/trunk/Torta
local tEditor = widgets.taskEditor; |
function Checklist3:InitializeChecklist() |
self:LoadList(nil); |
if type(Torta.db.profile.cfg.loadedList) == "number" then |
self:LoadList(Torta.db.profile.cfg.loadedList); |
else |
self:LoadList(nil) |
end |
self:ListLoadedCheck(); |
if not self:IsEditTaskDialogOpen() then |
widgets.removeTaskButton:Disable(); |
end |
end |
end |
gui:UpdateCLScrollBar(); |
gui:UpdateExplorerScrollBar(); |
self:ListLoadedCheck() |
end |
function Checklist3:GetLoadedList() |
return Torta.db.profile.lists[Torta.db.profile.cfg.loadedList]; |
end |
function Checklist3:ListLoadedCheck() |
if not self:GetLoadedList() then |
widgets.checkAllButton:Disable(); |
widgets.uncheckAllButton:Disable(); |
else |
widgets.checkAllButton:Enable(); |
widgets.uncheckAllButton:Enable(); |
end |
end |
function Checklist3:EditTask(taskID) |
if self.openTask and self.openTask == taskID then |
-- close the task editor |
dispWnd:SetPoint("BOTTOMRIGHT", widgets.taskBar, "TOPRIGHT"); |
tEditor:Hide(); |
self.openTask = nil; |
widgets.removeTaskButton:Disable(); |
end |
dispWnd:SetPoint(unpack(displayWindowPoints)); |
dispWnd:SetPoint("BOTTOMRIGHT", tEditor, "TOPRIGHT"); |
getglobal(tEditor:GetName() .. "HeaderText"):SetText("Task Editor: " .. (taskID or "|cffff0000No task ID|r")) |
widgets.removeTaskButton:Enable(); |
end |
function Checklist3:UncheckAll() |
function Checklist3:UncheckAllTasks() |
local list = self:GetLoadedList(); |
for i = 1, #list.stat do |
list.stat[i] = false; |
end |
gui:UpdateCLScrollBar(); |
end |
function Checklist3:CheckAll() |
function Checklist3:CheckAllTasks() |
local list = self:GetLoadedList(); |
for i = 1, #list.stat do |
list.stat[i] = true; |
end |
gui:UpdateCLScrollBar(); |
end |
function Checklist3:OnCheckClicked(id) |
local list = self:GetLoadedList() |
if list then |
list.stat[id] = not list.stat[id]; |
end |
gui:UpdateCLScrollBar(); |
end |
SlashCmdList["TORTA_RLUI"] = ReloadUI; |
SLASH_TORTA_RLUI1 = "/rl"; |
SlashCmdList["TORTA_GETWIDGETNAME"] = function() |
if GetMouseFocus() then |
print(GetMouseFocus():GetName()); |
else |
print("The cursor is not over a UI element."); |
end |
end |
SLASH_TORTA_GETWIDGETNAME1 = "/getname"; |
function Torta:OnInitialize() |
local aboutLabel = TortaParentFrameStartPageSidebarAboutText; |
aboutLabel:SetText("Torta is an addon written by Quezacolt of Aman'Thul based on the Checklist project.\n\nYour suggestions for Torta are always welcome :)"); |
local mainPage = TortaParentFrameMainPage; |
local explorerWindow = TortaParentFrameMainPageExplorerSubWindow; |
local explorerScrollBar = TortaParentFrameMainPageExplorerSubWindowScrollBar; |
local EXPLORER_LISTBUTTON_HEIGHT = 16; |
local clDisplayWindow = TortaParentFrameMainPageDisplaySubWindow; |
local clScrollBar = TortaParentFrameMainPageDisplaySubWindowScrollBar; |
local noLoadedListText = TortaParentFrameMainPageDisplaySubWindowNoLoadedListText; |
local clTopButton = TortaParentFrameMainPageDisplaySubWindowTaskButton1; |
local cl3HeaderText = TortaParentFrameMainPageDisplaySubWindowHeaderText; |
local taskEditor = TortaParentFrameMainPageTaskEditorSubWindow; |
local taskBar = TortaParentFrameMainPageTaskbar; |
local editTaskEB = TortaParentFrameMainPageTaskEditorSubWindowScrollFrameEditBox; |
local uncheckAllButton = TortaParentFrameMainPageTaskbarUncheckAllButton; |
local checkAllButton = TortaParentFrameMainPageTaskbarCheckAllButton; |
local removeTaskButton = TortaParentFrameMainPageTaskbarRemoveTaskButton; |
local cl3HeaderText = TortaParentFrameMainPageDisplaySubWindowHeaderText; |
local EXPLORER_LISTBUTTON_HEIGHT = 16; |
local Torta = Torta; |
-- Explorer subwindow stuff |
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) |
button.text:SetFormattedText("|cffffd000%i.)|r %s", lineplusoffset, self.data.text[lineplusoffset]); |
button.check:SetChecked(self.data.stat[lineplusoffset]); |
button:SetID(lineplusoffset); |
button.check:SetID(lineplusoffset); |
if lineplusoffset ~= Torta.cl3.openTask then |
button:UnlockHighlight(); |
<Offset x="5"/> |
</Anchor> |
</Anchors> |
<Scripts> |
<OnClick> |
Torta.cl3:UncheckAllTasks(); |
</OnClick> |
</Scripts> |
</Button> |
<Button name="$parentCheckAllButton" inherits="UIPanelButtonTemplate" text="Check All"> |
<Size x="100" y="22"/> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentUncheckAllButton" relativePoint="RIGHT"/> |
</Anchors> |
<Scripts> |
<OnClick> |
Torta.cl3:CheckAllTasks(); |
</OnClick> |
</Scripts> |
</Button> |
<Button name="$parentAddTaskButton" inherits="UIPanelButtonTemplate" text="Add A Task"> |
<Size x="100" y="22"/> |
</OnLoad> |
<OnUpdate> |
-- This is retardedly hackish, but the anchors trick doesnt work for some reason (WTF!) |
-- This is roughly how Checklist2 does it. |
-- This is roughly how Checklist2 does it, except because its window cannot be resized, |
-- it only does this once, at load time. |
self:GetParent().text:SetWidth(self:GetParent():GetWidth() - 38); |
</OnUpdate> |
<OnClick> |
Torta.cl3:OnCheckClicked(self:GetID()); |
</OnClick> |
</Scripts> |
</CheckButton> |
</Frames> |
</Anchor> |
</Anchors> |
</Button> |
<Button name="$parentTab3" inherits="TortaTabTemplate" text="Torta Notebook" id="3"> |
<Button name="$parentTab3" inherits="TortaTabTemplate" text="Torta Notebook (NYI)" id="3"> |
<Anchors> |
<Anchor point="LEFT" relativeTo="$parentTab2" relativePoint="RIGHT"> |
<Offset x="-15"/> |