From ce6d2b2688c2bece0518472b597a01d88bf4f567 Mon Sep 17 00:00:00 2001 From: Julien Rechaussat Date: Thu, 19 Jul 2018 15:39:47 +0200 Subject: [PATCH 1/3] BFA Release --- SimPermut.toc | 2 +- changelog.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/SimPermut.toc b/SimPermut.toc index c0fd812..4e0cd48 100644 --- a/SimPermut.toc +++ b/SimPermut.toc @@ -2,7 +2,7 @@ ## Title: SimPermut ## Notes: Constructs SimC export strings with permutations for items in inventory. Based on SimulationCraft's Addon. ## Author: Kutikuti -## Version: 1.14.15 +## Version: 1.15.0 ## SavedVariablesPerCharacter: SimPermutVars ## OptionalDependencies: Ace3 diff --git a/changelog.txt b/changelog.txt index 500eadb..09b6564 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +v1.15.0 07/19/2018 +[Fix] BFA compatibilité (thx to https://github.com/watcheur) + v1.14.15 02/01/2018 [Fix]LUA error in some cases From a473f30f38b353110f48ac61f3b0ae40a65deaca Mon Sep 17 00:00:00 2001 From: vdain Date: Mon, 23 Jul 2018 17:54:11 -0500 Subject: [PATCH 2/3] Fixed multi gem slash --- core.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core.lua b/core.lua index c5de3fc..e888d11 100644 --- a/core.lua +++ b/core.lua @@ -1371,11 +1371,11 @@ function SimPermut:GetItemString(itemLink,itemType,base,forceilvl,forcegem) if (itemSplit[UIParameters.OFFSET_GEM_ID_1]~=0) then gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_1] if (itemSplit[UIParameters.OFFSET_GEM_ID_2]~=0) then - gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_2] + gemstring=gemstring..'/'..itemSplit[UIParameters.OFFSET_GEM_ID_2] if (itemSplit[UIParameters.OFFSET_GEM_ID_3]~=0) then - gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_3] + gemstring=gemstring..'/'..itemSplit[UIParameters.OFFSET_GEM_ID_3] if (itemSplit[UIParameters.OFFSET_GEM_ID_4]~=0) then - gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_4] + gemstring=gemstring..'/'..itemSplit[UIParameters.OFFSET_GEM_ID_4] end end end @@ -1406,11 +1406,11 @@ function SimPermut:GetItemString(itemLink,itemType,base,forceilvl,forcegem) if (itemSplit[UIParameters.OFFSET_GEM_ID_1]~=0) then gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_1] if (itemSplit[UIParameters.OFFSET_GEM_ID_2]~=0) then - gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_2] + gemstring=gemstring..'/'..itemSplit[UIParameters.OFFSET_GEM_ID_2] if (itemSplit[UIParameters.OFFSET_GEM_ID_3]~=0) then - gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_3] + gemstring=gemstring..'/'..itemSplit[UIParameters.OFFSET_GEM_ID_3] if (itemSplit[UIParameters.OFFSET_GEM_ID_4]~=0) then - gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_4] + gemstring=gemstring..'/'..itemSplit[UIParameters.OFFSET_GEM_ID_4] end end end From f5cd625ca9b8f35a3b309ab6161d9c146bd1076c Mon Sep 17 00:00:00 2001 From: Julien Rechaussat Date: Mon, 20 Aug 2018 12:39:37 +0200 Subject: [PATCH 3/3] Update Ace3 lib --- libs/AceGUI-3.0/AceGUI-3.0.lua | 222 +++++++++++++++++- .../widgets/AceGUIContainer-TreeGroup.lua | 18 +- .../widgets/AceGUIWidget-CheckBox.lua | 5 +- .../widgets/AceGUIWidget-EditBox.lua | 20 +- 4 files changed, 246 insertions(+), 19 deletions(-) diff --git a/libs/AceGUI-3.0/AceGUI-3.0.lua b/libs/AceGUI-3.0/AceGUI-3.0.lua index 9853644..08904e4 100644 --- a/libs/AceGUI-3.0/AceGUI-3.0.lua +++ b/libs/AceGUI-3.0/AceGUI-3.0.lua @@ -24,8 +24,8 @@ -- f:AddChild(btn) -- @class file -- @name AceGUI-3.0 --- @release $Id: AceGUI-3.0.lua 1102 2013-10-25 14:15:23Z nevcairiel $ -local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 34 +-- @release $Id: AceGUI-3.0.lua 1177 2018-06-25 12:12:48Z nevcairiel $ +local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 36 local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR) if not AceGUI then return end -- No upgrade needed @@ -811,3 +811,221 @@ AceGUI:RegisterLayout("Flow", height = height + rowheight + 3 safecall(content.obj.LayoutFinished, content.obj, nil, height) end) + +-- Get alignment method and value. Possible alignment methods are a callback, a number, "start", "middle", "end", "fill" or "TOPLEFT", "BOTTOMRIGHT" etc. +local GetCellAlign = function (dir, tableObj, colObj, cellObj, cell, child) + local fn = cellObj and (cellObj["align" .. dir] or cellObj.align) + or colObj and (colObj["align" .. dir] or colObj.align) + or tableObj["align" .. dir] or tableObj.align + or "CENTERLEFT" + local child, cell, val = child or 0, cell or 0, nil + + if type(fn) == "string" then + fn = fn:lower() + fn = dir == "V" and (fn:sub(1, 3) == "top" and "start" or fn:sub(1, 6) == "bottom" and "end" or fn:sub(1, 6) == "center" and "middle") + or dir == "H" and (fn:sub(-4) == "left" and "start" or fn:sub(-5) == "right" and "end" or fn:sub(-6) == "center" and "middle") + or fn + val = (fn == "start" or fn == "fill") and 0 or fn == "end" and cell - child or (cell - child) / 2 + elseif type(fn) == "function" then + val = fn(child or 0, cell, dir) + else + val = fn + end + + return fn, max(0, min(val, cell)) +end + +-- Get width or height for multiple cells combined +local GetCellDimension = function (dir, laneDim, from, to, space) + local dim = 0 + for cell=from,to do + dim = dim + (laneDim[cell] or 0) + end + return dim + max(0, to - from) * (space or 0) +end + +--[[ Options +============ +Container: + - columns ({col, col, ...}): Column settings. "col" can be a number (<= 0: content width, <1: rel. width, <10: weight, >=10: abs. width) or a table with column setting. + - space, spaceH, spaceV: Overall, horizontal and vertical spacing between cells. + - align, alignH, alignV: Overall, horizontal and vertical cell alignment. See GetCellAlign() for possible values. +Columns: + - width: Fixed column width (nil or <=0: content width, <1: rel. width, >=1: abs. width). + - min or 1: Min width for content based width + - max or 2: Max width for content based width + - weight: Flexible column width. The leftover width after accounting for fixed-width columns is distributed to weighted columns according to their weights. + - align, alignH, alignV: Overwrites the container setting for alignment. +Cell: + - colspan: Makes a cell span multiple columns. + - rowspan: Makes a cell span multiple rows. + - align, alignH, alignV: Overwrites the container and column setting for alignment. +]] +AceGUI:RegisterLayout("Table", + function (content, children) + local obj = content.obj + obj:PauseLayout() + + local tableObj = obj:GetUserData("table") + local cols = tableObj.columns + local spaceH = tableObj.spaceH or tableObj.space or 0 + local spaceV = tableObj.spaceV or tableObj.space or 0 + local totalH = (content:GetWidth() or content.width or 0) - spaceH * (#cols - 1) + + -- We need to reuse these because layout events can come in very frequently + local layoutCache = obj:GetUserData("layoutCache") + if not layoutCache then + layoutCache = {{}, {}, {}, {}, {}, {}} + obj:SetUserData("layoutCache", layoutCache) + end + local t, laneH, laneV, rowspans, rowStart, colStart = unpack(layoutCache) + + -- Create the grid + local n, slotFound = 0 + for i,child in ipairs(children) do + if child:IsShown() then + repeat + n = n + 1 + local col = (n - 1) % #cols + 1 + local row = ceil(n / #cols) + local rowspan = rowspans[col] + local cell = rowspan and rowspan.child or child + local cellObj = cell:GetUserData("cell") + slotFound = not rowspan + + -- Rowspan + if not rowspan and cellObj and cellObj.rowspan then + rowspan = {child = child, from = row, to = row + cellObj.rowspan - 1} + rowspans[col] = rowspan + end + if rowspan and i == #children then + rowspan.to = row + end + + -- Colspan + local colspan = max(0, min((cellObj and cellObj.colspan or 1) - 1, #cols - col)) + n = n + colspan + + -- Place the cell + if not rowspan or rowspan.to == row then + t[n] = cell + rowStart[cell] = rowspan and rowspan.from or row + colStart[cell] = col + + if rowspan then + rowspans[col] = nil + end + end + until slotFound + end + end + + local rows = ceil(n / #cols) + + -- Determine fixed size cols and collect weights + local extantH, totalWeight = totalH, 0 + for col,colObj in ipairs(cols) do + laneH[col] = 0 + + if type(colObj) == "number" then + colObj = {[colObj >= 1 and colObj < 10 and "weight" or "width"] = colObj} + cols[col] = colObj + end + + if colObj.weight then + -- Weight + totalWeight = totalWeight + (colObj.weight or 1) + else + if not colObj.width or colObj.width <= 0 then + -- Content width + for row=1,rows do + local child = t[(row - 1) * #cols + col] + if child then + local f = child.frame + f:ClearAllPoints() + local childH = f:GetWidth() or 0 + + laneH[col] = max(laneH[col], childH - GetCellDimension("H", laneH, colStart[child], col - 1, spaceH)) + end + end + + laneH[col] = max(colObj.min or colObj[1] or 0, min(laneH[col], colObj.max or colObj[2] or laneH[col])) + else + -- Rel./Abs. width + laneH[col] = colObj.width < 1 and colObj.width * totalH or colObj.width + end + extantH = max(0, extantH - laneH[col]) + end + end + + -- Determine sizes based on weight + local scale = totalWeight > 0 and extantH / totalWeight or 0 + for col,colObj in pairs(cols) do + if colObj.weight then + laneH[col] = scale * colObj.weight + end + end + + -- Arrange children + for row=1,rows do + local rowV = 0 + + -- Horizontal placement and sizing + for col=1,#cols do + local child = t[(row - 1) * #cols + col] + if child then + local colObj = cols[colStart[child]] + local cellObj = child:GetUserData("cell") + local offsetH = GetCellDimension("H", laneH, 1, colStart[child] - 1, spaceH) + (colStart[child] == 1 and 0 or spaceH) + local cellH = GetCellDimension("H", laneH, colStart[child], col, spaceH) + + local f = child.frame + f:ClearAllPoints() + local childH = f:GetWidth() or 0 + + local alignFn, align = GetCellAlign("H", tableObj, colObj, cellObj, cellH, childH) + f:SetPoint("LEFT", content, offsetH + align, 0) + if child:IsFullWidth() or alignFn == "fill" or childH > cellH then + f:SetPoint("RIGHT", content, "LEFT", offsetH + align + cellH, 0) + end + + if child.DoLayout then + child:DoLayout() + end + + rowV = max(rowV, (f:GetHeight() or 0) - GetCellDimension("V", laneV, rowStart[child], row - 1, spaceV)) + end + end + + laneV[row] = rowV + + -- Vertical placement and sizing + for col=1,#cols do + local child = t[(row - 1) * #cols + col] + if child then + local colObj = cols[colStart[child]] + local cellObj = child:GetUserData("cell") + local offsetV = GetCellDimension("V", laneV, 1, rowStart[child] - 1, spaceV) + (rowStart[child] == 1 and 0 or spaceV) + local cellV = GetCellDimension("V", laneV, rowStart[child], row, spaceV) + + local f = child.frame + local childV = f:GetHeight() or 0 + + local alignFn, align = GetCellAlign("V", tableObj, colObj, cellObj, cellV, childV) + if child:IsFullHeight() or alignFn == "fill" then + f:SetHeight(cellV) + end + f:SetPoint("TOP", content, 0, -(offsetV + align)) + end + end + end + + -- Calculate total height + local totalV = GetCellDimension("V", laneV, 1, #laneV, spaceV) + + -- Cleanup + for _,v in pairs(layoutCache) do wipe(v) end + + safecall(obj.LayoutFinished, obj, nil, totalV) + obj:ResumeLayout() + end) diff --git a/libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua b/libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua index 617d5dc..236f633 100644 --- a/libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua +++ b/libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua @@ -2,10 +2,12 @@ TreeGroup Container Container that uses a tree control to switch between groups. -------------------------------------------------------------------------------]] -local Type, Version = "TreeGroup", 40 +local Type, Version = "TreeGroup", 41 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end +local WoW80 = select(4, GetBuildInfo()) >= 80000 + -- Lua APIs local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type local math_min, math_max, floor = math.min, math.max, floor @@ -162,7 +164,7 @@ end local function FirstFrameUpdate(frame) local self = frame.obj frame:SetScript("OnUpdate", nil) - self:RefreshTree() + self:RefreshTree(nil, true) end local function BuildUniqueValue(...) @@ -300,6 +302,8 @@ local methods = { ["OnRelease"] = function(self) self.status = nil + self.tree = nil + self.frame:SetScript("OnUpdate", nil) for k, v in pairs(self.localstatus) do if k == "groups" then for k2 in pairs(v) do @@ -388,8 +392,8 @@ local methods = { end end, - ["RefreshTree"] = function(self,scrollToSelection) - local buttons = self.buttons + ["RefreshTree"] = function(self,scrollToSelection,fromOnUpdate) + local buttons = self.buttons local lines = self.lines for i, v in ipairs(buttons) do @@ -420,6 +424,12 @@ local methods = { local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18)) if maxlines <= 0 then return end + -- workaround for lag spikes on WoW 8.0 + if WoW80 and self.frame:GetParent() == UIParent and not fromOnUpdate then + self.frame:SetScript("OnUpdate", FirstFrameUpdate) + return + end + local first, last scrollToSelection = status.scrollToSelection diff --git a/libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua b/libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua index b96ac59..44cab23 100644 --- a/libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua +++ b/libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua @@ -1,7 +1,7 @@ --[[----------------------------------------------------------------------------- Checkbox Widget -------------------------------------------------------------------------------]] -local Type, Version = "CheckBox", 23 +local Type, Version = "CheckBox", 24 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -26,7 +26,7 @@ local function AlignImage(self) self.text:SetPoint("LEFT", self.checkbg, "RIGHT") self.text:SetPoint("RIGHT") else - self.text:SetPoint("LEFT", self.image,"RIGHT", 1, 0) + self.text:SetPoint("LEFT", self.checkbg, "RIGHT", self.image:GetWidth() + 2, 0) self.text:SetPoint("RIGHT") end end @@ -203,6 +203,7 @@ local methods = { desc:ClearAllPoints() desc:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21) desc:SetWidth(self.frame.width - 30) + desc:SetPoint("RIGHT", self.frame, "RIGHT", -30, 0) desc:SetJustifyH("LEFT") desc:SetJustifyV("TOP") self.desc = desc diff --git a/libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua b/libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua index b0b00f9..29f7e00 100644 --- a/libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua +++ b/libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua @@ -1,7 +1,7 @@ --[[----------------------------------------------------------------------------- EditBox Widget -------------------------------------------------------------------------------]] -local Type, Version = "EditBox", 27 +local Type, Version = "EditBox", 28 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -81,23 +81,21 @@ end local function EditBox_OnReceiveDrag(frame) local self = frame.obj local type, id, info = GetCursorInfo() + local name if type == "item" then - self:SetText(info) - self:Fire("OnEnterPressed", info) - ClearCursor() + name = info elseif type == "spell" then - local name = GetSpellInfo(id, info) - self:SetText(name) - self:Fire("OnEnterPressed", name) - ClearCursor() + name = GetSpellInfo(id, info) elseif type == "macro" then - local name = GetMacroInfo(id) + name = GetMacroInfo(id) + end + if name then self:SetText(name) self:Fire("OnEnterPressed", name) ClearCursor() + HideButton(self) + AceGUI:ClearFocus() end - HideButton(self) - AceGUI:ClearFocus() end local function EditBox_OnTextChanged(frame)