comparison Summary.lua @ 14:0fc8a54516d7

Altoholic is now marked as an optional dependency. Fixed the queue button so it doesn?t get recreated when a widget is re-used from the pool. Queue all button and queue single group buttons are now working. Items within a group being queued that couldn?t be found in the current profession will be announced. The goal is to put these into a new window from which you can queue these.
author Zerotorescue
date Mon, 18 Oct 2010 19:31:52 +0200
parents 5006cb0e97c6
children 8f5c02113c5c
comparison
equal deleted inserted replaced
13:5006cb0e97c6 14:0fc8a54516d7
44 local widget = AceGUI:Create("InlineGroup"); 44 local widget = AceGUI:Create("InlineGroup");
45 widget.type = widgetType; 45 widget.type = widgetType;
46 46
47 widget.MakeButton = function(self, buttonSettings) 47 widget.MakeButton = function(self, buttonSettings)
48 if type(buttonSettings) == "table" then 48 if type(buttonSettings) == "table" then
49 local button = CreateFrame("Button", nil, self.frame, "UIPanelButtonTemplate"); 49 if not self.btnQueue then
50 button:SetText(buttonSettings.name); 50 -- Because widgets are re-used, we don't want to recreate this button
51 button:SetHeight(22); 51 self.btnQueue = CreateFrame("Button", nil, self.frame, "UIPanelButtonTemplate");
52 button:SetWidth(120); 52 self.btnQueue:SetHeight(22);
53 button:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", -10, 5); 53 self.btnQueue:SetWidth(120);
54 button:SetScript("OnClick", buttonSettings.exec); 54 end
55 button.tooltipTitle = buttonSettings.name; 55 self.btnQueue:SetText(buttonSettings.name);
56 button.tooltip = buttonSettings.desc or ""; 56 self.btnQueue:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", -10, 5);
57 button:SetScript("OnEnter", ShowTooltip); 57
58 button:SetScript("OnLeave", HideTooltip); 58 -- Triggers
59 self.btnQueue:SetScript("OnClick", buttonSettings.exec);
60
61 -- Tooltip
62 self.btnQueue.tooltipTitle = buttonSettings.name;
63 self.btnQueue.tooltip = buttonSettings.desc or "";
64 self.btnQueue:SetScript("OnEnter", ShowTooltip);
65 self.btnQueue:SetScript("OnLeave", HideTooltip);
59 else 66 else
60 error("settings must be a table - usage: MakeButton(table);"); 67 error("settings must be a table - usage: MakeButton(table);");
61 end 68 end
62 end 69 end;
63 70
64 return widget; 71 return widget;
65 end 72 end
66 73
67 AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion); 74 AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion);
181 mod.scrollFrame:AddChild(lblSpacer); 188 mod.scrollFrame:AddChild(lblSpacer);
182 189
183 -- Speed slider 190 -- Speed slider
184 local sdrSpeed = AceGUI:Create("Slider"); 191 local sdrSpeed = AceGUI:Create("Slider");
185 sdrSpeed:SetLabel("Processing speed"); 192 sdrSpeed:SetLabel("Processing speed");
186 sdrSpeed:SetSliderValues(0.01, 5, 0.01); 193 sdrSpeed:SetSliderValues(0.01, 5, 0.05);
187 sdrSpeed:SetIsPercent(true); 194 sdrSpeed:SetIsPercent(true);
188 sdrSpeed:SetRelativeWidth(.3); 195 sdrSpeed:SetRelativeWidth(.3);
189 sdrSpeed:SetCallback("OnMouseUp", function(self, event, value) 196 sdrSpeed:SetCallback("OnMouseUp", function(self, event, value)
190 addon.db.global.defaults.summary.speed = ceil( value * 100 / 5 ); 197 addon.db.global.defaults.summary.speed = ceil( value * 100 / 5 );
191 198
227 -- Queue all button 234 -- Queue all button
228 local btnQueueAll = AceGUI:Create("Button"); 235 local btnQueueAll = AceGUI:Create("Button");
229 btnQueueAll:SetText("Queue All"); 236 btnQueueAll:SetText("Queue All");
230 btnQueueAll:SetRelativeWidth(.2); 237 btnQueueAll:SetRelativeWidth(.2);
231 btnQueueAll:SetCallback("OnClick", function() 238 btnQueueAll:SetCallback("OnClick", function()
232 239 self:SendMessage("IM_QUEUE_ALL");
233 end); 240 end);
234 btnQueueAll:SetCallback("OnEnter", ShowTooltip); 241 btnQueueAll:SetCallback("OnEnter", ShowTooltip);
235 btnQueueAll:SetCallback("OnLeave", HideTooltip); 242 btnQueueAll:SetCallback("OnLeave", HideTooltip);
236 btnQueueAll.frame.tooltipTitle = "Queue all"; 243 btnQueueAll.frame.tooltipTitle = "Queue all";
237 btnQueueAll.frame.tooltip = "Queue everything that requires restocking within every single visible group."; 244 btnQueueAll.frame.tooltip = "Queue everything that requires restocking within every single visible group.";
268 iGroup:SetLayout("Flow"); 275 iGroup:SetLayout("Flow");
269 iGroup:MakeButton({ 276 iGroup:MakeButton({
270 name = "Queue", 277 name = "Queue",
271 desc = "Queue all items in this group.", 278 desc = "Queue all items in this group.",
272 exec = function() 279 exec = function()
273 print(groupName); 280 print("Queueing all items within " .. groupName .. " craftable by the currently open profession.");
281 self:SendMessage("IM_QUEUE_GROUP", groupName);
274 end, 282 end,
275 }); 283 });
276 284
277 285
278 286