diff --git a/src/Classes/CalcsTab.lua b/src/Classes/CalcsTab.lua index 7a6bf43e09..a7e76fa718 100644 --- a/src/Classes/CalcsTab.lua +++ b/src/Classes/CalcsTab.lua @@ -32,7 +32,7 @@ local CalcsTabClass = newClass("CalcsTab", "UndoHandler", "ControlHost", "Contro self.colWidth = 230 self.sectionList = { } - self.controls.search = new("EditControl", {"TOPLEFT",self,"TOPLEFT"}, 4, 5, 260, 20, "", "Search", "%c", 100, nil, nil, nil, true) + self.controls.search = new("EditControl", {"TOPLEFT",self,"TOPLEFT"}, {4, 5, 260, 20}, "", "Search", "%c", 100, nil, nil, nil, true) t_insert(self.controls, self.controls.search) -- Special section for skill/mode selection diff --git a/src/Classes/ConfigSetListControl.lua b/src/Classes/ConfigSetListControl.lua index 9a7f50f34b..b4c50e36db 100644 --- a/src/Classes/ConfigSetListControl.lua +++ b/src/Classes/ConfigSetListControl.lua @@ -7,10 +7,10 @@ local t_insert = table.insert local t_remove = table.remove local m_max = math.max -local ConfigSetListClass = newClass("ConfigSetListControl", "ListControl", function(self, anchor, x, y, width, height, configTab) - self.ListControl(anchor, x, y, width, height, 16, "VERTICAL", true, configTab.configSetOrderList) +local ConfigSetListClass = newClass("ConfigSetListControl", "ListControl", function(self, anchor, rect, configTab) + self.ListControl(anchor, rect, 16, "VERTICAL", true, configTab.configSetOrderList) self.configTab = configTab - self.controls.copy = new("ButtonControl", {"BOTTOMLEFT",self,"TOP"}, 2, -4, 60, 18, "Copy", function() + self.controls.copy = new("ButtonControl", {"BOTTOMLEFT",self,"TOP"}, {2, -4, 60, 18}, "Copy", function() local configSet = configTab.configSets[self.selValue] local newConfigSet = copyTable(configSet) newConfigSet.id = 1 @@ -23,30 +23,30 @@ local ConfigSetListClass = newClass("ConfigSetListControl", "ListControl", funct self.controls.copy.enabled = function() return self.selValue ~= nil end - self.controls.delete = new("ButtonControl", {"LEFT",self.controls.copy,"RIGHT"}, 4, 0, 60, 18, "Delete", function() + self.controls.delete = new("ButtonControl", {"LEFT",self.controls.copy,"RIGHT"}, {4, 0, 60, 18}, "Delete", function() self:OnSelDelete(self.selIndex, self.selValue) end) self.controls.delete.enabled = function() return self.selValue ~= nil and #self.list > 1 end - self.controls.rename = new("ButtonControl", {"BOTTOMRIGHT",self,"TOP"}, -2, -4, 60, 18, "Rename", function() + self.controls.rename = new("ButtonControl", {"BOTTOMRIGHT",self,"TOP"}, {-2, -4, 60, 18}, "Rename", function() self:RenameSet(configTab.configSets[self.selValue]) end) self.controls.rename.enabled = function() return self.selValue ~= nil end - self.controls.new = new("ButtonControl", {"RIGHT",self.controls.rename,"LEFT"}, -4, 0, 60, 18, "New", function() + self.controls.new = new("ButtonControl", {"RIGHT",self.controls.rename,"LEFT"}, {-4, 0, 60, 18}, "New", function() self:RenameSet(configTab:NewConfigSet(), true) end) end) function ConfigSetListClass:RenameSet(configSet, addOnName) local controls = { } - controls.label = new("LabelControl", nil, 0, 20, 0, 16, "^7Enter name for this config set:") - controls.edit = new("EditControl", nil, 0, 40, 350, 20, configSet.title, nil, nil, 100, function(buf) + controls.label = new("LabelControl", nil, {0, 20, 0, 16}, "^7Enter name for this config set:") + controls.edit = new("EditControl", nil, {0, 40, 350, 20}, configSet.title, nil, nil, 100, function(buf) controls.save.enabled = buf:match("%S") end) - controls.save = new("ButtonControl", nil, -45, 70, 80, 20, "Save", function() + controls.save = new("ButtonControl", nil, {-45, 70, 80, 20}, "Save", function() configSet.title = controls.edit.buf self.configTab.modFlag = true if addOnName then @@ -59,7 +59,7 @@ function ConfigSetListClass:RenameSet(configSet, addOnName) main:ClosePopup() end) controls.save.enabled = false - controls.cancel = new("ButtonControl", nil, 45, 70, 80, 20, "Cancel", function() + controls.cancel = new("ButtonControl", nil, {45, 70, 80, 20}, "Cancel", function() if addOnName then self.configTab.configSets[configSet.id] = nil end diff --git a/src/Classes/ConfigTab.lua b/src/Classes/ConfigTab.lua index 48776ba583..28de4d9598 100644 --- a/src/Classes/ConfigTab.lua +++ b/src/Classes/ConfigTab.lua @@ -35,10 +35,10 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont self.toggleConfigs = false - self.controls.sectionAnchor = new("LabelControl", { "TOPLEFT", self, "TOPLEFT" }, 0, 20, 0, 0, "") + self.controls.sectionAnchor = new("LabelControl", { "TOPLEFT", self, "TOPLEFT" }, { 0, 20, 0, 0 }, "") -- Set selector - self.controls.setSelect = new("DropDownControl", { "TOPLEFT", self.controls.sectionAnchor, "TOPLEFT" }, 76, -12, 210, 20, nil, function(index, value) + self.controls.setSelect = new("DropDownControl", { "TOPLEFT", self.controls.sectionAnchor, "TOPLEFT" }, { 76, -12, 210, 20 }, nil, function(index, value) self:SetActiveConfigSet(self.configSetOrderList[index]) self:AddUndoState() end) @@ -46,15 +46,15 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont self.controls.setSelect.enabled = function() return #self.configSetOrderList > 1 end - self.controls.setLabel = new("LabelControl", { "RIGHT", self.controls.setSelect, "LEFT" }, -2, 0, 0, 16, "^7Config set:") - self.controls.setManage = new("ButtonControl", { "LEFT", self.controls.setSelect, "RIGHT" }, 4, 0, 90, 20, "Manage...", function() + self.controls.setLabel = new("LabelControl", { "RIGHT", self.controls.setSelect, "LEFT" }, { -2, 0, 0, 16 }, "^7Config set:") + self.controls.setManage = new("ButtonControl", { "LEFT", self.controls.setSelect, "RIGHT" }, { 4, 0, 90, 20 }, "Manage...", function() self:OpenConfigSetManagePopup() end) - self.controls.search = new("EditControl", { "TOPLEFT", self.controls.sectionAnchor, "TOPLEFT" }, 8, 15, 360, 20, "", "Search", "%c", 100, function() + self.controls.search = new("EditControl", { "TOPLEFT", self.controls.sectionAnchor, "TOPLEFT" }, { 8, 15, 360, 20 }, "", "Search", "%c", 100, function() self:UpdateControls() end, nil, nil, true) - self.controls.toggleConfigs = new("ButtonControl", { "LEFT", self.controls.search, "RIGHT" }, 10, 0, 200, 20, function() + self.controls.toggleConfigs = new("ButtonControl", { "LEFT", self.controls.search, "RIGHT" }, { 10, 0, 200, 20 }, function() -- dynamic text return self.toggleConfigs and "Hide Ineligible Configurations" or "Show All Configurations" end, function() @@ -144,8 +144,7 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont local lastSection for _, varData in ipairs(varList) do if varData.section then - lastSection = new("SectionControl", {"TOPLEFT",self.controls.search,"BOTTOMLEFT"}, 0, 0, 360, 0, varData.section) - lastSection = new("SectionControl", {"TOPLEFT",self,"TOPLEFT"}, {0, 0, 360, 0}, varData.section) + lastSection = new("SectionControl", {"TOPLEFT",self.controls.search,"BOTTOMLEFT"}, {0, 0, 360, 0}, varData.section) lastSection.varControlList = { } lastSection.col = varData.col lastSection.height = function(self) @@ -198,7 +197,7 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont self.build.buildFlag = true end, 16) elseif varData.type == "text" and varData.resizable then - control = new("ResizableEditControl", {"TOPLEFT",lastSection,"TOPLEFT"}, 8, 0, nil, 344, nil, nil, 118, 118 + 16 * 40, "", nil, "^%C\t\n", nil, function(buf, placeholder) + control = new("ResizableEditControl", {"TOPLEFT",lastSection,"TOPLEFT"}, {8, 0, 344, 118, nil, nil, nil, 118 + 16 * 40}, "", nil, "^%C\t\n", nil, function(buf, placeholder) if placeholder then self.configSets[self.activeConfigSetId].placeholder[varData.var] = tostring(buf) else @@ -936,8 +935,8 @@ end function ConfigTabClass:OpenConfigSetManagePopup() main:OpenPopup(370, 290, "Manage Config Sets", { - new("ConfigSetListControl", nil, 0, 50, 350, 200, self), - new("ButtonControl", nil, 0, 260, 90, 20, "Done", function() + new("ConfigSetListControl", nil, {0, 50, 350, 200}, self), + new("ButtonControl", nil, {0, 260, 90, 20}, "Done", function() main:ClosePopup() end), }) diff --git a/src/Classes/Control.lua b/src/Classes/Control.lua index 45f550ae6d..110eb6884e 100644 --- a/src/Classes/Control.lua +++ b/src/Classes/Control.lua @@ -24,9 +24,12 @@ local rect = { y, width, height, + } + + could possibly have minWidth, minHeight, - } + for containers --]] local ControlClass = newClass("Control", function(self, anchor, rect) diff --git a/src/Classes/DraggerControl.lua b/src/Classes/DraggerControl.lua index cba2489bb0..de331cbb04 100644 --- a/src/Classes/DraggerControl.lua +++ b/src/Classes/DraggerControl.lua @@ -3,8 +3,8 @@ -- Class: Dragger Button Control -- Dragger button control. -- -local DraggerClass = newClass("DraggerControl", "Control", "TooltipHost", function(self, anchor, x, y, width, height, label, onKeyDown, onKeyUp, onRightClick, onHover, forceTooltip) - self.Control(anchor, x, y, width, height) +local DraggerClass = newClass("DraggerControl", "Control", "TooltipHost", function(self, anchor, rect, label, onKeyDown, onKeyUp, onRightClick, onHover, forceTooltip) + self.Control(anchor, rect) self.TooltipHost() self.label = label self.onKeyDown = onKeyDown diff --git a/src/Classes/ExtBuildListControl.lua b/src/Classes/ExtBuildListControl.lua index a8b635036d..fb6070ba69 100644 --- a/src/Classes/ExtBuildListControl.lua +++ b/src/Classes/ExtBuildListControl.lua @@ -11,8 +11,8 @@ local m_min = math.min local dkjson = require "dkjson" local ExtBuildListControlClass = newClass("ExtBuildListControl", "ControlHost", "Control", - function(self, anchor, x, y, width, height, providers) - self.Control(anchor, x, y, width, height) + function(self, anchor, rect, providers) + self.Control(anchor, rect) self.ControlHost() self:SelectControl() @@ -39,7 +39,7 @@ function ExtBuildListControlClass:Init(providerName) wipeTable(self.controls) wipeTable(self.tabs) - self.controls.sort = new("DropDownControl", { "TOP", self, "TOP" }, 0, -20, self.providerMaxLength, 20, + self.controls.sort = new("DropDownControl", { "TOP", self, "TOP" }, { 0, -20, self.providerMaxLength, 20 }, self.buildProvidersList, function(index, value) self:Init(value) end) @@ -72,7 +72,7 @@ function ExtBuildListControlClass:Init(providerName) if lastControl then anchor = { "LEFT", lastControl, "RIGHT" } end - local button = new("ButtonControl", anchor, 0, lastControl and 0 or -20, stringWidth + 10, 20, title, function() + local button = new("ButtonControl", anchor, { 0, lastControl and 0 or -20, stringWidth + 10, 20 }, title, function() if self.activeListProvider:GetActiveList() == title then return end @@ -105,7 +105,7 @@ function ExtBuildListControlClass:Init(providerName) return (self.width() - self.controls.sort.width()) / 2 end - self.controls.scrollBarV = new("ScrollBarControl", { "RIGHT", self, "RIGHT" }, -1, 0, self.scroll and 16 or 0, 0, + self.controls.scrollBarV = new("ScrollBarControl", { "RIGHT", self, "RIGHT" }, { -1, 0, self.scroll and 16 or 0, 0 }, 80, "VERTICAL") { -- y = function() -- return (self.scrollH and -8 or 0) @@ -120,7 +120,7 @@ function ExtBuildListControlClass:Init(providerName) end if self.activeListProvider:GetPageUrl() then - self.controls.all = new("ButtonControl", { "BOTTOM", self, "BOTTOM" }, 0, 1, self.width, 20, "See All", + self.controls.all = new("ButtonControl", { "BOTTOM", self, "BOTTOM" }, { 0, 1, self.width, 20 }, "See All", function() local url = self.activeListProvider:GetPageUrl() if url then @@ -407,14 +407,14 @@ function ExtBuildListControlClass:Draw(viewPort, noTooltip) local relativeHeight = currentHeight + 10 - self.controls.scrollBarV.offset if relativeHeight > y and relativeHeight < self.height() + y - 10 then if build.buildLink then - local importButton = new("ButtonControl", nil, x, currentHeight - self.controls.scrollBarV.offset, 45, 20, "Import", function() + local importButton = new("ButtonControl", nil, { x, currentHeight - self.controls.scrollBarV.offset, 45, 20 }, "Import", function() self:importBuild(build) end) t_insert(self.controls, importButton) end if build.previewLink then - local previewButton = new("ButtonControl", nil, x + 50, currentHeight - self.controls.scrollBarV.offset, 60, 20, "Preview", function() + local previewButton = new("ButtonControl", nil, { x + 50, currentHeight - self.controls.scrollBarV.offset, 60, 20 }, "Preview", function() OpenURL(build.previewLink) end) t_insert(self.controls, previewButton) diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index 43ea8dfb5c..f325b6fa29 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -540,15 +540,15 @@ holding Shift will put it in the second.]]) end -- Section: Item Quality - self.controls.displayItemSectionQuality = new("Control", {"TOPLEFT",self.controls.displayItemSectionInfluence,"BOTTOMLEFT"}, 0, 0, 0, function() + self.controls.displayItemSectionQuality = new("Control", {"TOPLEFT",self.controls.displayItemSectionInfluence,"BOTTOMLEFT"}, {0, 0, 0, function() return (self.controls.displayItemQuality:IsShown() and self.controls.displayItemQualityEdit:IsShown()) and 28 or 0 - end) - self.controls.displayItemQuality = new("LabelControl", {"TOPLEFT",self.controls.displayItemSectionQuality,"TOPRIGHT"}, -4, 0, 0, 16, "^7Quality:") + end}) + self.controls.displayItemQuality = new("LabelControl", {"TOPLEFT",self.controls.displayItemSectionQuality,"TOPRIGHT"}, {-4, 0, 0, 16}, "^7Quality:") self.controls.displayItemQuality.shown = function() return self.displayItem and self.displayItem.quality and (self.displayItem.base.type ~= "Amulet" or self.displayItem.base.type ~= "Belt" or self.displayItem.base.type ~= "Jewel" or self.displayItem.base.type ~= "Quiver" or self.displayItem.base.type ~= "Ring") end - self.controls.displayItemQualityEdit = new("EditControl", {"LEFT",self.controls.displayItemQuality,"RIGHT"},2,0,60,20,nil,nil,"%D",2,function(buf) + self.controls.displayItemQualityEdit = new("EditControl", {"LEFT",self.controls.displayItemQuality,"RIGHT"}, {2, 0, 60, 20}, nil, nil, "%D", 2, function(buf) self.displayItem.quality = tonumber(buf) self.displayItem:BuildAndParseRaw() self:UpdateDisplayItemTooltip() @@ -558,9 +558,9 @@ holding Shift will put it in the second.]]) end -- Section: Catalysts - self.controls.displayItemSectionCatalyst = new("Control", {"TOPLEFT",self.controls.displayItemSectionQuality,"BOTTOMLEFT"}, 0, 0, 0, function() + self.controls.displayItemSectionCatalyst = new("Control", {"TOPLEFT",self.controls.displayItemSectionQuality,"BOTTOMLEFT"}, {0, 0, 0, function() return (self.controls.displayItemCatalyst:IsShown() or self.controls.displayItemCatalystQualityEdit:IsShown()) and 28 or 0 - end) + end}) self.controls.displayItemCatalyst = new("DropDownControl", {"TOPLEFT",self.controls.displayItemSectionCatalyst,"TOPRIGHT"}, {0, 0, 250, 20}, {"Catalyst","Abrasive (Attack)","Accelerating (Speed)","Fertile (Life & Mana)","Imbued (Caster)","Intrinsic (Attribute)","Noxious (Physical & Chaos Damage)", "Prismatic (Resistance)","Tempering (Defense)","Turbulent (Elemental)","Unstable (Critical)"}, @@ -583,7 +583,7 @@ holding Shift will put it in the second.]]) self.controls.displayItemCatalyst.shown = function() return self.displayItem and (self.displayItem.crafted or self.displayItem.hasModTags) and (self.displayItem.base.type == "Amulet" or self.displayItem.base.type == "Ring" or self.displayItem.base.type == "Belt") end - self.controls.displayItemCatalystQualityEdit = new("EditControl", {"LEFT",self.controls.displayItemCatalyst,"RIGHT"},2,0,60,20,nil,nil,"%D",2,function(buf) + self.controls.displayItemCatalystQualityEdit = new("EditControl", {"LEFT",self.controls.displayItemCatalyst,"RIGHT"}, {2, 0, 60, 20}, nil, nil, "%D", 2, function(buf) self.displayItem.catalystQuality = tonumber(buf) if self.displayItem.crafted then for i = 1, self.displayItem.affixLimit do @@ -2530,7 +2530,7 @@ function ItemsTabClass:CorruptDisplayItem(modType) end controls.implicit4Label.shown = false controls.implicit4.shown = false - controls.implicitCannotBeChangedLabel = new("LabelControl", {"TOPLEFT",nil,"TOPLEFT"}, 20, 45, 0, 20, "^7This Items Implicits Cannot Be Changed") + controls.implicitCannotBeChangedLabel = new("LabelControl", {"TOPLEFT",nil,"TOPLEFT"}, {20, 45, 0, 20}, "^7This Items Implicits Cannot Be Changed") controls.implicitCannotBeChangedLabel.shown = self.displayItem.implicitsCannotBeChanged buildList(controls.implicit, controls.implicit2, currentModType) buildList(controls.implicit2, controls.implicit, currentModType) diff --git a/src/Classes/MinionSearchListControl.lua b/src/Classes/MinionSearchListControl.lua index a837ab6865..f0f4d28e13 100644 --- a/src/Classes/MinionSearchListControl.lua +++ b/src/Classes/MinionSearchListControl.lua @@ -8,16 +8,16 @@ local t_insert = table.insert local t_remove = table.remove local s_format = string.format -local MinionSearchListClass = newClass("MinionSearchListControl", "MinionListControl", function(self, anchor, x, y, width, height, data, list, dest) - self.MinionListControl(anchor, x, y, width, height, data, list, dest) +local MinionSearchListClass = newClass("MinionSearchListControl", "MinionListControl", function(self, anchor, rect, data, list, dest) + self.MinionListControl(anchor, rect, data, list, dest) self.unfilteredList = copyTable(list) self.isMutable = false - self.controls.searchText = new("EditControl", {"BOTTOMLEFT",self,"TOPLEFT"}, 0, -2, 128, 18, "", "Search", "%c", 100, function(buf) + self.controls.searchText = new("EditControl", {"BOTTOMLEFT",self,"TOPLEFT"}, {0, -2, 128, 18}, "", "Search", "%c", 100, function(buf) self:ListFilterChanged(buf, self.controls.searchModeDropDown.selIndex) end, nil, nil, true) - self.controls.searchModeDropDown = new("DropDownControl", {"LEFT",self.controls.searchText,"RIGHT"}, 2, 0, 60, 18, { "Names", "Skills", "Both"}, function(index, value) + self.controls.searchModeDropDown = new("DropDownControl", {"LEFT",self.controls.searchText,"RIGHT"}, {2, 0, 60, 18}, { "Names", "Skills", "Both"}, function(index, value) self:ListFilterChanged(self.controls.searchText.buf, index) end) diff --git a/src/Classes/PartyTab.lua b/src/Classes/PartyTab.lua index 94adaaf5cd..451759eccb 100644 --- a/src/Classes/PartyTab.lua +++ b/src/Classes/PartyTab.lua @@ -399,11 +399,11 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se return not self.controls.ShowAdvanceTools.state end - self.controls.editWarcriesLabel = new("LabelControl", {"TOPLEFT",self.controls.editAurasLabel,"BOTTOMLEFT"}, 0, 8, 0, theme.stringHeight, "^7Warcry Skills") + self.controls.editWarcriesLabel = new("LabelControl", {"TOPLEFT",self.controls.editAurasLabel,"BOTTOMLEFT"}, {0, 8, 0, theme.stringHeight}, "^7Warcry Skills") self.controls.editWarcriesLabel.y = function() return self.controls.ShowAdvanceTools.state and (self.controls.editAuras.height() + 8) or (theme.lineCounter(self.controls.simpleAuras.label) + 4) end - self.controls.editWarcries = new("EditControl", {"TOPLEFT",self.controls.editWarcriesLabel,"TOPLEFT"}, 0, 18, 0, 0, "", nil, "^%C\t\n", nil, nil, 14, true) + self.controls.editWarcries = new("EditControl", {"TOPLEFT",self.controls.editWarcriesLabel,"TOPLEFT"}, {0, 18, 0, 0}, "", nil, "^%C\t\n", nil, nil, 14, true) self.controls.editWarcries.width = function() return self.width / 2 - 16 end @@ -413,16 +413,16 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se self.controls.editWarcries.shown = function() return self.controls.ShowAdvanceTools.state end - self.controls.simpleWarcries = new("LabelControl", {"TOPLEFT",self.controls.editWarcriesLabel,"TOPLEFT"}, 0, 18, 0, theme.stringHeight, "") + self.controls.simpleWarcries = new("LabelControl", {"TOPLEFT",self.controls.editWarcriesLabel,"TOPLEFT"}, {0, 18, 0, theme.stringHeight}, "") self.controls.simpleWarcries.shown = function() return not self.controls.ShowAdvanceTools.state end - self.controls.editLinksLabel = new("LabelControl", {"TOPLEFT",self.controls.editWarcriesLabel,"BOTTOMLEFT"}, 0, 8, 0, theme.stringHeight, "^7Link Skills") + self.controls.editLinksLabel = new("LabelControl", {"TOPLEFT",self.controls.editWarcriesLabel,"BOTTOMLEFT"}, {0, 8, 0, theme.stringHeight}, "^7Link Skills") self.controls.editLinksLabel.y = function() return self.controls.ShowAdvanceTools.state and (self.controls.editWarcries.height() + 8) or (theme.lineCounter(self.controls.simpleWarcries.label) + 4) end - self.controls.editLinks = new("EditControl", {"TOPLEFT",self.controls.editLinksLabel,"TOPLEFT"}, 0, 18, 0, 0, "", nil, "^%C\t\n", nil, nil, 14, true) + self.controls.editLinks = new("EditControl", {"TOPLEFT",self.controls.editLinksLabel,"TOPLEFT"}, {0, 18, 0, 0}, "", nil, "^%C\t\n", nil, nil, 14, true) self.controls.editLinks.width = function() return self.width / 2 - 16 end diff --git a/src/Classes/ResizableEditControl.lua b/src/Classes/ResizableEditControl.lua index 9bff3bd5fe..7de2a31653 100644 --- a/src/Classes/ResizableEditControl.lua +++ b/src/Classes/ResizableEditControl.lua @@ -6,13 +6,14 @@ local m_max = math.max local m_min = math.min -local ResizableEditClass = newClass("ResizableEditControl", "EditControl", function(self, anchor, x, y, minWidth, width, maxWidth, minHeight, height, maxHeight, init, prompt, filter, limit, changeFunc, lineHeight, allowZoom, clearable) - self.EditControl(anchor, x, y, width, height, init, prompt, filter, limit, changeFunc, lineHeight, allowZoom, clearable) +local ResizableEditClass = newClass("ResizableEditControl", "EditControl", function(self, anchor, rect, init, prompt, filter, limit, changeFunc, lineHeight, allowZoom, clearable) + self.EditControl(anchor, rect, init, prompt, filter, limit, changeFunc, lineHeight, allowZoom, clearable) + local x, y, width, hight, minWidth, minHeight, maxWidth, maxHeight = unpack(rect) self.minHeight = minHeight or height self.maxHeight = maxHeight or height self.minWidth = minWidth or width self.maxWidth = maxWidth or width - self.controls.draggerHeight = new("DraggerControl", {"BOTTOMRIGHT", self, "BOTTOMRIGHT"}, 7, 7, 14, 14, "//", nil, nil, function (position) + self.controls.draggerHeight = new("DraggerControl", {"BOTTOMRIGHT", self, "BOTTOMRIGHT"}, {7, 7, 14, 14}, "//", nil, nil, function (position) -- onRightClick if (self.height ~= self.minHeight) or (self.width ~= self.minWidth) then self:SetWidth(self.minWidth) diff --git a/src/Classes/TradeQuery.lua b/src/Classes/TradeQuery.lua index 0f20d6777c..8bdd5145af 100644 --- a/src/Classes/TradeQuery.lua +++ b/src/Classes/TradeQuery.lua @@ -449,7 +449,7 @@ Highest Weight - Displays the order retrieved from trade]] t_insert(slotTables, { slotName = self.itemsTab.sockets[nodeId].label, nodeId = nodeId }) end - self.controls.sectionAnchor = new("LabelControl", { "LEFT", self.controls.poesessidButton, "LEFT" }, 0, 0, 0, 0, "") + self.controls.sectionAnchor = new("LabelControl", {"LEFT", self.controls.poesessidButton, "LEFT"}, {0, 0, 0, }, "") top_pane_alignment_ref = {"TOPLEFT", self.controls.sectionAnchor, "TOPLEFT"} local scrollBarShown = #slotTables > 21 -- clipping starts beyond this -- dynamically hide rows that are above or below the scrollBar @@ -474,7 +474,7 @@ Highest Weight - Displays the order retrieved from trade]] end end - self.controls.otherTradesLabel = new("LabelControl", top_pane_alignment_ref, 0, (#slotTables+1)*(row_height + row_vertical_padding), 100, 16, "^8Other trades:") + self.controls.otherTradesLabel = new("LabelControl", top_pane_alignment_ref, {0, (#slotTables+1)*(row_height + row_vertical_padding), 100, 16}, "^8Other trades:") self.controls.otherTradesLabel.shown = function() return hideRowFunc(self, #slotTables+1) end @@ -492,7 +492,7 @@ Highest Weight - Displays the order retrieved from trade]] self.pane_height = (row_height + row_vertical_padding) * effective_row_count + 2 * pane_margins_vertical + row_height / 2 local pane_width = 850 + (scrollBarShown and 25 or 0) - self.controls.scrollBar = new("ScrollBarControl", {"TOPRIGHT", self.controls["StatWeightMultipliersButton"],"TOPRIGHT"}, 0, 25, 18, 0, 50, "VERTICAL", false) + self.controls.scrollBar = new("ScrollBarControl", {"TOPRIGHT", self.controls["StatWeightMultipliersButton"],"TOPRIGHT"}, {0, 25, 18, 0}, 50, "VERTICAL", false) self.controls.scrollBar.shown = function() return scrollBarShown end local function wipeItemControls() @@ -533,7 +533,7 @@ function TradeQueryClass:SetStatWeights(previousSelectionList) local sliderController = { index = 1 } local popupHeight = 285 - controls.ListControl = new("TradeStatWeightMultiplierListControl", { "TOPLEFT", nil, "TOPRIGHT" }, {-410, 45, 400, 200}, statList, sliderController) + controls.ListControl = new("TradeStatWeightMultiplierListControl", {"TOPLEFT", nil, "TOPRIGHT"}, {-410, 45, 400, 200}, statList, sliderController) for id, stat in pairs(data.powerStatList) do if not stat.ignoreForItems and stat.label ~= "Name" then @@ -605,13 +605,13 @@ function TradeQueryClass:SetStatWeights(previousSelectionList) self:UpdateControlsWithItems(row_idx) end end) - controls.cancel = new("ButtonControl", { "BOTTOM", nil, "BOTTOM" }, 0, -10, 80, 20, "Cancel", function() + controls.cancel = new("ButtonControl", { "BOTTOM", nil, "BOTTOM" }, { 0, -10, 80, 20 }, "Cancel", function() if previousSelectionList and #previousSelectionList > 0 then self.statSortSelectionList = copyTable(previousSelectionList, true) end main:ClosePopup() end) - controls.reset = new("ButtonControl", { "BOTTOM", nil, "BOTTOM" }, 90, -10, 80, 20, "Reset", function() + controls.reset = new("ButtonControl", { "BOTTOM", nil, "BOTTOM" }, { 90, -10, 80, 20 }, "Reset", function() local previousSelection = { } if isSameAsDefaultList(self.statSortSelectionList) then previousSelection = copyTable(previousSelectionList, true) @@ -884,7 +884,7 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro local activeSlotRef = slotTbl.nodeId and self.itemsTab.activeItemSet[slotTbl.nodeId] or self.itemsTab.activeItemSet[slotTbl.slotName] local activeSlot = slotTbl.nodeId and self.itemsTab.sockets[slotTbl.nodeId] or slotTbl.slotName and (self.itemsTab.slots[slotTbl.slotName] or slotTbl.fullName and self.itemsTab.slots[slotTbl.fullName]) -- fullName for Abyssal Sockets local nameColor = slotTbl.unique and colorCodes.UNIQUE or "^7" - controls["name"..row_idx] = new("LabelControl", top_pane_alignment_ref, 0, row_idx*(row_height + row_vertical_padding), 100, row_height - 4, nameColor..slotTbl.slotName) + controls["name"..row_idx] = new("LabelControl", top_pane_alignment_ref, {0, row_idx*(row_height + row_vertical_padding), 100, row_height - 4}, nameColor..slotTbl.slotName) controls["bestButton"..row_idx] = new("ButtonControl", { "LEFT", controls["name"..row_idx], "LEFT"}, {100 + 8, 0, 80, row_height}, "Find best", function() self.tradeQueryGenerator:RequestQuery(activeSlot, { slotTbl = slotTbl, controls = controls, row_idx = row_idx }, self.statSortSelectionList, function(context, query, errMsg) if errMsg then diff --git a/src/Classes/TradeQueryGenerator.lua b/src/Classes/TradeQueryGenerator.lua index 6dacdcb235..8ba4e5d6cb 100644 --- a/src/Classes/TradeQueryGenerator.lua +++ b/src/Classes/TradeQueryGenerator.lua @@ -1035,7 +1035,7 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb options.special = { itemName = context.slotTbl.slotName } end - controls.includeMirrored = new("CheckBoxControl", {"TOPRIGHT",lastItemAnchor,"BOTTOMRIGHT"}, 0, 5, 18, "Mirrored items:", function(state) end) + controls.includeMirrored = new("CheckBoxControl", {"TOPRIGHT",lastItemAnchor,"BOTTOMRIGHT"}, {0, 5, 18}, "Mirrored items:", function(state) end) controls.includeMirrored.state = (self.lastIncludeMirrored == nil or self.lastIncludeMirrored == true) updateLastAnchor(controls.includeMirrored) @@ -1072,9 +1072,9 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb controls.influence2Label = new("LabelControl", {"RIGHT",controls.influence2,"LEFT"}, {-5, 0, 0, 16}, "Influence 2:") updateLastAnchor(controls.influence2, 46) elseif isAbyssalJewelSlot then - controls.jewelType = new("DropDownControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, 0, 5, 100, 18, { "Abyss" }, nil) + controls.jewelType = new("DropDownControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, {0, 5, 100, 18}, { "Abyss" }, nil) controls.jewelType.selIndex = 1 - controls.jewelTypeLabel = new("LabelControl", {"RIGHT",controls.jewelType,"LEFT"}, -5, 0, 0, 16, "Jewel Type:") + controls.jewelTypeLabel = new("LabelControl", {"RIGHT",controls.jewelType,"LEFT"}, {-5, 0, 0, 16}, "Jewel Type:") updateLastAnchor(controls.jewelType) end @@ -1102,24 +1102,24 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb for _, currency in ipairs(currencyTable) do t_insert(currencyDropdownNames, currency.name) end - controls.maxPrice = new("EditControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, 0, 5, 70, 18, nil, nil, "%D") - controls.maxPriceType = new("DropDownControl", {"LEFT",controls.maxPrice,"RIGHT"}, 5, 0, 150, 18, currencyDropdownNames, nil) + controls.maxPrice = new("EditControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, {0, 5, 70, 18}, nil, nil, "%D") + controls.maxPriceType = new("DropDownControl", {"LEFT",controls.maxPrice,"RIGHT"}, {5, 0, 150, 18}, currencyDropdownNames, nil) controls.maxPriceLabel = new("LabelControl", {"RIGHT",controls.maxPrice,"LEFT"}, {-5, 0, 0, 16}, "^7Max Price:") updateLastAnchor(controls.maxPrice) - controls.maxLevel = new("EditControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, 0, 5, 100, 18, nil, nil, "%D") + controls.maxLevel = new("EditControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, {0, 5, 100, 18}, nil, nil, "%D") controls.maxLevelLabel = new("LabelControl", {"RIGHT",controls.maxLevel,"LEFT"}, {-5, 0, 0, 16}, "Max Level:") updateLastAnchor(controls.maxLevel) -- basic filtering by slot for sockets and links, Megalomaniac does not have slot and Sockets use "Jewel nodeId" if slot and not isJewelSlot and not isAbyssalJewelSlot and not slot.slotName:find("Flask") then - controls.sockets = new("EditControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, 0, 5, 70, 18, nil, nil, "%D") - controls.socketsLabel = new("LabelControl", {"RIGHT",controls.sockets,"LEFT"}, -5, 0, 0, 16, "# of Sockets:") + controls.sockets = new("EditControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, {0, 5, 70, 18}, nil, nil, "%D") + controls.socketsLabel = new("LabelControl", {"RIGHT",controls.sockets,"LEFT"}, {-5, 0, 0, 16}, "# of Sockets:") updateLastAnchor(controls.sockets) if not slot.slotName:find("Belt") and not slot.slotName:find("Ring") and not slot.slotName:find("Amulet") then - controls.links = new("EditControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, 0, 5, 70, 18, nil, nil, "%D") - controls.linksLabel = new("LabelControl", {"RIGHT",controls.links,"LEFT"}, -5, 0, 0, 16, "# of Links:") + controls.links = new("EditControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, {0, 5, 70, 18}, nil, nil, "%D") + controls.linksLabel = new("LabelControl", {"RIGHT",controls.links,"LEFT"}, {-5, 0, 0, 16}, "# of Links:") updateLastAnchor(controls.links) end end diff --git a/src/Classes/TreeTab.lua b/src/Classes/TreeTab.lua index 970fb6bfbf..c0ae6c353e 100644 --- a/src/Classes/TreeTab.lua +++ b/src/Classes/TreeTab.lua @@ -113,18 +113,18 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) self.controls.compareSelect.maxDroppedWidth = 1000 self.controls.compareSelect.enableDroppedWidth = true self.controls.compareSelect.enableChangeBoxWidth = true - self.controls.reset = new("ButtonControl", { "LEFT", self.controls.compareCheck, "RIGHT" }, 8, 0, 145, 20, "Reset Tree/Tattoos", function() + self.controls.reset = new("ButtonControl", { "LEFT", self.controls.compareCheck, "RIGHT" }, { 8, 0, 145, 20 }, "Reset Tree/Tattoos", function() local controls = { } local buttonY = 65 - controls.warningLabel = new("LabelControl", nil, 0, 30, 0, 16, "^7Warning: resetting your passive tree or removing all tattoos cannot be undone.\n") - controls.reset = new("ButtonControl", nil, -130, buttonY, 100, 20, "Reset Tree", function() + controls.warningLabel = new("LabelControl", nil, { 0, 30, 0, 16 }, "^7Warning: resetting your passive tree or removing all tattoos cannot be undone.\n") + controls.reset = new("ButtonControl", nil, { -130, buttonY, 100, 20 }, "Reset Tree", function() self.build.spec:ResetNodes() self.build.spec:BuildAllDependsAndPaths() self.build.spec:AddUndoState() self.build.buildFlag = true main:ClosePopup() end) - controls.removeTattoo = new("ButtonControl", nil, 0, buttonY, 144, 20, "Remove All Tattoos", function() + controls.removeTattoo = new("ButtonControl", nil, { 0, buttonY, 144, 20 }, "Remove All Tattoos", function() for id, node in pairs(self.build.spec.hashOverrides) do --hashOverrides will contain only the nodes that have been tattoo-ed if node.isTattoo then self:RemoveTattooFromNode(self.build.spec.nodes[id]) @@ -134,7 +134,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) self.build.buildFlag = true main:ClosePopup() end) - controls.cancel = new("ButtonControl", nil, 130, buttonY, 100, 20, "Cancel", function() + controls.cancel = new("ButtonControl", nil, { 130, buttonY, 100, 20 }, "Cancel", function() main:ClosePopup() end) main:OpenPopup(570, 100, "Reset Tree/Tattoos", controls, nil, "edit", "cancel") @@ -150,7 +150,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) t_insert(self.treeVersions, value) end self.controls.versionText = new("LabelControl", { "LEFT", self.controls.reset, "RIGHT" }, { 8, 0, 0, 16 }, "Version:") - self.controls.versionSelect = new("DropDownControl", { "LEFT", self.controls.versionText, "RIGHT" }, 8, 0, 100, 20, self.treeVersions, function(index, selected) + self.controls.versionSelect = new("DropDownControl", { "LEFT", self.controls.versionText, "RIGHT" }, { 8, 0, 100, 20 }, self.treeVersions, function(index, selected) if selected.value ~= self.build.spec.treeVersion then self:OpenVersionConvertPopup(selected.value, true) end @@ -262,7 +262,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) self.controls.specConvert = new("ButtonControl", { "LEFT", self.controls.specConvertText, "RIGHT" }, { 8, 0, function() return DrawStringWidth(16, "VAR", buildConvertButtonLabel()) + 20 end, 20 }, buildConvertButtonLabel, function() self:ConvertToVersion(getLatestTreeVersion(), false, true) end) - self.controls.specConvertAll = new("ButtonControl", { "LEFT", self.controls.specConvert, "RIGHT" }, 8, 0, function() return DrawStringWidth(16, "VAR", buildConvertAllButtonLabel()) + 20 end, 20, buildConvertAllButtonLabel, function() + self.controls.specConvertAll = new("ButtonControl", { "LEFT", self.controls.specConvert, "RIGHT" }, { 8, 0, function() return DrawStringWidth(16, "VAR", buildConvertAllButtonLabel()) + 20 end, 20 }, buildConvertAllButtonLabel, function() self:OpenVersionConvertAllPopup(getLatestTreeVersion()) end) self.jumpToNode = false @@ -547,15 +547,15 @@ function TreeTabClass:OpenVersionConvertPopup(version, ignoreRuthlessCheck) local controls = { } controls.warningLabel = new("LabelControl", nil, {0, 20, 0, 16}, "^7Warning: some or all of the passives may be de-allocated due to changes in the tree.\n\n" .. "Convert will replace your current tree.\nCopy + Convert will backup your current tree.\n") - controls.convert = new("ButtonControl", nil, -125, 105, 100, 20, "Convert", function() + controls.convert = new("ButtonControl", nil, {-125, 105, 100, 20}, "Convert", function() self:ConvertToVersion(version, true, false, ignoreRuthlessCheck) main:ClosePopup() end) - controls.convertCopy = new("ButtonControl", nil, 0, 105, 125, 20, "Copy + Convert", function() + controls.convertCopy = new("ButtonControl", nil, {0, 105, 125, 20}, "Copy + Convert", function() self:ConvertToVersion(version, false, false, ignoreRuthlessCheck) main:ClosePopup() end) - controls.cancel = new("ButtonControl", nil, 125, 105, 100, 20, "Cancel", function() + controls.cancel = new("ButtonControl", nil, {125, 105, 100, 20}, "Cancel", function() self.controls.versionSelect:SelByValue(self.build.spec.treeVersion, 'value') main:ClosePopup() end) @@ -564,13 +564,13 @@ end function TreeTabClass:OpenVersionConvertAllPopup(version) local controls = { } - controls.warningLabel = new("LabelControl", nil, 0, 20, 0, 16, "^7Warning: some or all of the passives may be de-allocated due to changes in the tree.\n\n" .. + controls.warningLabel = new("LabelControl", nil, {0, 20, 0, 16}, "^7Warning: some or all of the passives may be de-allocated due to changes in the tree.\n\n" .. "Convert will replace all trees that are not Version "..treeVersions[version].display..".\nThis action cannot be undone.\n") - controls.convert = new("ButtonControl", nil, -58, 105, 100, 20, "Convert", function() + controls.convert = new("ButtonControl", nil, {-58, 105, 100, 20}, "Convert", function() self:ConvertAllToVersion(version) main:ClosePopup() end) - controls.cancel = new("ButtonControl", nil, 58, 105, 100, 20, "Cancel", function() + controls.cancel = new("ButtonControl", nil, {58, 105, 100, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(570, 140, "Convert all to Version "..treeVersions[version].display, controls, "convert", "edit") @@ -846,12 +846,12 @@ function TreeTabClass:ModifyNodePopup(selectedNode) end return count end - controls.totalTattoos = new("LabelControl", nil, 0, 95, 0, 16, "^7Tattoo Count: ".. getTattooCount() .."/50" ) + controls.totalTattoos = new("LabelControl", nil, { 0, 95, 0, 16 }, "^7Tattoo Count: ".. getTattooCount() .."/50" ) main:OpenPopup(600, 105, "Replace Modifier of Node", controls, "save") constructUI(modGroups[self.defaultTattoo[nodeName] or 1]) -- Show Legacy Tattoos - controls.showLegacyTattoo = new("CheckBoxControl", { "LEFT", controls.totalTattoos, "RIGHT" }, 205, 0, 20, "Show Legacy Tattoos:", function(state) + controls.showLegacyTattoo = new("CheckBoxControl", { "LEFT", controls.totalTattoos, "RIGHT" }, { 205, 0, 20 }, "Show Legacy Tattoos:", function(state) self.showLegacyTattoo = state buildMods(selectedNode) end) @@ -1410,8 +1410,8 @@ function TreeTabClass:FindTimelessJewel() end end end - controls.socketFilterLabel = new("LabelControl", { "TOPRIGHT", nil, "TOPLEFT" }, 405, 100, 0, 16, "^7Filter Nodes:") - controls.socketFilter = new("CheckBoxControl", { "LEFT", controls.socketFilterLabel, "RIGHT" }, 10, 0, 18, nil, function(value) + controls.socketFilterLabel = new("LabelControl", { "TOPRIGHT", nil, "TOPLEFT" }, { 405, 100, 0, 16 }, "^7Filter Nodes:") + controls.socketFilter = new("CheckBoxControl", { "LEFT", controls.socketFilterLabel, "RIGHT" }, { 10, 0, 18 }, nil, function(value) timelessData.socketFilter = value self.build.modFlag = true controls.socketFilterAdditionalDistanceLabel.shown = value @@ -1433,17 +1433,17 @@ function TreeTabClass:FindTimelessJewel() controls.socketFilter.state = timelessData.socketFilter -- Militant Faith protect notables controls - controls.protectAllocatedLabel = new("LabelControl", { "TOPLEFT", nil, "TOPLEFT" }, 15, 25, 0, 16, "^7Protect allocated nodes from changing:") - controls.protectAllocatedSelect = new("DropDownControl", { "TOPLEFT", controls.protectAllocatedLabel, "BOTTOMLEFT" }, 0, 8, 200, 18, nil, nil) - controls.protectAllocatedButtonAdd = new("ButtonControl", { "LEFT", controls.protectAllocatedSelect, "RIGHT" }, 5, 0, 44, 18, "Add", function() + controls.protectAllocatedLabel = new("LabelControl", { "TOPLEFT", nil, "TOPLEFT" }, { 15, 25, 0, 16 }, "^7Protect allocated nodes from changing:") + controls.protectAllocatedSelect = new("DropDownControl", { "TOPLEFT", controls.protectAllocatedLabel, "BOTTOMLEFT" }, { 0, 8, 200, 18 }, nil, nil) + controls.protectAllocatedButtonAdd = new("ButtonControl", { "LEFT", controls.protectAllocatedSelect, "RIGHT" }, { 5, 0, 44, 18 }, "Add", function() local selValue = controls.protectAllocatedSelect:GetSelValue() if selValue and not controls["protected:"..selValue] then protectedNodesCount = protectedNodesCount + 1 t_insert(protectedNodes, selValue) - controls["protected:"..selValue] = new("LabelControl", { "TOPLEFT", controls.protectAllocatedSelect, "BOTTOMLEFT" }, 0, 16*protectedNodesCount-10, 0, 16, "^7"..selValue) + controls["protected:"..selValue] = new("LabelControl", { "TOPLEFT", controls.protectAllocatedSelect, "BOTTOMLEFT" }, { 0, 16 * protectedNodesCount - 10, 0, 16 }, "^7"..selValue) end end) - controls.protectAllocatedButtonClear = new("ButtonControl", { "LEFT", controls.protectAllocatedButtonAdd, "RIGHT" }, 5, 0, 44, 18, "Clear", function() + controls.protectAllocatedButtonClear = new("ButtonControl", { "LEFT", controls.protectAllocatedButtonAdd, "RIGHT" }, { 5, 0, 44, 18 }, "Clear", function() clearProtected() end) -- set shown and list on load @@ -1905,13 +1905,13 @@ function TreeTabClass:FindTimelessJewel() controls.searchListFallback.enabled = false controls.searchListFallback:SetText(timelessData.searchListFallback and timelessData.searchListFallback or "") - controls.searchResultsLabel = new("LabelControl", { "TOPLEFT", nil, "TOPRIGHT" }, -450, 250, 0, 16, "^7Search Results:") - controls.searchResults = new("TimelessJewelListControl", { "TOPLEFT", nil, "TOPRIGHT" }, -450, 275, 438, 200, self.build) - controls.searchTradeLeagueSelect = new("DropDownControl", { "BOTTOMRIGHT", controls.searchResults, "TOPRIGHT" }, -175, -5, 140, 20, nil, function(_, value) + controls.searchResultsLabel = new("LabelControl", { "TOPLEFT", nil, "TOPRIGHT" }, { -450, 250, 0, 16 }, "^7Search Results:") + controls.searchResults = new("TimelessJewelListControl", { "TOPLEFT", nil, "TOPRIGHT" }, { -450, 275, 438, 200 }, self.build) + controls.searchTradeLeagueSelect = new("DropDownControl", { "BOTTOMRIGHT", controls.searchResults, "TOPRIGHT" }, { -175, -5, 140, 20 }, nil, function(_, value) self.timelessJewelLeagueSelect = value end) self.tradeQueryRequests = new("TradeQueryRequests") - controls.msg = new("LabelControl", nil, -280, 5, 0, 16, "") + controls.msg = new("LabelControl", nil, { -280, 5, 0, 16 }, "") if #self.tradeLeaguesList > 0 then controls.searchTradeLeagueSelect:SetList(self.tradeLeaguesList) -- restore the last league selected @@ -1949,7 +1949,7 @@ function TreeTabClass:FindTimelessJewel() controls.searchTradeLeagueSelect:SetList(self.tradeLeaguesList) end) end - controls.searchTradeButton = new("ButtonControl", { "BOTTOMRIGHT", controls.searchResults, "TOPRIGHT" }, 0, -5, 170, 20, "Copy Trade URL", function() + controls.searchTradeButton = new("ButtonControl", { "BOTTOMRIGHT", controls.searchResults, "TOPRIGHT" }, { 0, -5, 170, 20 }, "Copy Trade URL", function() local seedTrades = {} local startRow = controls.searchResults.selIndex or 1 local endRow = startRow + m_floor(10 / ((timelessData.sharedResults.conqueror.id == 1) and 3 or 1)) diff --git a/src/Export/Main.lua b/src/Export/Main.lua index 551b890568..dc744d625f 100644 --- a/src/Export/Main.lua +++ b/src/Export/Main.lua @@ -155,14 +155,14 @@ function main:Init() self.colList = { } - self.controls.shownLeagueLabel = new("LabelControl", nil, 10, 10, 100, 16, "^7Data from:") - self.controls.leagueLabel = new("LabelControl", { "LEFT", self.controls.shownLeagueLabel, "RIGHT"}, 10, 0, 100, 16, function() return "^7" .. (self.leagueLabel or "Unknown") end) - self.controls.addSource = new("ButtonControl", nil, 10, 30, 100, 18, "Edit Sources...", function() + self.controls.shownLeagueLabel = new("LabelControl", nil, {10, 10, 100, 16}, "^7Data from:") + self.controls.leagueLabel = new("LabelControl", {"LEFT", self.controls.shownLeagueLabel, "RIGHT"}, {10, 0, 100, 16}, function() return "^7" .. (self.leagueLabel or "Unknown") end) + self.controls.addSource = new("ButtonControl", nil, {10, 30, 100, 18}, "Edit Sources...", function() self.OpenPathPopup() end) self.datSources = self.datSources or { } - self.controls.datSource = new("DropDownControl", nil, 10, 50, 250, 18, self.datSources, function(_, value) + self.controls.datSource = new("DropDownControl", nil, {10, 50, 250, 18}, self.datSources, function(_, value) self:LoadDatSource(value) end, nil) @@ -170,7 +170,7 @@ function main:Init() self.controls.datSource:SelByValue(self.datSource.label, "label") end - self.controls.scripts = new("ButtonControl", nil, 160, 30, 100, 18, "Scripts >>", function() + self.controls.scripts = new("ButtonControl", nil, {160, 30, 100, 18}, "Scripts >>", function() self:SetCurrentDat() end) @@ -268,7 +268,7 @@ function main:Init() end } - self.controls.enumBase = new("EditControl", {"TOPLEFT",self.controls.colWidth,"BOTTOMLEFT"}, 0, 4, 100, 18, nil, nil, "%D", nil, function(buf) + self.controls.enumBase = new("EditControl", {"TOPLEFT",self.controls.colWidth,"BOTTOMLEFT"}, {0, 4, 100, 18}, nil, nil, "%D", nil, function(buf) self.curSpecCol.enumBase = tonumber(buf) or 0 self.curDatFile:OnSpecChanged() end) { @@ -279,7 +279,7 @@ function main:Init() end } - self.controls.colDelete = new("ButtonControl", {"BOTTOMRIGHT",self.controls.colName,"TOPRIGHT"}, 0, -4, 18, 18, "x", function() + self.controls.colDelete = new("ButtonControl", {"BOTTOMRIGHT",self.controls.colName,"TOPRIGHT"}, {0, -4, 18, 18}, "x", function() t_remove(self.curDatFile.spec, self.curSpecColIndex) self.curDatFile:OnSpecChanged() self.controls.rowList:BuildColumns() diff --git a/src/Modules/Build.lua b/src/Modules/Build.lua index 8a234ac98b..37f9922a54 100644 --- a/src/Modules/Build.lua +++ b/src/Modules/Build.lua @@ -228,13 +228,13 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin self.buildFlag = true end) -- // hiding away until we learn more, this dropdown and the Loadout dropdown conflict for UI space, will need to address if secondaryAscendancies come back - --self.controls.secondaryAscendDrop = new("DropDownControl", {"LEFT",self.controls.ascendDrop,"RIGHT"}, 8, 0, 120, 20, nil, function(index, value) + --self.controls.secondaryAscendDrop = new("DropDownControl", {"LEFT",self.controls.ascendDrop,"RIGHT"}, {8, 0, 120, 20}, nil, function(index, value) -- self.spec:SelectSecondaryAscendClass(value.ascendClassId) -- self.spec:AddUndoState() -- self.spec:SetWindowTitleWithBuildClass() -- self.buildFlag = true --end) - self.controls.buildLoadouts = new("DropDownControl", {"LEFT",self.controls.ascendDrop,"RIGHT"}, 8, 0, 190, 20, {}, function(index, value) + self.controls.buildLoadouts = new("DropDownControl", {"LEFT",self.controls.ascendDrop,"RIGHT"}, {8, 0, 190, 20}, {}, function(index, value) if value == "^7^7Loadouts:" or value == "^7^7-----" then self.controls.buildLoadouts:SetSel(1) return @@ -251,11 +251,11 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin end if value == "^7^7New Loadout" then local controls = { } - controls.label = new("LabelControl", nil, 0, 20, 0, 16, "^7Enter name for this loadout:") - controls.edit = new("EditControl", nil, 0, 40, 350, 20, "New Loadout", nil, nil, 100, function(buf) + controls.label = new("LabelControl", nil, {0, 20, 0, 16}, "^7Enter name for this loadout:") + controls.edit = new("EditControl", nil, {0, 40, 350, 20}, "New Loadout", nil, nil, 100, function(buf) controls.save.enabled = buf:match("%S") end) - controls.save = new("ButtonControl", nil, -45, 70, 80, 20, "Save", function() + controls.save = new("ButtonControl", nil, {-45, 70, 80, 20}, "Save", function() local loadout = controls.edit.buf local newSpec = new("PassiveSpec", self, latestTreeVersion) @@ -279,7 +279,7 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin main:ClosePopup() end) controls.save.enabled = false - controls.cancel = new("ButtonControl", nil, 45, 70, 80, 20, "Cancel", function() + controls.cancel = new("ButtonControl", nil, {45, 70, 80, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(370, 100, "Set Name", controls, "save", "edit", "cancel") @@ -350,7 +350,7 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin self.controls.buildLoadouts:SelByValue(value) end) - --self.controls.similarBuilds = new("ButtonControl", {"LEFT",self.controls.buildLoadouts,"RIGHT"}, 8, 0, 100, 20, "Similar Builds", function() + --self.controls.similarBuilds = new("ButtonControl", {"LEFT",self.controls.buildLoadouts,"RIGHT"}, {8, 0, 100, 20}, "Similar Builds", function() -- self:OpenSimilarPopup() --end) --self.controls.similarBuilds.tooltipFunc = function(tooltip) @@ -1449,7 +1449,7 @@ function buildMode:OpenSaveAsPopup() end end controls.label = new("LabelControl", nil, {0, 20, 0, 16}, "^7Enter new build name:") - controls.edit = new("EditControl", nil, 0, 40, 450, 20, + controls.edit = new("EditControl", nil, {0, 40, 450, 20}, (self.buildName or self.dbFileName):gsub("[\\/:%*%?\"<>|%c]", "-"), nil, "\\/:%*%?\"<>|%c", 100, function(buf) updateBuildName() end) @@ -1503,8 +1503,8 @@ function buildMode:OpenSpectreLibrary() end) local controls = { } controls.list = new("MinionListControl", nil, {-100, 40, 190, 250}, self.data, destList) - controls.source = new("MinionSearchListControl", nil, 100, 60, 190, 230, self.data, sourceList, controls.list) - controls.save = new("ButtonControl", nil, -45, 330, 80, 20, "Save", function() + controls.source = new("MinionSearchListControl", nil, {100, 60, 190, 230}, self.data, sourceList, controls.list) + controls.save = new("ButtonControl", nil, {-45, 330, 80, 20}, "Save", function() self.spectreList = destList self.modFlag = true self.buildFlag = true @@ -1533,7 +1533,7 @@ function buildMode:OpenSimilarPopup() return main.screenH * 0.8 end local padding = 50 - controls.similarBuildList = new("ExtBuildListControl", nil, 0, padding, width, height() - 2 * padding, buildProviders) + controls.similarBuildList = new("ExtBuildListControl", nil, {0, padding, width, height() - 2 * padding}, buildProviders) controls.similarBuildList.shown = true controls.similarBuildList.height = function() return height() - 2 * padding @@ -1546,7 +1546,7 @@ function buildMode:OpenSimilarPopup() -- controls.similarBuildList.shown = not controls.similarBuildList:IsShown() - controls.close = new("ButtonControl", nil, 0, height() - (padding + 20) / 2, 80, 20, "Close", function() + controls.close = new("ButtonControl", nil, {0, height() - (padding + 20) / 2, 80, 20}, "Close", function() main:ClosePopup() end) -- used in PopupDialog to dynamically size the popup diff --git a/src/Modules/BuildList.lua b/src/Modules/BuildList.lua index 248af570f5..75b27e98b3 100644 --- a/src/Modules/BuildList.lua +++ b/src/Modules/BuildList.lua @@ -118,7 +118,7 @@ function listMode:getPublicBuilds() impl = new("PoBArchivesProvider", "builds") } } - local extBuildList = new("ExtBuildListControl", {"LEFT",self.controls.buildList,"RIGHT"}, 25, 0, main.screenW * 1 / 4 - 50, 0, buildProviders) + local extBuildList = new("ExtBuildListControl", {"LEFT",self.controls.buildList,"RIGHT"}, {25, 0, main.screenW * 1 / 4 - 50, 0}, buildProviders) extBuildList:Init("PoB Archives") extBuildList.height = function() return main.screenH - 80 diff --git a/src/Modules/Main.lua b/src/Modules/Main.lua index 0c82a768a6..f6df2f1cf2 100644 --- a/src/Modules/Main.lua +++ b/src/Modules/Main.lua @@ -740,15 +740,15 @@ function main:OpenPathPopup(invalidPath, ignoreBuild) local controls = { } local defaultLabelPlacementX = 8 - controls.label = new("LabelControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, 20, 206, 16, function() + controls.label = new("LabelControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, 20, 206, 16 }, function() return "^7User settings path contains unicode characters and cannot be loaded.".. "\nCurrent Path: "..invalidPath:gsub("?", "^1?^7").."/Path of Building/".. "\nSpecify a new location for your Settings.xml:" end) - controls.explainButton = new("ButtonControl", { "LEFT", controls.label, "RIGHT" }, 4, 0, 20, 20, "?", function() + controls.explainButton = new("ButtonControl", { "LEFT", controls.label, "RIGHT" }, { 4, 0, 20, 20 }, "?", function() OpenURL("https://github.com/PathOfBuildingCommunity/PathOfBuilding/wiki/Why-do-I-have-to-change-my-Settings-path%3F") end) - controls.userPath = new("EditControl", { "TOPLEFT", controls.label, "TOPLEFT" }, 0, 60, 206, 20, invalidPath, nil, nil, nil, function(buf) + controls.userPath = new("EditControl", { "TOPLEFT", controls.label, "TOPLEFT" }, { 0, 60, 206, 20 }, invalidPath, nil, nil, nil, function(buf) invalidPath = sanitiseText(buf) if not invalidPath:match("?") then controls.save.enabled = true @@ -756,7 +756,7 @@ function main:OpenPathPopup(invalidPath, ignoreBuild) controls.save.enabled = false end end) - controls.save = new("ButtonControl", { "TOPLEFT", controls.userPath, "TOPLEFT" }, 0, 26, 206, 20, "Save", function() + controls.save = new("ButtonControl", { "TOPLEFT", controls.userPath, "TOPLEFT" }, { 0, 26, 206, 20 }, "Save", function() local res, msg = MakeDir(controls.userPath.buf) if not res and msg ~= "No error" then self:OpenMessagePopup("Error", "Couldn't create '"..controls.userPath.buf.."' : "..msg) @@ -766,7 +766,7 @@ function main:OpenPathPopup(invalidPath, ignoreBuild) end end) controls.save.enabled = false - controls.cancel = new("ButtonControl", nil, 0, 0, 0, 0, "Cancel", function() + controls.cancel = new("ButtonControl", nil, { 0, 0, 0, 0 }, "Cancel", function() -- Do nothing, require user to enter a location end) self:OpenPopup(600, 150, "Change Settings Path", controls, "save", nil, "cancel")