/trunk
cfg = { |
loadedList = false -- No more ListInUse/ListLastUsed madness like before. |
}, |
lists = {}, |
lists = { |
[1] = { |
meta = { |
listName = "CL3 Test List" |
}, |
text = { |
[1] = "Hello, world from Lua!" |
}, |
stat = { |
[1] = true |
} |
}, |
[2] = { |
meta = { |
listName = "Hello, world!" |
}, |
text = { |
[1] = "Peter Piper picked a peck of pickled pepper.", |
[2] = "She sells seashells on the seashore", |
[3] = "", |
[4] = "", |
[5] = "Hello, Torta!", |
[6] = "", |
[7] = "", |
[8] = "", |
[9] = "", |
[10] = "Hello, Checklist!", |
[11] = "", |
[12] = "", |
[13] = "", |
[14] = "", |
[15] = "Hello, Notebook!", |
[16] = "", |
[17] = "", |
[18] = "", |
[19] = "", |
[20] = "This addon was made using Notepad++.", |
[21] = "", |
[22] = "", |
[23] = ":D", |
}, |
stat = { |
[1] = true, |
[2] = false, |
[3] = true, |
[4] = false, |
[5] = false, |
[6] = false, |
[7] = true, |
[8] = true, |
[9] = true, |
[10] = true, |
[11] = false, |
[12] = false, |
[13] = false, |
[14] = false, |
[15] = false, |
[16] = false, |
[17] = false, |
[18] = false, |
[19] = false, |
[20] = false, |
[21] = false, |
[22] = false, |
[23] = false, |
} |
}, |
[3] = { |
meta = { |
listName = "Hello, cruel world!" |
}, |
text = { |
[1] = "Peter Piper picked a peck of pickled pepper.", |
[2] = "She sells seashells on the seashore", |
[3] = "", |
[4] = "", |
[5] = "Hello, Torta!", |
[6] = "", |
[7] = "", |
[8] = "I like xkcd. Do you?", |
[9] = "", |
[10] = "Hello, Checklist!", |
[11] = "", |
[12] = "", |
[13] = "Hello, Notebook!", |
[14] = "", |
[15] = "This addon was created using Notepad++.", |
[16] = "", |
[17] = "", |
[18] = "", |
[19] = "", |
[20] = "", |
[21] = "", |
[22] = "", |
[23] = ":D", |
}, |
stat = { |
[1] = true, |
[2] = false, |
[3] = true, |
[4] = false, |
[5] = false, |
[6] = false, |
[7] = true, |
[8] = true, |
[9] = true, |
[10] = true, |
[11] = false, |
[12] = false, |
[13] = false, |
[14] = false, |
[15] = false, |
[16] = false, |
[17] = false, |
[18] = false, |
[19] = false, |
[20] = false, |
[21] = false, |
[22] = false, |
[23] = false, |
} |
} |
}, |
notes = {} |
} |
} |
local editTaskEB = TortaParentFrameMainPageTaskEditorSubWindowScrollFrameEditBox; |
local uncheckAllButton = TortaParentFrameMainPageTaskbarUncheckAllButton; |
local checkAllButton = TortaParentFrameMainPageTaskbarCheckAllButton; |
local addTaskButton = TortaParentFrameMainPageTaskbarAddTaskButton; |
local removeTaskButton = TortaParentFrameMainPageTaskbarRemoveTaskButton; |
local explorerNoListsText = TortaParentFrameMainPageExplorerSubWindowNoListsText; |
local EXPLORER_LISTBUTTON_HEIGHT = 16; |
local Torta = Torta; |
---------------------------------------------------------------------------------------- |
Torta.gui.elements = {}; |
local e = Torta.gui.elements; |
e.mainWindow = mainWindow; |
e.startPage = startPage; |
e.explorerWindow = explorerWindow; |
e.explorerScrollBar = explorerScrollBar; |
e.clDisplayWindow = clDisplayWindow; |
e.clScrollBar = clScrollBar; |
e.noLoadedListText = noLoadedListText; |
e.clTopButton = clTopButton; |
e.cl3HeaderText = cl3HeaderText; |
e.taskEditor = taskEditor; |
e.taskBar = taskBar; |
e.editTaskEB = editTaskEB; |
e.uncheckAllButton = uncheckAllButton; |
e.checkAllButton = checkAllButton; |
e.addTaskButton = addTaskButton; |
e.removeTaskButton = removeTaskButton; |
e.explorerNoListsText = explorerNoListsText; |
e.mainWindow = mainWindow; |
e.startPage = startPage; |
e.explorerWindow = explorerWindow; |
e.explorerScrollBar = explorerScrollBar; |
e.clDisplayWindow = clDisplayWindow; |
e.clScrollBar = clScrollBar; |
e.noLoadedListText = noLoadedListText; |
e.clTopButton = clTopButton; |
e.cl3HeaderText = cl3HeaderText; |
e.taskEditor = taskEditor; |
e.taskBar = taskBar; |
e.editTaskEB = editTaskEB; |
e.uncheckAllButton = uncheckAllButton; |
e.checkAllButton = checkAllButton; |
e.removeTaskButton = removeTaskButton; |
e = nil; |
---------------------------------------------------------------------------------------- |
function Torta.gui.scalingFinishedFunc(frame) |
self = Torta.gui; |
local lineplusoffset; |
local button; |
explorerNoListsText:Hide(); |
if #Torta.db.profile.lists > 0 then |
local lists = Torta.db.profile.lists; |
FauxScrollFrame_Update(explorerScrollBar, #Torta.db.profile.lists, #self.exListButtons, 16, nil, nil, nil, nil, nil, nil, true) |
end |
end |
else |
explorerScrollBar:Hide(); |
explorerNoListsText:Show(); |
for i = 1, #self.exListButtons do |
self.exListButtons[i]:Hide(); |
end |
end |
end |
}, |
{ |
text = "Rename this list", |
func = function() end |
func = function() end |
}, |
{ |
text = "Delete this list", |
func = function() Torta.cl3:DeleteList(Torta.gui.selectedExplorerButton:GetID()); end |
func = function() end |
}, |
{ |
text = "", |
function Torta.gui:clShowButtonDropdown(button) |
assert(button); |
self.selectedExplorerButton = button; |
clListDropdownInfo[1].text = button:GetText(); |
EasyMenu(clListDropdownInfo, dropdown, "cursor", 0, 0, "MENU", 3); |
end |
<Anchor point="RIGHT" relativeTo="$parentHeaderTexture"/> |
</Anchors> |
</FontString> |
<FontString name="$parentNoListsText" inherits="GameFontHighlight" text="You do not appear to have any lists. Right-click here to open up a context menu to create one."> |
<Anchors> |
<Anchor point="LEFT"> |
<Offset x="5"/> |
</Anchor> |
<Anchor point="RIGHT"> |
<Offset x="-5"/> |
</Anchor> |
<Anchor point="TOP"/> |
<Anchor point="BOTTOM"/> |
</Anchors> |
</FontString> |
</Layer> |
</Layers> |
<Frames> |
local dispWnd = widgets.clDisplayWindow; |
local tEditor = widgets.taskEditor; |
local newListCount = 0; |
function Checklist3:InitializeChecklist() |
if type(Torta.db.profile.cfg.loadedList) == "number" then |
self:LoadList(Torta.db.profile.cfg.loadedList); |
if not self:GetLoadedList() then |
widgets.checkAllButton:Disable(); |
widgets.uncheckAllButton:Disable(); |
widgets.addTaskButton:Disable(); |
else |
widgets.checkAllButton:Enable(); |
widgets.uncheckAllButton:Enable(); |
widgets.addTaskButton:Enable(); |
end |
end |
function Checklist3:CreateList() |
newListCount = newListCount + 1; |
tinsert(Torta.db.profile.lists, { |
meta = { |
listName = "New List " .. newListCount |
listName = "New List" |
}, |
text = {}, |
stat = {} |
end |
function Checklist3:DeleteList(index) |
assert(index); |
local loadedListIndex = Torta.db.profile.cfg.loadedList; |
tremove(Torta.db.profile.lists, index); |
-- print(index, loadedListIndex); |
if loadedListIndex then |
if index < loadedListIndex then |
self:LoadList(loadedListIndex - 1); |
end |
end |
gui:UpdateExplorerScrollBar(); |
if not Torta.db.profile.lists[Torta.db.profile.cfg.loadedList] then |
Torta.db.profile.cfg.loadedList = false; |
gui:UpdateCLScrollBar(); |
end |
end |
function Checklist3:RestoreList() |