WoWInterface SVN Torta

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 35 to Rev 36
    Reverse comparison

Rev 35 → Rev 36

Torta/CL3.lua
1,4 → 1,7
-- CL3.lua
-- ====================================================================
-- CL3.lua
-- Contains code for performing operations on list data
-- ====================================================================
local Torta = Torta;
local Checklist3 = Torta.cl3;
local gui = Torta.gui;
243,10 → 246,27
end
end
percent = format("%.1f", (checked / total) * 100);
-- Fix this sometime.
-- widgets.statsButton:SetFormattedText("Tasks: %d/%d (%s(%))", checked, total, percent);
widgets.statsButton:SetText("Tasks: " .. checked .. "/" .. total .. " (" .. percent .. "%)");
widgets.statsButton:SetFormattedText("Tasks: %d/%d (%s)", checked, total, percent .. "%");
else
widgets.statsButton:SetText("");
end
end
 
-- Drop handler functions
function Checklist3:MoveTask(SrcID, DestID)
local list = self:GetLoadedList();
local text = list.text[SrcID];
local stat = list.stat[SrcID];
 
if DestID > #list.text then -- If the button was dragged to be below the last item
DestID = #list.text;
end
 
tremove(list.text, SrcID);
tremove(list.stat, SrcID);
 
tinsert(list.text, DestID, text);
tinsert(list.stat, DestID, stat);
 
gui:UpdateCLScrollBar();
end
Torta/UIManager.lua
99,6 → 99,9
function Torta.gui:OnTabClicked(tabID)
assert(type(tabID) == "number");
PanelTemplates_SetTab(mainWindow, tabID);
if Torta.cl3.HideTaskEditor then
Torta.cl3:HideTaskEditor();
end
if tabID == 1 then
startPage:Show();
mainPage:Hide();
106,6 → 109,7
self.tab = tabID;
startPage:Hide();
mainPage:Show();
self:UpdateExplorerScrollBar();
if tabID == 2 then
clDisplayWindow:Show();
clTaskBar:Show();
119,16 → 123,12
nbDisplayWindow:Show();
nbTaskBar:Show();
end
self:UpdateExplorerScrollBar();
end
if Torta.cl3.HideTaskEditor then
Torta.cl3:HideTaskEditor();
end
end
 
 
function Torta.gui:Initialize()
Torta.gui:clHideDropHandlers();
 
end
 
-- Explorer listbox code
319,6 → 319,14
button.check:SetID(lineplusoffset);
button:SetID(lineplusoffset);
 
local topText = "Insert above task " .. lineplusoffset;
local btmText = "Insert below task " .. lineplusoffset;
 
button.topDropHandler:SetFormattedText("%s - %s - %s", topText, topText, topText);
button.topDropHandler.destLoc = lineplusoffset;
button.bottomDropHandler:SetFormattedText("%s - %s - %s", btmText, btmText, btmText);
button.bottomDropHandler.destLoc = lineplusoffset + 1;
 
if lineplusoffset ~= Torta.cl3.openTask then
button:UnlockHighlight();
else
383,7 → 391,7
end
 
FauxScrollFrame_SetOffset(clScrollBar, offset);
FauxScrollFrame_Update(clScrollBar, #self:GetLoadedList().text, #self.clListButtons, 32, nil, nil, nil, nil, nil, nil, true)
FauxScrollFrame_Update(clScrollBar, #Torta.cl3:GetLoadedList().text, #self.clListButtons, 32, nil, nil, nil, nil, nil, nil, true)
self:CheckCLButtons();
self:UpdateCLScrollBar();
offset = offset + 1
393,12 → 401,14
end
 
-- ====================================================================
-- Drop handler functions
-- Drag and drop functions
-- ====================================================================
function Torta.gui:clShowDropHandlers()
for _, button in pairs(self.clListButtons) do
button.topDropHandler:Show();
button.bottomDropHandler:Show();
UIFrameFadeOut(button.text, 0.3, button.text:GetAlpha(), 0.5);
UIFrameFadeOut(button.check, 0.3, button.check:GetAlpha(), 0.5);
end
end
 
406,20 → 416,32
for _, button in pairs(self.clListButtons) do
button.topDropHandler:Hide();
button.bottomDropHandler:Hide();
UIFrameFadeIn(button.text, 0.3, button.text:GetAlpha(), 1);
UIFrameFadeIn(button.check, 0.3, button.check:GetAlpha(), 1);
end
end
 
function Torta.gui:clTaskDragStart(taskButton)
PlaySound("INTERFACESOUND_CURSORGRABOBJECT");
local text = taskButton.text:GetText();
local stat = taskButton.check:GetChecked();
TortaDragThingy.text:SetText(text);
TortaDragThingy.check:SetChecked(stat);
TortaDragThingy:Show();
UIFrameFadeIn(TortaDragThingy, 0.25, 0.5, 1);
UIFrameFadeIn(TortaDragThingy, 0.25, 0, 1);
self:clShowDropHandlers();
self.dragSrcID = taskButton:GetID();
end
 
function Torta.gui:clTaskDragStop()
PlaySound("INTERFACESOUND_CURSORDROPOBJECT");
TortaDragThingy:Hide();
if GetMouseFocus().tortaDropType == "CLTASK" then
UIErrorsFrame:AddMessage("This is a valid drop area!");
Torta.cl3:MoveTask(self.dragSrcID, GetMouseFocus().destLoc);
GetMouseFocus():Hide(); -- If this line isn't here, the drop handler under the mouse will fail to hide
end
self:clHideDropHandlers();
end
 
-- Note:
Torta/Windows/DisplayWindow.xml
210,6 → 210,9
Torta.cl3:ModifyOpenTask( getglobal( self:GetParent():GetName() .. "EditBox" ):GetText() );
Torta.gui:UpdateCLScrollBar();
Torta.cl3:HideTaskEditor();
else
-- Add a setting that stops the editor from closing when escape is pressed sometime later.
Torta.cl3:HideTaskEditor();
end
</OnEscapePressed>
<OnEnterPressed>
Torta/Windows/Templates.xml
94,6 → 94,18
fs:SetJustifyV("TOP");
self.text = fs;
</OnLoad>
<OnEnter>
if self.text:GetStringWidth() >= (self:GetWidth() - 10) then
GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT");
GameTooltip:AddLine(self.text:GetText());
GameTooltip:Show();
end
</OnEnter>
<OnLeave>
if GameTooltip:IsOwned(self) then
GameTooltip:Hide();
end
</OnLeave>
</Scripts>
</Button>
 
120,12 → 132,15
self.dragFlag = true;
</OnMouseDown>
<OnMouseUp>
if not self.dragFlag then
Torta.gui:clTaskDragStop();
end
self.dragFlag = false;
Torta.gui:clTaskDragStop();
</OnMouseUp>
<OnLeave>
if self.dragFlag then
Torta.gui:clTaskDragStart(self);
self.dragFlag = false;
end
</OnLeave>
</Scripts>
161,7 → 176,7
</Scripts>
</CheckButton>
<!-- Drop areas -->
<Button name="$parentTopDropHandler" text="Top" hidden="true">
<Button name="$parentTopDropHandler" text="Above this task" hidden="true" alpha="0">
<NormalFont style="GameFontNormal"/>
<Anchors>
<Anchor point="TOPLEFT"/>
172,9 → 187,18
self.tortaDropType = "CLTASK";
self:GetParent().topDropHandler = self;
</OnLoad>
<OnEnter>
UIFrameFadeIn(self, 0.3, self:GetAlpha(), 1);
</OnEnter>
<OnLeave>
UIFrameFadeOut(self, 0.3, self:GetAlpha(), 0);
</OnLeave>
<OnUpdate>
 
</OnUpdate>
</Scripts>
</Button>
<Button name="$parentBottomDropHandler" text="Bottom" hidden="true">
<Button name="$parentBottomDropHandler" text="Below this task" hidden="true" alpha="0">
<NormalFont style="GameFontNormal"/>
<Anchors>
<Anchor point="TOPLEFT" relativePoint="LEFT"/>
185,6 → 209,15
self.tortaDropType = "CLTASK";
self:GetParent().bottomDropHandler = self;
</OnLoad>
<OnEnter>
UIFrameFadeIn(self, 0.3, self:GetAlpha(), 1);
</OnEnter>
<OnLeave>
UIFrameFadeOut(self, 0.3, self:GetAlpha(), 0);
</OnLeave>
<OnUpdate>
 
</OnUpdate>
</Scripts>
</Button>
<!-- End of drop areas -->
209,7 → 242,8
</Layers>
</ScrollFrame>
 
<Frame name="TortaDragThingy" inherits="TortaTooltipStyleFrameTemplate" parent="UIParent" frameStrata="TOOLTIP">
<Frame name="TortaDragThingy" inherits="TortaTooltipStyleFrameTemplate" parent="UIParent"
frameStrata="TOOLTIP" hidden="true">
<Size x="200" y="40"/>
<Anchors>
<Anchor point="CENTER"/>
Torta/Windows/TortaParentFrame.xml
90,7 → 90,7
Torta.gui:CheckExplorerWindow();
</OnMouseUp>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_CURSOR");
GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT");
GameTooltip:AddLine("Drag here to resize the Torta window.");
GameTooltip:Show();
</OnEnter>
119,7 → 119,7
Torta.gui:CheckExplorerWindow();
</OnMouseUp>
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_CURSOR");
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT");
GameTooltip:AddLine("Drag here to resize the Torta window.");
GameTooltip:Show();
</OnEnter>