/trunk
end |
function Checklist3:DeleteList(index) |
print(Torta.db.profile.cfg.loadedList); |
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 |
print(index, loadedListIndex, index < loadedListIndex); |
self:LoadList(nil); |
self:LoadList(loadedListIndex - 1); |
end |
end |
gui:UpdateExplorerScrollBar(); |
if not Torta.db.profile.lists[Torta.db.profile.cfg.loadedList] then |
print(Torta.db.profile.cfg.loadedList); |
Torta.db.profile.cfg.loadedList = false; |
self:LoadList(nil); |
gui:UpdateCLScrollBar(); |
end |
end |
function Checklist3:RenameList(listID, newName) |
print(listID, newName); |
if not (type(newName) == "string") then |
print(":D"); |
StaticPopup_Show("TORTA_CLRENAMELIST", Torta.db.profile.lists[listID].meta.listName); |
else |
Torta.db.profile.lists[listID].meta.listName = newName; |
gui:UpdateExplorerScrollBar(); |
gui:UpdateCLScrollBar(); |
end |
end |
function Checklist3:RestoreList() |
end |
if self.data then |
noLoadedListText:Hide(); |
cl3HeaderText:SetText(self.data.meta.listName); |
FauxScrollFrame_Update(clScrollBar, #self.data.text, #self.clListButtons, 32, nil, nil, nil, nil, nil, nil, true) |
if not isFromOnShow then |
clScrollBar:Show(); |
-- print(offset, scrollBar:GetValue()); |
end |
-- Note: |
-- Add all UI management functions ABOVE! |
-- ==================================================================== |
-- Dropdown menu stuff |
-- ==================================================================== |
local clExplorerDropdownInfo = { |
{ |
text = "Turtle Explorer", |
}, |
{ |
text = "Rename this list", |
func = function() end |
func = function() Torta.cl3:RenameList(Torta.gui.selectedExplorerButton:GetID()); end |
}, |
{ |
text = "Delete this list", |
EasyMenu(clExplorerDropdownInfo, dropdown, "cursor", 0, 0, "MENU", 3); |
end |
-- ==================================================================== |
-- Dialogs |
-- ==================================================================== |
StaticPopupDialogs["TORTA_CLRENAMELIST"] = { |
text = "Please enter the new name for the list currently named \"|cffffd000%s|r\":", |
OnAccept = function(button) |
local newName = getglobal(button:GetParent():GetName() .. "EditBox"):GetText(); |
Torta.cl3:RenameList(Torta.gui.selectedExplorerButton:GetID(), newName); |
button:GetParent():Hide(); |
end, |
EditBoxOnEnterPressed = function(editBox) |
print(editBox:GetName()); |
local newName = editBox:GetText(); |
print(newName); |
Torta.cl3:RenameList(Torta.gui.selectedExplorerButton:GetID(), newName); |
editBox:GetParent():Hide(); |
end, |
button1 = ACCEPT, |
button2 = CANCEL, |
whileDead = 1, |
timeout = 30, |
hasEditBox = 1, |
hideOnEscape = 1, |
} |
-- ==================================================================== |
-- Misc. UI init code |
-- ==================================================================== |
FauxScrollFrame_SetOffset(explorerScrollBar, 0); |
FauxScrollFrame_SetOffset(clScrollBar, 0); |
<Anchor point="RIGHT" relativeTo="$parentHeaderTexture"/> |
</Anchors> |
</FontString> |
<FontString name="$parentHelpText" inherits="GameFontHighlight" justifyH="LEFT" text="|cffffd000Note|r: Only the first three lines of text will be displayed."> |
<FontString name="$parentHelpText" inherits="GameFontHighlight" justifyH="LEFT" text="|cffffd000Hint|r: You can press Shift-ESC to save your task."> |
<Anchors> |
<Anchor point="BOTTOMLEFT"> |
<Offset x="6" y="9"/> |