From c0929fdeb36b1347f094948d77efcb637d5e1787 Mon Sep 17 00:00:00 2001 From: Openarl Date: Fri, 19 May 2017 18:24:38 +1000 Subject: [PATCH] Minor tweaks to list controls --- Classes/ItemDBControl.lua | 1 + Classes/ItemListControl.lua | 29 +++++++++++++++++++++++++--- Classes/ItemsTab.lua | 2 +- Classes/ListControl.lua | 4 ++++ Classes/SharedItemListControl.lua | 1 + Classes/SkillListControl.lua | 32 +++++++++++++++++-------------- Classes/SkillsTab.lua | 1 + README.md | 1 + changelog.txt | 1 + manifest.xml | 16 ++++++++-------- 10 files changed, 62 insertions(+), 26 deletions(-) diff --git a/Classes/ItemDBControl.lua b/Classes/ItemDBControl.lua index c063c6d6..3333299d 100644 --- a/Classes/ItemDBControl.lua +++ b/Classes/ItemDBControl.lua @@ -13,6 +13,7 @@ local ItemDBClass = common.NewClass("ItemDB", "ListControl", function(self, anch self.ListControl(anchor, x, y, width, height, 16, false) self.itemsTab = itemsTab self.db = db + self.defaultText = "^7No items found that match those filters." self.dragTargetList = { } self.sortControl = { NAME = { key = "name", order = 1, dir = "ASCEND", func = function(a,b) return a:gsub("^The ","") < b:gsub("^The ","") end } diff --git a/Classes/ItemListControl.lua b/Classes/ItemListControl.lua index a11eb94f..760cfd28 100644 --- a/Classes/ItemListControl.lua +++ b/Classes/ItemListControl.lua @@ -12,16 +12,39 @@ local ItemListClass = common.NewClass("ItemList", "ListControl", function(self, self.ListControl(anchor, x, y, width, height, 16, true, itemsTab.orderList) 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.sort = common.New("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, -64, -2, 60, 18, "Sort", function() - itemsTab:SortItemList() - end) self.controls.delete = common.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 = common.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) + end + for _, spec in pairs(itemsTab.build.treeTab.specList) do + for nodeId, itemId in pairs(spec.jewels) do + spec.jewels[nodeId] = 0 + end + end + wipeTable(self.list) + wipeTable(self.itemsTab.list) + itemsTab:PopulateSlots() + itemsTab:AddUndoState() + itemsTab.build.buildFlag = true + self.selIndex = nil + self.selValue = nil + end) + end) + self.controls.deleteAll.enabled = function() + return #self.list > 0 + end + self.controls.sort = common.New("ButtonControl", {"RIGHT",self.controls.deleteAll,"LEFT"}, -4, 0, 60, 18, "Sort", function() + itemsTab:SortItemList() + end) end) function ItemListClass:GetRowValue(column, index, itemId) diff --git a/Classes/ItemsTab.lua b/Classes/ItemsTab.lua index ea47807f..69102cfb 100644 --- a/Classes/ItemsTab.lua +++ b/Classes/ItemsTab.lua @@ -181,7 +181,7 @@ local ItemsTabClass = common.NewClass("ItemsTab", "UndoHandler", "ControlHost", self.controls.displayItemTip = common.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/edit the item and add it to your build. +to view or edit the item and add it to your build. You can Control + Click an item to equip it, or 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.]]) diff --git a/Classes/ListControl.lua b/Classes/ListControl.lua index ea4fb2e1..9656f68b 100644 --- a/Classes/ListControl.lua +++ b/Classes/ListControl.lua @@ -197,6 +197,10 @@ function ListClass:Draw(viewPort) end column = column + 1 end + if #self.list == 0 and self.defaultText then + SetDrawColor(1, 1, 1) + DrawString(2, 2, "LEFT", 14, "VAR", self.defaultText) + end if self.selDragIndex then local lineY = rowHeight * (self.selDragIndex - 1) - scrollBar.offset SetDrawColor(1, 1, 1) diff --git a/Classes/SharedItemListControl.lua b/Classes/SharedItemListControl.lua index d4948796..9da878aa 100644 --- a/Classes/SharedItemListControl.lua +++ b/Classes/SharedItemListControl.lua @@ -13,6 +13,7 @@ local SharedItemListClass = common.NewClass("SharedItemList", "ListControl", fun self.ListControl(anchor, x, y, width, height, 16, true, main.sharedItems) 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 = common.New("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, 0, -2, 60, 18, "Delete", function() self:OnSelDelete(self.selIndex, self.selValue) diff --git a/Classes/SkillListControl.lua b/Classes/SkillListControl.lua index ef20abd9..b125c5ba 100644 --- a/Classes/SkillListControl.lua +++ b/Classes/SkillListControl.lua @@ -19,28 +19,32 @@ local SkillListClass = common.NewClass("SkillList", "ListControl", function(self self.controls.delete.enabled = function() return self.selValue ~= nil and self.selValue.source == nil end - self.controls.paste = common.New("ButtonControl", {"RIGHT",self.controls.delete,"LEFT"}, -4, 0, 60, 18, "Paste", function() - skillsTab:PasteSocketGroup() + self.controls.deleteAll = common.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() + skillsTab:AddUndoState() + skillsTab.build.buildFlag = true + self.selIndex = nil + self.selValue = nil + end) end) - self.controls.copy = common.New("ButtonControl", {"RIGHT",self.controls.paste,"LEFT"}, -4, 0, 60, 18, "Copy", function() - skillsTab:CopySocketGroup(self.selValue) - end) - self.controls.copy.enabled = function() - return self.selValue ~= nil and self.selValue.source == nil + self.controls.deleteAll.enabled = function() + return #self.list > 0 end - self.controls.new = common.New("ButtonControl", {"RIGHT",self.controls.copy,"LEFT"}, -4, 0, 60, 18, "New", function() + self.controls.new = common.New("ButtonControl", {"RIGHT",self.controls.deleteAll,"LEFT"}, -4, 0, 60, 18, "New", function() local newGroup = { label = "", enabled = true, gemList = { } } t_insert(self.list, newGroup) - self.selIndex = #self.skillsTab.socketGroupList + self.selIndex = #self.list self.selValue = newGroup - self.skillsTab:SetDisplayGroup(newGroup) - self.skillsTab:AddUndoState() - self.skillsTab.build.buildFlag = true - return self.skillsTab.gemSlots[1].nameSpec + skillsTab:SetDisplayGroup(newGroup) + skillsTab:AddUndoState() + skillsTab.build.buildFlag = true + return skillsTab.gemSlots[1].nameSpec end) end) @@ -166,7 +170,7 @@ function SkillListClass:OnSelDelete(index, socketGroup) main:OpenConfirmPopup("Delete Socket Group", "Are you sure you want to delete '"..socketGroup.displayLabel.."'?", "Delete", function() t_remove(self.list, index) if self.skillsTab.displayGroup == socketGroup then - self.skillsTab.displayGroup = nil + self.skillsTab:SetDisplayGroup() end self.skillsTab:AddUndoState() self.skillsTab.build.buildFlag = true diff --git a/Classes/SkillsTab.lua b/Classes/SkillsTab.lua index de99765a..929af431 100644 --- a/Classes/SkillsTab.lua +++ b/Classes/SkillsTab.lua @@ -23,6 +23,7 @@ local SkillsTabClass = common.NewClass("SkillsTab", "UndoHandler", "ControlHost" -- Socket group list self.controls.groupList = common.New("SkillList", {"TOPLEFT",self,"TOPLEFT"}, 20, 24, 360, 300, self) + self.controls.groupTip = common.New("LabelControl", {"TOPLEFT",self.controls.groupList,"BOTTOMLEFT"}, 0, 8, 0, 14, "^7Tip: You can copy/paste socket groups using Ctrl+C and Ctrl+V.") -- Socket group details self.anchorGroupDetail = common.New("Control", {"TOPLEFT",self.controls.groupList,"TOPRIGHT"}, 20, 0, 0, 0) diff --git a/README.md b/README.md index c771b3b6..786a00f6 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ If you'd like to help support the development of Path of Building, I have a [Pat * Build save path: overrides the default save location for builds * Node Power colours: changes the colour scheme used for the node power display * The breakdowns for hit damage types now show the percentage of total hit damage that is being dealt as that type + * The stat differences shown in passive skill tooltips can now be toggled on and off by pressing Ctrl+D * Some friendly toasts have set up camp in the bottom left corner, and may appear occasionally to convey various messages * With the new installer versions, the program will always update itself when started for the first time, but will still start even if the update check fails diff --git a/changelog.txt b/changelog.txt index d738748a..882b8125 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ VERSION[1.4.12][2017/05/19] * Build save path: overrides the default save location for builds * Node Power colours: changes the colour scheme used for the node power display * The breakdowns for hit damage types now show the percentage of total hit damage that is being dealt as that type + * The stat differences shown in passive skill tooltips can now be toggled on and off by pressing Ctrl+D * Some friendly toasts have set up camp in the bottom left corner, and may appear occasionally to convey various messages * With the new installer versions, the program will always update itself when started for the first time, but will still start even if the update check fails diff --git a/manifest.xml b/manifest.xml index e6b95801..b7e5d464 100644 --- a/manifest.xml +++ b/manifest.xml @@ -7,7 +7,7 @@ - + @@ -21,12 +21,12 @@ - - + + - + - + @@ -38,9 +38,9 @@ - - - + + +