e504f88167
Three features layered onto the Turtle WoW baseline: - Account manager (AccountLogin.lua / .xml): saved-account list backed by Windows Credential Manager via ClassicAPI. Pass-through to LoginWithSavedAccount; per-account 'last used' timestamp; password field hides itself when the typed name matches a saved entry and a 'Change password' button reveals it on demand. - Character reordering (CharacterSelect.lua / .xml): drag-to-reorder the character list, persisted via ClassicAPI's GetSavedCharacterOrder / SetSavedCharacterOrder. - Glue Lua console (GlueConsole.lua / .xml, new files): in-glue RunScript console reachable from the title and char-select screens. Currently no key opens the console — the backtick binding was removed pending a ClassicAPI EditBox arrow/key script handler (see TODO.md section 96).
66 lines
1.9 KiB
Lua
66 lines
1.9 KiB
Lua
GLUE_CONSOLE_MAX_LINES = 200;
|
|
|
|
function GlueConsole_OnLoad()
|
|
GlueConsoleOutput:SetFading(false);
|
|
GlueConsoleOutput:SetMaxLines(GLUE_CONSOLE_MAX_LINES);
|
|
GlueConsoleOutput:SetJustifyH("LEFT");
|
|
|
|
-- ChatFrameBackground is a white pixel; tint to dark + faint border.
|
|
GlueConsoleInput:SetBackdropColor(0, 0, 0, 0.7);
|
|
GlueConsoleInput:SetBackdropBorderColor(0.4, 0.4, 0.4, 1);
|
|
|
|
-- Route print() output into the console so RunScript("print(...)") is visible.
|
|
local original_print = print;
|
|
print = function(...)
|
|
local parts = {};
|
|
for i = 1, arg.n do
|
|
parts[i] = tostring(arg[i]);
|
|
end
|
|
GlueConsole_Print(table.concat(parts, " "));
|
|
if ( original_print ) then
|
|
original_print(unpack(arg));
|
|
end
|
|
end
|
|
end
|
|
|
|
function GlueConsole_Print(msg)
|
|
if ( msg == nil ) then msg = "nil"; end
|
|
GlueConsoleOutput:AddMessage(tostring(msg));
|
|
end
|
|
|
|
function GlueConsole_Toggle()
|
|
if ( GlueConsoleFrame:IsVisible() ) then
|
|
GlueConsoleInput:ClearFocus();
|
|
GlueConsoleFrame:Hide();
|
|
else
|
|
GlueConsoleFrame:Show();
|
|
GlueConsoleFrame:Raise();
|
|
GlueConsoleInput:SetFocus();
|
|
end
|
|
end
|
|
|
|
-- Returns true if a backtick was found in the EditBox text. Strips it and toggles the console.
|
|
-- Used as an OnTextChanged interceptor so backtick still toggles the console while an EditBox has focus
|
|
-- (the parent frame's OnKeyDown doesn't fire when an EditBox has consumed the keystroke).
|
|
function GlueConsole_StripBacktickAndToggle(editBox)
|
|
local text = editBox:GetText();
|
|
if ( text == nil ) then return false; end
|
|
if ( string.find(text, "`", 1, true) == nil ) then return false; end
|
|
editBox:SetText((string.gsub(text, "`", "")));
|
|
GlueConsole_Toggle();
|
|
return true;
|
|
end
|
|
|
|
function GlueConsole_Submit()
|
|
local text = GlueConsoleInput:GetText();
|
|
GlueConsoleInput:SetText("");
|
|
if ( text == nil or text == "" ) then return; end
|
|
|
|
GlueConsole_Print("> " .. text);
|
|
if ( RunScript ) then
|
|
RunScript(text);
|
|
else
|
|
GlueConsole_Print("|cffff4444RunScript is not available in this context|r");
|
|
end
|
|
end
|