Skip to content

Commit c49acaa

Browse files
committed
Auto clear checkbox for script output
1 parent 770bc7e commit c49acaa

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

src/Export/Classes/ScriptListControl.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ end
1515

1616
function ScriptListClass:OnSelClick(index, script, doubleClick)
1717
if doubleClick then
18+
if main.controls.clearAutoClearOutput.state then
19+
wipeTable(main.scriptOutput)
20+
end
1821
local errMsg = PLoadModule("Scripts/"..script..".lua")
1922
if errMsg then
2023
print(errMsg)

src/Export/Main.lua

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,10 @@ function main:Init()
208208
return #self.scriptOutput > 0
209209
end
210210
}
211-
212-
self.controls.helpText = new("LabelControl", {"TOPLEFT",self.controls.clearOutput,"BOTTOMLEFT"}, {0, 12, 100, 16}, "Press Ctrl+F5 to re-export\ndata from the game")
211+
self.controls.clearAutoClearOutput = new("CheckBoxControl", { "TOPLEFT", self.controls.clearOutput, "BOTTOMLEFT" }, { 120, 10, 20, 20 }, "Auto Clear Output:", function(state)
212+
self.clearAutoClearOutput = state
213+
end, nil, false)
214+
self.controls.helpText = new("LabelControl", {"TOPLEFT",self.controls.clearOutput,"BOTTOMLEFT"}, {0, 42, 100, 16}, "Press Ctrl+F5 to re-export\ndata from the game")
213215

214216
self.controls.scriptList = new("ScriptListControl", nil, {270, 35, 100, 300}) {
215217
shown = function()
@@ -435,6 +437,19 @@ function main:OnFrame()
435437
end
436438

437439
function main:OnKeyDown(key, doubleClick)
440+
-- Ctrl+F shortcut for focusing dat file Search
441+
if key == "f" and IsKeyDown("CTRL") then
442+
if self.controls and self.controls.datSearch and self.SelectControl then
443+
self:SelectControl(self.controls.datSearch)
444+
end
445+
return
446+
-- ESC key closes Dat window so that the script menu is shown.
447+
elseif key == "ESCAPE" then
448+
if self.controls and self.controls.scripts and self.SelectControl then
449+
self:SetCurrentDat()
450+
end
451+
return
452+
end
438453
t_insert(self.inputEvents, { type = "KeyDown", key = key, doubleClick = doubleClick })
439454
end
440455

@@ -592,23 +607,6 @@ function main:SaveSettings()
592607
end
593608
end
594609

595-
function main:OnKeyDown(key, doubleClick)
596-
-- Ctrl+F shortcut for focusing dat file Search
597-
if key == "f" and IsKeyDown("CTRL") then
598-
if self.controls and self.controls.datSearch and self.SelectControl then
599-
self:SelectControl(self.controls.datSearch)
600-
end
601-
return
602-
-- ESC key closes Dat window so that the script menu is shown.
603-
elseif key == "ESCAPE" then
604-
if self.controls and self.controls.scripts and self.SelectControl then
605-
self:SetCurrentDat()
606-
end
607-
return
608-
end
609-
t_insert(self.inputEvents, { type = "KeyDown", key = key, doubleClick = doubleClick })
610-
end
611-
612610
function main:DrawArrow(x, y, width, height, dir)
613611
local x1 = x - width / 2
614612
local x2 = x + width / 2

0 commit comments

Comments
 (0)