From 356c29c5c288f2863e52170147d7694a1526e75a Mon Sep 17 00:00:00 2001 From: Regisle <49933620+Regisle@users.noreply.github.com> Date: Mon, 9 Sep 2024 07:14:23 +0930 Subject: [PATCH] Change controls to take a packed "rect" instead of x, y, width, height (#6873) * change controls to take a packed "rect" instead of x, y, width, height * Fix bad merge * Add missing box notation * fix merge issues and update new controls to use packed rect * update export * fix white space * fix spelling mistake * fix more merge issues --------- Co-authored-by: Wires77 --- src/Classes/BuildListControl.lua | 14 +- src/Classes/ButtonControl.lua | 4 +- src/Classes/CalcBreakdownControl.lua | 2 +- src/Classes/CalcSectionControl.lua | 4 +- src/Classes/CalcsTab.lua | 24 +- src/Classes/CheckBoxControl.lua | 7 +- src/Classes/ConfigSetListControl.lua | 20 +- src/Classes/ConfigTab.lua | 34 +- src/Classes/Control.lua | 22 +- src/Classes/DraggerControl.lua | 4 +- src/Classes/DropDownControl.lua | 6 +- src/Classes/EditControl.lua | 14 +- src/Classes/ExtBuildListControl.lua | 16 +- src/Classes/FolderListControl.lua | 6 +- src/Classes/GemSelectControl.lua | 8 +- src/Classes/ImportTab.lua | 86 ++--- src/Classes/ItemDBControl.lua | 20 +- src/Classes/ItemListControl.lua | 12 +- src/Classes/ItemSetListControl.lua | 20 +- src/Classes/ItemSlotControl.lua | 4 +- src/Classes/ItemsTab.lua | 298 +++++++++--------- src/Classes/LabelControl.lua | 4 +- src/Classes/ListControl.lua | 8 +- src/Classes/MinionListControl.lua | 8 +- src/Classes/MinionSearchListControl.lua | 8 +- src/Classes/NotableDBControl.lua | 10 +- src/Classes/NotesTab.lua | 30 +- src/Classes/PartyTab.lua | 62 ++-- src/Classes/PassiveMasteryControl.lua | 6 +- src/Classes/PassiveSpecListControl.lua | 20 +- src/Classes/PathControl.lua | 6 +- src/Classes/PopupDialog.lua | 2 +- src/Classes/PowerReportListControl.lua | 7 +- src/Classes/RectangleOutlineControl.lua | 4 +- src/Classes/ResizableEditControl.lua | 7 +- src/Classes/ScrollBarControl.lua | 6 +- src/Classes/SectionControl.lua | 4 +- src/Classes/SharedItemListControl.lua | 6 +- src/Classes/SharedItemSetListControl.lua | 16 +- src/Classes/SkillListControl.lua | 10 +- src/Classes/SkillSetListControl.lua | 20 +- src/Classes/SkillsTab.lua | 90 +++--- src/Classes/SliderControl.lua | 6 +- src/Classes/TextListControl.lua | 6 +- src/Classes/TimelessJewelListControl.lua | 4 +- src/Classes/TimelessJewelSocketControl.lua | 4 +- src/Classes/TradeQuery.lua | 72 ++--- src/Classes/TradeQueryGenerator.lua | 56 ++-- .../TradeStatWeightMultiplierListControl.lua | 4 +- src/Classes/TreeTab.lua | 199 ++++++------ src/Export/Classes/DatListControl.lua | 4 +- src/Export/Classes/GGPKSourceListControl.lua | 32 +- src/Export/Classes/RowListControl.lua | 4 +- src/Export/Classes/ScriptListControl.lua | 4 +- src/Export/Classes/SpecColListControl.lua | 4 +- src/Export/Main.lua | 66 ++-- src/Modules/Build.lua | 128 ++++---- src/Modules/BuildList.lua | 22 +- src/Modules/Main.lua | 145 ++++----- 59 files changed, 867 insertions(+), 852 deletions(-) diff --git a/src/Classes/BuildListControl.lua b/src/Classes/BuildListControl.lua index 699abc5d51..c1bec7f923 100644 --- a/src/Classes/BuildListControl.lua +++ b/src/Classes/BuildListControl.lua @@ -6,15 +6,15 @@ local ipairs = ipairs local s_format = string.format -local BuildListClass = newClass("BuildListControl", "ListControl", function(self, anchor, x, y, width, height, listMode) - self.ListControl(anchor, x, y, width, height, 20, "VERTICAL", false, listMode.list) +local BuildListClass = newClass("BuildListControl", "ListControl", function(self, anchor, rect, listMode) + self.ListControl(anchor, rect, 20, "VERTICAL", false, listMode.list) self.listMode = listMode self.colList = { { width = function() return self:GetProperty("width") - 172 end }, { }, } self.showRowSeparators = true - self.controls.path = new("PathControl", {"BOTTOM",self,"TOP"}, 0, -2, width, 24, main.buildPath, listMode.subPath, function(subPath) + self.controls.path = new("PathControl", {"BOTTOM",self,"TOP"}, {0, -2, self.width, 24}, main.buildPath, listMode.subPath, function(subPath) listMode.subPath = subPath listMode:BuildList() self.selIndex = nil @@ -74,8 +74,8 @@ end function BuildListClass:RenameBuild(build, copyOnName) local controls = { } - controls.label = new("LabelControl", nil, 0, 20, 0, 16, "^7Enter the new name for this "..(build.folderName and "folder:" or "build:")) - controls.edit = new("EditControl", nil, 0, 40, 350, 20, build.folderName or build.buildName, nil, "\\/:%*%?\"<>|%c", 100, function(buf) + controls.label = new("LabelControl", nil, {0, 20, 0, 16}, "^7Enter the new name for this "..(build.folderName and "folder:" or "build:")) + controls.edit = new("EditControl", nil, {0, 40, 350, 20}, build.folderName or build.buildName, nil, "\\/:%*%?\"<>|%c", 100, function(buf) controls.save.enabled = false if build.folderName then if buf:match("%S") then @@ -97,7 +97,7 @@ function BuildListClass:RenameBuild(build, copyOnName) end end end) - controls.save = new("ButtonControl", nil, -45, 70, 80, 20, "Save", function() + controls.save = new("ButtonControl", nil, {-45, 70, 80, 20}, "Save", function() local newBuildName = controls.edit.buf if build.folderName then if copyOnName then @@ -132,7 +132,7 @@ function BuildListClass:RenameBuild(build, copyOnName) self.listMode:SelectControl(self) 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() self.listMode:SelectControl(self) end) diff --git a/src/Classes/ButtonControl.lua b/src/Classes/ButtonControl.lua index 63f73b1183..a37c6fc658 100644 --- a/src/Classes/ButtonControl.lua +++ b/src/Classes/ButtonControl.lua @@ -3,8 +3,8 @@ -- Class: Button Control -- Basic button control. -- -local ButtonClass = newClass("ButtonControl", "Control", "TooltipHost", function(self, anchor, x, y, width, height, label, onClick, onHover, forceTooltip) - self.Control(anchor, x, y, width, height) +local ButtonClass = newClass("ButtonControl", "Control", "TooltipHost", function(self, anchor, rect, label, onClick, onHover, forceTooltip) + self.Control(anchor, rect) self.TooltipHost() self.label = label self.onClick = onClick diff --git a/src/Classes/CalcBreakdownControl.lua b/src/Classes/CalcBreakdownControl.lua index d335fdb8bc..2596fd75ae 100644 --- a/src/Classes/CalcBreakdownControl.lua +++ b/src/Classes/CalcBreakdownControl.lua @@ -24,7 +24,7 @@ local CalcBreakdownClass = newClass("CalcBreakdownControl", "Control", "ControlH self.rangeGuide:Load("Assets/range_guide.png") self.uiOverlay = NewImageHandle() self.uiOverlay:Load("Assets/game_ui_small.png") - self.controls.scrollBar = new("ScrollBarControl", {"RIGHT",self,"RIGHT"}, -2, 0, 18, 0, 80, "VERTICAL", true) + self.controls.scrollBar = new("ScrollBarControl", {"RIGHT",self,"RIGHT"}, {-2, 0, 18, 0}, 80, "VERTICAL", true) end) function CalcBreakdownClass:IsMouseOver() diff --git a/src/Classes/CalcSectionControl.lua b/src/Classes/CalcSectionControl.lua index e8611adf2f..bee372e91f 100644 --- a/src/Classes/CalcSectionControl.lua +++ b/src/Classes/CalcSectionControl.lua @@ -6,7 +6,7 @@ local t_insert = table.insert local CalcSectionClass = newClass("CalcSectionControl", "Control", "ControlHost", function(self, calcsTab, width, id, group, colour, subSection, updateFunc) - self.Control(calcsTab, 0, 0, width, 0) + self.Control(calcsTab, {0, 0, width, 0}) self.ControlHost() self.calcsTab = calcsTab self.id = id @@ -33,7 +33,7 @@ local CalcSectionClass = newClass("CalcSectionControl", "Control", "ControlHost" end end subSec.collapsed = subSec.defaultCollapsed - self.controls["toggle"..i] = new("ButtonControl", {"TOPRIGHT",self,"TOPRIGHT"}, -3, -13 + (16 * i), 16, 16, function() + self.controls["toggle"..i] = new("ButtonControl", {"TOPRIGHT",self,"TOPRIGHT"}, {-3, -13 + (16 * i), 16, 16}, function() return subSec.collapsed and "+" or "-" end, function() subSec.collapsed = not subSec.collapsed diff --git a/src/Classes/CalcsTab.lua b/src/Classes/CalcsTab.lua index 651c7dd7f5..a7e76fa718 100644 --- a/src/Classes/CalcsTab.lua +++ b/src/Classes/CalcsTab.lua @@ -32,13 +32,13 @@ 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 self:NewSection(3, "SkillSelect", 1, colorCodes.NORMAL, {{ defaultCollapsed = false, label = "View Skill Details", data = { { label = "Socket Group", { controlName = "mainSocketGroup", - control = new("DropDownControl", nil, 0, 0, 300, 16, nil, function(index, value) + control = new("DropDownControl", nil, {0, 0, 300, 16}, nil, function(index, value) self.input.skill_number = index self:AddUndoState() self.build.buildFlag = true @@ -52,14 +52,14 @@ local CalcsTabClass = newClass("CalcsTab", "UndoHandler", "ControlHost", "Contro } }, }, { label = "Active Skill", { controlName = "mainSkill", - control = new("DropDownControl", nil, 0, 0, 300, 16, nil, function(index, value) + control = new("DropDownControl", nil, {0, 0, 300, 16}, nil, function(index, value) local mainSocketGroup = self.build.skillsTab.socketGroupList[self.input.skill_number] mainSocketGroup.mainActiveSkillCalcs = index self.build.buildFlag = true end) }, }, { label = "Skill Part", playerFlag = "multiPart", { controlName = "mainSkillPart", - control = new("DropDownControl", nil, 0, 0, 250, 16, nil, function(index, value) + control = new("DropDownControl", nil, {0, 0, 250, 16}, nil, function(index, value) local mainSocketGroup = self.build.skillsTab.socketGroupList[self.input.skill_number] local srcInstance = mainSocketGroup.displaySkillListCalcs[mainSocketGroup.mainActiveSkillCalcs].activeEffect.srcInstance srcInstance.skillPartCalcs = index @@ -67,7 +67,7 @@ local CalcsTabClass = newClass("CalcsTab", "UndoHandler", "ControlHost", "Contro self.build.buildFlag = true end) }, },{ label = "Skill Stages", playerFlag = "multiStage", { controlName = "mainSkillStageCount", - control = new("EditControl", nil, 0, 0, 52, 16, nil, nil, "%D", nil, function(buf) + control = new("EditControl", nil, {0, 0, 52, 16}, nil, nil, "%D", nil, function(buf) local mainSocketGroup = self.build.skillsTab.socketGroupList[self.input.skill_number] local srcInstance = mainSocketGroup.displaySkillListCalcs[mainSocketGroup.mainActiveSkillCalcs].activeEffect.srcInstance srcInstance.skillStageCountCalcs = tonumber(buf) @@ -76,7 +76,7 @@ local CalcsTabClass = newClass("CalcsTab", "UndoHandler", "ControlHost", "Contro end) }, }, { label = "Active Mines", playerFlag = "mine", { controlName = "mainSkillMineCount", - control = new("EditControl", nil, 0, 0, 52, 16, nil, nil, "%D", nil, function(buf) + control = new("EditControl", nil, {0, 0, 52, 16}, nil, nil, "%D", nil, function(buf) local mainSocketGroup = self.build.skillsTab.socketGroupList[self.input.skill_number] local srcInstance = mainSocketGroup.displaySkillListCalcs[mainSocketGroup.mainActiveSkillCalcs].activeEffect.srcInstance srcInstance.skillMineCountCalcs = tonumber(buf) @@ -85,13 +85,13 @@ local CalcsTabClass = newClass("CalcsTab", "UndoHandler", "ControlHost", "Contro end) }, }, { label = "Show Minion Stats", flag = "haveMinion", { controlName = "showMinion", - control = new("CheckBoxControl", nil, 0, 0, 18, nil, function(state) + control = new("CheckBoxControl", nil, {0, 0, 18}, nil, function(state) self.input.showMinion = state self:AddUndoState() end, "Show stats for the minion instead of the player.") }, }, { label = "Minion", flag = "minion", { controlName = "mainSkillMinion", - control = new("DropDownControl", nil, 0, 0, 160, 16, nil, function(index, value) + control = new("DropDownControl", nil, {0, 0, 160, 16}, nil, function(index, value) local mainSocketGroup = self.build.skillsTab.socketGroupList[self.input.skill_number] local srcInstance = mainSocketGroup.displaySkillListCalcs[mainSocketGroup.mainActiveSkillCalcs].activeEffect.srcInstance if value.itemSetId then @@ -104,12 +104,12 @@ local CalcsTabClass = newClass("CalcsTab", "UndoHandler", "ControlHost", "Contro end) } }, { label = "Spectre Library", flag = "spectre", { controlName = "mainSkillMinionLibrary", - control = new("ButtonControl", nil, 0, 0, 100, 16, "Manage Spectres...", function() + control = new("ButtonControl", nil, {0, 0, 100, 16}, "Manage Spectres...", function() self.build:OpenSpectreLibrary() end) } }, { label = "Minion Skill", flag = "haveMinion", { controlName = "mainSkillMinionSkill", - control = new("DropDownControl", nil, 0, 0, 200, 16, nil, function(index, value) + control = new("DropDownControl", nil, {0, 0, 200, 16}, nil, function(index, value) local mainSocketGroup = self.build.skillsTab.socketGroupList[self.input.skill_number] local srcInstance = mainSocketGroup.displaySkillListCalcs[mainSocketGroup.mainActiveSkillCalcs].activeEffect.srcInstance srcInstance.skillMinionSkillCalcs = index @@ -119,7 +119,7 @@ local CalcsTabClass = newClass("CalcsTab", "UndoHandler", "ControlHost", "Contro } }, { label = "Calculation Mode", { controlName = "mode", - control = new("DropDownControl", nil, 0, 0, 100, 16, buffModeDropList, function(index, value) + control = new("DropDownControl", nil, {0, 0, 100, 16}, buffModeDropList, function(index, value) self.input.misc_buffMode = value.buffMode self:AddUndoState() self.build.buildFlag = true @@ -149,7 +149,7 @@ Effective DPS: Curses and enemy properties (such as resistances and status condi self.controls.breakdown = new("CalcBreakdownControl", self) - self.controls.scrollBar = new("ScrollBarControl", {"TOPRIGHT",self,"TOPRIGHT"}, 0, 0, 18, 0, 50, "VERTICAL", true) + self.controls.scrollBar = new("ScrollBarControl", {"TOPRIGHT",self,"TOPRIGHT"}, {0, 0, 18, 0}, 50, "VERTICAL", true) self.powerBuilderInitialized = nil end) diff --git a/src/Classes/CheckBoxControl.lua b/src/Classes/CheckBoxControl.lua index 6829818886..16a83030f9 100644 --- a/src/Classes/CheckBoxControl.lua +++ b/src/Classes/CheckBoxControl.lua @@ -3,11 +3,12 @@ -- Class: Check Box Control -- Basic check box control. -- -local CheckBoxClass = newClass("CheckBoxControl", "Control", "TooltipHost", function(self, anchor, x, y, size, label, changeFunc, tooltipText, initialState) - self.Control(anchor, x, y, size, size) +local CheckBoxClass = newClass("CheckBoxControl", "Control", "TooltipHost", function(self, anchor, rect, label, changeFunc, tooltipText, initialState) + rect[4] = rect[3] or 0 + self.Control(anchor, rect) self.TooltipHost(tooltipText) self.label = label - self.labelWidth = DrawStringWidth(size - 4, "VAR", label or "") + 5 + self.labelWidth = DrawStringWidth(self.width - 4, "VAR", label or "") + 5 self.changeFunc = changeFunc self.state = initialState end) 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 619de6d4c5..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,7 +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.controls.search,"BOTTOMLEFT"}, {0, 0, 360, 0}, varData.section) lastSection.varControlList = { } lastSection.col = varData.col lastSection.height = function(self) @@ -161,14 +161,14 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont else local control if varData.type == "check" then - control = new("CheckBoxControl", {"TOPLEFT",lastSection,"TOPLEFT"}, 234, 0, 18, varData.label, function(state) + control = new("CheckBoxControl", {"TOPLEFT",lastSection,"TOPLEFT"}, {234, 0, 18}, varData.label, function(state) self.configSets[self.activeConfigSetId].input[varData.var] = state self:AddUndoState() self:BuildModList() self.build.buildFlag = true end) elseif varData.type == "count" or varData.type == "integer" or varData.type == "countAllowZero" or varData.type == "float" then - control = new("EditControl", {"TOPLEFT",lastSection,"TOPLEFT"}, 234, 0, 90, 18, "", nil, (varData.type == "integer" and "^%-%d") or (varData.type == "float" and "^%d.") or "%D", 7, function(buf, placeholder) + control = new("EditControl", {"TOPLEFT",lastSection,"TOPLEFT"}, {234, 0, 90, 18}, "", nil, (varData.type == "integer" and "^%-%d") or (varData.type == "float" and "^%d.") or "%D", 7, function(buf, placeholder) if placeholder then self.configSets[self.activeConfigSetId].placeholder[varData.var] = tonumber(buf) else @@ -179,14 +179,14 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont self.build.buildFlag = true end) elseif varData.type == "list" then - control = new("DropDownControl", {"TOPLEFT",lastSection,"TOPLEFT"}, 234, 0, 118, 16, varData.list, function(index, value) + control = new("DropDownControl", {"TOPLEFT",lastSection,"TOPLEFT"}, {234, 0, 118, 16}, varData.list, function(index, value) self.configSets[self.activeConfigSetId].input[varData.var] = value.val self:AddUndoState() self:BuildModList() self.build.buildFlag = true end) elseif varData.type == "text" and not varData.resizable then - control = new("EditControl", {"TOPLEFT",lastSection,"TOPLEFT"}, 8, 0, 344, 118, "", nil, "^%C\t\n", nil, function(buf, placeholder) + control = new("EditControl", {"TOPLEFT",lastSection,"TOPLEFT"}, {8, 0, 344, 118}, "", nil, "^%C\t\n", nil, function(buf, placeholder) if placeholder then self.configSets[self.activeConfigSetId].placeholder[varData.var] = tostring(buf) else @@ -197,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 @@ -208,7 +208,7 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont self.build.buildFlag = true end, 16) else - control = new("Control", {"TOPLEFT",lastSection,"TOPLEFT"}, 234, 0, 16, 16) + control = new("Control", {"TOPLEFT",lastSection,"TOPLEFT"}, {234, 0, 16, 16}) end if varData.inactiveText then @@ -520,7 +520,7 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont end local labelControl = control if varData.label and varData.type ~= "check" then - labelControl = new("LabelControl", {"RIGHT",control,"LEFT"}, -4, 0, 0, DrawStringWidth(14, "VAR", varData.label) > 228 and 12 or 14, "^7"..varData.label) + labelControl = new("LabelControl", {"RIGHT",control,"LEFT"}, {-4, 0, 0, DrawStringWidth(14, "VAR", varData.label) > 228 and 12 or 14}, "^7"..varData.label) t_insert(self.controls, labelControl) end if varData.var then @@ -608,7 +608,7 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont t_insert(lastSection.varControlList, control) end end - self.controls.scrollBar = new("ScrollBarControl", {"TOPRIGHT",self,"TOPRIGHT"}, 0, 0, 18, 0, 50, "VERTICAL", true) + self.controls.scrollBar = new("ScrollBarControl", {"TOPRIGHT",self,"TOPRIGHT"}, {0, 0, 18, 0}, 50, "VERTICAL", true) end) function ConfigTabClass:Load(xml, fileName) @@ -935,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 914d065171..110eb6884e 100644 --- a/src/Classes/Control.lua +++ b/src/Classes/Control.lua @@ -18,11 +18,23 @@ local anchorPos = { ["CENTER"] = { 0.5, 0.5 }, } -local ControlClass = newClass("Control", function(self, anchor, x, y, width, height) - self.x = x or 0 - self.y = y or 0 - self.width = width or 0 - self.height = height or 0 +--[[ +local rect = { + x, + y, + width, + height, + } + + could possibly have + minWidth, + minHeight, + for containers +--]] + +local ControlClass = newClass("Control", function(self, anchor, rect) + self.rectStart = rect or {0, 0, 0, 0} + self.x, self.y, self.width, self.height = unpack(self.rectStart) self.shown = true self.enabled = true self.anchor = { } 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/DropDownControl.lua b/src/Classes/DropDownControl.lua index 27a9648209..3a4bb6e26a 100644 --- a/src/Classes/DropDownControl.lua +++ b/src/Classes/DropDownControl.lua @@ -8,8 +8,8 @@ local m_min = math.min local m_max = math.max local m_floor = math.floor -local DropDownClass = newClass("DropDownControl", "Control", "ControlHost", "TooltipHost", "SearchHost", function(self, anchor, x, y, width, height, list, selFunc, tooltipText) - self.Control(anchor, x, y, width, height) +local DropDownClass = newClass("DropDownControl", "Control", "ControlHost", "TooltipHost", "SearchHost", function(self, anchor, rect, list, selFunc, tooltipText) + self.Control(anchor, rect) self.ControlHost() self.TooltipHost(tooltipText) self.SearchHost( @@ -30,7 +30,7 @@ local DropDownClass = newClass("DropDownControl", "Control", "ControlHost", "Too return StripEscapes(listVal) end ) - self.controls.scrollBar = new("ScrollBarControl", {"TOPRIGHT",self,"TOPRIGHT"}, -1, 0, 18, 0, (height - 4) * 4) + self.controls.scrollBar = new("ScrollBarControl", {"TOPRIGHT",self,"TOPRIGHT"}, {-1, 0, 18, 0}, (self.height - 4) * 4) self.controls.scrollBar.height = function() return self.dropHeight + 2 end diff --git a/src/Classes/EditControl.lua b/src/Classes/EditControl.lua index 17abfce044..63eedfa1eb 100644 --- a/src/Classes/EditControl.lua +++ b/src/Classes/EditControl.lua @@ -35,9 +35,9 @@ local function newlineCount(str) end end -local EditClass = newClass("EditControl", "ControlHost", "Control", "UndoHandler", "TooltipHost", function(self, anchor, x, y, width, height, init, prompt, filter, limit, changeFunc, lineHeight, allowZoom, clearable) +local EditClass = newClass("EditControl", "ControlHost", "Control", "UndoHandler", "TooltipHost", function(self, anchor, rect, init, prompt, filter, limit, changeFunc, lineHeight, allowZoom, clearable) self.ControlHost() - self.Control(anchor, x, y, width, height) + self.Control(anchor, rect) self.UndoHandler() self.TooltipHost() self:SetText(init or "") @@ -63,24 +63,24 @@ local EditClass = newClass("EditControl", "ControlHost", "Control", "UndoHandler if self.filter == "%D" or self.filter == "^%-%d" then -- Add +/- buttons for integer number edits self.isNumeric = true - self.controls.buttonDown = new("ButtonControl", {"RIGHT",self,"RIGHT"}, -2, 0, buttonSize, buttonSize, "-", function() + self.controls.buttonDown = new("ButtonControl", {"RIGHT",self,"RIGHT"}, {-2, 0, buttonSize, buttonSize}, "-", function() self:OnKeyUp("DOWN") end) - self.controls.buttonUp = new("ButtonControl", {"RIGHT",self.controls.buttonDown,"LEFT"}, -1, 0, buttonSize, buttonSize, "+", function() + self.controls.buttonUp = new("ButtonControl", {"RIGHT",self.controls.buttonDown,"LEFT"}, {-1, 0, buttonSize, buttonSize}, "+", function() self:OnKeyUp("UP") end) elseif clearable then - self.controls.buttonClear = new("ButtonControl", {"RIGHT",self,"RIGHT"}, -2, 0, buttonSize, buttonSize, "x", function() + self.controls.buttonClear = new("ButtonControl", {"RIGHT",self,"RIGHT"}, {-2, 0, buttonSize, buttonSize}, "x", function() self:SetText("", true) end) self.controls.buttonClear.shown = function() return #self.buf > 0 and self:IsMouseInBounds() end end - self.controls.scrollBarH = new("ScrollBarControl", {"BOTTOMLEFT",self,"BOTTOMLEFT"}, 1, -1, 0, 14, 60, "HORIZONTAL", true) + self.controls.scrollBarH = new("ScrollBarControl", {"BOTTOMLEFT",self,"BOTTOMLEFT"}, {1, -1, 0, 14}, 60, "HORIZONTAL", true) self.controls.scrollBarH.width = function() local width, height = self:GetSize() return width - (self.controls.scrollBarV.enabled and 16 or 2) end - self.controls.scrollBarV = new("ScrollBarControl", {"TOPRIGHT",self,"TOPRIGHT"}, -1, 1, 14, 0, (lineHeight or 0) * 3, "VERTICAL", true) + self.controls.scrollBarV = new("ScrollBarControl", {"TOPRIGHT",self,"TOPRIGHT"}, {-1, 1, 14, 0}, (lineHeight or 0) * 3, "VERTICAL", true) self.controls.scrollBarV.height = function() local width, height = self:GetSize() return height - (self.controls.scrollBarH.enabled and 16 or 2) 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/FolderListControl.lua b/src/Classes/FolderListControl.lua index 461beb49b0..ae4cf5e620 100644 --- a/src/Classes/FolderListControl.lua +++ b/src/Classes/FolderListControl.lua @@ -6,10 +6,10 @@ local ipairs = ipairs local t_insert = table.insert -local FolderListClass = newClass("FolderListControl", "ListControl", function(self, anchor, x, y, width, height, subPath, onChange) - self.ListControl(anchor, x, y, width, height, 16, "VERTICAL", false, { }) +local FolderListClass = newClass("FolderListControl", "ListControl", function(self, anchor, rect, subPath, onChange) + self.ListControl(anchor, rect, 16, "VERTICAL", false, { }) self.subPath = subPath or "" - self.controls.path = new("PathControl", {"BOTTOM",self,"TOP"}, 0, -2, width, 24, main.buildPath, self.subPath, function(subPath) + self.controls.path = new("PathControl", {"BOTTOM",self,"TOP"}, {0, -2, self.width, 24}, main.buildPath, self.subPath, function(subPath) self.subPath = subPath self:BuildList() self.selIndex = nil diff --git a/src/Classes/GemSelectControl.lua b/src/Classes/GemSelectControl.lua index f492ff2bdd..84fc03e6bc 100644 --- a/src/Classes/GemSelectControl.lua +++ b/src/Classes/GemSelectControl.lua @@ -19,15 +19,15 @@ local altQualMap = { ["Alternate3"] = "Phantasmal ", } -local GemSelectClass = newClass("GemSelectControl", "EditControl", function(self, anchor, x, y, width, height, skillsTab, index, changeFunc, forceTooltip) - self.EditControl(anchor, x, y, width, height, nil, nil, "^ %a':-") - self.controls.scrollBar = new("ScrollBarControl", { "TOPRIGHT", self, "TOPRIGHT" }, -1, 0, 18, 0, (height - 4) * 4) +local GemSelectClass = newClass("GemSelectControl", "EditControl", function(self, anchor, rect, skillsTab, index, changeFunc, forceTooltip) + self.EditControl(anchor, rect, nil, nil, "^ %a':-") + self.controls.scrollBar = new("ScrollBarControl", { "TOPRIGHT", self, "TOPRIGHT" }, {-1, 0, 18, 0}, (self.height - 4) * 4) self.controls.scrollBar.y = function() local width, height = self:GetSize() return height + 1 end self.controls.scrollBar.height = function() - return (height - 4) * m_min(#self.list, 15) + 2 + return (self.height - 4) * m_min(#self.list, 15) + 2 end self.controls.scrollBar.shown = function() return self.dropped and self.controls.scrollBar.enabled diff --git a/src/Classes/ImportTab.lua b/src/Classes/ImportTab.lua index a3197bcd99..4dbab4dbb3 100644 --- a/src/Classes/ImportTab.lua +++ b/src/Classes/ImportTab.lua @@ -27,19 +27,19 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function( self.charImportMode = "GETACCOUNTNAME" self.charImportStatus = "Idle" - self.controls.sectionCharImport = new("SectionControl", {"TOPLEFT",self,"TOPLEFT"}, 10, 18, 650, 250, "Character Import") - self.controls.charImportStatusLabel = new("LabelControl", {"TOPLEFT",self.controls.sectionCharImport,"TOPLEFT"}, 6, 14, 200, 16, function() + self.controls.sectionCharImport = new("SectionControl", {"TOPLEFT",self,"TOPLEFT"}, {10, 18, 650, 250}, "Character Import") + self.controls.charImportStatusLabel = new("LabelControl", {"TOPLEFT",self.controls.sectionCharImport,"TOPLEFT"}, {6, 14, 200, 16}, function() return "^7Character import status: "..self.charImportStatus end) -- Stage: input account name - self.controls.accountNameHeader = new("LabelControl", {"TOPLEFT",self.controls.sectionCharImport,"TOPLEFT"}, 6, 40, 200, 16, "^7To start importing a character, enter the character's account name:") + self.controls.accountNameHeader = new("LabelControl", {"TOPLEFT",self.controls.sectionCharImport,"TOPLEFT"}, {6, 40, 200, 16}, "^7To start importing a character, enter the character's account name:") self.controls.accountNameHeader.shown = function() return self.charImportMode == "GETACCOUNTNAME" end - self.controls.accountRealm = new("DropDownControl", {"TOPLEFT",self.controls.accountNameHeader,"BOTTOMLEFT"}, 0, 4, 60, 20, realmList ) + self.controls.accountRealm = new("DropDownControl", {"TOPLEFT",self.controls.accountNameHeader,"BOTTOMLEFT"}, {0, 4, 60, 20}, realmList ) self.controls.accountRealm:SelByValue( main.lastRealm or "PC", "id" ) - self.controls.accountName = new("EditControl", {"LEFT",self.controls.accountRealm,"RIGHT"}, 8, 0, 200, 20, main.lastAccountName or "", nil, "%c", nil, nil, nil, nil, true) + self.controls.accountName = new("EditControl", {"LEFT",self.controls.accountRealm,"RIGHT"}, {8, 0, 200, 20}, main.lastAccountName or "", nil, "%c", nil, nil, nil, nil, true) self.controls.accountName.pasteFilter = function(text) return text:gsub("[\128-\255]",function(c) return codePointToUTF8(c:byte(1)):gsub(".",function(c) @@ -58,7 +58,7 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function( return a:lower() < b:lower() end) end -- don't load the list many times - self.controls.accountNameGo = new("ButtonControl", {"LEFT",self.controls.accountName,"RIGHT"}, 8, 0, 60, 20, "Start", function() + self.controls.accountNameGo = new("ButtonControl", {"LEFT",self.controls.accountName,"RIGHT"}, {8, 0, 60, 20}, "Start", function() self.controls.sessionInput.buf = "" self:DownloadCharacterList() end) @@ -66,13 +66,13 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function( return self.controls.accountName.buf:match("%S") end - self.controls.accountHistory = new("DropDownControl", {"LEFT",self.controls.accountNameGo,"RIGHT"}, 8, 0, 200, 20, historyList, function() + self.controls.accountHistory = new("DropDownControl", {"LEFT",self.controls.accountNameGo,"RIGHT"}, {8, 0, 200, 20}, historyList, function() self.controls.accountName.buf = self.controls.accountHistory.list[self.controls.accountHistory.selIndex] end) self.controls.accountHistory:SelByValue(main.lastAccountName) self.controls.accountHistory:CheckDroppedWidth(true) - self.controls.removeAccount = new("ButtonControl", {"LEFT",self.controls.accountHistory,"RIGHT"}, 8, 0, 20, 20, "X", function() + self.controls.removeAccount = new("ButtonControl", {"LEFT",self.controls.accountHistory,"RIGHT"}, {8, 0, 20, 20}, "X", function() local accountName = self.controls.accountHistory.list[self.controls.accountHistory.selIndex] if (accountName ~= nil) then t_remove(self.controls.accountHistory.list, self.controls.accountHistory.selIndex) @@ -86,13 +86,13 @@ local ImportTabClass = newClass("ImportTab", "ControlHost", "Control", function( tooltip:AddLine(16, "^7Removes account from the dropdown list") end - self.controls.accountNameUnicode = new("LabelControl", {"TOPLEFT",self.controls.accountRealm,"BOTTOMLEFT"}, 0, 16, 0, 14, "^7Note: if the account name contains non-ASCII characters then it must be URL encoded first.") - self.controls.accountNameURLEncoder = new("ButtonControl", {"TOPLEFT",self.controls.accountNameUnicode,"BOTTOMLEFT"}, 0, 4, 170, 18, "^x4040FFhttps://www.urlencoder.org/", function() + self.controls.accountNameUnicode = new("LabelControl", {"TOPLEFT",self.controls.accountRealm,"BOTTOMLEFT"}, {0, 16, 0, 14}, "^7Note: if the account name contains non-ASCII characters then it must be URL encoded first.") + self.controls.accountNameURLEncoder = new("ButtonControl", {"TOPLEFT",self.controls.accountNameUnicode,"BOTTOMLEFT"}, {0, 4, 170, 18}, "^x4040FFhttps://www.urlencoder.org/", function() OpenURL("https://www.urlencoder.org/") end) -- Stage: input POESESSID - self.controls.sessionHeader = new("LabelControl", {"TOPLEFT",self.controls.sectionCharImport,"TOPLEFT"}, 6, 40, 200, 14) + self.controls.sessionHeader = new("LabelControl", {"TOPLEFT",self.controls.sectionCharImport,"TOPLEFT"}, {6, 40, 200, 14}) self.controls.sessionHeader.label = function() return [[ ^7The list of characters on ']]..self.controls.accountName.buf..[[' couldn't be retrieved. This may be because: @@ -107,19 +107,19 @@ You can get this from your web browser's cookies while logged into the Path of E self.controls.sessionHeader.shown = function() return self.charImportMode == "GETSESSIONID" end - self.controls.sessionRetry = new("ButtonControl", {"TOPLEFT",self.controls.sessionHeader,"TOPLEFT"}, 0, 108, 60, 20, "Retry", function() + self.controls.sessionRetry = new("ButtonControl", {"TOPLEFT",self.controls.sessionHeader,"TOPLEFT"}, {0, 108, 60, 20}, "Retry", function() self:DownloadCharacterList() end) - self.controls.sessionCancel = new("ButtonControl", {"LEFT",self.controls.sessionRetry,"RIGHT"}, 8, 0, 60, 20, "Cancel", function() + self.controls.sessionCancel = new("ButtonControl", {"LEFT",self.controls.sessionRetry,"RIGHT"}, {8, 0, 60, 20}, "Cancel", function() self.charImportMode = "GETACCOUNTNAME" self.charImportStatus = "Idle" end) - self.controls.sessionPrivacySettings = new("ButtonControl", {"LEFT",self.controls.sessionCancel,"RIGHT"}, 8, 0, 120, 20, "Privacy Settings", function() + self.controls.sessionPrivacySettings = new("ButtonControl", {"LEFT",self.controls.sessionCancel,"RIGHT"}, {8, 0, 120, 20}, "Privacy Settings", function() OpenURL('https://www.pathofexile.com/my-account/privacy') end) - self.controls.sessionInput = new("EditControl", {"TOPLEFT",self.controls.sessionRetry,"BOTTOMLEFT"}, 0, 8, 350, 20, "", "POESESSID", "%X", 32) + self.controls.sessionInput = new("EditControl", {"TOPLEFT",self.controls.sessionRetry,"BOTTOMLEFT"}, {0, 8, 350, 20}, "", "POESESSID", "%X", 32) self.controls.sessionInput:SetProtected(true) - self.controls.sessionGo = new("ButtonControl", {"LEFT",self.controls.sessionInput,"RIGHT"}, 8, 0, 60, 20, "Go", function() + self.controls.sessionGo = new("ButtonControl", {"LEFT",self.controls.sessionInput,"RIGHT"}, {8, 0, 60, 20}, "Go", function() self:DownloadCharacterList() end) self.controls.sessionGo.enabled = function() @@ -127,20 +127,20 @@ You can get this from your web browser's cookies while logged into the Path of E end -- Stage: select character and import data - self.controls.charSelectHeader = new("LabelControl", {"TOPLEFT",self.controls.sectionCharImport,"TOPLEFT"}, 6, 40, 200, 16, "^7Choose character to import data from:") + self.controls.charSelectHeader = new("LabelControl", {"TOPLEFT",self.controls.sectionCharImport,"TOPLEFT"}, {6, 40, 200, 16}, "^7Choose character to import data from:") self.controls.charSelectHeader.shown = function() return self.charImportMode == "SELECTCHAR" or self.charImportMode == "IMPORTING" end - self.controls.charSelectLeagueLabel = new("LabelControl", {"TOPLEFT",self.controls.charSelectHeader,"BOTTOMLEFT"}, 0, 6, 0, 14, "^7League:") - self.controls.charSelectLeague = new("DropDownControl", {"LEFT",self.controls.charSelectLeagueLabel,"RIGHT"}, 4, 0, 150, 18, nil, function(index, value) + self.controls.charSelectLeagueLabel = new("LabelControl", {"TOPLEFT",self.controls.charSelectHeader,"BOTTOMLEFT"}, {0, 6, 0, 14}, "^7League:") + self.controls.charSelectLeague = new("DropDownControl", {"LEFT",self.controls.charSelectLeagueLabel,"RIGHT"}, {4, 0, 150, 18}, nil, function(index, value) self:BuildCharacterList(value.league) end) - self.controls.charSelect = new("DropDownControl", {"TOPLEFT",self.controls.charSelectHeader,"BOTTOMLEFT"}, 0, 24, 400, 18) + self.controls.charSelect = new("DropDownControl", {"TOPLEFT",self.controls.charSelectHeader,"BOTTOMLEFT"}, {0, 24, 400, 18}) self.controls.charSelect.enabled = function() return self.charImportMode == "SELECTCHAR" end - self.controls.charImportHeader = new("LabelControl", {"TOPLEFT",self.controls.charSelect,"BOTTOMLEFT"}, 0, 16, 200, 16, "Import:") - self.controls.charImportTree = new("ButtonControl", {"LEFT",self.controls.charImportHeader, "RIGHT"}, 8, 0, 170, 20, "Passive Tree and Jewels", function() + self.controls.charImportHeader = new("LabelControl", {"TOPLEFT",self.controls.charSelect,"BOTTOMLEFT"}, {0, 16, 200, 16}, "Import:") + self.controls.charImportTree = new("ButtonControl", {"LEFT",self.controls.charImportHeader, "RIGHT"}, {8, 0, 170, 20}, "Passive Tree and Jewels", function() if self.build.spec:CountAllocNodes() > 0 then main:OpenConfirmPopup("Character Import", "Importing the passive tree will overwrite your current tree.", "Import", function() self:DownloadPassiveTree() @@ -152,38 +152,38 @@ You can get this from your web browser's cookies while logged into the Path of E self.controls.charImportTree.enabled = function() return self.charImportMode == "SELECTCHAR" end - self.controls.charImportTreeClearJewels = new("CheckBoxControl", {"LEFT",self.controls.charImportTree,"RIGHT"}, 90, 0, 18, "Delete jewels:", nil, "Delete all existing jewels when importing.", true) - self.controls.charImportItems = new("ButtonControl", {"LEFT",self.controls.charImportTree, "LEFT"}, 0, 36, 110, 20, "Items and Skills", function() + self.controls.charImportTreeClearJewels = new("CheckBoxControl", {"LEFT",self.controls.charImportTree,"RIGHT"}, {90, 0, 18}, "Delete jewels:", nil, "Delete all existing jewels when importing.", true) + self.controls.charImportItems = new("ButtonControl", {"LEFT",self.controls.charImportTree, "LEFT"}, {0, 36, 110, 20}, "Items and Skills", function() self:DownloadItems() end) self.controls.charImportItems.enabled = function() return self.charImportMode == "SELECTCHAR" end - self.controls.charImportItemsClearSkills = new("CheckBoxControl", {"LEFT",self.controls.charImportItems,"RIGHT"}, 85, 0, 18, "Delete skills:", nil, "Delete all existing skills when importing.", true) - self.controls.charImportItemsClearItems = new("CheckBoxControl", {"LEFT",self.controls.charImportItems,"RIGHT"}, 220, 0, 18, "Delete equipment:", nil, "Delete all equipped items when importing.", true) - self.controls.charImportItemsIgnoreWeaponSwap = new("CheckBoxControl", {"LEFT",self.controls.charImportItems,"RIGHT"}, 380, 0, 18, "Ignore weapon swap:", nil, "Ignore items and skills in weapon swap.", false) - self.controls.charBanditNote = new("LabelControl", {"TOPLEFT",self.controls.charImportHeader,"BOTTOMLEFT"}, 0, 50, 200, 14, "^7Tip: After you finish importing a character, make sure you update the bandit choice,\nas it cannot be imported.") + self.controls.charImportItemsClearSkills = new("CheckBoxControl", {"LEFT",self.controls.charImportItems,"RIGHT"}, {85, 0, 18}, "Delete skills:", nil, "Delete all existing skills when importing.", true) + self.controls.charImportItemsClearItems = new("CheckBoxControl", {"LEFT",self.controls.charImportItems,"RIGHT"}, {220, 0, 18}, "Delete equipment:", nil, "Delete all equipped items when importing.", true) + self.controls.charImportItemsIgnoreWeaponSwap = new("CheckBoxControl", {"LEFT",self.controls.charImportItems,"RIGHT"}, {380, 0, 18}, "Ignore weapon swap:", nil, "Ignore items and skills in weapon swap.", false) + self.controls.charBanditNote = new("LabelControl", {"TOPLEFT",self.controls.charImportHeader,"BOTTOMLEFT"}, {0, 50, 200, 14}, "^7Tip: After you finish importing a character, make sure you update the bandit choice,\nas it cannot be imported.") - self.controls.charClose = new("ButtonControl", {"TOPLEFT",self.controls.charImportHeader,"BOTTOMLEFT"}, 0, 90, 60, 20, "Close", function() + self.controls.charClose = new("ButtonControl", {"TOPLEFT",self.controls.charImportHeader,"BOTTOMLEFT"}, {0, 90, 60, 20}, "Close", function() self.charImportMode = "GETACCOUNTNAME" self.charImportStatus = "Idle" end) -- Build import/export - self.controls.sectionBuild = new("SectionControl", {"TOPLEFT",self.controls.sectionCharImport,"BOTTOMLEFT"}, 0, 18, 650, 182, "Build Sharing") - self.controls.generateCodeLabel = new("LabelControl", {"TOPLEFT",self.controls.sectionBuild,"TOPLEFT"}, 6, 14, 0, 16, "^7Generate a code to share this build with other Path of Building users:") - self.controls.generateCode = new("ButtonControl", {"LEFT",self.controls.generateCodeLabel,"RIGHT"}, 4, 0, 80, 20, "Generate", function() + self.controls.sectionBuild = new("SectionControl", {"TOPLEFT",self.controls.sectionCharImport,"BOTTOMLEFT"}, {0, 18, 650, 182}, "Build Sharing") + self.controls.generateCodeLabel = new("LabelControl", {"TOPLEFT",self.controls.sectionBuild,"TOPLEFT"}, {6, 14, 0, 16}, "^7Generate a code to share this build with other Path of Building users:") + self.controls.generateCode = new("ButtonControl", {"LEFT",self.controls.generateCodeLabel,"RIGHT"}, {4, 0, 80, 20}, "Generate", function() self.controls.generateCodeOut:SetText(common.base64.encode(Deflate(self.build:SaveDB("code"))):gsub("+","-"):gsub("/","_")) end) - self.controls.enablePartyExportBuffs = new("CheckBoxControl", {"LEFT",self.controls.generateCode,"RIGHT"}, 100, 0, 18, "Export Support", function(state) + self.controls.enablePartyExportBuffs = new("CheckBoxControl", {"LEFT",self.controls.generateCode,"RIGHT"}, {100, 0, 18}, "Export Support", function(state) self.build.partyTab.enableExportBuffs = state self.build.buildFlag = true end, "This is for party play, to export support character, it enables the exporting of auras, curses and modifiers to the enemy", false) - self.controls.generateCodeOut = new("EditControl", {"TOPLEFT",self.controls.generateCodeLabel,"BOTTOMLEFT"}, 0, 8, 250, 20, "", "Code", "%Z") + self.controls.generateCodeOut = new("EditControl", {"TOPLEFT",self.controls.generateCodeLabel,"BOTTOMLEFT"}, {0, 8, 250, 20}, "", "Code", "%Z") self.controls.generateCodeOut.enabled = function() return #self.controls.generateCodeOut.buf > 0 end - self.controls.generateCodeCopy = new("ButtonControl", {"LEFT",self.controls.generateCodeOut,"RIGHT"}, 8, 0, 60, 20, "Copy", function() + self.controls.generateCodeCopy = new("ButtonControl", {"LEFT",self.controls.generateCodeOut,"RIGHT"}, {8, 0, 60, 20}, "Copy", function() Copy(self.controls.generateCodeOut.buf) self.controls.generateCodeOut:SetText("") end) @@ -203,12 +203,12 @@ You can get this from your web browser's cookies while logged into the Path of E end local exportWebsitesList = getExportSitesFromImportList() - self.controls.exportFrom = new("DropDownControl", { "LEFT", self.controls.generateCodeCopy,"RIGHT"}, 8, 0, 120, 20, exportWebsitesList, function(_, selectedWebsite) + self.controls.exportFrom = new("DropDownControl", { "LEFT", self.controls.generateCodeCopy,"RIGHT"}, {8, 0, 120, 20}, exportWebsitesList, function(_, selectedWebsite) main.lastExportWebsite = selectedWebsite.id self.exportWebsiteSelected = selectedWebsite.id end) self.controls.exportFrom:SelByValue(self.exportWebsiteSelected or main.lastExportWebsite or "Pastebin", "id") - self.controls.generateCodeByLink = new("ButtonControl", { "LEFT", self.controls.exportFrom, "RIGHT"}, 8, 0, 100, 20, "Share", function() + self.controls.generateCodeByLink = new("ButtonControl", { "LEFT", self.controls.exportFrom, "RIGHT"}, {8, 0, 100, 20}, "Share", function() local exportWebsite = exportWebsitesList[self.controls.exportFrom.selIndex] local response = buildSites.UploadBuild(self.controls.generateCodeOut.buf, exportWebsite) if response then @@ -240,8 +240,8 @@ You can get this from your web browser's cookies while logged into the Path of E end return #self.controls.generateCodeOut.buf > 0 end - self.controls.generateCodeNote = new("LabelControl", {"TOPLEFT",self.controls.generateCodeOut,"BOTTOMLEFT"}, 0, 4, 0, 14, "^7Note: this code can be very long; you can use 'Share' to shrink it.") - self.controls.importCodeHeader = new("LabelControl", {"TOPLEFT",self.controls.generateCodeNote,"BOTTOMLEFT"}, 0, 26, 0, 16, "^7To import a build, enter URL or code here:") + self.controls.generateCodeNote = new("LabelControl", {"TOPLEFT",self.controls.generateCodeOut,"BOTTOMLEFT"}, {0, 4, 0, 14}, "^7Note: this code can be very long; you can use 'Share' to shrink it.") + self.controls.importCodeHeader = new("LabelControl", {"TOPLEFT",self.controls.generateCodeNote,"BOTTOMLEFT"}, {0, 26, 0, 16}, "^7To import a build, enter URL or code here:") local importCodeHandle = function (buf) self.importCodeSite = nil @@ -307,21 +307,21 @@ You can get this from your web browser's cookies while logged into the Path of E end end - self.controls.importCodeIn = new("EditControl", {"TOPLEFT",self.controls.importCodeHeader,"BOTTOMLEFT"}, 0, 4, 328, 20, "", nil, nil, nil, importCodeHandle, nil, nil, true) + self.controls.importCodeIn = new("EditControl", {"TOPLEFT",self.controls.importCodeHeader,"BOTTOMLEFT"}, {0, 4, 328, 20}, "", nil, nil, nil, importCodeHandle, nil, nil, true) self.controls.importCodeIn.enterFunc = function() if self.importCodeValid then self.controls.importCodeGo.onClick() end end - self.controls.importCodeState = new("LabelControl", {"LEFT",self.controls.importCodeIn,"RIGHT"}, 8, 0, 0, 16) + self.controls.importCodeState = new("LabelControl", {"LEFT",self.controls.importCodeIn,"RIGHT"}, {8, 0, 0, 16}) self.controls.importCodeState.label = function() return self.importCodeDetail or "" end - self.controls.importCodeMode = new("DropDownControl", {"TOPLEFT",self.controls.importCodeIn,"BOTTOMLEFT"}, 0, 4, 160, 20, { "Import to this build", "Import to a new build" }) + self.controls.importCodeMode = new("DropDownControl", {"TOPLEFT",self.controls.importCodeIn,"BOTTOMLEFT"}, {0, 4, 160, 20}, { "Import to this build", "Import to a new build" }) self.controls.importCodeMode.enabled = function() return self.build.dbFileName and self.importCodeValid end - self.controls.importCodeGo = new("ButtonControl", {"LEFT",self.controls.importCodeMode,"RIGHT"}, 8, 0, 160, 20, "Import", function() + self.controls.importCodeGo = new("ButtonControl", {"LEFT",self.controls.importCodeMode,"RIGHT"}, {8, 0, 160, 20}, "Import", function() if self.importCodeSite and not self.importCodeXML then self.importCodeFetching = true local selectedWebsite = buildSites.websiteList[self.importCodeSite] diff --git a/src/Classes/ItemDBControl.lua b/src/Classes/ItemDBControl.lua index e0a4a35282..12eeb4c2a2 100644 --- a/src/Classes/ItemDBControl.lua +++ b/src/Classes/ItemDBControl.lua @@ -10,8 +10,8 @@ local m_max = math.max local m_floor = math.floor -local ItemDBClass = newClass("ItemDBControl", "ListControl", function(self, anchor, x, y, width, height, itemsTab, db, dbType) - self.ListControl(anchor, x, y, width, height, 16, "VERTICAL", false) +local ItemDBClass = newClass("ItemDBControl", "ListControl", function(self, anchor, rect, itemsTab, db, dbType) + self.ListControl(anchor, rect, 16, "VERTICAL", false) self.itemsTab = itemsTab self.db = db self.dbType = dbType @@ -28,31 +28,31 @@ local ItemDBClass = newClass("ItemDBControl", "ListControl", function(self, anch self.typeList = { "Any type", "Armour", "Jewellery", "One Handed Melee", "Two Handed Melee" } self.slotList = { "Any slot", "Weapon 1", "Weapon 2", "Helmet", "Body Armour", "Gloves", "Boots", "Amulet", "Ring", "Belt", "Jewel" } local baseY = dbType == "RARE" and -22 or -62 - self.controls.slot = new("DropDownControl", {"BOTTOMLEFT",self,"TOPLEFT"}, 0, baseY, 179, 18, self.slotList, function(index, value) + self.controls.slot = new("DropDownControl", {"BOTTOMLEFT",self,"TOPLEFT"}, {0, baseY, 179, 18}, self.slotList, function(index, value) self.listBuildFlag = true end) - self.controls.type = new("DropDownControl", {"LEFT",self.controls.slot,"RIGHT"}, 2, 0, 179, 18, self.typeList, function(index, value) + self.controls.type = new("DropDownControl", {"LEFT",self.controls.slot,"RIGHT"}, {2, 0, 179, 18}, self.typeList, function(index, value) self.listBuildFlag = true end) if dbType == "UNIQUE" then - self.controls.sort = new("DropDownControl", {"BOTTOMLEFT",self,"TOPLEFT"}, 0, baseY + 20, 179, 18, self.sortDropList, function(index, value) + self.controls.sort = new("DropDownControl", {"BOTTOMLEFT",self,"TOPLEFT"}, {0, baseY + 20, 179, 18}, self.sortDropList, function(index, value) self:SetSortMode(value.sortMode) GlobalCache.useFullDPS = value.sortMode == "FullDPS" end) - self.controls.league = new("DropDownControl", {"LEFT",self.controls.sort,"RIGHT"}, 2, 0, 179, 18, self.leagueList, function(index, value) + self.controls.league = new("DropDownControl", {"LEFT",self.controls.sort,"RIGHT"}, {2, 0, 179, 18}, self.leagueList, function(index, value) self.listBuildFlag = true end) - self.controls.requirement = new("DropDownControl", {"LEFT",self.controls.sort,"BOTTOMLEFT"}, 0, 11, 179, 18, { "Any requirements", "Current level", "Current attributes", "Current useable" }, function(index, value) + self.controls.requirement = new("DropDownControl", {"LEFT",self.controls.sort,"BOTTOMLEFT"}, {0, 11, 179, 18}, { "Any requirements", "Current level", "Current attributes", "Current useable" }, function(index, value) self.listBuildFlag = true end) - self.controls.obtainable = new("DropDownControl", {"LEFT",self.controls.requirement,"RIGHT"}, 2, 0, 179, 18, { "Obtainable", "Any source", "Unobtainable", "Vendor Recipe", "Upgraded", "Boss Item", "Corruption"}, function(index, value) + self.controls.obtainable = new("DropDownControl", {"LEFT",self.controls.requirement,"RIGHT"}, {2, 0, 179, 18}, { "Obtainable", "Any source", "Unobtainable", "Vendor Recipe", "Upgraded", "Boss Item", "Corruption"}, function(index, value) self.listBuildFlag = true end) end - self.controls.search = new("EditControl", {"BOTTOMLEFT",self,"TOPLEFT"}, 0, -2, 258, 18, "", "Search", "%c", 100, function() + self.controls.search = new("EditControl", {"BOTTOMLEFT",self,"TOPLEFT"}, {0, -2, 258, 18}, "", "Search", "%c", 100, function() self.listBuildFlag = true end, nil, nil, true) - self.controls.searchMode = new("DropDownControl", {"LEFT",self.controls.search,"RIGHT"}, 2, 0, 100, 18, { "Anywhere", "Names", "Modifiers" }, function(index, value) + self.controls.searchMode = new("DropDownControl", {"LEFT",self.controls.search,"RIGHT"}, {2, 0, 100, 18}, { "Anywhere", "Names", "Modifiers" }, function(index, value) self.listBuildFlag = true end) self:BuildSortOrder() diff --git a/src/Classes/ItemListControl.lua b/src/Classes/ItemListControl.lua index f3bce38c19..53f9fde103 100644 --- a/src/Classes/ItemListControl.lua +++ b/src/Classes/ItemListControl.lua @@ -6,19 +6,19 @@ local pairs = pairs local t_insert = table.insert -local ItemListClass = newClass("ItemListControl", "ListControl", function(self, anchor, x, y, width, height, itemsTab, forceTooltip) - self.ListControl(anchor, x, y, width, height, 16, "VERTICAL", true, itemsTab.itemOrderList, forceTooltip) +local ItemListClass = newClass("ItemListControl", "ListControl", function(self, anchor, rect, itemsTab, forceTooltip) + self.ListControl(anchor, rect, 16, "VERTICAL", true, itemsTab.itemOrderList, forceTooltip) self.itemsTab = itemsTab self.label = "^7All items:" self.defaultText = "^x7F7F7FThis is the list of items that have been added to this build.\nYou can add items to this list by dragging them from\none of the other lists, or by clicking 'Add to build' when\nviewing an item." self.dragTargetList = { } - self.controls.delete = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, 0, -2, 60, 18, "Delete", function() + self.controls.delete = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, {0, -2, 60, 18}, "Delete", function() self:OnSelDelete(self.selIndex, self.selValue) end) self.controls.delete.enabled = function() return self.selValue ~= nil end - self.controls.deleteAll = new("ButtonControl", {"RIGHT",self.controls.delete,"LEFT"}, -4, 0, 70, 18, "Delete All", function() + self.controls.deleteAll = new("ButtonControl", {"RIGHT",self.controls.delete,"LEFT"}, {-4, 0, 70, 18}, "Delete All", function() main:OpenConfirmPopup("Delete All", "Are you sure you want to delete all items in this build?", "Delete", function() for _, slot in pairs(itemsTab.slots) do slot:SetSelItemId(0) @@ -40,7 +40,7 @@ local ItemListClass = newClass("ItemListControl", "ListControl", function(self, self.controls.deleteAll.enabled = function() return #self.list > 0 end - self.controls.deleteUnused = new("ButtonControl", {"RIGHT",self.controls.deleteAll,"LEFT"}, -4, 0, 100, 18, "Delete Unused", function() + self.controls.deleteUnused = new("ButtonControl", {"RIGHT",self.controls.deleteAll,"LEFT"}, {-4, 0, 100, 18}, "Delete Unused", function() local delList = {} for _, itemId in pairs(self.list) do if not itemsTab:GetEquippedSlotForItem(itemsTab.items[itemId]) and not self:FindEquippedAbyssJewel(itemId, false) and not self:FindSocketedJewel(itemId, false) then @@ -62,7 +62,7 @@ local ItemListClass = newClass("ItemListControl", "ListControl", function(self, self.controls.deleteUnused.enabled = function() return #self.list > 0 end - self.controls.sort = new("ButtonControl", {"RIGHT",self.controls.deleteUnused,"LEFT"}, -4, 0, 60, 18, "Sort", function() + self.controls.sort = new("ButtonControl", {"RIGHT",self.controls.deleteUnused,"LEFT"}, {-4, 0, 60, 18}, "Sort", function() itemsTab:SortItemList() end) end) diff --git a/src/Classes/ItemSetListControl.lua b/src/Classes/ItemSetListControl.lua index 8c1aad1b8f..0292026aba 100644 --- a/src/Classes/ItemSetListControl.lua +++ b/src/Classes/ItemSetListControl.lua @@ -8,10 +8,10 @@ local t_remove = table.remove local m_max = math.max local s_format = string.format -local ItemSetListClass = newClass("ItemSetListControl", "ListControl", function(self, anchor, x, y, width, height, itemsTab) - self.ListControl(anchor, x, y, width, height, 16, "VERTICAL", true, itemsTab.itemSetOrderList) +local ItemSetListClass = newClass("ItemSetListControl", "ListControl", function(self, anchor, rect, itemsTab) + self.ListControl(anchor, rect, 16, "VERTICAL", true, itemsTab.itemSetOrderList) self.itemsTab = itemsTab - 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 newSet = copyTable(itemsTab.itemSets[self.selValue]) newSet.id = 1 while itemsTab.itemSets[newSet.id] do @@ -23,19 +23,19 @@ local ItemSetListClass = newClass("ItemSetListControl", "ListControl", function( 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(itemsTab.itemSets[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() local newSet = itemsTab:NewItemSet() self:RenameSet(newSet, true) end) @@ -43,11 +43,11 @@ end) function ItemSetListClass:RenameSet(itemSet, addOnName) local controls = { } - controls.label = new("LabelControl", nil, 0, 20, 0, 16, "^7Enter name for this item set:") - controls.edit = new("EditControl", nil, 0, 40, 350, 20, itemSet.title, nil, nil, 100, function(buf) + controls.label = new("LabelControl", nil, {0, 20, 0, 16}, "^7Enter name for this item set:") + controls.edit = new("EditControl", nil, {0, 40, 350, 20}, itemSet.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() itemSet.title = controls.edit.buf self.itemsTab.modFlag = true if addOnName then @@ -60,7 +60,7 @@ function ItemSetListClass:RenameSet(itemSet, 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.itemsTab.itemSets[itemSet.id] = nil end diff --git a/src/Classes/ItemSlotControl.lua b/src/Classes/ItemSlotControl.lua index 62e810f50b..596f09d207 100644 --- a/src/Classes/ItemSlotControl.lua +++ b/src/Classes/ItemSlotControl.lua @@ -8,7 +8,7 @@ local t_insert = table.insert local m_min = math.min local ItemSlotClass = newClass("ItemSlotControl", "DropDownControl", function(self, anchor, x, y, itemsTab, slotName, slotLabel, nodeId) - self.DropDownControl(anchor, x, y, 310, 20, { }, function(index, value) + self.DropDownControl(anchor, {x, y, 310, 20}, { }, function(index, value) if self.items[index] ~= self.selItemId then self:SetSelItemId(self.items[index]) itemsTab:PopulateSlots() @@ -29,7 +29,7 @@ local ItemSlotClass = newClass("ItemSlotControl", "DropDownControl", function(se self.slotName = slotName self.slotNum = tonumber(slotName:match("%d+$") or slotName:match("%d+")) if slotName:match("Flask") then - self.controls.activate = new("CheckBoxControl", {"RIGHT",self,"LEFT"}, -2, 0, 20, nil, function(state) + self.controls.activate = new("CheckBoxControl", {"RIGHT",self,"LEFT"}, {-2, 0, 20}, nil, function(state) self.active = state itemsTab.activeItemSet[self.slotName].active = state itemsTab:AddUndoState() diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index a9bfeb2931..f325b6fa29 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -65,7 +65,7 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro self.tradeQuery = new("TradeQuery", self) -- Set selector - self.controls.setSelect = new("DropDownControl", {"TOPLEFT",self,"TOPLEFT"}, 96, 8, 216, 20, nil, function(index, value) + self.controls.setSelect = new("DropDownControl", {"TOPLEFT",self,"TOPLEFT"}, {96, 8, 216, 20}, nil, function(index, value) self:SetActiveItemSet(self.itemSetOrderList[index]) self:AddUndoState() end) @@ -79,13 +79,13 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro self:AddItemSetTooltip(tooltip, self.itemSets[self.itemSetOrderList[index]]) end end - self.controls.setLabel = new("LabelControl", {"RIGHT",self.controls.setSelect,"LEFT"}, -2, 0, 0, 16, "^7Item 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}, "^7Item set:") + self.controls.setManage = new("ButtonControl", {"LEFT",self.controls.setSelect,"RIGHT"}, {4, 0, 90, 20}, "Manage...", function() self:OpenItemSetManagePopup() end) -- Price Items - self.controls.priceDisplayItem = new("ButtonControl", {"TOPLEFT",self,"TOPLEFT"}, 96, 32, 310, 20, "Trade for these items", function() + self.controls.priceDisplayItem = new("ButtonControl", {"TOPLEFT",self,"TOPLEFT"}, {96, 32, 310, 20}, "Trade for these items", function() self.tradeQuery:PriceItem() end) self.controls.priceDisplayItem.tooltipFunc = function(tooltip) @@ -98,7 +98,7 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro self.slots = { } self.orderedSlots = { } self.slotOrder = { } - self.slotAnchor = new("Control", {"TOPLEFT",self,"TOPLEFT"}, 96, 76, 310, 0) + self.slotAnchor = new("Control", {"TOPLEFT",self,"TOPLEFT"}, {96, 76, 310, 0}) local prevSlot = self.slotAnchor local function addSlot(slot) prevSlot = slot @@ -151,7 +151,7 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro end -- Passive tree dropdown controls - self.controls.specSelect = new("DropDownControl", {"TOPLEFT",prevSlot,"BOTTOMLEFT"}, 0, 8, 216, 20, nil, function(index, value) + self.controls.specSelect = new("DropDownControl", {"TOPLEFT",prevSlot,"BOTTOMLEFT"}, {0, 8, 216, 20}, nil, function(index, value) if self.build.treeTab.specList[index] then self.build.modFlag = true self.build.treeTab:SetActiveSpec(index) @@ -161,10 +161,10 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro return #self.controls.specSelect.list > 1 end prevSlot = self.controls.specSelect - self.controls.specButton = new("ButtonControl", {"LEFT",prevSlot,"RIGHT"}, 4, 0, 90, 20, "Manage...", function() + self.controls.specButton = new("ButtonControl", {"LEFT",prevSlot,"RIGHT"}, {4, 0, 90, 20}, "Manage...", function() self.build.treeTab:OpenSpecManagePopup() end) - self.controls.specLabel = new("LabelControl", {"RIGHT",prevSlot,"LEFT"}, -2, 0, 0, 16, "^7Passive tree:") + self.controls.specLabel = new("LabelControl", {"RIGHT",prevSlot,"LEFT"}, {-2, 0, 0, 16}, "^7Passive tree:") self.sockets = { } local socketOrder = { } @@ -181,8 +181,8 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro self.sockets[node.id] = socketControl addSlot(socketControl) end - self.controls.slotHeader = new("LabelControl", {"BOTTOMLEFT",self.slotAnchor,"TOPLEFT"}, 0, -4, 0, 16, "^7Equipped items:") - self.controls.weaponSwap1 = new("ButtonControl", {"BOTTOMRIGHT",self.slotAnchor,"TOPRIGHT"}, -20, -2, 18, 18, "I", function() + self.controls.slotHeader = new("LabelControl", {"BOTTOMLEFT",self.slotAnchor,"TOPLEFT"}, {0, -4, 0, 16}, "^7Equipped items:") + self.controls.weaponSwap1 = new("ButtonControl", {"BOTTOMRIGHT",self.slotAnchor,"TOPRIGHT"}, {-20, -2, 18, 18}, "I", function() if self.activeItemSet.useSecondWeaponSet then self.activeItemSet.useSecondWeaponSet = false self:AddUndoState() @@ -202,7 +202,7 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro self.controls.weaponSwap1.locked = function() return not self.activeItemSet.useSecondWeaponSet end - self.controls.weaponSwap2 = new("ButtonControl", {"BOTTOMRIGHT",self.slotAnchor,"TOPRIGHT"}, 0, -2, 18, 18, "II", function() + self.controls.weaponSwap2 = new("ButtonControl", {"BOTTOMRIGHT",self.slotAnchor,"TOPRIGHT"}, {0, -2, 18, 18}, "II", function() if not self.activeItemSet.useSecondWeaponSet then self.activeItemSet.useSecondWeaponSet = true self:AddUndoState() @@ -222,24 +222,24 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro self.controls.weaponSwap2.locked = function() return self.activeItemSet.useSecondWeaponSet end - self.controls.weaponSwapLabel = new("LabelControl", {"RIGHT",self.controls.weaponSwap1,"LEFT"}, -4, 0, 0, 14, "^7Weapon Set:") + self.controls.weaponSwapLabel = new("LabelControl", {"RIGHT",self.controls.weaponSwap1,"LEFT"}, {-4, 0, 0, 14}, "^7Weapon Set:") -- All items list if main.portraitMode then - self.controls.itemList = new("ItemListControl", {"TOPRIGHT",self.lastSlot,"BOTTOMRIGHT"}, 0, 0, 360, 308, self, true) + self.controls.itemList = new("ItemListControl", {"TOPRIGHT",self.lastSlot,"BOTTOMRIGHT"}, {0, 0, 360, 308}, self, true) else - self.controls.itemList = new("ItemListControl", {"TOPLEFT",self.controls.setManage,"TOPRIGHT"}, 20, 20, 360, 308, self, true) + self.controls.itemList = new("ItemListControl", {"TOPLEFT",self.controls.setManage,"TOPRIGHT"}, {20, 20, 360, 308}, self, true) end -- Database selector - self.controls.selectDBLabel = new("LabelControl", {"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, 0, 14, 0, 16, "^7Import from:") + self.controls.selectDBLabel = new("LabelControl", {"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, {0, 14, 0, 16}, "^7Import from:") self.controls.selectDBLabel.shown = function() return self.height < 980 end - self.controls.selectDB = new("DropDownControl", {"LEFT",self.controls.selectDBLabel,"RIGHT"}, 4, 0, 150, 18, { "Uniques", "Rare Templates" }) + self.controls.selectDB = new("DropDownControl", {"LEFT",self.controls.selectDBLabel,"RIGHT"}, {4, 0, 150, 18}, { "Uniques", "Rare Templates" }) -- Unique database - self.controls.uniqueDB = new("ItemDBControl", {"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, 0, 76, 360, function(c) return m_min(244, self.maxY - select(2, c:GetPos())) end, self, main.uniqueDB, "UNIQUE") + self.controls.uniqueDB = new("ItemDBControl", {"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, {0, 76, 360, function(c) return m_min(244, self.maxY - select(2, c:GetPos())) end}, self, main.uniqueDB, "UNIQUE") self.controls.uniqueDB.y = function() return self.controls.selectDBLabel:IsShown() and 118 or 96 end @@ -248,7 +248,7 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro end -- Rare template database - self.controls.rareDB = new("ItemDBControl", {"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, 0, 76, 360, function(c) return m_min(260, self.maxY - select(2, c:GetPos())) end, self, main.rareDB, "RARE") + self.controls.rareDB = new("ItemDBControl", {"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, {0, 76, 360, function(c) return m_min(260, self.maxY - select(2, c:GetPos())) end}, self, main.rareDB, "RARE") self.controls.rareDB.y = function() return self.controls.selectDBLabel:IsShown() and 78 or 396 end @@ -256,16 +256,16 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro return not self.controls.selectDBLabel:IsShown() or self.controls.selectDB.selIndex == 2 end -- Create/import item - self.controls.craftDisplayItem = new("ButtonControl", {"TOPLEFT",main.portraitMode and self.controls.setManage or self.controls.itemList,"TOPRIGHT"}, 20, main.portraitMode and 0 or -20, 120, 20, "Craft item...", function() + self.controls.craftDisplayItem = new("ButtonControl", {"TOPLEFT",main.portraitMode and self.controls.setManage or self.controls.itemList,"TOPRIGHT"}, {20, main.portraitMode and 0 or -20, 120, 20}, "Craft item...", function() self:CraftItem() end) self.controls.craftDisplayItem.shown = function() return self.displayItem == nil end - self.controls.newDisplayItem = new("ButtonControl", {"TOPLEFT",self.controls.craftDisplayItem,"TOPRIGHT"}, 8, 0, 120, 20, "Create custom...", function() + self.controls.newDisplayItem = new("ButtonControl", {"TOPLEFT",self.controls.craftDisplayItem,"TOPRIGHT"}, {8, 0, 120, 20}, "Create custom...", function() self:EditDisplayItemText() end) - self.controls.displayItemTip = new("LabelControl", {"TOPLEFT",self.controls.craftDisplayItem,"BOTTOMLEFT"}, 0, 8, 100, 16, + self.controls.displayItemTip = new("LabelControl", {"TOPLEFT",self.controls.craftDisplayItem,"BOTTOMLEFT"}, {0, 8, 100, 16}, [[^7Double-click an item from one of the lists, or copy and paste an item from in game (hover over the item and Ctrl+C) to view or edit @@ -278,31 +278,31 @@ drag it onto the slot. This will also add it to your build if it's from the unique/template list. If there's 2 slots an item can go in, holding Shift will put it in the second.]]) - self.controls.sharedItemList = new("SharedItemListControl", {"TOPLEFT",self.controls.craftDisplayItem, "BOTTOMLEFT"}, 0, 232, 340, 308, self, true) + self.controls.sharedItemList = new("SharedItemListControl", {"TOPLEFT",self.controls.craftDisplayItem, "BOTTOMLEFT"}, {0, 232, 340, 308}, self, true) -- Display item self.displayItemTooltip = new("Tooltip") self.displayItemTooltip.maxWidth = 458 - self.anchorDisplayItem = new("Control", {"TOPLEFT",main.portraitMode and self.controls.setManage or self.controls.itemList,"TOPRIGHT"}, 20, main.portraitMode and 0 or -20, 0, 0) + self.anchorDisplayItem = new("Control", {"TOPLEFT",main.portraitMode and self.controls.setManage or self.controls.itemList,"TOPRIGHT"}, {20, main.portraitMode and 0 or -20, 0, 0}) self.anchorDisplayItem.shown = function() return self.displayItem ~= nil end - self.controls.addDisplayItem = new("ButtonControl", {"TOPLEFT",self.anchorDisplayItem,"TOPLEFT"}, 0, 0, 100, 20, "", function() + self.controls.addDisplayItem = new("ButtonControl", {"TOPLEFT",self.anchorDisplayItem,"TOPLEFT"}, {0, 0, 100, 20}, "", function() self:AddDisplayItem() end) self.controls.addDisplayItem.label = function() return self.items[self.displayItem.id] and "Save" or "Add to build" end - self.controls.editDisplayItem = new("ButtonControl", {"LEFT",self.controls.addDisplayItem,"RIGHT"}, 8, 0, 60, 20, "Edit...", function() + self.controls.editDisplayItem = new("ButtonControl", {"LEFT",self.controls.addDisplayItem,"RIGHT"}, {8, 0, 60, 20}, "Edit...", function() self:EditDisplayItemText() end) - self.controls.removeDisplayItem = new("ButtonControl", {"LEFT",self.controls.editDisplayItem,"RIGHT"}, 8, 0, 60, 20, "Cancel", function() + self.controls.removeDisplayItem = new("ButtonControl", {"LEFT",self.controls.editDisplayItem,"RIGHT"}, {8, 0, 60, 20}, "Cancel", function() self:SetDisplayItem() end) -- Section: Variant(s) - self.controls.displayItemSectionVariant = new("Control", {"TOPLEFT",self.controls.addDisplayItem,"BOTTOMLEFT"}, 0, 8, 0, function() + self.controls.displayItemSectionVariant = new("Control", {"TOPLEFT",self.controls.addDisplayItem,"BOTTOMLEFT"}, {0, 8, 0, function() if not self.controls.displayItemVariant:IsShown() then return 0 end @@ -312,8 +312,8 @@ holding Shift will put it in the second.]]) (self.displayItem.hasAltVariant3 and 24 or 0) + (self.displayItem.hasAltVariant4 and 24 or 0) + (self.displayItem.hasAltVariant5 and 24 or 0)) - end) - self.controls.displayItemVariant = new("DropDownControl", {"TOPLEFT", self.controls.displayItemSectionVariant,"TOPLEFT"}, 0, 0, 300, 20, nil, function(index, value) + end}) + self.controls.displayItemVariant = new("DropDownControl", {"TOPLEFT", self.controls.displayItemSectionVariant,"TOPLEFT"}, {0, 0, 300, 20}, nil, function(index, value) self.displayItem.variant = index self.displayItem:BuildAndParseRaw() self:UpdateDisplayItemTooltip() @@ -323,7 +323,7 @@ holding Shift will put it in the second.]]) self.controls.displayItemVariant.shown = function() return self.displayItem.variantList and #self.displayItem.variantList > 1 end - self.controls.displayItemAltVariant = new("DropDownControl", {"TOPLEFT",self.controls.displayItemVariant,"BOTTOMLEFT"}, 0, 4, 300, 20, nil, function(index, value) + self.controls.displayItemAltVariant = new("DropDownControl", {"TOPLEFT",self.controls.displayItemVariant,"BOTTOMLEFT"}, {0, 4, 300, 20}, nil, function(index, value) self.displayItem.variantAlt = index self.displayItem:BuildAndParseRaw() self:UpdateDisplayItemTooltip() @@ -333,7 +333,7 @@ holding Shift will put it in the second.]]) self.controls.displayItemAltVariant.shown = function() return self.displayItem.hasAltVariant end - self.controls.displayItemAltVariant2 = new("DropDownControl", {"TOPLEFT",self.controls.displayItemAltVariant,"BOTTOMLEFT"}, 0, 4, 300, 20, nil, function(index, value) + self.controls.displayItemAltVariant2 = new("DropDownControl", {"TOPLEFT",self.controls.displayItemAltVariant,"BOTTOMLEFT"}, {0, 4, 300, 20}, nil, function(index, value) self.displayItem.variantAlt2 = index self.displayItem:BuildAndParseRaw() self:UpdateDisplayItemTooltip() @@ -343,7 +343,7 @@ holding Shift will put it in the second.]]) self.controls.displayItemAltVariant2.shown = function() return self.displayItem.hasAltVariant2 end - self.controls.displayItemAltVariant3 = new("DropDownControl", {"TOPLEFT",self.controls.displayItemAltVariant2,"BOTTOMLEFT"}, 0, 4, 300, 20, nil, function(index, value) + self.controls.displayItemAltVariant3 = new("DropDownControl", {"TOPLEFT",self.controls.displayItemAltVariant2,"BOTTOMLEFT"}, {0, 4, 300, 20}, nil, function(index, value) self.displayItem.variantAlt3 = index self.displayItem:BuildAndParseRaw() self:UpdateDisplayItemTooltip() @@ -353,7 +353,7 @@ holding Shift will put it in the second.]]) self.controls.displayItemAltVariant3.shown = function() return self.displayItem.hasAltVariant3 end - self.controls.displayItemAltVariant4 = new("DropDownControl", {"TOPLEFT",self.controls.displayItemAltVariant3,"BOTTOMLEFT"}, 0, 4, 300, 20, nil, function(index, value) + self.controls.displayItemAltVariant4 = new("DropDownControl", {"TOPLEFT",self.controls.displayItemAltVariant3,"BOTTOMLEFT"}, {0, 4, 300, 20}, nil, function(index, value) self.displayItem.variantAlt4 = index self.displayItem:BuildAndParseRaw() self:UpdateDisplayItemTooltip() @@ -363,7 +363,7 @@ holding Shift will put it in the second.]]) self.controls.displayItemAltVariant4.shown = function() return self.displayItem.hasAltVariant4 end - self.controls.displayItemAltVariant5 = new("DropDownControl", {"TOPLEFT",self.controls.displayItemAltVariant4,"BOTTOMLEFT"}, 0, 4, 300, 20, nil, function(index, value) + self.controls.displayItemAltVariant5 = new("DropDownControl", {"TOPLEFT",self.controls.displayItemAltVariant4,"BOTTOMLEFT"}, {0, 4, 300, 20}, nil, function(index, value) self.displayItem.variantAlt5 = index self.displayItem:BuildAndParseRaw() self:UpdateDisplayItemTooltip() @@ -375,11 +375,11 @@ holding Shift will put it in the second.]]) end -- Section: Sockets and Links - self.controls.displayItemSectionSockets = new("Control", {"TOPLEFT",self.controls.displayItemSectionVariant,"BOTTOMLEFT"}, 0, 0, 0, function() + self.controls.displayItemSectionSockets = new("Control", {"TOPLEFT",self.controls.displayItemSectionVariant,"BOTTOMLEFT"}, {0, 0, 0, function() return self.displayItem and self.displayItem.selectableSocketCount > 0 and 28 or 0 - end) + end}) for i = 1, 6 do - local drop = new("DropDownControl", {"TOPLEFT",self.controls.displayItemSectionSockets,"TOPLEFT"}, (i-1) * 64, 0, 36, 20, socketDropList, function(index, value) + local drop = new("DropDownControl", {"TOPLEFT",self.controls.displayItemSectionSockets,"TOPLEFT"}, {(i-1) * 64, 0, 36, 20}, socketDropList, function(index, value) self.displayItem.sockets[i].color = value.color self.displayItem:BuildAndParseRaw() self:UpdateDisplayItemTooltip() @@ -389,7 +389,7 @@ holding Shift will put it in the second.]]) end self.controls["displayItemSocket"..i] = drop if i < 6 then - local link = new("CheckBoxControl", {"LEFT",drop,"RIGHT"}, 4, 0, 20, nil, function(state) + local link = new("CheckBoxControl", {"LEFT",drop,"RIGHT"}, {4, 0, 20}, nil, function(state) if state and self.displayItem.sockets[i].group ~= self.displayItem.sockets[i+1].group then for s = i + 1, #self.displayItem.sockets do self.displayItem.sockets[s].group = self.displayItem.sockets[s].group - 1 @@ -408,7 +408,7 @@ holding Shift will put it in the second.]]) self.controls["displayItemLink"..i] = link end end - self.controls.displayItemAddSocket = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionSockets,"TOPLEFT"}, function() return (#self.displayItem.sockets - self.displayItem.abyssalSocketCount) * 64 - 12 end, 0, 20, 20, "+", function() + self.controls.displayItemAddSocket = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionSockets,"TOPLEFT"}, {function() return (#self.displayItem.sockets - self.displayItem.abyssalSocketCount) * 64 - 12 end, 0, 20, 20}, "+", function() local insertIndex = #self.displayItem.sockets - self.displayItem.abyssalSocketCount + 1 t_insert(self.displayItem.sockets, insertIndex, { color = self.displayItem.defaultSocketColor, @@ -426,28 +426,28 @@ holding Shift will put it in the second.]]) end -- Section: Enchant / Anoint / Corrupt - self.controls.displayItemSectionEnchant = new("Control", {"TOPLEFT",self.controls.displayItemSectionSockets,"BOTTOMLEFT"}, 0, 0, 0, function() + self.controls.displayItemSectionEnchant = new("Control", {"TOPLEFT",self.controls.displayItemSectionSockets,"BOTTOMLEFT"}, {0, 0, 0, function() return (self.controls.displayItemEnchant:IsShown() or self.controls.displayItemEnchant2:IsShown() or self.controls.displayItemAnoint:IsShown() or self.controls.displayItemAnoint2:IsShown() or self.controls.displayItemCorrupt:IsShown() ) and 28 or 0 - end) - self.controls.displayItemEnchant = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionEnchant,"TOPLEFT"}, 0, 0, 160, 20, "Apply Enchantment...", function() + end}) + self.controls.displayItemEnchant = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionEnchant,"TOPLEFT"}, {0, 0, 160, 20}, "Apply Enchantment...", function() self:EnchantDisplayItem(1) end) self.controls.displayItemEnchant.shown = function() return self.displayItem and self.displayItem.enchantments end - self.controls.displayItemEnchant2 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemEnchant,"TOPRIGHT",true}, 8, 0, 160, 20, "Apply Enchantment 2...", function() + self.controls.displayItemEnchant2 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemEnchant,"TOPRIGHT",true}, {8, 0, 160, 20}, "Apply Enchantment 2...", function() self:EnchantDisplayItem(2) end) self.controls.displayItemEnchant2.shown = function() return self.displayItem and self.displayItem.enchantments and self.displayItem.canHaveTwoEnchants and #self.displayItem.enchantModLines > 0 end - self.controls.displayItemAnoint = new("ButtonControl", {"TOPLEFT",self.controls.displayItemEnchant2,"TOPRIGHT",true}, 8, 0, 100, 20, "Anoint...", function() + self.controls.displayItemAnoint = new("ButtonControl", {"TOPLEFT",self.controls.displayItemEnchant2,"TOPRIGHT",true}, {8, 0, 100, 20}, "Anoint...", function() self:AnointDisplayItem(1) end) self.controls.displayItemAnoint.shown = function() return self.displayItem and (self.displayItem.base.type == "Amulet" or self.displayItem.canBeAnointed) end - self.controls.displayItemAnoint2 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint,"TOPRIGHT",true}, 8, 0, 100, 20, "Anoint 2...", function() + self.controls.displayItemAnoint2 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint,"TOPRIGHT",true}, {8, 0, 100, 20}, "Anoint 2...", function() self:AnointDisplayItem(2) end) self.controls.displayItemAnoint2.shown = function() @@ -456,7 +456,7 @@ holding Shift will put it in the second.]]) self.displayItem.canHaveTwoEnchants and #self.displayItem.enchantModLines > 0 end - self.controls.displayItemAnoint3 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint2,"TOPRIGHT",true}, 8, 0, 100, 20, "Anoint 3...", function() + self.controls.displayItemAnoint3 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint2,"TOPRIGHT",true}, {8, 0, 100, 20}, "Anoint 3...", function() self:AnointDisplayItem(3) end) self.controls.displayItemAnoint3.shown = function() @@ -465,7 +465,7 @@ holding Shift will put it in the second.]]) self.displayItem.canHaveThreeEnchants and #self.displayItem.enchantModLines > 1 end - self.controls.displayItemAnoint4 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint3,"TOPRIGHT",true}, 8, 0, 100, 20, "Anoint 4...", function() + self.controls.displayItemAnoint4 = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint3,"TOPRIGHT",true}, {8, 0, 100, 20}, "Anoint 4...", function() self:AnointDisplayItem(4) end) self.controls.displayItemAnoint4.shown = function() @@ -474,21 +474,21 @@ holding Shift will put it in the second.]]) self.displayItem.canHaveFourEnchants and #self.displayItem.enchantModLines > 2 end - self.controls.displayItemCorrupt = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint4,"TOPRIGHT",true}, 8, 10, 100, 20, "Corrupt...", function() + self.controls.displayItemCorrupt = new("ButtonControl", {"TOPLEFT",self.controls.displayItemAnoint4,"TOPRIGHT",true}, {8, 10, 100, 20}, "Corrupt...", function() self:CorruptDisplayItem("Corrupted") end) self.controls.displayItemCorrupt.shown = function() return self.displayItem and self.displayItem.corruptible end --[[ - self.controls.displayItemScourge = new("ButtonControl", {"TOPLEFT",self.controls.displayItemCorrupt,"TOPRIGHT",true}, 8, 0, 100, 20, "Scourge...", function() + self.controls.displayItemScourge = new("ButtonControl", {"TOPLEFT",self.controls.displayItemCorrupt,"TOPRIGHT",true}, {8, 0, 100, 20}, "Scourge...", function() self:CorruptDisplayItem("Scourge") end) self.controls.displayItemScourge.shown = function() return self.displayItem and self.displayItem.corruptible end --]] - self.controls.displayItemAddImplicit = new("ButtonControl", {"TOPLEFT",self.controls.displayItemCorrupt,"TOPRIGHT",true}, 8, 0, 120, 20, "Add Implicit...", function() + self.controls.displayItemAddImplicit = new("ButtonControl", {"TOPLEFT",self.controls.displayItemCorrupt,"TOPRIGHT",true}, {8, 0, 120, 20}, "Add Implicit...", function() self:AddImplicitToDisplayItem() end) self.controls.displayItemAddImplicit.shown = function() @@ -521,17 +521,17 @@ holding Shift will put it in the second.]]) self.displayItem:BuildAndParseRaw() self:UpdateDisplayItemTooltip() end - self.controls.displayItemSectionInfluence = new("Control", {"TOPLEFT",self.controls.displayItemSectionEnchant,"BOTTOMLEFT"}, 0, 0, 0, function() + self.controls.displayItemSectionInfluence = new("Control", {"TOPLEFT",self.controls.displayItemSectionEnchant,"BOTTOMLEFT"}, {0, 0, 0, function() return self.displayItem and self.displayItem.canBeInfluenced and 28 or 0 - end) - self.controls.displayItemInfluence = new("DropDownControl", {"TOPLEFT",self.controls.displayItemSectionInfluence,"TOPRIGHT"}, 0, 0, 100, 20, influenceDisplayList, function(index, value) + end}) + self.controls.displayItemInfluence = new("DropDownControl", {"TOPLEFT",self.controls.displayItemSectionInfluence,"TOPRIGHT"}, {0, 0, 100, 20}, influenceDisplayList, function(index, value) local otherIndex = self.controls.displayItemInfluence2.selIndex setDisplayItemInfluence({ index - 1, otherIndex - 1 }) end) self.controls.displayItemInfluence.shown = function() return self.displayItem and self.displayItem.canBeInfluenced end - self.controls.displayItemInfluence2 = new("DropDownControl", {"TOPLEFT",self.controls.displayItemInfluence,"TOPRIGHT",true}, 8, 0, 100, 20, influenceDisplayList, function(index, value) + self.controls.displayItemInfluence2 = new("DropDownControl", {"TOPLEFT",self.controls.displayItemInfluence,"TOPRIGHT",true}, {8, 0, 100, 20}, influenceDisplayList, function(index, value) local otherIndex = self.controls.displayItemInfluence.selIndex setDisplayItemInfluence({ index - 1, otherIndex - 1 }) end) @@ -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,10 +558,10 @@ 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) - self.controls.displayItemCatalyst = new("DropDownControl", {"TOPLEFT",self.controls.displayItemSectionCatalyst,"TOPRIGHT"}, 0, 0, 250, 20, + 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)"}, function(index, value) @@ -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 @@ -600,10 +600,10 @@ holding Shift will put it in the second.]]) end -- Section: Cluster Jewel - self.controls.displayItemSectionClusterJewel = new("Control", {"TOPLEFT",self.controls.displayItemSectionCatalyst,"BOTTOMLEFT"}, 0, 0, 0, function() + self.controls.displayItemSectionClusterJewel = new("Control", {"TOPLEFT",self.controls.displayItemSectionCatalyst,"BOTTOMLEFT"}, {0, 0, 0, function() return self.controls.displayItemClusterJewelSkill:IsShown() and 52 or 0 - end) - self.controls.displayItemClusterJewelSkill = new("DropDownControl", {"TOPLEFT",self.controls.displayItemSectionClusterJewel,"TOPLEFT"}, 0, 0, 300, 20, { }, function(index, value) + end}) + self.controls.displayItemClusterJewelSkill = new("DropDownControl", {"TOPLEFT",self.controls.displayItemSectionClusterJewel,"TOPLEFT"}, {0, 0, 300, 20}, { }, function(index, value) self.displayItem.clusterJewelSkill = value.skillId self:CraftClusterJewel() end) { @@ -612,8 +612,8 @@ holding Shift will put it in the second.]]) end } - self.controls.displayItemClusterJewelNodeCountLabel = new("LabelControl", {"TOPLEFT",self.controls.displayItemClusterJewelSkill,"BOTTOMLEFT"}, 0, 7, 0, 14, "^7Added Passives:") - self.controls.displayItemClusterJewelNodeCount = new("SliderControl", {"LEFT",self.controls.displayItemClusterJewelNodeCountLabel,"RIGHT"}, 2, 0, 150, 20, function(val) + self.controls.displayItemClusterJewelNodeCountLabel = new("LabelControl", {"TOPLEFT",self.controls.displayItemClusterJewelSkill,"BOTTOMLEFT"}, {0, 7, 0, 14}, "^7Added Passives:") + self.controls.displayItemClusterJewelNodeCount = new("SliderControl", {"LEFT",self.controls.displayItemClusterJewelNodeCountLabel,"RIGHT"}, {2, 0, 150, 20}, function(val) local divVal = self.controls.displayItemClusterJewelNodeCount:GetDivVal() local clusterJewel = self.displayItem.clusterJewel self.displayItem.clusterJewelNodeCount = round(val * (clusterJewel.maxNodes - clusterJewel.minNodes) + clusterJewel.minNodes) @@ -621,7 +621,7 @@ holding Shift will put it in the second.]]) end) -- Section: Affix Selection - self.controls.displayItemSectionAffix = new("Control", {"TOPLEFT",self.controls.displayItemSectionClusterJewel,"BOTTOMLEFT"}, 0, 0, 0, function() + self.controls.displayItemSectionAffix = new("Control", {"TOPLEFT",self.controls.displayItemSectionClusterJewel,"BOTTOMLEFT"}, {0, 0, 0, function() if not self.displayItem or not self.displayItem.crafted then return 0 end @@ -635,7 +635,7 @@ holding Shift will put it in the second.]]) end end return h - end) + end}) for i = 1, 6 do local prev = self.controls["displayItemAffix"..(i-1)] or self.controls.displayItemSectionAffix local drop, slider @@ -679,7 +679,7 @@ holding Shift will put it in the second.]]) end return range end - drop = new("DropDownControl", {"TOPLEFT",prev,"TOPLEFT"}, i==1 and 40 or 0, 0, 418, 20, nil, function(index, value) + drop = new("DropDownControl", {"TOPLEFT",prev,"TOPLEFT"}, {i==1 and 40 or 0, 0, 418, 20}, nil, function(index, value) local affix = { modId = "None" } if value.modId then affix.modId = value.modId @@ -808,7 +808,7 @@ holding Shift will put it in the second.]]) drop.shown = function() return self.displayItem and self.displayItem.crafted and i <= self.displayItem.affixLimit end - slider = new("SliderControl", {"TOPLEFT",drop,"BOTTOMLEFT"}, 0, 2, 300, 16, function(val) + slider = new("SliderControl", {"TOPLEFT",drop,"BOTTOMLEFT"}, {0, 2, 300, 16}, function(val) local affix = self.displayItem[drop.outputTable][drop.outputIndex] local index, range = slider:GetDivVal() affix.modId = drop.list[drop.selIndex].modList[index] @@ -847,21 +847,21 @@ holding Shift will put it in the second.]]) end drop.slider = slider self.controls["displayItemAffix"..i] = drop - self.controls["displayItemAffixLabel"..i] = new("LabelControl", {"RIGHT",drop,"LEFT"}, -4, 0, 0, 14, function() + self.controls["displayItemAffixLabel"..i] = new("LabelControl", {"RIGHT",drop,"LEFT"}, {-4, 0, 0, 14}, function() return drop.outputTable == "prefixes" and "^7Prefix:" or "^7Suffix:" end) self.controls["displayItemAffixRange"..i] = slider - self.controls["displayItemAffixRangeLabel"..i] = new("LabelControl", {"RIGHT",slider,"LEFT"}, -4, 0, 0, 14, function() + self.controls["displayItemAffixRangeLabel"..i] = new("LabelControl", {"RIGHT",slider,"LEFT"}, {-4, 0, 0, 14}, function() return drop.selIndex > 1 and "^7Roll:" or "^x7F7F7FRoll:" end) end -- Section: Custom modifiers -- if either Custom or Crucible mod buttons are shown, create the control for the list of mods - self.controls.displayItemSectionCustom = new("Control", {"TOPLEFT",self.controls.displayItemSectionAffix,"BOTTOMLEFT"}, 0, 0, 0, function() + self.controls.displayItemSectionCustom = new("Control", {"TOPLEFT",self.controls.displayItemSectionAffix,"BOTTOMLEFT"}, {0, 0, 0, function() return (self.controls.displayItemAddCustom:IsShown() or self.controls.displayItemAddCrucible:IsShown()) and 28 + self.displayItem.customCount * 22 or 0 - end) - self.controls.displayItemAddCustom = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionCustom,"TOPLEFT"}, 0, 0, 120, 20, "Add modifier...", function() + end}) + self.controls.displayItemAddCustom = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionCustom,"TOPLEFT"}, {0, 0, 120, 20}, "Add modifier...", function() self:AddCustomModifierToDisplayItem() end) self.controls.displayItemAddCustom.shown = function() @@ -870,9 +870,9 @@ holding Shift will put it in the second.]]) -- Section: Crucible modifiers -- if the Add modifier button is not shown, take its place, otherwise move it to the right of it - self.controls.displayItemAddCrucible = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionCustom,"TOPLEFT"}, function() + self.controls.displayItemAddCrucible = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionCustom,"TOPLEFT"}, {function() return (self.controls.displayItemAddCustom:IsShown() and 128) or 0 - end, 0, 150, 20, "Add Crucible mod...", function() + end, 0, 150, 20}, "Add Crucible mod...", function() self:AddCrucibleModifierToDisplayItem() end) self.controls.displayItemAddCrucible.shown = function() @@ -880,16 +880,16 @@ holding Shift will put it in the second.]]) end -- Section: Modifier Range - self.controls.displayItemSectionRange = new("Control", {"TOPLEFT",self.controls.displayItemSectionCustom,"BOTTOMLEFT"}, 0, 0, 0, function() + self.controls.displayItemSectionRange = new("Control", {"TOPLEFT",self.controls.displayItemSectionCustom,"BOTTOMLEFT"}, {0, 0, 0, function() return self.displayItem.rangeLineList[1] and 28 or 0 - end) - self.controls.displayItemRangeLine = new("DropDownControl", {"TOPLEFT",self.controls.displayItemSectionRange,"TOPLEFT"}, 0, 0, 350, 18, nil, function(index, value) + end}) + self.controls.displayItemRangeLine = new("DropDownControl", {"TOPLEFT",self.controls.displayItemSectionRange,"TOPLEFT"}, {0, 0, 350, 18}, nil, function(index, value) self.controls.displayItemRangeSlider.val = self.displayItem.rangeLineList[index].range end) self.controls.displayItemRangeLine.shown = function() return self.displayItem and self.displayItem.rangeLineList[1] ~= nil end - self.controls.displayItemRangeSlider = new("SliderControl", {"LEFT",self.controls.displayItemRangeLine,"RIGHT"}, 8, 0, 100, 18, function(val) + self.controls.displayItemRangeSlider = new("SliderControl", {"LEFT",self.controls.displayItemRangeLine,"RIGHT"}, {8, 0, 100, 18}, function(val) self.displayItem.rangeLineList[self.controls.displayItemRangeLine.selIndex].range = val self.displayItem:BuildAndParseRaw() self:UpdateDisplayItemTooltip() @@ -900,8 +900,8 @@ holding Shift will put it in the second.]]) self.controls.displayItemTooltipAnchor = new("Control", {"TOPLEFT",self.controls.displayItemSectionRange,"BOTTOMLEFT"}) -- Scroll bars - self.controls.scrollBarH = new("ScrollBarControl", nil, 0, 0, 0, 18, 100, "HORIZONTAL", true) - self.controls.scrollBarV = new("ScrollBarControl", nil, 0, 0, 18, 0, 100, "VERTICAL", true) + self.controls.scrollBarH = new("ScrollBarControl", nil, {0, 0, 0, 18}, 100, "HORIZONTAL", true) + self.controls.scrollBarV = new("ScrollBarControl", nil, {0, 0, 18, 0}, 100, "VERTICAL", true) -- Initialise drag target lists t_insert(self.controls.itemList.dragTargetList, self.controls.sharedItemList) @@ -1792,9 +1792,9 @@ function ItemsTabClass:UpdateCustomControls() local line = itemLib.formatModLine(modLine) if line then if not self.controls["displayItemCustomModifierRemove"..i] then - self.controls["displayItemCustomModifierRemove"..i] = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionCustom,"TOPLEFT"}, 0, i * 22 + 4, 70, 20, "^7Remove") - self.controls["displayItemCustomModifier"..i] = new("LabelControl", {"LEFT",self.controls["displayItemCustomModifierRemove"..i],"RIGHT"}, 65, 0, 0, 16) - self.controls["displayItemCustomModifierLabel"..i] = new("LabelControl", {"LEFT",self.controls["displayItemCustomModifierRemove"..i],"RIGHT"}, 5, 0, 0, 16) + self.controls["displayItemCustomModifierRemove"..i] = new("ButtonControl", {"TOPLEFT",self.controls.displayItemSectionCustom,"TOPLEFT"}, {0, i * 22 + 4, 70, 20}, "^7Remove") + self.controls["displayItemCustomModifier"..i] = new("LabelControl", {"LEFT",self.controls["displayItemCustomModifierRemove"..i],"RIGHT"}, {65, 0, 0, 16}) + self.controls["displayItemCustomModifierLabel"..i] = new("LabelControl", {"LEFT",self.controls["displayItemCustomModifierRemove"..i],"RIGHT"}, {5, 0, 0, 16}) end self.controls["displayItemCustomModifierRemove"..i].shown = true local label = itemLib.formatModLine(modLine) @@ -1937,11 +1937,11 @@ end -- Opens the item set manager function ItemsTabClass:OpenItemSetManagePopup() local controls = { } - controls.setList = new("ItemSetListControl", nil, -155, 50, 300, 200, self) - controls.sharedList = new("SharedItemSetListControl", nil, 155, 50, 300, 200, self) + controls.setList = new("ItemSetListControl", nil, {-155, 50, 300, 200}, self) + controls.sharedList = new("SharedItemSetListControl", nil, {155, 50, 300, 200}, self) controls.setList.dragTargetList = { controls.sharedList } controls.sharedList.dragTargetList = { controls.setList } - controls.close = new("ButtonControl", nil, 0, 260, 90, 20, "Done", function() + controls.close = new("ButtonControl", nil, {0, 260, 90, 20}, "Done", function() main:ClosePopup() end) main:OpenPopup(630, 290, "Manage Item Sets", controls) @@ -1995,21 +1995,21 @@ function ItemsTabClass:CraftItem() item:BuildAndParseRaw() return item end - controls.rarityLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 50, 20, 0, 16, "Rarity:") - controls.rarity = new("DropDownControl", nil, -80, 20, 100, 18, rarityDropList) + controls.rarityLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {50, 20, 0, 16}, "Rarity:") + controls.rarity = new("DropDownControl", nil, {-80, 20, 100, 18}, rarityDropList) controls.rarity.selIndex = self.lastCraftRaritySel or 3 - controls.title = new("EditControl", nil, 70, 20, 190, 18, "", "Name") + controls.title = new("EditControl", nil, {70, 20, 190, 18}, "", "Name") controls.title.shown = function() return controls.rarity.selIndex >= 3 end - controls.typeLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 50, 45, 0, 16, "Type:") - controls.type = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 55, 45, 295, 18, self.build.data.itemBaseTypeList, function(index, value) + controls.typeLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {50, 45, 0, 16}, "Type:") + controls.type = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {55, 45, 295, 18}, self.build.data.itemBaseTypeList, function(index, value) controls.base.list = self.build.data.itemBaseLists[self.build.data.itemBaseTypeList[index]] controls.base.selIndex = 1 end) controls.type.selIndex = self.lastCraftTypeSel or 1 - controls.baseLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 50, 70, 0, 16, "Base:") - controls.base = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 55, 70, 200, 18, self.build.data.itemBaseLists[self.build.data.itemBaseTypeList[controls.type.selIndex]]) + controls.baseLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {50, 70, 0, 16}, "Base:") + controls.base = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {55, 70, 200, 18}, self.build.data.itemBaseLists[self.build.data.itemBaseTypeList[controls.type.selIndex]]) controls.base.selIndex = self.lastCraftBaseSel or 1 controls.base.tooltipFunc = function(tooltip, mode, index, value) tooltip:Clear() @@ -2017,7 +2017,7 @@ function ItemsTabClass:CraftItem() self:AddItemTooltip(tooltip, makeItem(value), nil, true) end end - controls.save = new("ButtonControl", nil, -45, 100, 80, 20, "Create", function() + controls.save = new("ButtonControl", nil, {-45, 100, 80, 20}, "Create", function() main:ClosePopup() local item = makeItem(controls.base.list[controls.base.selIndex]) self:SetDisplayItem(item) @@ -2028,7 +2028,7 @@ function ItemsTabClass:CraftItem() self.lastCraftTypeSel = controls.type.selIndex self.lastCraftBaseSel = controls.base.selIndex end) - controls.cancel = new("ButtonControl", nil, 45, 100, 80, 20, "Cancel", function() + controls.cancel = new("ButtonControl", nil, {45, 100, 80, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(370, 130, "Craft Item", controls) @@ -2045,8 +2045,8 @@ function ItemsTabClass:EditDisplayItemText(alsoAddItem) return "Rarity: "..controls.rarity.list[controls.rarity.selIndex].rarity.."\n"..controls.edit.buf end end - controls.rarity = new("DropDownControl", nil, -190, 10, 100, 18, rarityDropList) - controls.edit = new("EditControl", nil, 0, 40, 480, 420, "", nil, "^%C\t\n", nil, nil, 14) + controls.rarity = new("DropDownControl", nil, {-190, 10, 100, 18}, rarityDropList) + controls.edit = new("EditControl", nil, {0, 40, 480, 420}, "", nil, "^%C\t\n", nil, nil, 14) if self.displayItem then controls.edit:SetText(self.displayItem:BuildRaw():gsub("Rarity: %w+\n","")) controls.rarity:SelByValue(self.displayItem.rarity, "rarity") @@ -2055,7 +2055,7 @@ function ItemsTabClass:EditDisplayItemText(alsoAddItem) end controls.edit.font = "FIXED" controls.edit.pasteFilter = sanitiseText - controls.save = new("ButtonControl", nil, -45, 470, 80, 20, self.displayItem and "Save" or "Create", function() + controls.save = new("ButtonControl", nil, {-45, 470, 80, 20}, self.displayItem and "Save" or "Create", function() local id = self.displayItem and self.displayItem.id self:CreateDisplayItemFromRaw(buildRaw(), not self.displayItem) self.displayItem.id = id @@ -2083,7 +2083,7 @@ function ItemsTabClass:EditDisplayItemText(alsoAddItem) tooltip:AddLine(14, "Scholar's Platinum Kris of Joy") end end - controls.cancel = new("ButtonControl", nil, 45, 470, 80, 20, "Cancel", function() + controls.cancel = new("ButtonControl", nil, {45, 470, 80, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(500, 500, self.displayItem and "Edit Item Text" or "Create Custom Item from Text", controls, nil, "edit") @@ -2173,13 +2173,13 @@ function ItemsTabClass:EnchantDisplayItem(enchantSlot) return item end if haveSkills then - controls.skillLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 95, 20, 0, 16, "^7Skill:") - controls.skill = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 20, 180, 18, skillList, function(index, value) + controls.skillLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, 20, 0, 16}, "^7Skill:") + controls.skill = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 20, 180, 18}, skillList, function(index, value) buildEnchantmentSourceList() buildEnchantmentList() controls.enchantment:SetSel(1) end) - controls.allSkills = new("CheckBoxControl", {"TOPLEFT",nil,"TOPLEFT"}, 350, 20, 18, "All skills:", function(state) + controls.allSkills = new("CheckBoxControl", {"TOPLEFT",nil,"TOPLEFT"}, {350, 20, 18}, "All skills:", function(state) buildSkillList(not state) controls.skill:SetSel(1) buildEnchantmentList() @@ -2191,26 +2191,26 @@ function ItemsTabClass:EnchantDisplayItem(enchantSlot) controls.allSkills.enabled = false end end - controls.enchantmentSourceLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 95, 45, 0, 16, "^7Source:") - controls.enchantmentSource = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 45, 180, 18, enchantmentSourceList, function(index, value) + controls.enchantmentSourceLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, 45, 0, 16}, "^7Source:") + controls.enchantmentSource = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 45, 180, 18}, enchantmentSourceList, function(index, value) buildEnchantmentList() controls.enchantment:SetSel(m_min(controls.enchantment.selIndex, #enchantmentList)) end) - controls.enchantmentLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 95, 70, 0, 16, "^7Enchantment:") - controls.enchantment = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 70, 440, 18, enchantmentList) + controls.enchantmentLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, 70, 0, 16}, "^7Enchantment:") + controls.enchantment = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 70, 440, 18}, enchantmentList) controls.enchantment.tooltipFunc = function(tooltip, mode, index) tooltip:Clear() self:AddItemTooltip(tooltip, enchantItem(index), nil, true) end - controls.save = new("ButtonControl", nil, -88, 100, 80, 20, "Enchant", function() + controls.save = new("ButtonControl", nil, {-88, 100, 80, 20}, "Enchant", function() self:SetDisplayItem(enchantItem()) main:ClosePopup() end) - controls.remove = new("ButtonControl", nil, 0, 100, 80, 20, "Remove", function() + controls.remove = new("ButtonControl", nil, {0, 100, 80, 20}, "Remove", function() self:SetDisplayItem(enchantItem(nil, true)) main:ClosePopup() end) - controls.close = new("ButtonControl", nil, 88, 100, 80, 20, "Cancel", function() + controls.close = new("ButtonControl", nil, {88, 100, 80, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(550, 130, "Enchant Item", controls) @@ -2319,7 +2319,7 @@ function ItemsTabClass:AnointDisplayItem(enchantSlot) self.anointEnchantSlot = enchantSlot or 1 local controls = { } - controls.notableDB = new("NotableDBControl", {"TOPLEFT",nil,"TOPLEFT"}, 10, 60, 360, 360, self, self.build.spec.tree.nodes, "ANOINT") + controls.notableDB = new("NotableDBControl", {"TOPLEFT",nil,"TOPLEFT"}, {10, 60, 360, 360}, self, self.build.spec.tree.nodes, "ANOINT") local function saveLabel() local node = controls.notableDB.selValue @@ -2340,7 +2340,7 @@ function ItemsTabClass:AnointDisplayItem(enchantSlot) local width = saveLabelWidth() return -(width + 90) / 2 end - controls.save = new("ButtonControl", {"BOTTOMLEFT", nil, "BOTTOM" }, saveLabelX, -4, saveLabelWidth, 20, saveLabel, function() + controls.save = new("ButtonControl", {"BOTTOMLEFT", nil, "BOTTOM" }, {saveLabelX, -4, saveLabelWidth, 20}, saveLabel, function() self:SetDisplayItem(self:anointItem(controls.notableDB.selValue)) main:ClosePopup() end) @@ -2348,7 +2348,7 @@ function ItemsTabClass:AnointDisplayItem(enchantSlot) tooltip:Clear() self:AppendAnointTooltip(tooltip, controls.notableDB.selValue) end - controls.close = new("ButtonControl", {"TOPLEFT", controls.save, "TOPRIGHT" }, 10, 0, 80, 20, "Cancel", function() + controls.close = new("ButtonControl", {"TOPLEFT", controls.save, "TOPRIGHT" }, {10, 0, 80, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(380, 448, "Anoint Item", controls) @@ -2420,8 +2420,8 @@ function ItemsTabClass:CorruptDisplayItem(modType) item:BuildAndParseRaw() return item end - controls.sourceLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 95, 20, 0, 16, "^7Source:") - controls.source = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 20, 150, 18, sourceList, function(index, value) + controls.sourceLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, 20, 0, 16}, "^7Source:") + controls.source = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 20, 150, 18}, sourceList, function(index, value) if value == "Scourge" then currentModType = "ScourgeUpside" buildImplicitList("ScourgeUpside") @@ -2470,8 +2470,8 @@ function ItemsTabClass:CorruptDisplayItem(modType) controls.implicit4:SetSel(1) end) controls.source.enabled = #sourceList > 1 - controls.implicitLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 75, 45, 0, 16, "^7Implicit #1:") - controls.implicit = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 80, 45, 440, 18, nil, function() + controls.implicitLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {75, 45, 0, 16}, "^7Implicit #1:") + controls.implicit = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {80, 45, 440, 18}, nil, function() buildList(controls.implicit2, controls.implicit, currentModType) end) controls.implicit.tooltipFunc = function(tooltip, mode, index, value) @@ -2485,8 +2485,8 @@ function ItemsTabClass:CorruptDisplayItem(modType) end controls.implicit.shown = not self.displayItem.implicitsCannotBeChanged controls.implicitLabel.shown = not self.displayItem.implicitsCannotBeChanged - controls.implicit2Label = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 75, 65, 0, 16, "^7Implicit #2:") - controls.implicit2 = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 80, 65, 440, 18, nil, function() + controls.implicit2Label = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {75, 65, 0, 16}, "^7Implicit #2:") + controls.implicit2 = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {80, 65, 440, 18}, nil, function() buildList(controls.implicit, controls.implicit2, currentModType) end) controls.implicit2.tooltipFunc = function(tooltip, mode, index, value) @@ -2500,8 +2500,8 @@ function ItemsTabClass:CorruptDisplayItem(modType) end controls.implicit2.shown = not self.displayItem.implicitsCannotBeChanged controls.implicit2Label.shown = not self.displayItem.implicitsCannotBeChanged - controls.implicit3Label = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 75, 85, 0, 16, "^7Implicit #3:") - controls.implicit3 = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 80, 65, 440, 18, nil, function() + controls.implicit3Label = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {75, 85, 0, 16}, "^7Implicit #3:") + controls.implicit3 = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {80, 65, 440, 18}, nil, function() buildList(controls.implicit4, controls.implicit3, "ScourgeDownside") end) controls.implicit3.tooltipFunc = function(tooltip, mode, index, value) @@ -2515,8 +2515,8 @@ function ItemsTabClass:CorruptDisplayItem(modType) end controls.implicit3Label.shown = false controls.implicit3.shown = false - controls.implicit4Label = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 75, 105, 0, 16, "^7Implicit #4:") - controls.implicit4 = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 80, 105, 440, 18, nil, function() + controls.implicit4Label = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {75, 105, 0, 16}, "^7Implicit #4:") + controls.implicit4 = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {80, 105, 440, 18}, nil, function() buildList(controls.implicit3, controls.implicit4, "ScourgeDownside") end) controls.implicit4.tooltipFunc = function(tooltip, mode, index, value) @@ -2530,11 +2530,11 @@ 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) - controls.save = new("ButtonControl", nil, -45, 99, 80, 20, modType, function() + controls.save = new("ButtonControl", nil, {-45, 99, 80, 20}, modType, function() self:SetDisplayItem(corruptItem()) main:ClosePopup() end) @@ -2542,7 +2542,7 @@ function ItemsTabClass:CorruptDisplayItem(modType) tooltip:Clear() self:AddItemTooltip(tooltip, corruptItem(), nil, true) end - controls.close = new("ButtonControl", nil, 45, 99, 80, 20, "Cancel", function() + controls.close = new("ButtonControl", nil, {45, 99, 80, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(540, 129, modType .. " Item", controls) @@ -2721,14 +2721,14 @@ function ItemsTabClass:AddCustomModifierToDisplayItem() item:BuildAndParseRaw() return item end - controls.sourceLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 95, 20, 0, 16, "^7Source:") - controls.source = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 20, 150, 18, sourceList, function(index, value) + controls.sourceLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, 20, 0, 16}, "^7Source:") + controls.source = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 20, 150, 18}, sourceList, function(index, value) buildMods(value.sourceId) controls.modSelect:SetSel(1) end) controls.source.enabled = #sourceList > 1 - controls.modSelectLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 95, 45, 0, 16, "^7Modifier:") - controls.modSelect = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 45, 600, 18, modList) + controls.modSelectLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, 45, 0, 16}, "^7Modifier:") + controls.modSelect = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 45, 600, 18}, modList) controls.modSelect.shown = function() return sourceList[controls.source.selIndex].sourceId ~= "CUSTOM" end @@ -2741,11 +2741,11 @@ function ItemsTabClass:AddCustomModifierToDisplayItem() self:AddModComparisonTooltip(tooltip, value.mod) end end - controls.custom = new("EditControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 45, 440, 18) + controls.custom = new("EditControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 45, 440, 18}) controls.custom.shown = function() return sourceList[controls.source.selIndex].sourceId == "CUSTOM" end - controls.save = new("ButtonControl", nil, -45, 75, 80, 20, "Add", function() + controls.save = new("ButtonControl", nil, {-45, 75, 80, 20}, "Add", function() self:SetDisplayItem(addModifier()) main:ClosePopup() end) @@ -2753,7 +2753,7 @@ function ItemsTabClass:AddCustomModifierToDisplayItem() tooltip:Clear() self:AddItemTooltip(tooltip, addModifier()) end - controls.close = new("ButtonControl", nil, 45, 75, 80, 20, "Cancel", function() + controls.close = new("ButtonControl", nil, {45, 75, 80, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(710, 105, "Add Modifier to Item", controls, "save", sourceList[controls.source.selIndex].sourceId == "CUSTOM" and "custom") @@ -2857,8 +2857,8 @@ function ItemsTabClass:AddCrucibleModifierToDisplayItem() buildCrucibleMods() local y = 45 for i = 1,5 do - controls["modSelectNode"..i.."Label"] = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 95, y, 0, 16, "^7Node "..i..":") - controls["modSelectNode"..i] = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, y, 555, 18, modList[i]) + controls["modSelectNode"..i.."Label"] = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, y, 0, 16}, "^7Node "..i..":") + controls["modSelectNode"..i] = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, y, 555, 18}, modList[i]) controls["modSelectNode"..i].tooltipFunc = function(tooltip, mode, index, value) tooltip:Clear() if mode ~= "OUT" and value and value ~= "None" then @@ -2878,7 +2878,7 @@ function ItemsTabClass:AddCrucibleModifierToDisplayItem() end end end - controls.save = new("ButtonControl", nil, -45, 157, 80, 20, "Add", function() + controls.save = new("ButtonControl", nil, {-45, 157, 80, 20}, "Add", function() self:SetDisplayItem(addModifier()) main:ClosePopup() end) @@ -2886,7 +2886,7 @@ function ItemsTabClass:AddCrucibleModifierToDisplayItem() tooltip:Clear() self:AddItemTooltip(tooltip, addModifier()) end - controls.close = new("ButtonControl", nil, 45, 157, 80, 20, "Cancel", function() + controls.close = new("ButtonControl", nil, {45, 157, 80, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(710, 185, "Add Crucible Modifier to Item", controls, "save") @@ -3078,8 +3078,8 @@ function ItemsTabClass:AddImplicitToDisplayItem() item:BuildAndParseRaw() return item end - controls.sourceLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 95, 20, 0, 16, "^7Source:") - controls.source = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 20, 150, 18, sourceList, function(index, value) + controls.sourceLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, 20, 0, 16}, "^7Source:") + controls.source = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 20, 150, 18}, sourceList, function(index, value) if value.sourceId ~= "CUSTOM" then controls.modSelectLabel.y = 70 buildMods(value.sourceId) @@ -3091,8 +3091,8 @@ function ItemsTabClass:AddImplicitToDisplayItem() end end) controls.source.enabled = #sourceList > 1 - controls.modGroupSelectLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 95, 45, 0, 16, "^7Type:") - controls.modGroupSelect = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 45, 600, 18, modGroups, function(index, value) + controls.modGroupSelectLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, 45, 0, 16}, "^7Type:") + controls.modGroupSelect = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 45, 600, 18}, modGroups, function(index, value) controls.modSelect.list = modList[value.modListIndex] controls.modSelect:SetSel(1) end) @@ -3114,8 +3114,8 @@ function ItemsTabClass:AddImplicitToDisplayItem() self:AddModComparisonTooltip(tooltip, value.mod) end end - controls.modSelectLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 95, 70, 0, 16, "^7Modifier:") - controls.modSelect = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 70, 600, 18, sourceList[controls.source.selIndex].sourceId ~= "CUSTOM" and modList[modGroups[1].modListIndex] or { }) + controls.modSelectLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {95, 70, 0, 16}, "^7Modifier:") + controls.modSelect = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 70, 600, 18}, sourceList[controls.source.selIndex].sourceId ~= "CUSTOM" and modList[modGroups[1].modListIndex] or { }) controls.modSelect.shown = function() return sourceList[controls.source.selIndex].sourceId ~= "CUSTOM" end @@ -3128,11 +3128,11 @@ function ItemsTabClass:AddImplicitToDisplayItem() self:AddModComparisonTooltip(tooltip, value.mod) end end - controls.custom = new("EditControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 45, 440, 18) + controls.custom = new("EditControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 45, 440, 18}) controls.custom.shown = function() return sourceList[controls.source.selIndex].sourceId == "CUSTOM" end - controls.save = new("ButtonControl", nil, -45, 100, 80, 20, "Add", function() + controls.save = new("ButtonControl", nil, {-45, 100, 80, 20}, "Add", function() self:SetDisplayItem(addModifier()) main:ClosePopup() end) @@ -3140,7 +3140,7 @@ function ItemsTabClass:AddImplicitToDisplayItem() tooltip:Clear() self:AddItemTooltip(tooltip, addModifier()) end - controls.close = new("ButtonControl", nil, 45, 100, 80, 20, "Cancel", function() + controls.close = new("ButtonControl", nil, {45, 100, 80, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(710, 130, "Add Implicit to Item", controls, "save", sourceList[controls.source.selIndex].sourceId == "CUSTOM" and "custom") diff --git a/src/Classes/LabelControl.lua b/src/Classes/LabelControl.lua index a4e8753f3a..2f799ece2d 100644 --- a/src/Classes/LabelControl.lua +++ b/src/Classes/LabelControl.lua @@ -3,8 +3,8 @@ -- Class: Label Control -- Simple text label. -- -local LabelClass = newClass("LabelControl", "Control", function(self, anchor, x, y, width, height, label) - self.Control(anchor, x, y, width, height) +local LabelClass = newClass("LabelControl", "Control", function(self, anchor, rect, label) + self.Control(anchor, rect) self.label = label self.width = function() return DrawStringWidth(self:GetProperty("height"), "VAR", self:GetProperty("label")) diff --git a/src/Classes/ListControl.lua b/src/Classes/ListControl.lua index 4ca10ae51c..ebc8287c50 100644 --- a/src/Classes/ListControl.lua +++ b/src/Classes/ListControl.lua @@ -30,8 +30,8 @@ local m_min = math.min local m_max = math.max local m_floor = math.floor -local ListClass = newClass("ListControl", "Control", "ControlHost", function(self, anchor, x, y, width, height, rowHeight, scroll, isMutable, list, forceTooltip) - self.Control(anchor, x, y, width, height) +local ListClass = newClass("ListControl", "Control", "ControlHost", function(self, anchor, rect, rowHeight, scroll, isMutable, list, forceTooltip) + self.Control(anchor, rect) self.ControlHost() self.rowHeight = rowHeight self.scroll = scroll @@ -48,7 +48,7 @@ local ListClass = newClass("ListControl", "Control", "ControlHost", function(sel self.scrollH = false end end - self.controls.scrollBarH = new("ScrollBarControl", {"BOTTOM",self,"BOTTOM"}, -8, -1, 0, self.scroll and 16 or 0, rowHeight * 2, "HORIZONTAL") { + self.controls.scrollBarH = new("ScrollBarControl", {"BOTTOM",self,"BOTTOM"}, {-8, -1, 0, self.scroll and 16 or 0}, rowHeight * 2, "HORIZONTAL") { shown = function() return self.scrollH end, @@ -57,7 +57,7 @@ local ListClass = newClass("ListControl", "Control", "ControlHost", function(sel return width - 18 end } - self.controls.scrollBarV = new("ScrollBarControl", {"RIGHT",self,"RIGHT"}, -1, 0, self.scroll and 16 or 0, 0, rowHeight * 2, "VERTICAL") { + self.controls.scrollBarV = new("ScrollBarControl", {"RIGHT",self,"RIGHT"}, {-1, 0, self.scroll and 16 or 0, 0}, rowHeight * 2, "VERTICAL") { y = function() return (self.scrollH and -8 or 0) end, diff --git a/src/Classes/MinionListControl.lua b/src/Classes/MinionListControl.lua index 3fe86013cf..1bd119853c 100644 --- a/src/Classes/MinionListControl.lua +++ b/src/Classes/MinionListControl.lua @@ -8,14 +8,14 @@ local t_insert = table.insert local t_remove = table.remove local s_format = string.format -local MinionListClass = newClass("MinionListControl", "ListControl", function(self, anchor, x, y, width, height, data, list, dest) - self.ListControl(anchor, x, y, width, height, 16, "VERTICAL", not dest, list) +local MinionListClass = newClass("MinionListControl", "ListControl", function(self, anchor, rect, data, list, dest) + self.ListControl(anchor, rect, 16, "VERTICAL", not dest, list) self.data = data self.dest = dest if dest then self.dragTargetList = { dest } self.label = "^7Available Spectres:" - self.controls.add = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, 0, -2, 60, 18, "Add", function() + self.controls.add = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, {0, -2, 60, 18}, "Add", function() self:AddSel() end) self.controls.add.enabled = function() @@ -23,7 +23,7 @@ local MinionListClass = newClass("MinionListControl", "ListControl", function(se end else self.label = "^7Spectres in Build:" - self.controls.delete = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, 0, -2, 60, 18, "Remove", function() + self.controls.delete = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, {0, -2, 60, 18}, "Remove", function() self:OnSelDelete(self.selIndex, self.selValue) end) self.controls.delete.enabled = function() 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/NotableDBControl.lua b/src/Classes/NotableDBControl.lua index 62253adff8..093929ddef 100644 --- a/src/Classes/NotableDBControl.lua +++ b/src/Classes/NotableDBControl.lua @@ -19,8 +19,8 @@ local function IsAnointableNode(node) end ---@class NotableDBControl : ListControl -local NotableDBClass = newClass("NotableDBControl", "ListControl", function(self, anchor, x, y, width, height, itemsTab, db, dbType) - self.ListControl(anchor, x, y, width, height, 16, "VERTICAL", false) +local NotableDBClass = newClass("NotableDBControl", "ListControl", function(self, anchor, rect, itemsTab, db, dbType) + self.ListControl(anchor, rect, 16, "VERTICAL", false) self.itemsTab = itemsTab self.db = db self.dbType = dbType @@ -32,13 +32,13 @@ local NotableDBClass = newClass("NotableDBControl", "ListControl", function(self self.sortDropList = { } self.sortOrder = { } self.sortMode = "NAME" - self.controls.sort = new("DropDownControl", {"BOTTOMLEFT",self,"TOPLEFT"}, 0, -22, 360, 18, self.sortDropList, function(index, value) + self.controls.sort = new("DropDownControl", {"BOTTOMLEFT",self,"TOPLEFT"}, {0, -22, 360, 18}, self.sortDropList, function(index, value) self:SetSortMode(value.sortMode) end) - self.controls.search = new("EditControl", {"BOTTOMLEFT",self,"TOPLEFT"}, 0, -2, 258, 18, "", "Search", "%c", 100, function() + self.controls.search = new("EditControl", {"BOTTOMLEFT",self,"TOPLEFT"}, {0, -2, 258, 18}, "", "Search", "%c", 100, function() self.listBuildFlag = true end, nil, nil, true) - self.controls.searchMode = new("DropDownControl", {"LEFT",self.controls.search,"RIGHT"}, 2, 0, 100, 18, { "Anywhere", "Names", "Modifiers" }, function(index, value) + self.controls.searchMode = new("DropDownControl", {"LEFT",self.controls.search,"RIGHT"}, {2, 0, 100, 18}, { "Anywhere", "Names", "Modifiers" }, function(index, value) self.listBuildFlag = true end) self:BuildSortOrder() diff --git a/src/Classes/NotesTab.lua b/src/Classes/NotesTab.lua index 303e169c29..f78ea2eb41 100644 --- a/src/Classes/NotesTab.lua +++ b/src/Classes/NotesTab.lua @@ -17,28 +17,28 @@ local NotesTabClass = newClass("NotesTab", "ControlHost", "Control", function(se local notesDesc = [[^7You can use Ctrl +/- (or Ctrl+Scroll) to zoom in and out and Ctrl+0 to reset. This field also supports different colors. Using the caret symbol (^) followed by a Hex code or a number (0-9) will set the color. Below are some common color codes PoB uses: ]] - self.controls.notesDesc = new("LabelControl", {"TOPLEFT",self,"TOPLEFT"}, 8, 8, 150, 16, notesDesc) - self.controls.normal = new("ButtonControl", {"TOPLEFT",self.controls.notesDesc,"TOPLEFT"}, 0, 48, 100, 18, colorCodes.NORMAL.."NORMAL", function() self:SetColor(colorCodes.NORMAL) end) - self.controls.magic = new("ButtonControl", {"TOPLEFT",self.controls.normal,"TOPLEFT"}, 120, 0, 100, 18, colorCodes.MAGIC.."MAGIC", function() self:SetColor(colorCodes.MAGIC) end) - self.controls.rare = new("ButtonControl", {"TOPLEFT",self.controls.magic,"TOPLEFT"}, 120, 0, 100, 18, colorCodes.RARE.."RARE", function() self:SetColor(colorCodes.RARE) end) - self.controls.unique = new("ButtonControl", {"TOPLEFT",self.controls.rare,"TOPLEFT"}, 120, 0, 100, 18, colorCodes.UNIQUE.."UNIQUE", function() self:SetColor(colorCodes.UNIQUE) end) - self.controls.fire = new("ButtonControl", {"TOPLEFT",self.controls.normal,"TOPLEFT"}, 0, 18, 100, 18, colorCodes.FIRE.."FIRE", function() self:SetColor(colorCodes.FIRE) end) - self.controls.cold = new("ButtonControl", {"TOPLEFT",self.controls.fire,"TOPLEFT"}, 120, 0, 100, 18, colorCodes.COLD.."COLD", function() self:SetColor(colorCodes.COLD) end) - self.controls.lightning = new("ButtonControl", {"TOPLEFT",self.controls.cold,"TOPLEFT"}, 120, 0, 100, 18, colorCodes.LIGHTNING.."LIGHTNING", function() self:SetColor(colorCodes.LIGHTNING) end) - self.controls.chaos = new("ButtonControl", {"TOPLEFT",self.controls.lightning,"TOPLEFT"}, 120, 0, 100, 18, colorCodes.CHAOS.."CHAOS", function() self:SetColor(colorCodes.CHAOS) end) - self.controls.strength = new("ButtonControl", {"TOPLEFT",self.controls.fire,"TOPLEFT"}, 0, 18, 100, 18, colorCodes.STRENGTH.."STRENGTH", function() self:SetColor(colorCodes.STRENGTH) end) - self.controls.dexterity = new("ButtonControl", {"TOPLEFT",self.controls.strength,"TOPLEFT"}, 120, 0, 100, 18, colorCodes.DEXTERITY.."DEXTERITY", function() self:SetColor(colorCodes.DEXTERITY) end) - self.controls.intelligence = new("ButtonControl", {"TOPLEFT",self.controls.dexterity,"TOPLEFT"}, 120, 0, 100, 18, colorCodes.INTELLIGENCE.."INTELLIGENCE", function() self:SetColor(colorCodes.INTELLIGENCE) end) - self.controls.default = new("ButtonControl", {"TOPLEFT",self.controls.intelligence,"TOPLEFT"}, 120, 0, 100, 18, "^7DEFAULT", function() self:SetColor("^7") end) + self.controls.notesDesc = new("LabelControl", {"TOPLEFT",self,"TOPLEFT"}, {8, 8, 150, 16}, notesDesc) + self.controls.normal = new("ButtonControl", {"TOPLEFT",self.controls.notesDesc,"TOPLEFT"}, {0, 48, 100, 18}, colorCodes.NORMAL.."NORMAL", function() self:SetColor(colorCodes.NORMAL) end) + self.controls.magic = new("ButtonControl", {"TOPLEFT",self.controls.normal,"TOPLEFT"}, {120, 0, 100, 18}, colorCodes.MAGIC.."MAGIC", function() self:SetColor(colorCodes.MAGIC) end) + self.controls.rare = new("ButtonControl", {"TOPLEFT",self.controls.magic,"TOPLEFT"}, {120, 0, 100, 18}, colorCodes.RARE.."RARE", function() self:SetColor(colorCodes.RARE) end) + self.controls.unique = new("ButtonControl", {"TOPLEFT",self.controls.rare,"TOPLEFT"}, {120, 0, 100, 18}, colorCodes.UNIQUE.."UNIQUE", function() self:SetColor(colorCodes.UNIQUE) end) + self.controls.fire = new("ButtonControl", {"TOPLEFT",self.controls.normal,"TOPLEFT"}, {0, 18, 100, 18}, colorCodes.FIRE.."FIRE", function() self:SetColor(colorCodes.FIRE) end) + self.controls.cold = new("ButtonControl", {"TOPLEFT",self.controls.fire,"TOPLEFT"}, {120, 0, 100, 18}, colorCodes.COLD.."COLD", function() self:SetColor(colorCodes.COLD) end) + self.controls.lightning = new("ButtonControl", {"TOPLEFT",self.controls.cold,"TOPLEFT"}, {120, 0, 100, 18}, colorCodes.LIGHTNING.."LIGHTNING", function() self:SetColor(colorCodes.LIGHTNING) end) + self.controls.chaos = new("ButtonControl", {"TOPLEFT",self.controls.lightning,"TOPLEFT"}, {120, 0, 100, 18}, colorCodes.CHAOS.."CHAOS", function() self:SetColor(colorCodes.CHAOS) end) + self.controls.strength = new("ButtonControl", {"TOPLEFT",self.controls.fire,"TOPLEFT"}, {0, 18, 100, 18}, colorCodes.STRENGTH.."STRENGTH", function() self:SetColor(colorCodes.STRENGTH) end) + self.controls.dexterity = new("ButtonControl", {"TOPLEFT",self.controls.strength,"TOPLEFT"}, {120, 0, 100, 18}, colorCodes.DEXTERITY.."DEXTERITY", function() self:SetColor(colorCodes.DEXTERITY) end) + self.controls.intelligence = new("ButtonControl", {"TOPLEFT",self.controls.dexterity,"TOPLEFT"}, {120, 0, 100, 18}, colorCodes.INTELLIGENCE.."INTELLIGENCE", function() self:SetColor(colorCodes.INTELLIGENCE) end) + self.controls.default = new("ButtonControl", {"TOPLEFT",self.controls.intelligence,"TOPLEFT"}, {120, 0, 100, 18}, "^7DEFAULT", function() self:SetColor("^7") end) - self.controls.edit = new("EditControl", {"TOPLEFT",self.controls.fire,"TOPLEFT"}, 0, 48, 0, 0, "", nil, "^%C\t\n", nil, nil, 16, true) + self.controls.edit = new("EditControl", {"TOPLEFT",self.controls.fire,"TOPLEFT"}, {0, 48, 0, 0}, "", nil, "^%C\t\n", nil, nil, 16, true) self.controls.edit.width = function() return self.width - 16 end self.controls.edit.height = function() return self.height - 128 end - self.controls.toggleColorCodes = new("ButtonControl", {"TOPRIGHT",self,"TOPRIGHT"}, -10, 70, 160, 20, "Show Color Codes", function() + self.controls.toggleColorCodes = new("ButtonControl", {"TOPRIGHT",self,"TOPRIGHT"}, {-10, 70, 160, 20}, "Show Color Codes", function() self.showColorCodes = not self.showColorCodes self:SetShowColorCodes(self.showColorCodes) end) diff --git a/src/Classes/PartyTab.lua b/src/Classes/PartyTab.lua index 8adf700357..451759eccb 100644 --- a/src/Classes/PartyTab.lua +++ b/src/Classes/PartyTab.lua @@ -61,7 +61,7 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se All of these effects can be found in the Calcs tab]] - self.controls.notesDesc = new("LabelControl", {"TOPLEFT",self,"TOPLEFT"}, 8, 8, 150, theme.stringHeight, notesDesc) + self.controls.notesDesc = new("LabelControl", {"TOPLEFT",self,"TOPLEFT"}, {8, 8, 150, theme.stringHeight}, notesDesc) self.controls.notesDesc.width = function() local width = self.width / 2 - 16 if width ~= self.controls.notesDesc.lastWidth then @@ -70,7 +70,7 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se end return width end - self.controls.importCodeHeader = new("LabelControl", {"TOPLEFT",self.controls.notesDesc,"BOTTOMLEFT"}, 0, 32, 0, theme.stringHeight, "^7Enter a build code/URL below:") + self.controls.importCodeHeader = new("LabelControl", {"TOPLEFT",self.controls.notesDesc,"BOTTOMLEFT"}, {0, 32, 0, theme.stringHeight}, "^7Enter a build code/URL below:") self.controls.importCodeHeader.y = function() return theme.lineCounter(self.controls.notesDesc.label) + 4 end @@ -280,7 +280,7 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se end end - self.controls.importCodeIn = new("EditControl", {"TOPLEFT",self.controls.importCodeHeader,"BOTTOMLEFT"}, 0, 4, 328, theme.buttonHeight, "", nil, nil, nil, importCodeHandle) + self.controls.importCodeIn = new("EditControl", {"TOPLEFT",self.controls.importCodeHeader,"BOTTOMLEFT"}, {0, 4, 328, theme.buttonHeight}, "", nil, nil, nil, importCodeHandle) self.controls.importCodeIn.width = function() return (self.width > 880) and 328 or (self.width / 2 - 100) end @@ -289,13 +289,13 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se self.controls.importCodeGo.onClick() end end - self.controls.importCodeState = new("LabelControl", {"LEFT",self.controls.importCodeIn,"RIGHT"}, 8, 0, 0, theme.stringHeight) + self.controls.importCodeState = new("LabelControl", {"LEFT",self.controls.importCodeIn,"RIGHT"}, {8, 0, 0, theme.stringHeight}) self.controls.importCodeState.label = function() return self.importCodeDetail or "" end - self.controls.importCodeDestination = new("DropDownControl", {"TOPLEFT",self.controls.importCodeIn,"BOTTOMLEFT"}, 0, 4, 160, theme.buttonHeight, partyDestinations) + self.controls.importCodeDestination = new("DropDownControl", {"TOPLEFT",self.controls.importCodeIn,"BOTTOMLEFT"}, {0, 4, 160, theme.buttonHeight}, partyDestinations) self.controls.importCodeDestination.tooltipText = "Destination for Import/clear\nCurrently Links Skills do not export" - self.controls.importCodeGo = new("ButtonControl", {"LEFT",self.controls.importCodeDestination,"RIGHT"}, 8, 0, 160, theme.buttonHeight, "Import", function() + self.controls.importCodeGo = new("ButtonControl", {"LEFT",self.controls.importCodeDestination,"RIGHT"}, {8, 0, 160, theme.buttonHeight}, "Import", function() local importCodeFetching = false if self.importCodeSite and not self.importCodeXML then self.importCodeFetching = true @@ -323,7 +323,7 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se self.controls.importCodeGo.onClick() end end - self.controls.appendNotReplace = new("CheckBoxControl", {"LEFT",self.controls.importCodeGo,"RIGHT"}, 60, 0, theme.buttonHeight, "Append", function(state) + self.controls.appendNotReplace = new("CheckBoxControl", {"LEFT",self.controls.importCodeGo,"RIGHT"}, {60, 0, theme.buttonHeight}, "Append", function(state) end, "This sets the import button to append to the current party lists instead of replacing them (curses will still replace)", false) self.controls.appendNotReplace.x = function() return (self.width > theme.widthThreshold1) and 60 or (-276) @@ -332,7 +332,7 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se return (self.width > theme.widthThreshold1) and 0 or 24 end - self.controls.clear = new("ButtonControl", {"LEFT",self.controls.appendNotReplace,"RIGHT"}, 8, 0, 160, theme.buttonHeight, "Clear", function() + self.controls.clear = new("ButtonControl", {"LEFT",self.controls.appendNotReplace,"RIGHT"}, {8, 0, 160, theme.buttonHeight}, "Clear", function() clearInputText() wipeTable(self.enemyModList) self.enemyModList = new("ModList") @@ -340,13 +340,13 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se end) self.controls.clear.tooltipText = "^7Clears all the party tab imported data" - self.controls.ShowAdvanceTools = new("CheckBoxControl", {"TOPLEFT",self.controls.importCodeDestination,"BOTTOMLEFT"}, 140, 4, theme.buttonHeight, "^7Show Advanced Info", function(state) + self.controls.ShowAdvanceTools = new("CheckBoxControl", {"TOPLEFT",self.controls.importCodeDestination,"BOTTOMLEFT"}, {140, 4, theme.buttonHeight}, "^7Show Advanced Info", function(state) end, "This shows the advanced info like what stats each aura/curse etc are adding, as well as enables the ability to edit them without a re-export\nDo not edit any boxes unless you know what you are doing, use copy/paste or import instead", false) self.controls.ShowAdvanceTools.y = function() return (self.width > theme.widthThreshold1) and 4 or 28 end - self.controls.removeEffects = new("ButtonControl", {"LEFT",self.controls.ShowAdvanceTools,"RIGHT"}, 8, 0, 160, theme.buttonHeight, "Disable Party Effects", function() + self.controls.removeEffects = new("ButtonControl", {"LEFT",self.controls.ShowAdvanceTools,"RIGHT"}, {8, 0, 160, theme.buttonHeight}, "Disable Party Effects", function() wipeTable(self.actor) wipeTable(self.enemyModList) self.actor = { Aura = {}, Curse = {}, Warcry = { }, Link = {}, modDB = new("ModDB"), output = { } } @@ -356,7 +356,7 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se end) self.controls.removeEffects.tooltipText = "^7Removes the effects of the supports, without removing the data\nUse \"rebuild all\" to apply the effects again" - self.controls.rebuild = new("ButtonControl", {"LEFT",self.controls.removeEffects,"RIGHT"}, 8, 0, 160, theme.buttonHeight, "^7Rebuild All", function() + self.controls.rebuild = new("ButtonControl", {"LEFT",self.controls.removeEffects,"RIGHT"}, {8, 0, 160, theme.buttonHeight}, "^7Rebuild All", function() wipeTable(self.actor) wipeTable(self.enemyModList) self.actor = { Aura = {}, Curse = {}, Warcry = { }, Link = {}, modDB = new("ModDB"), output = { } } @@ -379,11 +379,11 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se return (self.width > theme.widthThreshold1) and 0 or 24 end - self.controls.editAurasLabel = new("LabelControl", {"TOPLEFT",self.controls.ShowAdvanceTools,"TOPLEFT"}, -140, 40, 0, theme.stringHeight, "^7Auras") + self.controls.editAurasLabel = new("LabelControl", {"TOPLEFT",self.controls.ShowAdvanceTools,"TOPLEFT"}, {-140, 40, 0, theme.stringHeight}, "^7Auras") self.controls.editAurasLabel.y = function() return 36 + ((self.width <= theme.widthThreshold1) and 24 or 0) end - self.controls.editAuras = new("EditControl", {"TOPLEFT",self.controls.editAurasLabel,"TOPLEFT"}, 0, 18, 0, 0, "", nil, "^%C\t\n", nil, nil, 14, true) + self.controls.editAuras = new("EditControl", {"TOPLEFT",self.controls.editAurasLabel,"TOPLEFT"}, {0, 18, 0, 0}, "", nil, "^%C\t\n", nil, nil, 14, true) self.controls.editAuras.width = function() return self.width / 2 - 16 end @@ -394,16 +394,16 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se self.controls.editAuras.shown = function() return self.controls.ShowAdvanceTools.state end - self.controls.simpleAuras = new("LabelControl", {"TOPLEFT",self.controls.editAurasLabel,"TOPLEFT"}, 0, 18, 0, theme.stringHeight, "") + self.controls.simpleAuras = new("LabelControl", {"TOPLEFT",self.controls.editAurasLabel,"TOPLEFT"}, {0, 18, 0, theme.stringHeight}, "") self.controls.simpleAuras.shown = function() 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 @@ -432,13 +432,13 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se self.controls.editLinks.shown = function() return self.controls.ShowAdvanceTools.state end - self.controls.simpleLinks = new("LabelControl", {"TOPLEFT",self.controls.editLinksLabel,"TOPLEFT"}, 0, 18, 0, theme.stringHeight, "") + self.controls.simpleLinks = new("LabelControl", {"TOPLEFT",self.controls.editLinksLabel,"TOPLEFT"}, {0, 18, 0, theme.stringHeight}, "") self.controls.simpleLinks.shown = function() return not self.controls.ShowAdvanceTools.state end - self.controls.editPartyMemberStatsLabel = new("LabelControl", {"TOPLEFT",self.controls.notesDesc,"TOPRIGHT"}, 8, 0, 0, theme.stringHeight, "^7Party Member Stats") - self.controls.editPartyMemberStats = new("EditControl", {"TOPLEFT",self.controls.editPartyMemberStatsLabel,"BOTTOMLEFT"}, 0, 2, 0, 0, "", nil, "^%C\t\n", nil, nil, 14, true) + self.controls.editPartyMemberStatsLabel = new("LabelControl", {"TOPLEFT",self.controls.notesDesc,"TOPRIGHT"}, {8, 0, 0, theme.stringHeight}, "^7Party Member Stats") + self.controls.editPartyMemberStats = new("EditControl", {"TOPLEFT",self.controls.editPartyMemberStatsLabel,"BOTTOMLEFT"}, {0, 2, 0, 0}, "", nil, "^%C\t\n", nil, nil, 14, true) self.controls.editPartyMemberStats.width = function() return self.width / 2 - 16 end @@ -449,11 +449,11 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se return self.controls.ShowAdvanceTools.state end - self.controls.enemyCondLabel = new("LabelControl", {"TOPLEFT",self.controls.editPartyMemberStatsLabel,"BOTTOMLEFT"}, 0, 8, 0, theme.stringHeight, "^7Enemy Conditions") + self.controls.enemyCondLabel = new("LabelControl", {"TOPLEFT",self.controls.editPartyMemberStatsLabel,"BOTTOMLEFT"}, {0, 8, 0, theme.stringHeight}, "^7Enemy Conditions") self.controls.enemyCondLabel.y = function() return self.controls.ShowAdvanceTools.state and (self.controls.editPartyMemberStats.height() + 8) or 4 end - self.controls.enemyCond = new("EditControl", {"TOPLEFT",self.controls.enemyCondLabel,"BOTTOMLEFT"}, 0, 2, 0, 0, "", nil, "^%C\t\n", nil, nil, 14, true) + self.controls.enemyCond = new("EditControl", {"TOPLEFT",self.controls.enemyCondLabel,"BOTTOMLEFT"}, {0, 2, 0, 0}, "", nil, "^%C\t\n", nil, nil, 14, true) self.controls.enemyCond.width = function() return self.width / 2 - 16 end @@ -463,16 +463,16 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se self.controls.enemyCond.shown = function() return self.controls.ShowAdvanceTools.state end - self.controls.simpleEnemyCond = new("LabelControl", {"TOPLEFT",self.controls.enemyCondLabel,"TOPLEFT"}, 0, 18, 0, theme.stringHeight, "^7---------------------------\n") + self.controls.simpleEnemyCond = new("LabelControl", {"TOPLEFT",self.controls.enemyCondLabel,"TOPLEFT"}, {0, 18, 0, theme.stringHeight}, "^7---------------------------\n") self.controls.simpleEnemyCond.shown = function() return not self.controls.ShowAdvanceTools.state end - self.controls.enemyModsLabel = new("LabelControl", {"TOPLEFT",self.controls.enemyCondLabel,"BOTTOMLEFT"}, 0, 8, 0, theme.stringHeight, "^7Enemy Modifiers") + self.controls.enemyModsLabel = new("LabelControl", {"TOPLEFT",self.controls.enemyCondLabel,"BOTTOMLEFT"}, {0, 8, 0, theme.stringHeight}, "^7Enemy Modifiers") self.controls.enemyModsLabel.y = function() return self.controls.ShowAdvanceTools.state and (self.controls.enemyCond.height() + 8) or (theme.lineCounter(self.controls.simpleEnemyCond.label) + 4) end - self.controls.enemyMods = new("EditControl", {"TOPLEFT",self.controls.enemyModsLabel,"BOTTOMLEFT"}, 0, 2, 0, 0, "", nil, "^%C\t\n", nil, nil, 14, true) + self.controls.enemyMods = new("EditControl", {"TOPLEFT",self.controls.enemyModsLabel,"BOTTOMLEFT"}, {0, 2, 0, 0}, "", nil, "^%C\t\n", nil, nil, 14, true) self.controls.enemyMods.width = function() return self.width / 2 - 16 end @@ -482,16 +482,16 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se self.controls.enemyMods.shown = function() return self.controls.ShowAdvanceTools.state end - self.controls.simpleEnemyMods = new("LabelControl", {"TOPLEFT",self.controls.enemyModsLabel,"TOPLEFT"}, 0, 18, 0, theme.stringHeight, "\n") + self.controls.simpleEnemyMods = new("LabelControl", {"TOPLEFT",self.controls.enemyModsLabel,"TOPLEFT"}, {0, 18, 0, theme.stringHeight}, "\n") self.controls.simpleEnemyMods.shown = function() return not self.controls.ShowAdvanceTools.state end - self.controls.editCursesLabel = new("LabelControl", {"TOPLEFT",self.controls.enemyModsLabel,"BOTTOMLEFT"}, 0, 8, 0, theme.stringHeight, "^7Curses") + self.controls.editCursesLabel = new("LabelControl", {"TOPLEFT",self.controls.enemyModsLabel,"BOTTOMLEFT"}, {0, 8, 0, theme.stringHeight}, "^7Curses") self.controls.editCursesLabel.y = function() return self.controls.ShowAdvanceTools.state and (self.controls.enemyMods.height() + 8) or (theme.lineCounter(self.controls.simpleEnemyMods.label) + 4) end - self.controls.editCurses = new("EditControl", {"TOPLEFT",self.controls.editCursesLabel,"BOTTOMLEFT"}, 0, 2, 0, 0, "", nil, "^%C\t\n", nil, nil, 14, true) + self.controls.editCurses = new("EditControl", {"TOPLEFT",self.controls.editCursesLabel,"BOTTOMLEFT"}, {0, 2, 0, 0}, "", nil, "^%C\t\n", nil, nil, 14, true) self.controls.editCurses.width = function() return self.width / 2 - 16 end @@ -501,7 +501,7 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se self.controls.editCurses.shown = function() return self.controls.ShowAdvanceTools.state end - self.controls.simpleCurses = new("LabelControl", {"TOPLEFT",self.controls.editCursesLabel,"TOPLEFT"}, 0, 18, 0, theme.stringHeight, "") + self.controls.simpleCurses = new("LabelControl", {"TOPLEFT",self.controls.editCursesLabel,"TOPLEFT"}, {0, 18, 0, theme.stringHeight}, "") self.controls.simpleCurses.shown = function() return not self.controls.ShowAdvanceTools.state end diff --git a/src/Classes/PassiveMasteryControl.lua b/src/Classes/PassiveMasteryControl.lua index 61e0fef119..6cf35b182c 100644 --- a/src/Classes/PassiveMasteryControl.lua +++ b/src/Classes/PassiveMasteryControl.lua @@ -10,13 +10,13 @@ local m_max = math.max local m_floor = math.floor --constructor -local PassiveMasteryControlClass = newClass("PassiveMasteryControl", "ListControl", function(self, anchor, x, y, width, height, list, treeTab, node, saveButton) +local PassiveMasteryControlClass = newClass("PassiveMasteryControl", "ListControl", function(self, anchor, rect, list, treeTab, node, saveButton) self.list = list or { } -- automagical width for j=1,#list do - width = m_max(width, DrawStringWidth(16, "VAR", list[j].label) + 5) + rect[3] = m_max(rect[3], DrawStringWidth(16, "VAR", list[j].label) + 5) end - self.ListControl(anchor, x, y, width, height, 16, false, false, self.list) + self.ListControl(anchor, rect, 16, false, false, self.list) self.treeTab = treeTab self.treeView = treeTab.viewer self.node = node diff --git a/src/Classes/PassiveSpecListControl.lua b/src/Classes/PassiveSpecListControl.lua index 7b65d5a938..f227764d8f 100644 --- a/src/Classes/PassiveSpecListControl.lua +++ b/src/Classes/PassiveSpecListControl.lua @@ -7,10 +7,10 @@ local t_insert = table.insert local t_remove = table.remove local m_max = math.max -local PassiveSpecListClass = newClass("PassiveSpecListControl", "ListControl", function(self, anchor, x, y, width, height, treeTab) - self.ListControl(anchor, x, y, width, height, 16, "VERTICAL", true, treeTab.specList) +local PassiveSpecListClass = newClass("PassiveSpecListControl", "ListControl", function(self, anchor, rect, treeTab) + self.ListControl(anchor, rect, 16, "VERTICAL", true, treeTab.specList) self.treeTab = treeTab - 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 newSpec = new("PassiveSpec", treeTab.build, self.selValue.treeVersion) newSpec.title = self.selValue.title newSpec.jewels = copyTable(self.selValue.jewels) @@ -21,19 +21,19 @@ local PassiveSpecListClass = newClass("PassiveSpecListControl", "ListControl", f 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:RenameSpec(self.selValue, "Rename Tree") 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() local newSpec = new("PassiveSpec", treeTab.build, latestTreeVersion) newSpec:SelectClass(treeTab.build.spec.curClassId) newSpec:SelectAscendClass(treeTab.build.spec.curAscendClassId) @@ -45,11 +45,11 @@ end) function PassiveSpecListClass:RenameSpec(spec, title, addOnName) local controls = { } - controls.label = new("LabelControl", nil, 0, 20, 0, 16, "^7Enter name for this passive tree:") - controls.edit = new("EditControl", nil, 0, 40, 350, 20, spec.title, nil, nil, 100, function(buf) + controls.label = new("LabelControl", nil, {0, 20, 0, 16}, "^7Enter name for this passive tree:") + controls.edit = new("EditControl", nil, {0, 40, 350, 20}, spec.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() spec.title = controls.edit.buf self.treeTab.modFlag = true if addOnName then @@ -62,7 +62,7 @@ function PassiveSpecListClass:RenameSpec(spec, title, 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() main:ClosePopup() end) -- main:OpenPopup(370, 100, spec.title and "Rename" or "Set Name", controls, "save", "edit") diff --git a/src/Classes/PathControl.lua b/src/Classes/PathControl.lua index 35b5cc872a..4d62bef272 100644 --- a/src/Classes/PathControl.lua +++ b/src/Classes/PathControl.lua @@ -6,8 +6,8 @@ local ipairs = ipairs local t_insert = table.insert -local PathClass = newClass("PathControl", "Control", "ControlHost", "UndoHandler", function(self, anchor, x, y, width, height, basePath, subPath, onChange) - self.Control(anchor, x, y, width, height) +local PathClass = newClass("PathControl", "Control", "ControlHost", "UndoHandler", function(self, anchor, rect, basePath, subPath, onChange) + self.Control(anchor, rect) self.ControlHost() self.UndoHandler() self.basePath = basePath @@ -33,7 +33,7 @@ function PathClass:SetSubPath(subPath, noUndo) for index, folder in ipairs(self.folderList) do local button = self.controls["folder"..i] if not button then - button = new("ButtonControl", {"LEFT",self,"LEFT"}, 0, 0, 0, self.height - 4) + button = new("ButtonControl", {"LEFT",self,"LEFT"}, {0, 0, 0, self.height - 4}) self.controls["folder"..i] = button end button.shown = true diff --git a/src/Classes/PopupDialog.lua b/src/Classes/PopupDialog.lua index afcf9b865f..223059def9 100644 --- a/src/Classes/PopupDialog.lua +++ b/src/Classes/PopupDialog.lua @@ -8,7 +8,7 @@ local m_floor = math.floor local PopupDialogClass = newClass("PopupDialog", "ControlHost", "Control", function(self, width, height, title, controls, enterControl, defaultControl, escapeControl, scrollBarFunc, resizeFunc) self.ControlHost() - self.Control(nil, 0, 0, width, height) + self.Control(nil, {0, 0, width, height}) self.x = function() return m_floor((main.screenW - width) / 2) end diff --git a/src/Classes/PowerReportListControl.lua b/src/Classes/PowerReportListControl.lua index 1a58db5f78..0b08bdd60f 100644 --- a/src/Classes/PowerReportListControl.lua +++ b/src/Classes/PowerReportListControl.lua @@ -8,9 +8,10 @@ local t_insert = table.insert local t_remove = table.remove local t_sort = table.sort -local PowerReportListClass = newClass("PowerReportListControl", "ListControl", function(self, anchor, x, y, width, height, nodeSelectCallback) - self.ListControl(anchor, x, y, width, height-50, 16, "VERTICAL", false) +local PowerReportListClass = newClass("PowerReportListControl", "ListControl", function(self, anchor, rect, nodeSelectCallback) + self.ListControl(anchor, rect, 16, "VERTICAL", false) + local width = rect[3] self.powerColumn = { width = width * 0.16, label = "", sortable = true } self.colList = { { width = width * 0.15, label = "Type", sortable = true }, @@ -25,7 +26,7 @@ local PowerReportListClass = newClass("PowerReportListControl", "ListControl", f self.allocated = false self.label = "Building Tree..." - self.controls.filterSelect = new("DropDownControl", { "BOTTOMRIGHT", self, "TOPRIGHT" }, 0, -2, 200, 20, + self.controls.filterSelect = new("DropDownControl", {"BOTTOMRIGHT", self, "TOPRIGHT"}, {0, -2, 200, 20}, { "Show Unallocated", "Show Unallocated & Clusters", "Show Allocated" }, function(index, value) self.showClusters = index == 2 diff --git a/src/Classes/RectangleOutlineControl.lua b/src/Classes/RectangleOutlineControl.lua index 2acf23bf8d..8b8b0b9d47 100644 --- a/src/Classes/RectangleOutlineControl.lua +++ b/src/Classes/RectangleOutlineControl.lua @@ -3,8 +3,8 @@ -- Class: RectangleOutline Control -- Simple Outline Only Rectangle control -- -local RectangleOutlineClass = newClass("RectangleOutlineControl", "Control", function(self, anchor, x, y, width, height, colors, stroke) - self.Control(anchor, x, y, width, height) +local RectangleOutlineClass = newClass("RectangleOutlineControl", "Control", function(self, anchor, rect, colors, stroke) + self.Control(anchor, rect) self.stroke = stroke or 1 self.colors = colors or { 1, 1, 1 } end) diff --git a/src/Classes/ResizableEditControl.lua b/src/Classes/ResizableEditControl.lua index 9bff3bd5fe..66a0402e3f 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, height, 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/ScrollBarControl.lua b/src/Classes/ScrollBarControl.lua index 8a7260470d..7dfc416e9e 100644 --- a/src/Classes/ScrollBarControl.lua +++ b/src/Classes/ScrollBarControl.lua @@ -8,9 +8,9 @@ local m_max = math.max local m_ceil = math.ceil local m_floor = math.floor -local ScrollBarClass = newClass("ScrollBarControl", "Control", function(self, anchor, x, y, width, height, step, dir, autoHide) - self.Control(anchor, x, y, width, height) - self.step = step or width * 2 +local ScrollBarClass = newClass("ScrollBarControl", "Control", function(self, anchor, rect, step, dir, autoHide) + self.Control(anchor, rect) + self.step = step or self.width * 2 self.dir = dir or "VERTICAL" self.offset = 0 self.enabled = false diff --git a/src/Classes/SectionControl.lua b/src/Classes/SectionControl.lua index 1d2390e99b..45e1498d2e 100644 --- a/src/Classes/SectionControl.lua +++ b/src/Classes/SectionControl.lua @@ -4,8 +4,8 @@ -- Section box with label -- -local SectionClass = newClass("SectionControl", "Control", function(self, anchor, x, y, width, height, label) - self.Control(anchor, x, y, width, height) +local SectionClass = newClass("SectionControl", "Control", function(self, anchor, rect, label) + self.Control(anchor, rect) self.label = label end) diff --git a/src/Classes/SharedItemListControl.lua b/src/Classes/SharedItemListControl.lua index 9672f38d56..b7605b61dc 100644 --- a/src/Classes/SharedItemListControl.lua +++ b/src/Classes/SharedItemListControl.lua @@ -7,13 +7,13 @@ local pairs = pairs local t_insert = table.insert local t_remove = table.remove -local SharedItemListClass = newClass("SharedItemListControl", "ListControl", function(self, anchor, x, y, width, height, itemsTab, forceTooltip) - self.ListControl(anchor, x, y, width, height, 16, "VERTICAL", true, main.sharedItemList, forceTooltip) +local SharedItemListClass = newClass("SharedItemListControl", "ListControl", function(self, anchor, rect, itemsTab, forceTooltip) + self.ListControl(anchor, rect, 16, "VERTICAL", true, main.sharedItemList, forceTooltip) self.itemsTab = itemsTab self.label = "^7Shared items:" self.defaultText = "^x7F7F7FThis is a list of items that will be shared between all of\nyour builds.\nYou can add items to this list by dragging them from\none of the other lists." self.dragTargetList = { } - self.controls.delete = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, 0, -2, 60, 18, "Delete", function() + self.controls.delete = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, {0, -2, 60, 18}, "Delete", function() self:OnSelDelete(self.selIndex, self.selValue) end) self.controls.delete.enabled = function() diff --git a/src/Classes/SharedItemSetListControl.lua b/src/Classes/SharedItemSetListControl.lua index c6dfeefb81..c24932a705 100644 --- a/src/Classes/SharedItemSetListControl.lua +++ b/src/Classes/SharedItemSetListControl.lua @@ -8,17 +8,17 @@ local t_remove = table.remove local m_max = math.max local s_format = string.format -local SharedItemSetListClass = newClass("SharedItemSetListControl", "ListControl", function(self, anchor, x, y, width, height, itemsTab) - self.ListControl(anchor, x, y, width, height, 16, "VERTICAL", true, main.sharedItemSetList) +local SharedItemSetListClass = newClass("SharedItemSetListControl", "ListControl", function(self, anchor, rect, itemsTab) + self.ListControl(anchor, rect, 16, "VERTICAL", true, main.sharedItemSetList) self.itemsTab = itemsTab self.defaultText = "^x7F7F7FThis is a list of item sets that will be shared\nbetween all of your builds.\nYou can add sets to this list by dragging them\nfrom the build's set list." - self.controls.delete = new("ButtonControl", {"BOTTOMLEFT",self,"TOP"}, 2, -4, 60, 18, "Delete", function() + self.controls.delete = new("ButtonControl", {"BOTTOMLEFT",self,"TOP"}, {2, -4, 60, 18}, "Delete", function() self:OnSelDelete(self.selIndex, self.selValue) end) self.controls.delete.enabled = function() return self.selValue ~= nil 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(self.selValue) end) self.controls.rename.enabled = function() @@ -28,17 +28,17 @@ end) function SharedItemSetListClass:RenameSet(sharedItemSet) local controls = { } - controls.label = new("LabelControl", nil, 0, 20, 0, 16, "^7Enter name for this item set:") - controls.edit = new("EditControl", nil, 0, 40, 350, 20, sharedItemSet.title, nil, nil, 100, function(buf) + controls.label = new("LabelControl", nil, {0, 20, 0, 16}, "^7Enter name for this item set:") + controls.edit = new("EditControl", nil, {0, 40, 350, 20}, sharedItemSet.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() sharedItemSet.title = controls.edit.buf self.itemsTab.modFlag = true 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, sharedItemSet.title and "Rename" or "Set Name", controls, "save", "edit") diff --git a/src/Classes/SkillListControl.lua b/src/Classes/SkillListControl.lua index e2126f3841..02a95c3ffe 100644 --- a/src/Classes/SkillListControl.lua +++ b/src/Classes/SkillListControl.lua @@ -25,17 +25,17 @@ local slot_map = { ["Belt"] = { icon = NewImageHandle(), path = "Assets/icon_belt.png" }, } -local SkillListClass = newClass("SkillListControl", "ListControl", function(self, anchor, x, y, width, height, skillsTab) - self.ListControl(anchor, x, y, width, height, 16, "VERTICAL", true, skillsTab.socketGroupList) +local SkillListClass = newClass("SkillListControl", "ListControl", function(self, anchor, rect, skillsTab) + self.ListControl(anchor, rect, 16, "VERTICAL", true, skillsTab.socketGroupList) self.skillsTab = skillsTab self.label = "^7Socket Groups:" - self.controls.delete = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, 0, -2, 60, 18, "Delete", function() + self.controls.delete = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, {0, -2, 60, 18}, "Delete", function() self:OnSelDelete(self.selIndex, self.selValue) end) self.controls.delete.enabled = function() return self.selValue ~= nil and self.selValue.source == nil end - self.controls.deleteAll = new("ButtonControl", {"RIGHT",self.controls.delete,"LEFT"}, -4, 0, 70, 18, "Delete All", function() + self.controls.deleteAll = new("ButtonControl", {"RIGHT",self.controls.delete,"LEFT"}, {-4, 0, 70, 18}, "Delete All", function() main:OpenConfirmPopup("Delete All", "Are you sure you want to delete all socket groups in this build?", "Delete", function() wipeTable(self.list) skillsTab:SetDisplayGroup() @@ -48,7 +48,7 @@ local SkillListClass = newClass("SkillListControl", "ListControl", function(self self.controls.deleteAll.enabled = function() return #self.list > 0 end - self.controls.new = new("ButtonControl", {"RIGHT",self.controls.deleteAll,"LEFT"}, -4, 0, 60, 18, "New", function() + self.controls.new = new("ButtonControl", {"RIGHT",self.controls.deleteAll,"LEFT"}, {-4, 0, 60, 18}, "New", function() local newGroup = { label = "", enabled = true, diff --git a/src/Classes/SkillSetListControl.lua b/src/Classes/SkillSetListControl.lua index c0752f2e83..d93e175ae9 100644 --- a/src/Classes/SkillSetListControl.lua +++ b/src/Classes/SkillSetListControl.lua @@ -8,10 +8,10 @@ local t_remove = table.remove local m_max = math.max local s_format = string.format -local SkillSetListClass = newClass("SkillSetListControl", "ListControl", function(self, anchor, x, y, width, height, skillsTab) - self.ListControl(anchor, x, y, width, height, 16, "VERTICAL", true, skillsTab.skillSetOrderList) +local SkillSetListClass = newClass("SkillSetListControl", "ListControl", function(self, anchor, rect, skillsTab) + self.ListControl(anchor, rect, 16, "VERTICAL", true, skillsTab.skillSetOrderList) self.skillsTab = skillsTab - 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 skillSet = skillsTab.skillSets[self.selValue] local newSkillSet = copyTable(skillSet, true) newSkillSet.socketGroupList = { } @@ -33,30 +33,30 @@ local SkillSetListClass = newClass("SkillSetListControl", "ListControl", functio 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(skillsTab.skillSets[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(skillsTab:NewSkillSet(), true) end) end) function SkillSetListClass:RenameSet(skillSet, addOnName) local controls = { } - controls.label = new("LabelControl", nil, 0, 20, 0, 16, "^7Enter name for this skill set:") - controls.edit = new("EditControl", nil, 0, 40, 350, 20, skillSet.title, nil, nil, 100, function(buf) + controls.label = new("LabelControl", nil, {0, 20, 0, 16}, "^7Enter name for this skill set:") + controls.edit = new("EditControl", nil, {0, 40, 350, 20}, skillSet.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() skillSet.title = controls.edit.buf self.skillsTab.modFlag = true if addOnName then @@ -69,7 +69,7 @@ function SkillSetListClass:RenameSet(skillSet, 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.skillsTab.skillSets[skillSet.id] = nil end diff --git a/src/Classes/SkillsTab.lua b/src/Classes/SkillsTab.lua index 62909a4e3f..d1fd6a38e0 100644 --- a/src/Classes/SkillsTab.lua +++ b/src/Classes/SkillsTab.lua @@ -93,7 +93,7 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont self.defaultGemQuality = main.defaultGemQuality -- Set selector - self.controls.setSelect = new("DropDownControl", { "TOPLEFT", self, "TOPLEFT" }, 76, 8, 210, 20, nil, function(index, value) + self.controls.setSelect = new("DropDownControl", { "TOPLEFT", self, "TOPLEFT" }, { 76, 8, 210, 20 }, nil, function(index, value) self:SetActiveSkillSet(self.skillSetOrderList[index]) self:AddUndoState() end) @@ -101,14 +101,14 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont self.controls.setSelect.enabled = function() return #self.skillSetOrderList > 1 end - self.controls.setLabel = new("LabelControl", { "RIGHT", self.controls.setSelect, "LEFT" }, -2, 0, 0, 16, "^7Skill 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 }, "^7Skill set:") + self.controls.setManage = new("ButtonControl", { "LEFT", self.controls.setSelect, "RIGHT" }, { 4, 0, 90, 20 }, "Manage...", function() self:OpenSkillSetManagePopup() end) -- Socket group list - self.controls.groupList = new("SkillListControl", { "TOPLEFT", self, "TOPLEFT" }, 20, 54, 360, 300, self) - self.controls.groupTip = new("LabelControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, 0, 8, 0, 14, + self.controls.groupList = new("SkillListControl", { "TOPLEFT", self, "TOPLEFT" }, { 20, 54, 360, 300 }, self) + self.controls.groupTip = new("LabelControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, { 0, 8, 0, 14 }, [[ ^7Usage Tips: - You can copy/paste socket groups using Ctrl+C and Ctrl+V. @@ -121,14 +121,14 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont -- Gem options local optionInputsX = 170 local optionInputsY = 45 - self.controls.optionSection = new("SectionControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, 0, optionInputsY + 50, 360, 156, "Gem Options") - self.controls.sortGemsByDPS = new("CheckBoxControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, optionInputsX, optionInputsY + 70, 20, "Sort gems by DPS:", function(state) + self.controls.optionSection = new("SectionControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, { 0, optionInputsY + 50, 360, 156 }, "Gem Options") + self.controls.sortGemsByDPS = new("CheckBoxControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, { optionInputsX, optionInputsY + 70, 20 }, "Sort gems by DPS:", function(state) self.sortGemsByDPS = state end, nil, true) - self.controls.sortGemsByDPSFieldControl = new("DropDownControl", { "LEFT", self.controls.sortGemsByDPS, "RIGHT" }, 10, 0, 140, 20, sortGemTypeList, function(index, value) + self.controls.sortGemsByDPSFieldControl = new("DropDownControl", { "LEFT", self.controls.sortGemsByDPS, "RIGHT" }, { 10, 0, 140, 20 }, sortGemTypeList, function(index, value) self.sortGemsByDPSField = value.type end) - self.controls.defaultLevel = new("DropDownControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, optionInputsX, optionInputsY + 94, 170, 20, defaultGemLevelList, function(index, value) + self.controls.defaultLevel = new("DropDownControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, { optionInputsX, optionInputsY + 94, 170, 20 }, defaultGemLevelList, function(index, value) self.defaultGemLevel = value.gemLevel end) self.controls.defaultLevel.tooltipFunc = function(tooltip, mode, index, value) @@ -137,36 +137,36 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont tooltip:AddLine(16, "^7" .. value.description) end end - self.controls.defaultLevelLabel = new("LabelControl", { "RIGHT", self.controls.defaultLevel, "LEFT" }, -4, 0, 0, 16, "^7Default gem level:") - self.controls.defaultQuality = new("EditControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, optionInputsX, optionInputsY + 118, 60, 20, nil, nil, "%D", 2, function(buf) + self.controls.defaultLevelLabel = new("LabelControl", { "RIGHT", self.controls.defaultLevel, "LEFT" }, { -4, 0, 0, 16 }, "^7Default gem level:") + self.controls.defaultQuality = new("EditControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, { optionInputsX, optionInputsY + 118, 60, 20 }, nil, nil, "%D", 2, function(buf) self.defaultGemQuality = m_min(tonumber(buf) or 0, 23) end) - self.controls.defaultQualityLabel = new("LabelControl", { "RIGHT", self.controls.defaultQuality, "LEFT" }, -4, 0, 0, 16, "^7Default gem quality:") - self.controls.showSupportGemTypes = new("DropDownControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, optionInputsX, optionInputsY + 142, 170, 20, showSupportGemTypeList, function(index, value) + self.controls.defaultQualityLabel = new("LabelControl", { "RIGHT", self.controls.defaultQuality, "LEFT" }, { -4, 0, 0, 16 }, "^7Default gem quality:") + self.controls.showSupportGemTypes = new("DropDownControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, { optionInputsX, optionInputsY + 142, 170, 20 }, showSupportGemTypeList, function(index, value) self.showSupportGemTypes = value.show end) - self.controls.showSupportGemTypesLabel = new("LabelControl", { "RIGHT", self.controls.showSupportGemTypes, "LEFT" }, -4, 0, 0, 16, "^7Show support gems:") - self.controls.showAltQualityGems = new("CheckBoxControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, optionInputsX, optionInputsY + 166, 20, "^7Show quality variants:", function(state) + self.controls.showSupportGemTypesLabel = new("LabelControl", { "RIGHT", self.controls.showSupportGemTypes, "LEFT" }, { -4, 0, 0, 16 }, "^7Show support gems:") + self.controls.showAltQualityGems = new("CheckBoxControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, { optionInputsX, optionInputsY + 166, 20 }, "^7Show quality variants:", function(state) self.showAltQualityGems = state end) -- Socket group details if main.portraitMode then - self.anchorGroupDetail = new("Control", { "TOPLEFT", self.controls.optionSection, "BOTTOMLEFT" }, 0, 20, 0, 0) + self.anchorGroupDetail = new("Control", { "TOPLEFT", self.controls.optionSection, "BOTTOMLEFT" }, { 0, 20, 0, 0 }) else - self.anchorGroupDetail = new("Control", { "TOPLEFT", self.controls.groupList, "TOPRIGHT" }, 20, 0, 0, 0) + self.anchorGroupDetail = new("Control", { "TOPLEFT", self.controls.groupList, "TOPRIGHT" }, { 20, 0, 0, 0 }) end self.anchorGroupDetail.shown = function() return self.displayGroup ~= nil end - self.controls.groupLabel = new("EditControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, 0, 0, 380, 20, nil, "Label", "%c", 50, function(buf) + self.controls.groupLabel = new("EditControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, { 0, 0, 380, 20 }, nil, "Label", "%c", 50, function(buf) self.displayGroup.label = buf self:ProcessSocketGroup(self.displayGroup) self:AddUndoState() self.build.buildFlag = true end) - self.controls.groupSlotLabel = new("LabelControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, 0, 30, 0, 16, "^7Socketed in:") - self.controls.groupSlot = new("DropDownControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, 85, 28, 130, 20, groupSlotDropList, function(index, value) + self.controls.groupSlotLabel = new("LabelControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, { 0, 30, 0, 16 }, "^7Socketed in:") + self.controls.groupSlot = new("DropDownControl", { "TOPLEFT", self.anchorGroupDetail, "TOPLEFT" }, { 85, 28, 130, 20 }, groupSlotDropList, function(index, value) self.displayGroup.slot = value.slotName self:AddUndoState() self.build.buildFlag = true @@ -189,21 +189,21 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont self.controls.groupSlot.enabled = function() return self.displayGroup.source == nil end - self.controls.groupEnabled = new("CheckBoxControl", { "LEFT", self.controls.groupSlot, "RIGHT" }, 70, 0, 20, "Enabled:", function(state) + self.controls.groupEnabled = new("CheckBoxControl", { "LEFT", self.controls.groupSlot, "RIGHT" }, { 70, 0, 20 }, "Enabled:", function(state) self.displayGroup.enabled = state self:AddUndoState() self.build.buildFlag = true end) - self.controls.includeInFullDPS = new("CheckBoxControl", { "LEFT", self.controls.groupEnabled, "RIGHT" }, 145, 0, 20, "Include in Full DPS:", function(state) + self.controls.includeInFullDPS = new("CheckBoxControl", { "LEFT", self.controls.groupEnabled, "RIGHT" }, { 145, 0, 20 }, "Include in Full DPS:", function(state) self.displayGroup.includeInFullDPS = state self:AddUndoState() self.build.buildFlag = true end) - self.controls.groupCountLabel = new("LabelControl", { "LEFT", self.controls.includeInFullDPS, "RIGHT" }, 16, 0, 0, 16, "Count:") + self.controls.groupCountLabel = new("LabelControl", { "LEFT", self.controls.includeInFullDPS, "RIGHT" }, { 16, 0, 0, 16 }, "Count:") self.controls.groupCountLabel.shown = function() return self.displayGroup.source ~= nil end - self.controls.groupCount = new("EditControl", { "LEFT", self.controls.groupCountLabel, "RIGHT" }, 4, 0, 60, 20, nil, nil, "%D", 2, function(buf) + self.controls.groupCount = new("EditControl", { "LEFT", self.controls.groupCountLabel, "RIGHT" }, { 4, 0, 60, 20 }, nil, nil, "%D", 2, function(buf) self.displayGroup.groupCount = tonumber(buf) or 1 self:AddUndoState() self.build.buildFlag = true @@ -211,7 +211,7 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont self.controls.groupCount.shown = function() return self.displayGroup.source ~= nil end - self.controls.sourceNote = new("LabelControl", { "TOPLEFT", self.controls.groupSlotLabel, "TOPLEFT" }, 0, 30, 0, 16) + self.controls.sourceNote = new("LabelControl", { "TOPLEFT", self.controls.groupSlotLabel, "TOPLEFT" }, { 0, 30, 0, 16 }) self.controls.sourceNote.shown = function() return self.displayGroup.source ~= nil end @@ -248,7 +248,7 @@ will automatically apply to the skill.]] end -- Scroll bar - self.controls.scrollBarH = new("ScrollBarControl", nil, 0, 0, 0, 18, 100, "HORIZONTAL", true) + self.controls.scrollBarH = new("ScrollBarControl", nil, {0, 0, 0, 18}, 100, "HORIZONTAL", true) -- Initialise skill sets self.skillSets = { } @@ -257,15 +257,15 @@ will automatically apply to the skill.]] self:SetActiveSkillSet(1) -- Skill gem slots - self.anchorGemSlots = new("Control", {"TOPLEFT",self.anchorGroupDetail,"TOPLEFT"}, 0, 28 + 28 + 16, 0, 0) + self.anchorGemSlots = new("Control", {"TOPLEFT",self.anchorGroupDetail,"TOPLEFT"}, {0, 28 + 28 + 16, 0, 0}) self.gemSlots = { } self:CreateGemSlot(1) - self.controls.gemNameHeader = new("LabelControl", { "BOTTOMLEFT", self.gemSlots[1].nameSpec, "TOPLEFT" }, 0, -2, 0, 16, "^7Gem name:") - self.controls.gemLevelHeader = new("LabelControl", { "BOTTOMLEFT", self.gemSlots[1].level, "TOPLEFT" }, 0, -2, 0, 16, "^7Level:") - self.controls.gemQualityIdHeader = new("LabelControl", { "BOTTOMLEFT", self.gemSlots[1].qualityId, "TOPLEFT" }, 0, -2, 0, 16, "^7Variant:") - self.controls.gemQualityHeader = new("LabelControl", { "BOTTOMLEFT", self.gemSlots[1].quality, "TOPLEFT" }, 0, -2, 0, 16, "^7Quality:") - self.controls.gemEnableHeader = new("LabelControl", { "BOTTOMLEFT", self.gemSlots[1].enabled, "TOPLEFT" }, -16, -2, 0, 16, "^7Enabled:") - self.controls.gemCountHeader = new("LabelControl", { "BOTTOMLEFT", self.gemSlots[1].count, "TOPLEFT" }, 8, -2, 0, 16, "^7Count:") + self.controls.gemNameHeader = new("LabelControl", {"BOTTOMLEFT", self.gemSlots[1].nameSpec, "TOPLEFT"}, {0, -2, 0, 16}, "^7Gem name:") + self.controls.gemLevelHeader = new("LabelControl", {"BOTTOMLEFT", self.gemSlots[1].level, "TOPLEFT"}, {0, -2, 0, 16}, "^7Level:") + self.controls.gemQualityIdHeader = new("LabelControl", {"BOTTOMLEFT", self.gemSlots[1].qualityId, "TOPLEFT"}, {0, -2, 0, 16}, "^7Variant:") + self.controls.gemQualityHeader = new("LabelControl", {"BOTTOMLEFT", self.gemSlots[1].quality, "TOPLEFT"}, {0, -2, 0, 16}, "^7Quality:") + self.controls.gemEnableHeader = new("LabelControl", {"BOTTOMLEFT", self.gemSlots[1].enabled, "TOPLEFT"}, {-16, -2, 0, 16}, "^7Enabled:") + self.controls.gemCountHeader = new("LabelControl", {"BOTTOMLEFT", self.gemSlots[1].count, "TOPLEFT"}, {8, -2, 0, 16}, "^7Count:") end) -- parse real gem name and quality by omitting the first word if alt qual is set @@ -599,7 +599,7 @@ function SkillsTabClass:CreateGemSlot(index) self.gemSlots[index] = slot -- Delete gem - slot.delete = new("ButtonControl", nil, 0, 0, 20, 20, "x", function() + slot.delete = new("ButtonControl", nil, {0, 0, 20, 20}, "x", function() t_remove(self.displayGroup.gemList, index) for index2 = index, #self.displayGroup.gemList do -- Update the other gem slot controls @@ -635,7 +635,7 @@ function SkillsTabClass:CreateGemSlot(index) self.controls["gemSlot"..index.."Delete"] = slot.delete -- Gem name specification - slot.nameSpec = new("GemSelectControl", { "LEFT", slot.delete, "RIGHT" }, 2, 0, 300, 20, self, index, function(gemId, qualityId, addUndo) + slot.nameSpec = new("GemSelectControl", { "LEFT", slot.delete, "RIGHT" }, { 2, 0, 300, 20 }, self, index, function(gemId, qualityId, addUndo) if not self.displayGroup then return end @@ -690,7 +690,7 @@ function SkillsTabClass:CreateGemSlot(index) self.controls["gemSlot"..index.."Name"] = slot.nameSpec -- Gem level - slot.level = new("EditControl", { "LEFT", slot.nameSpec, "RIGHT" }, 2, 0, 60, 20, nil, nil, "%D", 2, function(buf) + slot.level = new("EditControl", { "LEFT", slot.nameSpec, "RIGHT" }, { 2, 0, 60, 20 }, nil, nil, "%D", 2, function(buf) local gemInstance = self.displayGroup.gemList[index] if not gemInstance then gemInstance = { nameSpec = "", level = self.defaultGemLevel or 20, quality = self.defaultGemQuality or 0, qualityId = "Default", enabled = true, enableGlobal1 = true, enableGlobal2 = true, count = 1, new = true } @@ -714,7 +714,7 @@ function SkillsTabClass:CreateGemSlot(index) self.controls["gemSlot"..index.."Level"] = slot.level -- Gem quality id - slot.qualityId = new("DropDownControl", {"LEFT",slot.level,"RIGHT"}, 2, 0, 90, 20, alternateGemQualityList, function(dropDownIndex, value) + slot.qualityId = new("DropDownControl", {"LEFT",slot.level,"RIGHT"}, {2, 0, 90, 20}, alternateGemQualityList, function(dropDownIndex, value) local gemInstance = self.displayGroup.gemList[index] if not gemInstance then gemInstance = { nameSpec = "", level = self.defaultGemLevel or 20, quality = self.defaultGemQuality or 0, qualityId = "Default", enabled = true, enableGlobal1 = true, enableGlobal2 = true, count = 1, new = true } @@ -805,7 +805,7 @@ function SkillsTabClass:CreateGemSlot(index) self.controls["gemSlot"..index.."QualityId"] = slot.qualityId -- Gem quality - slot.quality = new("EditControl", {"LEFT",slot.qualityId,"RIGHT"}, 2, 0, 60, 20, nil, nil, "%D", 2, function(buf) + slot.quality = new("EditControl", {"LEFT",slot.qualityId,"RIGHT"}, {2, 0, 60, 20}, nil, nil, "%D", 2, function(buf) local gemInstance = self.displayGroup.gemList[index] if not gemInstance then gemInstance = { nameSpec = "", level = self.defaultGemLevel or 20, quality = self.defaultGemQuality or 0, qualityId = "Default", enabled = true, enableGlobal1 = true, enableGlobal2 = true, count = 1, new = true } @@ -844,7 +844,7 @@ function SkillsTabClass:CreateGemSlot(index) self.controls["gemSlot"..index.."Quality"] = slot.quality -- Enable gem - slot.enabled = new("CheckBoxControl", {"LEFT",slot.quality,"RIGHT"}, 18, 0, 20, nil, function(state) + slot.enabled = new("CheckBoxControl", {"LEFT",slot.quality,"RIGHT"}, {18, 0, 20}, nil, function(state) local gemInstance = self.displayGroup.gemList[index] if not gemInstance then gemInstance = { nameSpec = "", level = self.defaultGemLevel or 20, quality = self.defaultGemQuality or 0, qualityId = "Default", enabled = true, enableGlobal1 = true, enableGlobal2 = true, count = 1, new = true } @@ -888,7 +888,7 @@ function SkillsTabClass:CreateGemSlot(index) self.controls["gemSlot"..index.."Enable"] = slot.enabled -- Count gem - slot.count = new("EditControl", {"LEFT",slot.enabled,"RIGHT"}, 18, 0, 60, 20, nil, nil, "%D", 2, function(buf) + slot.count = new("EditControl", {"LEFT",slot.enabled,"RIGHT"}, {18, 0, 60, 20}, nil, nil, "%D", 2, function(buf) local gemInstance = self.displayGroup.gemList[index] if not gemInstance then gemInstance = { nameSpec = "", level = self.defaultGemLevel or 20, quality = self.defaultGemQuality or 0, qualityId = "Default", enabled = true, enableGlobal1 = true, count = 1, new = true } @@ -931,14 +931,14 @@ function SkillsTabClass:CreateGemSlot(index) self.controls["gemSlot"..index.."Count"] = slot.count -- Parser/calculator error message - slot.errMsg = new("LabelControl", {"LEFT",slot.count,"RIGHT"}, 2, 2, 0, 16, function() + slot.errMsg = new("LabelControl", {"LEFT",slot.count,"RIGHT"}, {2, 2, 0, 16}, function() local gemInstance = self.displayGroup and self.displayGroup.gemList[index] return "^1"..(gemInstance and gemInstance.errMsg or "") end) self.controls["gemSlot"..index.."ErrMsg"] = slot.errMsg -- Enable global-effect skill 1 - slot.enableGlobal1 = new("CheckBoxControl", {"TOPLEFT",slot.delete,"BOTTOMLEFT"}, 0, 2, 20, "", function(state) + slot.enableGlobal1 = new("CheckBoxControl", {"TOPLEFT",slot.delete,"BOTTOMLEFT"}, {0, 2, 20}, "", function(state) local gemInstance = self.displayGroup.gemList[index] gemInstance.enableGlobal1 = state self:AddUndoState() @@ -957,7 +957,7 @@ function SkillsTabClass:CreateGemSlot(index) self.controls["gemSlot"..index.."EnableGlobal1"] = slot.enableGlobal1 -- Enable global-effect skill 2 - slot.enableGlobal2 = new("CheckBoxControl", {"LEFT",slot.enableGlobal1,"RIGHT",true}, 0, 0, 20, "", function(state) + slot.enableGlobal2 = new("CheckBoxControl", {"LEFT",slot.enableGlobal1,"RIGHT",true}, {0, 0, 20}, "", function(state) local gemInstance = self.displayGroup.gemList[index] gemInstance.enableGlobal2 = state self:AddUndoState() @@ -1304,8 +1304,8 @@ end -- Opens the skill set manager function SkillsTabClass:OpenSkillSetManagePopup() main:OpenPopup(370, 290, "Manage Skill Sets", { - new("SkillSetListControl", nil, 0, 50, 350, 200, self), - new("ButtonControl", nil, 0, 260, 90, 20, "Done", function() + new("SkillSetListControl", nil, {0, 50, 350, 200}, self), + new("ButtonControl", nil, {0, 260, 90, 20}, "Done", function() main:ClosePopup() end), }) diff --git a/src/Classes/SliderControl.lua b/src/Classes/SliderControl.lua index f8c86a0217..2c3048de48 100644 --- a/src/Classes/SliderControl.lua +++ b/src/Classes/SliderControl.lua @@ -7,10 +7,10 @@ local m_min = math.min local m_max = math.max local m_ceil = math.ceil -local SliderClass = newClass("SliderControl", "Control", "TooltipHost", function(self, anchor, x, y, width, height, changeFunc, scrollWheelSpeedTbl) - self.Control(anchor, x, y, width, height) +local SliderClass = newClass("SliderControl", "Control", "TooltipHost", function(self, anchor, rect, changeFunc, scrollWheelSpeedTbl) + self.Control(anchor, rect) self.TooltipHost() - self.knobSize = height - 2 + self.knobSize = self.height - 2 self.val = 0 self.changeFunc = changeFunc self.scrollWheelSpeedTbl = scrollWheelSpeedTbl or { ["SHIFT"] = 0.25, ["CTRL"] = 0.01, ["DEFAULT"] = 0.05 } diff --git a/src/Classes/TextListControl.lua b/src/Classes/TextListControl.lua index 5f996dd50b..7302a153b9 100644 --- a/src/Classes/TextListControl.lua +++ b/src/Classes/TextListControl.lua @@ -3,10 +3,10 @@ -- Class: Text List -- Simple list control for displaying a block of text -- -local TextListClass = newClass("TextListControl", "Control", "ControlHost", function(self, anchor, x, y, width, height, columns, list, sectionHeights) - self.Control(anchor, x, y, width, height) +local TextListClass = newClass("TextListControl", "Control", "ControlHost", function(self, anchor, rect, columns, list, sectionHeights) + self.Control(anchor, rect) self.ControlHost() - self.controls.scrollBar = new("ScrollBarControl", {"RIGHT",self,"RIGHT"}, -1, 0, 18, 0, 40) + self.controls.scrollBar = new("ScrollBarControl", {"RIGHT",self,"RIGHT"}, {-1, 0, 18, 0}, 40) self.controls.scrollBar.height = function() local width, height = self:GetSize() return height - 2 diff --git a/src/Classes/TimelessJewelListControl.lua b/src/Classes/TimelessJewelListControl.lua index 54259ac81a..5a55490875 100644 --- a/src/Classes/TimelessJewelListControl.lua +++ b/src/Classes/TimelessJewelListControl.lua @@ -9,11 +9,11 @@ local m_min = math.min local m_max = math.max local t_concat = table.concat -local TimelessJewelListControlClass = newClass("TimelessJewelListControl", "ListControl", function(self, anchor, x, y, width, height, build) +local TimelessJewelListControlClass = newClass("TimelessJewelListControl", "ListControl", function(self, anchor, rect, build) self.build = build self.sharedList = self.build.timelessData.sharedResults or { } self.list = self.build.timelessData.searchResults or { } - self.ListControl(anchor, x, y, width, height, 16, true, false, self.list) + self.ListControl(anchor, rect, 16, true, false, self.list) self.selIndex = nil end) diff --git a/src/Classes/TimelessJewelSocketControl.lua b/src/Classes/TimelessJewelSocketControl.lua index fc0efaab5d..7ff6bcf0cf 100644 --- a/src/Classes/TimelessJewelSocketControl.lua +++ b/src/Classes/TimelessJewelSocketControl.lua @@ -6,8 +6,8 @@ local m_min = math.min -local TimelessJewelSocketClass = newClass("TimelessJewelSocketControl", "DropDownControl", function(self, anchor, x, y, width, height, list, selFunc, build, socketViewer) - self.DropDownControl(anchor, x, y, width, height, list, selFunc) +local TimelessJewelSocketClass = newClass("TimelessJewelSocketControl", "DropDownControl", function(self, anchor, rect, list, selFunc, build, socketViewer) + self.DropDownControl(anchor, rect, list, selFunc) self.build = build self.socketViewer = socketViewer end) diff --git a/src/Classes/TradeQuery.lua b/src/Classes/TradeQuery.lua index e76d1fdd12..783189ee44 100644 --- a/src/Classes/TradeQuery.lua +++ b/src/Classes/TradeQuery.lua @@ -236,7 +236,7 @@ function TradeQueryClass:PriceItem() local itemSet = self.itemsTab.itemSets[itemSetId] t_insert(newItemList, itemSet.title or "Default") end - self.controls.setSelect = new("DropDownControl", {"TOPLEFT", nil, "TOPLEFT"}, pane_margins_horizontal, pane_margins_vertical, 188, row_height, newItemList, function(index, value) + self.controls.setSelect = new("DropDownControl", {"TOPLEFT", nil, "TOPLEFT"}, {pane_margins_horizontal, pane_margins_vertical, 188, row_height}, newItemList, function(index, value) self.itemsTab:SetActiveItemSet(self.itemsTab.itemSetOrderList[index]) self.itemsTab:AddUndoState() end) @@ -245,20 +245,20 @@ function TradeQueryClass:PriceItem() return #self.itemsTab.itemSetOrderList > 1 end - self.controls.poesessidButton = new("ButtonControl", {"TOPLEFT", self.controls.setSelect, "TOPLEFT"}, 0, row_height + row_vertical_padding, 188, row_height, function() return main.POESESSID ~= "" and "^2Session Mode" or colorCodes.WARNING.."No Session Mode" end, function() + self.controls.poesessidButton = new("ButtonControl", {"TOPLEFT", self.controls.setSelect, "TOPLEFT"}, {0, row_height + row_vertical_padding, 188, row_height}, function() return main.POESESSID ~= "" and "^2Session Mode" or colorCodes.WARNING.."No Session Mode" end, function() local poesessid_controls = {} - poesessid_controls.sessionInput = new("EditControl", nil, 0, 18, 350, 18, main.POESESSID, nil, "%X", 32) + poesessid_controls.sessionInput = new("EditControl", nil, {0, 18, 350, 18}, main.POESESSID, nil, "%X", 32) poesessid_controls.sessionInput:SetProtected(true) poesessid_controls.sessionInput.placeholder = "Enter your session ID here" poesessid_controls.sessionInput.tooltipText = "You can get this from your web browser's cookies while logged into the Path of Exile website." - poesessid_controls.save = new("ButtonControl", {"TOPRIGHT", poesessid_controls.sessionInput, "TOP"}, -8, 24, 90, row_height, "Save", function() + poesessid_controls.save = new("ButtonControl", {"TOPRIGHT", poesessid_controls.sessionInput, "TOP"}, {-8, 24, 90, row_height}, "Save", function() main.POESESSID = poesessid_controls.sessionInput.buf main:ClosePopup() main:SaveSettings() self:UpdateRealms() end) poesessid_controls.save.enabled = function() return #poesessid_controls.sessionInput.buf == 32 or poesessid_controls.sessionInput.buf == "" end - poesessid_controls.cancel = new("ButtonControl", {"TOPLEFT", poesessid_controls.sessionInput, "TOP"}, 8, 24, 90, row_height, "Cancel", function() + poesessid_controls.cancel = new("ButtonControl", {"TOPLEFT", poesessid_controls.sessionInput, "TOP"}, {8, 24, 90, row_height}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(364, 72, "Change session ID", poesessid_controls) @@ -281,7 +281,7 @@ on trade site to work on other leagues and realms)]] -- Fetches Box self.maxFetchPerSearchDefault = 2 - self.controls.fetchCountEdit = new("EditControl", {"TOPRIGHT", nil, "TOPRIGHT"}, -12, 19, 154, row_height, "", "Fetch Pages", "%D", 3, function(buf) + self.controls.fetchCountEdit = new("EditControl", {"TOPRIGHT", nil, "TOPRIGHT"}, {-12, 19, 154, row_height}, "", "Fetch Pages", "%D", 3, function(buf) self.maxFetchPages = m_min(m_max(tonumber(buf) or self.maxFetchPerSearchDefault, 1), 10) self.tradeQueryRequests.maxFetchPerSearch = 10 * self.maxFetchPages self.controls.fetchCountEdit.focusValue = self.maxFetchPages @@ -305,7 +305,7 @@ on trade site to work on other leagues and realms)]] self.statSortSelectionList = { } initStatSortSelectionList(self.statSortSelectionList) end - self.controls.StatWeightMultipliersButton = new("ButtonControl", {"TOPRIGHT", self.controls.fetchCountEdit, "BOTTOMRIGHT"}, 0, row_vertical_padding, 150, row_height, "^7Adjust search weights", function() + self.controls.StatWeightMultipliersButton = new("ButtonControl", {"TOPRIGHT", self.controls.fetchCountEdit, "BOTTOMRIGHT"}, {0, row_vertical_padding, 150, row_height}, "^7Adjust search weights", function() self.itemsTab.modFlag = true self:SetStatWeights() end) @@ -330,7 +330,7 @@ on trade site to work on other leagues and realms)]] self.sortModes.Price, self.sortModes.Weight, } - self.controls.itemSortSelection = new("DropDownControl", {"TOPRIGHT", self.controls.StatWeightMultipliersButton, "TOPLEFT"}, -8, 0, 170, row_height, self.itemSortSelectionList, function(index, value) + self.controls.itemSortSelection = new("DropDownControl", {"TOPRIGHT", self.controls.StatWeightMultipliersButton, "TOPLEFT"}, {-8, 0, 170, row_height}, self.itemSortSelectionList, function(index, value) self.pbItemSortSelectionIndex = index for row_idx, _ in pairs(self.resultTbl) do self:UpdateControlsWithItems(row_idx) @@ -344,10 +344,10 @@ Highest Stat Value / Price - Sorts from highest to lowest Stat Value per currenc Lowest Price - Sorts from lowest to highest price of retrieved items Highest Weight - Displays the order retrieved from trade]] self.controls.itemSortSelection:SetSel(self.pbItemSortSelectionIndex) - self.controls.itemSortSelectionLabel = new("LabelControl", {"TOPRIGHT", self.controls.itemSortSelection, "TOPLEFT"}, -4, 0, 60, 16 , "^7Sort By:") + self.controls.itemSortSelectionLabel = new("LabelControl", {"TOPRIGHT", self.controls.itemSortSelection, "TOPLEFT"}, {-4, 0, 60, 16}, "^7Sort By:") -- Use Enchant in DPS sorting - self.controls.enchantInSort = new("CheckBoxControl", {"TOPRIGHT",self.controls.fetchCountEdit,"TOPLEFT"}, -8, 0, row_height, "Include Enchants:", function(state) + self.controls.enchantInSort = new("CheckBoxControl", {"TOPRIGHT",self.controls.fetchCountEdit,"TOPLEFT"}, {-8, 0, row_height}, "Include Enchants:", function(state) self.enchantInSort = state for row_idx, _ in pairs(self.resultTbl) do self:UpdateControlsWithItems(row_idx) @@ -356,8 +356,8 @@ Highest Weight - Displays the order retrieved from trade]] self.controls.enchantInSort.tooltipText = "This includes enchants in sorting that occurs after trade results have been retrieved" -- Realm selection - self.controls.realmLabel = new("LabelControl", {"LEFT", self.controls.setSelect, "RIGHT"}, 18, 0, 20, row_height - 4, "^7Realm:") - self.controls.realm = new("DropDownControl", {"LEFT", self.controls.realmLabel, "RIGHT"}, 6, 0, 150, row_height, self.realmDropList, function(index, value) + self.controls.realmLabel = new("LabelControl", {"LEFT", self.controls.setSelect, "RIGHT"}, {18, 0, 20, row_height - 4}, "^7Realm:") + self.controls.realm = new("DropDownControl", {"LEFT", self.controls.realmLabel, "RIGHT"}, {6, 0, 150, row_height}, self.realmDropList, function(index, value) self.pbRealmIndex = index self.pbRealm = self.realmIds[value] local function setLeagueDropList() @@ -397,8 +397,8 @@ Highest Weight - Displays the order retrieved from trade]] end -- League selection - self.controls.leagueLabel = new("LabelControl", {"TOPRIGHT", self.controls.realmLabel, "TOPRIGHT"}, 0, row_height + row_vertical_padding, 20, row_height - 4, "^7League:") - self.controls.league = new("DropDownControl", {"LEFT", self.controls.leagueLabel, "RIGHT"}, 6, 0, 150, row_height, self.itemsTab.leagueDropList, function(index, value) + self.controls.leagueLabel = new("LabelControl", {"TOPRIGHT", self.controls.realmLabel, "TOPRIGHT"}, {0, row_height + row_vertical_padding, 20, row_height - 4}, "^7League:") + self.controls.league = new("DropDownControl", {"LEFT", self.controls.leagueLabel, "RIGHT"}, {6, 0, 150, row_height}, self.itemsTab.leagueDropList, function(index, value) self.pbLeagueIndex = index self.pbLeague = value self:SetCurrencyConversionButton() @@ -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, 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() @@ -502,9 +502,9 @@ Highest Weight - Displays the order retrieved from trade]] end end end - self.controls.fullPrice = new("LabelControl", {"BOTTOM", nil, "BOTTOM"}, 0, -row_height - pane_margins_vertical - row_vertical_padding, pane_width - 2 * pane_margins_horizontal, row_height, "") + self.controls.fullPrice = new("LabelControl", {"BOTTOM", nil, "BOTTOM"}, {0, -row_height - pane_margins_vertical - row_vertical_padding, pane_width - 2 * pane_margins_horizontal, row_height}, "") GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0 - self.controls.close = new("ButtonControl", {"BOTTOM", nil, "BOTTOM"}, 0, -pane_margins_vertical, 90, row_height, "Done", function() + self.controls.close = new("ButtonControl", {"BOTTOM", nil, "BOTTOM"}, {0, -pane_margins_vertical, 90, row_height}, "Done", function() GlobalCache.useFullDPS = self.storedGlobalCacheDPSView main:ClosePopup() -- there's a case where if you have a socket(s) allocated, open TradeQuery, close it, dealloc, then open TradeQuery again @@ -512,10 +512,10 @@ Highest Weight - Displays the order retrieved from trade]] wipeItemControls() end) - self.controls.updateCurrencyConversion = new("ButtonControl", {"BOTTOMLEFT", nil, "BOTTOMLEFT"}, pane_margins_horizontal, -pane_margins_vertical, 240, row_height, "Get Currency Conversion Rates", function() + self.controls.updateCurrencyConversion = new("ButtonControl", {"BOTTOMLEFT", nil, "BOTTOMLEFT"}, {pane_margins_horizontal, -pane_margins_vertical, 240, row_height}, "Get Currency Conversion Rates", function() self:PullPoENinjaCurrencyConversion(self.pbLeague) end) - self.controls.pbNotice = new("LabelControl", {"BOTTOMRIGHT", nil, "BOTTOMRIGHT"}, -row_height - pane_margins_vertical - row_vertical_padding, -pane_margins_vertical, 300, row_height, "") + self.controls.pbNotice = new("LabelControl", {"BOTTOMRIGHT", nil, "BOTTOMRIGHT"}, {-row_height - pane_margins_vertical - row_vertical_padding, -pane_margins_vertical, 300, row_height}, "") -- used in PopupDialog:Draw() local function scrollBarFunc() @@ -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 @@ -549,8 +549,8 @@ function TradeQueryClass:SetStatWeights(previousSelectionList) end end - controls.SliderLabel = new("LabelControl", { "TOPLEFT", nil, "TOPRIGHT" }, -410, 20, 0, 16, "^7"..statList[1].stat.label..":") - controls.Slider = new("SliderControl", { "TOPLEFT", controls.SliderLabel, "TOPRIGHT" }, 20, 0, 150, 16, function(value) + controls.SliderLabel = new("LabelControl", { "TOPLEFT", nil, "TOPRIGHT" }, {-410, 20, 0, 16}, "^7"..statList[1].stat.label..":") + controls.Slider = new("SliderControl", { "TOPLEFT", controls.SliderLabel, "TOPRIGHT" }, {20, 0, 150, 16}, function(value) if value == 0 then controls.SliderValue.label = "^7Disabled" statList[sliderController.index].stat.weightMult = 0 @@ -561,7 +561,7 @@ function TradeQueryClass:SetStatWeights(previousSelectionList) statList[sliderController.index].label = s_format("%.2f : ", 0.01 + value * 0.99)..statList[sliderController.index].stat.label end end) - controls.SliderValue = new("LabelControl", { "TOPLEFT", controls.Slider, "TOPRIGHT" }, 20, 0, 0, 16, "^7Disabled") + controls.SliderValue = new("LabelControl", { "TOPLEFT", controls.Slider, "TOPRIGHT" }, {20, 0, 0, 16}, "^7Disabled") controls.Slider.tooltip.realDraw = controls.Slider.tooltip.Draw controls.Slider.tooltip.Draw = function(self, x, y, width, height, viewPort) local sliderOffsetX = round(184 * (1 - controls.Slider.val)) @@ -587,7 +587,7 @@ function TradeQueryClass:SetStatWeights(previousSelectionList) end end - controls.finalise = new("ButtonControl", { "BOTTOM", nil, "BOTTOM" }, -90, -10, 80, 20, "Save", function() + controls.finalise = new("ButtonControl", { "BOTTOM", nil, "BOTTOM" }, {-90, -10, 80, 20}, "Save", function() main:ClosePopup() -- used in ItemsTab to save to xml under TradeSearchWeights node @@ -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,8 +884,8 @@ 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["bestButton"..row_idx] = new("ButtonControl", { "LEFT", controls["name"..row_idx], "LEFT"}, 100 + 8, 0, 80, row_height, "Find best", function() + 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 self:SetNotice(context.controls.pbNotice, colorCodes.NEGATIVE .. errMsg) @@ -925,7 +925,7 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro controls["bestButton"..row_idx].shown = function() return not self.resultTbl[row_idx] end controls["bestButton"..row_idx].tooltipText = "Creates a weighted search to find the highest Stat Value items for this slot." local pbURL - controls["uri"..row_idx] = new("EditControl", { "TOPLEFT", controls["bestButton"..row_idx], "TOPRIGHT"}, 8, 0, 514, row_height, nil, nil, "^%C\t\n", nil, function(buf) + controls["uri"..row_idx] = new("EditControl", { "TOPLEFT", controls["bestButton"..row_idx], "TOPRIGHT"}, {8, 0, 514, row_height}, nil, nil, "^%C\t\n", nil, function(buf) local subpath = buf:match(self.hostName .. "trade/search/(.+)$") or "" local paths = {} for path in subpath:gmatch("[^/]+") do @@ -952,7 +952,7 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro tooltip:AddLine(16, "Control + click to open in web-browser") end end - controls["priceButton"..row_idx] = new("ButtonControl", { "TOPLEFT", controls["uri"..row_idx], "TOPRIGHT"}, 8, 0, 100, row_height, "Price Item", + controls["priceButton"..row_idx] = new("ButtonControl", { "TOPLEFT", controls["uri"..row_idx], "TOPRIGHT"}, {8, 0, 100, row_height}, "Price Item", function() controls["priceButton"..row_idx].label = "Searching..." self.tradeQueryRequests:SearchWithURL(controls["uri"..row_idx].buf, function(items, errMsg) @@ -983,7 +983,7 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro local clampItemIndex = function(index) return m_min(m_max(index or 1, 1), self.sortedResultTbl[row_idx] and #self.sortedResultTbl[row_idx] or 1) end - controls["changeButton"..row_idx] = new("ButtonControl", { "LEFT", controls["name"..row_idx], "LEFT"}, 100 + 8, 0, 80, row_height, "<< Search", function() + controls["changeButton"..row_idx] = new("ButtonControl", { "LEFT", controls["name"..row_idx], "LEFT"}, {100 + 8, 0, 80, row_height}, "<< Search", function() self.itemIndexTbl[row_idx] = nil self.sortedResultTbl[row_idx] = nil self.resultTbl[row_idx] = nil @@ -996,7 +996,7 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro local item = new("Item", self.resultTbl[row_idx][sortedResult.index].item_string) table.insert(dropdownLabels, colorCodes[item.rarity]..item.name) end - controls["resultDropdown"..row_idx] = new("DropDownControl", { "TOPLEFT", controls["changeButton"..row_idx], "TOPRIGHT"}, 8, 0, 325, row_height, dropdownLabels, function(index) + controls["resultDropdown"..row_idx] = new("DropDownControl", { "TOPLEFT", controls["changeButton"..row_idx], "TOPRIGHT"}, {8, 0, 325, row_height}, dropdownLabels, function(index) self.itemIndexTbl[row_idx] = self.sortedResultTbl[row_idx][index].index self:SetFetchResultReturn(row_idx, self.itemIndexTbl[row_idx]) end) @@ -1024,7 +1024,7 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro tooltip:AddSeparator(10) tooltip:AddLine(16, string.format("^7Price: %s %s", result.amount, result.currency)) end - controls["importButton"..row_idx] = new("ButtonControl", { "TOPLEFT", controls["resultDropdown"..row_idx], "TOPRIGHT"}, 8, 0, 100, row_height, "Import Item", function() + controls["importButton"..row_idx] = new("ButtonControl", { "TOPLEFT", controls["resultDropdown"..row_idx], "TOPRIGHT"}, {8, 0, 100, row_height}, "Import Item", function() self.itemsTab:CreateDisplayItemFromRaw(self.resultTbl[row_idx][self.itemIndexTbl[row_idx]].item_string) local item = self.itemsTab.displayItem -- pass "true" to not auto equip it as we will have our own logic @@ -1055,7 +1055,7 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro return self.itemIndexTbl[row_idx] and self.resultTbl[row_idx][self.itemIndexTbl[row_idx]].item_string ~= nil end -- Whisper so we can copy to clipboard - controls["whisperButton"..row_idx] = new("ButtonControl", { "TOPLEFT", controls["importButton"..row_idx], "TOPRIGHT"}, 8, 0, 185, row_height, function() + controls["whisperButton"..row_idx] = new("ButtonControl", { "TOPLEFT", controls["importButton"..row_idx], "TOPRIGHT"}, {8, 0, 185, row_height}, function() return self.totalPrice[row_idx] and "Whisper for " .. self.totalPrice[row_idx].amount .. " " .. self.totalPrice[row_idx].currency or "Whisper" end, function() Copy(self.resultTbl[row_idx][self.itemIndexTbl[row_idx]].whisper) diff --git a/src/Classes/TradeQueryGenerator.lua b/src/Classes/TradeQueryGenerator.lua index 46ef2995d7..8ba4e5d6cb 100644 --- a/src/Classes/TradeQueryGenerator.lua +++ b/src/Classes/TradeQueryGenerator.lua @@ -812,7 +812,7 @@ function TradeQueryGeneratorClass:StartQuery(slot, options) -- Open progress tracking blocker popup local controls = { } - controls.progressText = new("LabelControl", {"TOP",nil,"TOP"}, 0, 30, 0, 16, string.format("Calculating Mod Weights...")) + controls.progressText = new("LabelControl", {"TOP",nil,"TOP"}, {0, 30, 0, 16}, string.format("Calculating Mod Weights...")) self.calcContext.popup = main:OpenPopup(280, 65, "Please Wait", controls) end @@ -1015,12 +1015,12 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb local isAmuletSlot = slot and slot.slotName == "Amulet" local isEldritchModSlot = slot and eldritchModSlots[slot.slotName] == true - controls.includeCorrupted = new("CheckBoxControl", {"TOP",nil,"TOP"}, -40, 30, 18, "Corrupted Mods:", function(state) end) + controls.includeCorrupted = new("CheckBoxControl", {"TOP",nil,"TOP"}, {-40, 30, 18}, "Corrupted Mods:", function(state) end) controls.includeCorrupted.state = not context.slotTbl.alreadyCorrupted and (self.lastIncludeCorrupted == nil or self.lastIncludeCorrupted == true) controls.includeCorrupted.enabled = not context.slotTbl.alreadyCorrupted -- removing checkbox until synthesis mods are supported - --controls.includeSynthesis = new("CheckBoxControl", {"TOPRIGHT",controls.includeEldritch,"BOTTOMRIGHT"}, 0, 5, 18, "Synthesis Mods:", function(state) end) + --controls.includeSynthesis = new("CheckBoxControl", {"TOPRIGHT",controls.includeEldritch,"BOTTOMRIGHT"}, {0, 5, 18}, "Synthesis Mods:", function(state) end) --controls.includeSynthesis.state = (self.lastIncludeSynthesis == nil or self.lastIncludeSynthesis == true) local lastItemAnchor = controls.includeCorrupted @@ -1035,46 +1035,46 @@ 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) if not isJewelSlot and not isAbyssalJewelSlot and includeScourge then - controls.includeScourge = new("CheckBoxControl", {"TOPRIGHT",lastItemAnchor,"BOTTOMRIGHT"}, 0, 5, 18, "Scourge Mods:", function(state) end) + controls.includeScourge = new("CheckBoxControl", {"TOPRIGHT",lastItemAnchor,"BOTTOMRIGHT"}, {0, 5, 18}, "Scourge Mods:", function(state) end) controls.includeScourge.state = (self.lastIncludeScourge == nil or self.lastIncludeScourge == true) updateLastAnchor(controls.includeScourge) end if isAmuletSlot then - controls.includeTalisman = new("CheckBoxControl", {"TOPRIGHT",lastItemAnchor,"BOTTOMRIGHT"}, 0, 5, 18, "Talisman Mods:", function(state) end) + controls.includeTalisman = new("CheckBoxControl", {"TOPRIGHT",lastItemAnchor,"BOTTOMRIGHT"}, {0, 5, 18}, "Talisman Mods:", function(state) end) controls.includeTalisman.state = (self.lastIncludeTalisman == nil or self.lastIncludeTalisman == true) updateLastAnchor(controls.includeTalisman) end if isEldritchModSlot then - controls.includeEldritch = new("CheckBoxControl", {"TOPRIGHT",lastItemAnchor,"BOTTOMRIGHT"}, 0, 5, 18, "Eldritch Mods:", function(state) end) + controls.includeEldritch = new("CheckBoxControl", {"TOPRIGHT",lastItemAnchor,"BOTTOMRIGHT"}, {0, 5, 18}, "Eldritch Mods:", function(state) end) controls.includeEldritch.state = (self.lastIncludeEldritch == true) updateLastAnchor(controls.includeEldritch) end if isJewelSlot then - controls.jewelType = new("DropDownControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, 0, 5, 100, 18, { "Any", "Base", "Abyss" }, function(index, value) end) + controls.jewelType = new("DropDownControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, {0, 5, 100, 18}, { "Any", "Base", "Abyss" }, function(index, value) end) controls.jewelType.selIndex = self.lastJewelType or 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) elseif slot and not isAbyssalJewelSlot then - controls.influence1 = new("DropDownControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, 0, 5, 100, 18, influenceDropdownNames, function(index, value) end) + controls.influence1 = new("DropDownControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, {0, 5, 100, 18}, influenceDropdownNames, function(index, value) end) controls.influence1.selIndex = self.lastInfluence1 or 1 - controls.influence1Label = new("LabelControl", {"RIGHT",controls.influence1,"LEFT"}, -5, 0, 0, 16, "Influence 1:") + controls.influence1Label = new("LabelControl", {"RIGHT",controls.influence1,"LEFT"}, {-5, 0, 0, 16}, "Influence 1:") - controls.influence2 = new("DropDownControl", {"TOPLEFT",controls.influence1,"BOTTOMLEFT"}, 0, 5, 100, 18, influenceDropdownNames, function(index, value) end) + controls.influence2 = new("DropDownControl", {"TOPLEFT",controls.influence1,"BOTTOMLEFT"}, {0, 5, 100, 18}, influenceDropdownNames, function(index, value) end) controls.influence2.selIndex = self.lastInfluence2 or 1 - controls.influence2Label = new("LabelControl", {"RIGHT",controls.influence2,"LEFT"}, -5, 0, 0, 16, "Influence 2:") + 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,34 +1102,34 @@ 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.maxPriceLabel = new("LabelControl", {"RIGHT",controls.maxPrice,"LEFT"}, -5, 0, 0, 16, "^7Max Price:") + 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.maxLevelLabel = new("LabelControl", {"RIGHT",controls.maxLevel,"LEFT"}, -5, 0, 0, 16, "Max Level:") + 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 for i, stat in ipairs(statWeights) do - controls["sortStatType"..tostring(i)] = new("LabelControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, 0, i == 1 and 5 or 3, 70, 16, i < (#statWeights < 6 and 10 or 5) and s_format("^7%.2f: %s", stat.weightMult, stat.label) or ("+ "..tostring(#statWeights - 4).." Additional Stats")) + controls["sortStatType"..tostring(i)] = new("LabelControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, {0, i == 1 and 5 or 3, 70, 16}, i < (#statWeights < 6 and 10 or 5) and s_format("^7%.2f: %s", stat.weightMult, stat.label) or ("+ "..tostring(#statWeights - 4).." Additional Stats")) lastItemAnchor = controls["sortStatType"..tostring(i)] popupHeight = popupHeight + 19 if i == 1 then - controls.sortStatLabel = new("LabelControl", {"RIGHT",lastItemAnchor,"LEFT"}, -5, 0, 0, 16, "^7Stat to Sort By:") + controls.sortStatLabel = new("LabelControl", {"RIGHT",lastItemAnchor,"LEFT"}, {-5, 0, 0, 16}, "^7Stat to Sort By:") elseif i == 5 then -- tooltips do not actually work for labels lastItemAnchor.tooltipFunc = function(tooltip) @@ -1147,7 +1147,7 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb end popupHeight = popupHeight + 4 - controls.generateQuery = new("ButtonControl", { "BOTTOM", nil, "BOTTOM" }, -45, -10, 80, 20, "Execute", function() + controls.generateQuery = new("ButtonControl", { "BOTTOM", nil, "BOTTOM" }, {-45, -10, 80, 20}, "Execute", function() main:ClosePopup() if controls.includeMirrored then @@ -1199,7 +1199,7 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb self:StartQuery(slot, options) end) - controls.cancel = new("ButtonControl", { "BOTTOM", nil, "BOTTOM" }, 45, -10, 80, 20, "Cancel", function() + controls.cancel = new("ButtonControl", { "BOTTOM", nil, "BOTTOM" }, {45, -10, 80, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(400, popupHeight, "Query Options", controls) diff --git a/src/Classes/TradeStatWeightMultiplierListControl.lua b/src/Classes/TradeStatWeightMultiplierListControl.lua index 766b0f9de5..0d528470f5 100644 --- a/src/Classes/TradeStatWeightMultiplierListControl.lua +++ b/src/Classes/TradeStatWeightMultiplierListControl.lua @@ -4,10 +4,10 @@ -- Specialized UI element for listing and modifying Trade Stat Weight Multipliers. -- -local TradeStatWeightMultiplierListControlClass = newClass("TradeStatWeightMultiplierListControl", "ListControl", function(self, anchor, x, y, width, height, list, indexController) +local TradeStatWeightMultiplierListControlClass = newClass("TradeStatWeightMultiplierListControl", "ListControl", function(self, anchor, rect, list, indexController) self.list = list self.indexController = indexController - self.ListControl(anchor, x, y, width, height, 16, true, false, self.list) + self.ListControl(anchor, rect, 16, true, false, self.list) self.selIndex = nil end) diff --git a/src/Classes/TreeTab.lua b/src/Classes/TreeTab.lua index 43de27948e..c0ae6c353e 100644 --- a/src/Classes/TreeTab.lua +++ b/src/Classes/TreeTab.lua @@ -32,10 +32,10 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) self:SetActiveSpec(1) self:SetCompareSpec(1) - self.anchorControls = new("Control", nil, 0, 0, 0, 20) + self.anchorControls = new("Control", nil, {0, 0, 0, 20}) -- Tree list dropdown - self.controls.specSelect = new("DropDownControl", {"LEFT",self.anchorControls,"RIGHT"}, 0, 0, 190, 20, nil, function(index, value) + self.controls.specSelect = new("DropDownControl", { "LEFT",self.anchorControls,"RIGHT" }, { 0, 0, 190, 20 }, nil, function(index, value) if self.specList[index] then self.build.modFlag = true self:SetActiveSpec(index) @@ -90,7 +90,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) end -- Compare checkbox - self.controls.compareCheck = new("CheckBoxControl", { "LEFT", self.controls.specSelect, "RIGHT" }, 74, 0, 20, "Compare:", function(state) + self.controls.compareCheck = new("CheckBoxControl", { "LEFT", self.controls.specSelect, "RIGHT" }, { 74, 0, 20 }, "Compare:", function(state) self.isComparing = state self:SetCompareSpec(self.activeCompareSpec) self.controls.compareSelect.shown = state @@ -102,7 +102,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) end) -- Compare tree dropdown - self.controls.compareSelect = new("DropDownControl", { "LEFT", self.controls.compareCheck, "RIGHT" }, 8, 0, 190, 20, nil, function(index, value) + self.controls.compareSelect = new("DropDownControl", { "LEFT", self.controls.compareCheck, "RIGHT" }, { 8, 0, 190, 20 }, nil, function(index, value) if self.specList[index] then self:SetCompareSpec(index) else @@ -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") @@ -149,8 +149,8 @@ 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.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) if selected.value ~= self.build.spec.treeVersion then self:OpenVersionConvertPopup(selected.value, true) end @@ -161,7 +161,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) self.controls.versionSelect.selIndex = #self.treeVersions -- Tree Search Textbox - self.controls.treeSearch = new("EditControl", { "LEFT", self.controls.versionSelect, "RIGHT" }, 8, 0, main.portraitMode and 200 or 300, 20, "", "Search", "%c", 100, function(buf) + self.controls.treeSearch = new("EditControl", { "LEFT", self.controls.versionSelect, "RIGHT" }, { 8, 0, main.portraitMode and 200 or 300, 20 }, "", "Search", "%c", 100, function(buf) self.viewer.searchStr = buf self.searchFlag = buf ~= self.viewer.searchStrSaved end, nil, nil, true) @@ -169,7 +169,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) self.tradeLeaguesList = { } -- Find Timeless Jewel Button - self.controls.findTimelessJewel = new("ButtonControl", { "LEFT", self.controls.treeSearch, "RIGHT" }, 8, 0, 150, 20, "Find Timeless Jewel", function() + self.controls.findTimelessJewel = new("ButtonControl", { "LEFT", self.controls.treeSearch, "RIGHT" }, { 8, 0, 150, 20 }, "Find Timeless Jewel", function() self:FindTimelessJewel() end) @@ -177,7 +177,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) self.defaultTattoo = { } -- Show Node Power Checkbox - self.controls.treeHeatMap = new("CheckBoxControl", { "LEFT", self.controls.findTimelessJewel, "RIGHT" }, 130, 0, 20, "Show Node Power:", function(state) + self.controls.treeHeatMap = new("CheckBoxControl", { "LEFT", self.controls.findTimelessJewel, "RIGHT" }, { 130, 0, 20 }, "Show Node Power:", function(state) self.viewer.showHeatMap = state self.controls.treeHeatMapStatSelect.shown = state @@ -187,8 +187,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) end) -- Control for setting max node depth to limit calculation time of the heat map - self.controls.nodePowerMaxDepthSelect = new("DropDownControl", - { "LEFT", self.controls.treeHeatMap, "RIGHT" }, 8, 0, 50, 20, { "All", 5, 10, 15 }, function(index, value) + self.controls.nodePowerMaxDepthSelect = new("DropDownControl", { "LEFT", self.controls.treeHeatMap, "RIGHT" }, { 8, 0, 50, 20 }, { "All", 5, 10, 15 }, function(index, value) local oldMax = self.build.calcsTab.nodePowerMaxDepth if type(value) == "number" then @@ -208,7 +207,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) self.controls.nodePowerMaxDepthSelect.tooltipText = "Limit of Node distance to search (lower = faster)" -- Control for selecting the power stat to sort by (Defense, DPS, etc) - self.controls.treeHeatMapStatSelect = new("DropDownControl", { "LEFT", self.controls.nodePowerMaxDepthSelect, "RIGHT" }, 8, 0, 150, 20, nil, function(index, value) + self.controls.treeHeatMapStatSelect = new("DropDownControl", { "LEFT", self.controls.nodePowerMaxDepthSelect, "RIGHT" }, { 8, 0, 150, 20 }, nil, function(index, value) self:SetPowerCalc(value) end) self.controls.treeHeatMap.tooltipText = function() @@ -224,14 +223,14 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) end -- Show/Hide Power Report Button - self.controls.powerReport = new("ButtonControl", { "LEFT", self.controls.treeHeatMapStatSelect, "RIGHT" }, 8, 0, 150, 20, + self.controls.powerReport = new("ButtonControl", { "LEFT", self.controls.treeHeatMapStatSelect, "RIGHT" }, { 8, 0, 150, 20 }, function() return self.controls.powerReportList.shown and "Hide Power Report" or "Show Power Report" end, function() self.controls.powerReportList.shown = not self.controls.powerReportList.shown end) -- Power Report List local yPos = self.controls.treeHeatMap.y == 0 and self.controls.specSelect.height + 4 or self.controls.specSelect.height * 2 + 8 - self.controls.powerReportList = new("PowerReportListControl", {"TOPLEFT", self.controls.specSelect, "BOTTOMLEFT"}, 0, yPos, 700, 220, function(selectedNode) + self.controls.powerReportList = new("PowerReportListControl", { "TOPLEFT", self.controls.specSelect, "BOTTOMLEFT" }, { 0, yPos, 700, 170 }, function(selectedNode) -- this code is called by the list control when the user "selects" one of the passives in the list. -- we use this to set a flag which causes the next Draw() to recenter the passive tree on the desired node. if selectedNode.x then @@ -247,7 +246,7 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) self.controls.powerReportList:SetReport(powerStat, report) end - self.controls.specConvertText = new("LabelControl", { "BOTTOMLEFT", self.controls.specSelect, "TOPLEFT" }, 0, -14, 0, 16, "^7This is an older tree version, which may not be fully compatible with the current game version.") + self.controls.specConvertText = new("LabelControl", { "BOTTOMLEFT", self.controls.specSelect, "TOPLEFT" }, { 0, -14, 0, 16 }, "^7This is an older tree version, which may not be fully compatible with the current game version.") self.controls.specConvertText.shown = function() return self.showConvert end @@ -260,10 +259,10 @@ local TreeTabClass = newClass("TreeTab", "ControlHost", function(self, build) local function buildConvertAllButtonLabel() return colorCodes.POSITIVE.."Convert all trees to "..treeVersions[getLatestTreeVersion()].display end - self.controls.specConvert = new("ButtonControl", { "LEFT", self.controls.specConvertText, "RIGHT" }, 8, 0, function() return DrawStringWidth(16, "VAR", buildConvertButtonLabel()) + 20 end, 20, buildConvertButtonLabel, function() + 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 @@ -526,19 +525,19 @@ end function TreeTabClass:OpenSpecManagePopup() local importTree = - new("ButtonControl", nil, -99, 259, 90, 20, "Import Tree", function() + new("ButtonControl", nil, {-99, 259, 90, 20}, "Import Tree", function() self:OpenImportPopup() end) local exportTree = - new("ButtonControl", { "LEFT", importTree, "RIGHT" }, 8, 0, 90, 20, "Export Tree", function() + new("ButtonControl", {"LEFT", importTree, "RIGHT"}, {8, 0, 90, 20}, "Export Tree", function() self:OpenExportPopup() end) main:OpenPopup(370, 290, "Manage Passive Trees", { - new("PassiveSpecListControl", nil, 0, 50, 350, 200, self), + new("PassiveSpecListControl", nil, {0, 50, 350, 200}, self), importTree, exportTree, - new("ButtonControl", {"LEFT", exportTree, "RIGHT"}, 8, 0, 90, 20, "Done", function() + new("ButtonControl", {"LEFT", exportTree, "RIGHT"}, {8, 0, 90, 20}, "Done", function() main:ClosePopup() end), }) @@ -546,17 +545,17 @@ end 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" .. + 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) @@ -565,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") @@ -637,18 +636,18 @@ function TreeTabClass:OpenImportPopup() return latestTreeVersion .. (isRuthless and "_ruthless" or "") end - controls.nameLabel = new("LabelControl", nil, -180, 20, 0, 16, "Enter name for this passive tree:") - controls.name = new("EditControl", nil, 100, 20, 350, 18, "", nil, nil, nil, function(buf) + controls.nameLabel = new("LabelControl", nil, {-180, 20, 0, 16}, "Enter name for this passive tree:") + controls.name = new("EditControl", nil, {100, 20, 350, 18}, "", nil, nil, nil, function(buf) controls.msg.label = "" controls.import.enabled = buf:match("%S") and controls.edit.buf:match("%S") end) - controls.editLabel = new("LabelControl", nil, -150, 45, 0, 16, "Enter passive tree link:") - controls.edit = new("EditControl", nil, 100, 45, 350, 18, "", nil, nil, nil, function(buf) + controls.editLabel = new("LabelControl", nil, {-150, 45, 0, 16}, "Enter passive tree link:") + controls.edit = new("EditControl", nil, {100, 45, 350, 18}, "", nil, nil, nil, function(buf) controls.msg.label = "" controls.import.enabled = buf:match("%S") and controls.name.buf:match("%S") end) - controls.msg = new("LabelControl", nil, 0, 65, 0, 16, "") - controls.import = new("ButtonControl", nil, -45, 85, 80, 20, "Import", function() + controls.msg = new("LabelControl", nil, {0, 65, 0, 16}, "") + controls.import = new("ButtonControl", nil, {-45, 85, 80, 20}, "Import", function() local treeLink = controls.edit.buf if #treeLink == 0 then return @@ -698,7 +697,7 @@ function TreeTabClass:OpenImportPopup() end end) controls.import.enabled = false - controls.cancel = new("ButtonControl", nil, 45, 85, 80, 20, "Cancel", function() + controls.cancel = new("ButtonControl", nil, {45, 85, 80, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(580, 115, "Import Tree", controls, "import", "name") @@ -708,9 +707,9 @@ function TreeTabClass:OpenExportPopup() local treeLink = self.build.spec:EncodeURL(treeVersions[self.build.spec.treeVersion].url) local popup local controls = { } - controls.label = new("LabelControl", nil, 0, 20, 0, 16, "Passive tree link:") - controls.edit = new("EditControl", nil, 0, 40, 350, 18, treeLink, nil, "%Z") - controls.shrink = new("ButtonControl", nil, -90, 70, 140, 20, "Shrink with PoEURL", function() + controls.label = new("LabelControl", nil, {0, 20, 0, 16}, "Passive tree link:") + controls.edit = new("EditControl", nil, {0, 40, 350, 18}, treeLink, nil, "%Z") + controls.shrink = new("ButtonControl", nil, {-90, 70, 140, 20}, "Shrink with PoEURL", function() controls.shrink.enabled = false controls.shrink.label = "Shrinking..." launch:DownloadPage("http://poeurl.com/shrink.php?url="..treeLink, function(response, errMsg) @@ -724,10 +723,10 @@ function TreeTabClass:OpenExportPopup() end end) end) - controls.copy = new("ButtonControl", nil, 30, 70, 80, 20, "Copy", function() + controls.copy = new("ButtonControl", nil, {30, 70, 80, 20}, "Copy", function() Copy(treeLink) end) - controls.done = new("ButtonControl", nil, 120, 70, 80, 20, "Done", function() + controls.done = new("ButtonControl", nil, {120, 70, 80, 20}, "Done", function() main:ClosePopup() end) popup = main:OpenPopup(380, 100, "Export Tree", controls, "done", "edit") @@ -795,7 +794,7 @@ function TreeTabClass:ModifyNodePopup(selectedNode) end end for idx, desc in ipairs(wrapTable) do - controls[idx] = new("LabelControl", {"TOPLEFT", controls[idx-1] or controls.modSelect,"TOPLEFT"}, 0, 20, 600, 16, "^7"..desc) + controls[idx] = new("LabelControl", {"TOPLEFT", controls[idx-1] or controls.modSelect,"TOPLEFT"}, {0, 20, 600, 16}, "^7"..desc) totalHeight = totalHeight + 20 end main.popups[1].height = totalHeight + 75 @@ -807,8 +806,8 @@ function TreeTabClass:ModifyNodePopup(selectedNode) end buildMods(selectedNode) - controls.modSelectLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 150, 25, 0, 16, "^7Modifier:") - controls.modSelect = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 155, 25, 250, 18, modGroups, function(idx) constructUI(modGroups[idx]) end) + controls.modSelectLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, {150, 25, 0, 16}, "^7Modifier:") + controls.modSelect = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, {155, 25, 250, 18}, modGroups, function(idx) constructUI(modGroups[idx]) end) controls.modSelect.selIndex = self.defaultTattoo[nodeName] or 1 controls.modSelect.tooltipFunc = function(tooltip, mode, index, value) tooltip:Clear() @@ -818,20 +817,20 @@ function TreeTabClass:ModifyNodePopup(selectedNode) end end end - controls.save = new("ButtonControl", nil, -90, 75, 80, 20, "Add", function() + controls.save = new("ButtonControl", nil, {-90, 75, 80, 20}, "Add", function() addModifier(selectedNode) self.modFlag = true self.build.buildFlag = true self.defaultTattoo[nodeName] = controls.modSelect.selIndex main:ClosePopup() end) - controls.reset = new("ButtonControl", nil, 0, 75, 80, 20, "Reset Node", function() + controls.reset = new("ButtonControl", nil, {0, 75, 80, 20}, "Reset Node", function() self:RemoveTattooFromNode(selectedNode) self.modFlag = true self.build.buildFlag = true main:ClosePopup() end) - controls.close = new("ButtonControl", nil, 90, 75, 80, 20, "Cancel", function() + controls.close = new("ButtonControl", nil, {90, 75, 80, 20}, "Cancel", function() main:ClosePopup() end) @@ -847,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) @@ -894,13 +893,13 @@ function TreeTabClass:OpenMasteryPopup(node, viewPort) --Check to make sure that the effects list has a potential mod to apply to a mastery if not (next(effects) == nil) then local passiveMasteryControlHeight = (#effects + 1) * 14 + 2 - controls.close = new("ButtonControl", nil, 0, 30 + passiveMasteryControlHeight, 90, 20, "Cancel", function() + controls.close = new("ButtonControl", nil, {0, 30 + passiveMasteryControlHeight, 90, 20}, "Cancel", function() node.sd = cachedSd node.allMasteryOptions = cachedAllMasteryOption self.build.spec.tree:ProcessStats(node) main:ClosePopup() end) - controls.effect = new("PassiveMasteryControl", {"TOPLEFT",nil,"TOPLEFT"}, 6, 25, 0, passiveMasteryControlHeight, effects, self, node, controls.save) + controls.effect = new("PassiveMasteryControl", {"TOPLEFT",nil,"TOPLEFT"}, {6, 25, 0, passiveMasteryControlHeight}, effects, self, node, controls.save) main:OpenPopup(controls.effect.width + 12, controls.effect.height + 60, node.name, controls) end end @@ -1336,19 +1335,19 @@ function TreeTabClass:FindTimelessJewel() self.build.modFlag = true end - controls.devotionSelectLabel = new("LabelControl", { "TOPRIGHT", nil, "TOPLEFT" }, 820, 25, 0, 16, "^7Devotion modifiers:") + controls.devotionSelectLabel = new("LabelControl", {"TOPRIGHT", nil, "TOPLEFT"}, {820, 25, 0, 16}, "^7Devotion modifiers:") controls.devotionSelectLabel.shown = timelessData.jewelType.id == 4 - controls.devotionSelect1 = new("DropDownControl", { "TOP", controls.devotionSelectLabel, "BOTTOM" }, 0, 8, 200, 18, devotionVariants, function(index, value) + controls.devotionSelect1 = new("DropDownControl", {"TOP", controls.devotionSelectLabel, "BOTTOM"}, {0, 8, 200, 18}, devotionVariants, function(index, value) timelessData.devotionVariant1 = index end) controls.devotionSelect1.selIndex = timelessData.devotionVariant1 - controls.devotionSelect2 = new("DropDownControl", { "TOP", controls.devotionSelect1, "BOTTOM" }, 0, 7, 200, 18, devotionVariants, function(index, value) + controls.devotionSelect2 = new("DropDownControl", {"TOP", controls.devotionSelect1, "BOTTOM"}, {0, 7, 200, 18}, devotionVariants, function(index, value) timelessData.devotionVariant2 = index end) controls.devotionSelect2.selIndex = timelessData.devotionVariant2 - controls.jewelSelectLabel = new("LabelControl", { "TOPRIGHT", nil, "TOPLEFT" }, 405, 25, 0, 16, "^7Jewel Type:") - controls.jewelSelect = new("DropDownControl", { "LEFT", controls.jewelSelectLabel, "RIGHT" }, 10, 0, 200, 18, jewelTypes, function(index, value) + controls.jewelSelectLabel = new("LabelControl", {"TOPRIGHT", nil, "TOPLEFT"}, {405, 25, 0, 16}, "^7Jewel Type:") + controls.jewelSelect = new("DropDownControl", {"LEFT", controls.jewelSelectLabel, "RIGHT"}, {10, 0, 200, 18}, jewelTypes, function(index, value) timelessData.jewelType = value controls.devotionSelectLabel.shown = value.id == 4 -- Militant Faith controls.protectAllocatedLabel.shown = (value.id == 4 and controls.socketFilter.state) @@ -1362,8 +1361,8 @@ function TreeTabClass:FindTimelessJewel() end) controls.jewelSelect.selIndex = timelessData.jewelType.id - controls.conquerorSelectLabel = new("LabelControl", { "TOPRIGHT", nil, "TOPLEFT" }, 405, 50, 0, 16, "^7Conqueror:") - controls.conquerorSelect = new("DropDownControl", { "LEFT", controls.conquerorSelectLabel, "RIGHT" }, 10, 0, 200, 18, conquerorTypes[timelessData.jewelType.id], function(index, value) + controls.conquerorSelectLabel = new("LabelControl", {"TOPRIGHT", nil, "TOPLEFT"}, {405, 50, 0, 16}, "^7Conqueror:") + controls.conquerorSelect = new("DropDownControl", {"LEFT", controls.conquerorSelectLabel, "RIGHT"}, {10, 0, 200, 18}, conquerorTypes[timelessData.jewelType.id], function(index, value) timelessData.conquerorType = value self.build.modFlag = true end) @@ -1388,8 +1387,8 @@ function TreeTabClass:FindTimelessJewel() self.allocatedNodesInRadiusCount = #nodeNames end - controls.socketSelectLabel = new("LabelControl", { "TOPRIGHT", nil, "TOPLEFT" }, 405, 75, 0, 16, "^7Jewel Socket:") - controls.socketSelect = new("TimelessJewelSocketControl", { "LEFT", controls.socketSelectLabel, "RIGHT" }, 10, 0, 200, 18, jewelSockets, function(index, value) + controls.socketSelectLabel = new("LabelControl", {"TOPRIGHT", nil, "TOPLEFT"}, {405, 75, 0, 16}, "^7Jewel Socket:") + controls.socketSelect = new("TimelessJewelSocketControl", {"LEFT", controls.socketSelectLabel, "RIGHT"}, {10, 0, 200, 18}, jewelSockets, function(index, value) timelessData.jewelSocket = value setAllocatedNodes() -- reset list when changing sockets self.build.modFlag = true @@ -1411,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 @@ -1434,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 @@ -1460,8 +1459,8 @@ function TreeTabClass:FindTimelessJewel() end local socketFilterAdditionalDistanceMAX = 10 - controls.socketFilterAdditionalDistanceLabel = new("LabelControl", { "LEFT", controls.socketFilter, "RIGHT" }, 10, 0, 0, 16, "^7Node Distance:") - controls.socketFilterAdditionalDistance = new("SliderControl", { "LEFT", controls.socketFilterAdditionalDistanceLabel, "RIGHT" }, 10, 0, 66, 18, function(value) + controls.socketFilterAdditionalDistanceLabel = new("LabelControl", {"LEFT", controls.socketFilter, "RIGHT"}, {10, 0, 0, 16}, "^7Node Distance:") + controls.socketFilterAdditionalDistance = new("SliderControl", {"LEFT", controls.socketFilterAdditionalDistanceLabel, "RIGHT"}, {10, 0, 66, 18}, function(value) timelessData.socketFilterDistance = m_floor(value * socketFilterAdditionalDistanceMAX + 0.01) controls.socketFilterAdditionalDistanceValue.label = s_format("^7%d", timelessData.socketFilterDistance) end, { ["SHIFT"] = 1, ["CTRL"] = 1 / (socketFilterAdditionalDistanceMAX * 2), ["DEFAULT"] = 1 / socketFilterAdditionalDistanceMAX }) @@ -1480,7 +1479,7 @@ function TreeTabClass:FindTimelessJewel() end return controls.socketFilterAdditionalDistance.tooltip.realDraw(self, x, y, width, height, viewPort) end - controls.socketFilterAdditionalDistanceValue = new("LabelControl", { "LEFT", controls.socketFilterAdditionalDistance, "RIGHT" }, 5, 0, 0, 16, "^70") + controls.socketFilterAdditionalDistanceValue = new("LabelControl", {"LEFT", controls.socketFilterAdditionalDistance, "RIGHT"}, {5, 0, 0, 16}, "^70") controls.socketFilterAdditionalDistance:SetVal((timelessData.socketFilterDistance or 0) / socketFilterAdditionalDistanceMAX) controls.socketFilterAdditionalDistanceLabel.shown = timelessData.socketFilter controls.socketFilterAdditionalDistance.shown = timelessData.socketFilter @@ -1490,8 +1489,8 @@ function TreeTabClass:FindTimelessJewel() local scrollWheelSpeedTbl2 = { ["SHIFT"] = 0.2, ["CTRL"] = 0.002, ["DEFAULT"] = 0.02 } local nodeSliderStatLabel = "None" - controls.nodeSliderLabel = new("LabelControl", { "TOPRIGHT", nil, "TOPLEFT" }, 405, 125, 0, 16, "^7Primary Node Weight:") - controls.nodeSlider = new("SliderControl", { "LEFT", controls.nodeSliderLabel, "RIGHT" }, 10, 0, 200, 16, function(value) + controls.nodeSliderLabel = new("LabelControl", {"TOPRIGHT", nil, "TOPLEFT"}, {405, 125, 0, 16}, "^7Primary Node Weight:") + controls.nodeSlider = new("SliderControl", {"LEFT", controls.nodeSliderLabel, "RIGHT"}, {10, 0, 200, 16}, function(value) controls.nodeSliderValue.label = s_format("^7%.3f", value * 10) parseSearchList(1, controls.searchListFallback and controls.searchListFallback.shown or false) end, scrollWheelSpeedTbl) @@ -1506,7 +1505,7 @@ function TreeTabClass:FindTimelessJewel() end end end - controls.nodeSliderValue = new("LabelControl", { "LEFT", controls.nodeSlider, "RIGHT" }, 5, 0, 0, 16, "^71.000") + controls.nodeSliderValue = new("LabelControl", {"LEFT", controls.nodeSlider, "RIGHT"}, {5, 0, 0, 16}, "^71.000") controls.nodeSlider.tooltip.realDraw = controls.nodeSlider.tooltip.Draw controls.nodeSlider.tooltip.Draw = function(self, x, y, width, height, viewPort) local sliderOffsetX = round(184 * (1 - controls.nodeSlider.val)) @@ -1519,8 +1518,8 @@ function TreeTabClass:FindTimelessJewel() controls.nodeSlider:SetVal(0.1) local nodeSlider2StatLabel = "None" - controls.nodeSlider2Label = new("LabelControl", { "TOPRIGHT", nil, "TOPLEFT" }, 405, 150, 0, 16, "^7Secondary Node Weight:") - controls.nodeSlider2 = new("SliderControl", { "LEFT", controls.nodeSlider2Label, "RIGHT" }, 10, 0, 200, 16, function(value) + controls.nodeSlider2Label = new("LabelControl", {"TOPRIGHT", nil, "TOPLEFT"}, {405, 150, 0, 16}, "^7Secondary Node Weight:") + controls.nodeSlider2 = new("SliderControl", {"LEFT", controls.nodeSlider2Label, "RIGHT"}, {10, 0, 200, 16}, function(value) controls.nodeSlider2Value.label = s_format("^7%.3f", value * 10) parseSearchList(1, controls.searchListFallback and controls.searchListFallback.shown or false) end, scrollWheelSpeedTbl) @@ -1535,7 +1534,7 @@ function TreeTabClass:FindTimelessJewel() end end end - controls.nodeSlider2Value = new("LabelControl", { "LEFT", controls.nodeSlider2, "RIGHT" }, 5, 0, 0, 16, "^71.000") + controls.nodeSlider2Value = new("LabelControl", {"LEFT", controls.nodeSlider2, "RIGHT"}, {5, 0, 0, 16}, "^71.000") controls.nodeSlider2.tooltip.realDraw = controls.nodeSlider2.tooltip.Draw controls.nodeSlider2.tooltip.Draw = function(self, x, y, width, height, viewPort) local sliderOffsetX = round(184 * (1 - controls.nodeSlider2.val)) @@ -1547,8 +1546,8 @@ function TreeTabClass:FindTimelessJewel() end controls.nodeSlider2:SetVal(0.1) - controls.nodeSlider3Label = new("LabelControl", { "TOPRIGHT", nil, "TOPLEFT" }, 405, 175, 0, 16, "^7Minimum Node Weight:") - controls.nodeSlider3 = new("SliderControl", { "LEFT", controls.nodeSlider3Label, "RIGHT" }, 10, 0, 200, 16, function(value) + controls.nodeSlider3Label = new("LabelControl", {"TOPRIGHT", nil, "TOPLEFT"}, {405, 175, 0, 16}, "^7Minimum Node Weight:") + controls.nodeSlider3 = new("SliderControl", {"LEFT", controls.nodeSlider3Label, "RIGHT"}, {10, 0, 200, 16}, function(value) if value == 1 then controls.nodeSlider3Value.label = "^7Required" else @@ -1562,7 +1561,7 @@ function TreeTabClass:FindTimelessJewel() tooltip:AddLine(16, "^7Seeds that do not meet the minimum weight threshold for a desired node are excluded from the search results.") end end - controls.nodeSlider3Value = new("LabelControl", { "LEFT", controls.nodeSlider3, "RIGHT" }, 5, 0, 0, 16, "^70") + controls.nodeSlider3Value = new("LabelControl", {"LEFT", controls.nodeSlider3, "RIGHT"}, {5, 0, 0, 16}, "^70") controls.nodeSlider3.tooltip.realDraw = controls.nodeSlider3.tooltip.Draw controls.nodeSlider3.tooltip.Draw = function(self, x, y, width, height, viewPort) local sliderOffsetX = round(184 * (1 - controls.nodeSlider3.val)) @@ -1601,8 +1600,8 @@ function TreeTabClass:FindTimelessJewel() end buildMods() - controls.nodeSelectLabel = new("LabelControl", { "TOPRIGHT", nil, "TOPLEFT" }, 405, 200, 0, 16, "^7Search for Node:") - controls.nodeSelect = new("DropDownControl", { "LEFT", controls.nodeSelectLabel, "RIGHT" }, 10, 0, 200, 18, modData, function(index, value) + controls.nodeSelectLabel = new("LabelControl", {"TOPRIGHT", nil, "TOPLEFT"}, {405, 200, 0, 16}, "^7Search for Node:") + controls.nodeSelect = new("DropDownControl", {"LEFT", controls.nodeSelectLabel, "RIGHT"}, {10, 0, 200, 18}, modData, function(index, value) nodeSliderStatLabel = "None" nodeSlider2StatLabel = "None" if value.id then @@ -1835,7 +1834,7 @@ function TreeTabClass:FindTimelessJewel() updateSearchList(newList, true) end - controls.fallbackWeightsLabel = new("LabelControl", { "TOPRIGHT", nil, "TOPLEFT" }, 405, 225, 0, 16, "^7Fallback Weight Mode:") + controls.fallbackWeightsLabel = new("LabelControl", {"TOPRIGHT", nil, "TOPLEFT"}, {405, 225, 0, 16}, "^7Fallback Weight Mode:") local fallbackWeightsList = { } for id, stat in pairs(data.powerStatList) do if not stat.ignoreForItems and stat.label ~= "Name" then @@ -1846,11 +1845,11 @@ function TreeTabClass:FindTimelessJewel() }) end end - controls.fallbackWeightsList = new("DropDownControl", { "LEFT", controls.fallbackWeightsLabel, "RIGHT" }, 10, 0, 200, 18, fallbackWeightsList, function(index) + controls.fallbackWeightsList = new("DropDownControl", {"LEFT", controls.fallbackWeightsLabel, "RIGHT"}, {10, 0, 200, 18}, fallbackWeightsList, function(index) timelessData.fallbackWeightMode.idx = index end) controls.fallbackWeightsList.selIndex = timelessData.fallbackWeightMode.idx or 1 - controls.fallbackWeightsButton = new("ButtonControl", { "LEFT", controls.fallbackWeightsList, "RIGHT" }, 5, 0, 66, 18, "Generate", function() + controls.fallbackWeightsButton = new("ButtonControl", {"LEFT", controls.fallbackWeightsList, "RIGHT"}, {5, 0, 66, 18}, "Generate", function() setupFallbackWeights() controls.searchListFallbackButton.label = "^4Fallback Nodes" end) @@ -1859,7 +1858,7 @@ function TreeTabClass:FindTimelessJewel() tooltip:AddLine(16, "^7Click this button to generate new fallback node weights, replacing your old ones.") end - controls.searchListButton = new("ButtonControl", { "TOPLEFT", nil, "TOPLEFT" }, 12, 250, 106, 20, "^7Desired Nodes", function() + controls.searchListButton = new("ButtonControl", {"TOPLEFT", nil, "TOPLEFT"}, {12, 250, 106, 20}, "^7Desired Nodes", function() if controls.searchListFallback.shown then controls.searchListFallback.shown = false controls.searchListFallback.enabled = false @@ -1873,7 +1872,7 @@ function TreeTabClass:FindTimelessJewel() tooltip:AddLine(16, "^7This list can be updated manually or by selecting the node you want to update via the search dropdown list and then moving the node weight sliders.") end controls.searchListButton.locked = function() return controls.searchList.shown end - controls.searchListFallbackButton = new("ButtonControl", { "LEFT", controls.searchListButton, "RIGHT" }, 5, 0, 110, 20, "^7Fallback Nodes", function() + controls.searchListFallbackButton = new("ButtonControl", {"LEFT", controls.searchListButton, "RIGHT"}, {5, 0, 110, 20}, "^7Fallback Nodes", function() controls.searchList.shown = false controls.searchList.enabled = false controls.searchListFallback.shown = true @@ -1889,7 +1888,7 @@ function TreeTabClass:FindTimelessJewel() tooltip:AddLine(16, "^7Any manual changes made to your fallback nodes are lost when you click the generate button, as it completely replaces them.") end controls.searchListFallbackButton.locked = function() return controls.searchListFallback.shown end - controls.searchList = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, 12, 275, 438, 200, timelessData.searchList, nil, "^%C\t\n", nil, function(value) + controls.searchList = new("EditControl", {"TOPLEFT", nil, "TOPLEFT"}, {12, 275, 438, 200}, timelessData.searchList, nil, "^%C\t\n", nil, function(value) timelessData.searchList = value parseSearchList(0, false) self.build.modFlag = true @@ -1897,7 +1896,7 @@ function TreeTabClass:FindTimelessJewel() controls.searchList.shown = true controls.searchList.enabled = true controls.searchList:SetText(timelessData.searchList and timelessData.searchList or "") - controls.searchListFallback = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, 12, 275, 438, 200, timelessData.searchListFallback, nil, "^%C\t\n", nil, function(value) + controls.searchListFallback = new("EditControl", {"TOPLEFT", nil, "TOPLEFT"}, {12, 275, 438, 200}, timelessData.searchListFallback, nil, "^%C\t\n", nil, function(value) timelessData.searchListFallback = value parseSearchList(0, true) self.build.modFlag = true @@ -1906,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 @@ -1950,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)) @@ -2057,7 +2056,7 @@ function TreeTabClass:FindTimelessJewel() local totalWidth = m_floor(width * buttons + divider * (buttons - 1)) local buttonX = -totalWidth / 2 + width / 2 - controls.searchButton = new("ButtonControl", nil, buttonX, 485, width, 20, "Search", function() + controls.searchButton = new("ButtonControl", nil, {buttonX, 485, width, 20}, "Search", function() if treeData.nodes[timelessData.jewelSocket.id] and treeData.nodes[timelessData.jewelSocket.id].isJewelSocket then local radiusNodes = treeData.nodes[timelessData.jewelSocket.id].nodesInRadius[3] -- large radius around timelessData.jewelSocket.id local allocatedNodes = { } @@ -2349,14 +2348,14 @@ function TreeTabClass:FindTimelessJewel() controls.searchResults.selIndex = 1 end end) - controls.resetButton = new("ButtonControl", nil, buttonX + (width + divider), 485, width, 20, "Reset", function() + controls.resetButton = new("ButtonControl", nil, {buttonX + (width + divider), 485, width, 20}, "Reset", function() updateSearchList("", true) updateSearchList("", false) wipeTable(timelessData.searchResults) controls.searchTradeButton.enabled = false clearProtected() end) - controls.closeButton = new("ButtonControl", nil, buttonX + (width + divider) * 2, 485, width, 20, "Cancel", function() + controls.closeButton = new("ButtonControl", nil, {buttonX + (width + divider) * 2, 485, width, 20}, "Cancel", function() main:ClosePopup() end) diff --git a/src/Export/Classes/DatListControl.lua b/src/Export/Classes/DatListControl.lua index 5109a5af58..57ceafe00f 100644 --- a/src/Export/Classes/DatListControl.lua +++ b/src/Export/Classes/DatListControl.lua @@ -3,8 +3,8 @@ -- Class: Dat List -- Dat list control. -- -local DatListClass = newClass("DatListControl", "ListControl", function(self, anchor, x, y, width, height) - self.ListControl(anchor, x, y, width, height, 14, "VERTICAL", false, main.datFileList) +local DatListClass = newClass("DatListControl", "ListControl", function(self, anchor, rect) + self.ListControl(anchor, rect, 14, "VERTICAL", false, main.datFileList) end) function DatListClass:GetRowValue(column, index, datFile) diff --git a/src/Export/Classes/GGPKSourceListControl.lua b/src/Export/Classes/GGPKSourceListControl.lua index 045a306202..307e505879 100644 --- a/src/Export/Classes/GGPKSourceListControl.lua +++ b/src/Export/Classes/GGPKSourceListControl.lua @@ -3,18 +3,18 @@ -- Class: GGPK Source List -- GGPK source list control. -- -local GGPKSourceListClass = newClass("GGPKSourceListControl", "ListControl", function(self, anchor, x, y, width, height) - self.ListControl(anchor, x, y, width, height, 16, false, false, main.datSources) +local GGPKSourceListClass = newClass("GGPKSourceListControl", "ListControl", function(self, anchor, rect) + self.ListControl(anchor, rect, 16, false, false, main.datSources) self.colList = { - { width = width * 0.25, label = "Name", sortable = true }, - { width = width * 0.75, label = "Spec File Path" }, + { width = self.width * 0.25, label = "Name", sortable = true }, + { width = self.width * 0.75, label = "Spec File Path" }, } self.colLabels = true - self.controls.new = new("ButtonControl", {"BOTTOMLEFT",self,"TOP"}, -62, -4, 60, 18, "New", function() + self.controls.new = new("ButtonControl", {"BOTTOMLEFT",self,"TOP"}, {-62, -4, 60, 18}, "New", function() local datSource = {} self:EditDATSource(datSource, true) end) - self.controls.delete = new("ButtonControl", {"LEFT",self.controls.new,"RIGHT"}, 4, 0, 60, 18, "Delete", function() + self.controls.delete = new("ButtonControl", {"LEFT",self.controls.new,"RIGHT"}, {4, 0, 60, 18}, "Delete", function() self:OnSelDelete(self.selIndex) end) self.controls.delete.enabled = function() @@ -24,25 +24,25 @@ end) function GGPKSourceListClass:EditDATSource(datSource, newSource) local controls = { } - controls.labelLabel = new("LabelControl", nil, -30, 20, 0, 16, "^7Name:") - controls.label = new("EditControl", nil, 85, 20, 180, 20, datSource.label, nil, nil, nil, function(buf) + controls.labelLabel = new("LabelControl", nil, {-30, 20, 0, 16}, "^7Name:") + controls.label = new("EditControl", nil, {85, 20, 180, 20}, datSource.label, nil, nil, nil, function(buf) controls.save.enabled = (controls.dat.buf:match("%S") or controls.ggpk.buf:match("%S")) and buf:match("%S") end) - controls.ggpkLabel = new("LabelControl", nil, 0, 40, 0, 16, "^7Source from GGPK/Steam PoE path:") - controls.ggpk = new("EditControl", {"TOP",controls.ggpkLabel,"TOP"}, 0, 20, 350, 20, datSource.ggpkPath, nil, nil, nil, function(buf) + controls.ggpkLabel = new("LabelControl", nil, {0, 40, 0, 16}, "^7Source from GGPK/Steam PoE path:") + controls.ggpk = new("EditControl", {"TOP",controls.ggpkLabel,"TOP"}, {0, 20, 350, 20}, datSource.ggpkPath, nil, nil, nil, function(buf) controls.save.enabled = (buf:match("%S") or controls.dat.buf:match("%S")) and controls.label.buf:match("%S") and controls.spec.buf:match("%S") end) controls.ggpk.enabled = function() return not controls.dat.buf:match("%S") end - controls.datLabel = new("LabelControl", {"TOP",controls.ggpk,"TOP"}, 0, 22, 0, 16, "^7Source from DAT files:") - controls.dat = new("EditControl", {"TOP",controls.datLabel,"TOP"}, 0, 20, 350, 20, datSource.datFilePath, nil, nil, nil, function(buf) + controls.datLabel = new("LabelControl", {"TOP",controls.ggpk,"TOP"}, {0, 22, 0, 16}, "^7Source from DAT files:") + controls.dat = new("EditControl", {"TOP",controls.datLabel,"TOP"}, {0, 20, 350, 20}, datSource.datFilePath, nil, nil, nil, function(buf) controls.save.enabled = (buf:match("%S") or controls.ggpk.buf:match("%S")) and controls.label.buf:match("%S") and controls.spec.buf:match("%S") end) controls.dat.enabled = function() return not controls.ggpk.buf:match("%S") end - controls.specLabel = new("LabelControl", {"TOP",controls.dat,"TOP"}, 0, 22, 0, 16, "^7Spec File location:") - controls.spec = new("EditControl", {"TOP",controls.specLabel,"TOP"}, 0, 20, 350, 20, datSource.spec or "spec.lua", nil, nil, nil, function(buf) + controls.specLabel = new("LabelControl", {"TOP",controls.dat,"TOP"}, {0, 22, 0, 16}, "^7Spec File location:") + controls.spec = new("EditControl", {"TOP",controls.specLabel,"TOP"}, {0, 20, 350, 20}, datSource.spec or "spec.lua", nil, nil, nil, function(buf) controls.save.enabled = (controls.dat.buf:match("%S") or controls.ggpk.buf:match("%S")) and controls.label.buf:match("%S") and buf:match("%S") end) - controls.save = new("ButtonControl", {"TOP",controls.spec,"TOP"}, -45, 22, 80, 20, "Save", function() + controls.save = new("ButtonControl", {"TOP",controls.spec,"TOP"}, {-45, 22, 80, 20}, "Save", function() local reload = datSource.label == main.datSource.label datSource.label = controls.label.buf datSource.ggpkPath = controls.ggpk.buf or "" @@ -59,7 +59,7 @@ function GGPKSourceListClass:EditDATSource(datSource, newSource) main:ClosePopup() end) controls.save.enabled = false - controls.cancel = new("ButtonControl", {"TOP",controls.spec,"TOP"}, 45, 22, 80, 20, "Cancel", function() + controls.cancel = new("ButtonControl", {"TOP",controls.spec,"TOP"}, {45, 22, 80, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(370, 200, datSource[1] and "Edit DAT Source" or "New DAT Source", controls, "save", "edit") diff --git a/src/Export/Classes/RowListControl.lua b/src/Export/Classes/RowListControl.lua index 639cdf20fa..fe443a6f91 100644 --- a/src/Export/Classes/RowListControl.lua +++ b/src/Export/Classes/RowListControl.lua @@ -6,8 +6,8 @@ local ipairs = ipairs local t_insert = table.insert -local RowListClass = newClass("RowListControl", "ListControl", function(self, anchor, x, y, width, height) - self.ListControl(anchor, x, y, width, height, 14, "HORIZONTAL", false, { }) +local RowListClass = newClass("RowListControl", "ListControl", function(self, anchor, rect) + self.ListControl(anchor, rect, 14, "HORIZONTAL", false, { }) self.colLabels = true end) diff --git a/src/Export/Classes/ScriptListControl.lua b/src/Export/Classes/ScriptListControl.lua index 2cf1a88d7e..d31b9da997 100644 --- a/src/Export/Classes/ScriptListControl.lua +++ b/src/Export/Classes/ScriptListControl.lua @@ -3,8 +3,8 @@ -- Class: Script List -- Script list control. -- -local ScriptListClass = newClass("ScriptListControl", "ListControl", function(self, anchor, x, y, width, height) - self.ListControl(anchor, x, y, width, height, 16, "VERTICAL", false, main.scriptList) +local ScriptListClass = newClass("ScriptListControl", "ListControl", function(self, anchor, rect) + self.ListControl(anchor, rect, 16, "VERTICAL", false, main.scriptList) end) function ScriptListClass:GetRowValue(column, index, script) diff --git a/src/Export/Classes/SpecColListControl.lua b/src/Export/Classes/SpecColListControl.lua index 6612262a8a..9371234e68 100644 --- a/src/Export/Classes/SpecColListControl.lua +++ b/src/Export/Classes/SpecColListControl.lua @@ -5,8 +5,8 @@ -- local t_remove = table.remove -local SpecColListClass = newClass("SpecColListControl", "ListControl", function(self, anchor, x, y, width, height) - self.ListControl(anchor, x, y, width, height, 14, "VERTICAL", true) +local SpecColListClass = newClass("SpecColListControl", "ListControl", function(self, anchor, rect) + self.ListControl(anchor, rect, 14, "VERTICAL", true) end) function SpecColListClass:GetRowValue(column, index, specCol) diff --git a/src/Export/Main.lua b/src/Export/Main.lua index f7e401ebe3..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,11 +170,11 @@ 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) - self.controls.scriptAll = new("ButtonControl", nil, 270, 10, 100, 18, "Run All", function() + self.controls.scriptAll = new("ButtonControl", nil, {270, 10, 100, 18}, "Run All", function() do -- run stat desc first local errMsg = PLoadModule("Scripts/".."statdesc"..".lua") if errMsg then @@ -192,20 +192,20 @@ function main:Init() end } - self.controls.scriptList = new("ScriptListControl", nil, 270, 35, 100, 300) { + self.controls.scriptList = new("ScriptListControl", nil, {270, 35, 100, 300}) { shown = function() return not self.curDatFile end } - self.controls.scriptOutput = new("TextListControl", nil, 380, 10, 800, 600, nil, self.scriptOutput) { + self.controls.scriptOutput = new("TextListControl", nil, {380, 10, 800, 600}, nil, self.scriptOutput) { shown = function() return not self.curDatFile end } - self.controls.datList = new("DatListControl", nil, 10, 70, 250, function() return self.screenH - 70 end) + self.controls.datList = new("DatListControl", nil, {10, 70, 250, function() return self.screenH - 70 end}) - self.controls.specEditToggle = new("ButtonControl", nil, 270, 10, 100, 18, function() return self.editSpec and "Done <<" or "Edit >>" end, function() + self.controls.specEditToggle = new("ButtonControl", nil, {270, 10, 100, 18}, function() return self.editSpec and "Done <<" or "Edit >>" end, function() self.editSpec = not self.editSpec if self.editSpec then self:SetCurrentCol(1) @@ -215,13 +215,13 @@ function main:Init() return self.curDatFile end } - self.controls.specColList = new("SpecColListControl", {"TOPLEFT",self.controls.specEditToggle,"BOTTOMLEFT"}, 0, 2, 200, 200) { + self.controls.specColList = new("SpecColListControl", {"TOPLEFT",self.controls.specEditToggle,"BOTTOMLEFT"}, {0, 2, 200, 200}) { shown = function() return self.editSpec end } - self.controls.colName = new("EditControl", {"TOPLEFT",self.controls.specColList,"TOPRIGHT"}, 10, 0, 150, 18, nil, nil, nil, nil, function(buf) + self.controls.colName = new("EditControl", {"TOPLEFT",self.controls.specColList,"TOPRIGHT"}, {10, 0, 150, 18}, nil, nil, nil, nil, function(buf) self.curSpecCol.name = buf self.curDatFile:OnSpecChanged() self.controls.rowList:BuildColumns() @@ -235,19 +235,19 @@ function main:Init() end } - self.controls.colType = new("DropDownControl", {"TOPLEFT",self.controls.colName,"BOTTOMLEFT"}, 0, 4, 90, 18, self.typeDrop, function(_, value) + self.controls.colType = new("DropDownControl", {"TOPLEFT",self.controls.colName,"BOTTOMLEFT"}, {0, 4, 90, 18}, self.typeDrop, function(_, value) self.curSpecCol.type = value self.curDatFile:OnSpecChanged() self:UpdateCol() end, "^7Field type in the dat file") - self.controls.colIsList = new("CheckBoxControl", {"TOPLEFT",self.controls.colType,"BOTTOMLEFT"}, 30, 4, 18, "List:", function(state) + self.controls.colIsList = new("CheckBoxControl", {"TOPLEFT",self.controls.colType,"BOTTOMLEFT"}, {30, 4, 18}, "List:", function(state) self.curSpecCol.list = state self.curDatFile:OnSpecChanged() self.controls.rowList:BuildColumns() end) - self.controls.colRefTo = new("EditControl", {"TOPLEFT",self.controls.colType,"BOTTOMLEFT"}, 0, 26, 150, 18, nil, nil, nil, nil, function(buf) + self.controls.colRefTo = new("EditControl", {"TOPLEFT",self.controls.colType,"BOTTOMLEFT"}, {0, 26, 150, 18}, nil, nil, nil, nil, function(buf) self.curSpecCol.refTo = buf self.curDatFile:OnSpecChanged() end) { @@ -257,7 +257,7 @@ function main:Init() end } - self.controls.colWidth = new("EditControl", {"TOPLEFT",self.controls.colRefTo,"BOTTOMLEFT"}, 0, 4, 100, 18, nil, nil, "%D", nil, function(buf) + self.controls.colWidth = new("EditControl", {"TOPLEFT",self.controls.colRefTo,"BOTTOMLEFT"}, {0, 4, 100, 18}, nil, nil, "%D", nil, function(buf) self.curSpecCol.width = m_max(tonumber(buf) or 150, 20) self.controls.rowList:BuildColumns() 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,14 +279,14 @@ 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() self:SetCurrentCol() end) - self.controls.filter = new("EditControl", nil, 270, 0, 800, 18, nil, "^8Filter") { + self.controls.filter = new("EditControl", nil, {270, 0, 800, 18}, nil, "^8Filter") { y = function() return self.editSpec and 240 or 30 end, @@ -299,9 +299,9 @@ function main:Init() end, } self.controls.filter.tooltipText = "Takes a Lua expression that returns true or false for a row.\nE.g. `Id:match(\"test\")` or for a key column, `Col and Col.Id:match(\"test\")`" - self.controls.filterError = new("LabelControl", {"LEFT",self.controls.filter,"RIGHT"}, 4, 2, 0, 14, "") + self.controls.filterError = new("LabelControl", {"LEFT",self.controls.filter,"RIGHT"}, {4, 2, 0, 14}, "") - self.controls.rowList = new("RowListControl", nil, 270, 0, 0, 0) { + self.controls.rowList = new("RowListControl", nil, {270, 0, 0, 0}) { y = function() return self.editSpec and 260 or 50 end, @@ -316,7 +316,7 @@ function main:Init() end } - self.controls.addCol = new("ButtonControl", {"LEFT",self.controls.specEditToggle,"RIGHT"}, 10, 0, 80, 18, "Add", function() + self.controls.addCol = new("ButtonControl", {"LEFT",self.controls.specEditToggle,"RIGHT"}, {10, 0, 80, 18}, "Add", function() self:AddSpecCol() end) { shown = function() @@ -353,8 +353,8 @@ end function main:OpenPathPopup() main:OpenPopup(370, 290, "Manage GGPK versions", { - new("GGPKSourceListControl", nil, 0, 50, 350, 200, self), - new("ButtonControl", nil, 0, 260, 90, 20, "Done", function() + new("GGPKSourceListControl", nil, {0, 50, 350, 200}, self), + new("ButtonControl", nil, {0, 260, 90, 20}, "Done", function() main:ClosePopup() end), }) @@ -730,10 +730,10 @@ function main:OpenMessagePopup(title, msg) local controls = { } local numMsgLines = 0 for line in string.gmatch(msg .. "\n", "([^\n]*)\n") do - t_insert(controls, new("LabelControl", nil, 0, 20 + numMsgLines * 16, 0, 16, line)) + t_insert(controls, new("LabelControl", nil, {0, 20 + numMsgLines * 16, 0, 16}, line)) numMsgLines = numMsgLines + 1 end - controls.close = new("ButtonControl", nil, 0, 40 + numMsgLines * 16, 80, 20, "Ok", function() + controls.close = new("ButtonControl", nil, {0, 40 + numMsgLines * 16, 80, 20}, "Ok", function() main:ClosePopup() end) return self:OpenPopup(m_max(DrawStringWidth(16, "VAR", msg) + 30, 190), 70 + numMsgLines * 16, title, controls, "close") @@ -743,15 +743,15 @@ function main:OpenConfirmPopup(title, msg, confirmLabel, onConfirm) local controls = { } local numMsgLines = 0 for line in string.gmatch(msg .. "\n", "([^\n]*)\n") do - t_insert(controls, new("LabelControl", nil, 0, 20 + numMsgLines * 16, 0, 16, line)) + t_insert(controls, new("LabelControl", nil, {0, 20 + numMsgLines * 16, 0, 16}, line)) numMsgLines = numMsgLines + 1 end local confirmWidth = m_max(80, DrawStringWidth(16, "VAR", confirmLabel) + 10) - controls.confirm = new("ButtonControl", nil, -5 - m_ceil(confirmWidth/2), 40 + numMsgLines * 16, confirmWidth, 20, confirmLabel, function() + controls.confirm = new("ButtonControl", nil, {-5 - m_ceil(confirmWidth/2), 40 + numMsgLines * 16, confirmWidth, 20}, confirmLabel, function() main:ClosePopup() onConfirm() end) - t_insert(controls, new("ButtonControl", nil, 5 + m_ceil(confirmWidth/2), 40 + numMsgLines * 16, confirmWidth, 20, "Cancel", function() + t_insert(controls, new("ButtonControl", nil, {5 + m_ceil(confirmWidth/2), 40 + numMsgLines * 16, confirmWidth, 20}, "Cancel", function() main:ClosePopup() end)) return self:OpenPopup(m_max(DrawStringWidth(16, "VAR", msg) + 30, 190), 70 + numMsgLines * 16, title, controls, "confirm") @@ -759,11 +759,11 @@ end function main:OpenNewFolderPopup(path, onClose) local controls = { } - controls.label = new("LabelControl", nil, 0, 20, 0, 16, "^7Enter folder name:") - controls.edit = new("EditControl", nil, 0, 40, 350, 20, nil, nil, "\\/:%*%?\"<>|%c", 100, function(buf) + controls.label = new("LabelControl", nil, {0, 20, 0, 16}, "^7Enter folder name:") + controls.edit = new("EditControl", nil, {0, 40, 350, 20}, nil, nil, "\\/:%*%?\"<>|%c", 100, function(buf) controls.create.enabled = buf:match("%S") end) - controls.create = new("ButtonControl", nil, -45, 70, 80, 20, "Create", function() + controls.create = new("ButtonControl", nil, {-45, 70, 80, 20}, "Create", function() local newFolderName = controls.edit.buf local res, msg = MakeDir(path..newFolderName) if not res then @@ -776,7 +776,7 @@ function main:OpenNewFolderPopup(path, onClose) main:ClosePopup() end) controls.create.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 onClose then onClose() end diff --git a/src/Modules/Build.lua b/src/Modules/Build.lua index cf0a143713..d5ba8ebe7c 100644 --- a/src/Modules/Build.lua +++ b/src/Modules/Build.lua @@ -77,15 +77,15 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin local miscTooltip = new("Tooltip") -- Controls: top bar, left side - self.anchorTopBarLeft = new("Control", nil, 4, 4, 0, 20) - self.controls.back = new("ButtonControl", {"LEFT",self.anchorTopBarLeft,"RIGHT"}, 0, 0, 60, 20, "<< Back", function() + self.anchorTopBarLeft = new("Control", nil, {4, 4, 0, 20}) + self.controls.back = new("ButtonControl", {"LEFT",self.anchorTopBarLeft,"RIGHT"}, {0, 0, 60, 20}, "<< Back", function() if self.unsaved then self:OpenSavePopup("LIST") else self:CloseBuild() end end) - self.controls.buildName = new("Control", {"LEFT",self.controls.back,"RIGHT"}, 8, 0, 0, 20) + self.controls.buildName = new("Control", {"LEFT",self.controls.back,"RIGHT"}, {8, 0, 0, 20}) self.controls.buildName.width = function(control) local limit = self.anchorTopBarRight:GetPos() - 98 - 40 - self.controls.back:GetSize() - self.controls.save:GetSize() - self.controls.saveAs:GetSize() local bnw = DrawStringWidth(16, "VAR", self.buildName) @@ -116,13 +116,13 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin SetDrawLayer(nil, 0) end end - self.controls.save = new("ButtonControl", {"LEFT",self.controls.buildName,"RIGHT"}, 8, 0, 50, 20, "Save", function() + self.controls.save = new("ButtonControl", {"LEFT",self.controls.buildName,"RIGHT"}, {8, 0, 50, 20}, "Save", function() self:SaveDBFile() end) self.controls.save.enabled = function() return not self.dbFileName or self.unsaved end - self.controls.saveAs = new("ButtonControl", {"LEFT",self.controls.save,"RIGHT"}, 8, 0, 70, 20, "Save As", function() + self.controls.saveAs = new("ButtonControl", {"LEFT",self.controls.save,"RIGHT"}, {8, 0, 70, 20}, "Save As", function() self:OpenSaveAsPopup() end) self.controls.saveAs.enabled = function() @@ -130,8 +130,8 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin end -- Controls: top bar, right side - self.anchorTopBarRight = new("Control", nil, function() return main.screenW / 2 + 6 end, 4, 0, 20) - self.controls.pointDisplay = new("Control", {"LEFT",self.anchorTopBarRight,"RIGHT"}, -12, 0, 0, 20) + self.anchorTopBarRight = new("Control", nil, {function() return main.screenW / 2 + 6 end, 4, 0, 20}) + self.controls.pointDisplay = new("Control", {"LEFT",self.anchorTopBarRight,"RIGHT"}, {-12, 0, 0, 20}) self.controls.pointDisplay.x = function(control) local width, height = control:GetSize() if self.controls.saveAs:GetPos() + self.controls.saveAs:GetSize() < self.anchorTopBarRight:GetPos() - width - 16 then @@ -161,14 +161,14 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin SetDrawLayer(nil, 0) end end - self.controls.levelScalingButton = new("ButtonControl", {"LEFT",self.controls.pointDisplay,"RIGHT"}, 12, 0, 50, 20, self.characterLevelAutoMode and "Auto" or "Manual", function() + self.controls.levelScalingButton = new("ButtonControl", {"LEFT",self.controls.pointDisplay,"RIGHT"}, {12, 0, 50, 20}, self.characterLevelAutoMode and "Auto" or "Manual", function() self.characterLevelAutoMode = not self.characterLevelAutoMode self.controls.levelScalingButton.label = self.characterLevelAutoMode and "Auto" or "Manual" self.configTab:BuildModList() self.modFlag = true self.buildFlag = true end) - self.controls.characterLevel = new("EditControl", {"LEFT",self.controls.levelScalingButton,"RIGHT"}, 8, 0, 106, 20, "", "Level", "%D", 3, function(buf) + self.controls.characterLevel = new("EditControl", {"LEFT",self.controls.levelScalingButton,"RIGHT"}, {8, 0, 106, 20}, "", "Level", "%D", 3, function(buf) self.characterLevel = m_min(m_max(tonumber(buf) or 1, 1), 100) self.configTab:BuildModList() self.modFlag = true @@ -204,7 +204,7 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin end end end - self.controls.classDrop = new("DropDownControl", {"LEFT",self.controls.characterLevel,"RIGHT"}, 8, 0, 100, 20, nil, function(index, value) + self.controls.classDrop = new("DropDownControl", {"LEFT",self.controls.characterLevel,"RIGHT"}, {8, 0, 100, 20}, nil, function(index, value) if value.classId ~= self.spec.curClassId then if self.spec:CountAllocNodes() == 0 or self.spec:IsClassConnected(value.classId) then self.spec:SelectClass(value.classId) @@ -221,20 +221,20 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin end end end) - self.controls.ascendDrop = new("DropDownControl", {"LEFT",self.controls.classDrop,"RIGHT"}, 8, 0, 120, 20, nil, function(index, value) + self.controls.ascendDrop = new("DropDownControl", {"LEFT",self.controls.classDrop,"RIGHT"}, {8, 0, 120, 20}, nil, function(index, value) self.spec:SelectAscendClass(value.ascendClassId) self.spec:AddUndoState() self.spec:SetWindowTitleWithBuildClass() 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) @@ -587,42 +587,42 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin end -- Controls: Side bar - self.anchorSideBar = new("Control", nil, 4, 36, 0, 0) - self.controls.modeImport = new("ButtonControl", {"TOPLEFT",self.anchorSideBar,"TOPLEFT"}, 0, 0, 134, 20, "Import/Export Build", function() + self.anchorSideBar = new("Control", nil, {4, 36, 0, 0}) + self.controls.modeImport = new("ButtonControl", {"TOPLEFT",self.anchorSideBar,"TOPLEFT"}, {0, 0, 134, 20}, "Import/Export Build", function() self.viewMode = "IMPORT" end) self.controls.modeImport.locked = function() return self.viewMode == "IMPORT" end - self.controls.modeNotes = new("ButtonControl", {"LEFT",self.controls.modeImport,"RIGHT"}, 4, 0, 58, 20, "Notes", function() + self.controls.modeNotes = new("ButtonControl", {"LEFT",self.controls.modeImport,"RIGHT"}, {4, 0, 58, 20}, "Notes", function() self.viewMode = "NOTES" end) self.controls.modeNotes.locked = function() return self.viewMode == "NOTES" end - self.controls.modeConfig = new("ButtonControl", {"TOPRIGHT",self.anchorSideBar,"TOPLEFT"}, 300, 0, 100, 20, "Configuration", function() + self.controls.modeConfig = new("ButtonControl", {"TOPRIGHT",self.anchorSideBar,"TOPLEFT"}, {300, 0, 100, 20}, "Configuration", function() self.viewMode = "CONFIG" end) self.controls.modeConfig.locked = function() return self.viewMode == "CONFIG" end - self.controls.modeTree = new("ButtonControl", {"TOPLEFT",self.anchorSideBar,"TOPLEFT"}, 0, 26, 72, 20, "Tree", function() + self.controls.modeTree = new("ButtonControl", {"TOPLEFT",self.anchorSideBar,"TOPLEFT"}, {0, 26, 72, 20}, "Tree", function() self.viewMode = "TREE" end) self.controls.modeTree.locked = function() return self.viewMode == "TREE" end - self.controls.modeSkills = new("ButtonControl", {"LEFT",self.controls.modeTree,"RIGHT"}, 4, 0, 72, 20, "Skills", function() + self.controls.modeSkills = new("ButtonControl", {"LEFT",self.controls.modeTree,"RIGHT"}, {4, 0, 72, 20}, "Skills", function() self.viewMode = "SKILLS" end) self.controls.modeSkills.locked = function() return self.viewMode == "SKILLS" end - self.controls.modeItems = new("ButtonControl", {"LEFT",self.controls.modeSkills,"RIGHT"}, 4, 0, 72, 20, "Items", function() + self.controls.modeItems = new("ButtonControl", {"LEFT",self.controls.modeSkills,"RIGHT"}, {4, 0, 72, 20}, "Items", function() self.viewMode = "ITEMS" end) self.controls.modeItems.locked = function() return self.viewMode == "ITEMS" end - self.controls.modeCalcs = new("ButtonControl", {"LEFT",self.controls.modeItems,"RIGHT"}, 4, 0, 72, 20, "Calcs", function() + self.controls.modeCalcs = new("ButtonControl", {"LEFT",self.controls.modeItems,"RIGHT"}, {4, 0, 72, 20}, "Calcs", function() self.viewMode = "CALCS" end) self.controls.modeCalcs.locked = function() return self.viewMode == "CALCS" end - self.controls.modeParty = new("ButtonControl", {"TOPLEFT",self.anchorSideBar,"TOPLEFT"}, 0, 52, 72, 20, "Party", function() + self.controls.modeParty = new("ButtonControl", {"TOPLEFT",self.anchorSideBar,"TOPLEFT"}, {0, 52, 72, 20}, "Party", function() self.viewMode = "PARTY" end) self.controls.modeParty.locked = function() return self.viewMode == "PARTY" end -- Skills - self.controls.mainSkillLabel = new("LabelControl", {"TOPLEFT",self.anchorSideBar,"TOPLEFT"}, 0, 80, 300, 16, "^7Main Skill:") - self.controls.mainSocketGroup = new("DropDownControl", {"TOPLEFT",self.controls.mainSkillLabel,"BOTTOMLEFT"}, 0, 2, 300, 18, nil, function(index, value) + self.controls.mainSkillLabel = new("LabelControl", {"TOPLEFT",self.anchorSideBar,"TOPLEFT"}, {0, 80, 300, 16}, "^7Main Skill:") + self.controls.mainSocketGroup = new("DropDownControl", {"TOPLEFT",self.controls.mainSkillLabel,"BOTTOMLEFT"}, {0, 2, 300, 18}, nil, function(index, value) self.mainSocketGroup = index self.modFlag = true self.buildFlag = true @@ -634,44 +634,44 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin self.skillsTab:AddSocketGroupTooltip(tooltip, socketGroup) end end - self.controls.mainSkill = new("DropDownControl", {"TOPLEFT",self.controls.mainSocketGroup,"BOTTOMLEFT"}, 0, 2, 300, 18, nil, function(index, value) + self.controls.mainSkill = new("DropDownControl", {"TOPLEFT",self.controls.mainSocketGroup,"BOTTOMLEFT"}, {0, 2, 300, 18}, nil, function(index, value) local mainSocketGroup = self.skillsTab.socketGroupList[self.mainSocketGroup] mainSocketGroup.mainActiveSkill = index self.modFlag = true self.buildFlag = true end) - self.controls.mainSkillPart = new("DropDownControl", {"TOPLEFT",self.controls.mainSkill,"BOTTOMLEFT",true}, 0, 2, 300, 18, nil, function(index, value) + self.controls.mainSkillPart = new("DropDownControl", {"TOPLEFT",self.controls.mainSkill,"BOTTOMLEFT",true}, {0, 2, 300, 18}, nil, function(index, value) local mainSocketGroup = self.skillsTab.socketGroupList[self.mainSocketGroup] local srcInstance = mainSocketGroup.displaySkillList[mainSocketGroup.mainActiveSkill].activeEffect.srcInstance srcInstance.skillPart = index self.modFlag = true self.buildFlag = true end) - self.controls.mainSkillStageCountLabel = new("LabelControl", {"TOPLEFT",self.controls.mainSkillPart,"BOTTOMLEFT",true}, 0, 3, 0, 16, "^7Stages:") { + self.controls.mainSkillStageCountLabel = new("LabelControl", {"TOPLEFT",self.controls.mainSkillPart,"BOTTOMLEFT",true}, {0, 3, 0, 16}, "^7Stages:") { shown = function() return self.controls.mainSkillStageCount:IsShown() end, } - self.controls.mainSkillStageCount = new("EditControl", {"LEFT",self.controls.mainSkillStageCountLabel,"RIGHT",true}, 2, 0, 60, 18, nil, nil, "%D", nil, function(buf) + self.controls.mainSkillStageCount = new("EditControl", {"LEFT",self.controls.mainSkillStageCountLabel,"RIGHT",true}, {2, 0, 60, 18}, nil, nil, "%D", nil, function(buf) local mainSocketGroup = self.skillsTab.socketGroupList[self.mainSocketGroup] local srcInstance = mainSocketGroup.displaySkillList[mainSocketGroup.mainActiveSkill].activeEffect.srcInstance srcInstance.skillStageCount = tonumber(buf) self.modFlag = true self.buildFlag = true end) - self.controls.mainSkillMineCountLabel = new("LabelControl", {"TOPLEFT",self.controls.mainSkillStageCountLabel,"BOTTOMLEFT",true}, 0, 3, 0, 16, "^7Active Mines:") { + self.controls.mainSkillMineCountLabel = new("LabelControl", {"TOPLEFT",self.controls.mainSkillStageCountLabel,"BOTTOMLEFT",true}, {0, 3, 0, 16}, "^7Active Mines:") { shown = function() return self.controls.mainSkillMineCount:IsShown() end, } - self.controls.mainSkillMineCount = new("EditControl", {"LEFT",self.controls.mainSkillMineCountLabel,"RIGHT",true}, 2, 0, 60, 18, nil, nil, "%D", nil, function(buf) + self.controls.mainSkillMineCount = new("EditControl", {"LEFT",self.controls.mainSkillMineCountLabel,"RIGHT",true}, {2, 0, 60, 18}, nil, nil, "%D", nil, function(buf) local mainSocketGroup = self.skillsTab.socketGroupList[self.mainSocketGroup] local srcInstance = mainSocketGroup.displaySkillList[mainSocketGroup.mainActiveSkill].activeEffect.srcInstance srcInstance.skillMineCount = tonumber(buf) self.modFlag = true self.buildFlag = true end) - self.controls.mainSkillMinion = new("DropDownControl", {"TOPLEFT",self.controls.mainSkillMineCountLabel,"BOTTOMLEFT",true}, 0, 3, 178, 18, nil, function(index, value) + self.controls.mainSkillMinion = new("DropDownControl", {"TOPLEFT",self.controls.mainSkillMineCountLabel,"BOTTOMLEFT",true}, {0, 3, 178, 18}, nil, function(index, value) local mainSocketGroup = self.skillsTab.socketGroupList[self.mainSocketGroup] local srcInstance = mainSocketGroup.displaySkillList[mainSocketGroup.mainActiveSkill].activeEffect.srcInstance if value.itemSetId then @@ -700,24 +700,24 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin tooltip:AddLine(14, colorCodes.TIP.."Tip: You can drag items from the Items tab onto this dropdown to equip them onto the minion.") end end - self.controls.mainSkillMinionLibrary = new("ButtonControl", {"LEFT",self.controls.mainSkillMinion,"RIGHT"}, 2, 0, 120, 18, "Manage Spectres...", function() + self.controls.mainSkillMinionLibrary = new("ButtonControl", {"LEFT",self.controls.mainSkillMinion,"RIGHT"}, {2, 0, 120, 18}, "Manage Spectres...", function() self:OpenSpectreLibrary() end) - self.controls.mainSkillMinionSkill = new("DropDownControl", {"TOPLEFT",self.controls.mainSkillMinion,"BOTTOMLEFT",true}, 0, 2, 200, 16, nil, function(index, value) + self.controls.mainSkillMinionSkill = new("DropDownControl", {"TOPLEFT",self.controls.mainSkillMinion,"BOTTOMLEFT",true}, {0, 2, 200, 16}, nil, function(index, value) local mainSocketGroup = self.skillsTab.socketGroupList[self.mainSocketGroup] local srcInstance = mainSocketGroup.displaySkillList[mainSocketGroup.mainActiveSkill].activeEffect.srcInstance srcInstance.skillMinionSkill = index self.modFlag = true self.buildFlag = true end) - self.controls.statBoxAnchor = new("Control", {"TOPLEFT",self.controls.mainSkillMinionSkill,"BOTTOMLEFT",true}, 0, 2, 0, 0) - self.controls.statBox = new("TextListControl", {"TOPLEFT",self.controls.statBoxAnchor,"BOTTOMLEFT"}, 0, 2, 300, 0, {{x=170,align="RIGHT_X"},{x=174,align="LEFT"}}) + self.controls.statBoxAnchor = new("Control", {"TOPLEFT",self.controls.mainSkillMinionSkill,"BOTTOMLEFT",true}, {0, 2, 0, 0}) + self.controls.statBox = new("TextListControl", {"TOPLEFT",self.controls.statBoxAnchor,"BOTTOMLEFT"}, {0, 2, 300, 0}, {{x=170,align="RIGHT_X"},{x=174,align="LEFT"}}) self.controls.statBox.height = function(control) local x, y = control:GetPos() local warnHeight = main.showWarnings and #self.controls.warnings.lines > 0 and 18 or 0 return main.screenH - main.mainBarHeight - 4 - y - warnHeight end - self.controls.warnings = new("Control",{"TOPLEFT",self.controls.statBox,"BOTTOMLEFT",true}, 0, 0, 0, 18) + self.controls.warnings = new("Control",{"TOPLEFT",self.controls.statBox,"BOTTOMLEFT",true}, {0, 0, 0, 18}) self.controls.warnings.lines = {} self.controls.warnings.width = function(control) return control.str and DrawStringWidth(16, "FIXED", control.str) + 8 or 0 @@ -1378,24 +1378,24 @@ end function buildMode:OpenConversionPopup() local controls = { } local currentVersion = treeVersions[latestTreeVersion].display - controls.note = new("LabelControl", nil, 0, 20, 0, 16, colorCodes.TIP..[[ + controls.note = new("LabelControl", nil, {0, 20, 0, 16}, colorCodes.TIP..[[ Info:^7 You are trying to load a build created for a version of Path of Exile that is not supported by us. You will have to convert it to the current game version to load it. To use a build newer than the current supported game version, you may have to update. To use a build older than the current supported game version, we recommend loading it in an older version of Path of Building Community instead. ]]) - controls.label = new("LabelControl", nil, 0, 110, 0, 16, colorCodes.WARNING..[[ + controls.label = new("LabelControl", nil, {0, 110, 0, 16}, colorCodes.WARNING..[[ Warning:^7 Converting a build to a different game version may have side effects. For example, if the passive tree has changed, then some passives may be deallocated. You should create a backup copy of the build before proceeding. ]]) - controls.convert = new("ButtonControl", nil, -40, 170, 120, 20, "Convert to ".. currentVersion, function() + controls.convert = new("ButtonControl", nil, {-40, 170, 120, 20}, "Convert to ".. currentVersion, function() main:ClosePopup() self:Shutdown() self:Init(self.dbFileName, self.buildName, nil, true) end) - controls.cancel = new("ButtonControl", nil, 60, 170, 70, 20, "Cancel", function() + controls.cancel = new("ButtonControl", nil, {60, 170, 70, 20}, "Cancel", function() main:ClosePopup() self:CloseBuild() end) @@ -1409,13 +1409,13 @@ function buildMode:OpenSavePopup(mode) ["UPDATE"] = "before updating?", } local controls = { } - controls.label = new("LabelControl", nil, 0, 20, 0, 16, "^7This build has unsaved changes.\nDo you want to save them "..modeDesc[mode]) - controls.save = new("ButtonControl", nil, -90, 70, 80, 20, "Save", function() + controls.label = new("LabelControl", nil, {0, 20, 0, 16}, "^7This build has unsaved changes.\nDo you want to save them "..modeDesc[mode]) + controls.save = new("ButtonControl", nil, {-90, 70, 80, 20}, "Save", function() main:ClosePopup() self.actionOnSave = mode self:SaveDBFile() end) - controls.noSave = new("ButtonControl", nil, 0, 70, 80, 20, "Don't Save", function() + controls.noSave = new("ButtonControl", nil, {0, 70, 80, 20}, "Don't Save", function() main:ClosePopup() if mode == "LIST" then self:CloseBuild() @@ -1425,7 +1425,7 @@ function buildMode:OpenSavePopup(mode) launch:ApplyUpdate(launch.updateAvailable) end end) - controls.close = new("ButtonControl", nil, 90, 70, 80, 20, "Cancel", function() + controls.close = new("ButtonControl", nil, {90, 70, 80, 20}, "Cancel", function() main:ClosePopup() end) main:OpenPopup(300, 100, "Save Changes", controls) @@ -1448,23 +1448,23 @@ function buildMode:OpenSaveAsPopup() end 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.label = new("LabelControl", nil, {0, 20, 0, 16}, "^7Enter new build name:") + controls.edit = new("EditControl", nil, {0, 40, 450, 20}, (self.buildName or self.dbFileName):gsub("[\\/:%*%?\"<>|%c]", "-"), nil, "\\/:%*%?\"<>|%c", 100, function(buf) updateBuildName() end) - controls.folderLabel = new("LabelControl", {"TOPLEFT",nil,"TOPLEFT"}, 10, 70, 0, 16, "^7Folder:") - controls.newFolder = new("ButtonControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 67, 94, 20, "New Folder...", function() + controls.folderLabel = new("LabelControl", {"TOPLEFT",nil,"TOPLEFT"}, {10, 70, 0, 16}, "^7Folder:") + controls.newFolder = new("ButtonControl", {"TOPLEFT",nil,"TOPLEFT"}, {100, 67, 94, 20}, "New Folder...", function() main:OpenNewFolderPopup(main.buildPath..controls.folder.subPath, function(newFolderName) if newFolderName then controls.folder:OpenFolder(newFolderName) end end) end) - controls.folder = new("FolderListControl", nil, 0, 115, 450, 100, self.dbFileSubPath, function(subPath) + controls.folder = new("FolderListControl", nil, {0, 115, 450, 100}, self.dbFileSubPath, function(subPath) updateBuildName() end) - controls.save = new("ButtonControl", nil, -45, 225, 80, 20, "Save", function() + controls.save = new("ButtonControl", nil, {-45, 225, 80, 20}, "Save", function() main:ClosePopup() self.dbFileName = newFileName self.buildName = newBuildName @@ -1472,7 +1472,7 @@ function buildMode:OpenSaveAsPopup() self:SaveDBFile() self.spec:SetWindowTitleWithBuildClass() end) - controls.close = new("ButtonControl", nil, 45, 225, 80, 20, "Cancel", function() + controls.close = new("ButtonControl", nil, {45, 225, 80, 20}, "Cancel", function() main:ClosePopup() self.actionOnSave = nil end) @@ -1502,19 +1502,19 @@ function buildMode:OpenSpectreLibrary() end 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.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() self.spectreList = destList self.modFlag = true self.buildFlag = true main:ClosePopup() end) - controls.cancel = new("ButtonControl", nil, 45, 330, 80, 20, "Cancel", function() + controls.cancel = new("ButtonControl", nil, {45, 330, 80, 20}, "Cancel", function() main:ClosePopup() end) - controls.noteLine1 = new("LabelControl", {"TOPLEFT",controls.list,"BOTTOMLEFT"}, 24, 2, 0, 16, "Spectres in your Library must be assigned to an active") - controls.noteLine2 = new("LabelControl", {"TOPLEFT",controls.list,"BOTTOMLEFT"}, 20, 18, 0, 16, "Raise Spectre gem for their buffs and curses to activate") + controls.noteLine1 = new("LabelControl", {"TOPLEFT",controls.list,"BOTTOMLEFT"}, {24, 2, 0, 16}, "Spectres in your Library must be assigned to an active") + controls.noteLine2 = new("LabelControl", {"TOPLEFT",controls.list,"BOTTOMLEFT"}, {20, 18, 0, 16}, "Raise Spectre gem for their buffs and curses to activate") local spectrePopup = main:OpenPopup(410, 360, "Spectre Library", controls) spectrePopup:SelectControl(spectrePopup.controls.source.controls.searchText) end @@ -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 83fac2dd57..cd60417822 100644 --- a/src/Modules/BuildList.lua +++ b/src/Modules/BuildList.lua @@ -32,7 +32,7 @@ function listMode:Init(selBuildName, subPath) return end - self.anchor = new("Control", nil, 0, 4, 0, 0) + self.anchor = new("Control", nil, {0, 4, 0, 0}) self.anchor.x = function() return main.screenW / 2 end @@ -40,34 +40,34 @@ function listMode:Init(selBuildName, subPath) self.subPath = subPath or "" self.list = { } - self.controls.new = new("ButtonControl", {"TOP",self.anchor,"TOP"}, -259, 0, 60, 20, "New", function() + self.controls.new = new("ButtonControl", {"TOP",self.anchor,"TOP"}, {-259, 0, 60, 20}, "New", function() main:SetMode("BUILD", false, "Unnamed build") end) - self.controls.newFolder = new("ButtonControl", {"LEFT",self.controls.new,"RIGHT"}, 8, 0, 90, 20, "New Folder", function() + self.controls.newFolder = new("ButtonControl", {"LEFT",self.controls.new,"RIGHT"}, {8, 0, 90, 20}, "New Folder", function() self.controls.buildList:NewFolder() end) - self.controls.open = new("ButtonControl", {"LEFT",self.controls.newFolder,"RIGHT"}, 8, 0, 60, 20, "Open", function() + self.controls.open = new("ButtonControl", {"LEFT",self.controls.newFolder,"RIGHT"}, {8, 0, 60, 20}, "Open", function() self.controls.buildList:LoadBuild(self.controls.buildList.selValue) end) self.controls.open.enabled = function() return self.controls.buildList.selValue ~= nil end - self.controls.copy = new("ButtonControl", {"LEFT",self.controls.open,"RIGHT"}, 8, 0, 60, 20, "Copy", function() + self.controls.copy = new("ButtonControl", {"LEFT",self.controls.open,"RIGHT"}, {8, 0, 60, 20}, "Copy", function() self.controls.buildList:RenameBuild(self.controls.buildList.selValue, true) end) self.controls.copy.enabled = function() return self.controls.buildList.selValue ~= nil end - self.controls.rename = new("ButtonControl", {"LEFT",self.controls.copy,"RIGHT"}, 8, 0, 60, 20, "Rename", function() + self.controls.rename = new("ButtonControl", {"LEFT",self.controls.copy,"RIGHT"}, {8, 0, 60, 20}, "Rename", function() self.controls.buildList:RenameBuild(self.controls.buildList.selValue) end) self.controls.rename.enabled = function() return self.controls.buildList.selValue ~= nil end - self.controls.delete = new("ButtonControl", {"LEFT",self.controls.rename,"RIGHT"}, 8, 0, 60, 20, "Delete", function() + self.controls.delete = new("ButtonControl", {"LEFT",self.controls.rename,"RIGHT"}, {8, 0, 60, 20}, "Delete", function() self.controls.buildList:DeleteBuild(self.controls.buildList.selValue) end) self.controls.delete.enabled = function() return self.controls.buildList.selValue ~= nil end - self.controls.sort = new("DropDownControl", {"LEFT",self.controls.delete,"RIGHT"}, 8, 0, 140, 20, buildSortDropList, function(index, value) + self.controls.sort = new("DropDownControl", {"LEFT",self.controls.delete,"RIGHT"}, {8, 0, 140, 20}, buildSortDropList, function(index, value) main.buildSortMode = value.sortMode self:SortList() end) self.controls.sort:SelByValue(main.buildSortMode, "sortMode") - self.controls.buildList = new("BuildListControl", {"TOP",self.anchor,"TOP"}, 0, 75, 900, 0, self) + self.controls.buildList = new("BuildListControl", {"TOP",self.anchor,"TOP"}, {0, 75, 900, 0}, self) self.controls.buildList.height = function() return main.screenH - 80 end @@ -97,7 +97,7 @@ function listMode:Init(selBuildName, subPath) self.controls.ExtBuildList = self:getPublicBuilds() end - self.controls.searchText = new("EditControl", {"TOP",self.anchor,"TOP"}, 0, 25, 640, 20, self.filterBuildList, "Search", "%c%(%)", 100, function(buf) + self.controls.searchText = new("EditControl", {"TOP",self.anchor,"TOP"}, {0, 25, 640, 20}, self.filterBuildList, "Search", "%c%(%)", 100, function(buf) main.filterBuildList = buf self:BuildList() end, nil, nil, true) @@ -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 7d20e734f5..a3c93a0bea 100644 --- a/src/Modules/Main.lua +++ b/src/Modules/Main.lua @@ -179,23 +179,23 @@ function main:Init() self.defaultItemAffixQuality = saved end - self.anchorMain = new("Control", nil, 4, 0, 0, 0) + self.anchorMain = new("Control", nil, {4, 0, 0, 0}) self.anchorMain.y = function() return self.screenH - 4 end - self.controls.options = new("ButtonControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, 0, 0, 68, 20, "Options", function() + self.controls.options = new("ButtonControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, {0, 0, 68, 20}, "Options", function() self:OpenOptionsPopup() end) - self.controls.about = new("ButtonControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, 72, 0, 68, 20, "About", function() + self.controls.about = new("ButtonControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, {72, 0, 68, 20}, "About", function() self:OpenAboutPopup() end) - self.controls.applyUpdate = new("ButtonControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, 0, -24, 140, 20, "^x50E050Update Ready", function() + self.controls.applyUpdate = new("ButtonControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, {0, -24, 140, 20}, "^x50E050Update Ready", function() self:OpenUpdatePopup() end) self.controls.applyUpdate.shown = function() return launch.updateAvailable and launch.updateAvailable ~= "none" end - self.controls.checkUpdate = new("ButtonControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, 0, -24, 140, 20, "", function() + self.controls.checkUpdate = new("ButtonControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, {0, -24, 140, 20}, "", function() launch:CheckForUpdate() end) self.controls.checkUpdate.shown = function() @@ -207,19 +207,19 @@ function main:Init() self.controls.checkUpdate.enabled = function() return not launch.updateCheckRunning end - self.controls.forkLabel = new("LabelControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, 148, -26, 0, 16, "") + self.controls.forkLabel = new("LabelControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, {148, -26, 0, 16}, "") self.controls.forkLabel.label = function() return "^8PoB Community Fork" end - self.controls.versionLabel = new("LabelControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, 148, -2, 0, 16, "") + self.controls.versionLabel = new("LabelControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, {148, -2, 0, 16}, "") self.controls.versionLabel.label = function() return "^8Version: "..launch.versionNumber..(launch.versionBranch == "dev" and " (Dev)" or launch.versionBranch == "beta" and " (Beta)" or "") end - self.controls.devMode = new("LabelControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, 0, -26, 0, 20, colorCodes.NEGATIVE.."Dev Mode") + self.controls.devMode = new("LabelControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, {0, -26, 0, 20}, colorCodes.NEGATIVE.."Dev Mode") self.controls.devMode.shown = function() return launch.devMode end - self.controls.dismissToast = new("ButtonControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, 0, function() return -self.mainBarHeight + self.toastHeight end, 80, 20, "Dismiss", function() + self.controls.dismissToast = new("ButtonControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, {0, function() return -self.mainBarHeight + self.toastHeight end, 80, 20}, "Dismiss", function() self.toastMode = "HIDING" self.toastStart = GetTime() end) @@ -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") @@ -798,9 +798,9 @@ function main:OpenOptionsPopup() -- local func to make a new section header local function drawSectionHeader(id, title, omitHorizontalLine) local headerBGColor ={ .6, .6, .6} - controls["section-"..id .. "-bg"] = new("RectangleOutlineControl", { "TOPLEFT", nil, "TOPLEFT" }, 8, currentY, popupWidth - 17, 26, headerBGColor, 1) + controls["section-"..id .. "-bg"] = new("RectangleOutlineControl", { "TOPLEFT", nil, "TOPLEFT" }, { 8, currentY, popupWidth - 17, 26 }, headerBGColor, 1) nextRow(.2) - controls["section-"..id .. "-label"] = new("LabelControl", { "TOPLEFT", nil, "TOPLEFT" }, popupWidth / 2 - 60, currentY, 0, 16, "^7" .. title) + controls["section-"..id .. "-label"] = new("LabelControl", { "TOPLEFT", nil, "TOPLEFT" }, { popupWidth / 2 - 60, currentY, 0, 16 }, "^7" .. title) nextRow(1.5) end @@ -809,25 +809,25 @@ function main:OpenOptionsPopup() drawSectionHeader("app", "Application options") - controls.connectionProtocol = new("DropDownControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 100, 18, { + controls.connectionProtocol = new("DropDownControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 100, 18 }, { { label = "Auto", protocol = 0 }, { label = "IPv4", protocol = 1 }, { label = "IPv6", protocol = 2 }, }, function(index, value) self.connectionProtocol = value.protocol end) - controls.connectionProtocolLabel = new("LabelControl", { "RIGHT", controls.connectionProtocol, "LEFT" }, defaultLabelSpacingPx, 0, 0, 16, "^7Connection Protocol:") + controls.connectionProtocolLabel = new("LabelControl", { "RIGHT", controls.connectionProtocol, "LEFT" }, { defaultLabelSpacingPx, 0, 0, 16 }, "^7Connection Protocol:") controls.connectionProtocol.tooltipText = "Changes which protocol is used when downloading updates and importing builds." controls.connectionProtocol:SelByValue(launch.connectionProtocol, "protocol") nextRow() - controls.proxyType = new("DropDownControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 80, 18, { + controls.proxyType = new("DropDownControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 80, 18 }, { { label = "HTTP", scheme = "http" }, { label = "SOCKS", scheme = "socks5" }, { label = "SOCKS5H", scheme = "socks5h" }, }) - controls.proxyLabel = new("LabelControl", { "RIGHT", controls.proxyType, "LEFT" }, defaultLabelSpacingPx, 0, 0, 16, "^7Proxy server:") - controls.proxyURL = new("EditControl", { "LEFT", controls.proxyType, "RIGHT" }, 4, 0, 206, 18) + controls.proxyLabel = new("LabelControl", { "RIGHT", controls.proxyType, "LEFT" }, { defaultLabelSpacingPx, 0, 0, 16 }, "^7Proxy server:") + controls.proxyURL = new("EditControl", { "LEFT", controls.proxyType, "RIGHT" }, { 4, 0, 206, 18 }) if launch.proxyURL then local scheme, url = launch.proxyURL:match("(%w+)://(.+)") @@ -836,139 +836,140 @@ function main:OpenOptionsPopup() end nextRow() - controls.buildPath = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 290, 18) - controls.buildPathLabel = new("LabelControl", { "RIGHT", controls.buildPath, "LEFT" }, defaultLabelSpacingPx, 0, 0, 16, "^7Build save path:") + controls.buildPath = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 290, 18 }) + controls.buildPathLabel = new("LabelControl", { "RIGHT", controls.buildPath, "LEFT" }, { defaultLabelSpacingPx, 0, 0, 16 }, "^7Build save path:") if self.buildPath ~= self.defaultBuildPath then controls.buildPath:SetText(self.buildPath) end controls.buildPath.tooltipText = "Overrides the default save location for builds.\nThe default location is: '"..self.defaultBuildPath.."'" nextRow() - controls.nodePowerTheme = new("DropDownControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 100, 18, { + controls.nodePowerTheme = new("DropDownControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 100, 18 }, { { label = "Red & Blue", theme = "RED/BLUE" }, { label = "Red & Green", theme = "RED/GREEN" }, { label = "Green & Blue", theme = "GREEN/BLUE" }, }, function(index, value) self.nodePowerTheme = value.theme end) - controls.nodePowerThemeLabel = new("LabelControl", { "RIGHT", controls.nodePowerTheme, "LEFT" }, defaultLabelSpacingPx, 0, 0, 16, "^7Node Power colours:") + controls.nodePowerThemeLabel = new("LabelControl", { "RIGHT", controls.nodePowerTheme, "LEFT" }, { defaultLabelSpacingPx, 0, 0, 16 }, "^7Node Power colours:") controls.nodePowerTheme.tooltipText = "Changes the colour scheme used for the node power display on the passive tree." controls.nodePowerTheme:SelByValue(self.nodePowerTheme, "theme") nextRow() - controls.colorPositive = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 100, 18, tostring(self.colorPositive:gsub('^(^)', '0')), nil, nil, 8, function(buf) + controls.colorPositive = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 100, 18 }, tostring(self.colorPositive:gsub('^(^)', '0')), nil, nil, 8, function(buf) local match = string.match(buf, "0x%x+") if match and #match == 8 then updateColorCode("POSITIVE", buf) self.colorPositive = buf end end) - controls.colorPositiveLabel = new("LabelControl", { "RIGHT", controls.colorPositive, "LEFT" }, defaultLabelSpacingPx, 0, 0, 16, "^7Hex colour for positive values:") + controls.colorPositiveLabel = new("LabelControl", { "RIGHT", controls.colorPositive, "LEFT" }, { defaultLabelSpacingPx, 0, 0, 16 }, "^7Hex colour for positive values:") controls.colorPositive.tooltipText = "Overrides the default hex colour for positive values in breakdowns. \nExpected format is 0x000000. " .. "The default value is " .. tostring(defaultColorCodes.POSITIVE:gsub('^(^)', '0')) .. ".\nIf updating while inside a build, please re-load the build after saving." nextRow() - controls.colorNegative = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 100, 18, tostring(self.colorNegative:gsub('^(^)', '0')), nil, nil, 8, function(buf) + controls.colorNegative = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 100, 18 }, tostring(self.colorNegative:gsub('^(^)', '0')), nil, nil, 8, function(buf) local match = string.match(buf, "0x%x+") if match and #match == 8 then updateColorCode("NEGATIVE", buf) self.colorNegative = buf end end) - controls.colorNegativeLabel = new("LabelControl", { "RIGHT", controls.colorNegative, "LEFT" }, defaultLabelSpacingPx, 0, 0, 16, "^7Hex colour for negative values:") + controls.colorNegativeLabel = new("LabelControl", { "RIGHT", controls.colorNegative, "LEFT" }, { defaultLabelSpacingPx, 0, 0, 16 }, "^7Hex colour for negative values:") controls.colorNegative.tooltipText = "Overrides the default hex colour for negative values in breakdowns. \nExpected format is 0x000000. " .. "The default value is " .. tostring(defaultColorCodes.NEGATIVE:gsub('^(^)', '0')) .. ".\nIf updating while inside a build, please re-load the build after saving." nextRow() - controls.colorHighlight = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 100, 18, tostring(self.colorHighlight:gsub('^(^)', '0')), nil, nil, 8, function(buf) + + controls.colorHighlight = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 100, 18 }, tostring(self.colorHighlight:gsub('^(^)', '0')), nil, nil, 8, function(buf) local match = string.match(buf, "0x%x+") if match and #match == 8 then updateColorCode("HIGHLIGHT", buf) self.colorHighlight = buf end end) - controls.colorHighlightLabel = new("LabelControl", { "RIGHT", controls.colorHighlight, "LEFT" }, defaultLabelSpacingPx, 0, 0, 16, "^7Hex colour for highlight nodes:") + controls.colorHighlightLabel = new("LabelControl", { "RIGHT", controls.colorHighlight, "LEFT" }, { defaultLabelSpacingPx, 0, 0, 16 }, "^7Hex colour for highlight nodes:") controls.colorHighlight.tooltipText = "Overrides the default hex colour for highlighting nodes in passive tree search. \nExpected format is 0x000000. " .. "The default value is " .. tostring(defaultColorCodes.HIGHLIGHT:gsub('^(^)', '0')) .."\nIf updating while inside a build, please re-load the build after saving." nextRow() - controls.betaTest = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 20, "^7Opt-in to weekly beta test builds:", function(state) + controls.betaTest = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Opt-in to weekly beta test builds:", function(state) self.betaTest = state end) nextRow() - controls.edgeSearchHighlight = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 20, "^7Show search circles at viewport edge", function(state) + controls.edgeSearchHighlight = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20}, "^7Show search circles at viewport edge", function(state) self.edgeSearchHighlight = state end) nextRow() - controls.showPublicBuilds = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 20, "^7Show Latest/Trending builds:", function(state) + controls.showPublicBuilds = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Show Latest/Trending builds:", function(state) self.showPublicBuilds = state end) nextRow() drawSectionHeader("build", "Build-related options") - controls.showThousandsSeparators = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT"}, defaultLabelPlacementX, currentY, 20, "^7Show thousands separators:", function(state) + controls.showThousandsSeparators = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT"}, { defaultLabelPlacementX, currentY, 20 }, "^7Show thousands separators:", function(state) self.showThousandsSeparators = state end) controls.showThousandsSeparators.state = self.showThousandsSeparators nextRow() - controls.thousandsSeparator = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 30, 20, self.thousandsSeparator, nil, "%w", 1, function(buf) + controls.thousandsSeparator = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 30, 20 }, self.thousandsSeparator, nil, "%w", 1, function(buf) self.thousandsSeparator = buf end) - controls.thousandsSeparatorLabel = new("LabelControl", { "RIGHT", controls.thousandsSeparator, "LEFT" }, defaultLabelSpacingPx, 0, 92, 16, "^7Thousands separator:") + controls.thousandsSeparatorLabel = new("LabelControl", { "RIGHT", controls.thousandsSeparator, "LEFT" }, { defaultLabelSpacingPx, 0, 92, 16 }, "^7Thousands separator:") nextRow() - controls.decimalSeparator = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 30, 20, self.decimalSeparator, nil, "%w", 1, function(buf) + controls.decimalSeparator = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 30, 20 }, self.decimalSeparator, nil, "%w", 1, function(buf) self.decimalSeparator = buf end) - controls.decimalSeparatorLabel = new("LabelControl", { "RIGHT", controls.decimalSeparator, "LEFT" }, defaultLabelSpacingPx, 0, 92, 16, "^7Decimal separator:") + controls.decimalSeparatorLabel = new("LabelControl", { "RIGHT", controls.decimalSeparator, "LEFT" }, { defaultLabelSpacingPx, 0, 92, 16 }, "^7Decimal separator:") nextRow() - controls.titlebarName = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 20, "^7Show build name in window title:", function(state) + controls.titlebarName = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Show build name in window title:", function(state) self.showTitlebarName = state end) nextRow() - controls.defaultGemQuality = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 80, 20, self.defaultGemQuality, nil, "%D", 2, function(gemQuality) + controls.defaultGemQuality = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 80, 20 }, self.defaultGemQuality, nil, "%D", 2, function(gemQuality) self.defaultGemQuality = m_min(tonumber(gemQuality) or 0, 23) end) controls.defaultGemQuality.tooltipText = "Set the default quality that can be overwritten by build-related quality settings in the skill panel." - controls.defaultGemQualityLabel = new("LabelControl", { "RIGHT", controls.defaultGemQuality, "LEFT" }, defaultLabelSpacingPx, 0, 0, 16, "^7Default gem quality:") + controls.defaultGemQualityLabel = new("LabelControl", { "RIGHT", controls.defaultGemQuality, "LEFT" }, { defaultLabelSpacingPx, 0, 0, 16 }, "^7Default gem quality:") nextRow() - controls.defaultCharLevel = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 80, 20, self.defaultCharLevel, nil, "%D", 3, function(charLevel) + controls.defaultCharLevel = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 80, 20 }, self.defaultCharLevel, nil, "%D", 3, function(charLevel) self.defaultCharLevel = m_min(m_max(tonumber(charLevel) or 1, 1), 100) end) controls.defaultCharLevel.tooltipText = "Set the default level of your builds. If this is higher than 1, manual level mode will be enabled by default in new builds." - controls.defaultCharLevelLabel = new("LabelControl", { "RIGHT", controls.defaultCharLevel, "LEFT" }, defaultLabelSpacingPx, 0, 0, 16, "^7Default character level:") + controls.defaultCharLevelLabel = new("LabelControl", { "RIGHT", controls.defaultCharLevel, "LEFT" }, { defaultLabelSpacingPx, 0, 0, 16 }, "^7Default character level:") nextRow() - controls.defaultItemAffixQualitySlider = new("SliderControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 200, 20, function(value) + controls.defaultItemAffixQualitySlider = new("SliderControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 200, 20 }, function(value) self.defaultItemAffixQuality = round(value, 2) controls.defaultItemAffixQualityValue.label = (self.defaultItemAffixQuality * 100) .. "%" end) - controls.defaultItemAffixQualityLabel = new("LabelControl", { "RIGHT", controls.defaultItemAffixQualitySlider, "LEFT" }, defaultLabelSpacingPx, 0, 92, 16, "^7Default item affix quality:") - controls.defaultItemAffixQualityValue = new("LabelControl", { "LEFT", controls.defaultItemAffixQualitySlider, "RIGHT" }, -defaultLabelSpacingPx, 0, 92, 16, "50%") + controls.defaultItemAffixQualityLabel = new("LabelControl", { "RIGHT", controls.defaultItemAffixQualitySlider, "LEFT" }, { defaultLabelSpacingPx, 0, 92, 16 }, "^7Default item affix quality:") + controls.defaultItemAffixQualityValue = new("LabelControl", { "LEFT", controls.defaultItemAffixQualitySlider, "RIGHT" }, { -defaultLabelSpacingPx, 0, 92, 16 }, "50%") controls.defaultItemAffixQualitySlider.val = self.defaultItemAffixQuality controls.defaultItemAffixQualityValue.label = (self.defaultItemAffixQuality * 100) .. "%" nextRow() - controls.showWarnings = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 20, "^7Show build warnings:", function(state) + controls.showWarnings = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Show build warnings:", function(state) self.showWarnings = state end) controls.showWarnings.state = self.showWarnings nextRow() - controls.slotOnlyTooltips = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 20, "^7Show tooltips only for affected slots:", function(state) + controls.slotOnlyTooltips = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Show tooltips only for affected slots:", function(state) self.slotOnlyTooltips = state end) controls.slotOnlyTooltips.state = self.slotOnlyTooltips nextRow() - controls.invertSliderScrollDirection = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 20, "^7Invert slider scroll direction:", function(state) + controls.invertSliderScrollDirection = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Invert slider scroll direction:", function(state) self.invertSliderScrollDirection = state end) controls.invertSliderScrollDirection.tooltipText = "Default scroll direction is:\nScroll Up = Move right\nScroll Down = Move left" @@ -976,7 +977,7 @@ function main:OpenOptionsPopup() if launch.devMode then nextRow() - controls.disableDevAutoSave = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 20, "^7Disable Dev AutoSave:", function(state) + controls.disableDevAutoSave = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Disable Dev AutoSave:", function(state) self.disableDevAutoSave = state end) controls.disableDevAutoSave.tooltipText = "Do not Autosave builds while on Dev branch" @@ -1009,7 +1010,7 @@ function main:OpenOptionsPopup() -- last line with buttons has more spacing nextRow(1.5) - controls.save = new("ButtonControl", nil, -45, currentY, 80, 20, "Save", function() + controls.save = new("ButtonControl", nil, {-45, currentY, 80, 20}, "Save", function() launch.connectionProtocol = tonumber(self.connectionProtocol) if controls.proxyURL.buf:match("%w") then launch.proxyURL = controls.proxyType.list[controls.proxyType.selIndex].scheme .. "://" .. controls.proxyURL.buf @@ -1033,7 +1034,7 @@ function main:OpenOptionsPopup() main:ClosePopup() main:SaveSettings() end) - controls.cancel = new("ButtonControl", nil, 45, currentY, 80, 20, "Cancel", function() + controls.cancel = new("ButtonControl", nil, {45, currentY, 80, 20}, "Cancel", function() self.nodePowerTheme = initialNodePowerTheme self.colorPositive = initialColorPositive updateColorCode("POSITIVE", self.colorPositive) @@ -1103,15 +1104,15 @@ function main:OpenUpdatePopup() end end local controls = { } - controls.changeLog = new("TextListControl", nil, 0, 20, 780, 542, nil, changeList) - controls.update = new("ButtonControl", nil, -45, 570, 80, 20, "Update", function() + controls.changeLog = new("TextListControl", nil, {0, 20, 780, 542}, nil, changeList) + controls.update = new("ButtonControl", nil, {-45, 570, 80, 20}, "Update", function() self:ClosePopup() local ret = self:CallMode("CanExit", "UPDATE") if ret == nil or ret == true then launch:ApplyUpdate(launch.updateAvailable) end end) - controls.cancel = new("ButtonControl", nil, 45, 570, 80, 20, "Cancel", function() + controls.cancel = new("ButtonControl", nil, {45, 570, 80, 20}, "Cancel", function() self:ClosePopup() end) self:OpenPopup(800, 600, "Update Available", controls) @@ -1205,23 +1206,23 @@ function main:OpenAboutPopup(helpSectionIndex) helpSectionIndex = newIndex end local controls = { } - controls.close = new("ButtonControl", {"TOPRIGHT",nil,"TOPRIGHT"}, -10, 10, 50, 20, "Close", function() + controls.close = new("ButtonControl", {"TOPRIGHT",nil,"TOPRIGHT"}, {-10, 10, 50, 20}, "Close", function() self:ClosePopup() end) - controls.version = new("LabelControl", nil, 0, 18, 0, 18, "^7Path of Building Community Fork v"..launch.versionNumber) - controls.forum = new("LabelControl", nil, 0, 36, 0, 18, "^7Based on Openarl's Path of Building") - controls.github = new("ButtonControl", nil, 0, 62, 438, 18, "^7GitHub page: ^x4040FFhttps://github.com/PathOfBuildingCommunity/PathOfBuilding", function(control) + controls.version = new("LabelControl", nil, {0, 18, 0, 18}, "^7Path of Building Community Fork v"..launch.versionNumber) + controls.forum = new("LabelControl", nil, {0, 36, 0, 18}, "^7Based on Openarl's Path of Building") + controls.github = new("ButtonControl", nil, {0, 62, 438, 18}, "^7GitHub page: ^x4040FFhttps://github.com/PathOfBuildingCommunity/PathOfBuilding", function(control) OpenURL("https://github.com/PathOfBuildingCommunity/PathOfBuilding") end) - controls.verLabel = new("ButtonControl", { "TOPLEFT", nil, "TOPLEFT" }, 10, 85, 100, 18, "^7Version history:", function() + controls.verLabel = new("ButtonControl", {"TOPLEFT", nil, "TOPLEFT"}, {10, 85, 100, 18}, "^7Version history:", function() controls.changelog.list = changeList controls.changelog.sectionHeights = changeVersionHeights end) - controls.helpLabel = new("ButtonControl", { "TOPRIGHT", nil, "TOPRIGHT" }, -10, 85, 40, 18, "^7Help:", function() + controls.helpLabel = new("ButtonControl", {"TOPRIGHT", nil, "TOPRIGHT"}, {-10, 85, 40, 18}, "^7Help:", function() controls.changelog.list = helpList controls.changelog.sectionHeights = helpSectionHeights end) - controls.changelog = new("TextListControl", nil, 0, 103, popupWidth - 20, 515, {{ x = 1, align = "LEFT" }, { x = 135, align = "LEFT" }}, helpSectionIndex and helpList or changeList, helpSectionIndex and helpSectionHeights or changeVersionHeights) + controls.changelog = new("TextListControl", nil, {0, 103, popupWidth - 20, 515}, {{ x = 1, align = "LEFT" }, { x = 135, align = "LEFT" }}, helpSectionIndex and helpList or changeList, helpSectionIndex and helpSectionHeights or changeVersionHeights) if helpSectionIndex then controls.changelog.controls.scrollBar.offset = helpSections[helpSectionIndex].height * textSize end @@ -1416,10 +1417,10 @@ function main:OpenMessagePopup(title, msg) local controls = { } local numMsgLines = 0 for line in string.gmatch(msg .. "\n", "([^\n]*)\n") do - t_insert(controls, new("LabelControl", nil, 0, 20 + numMsgLines * 16, 0, 16, line)) + t_insert(controls, new("LabelControl", nil, {0, 20 + numMsgLines * 16, 0, 16}, line)) numMsgLines = numMsgLines + 1 end - controls.close = new("ButtonControl", nil, 0, 40 + numMsgLines * 16, 80, 20, "Ok", function() + controls.close = new("ButtonControl", nil, {0, 40 + numMsgLines * 16, 80, 20}, "Ok", function() main:ClosePopup() end) return self:OpenPopup(m_max(DrawStringWidth(16, "VAR", msg) + 30, 190), 70 + numMsgLines * 16, title, controls, "close") @@ -1429,15 +1430,15 @@ function main:OpenConfirmPopup(title, msg, confirmLabel, onConfirm) local controls = { } local numMsgLines = 0 for line in string.gmatch(msg .. "\n", "([^\n]*)\n") do - t_insert(controls, new("LabelControl", nil, 0, 20 + numMsgLines * 16, 0, 16, line)) + t_insert(controls, new("LabelControl", nil, {0, 20 + numMsgLines * 16, 0, 16}, line)) numMsgLines = numMsgLines + 1 end local confirmWidth = m_max(80, DrawStringWidth(16, "VAR", confirmLabel) + 10) - controls.confirm = new("ButtonControl", nil, -5 - m_ceil(confirmWidth/2), 40 + numMsgLines * 16, confirmWidth, 20, confirmLabel, function() + controls.confirm = new("ButtonControl", nil, {-5 - m_ceil(confirmWidth/2), 40 + numMsgLines * 16, confirmWidth, 20}, confirmLabel, function() main:ClosePopup() onConfirm() end) - t_insert(controls, new("ButtonControl", nil, 5 + m_ceil(confirmWidth/2), 40 + numMsgLines * 16, confirmWidth, 20, "Cancel", function() + t_insert(controls, new("ButtonControl", nil, {5 + m_ceil(confirmWidth/2), 40 + numMsgLines * 16, confirmWidth, 20}, "Cancel", function() main:ClosePopup() end)) return self:OpenPopup(m_max(DrawStringWidth(16, "VAR", msg) + 30, 190), 70 + numMsgLines * 16, title, controls, "confirm") @@ -1445,11 +1446,11 @@ end function main:OpenNewFolderPopup(path, onClose) local controls = { } - controls.label = new("LabelControl", nil, 0, 20, 0, 16, "^7Enter folder name:") - controls.edit = new("EditControl", nil, 0, 40, 350, 20, nil, nil, "\\/:%*%?\"<>|%c", 100, function(buf) + controls.label = new("LabelControl", nil, {0, 20, 0, 16}, "^7Enter folder name:") + controls.edit = new("EditControl", nil, {0, 40, 350, 20}, nil, nil, "\\/:%*%?\"<>|%c", 100, function(buf) controls.create.enabled = buf:match("%S") end) - controls.create = new("ButtonControl", nil, -45, 70, 80, 20, "Create", function() + controls.create = new("ButtonControl", nil, {-45, 70, 80, 20}, "Create", function() local newFolderName = controls.edit.buf local res, msg = MakeDir(path..newFolderName) if not res then @@ -1462,7 +1463,7 @@ function main:OpenNewFolderPopup(path, onClose) main:ClosePopup() end) controls.create.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 onClose then onClose() end