Skip to content

Commit a034d69

Browse files
authored
Merge branch 'master' into bfa-dev
2 parents d7bf25c + f5cd625 commit a034d69

File tree

5 files changed

+252
-25
lines changed

5 files changed

+252
-25
lines changed

core.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,11 +1174,11 @@ function SimPermut:GetItemString(itemLink,itemType,base,forceilvl,forcegem)
11741174
if (itemSplit[UIParameters.OFFSET_GEM_ID_1]~=0) then
11751175
gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_1]
11761176
if (itemSplit[UIParameters.OFFSET_GEM_ID_2]~=0) then
1177-
gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_2]
1177+
gemstring=gemstring..'/'..itemSplit[UIParameters.OFFSET_GEM_ID_2]
11781178
if (itemSplit[UIParameters.OFFSET_GEM_ID_3]~=0) then
1179-
gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_3]
1179+
gemstring=gemstring..'/'..itemSplit[UIParameters.OFFSET_GEM_ID_3]
11801180
if (itemSplit[UIParameters.OFFSET_GEM_ID_4]~=0) then
1181-
gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_4]
1181+
gemstring=gemstring..'/'..itemSplit[UIParameters.OFFSET_GEM_ID_4]
11821182
end
11831183
end
11841184
end
@@ -1209,11 +1209,11 @@ function SimPermut:GetItemString(itemLink,itemType,base,forceilvl,forcegem)
12091209
if (itemSplit[UIParameters.OFFSET_GEM_ID_1]~=0) then
12101210
gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_1]
12111211
if (itemSplit[UIParameters.OFFSET_GEM_ID_2]~=0) then
1212-
gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_2]
1212+
gemstring=gemstring..'/'..itemSplit[UIParameters.OFFSET_GEM_ID_2]
12131213
if (itemSplit[UIParameters.OFFSET_GEM_ID_3]~=0) then
1214-
gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_3]
1214+
gemstring=gemstring..'/'..itemSplit[UIParameters.OFFSET_GEM_ID_3]
12151215
if (itemSplit[UIParameters.OFFSET_GEM_ID_4]~=0) then
1216-
gemstring=gemstring..itemSplit[UIParameters.OFFSET_GEM_ID_4]
1216+
gemstring=gemstring..'/'..itemSplit[UIParameters.OFFSET_GEM_ID_4]
12171217
end
12181218
end
12191219
end

libs/AceGUI-3.0/AceGUI-3.0.lua

Lines changed: 220 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
-- f:AddChild(btn)
2525
-- @class file
2626
-- @name AceGUI-3.0
27-
-- @release $Id: AceGUI-3.0.lua 1102 2013-10-25 14:15:23Z nevcairiel $
28-
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 34
27+
-- @release $Id: AceGUI-3.0.lua 1177 2018-06-25 12:12:48Z nevcairiel $
28+
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 36
2929
local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR)
3030

3131
if not AceGUI then return end -- No upgrade needed
@@ -811,3 +811,221 @@ AceGUI:RegisterLayout("Flow",
811811
height = height + rowheight + 3
812812
safecall(content.obj.LayoutFinished, content.obj, nil, height)
813813
end)
814+
815+
-- Get alignment method and value. Possible alignment methods are a callback, a number, "start", "middle", "end", "fill" or "TOPLEFT", "BOTTOMRIGHT" etc.
816+
local GetCellAlign = function (dir, tableObj, colObj, cellObj, cell, child)
817+
local fn = cellObj and (cellObj["align" .. dir] or cellObj.align)
818+
or colObj and (colObj["align" .. dir] or colObj.align)
819+
or tableObj["align" .. dir] or tableObj.align
820+
or "CENTERLEFT"
821+
local child, cell, val = child or 0, cell or 0, nil
822+
823+
if type(fn) == "string" then
824+
fn = fn:lower()
825+
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")
826+
or dir == "H" and (fn:sub(-4) == "left" and "start" or fn:sub(-5) == "right" and "end" or fn:sub(-6) == "center" and "middle")
827+
or fn
828+
val = (fn == "start" or fn == "fill") and 0 or fn == "end" and cell - child or (cell - child) / 2
829+
elseif type(fn) == "function" then
830+
val = fn(child or 0, cell, dir)
831+
else
832+
val = fn
833+
end
834+
835+
return fn, max(0, min(val, cell))
836+
end
837+
838+
-- Get width or height for multiple cells combined
839+
local GetCellDimension = function (dir, laneDim, from, to, space)
840+
local dim = 0
841+
for cell=from,to do
842+
dim = dim + (laneDim[cell] or 0)
843+
end
844+
return dim + max(0, to - from) * (space or 0)
845+
end
846+
847+
--[[ Options
848+
============
849+
Container:
850+
- 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.
851+
- space, spaceH, spaceV: Overall, horizontal and vertical spacing between cells.
852+
- align, alignH, alignV: Overall, horizontal and vertical cell alignment. See GetCellAlign() for possible values.
853+
Columns:
854+
- width: Fixed column width (nil or <=0: content width, <1: rel. width, >=1: abs. width).
855+
- min or 1: Min width for content based width
856+
- max or 2: Max width for content based width
857+
- weight: Flexible column width. The leftover width after accounting for fixed-width columns is distributed to weighted columns according to their weights.
858+
- align, alignH, alignV: Overwrites the container setting for alignment.
859+
Cell:
860+
- colspan: Makes a cell span multiple columns.
861+
- rowspan: Makes a cell span multiple rows.
862+
- align, alignH, alignV: Overwrites the container and column setting for alignment.
863+
]]
864+
AceGUI:RegisterLayout("Table",
865+
function (content, children)
866+
local obj = content.obj
867+
obj:PauseLayout()
868+
869+
local tableObj = obj:GetUserData("table")
870+
local cols = tableObj.columns
871+
local spaceH = tableObj.spaceH or tableObj.space or 0
872+
local spaceV = tableObj.spaceV or tableObj.space or 0
873+
local totalH = (content:GetWidth() or content.width or 0) - spaceH * (#cols - 1)
874+
875+
-- We need to reuse these because layout events can come in very frequently
876+
local layoutCache = obj:GetUserData("layoutCache")
877+
if not layoutCache then
878+
layoutCache = {{}, {}, {}, {}, {}, {}}
879+
obj:SetUserData("layoutCache", layoutCache)
880+
end
881+
local t, laneH, laneV, rowspans, rowStart, colStart = unpack(layoutCache)
882+
883+
-- Create the grid
884+
local n, slotFound = 0
885+
for i,child in ipairs(children) do
886+
if child:IsShown() then
887+
repeat
888+
n = n + 1
889+
local col = (n - 1) % #cols + 1
890+
local row = ceil(n / #cols)
891+
local rowspan = rowspans[col]
892+
local cell = rowspan and rowspan.child or child
893+
local cellObj = cell:GetUserData("cell")
894+
slotFound = not rowspan
895+
896+
-- Rowspan
897+
if not rowspan and cellObj and cellObj.rowspan then
898+
rowspan = {child = child, from = row, to = row + cellObj.rowspan - 1}
899+
rowspans[col] = rowspan
900+
end
901+
if rowspan and i == #children then
902+
rowspan.to = row
903+
end
904+
905+
-- Colspan
906+
local colspan = max(0, min((cellObj and cellObj.colspan or 1) - 1, #cols - col))
907+
n = n + colspan
908+
909+
-- Place the cell
910+
if not rowspan or rowspan.to == row then
911+
t[n] = cell
912+
rowStart[cell] = rowspan and rowspan.from or row
913+
colStart[cell] = col
914+
915+
if rowspan then
916+
rowspans[col] = nil
917+
end
918+
end
919+
until slotFound
920+
end
921+
end
922+
923+
local rows = ceil(n / #cols)
924+
925+
-- Determine fixed size cols and collect weights
926+
local extantH, totalWeight = totalH, 0
927+
for col,colObj in ipairs(cols) do
928+
laneH[col] = 0
929+
930+
if type(colObj) == "number" then
931+
colObj = {[colObj >= 1 and colObj < 10 and "weight" or "width"] = colObj}
932+
cols[col] = colObj
933+
end
934+
935+
if colObj.weight then
936+
-- Weight
937+
totalWeight = totalWeight + (colObj.weight or 1)
938+
else
939+
if not colObj.width or colObj.width <= 0 then
940+
-- Content width
941+
for row=1,rows do
942+
local child = t[(row - 1) * #cols + col]
943+
if child then
944+
local f = child.frame
945+
f:ClearAllPoints()
946+
local childH = f:GetWidth() or 0
947+
948+
laneH[col] = max(laneH[col], childH - GetCellDimension("H", laneH, colStart[child], col - 1, spaceH))
949+
end
950+
end
951+
952+
laneH[col] = max(colObj.min or colObj[1] or 0, min(laneH[col], colObj.max or colObj[2] or laneH[col]))
953+
else
954+
-- Rel./Abs. width
955+
laneH[col] = colObj.width < 1 and colObj.width * totalH or colObj.width
956+
end
957+
extantH = max(0, extantH - laneH[col])
958+
end
959+
end
960+
961+
-- Determine sizes based on weight
962+
local scale = totalWeight > 0 and extantH / totalWeight or 0
963+
for col,colObj in pairs(cols) do
964+
if colObj.weight then
965+
laneH[col] = scale * colObj.weight
966+
end
967+
end
968+
969+
-- Arrange children
970+
for row=1,rows do
971+
local rowV = 0
972+
973+
-- Horizontal placement and sizing
974+
for col=1,#cols do
975+
local child = t[(row - 1) * #cols + col]
976+
if child then
977+
local colObj = cols[colStart[child]]
978+
local cellObj = child:GetUserData("cell")
979+
local offsetH = GetCellDimension("H", laneH, 1, colStart[child] - 1, spaceH) + (colStart[child] == 1 and 0 or spaceH)
980+
local cellH = GetCellDimension("H", laneH, colStart[child], col, spaceH)
981+
982+
local f = child.frame
983+
f:ClearAllPoints()
984+
local childH = f:GetWidth() or 0
985+
986+
local alignFn, align = GetCellAlign("H", tableObj, colObj, cellObj, cellH, childH)
987+
f:SetPoint("LEFT", content, offsetH + align, 0)
988+
if child:IsFullWidth() or alignFn == "fill" or childH > cellH then
989+
f:SetPoint("RIGHT", content, "LEFT", offsetH + align + cellH, 0)
990+
end
991+
992+
if child.DoLayout then
993+
child:DoLayout()
994+
end
995+
996+
rowV = max(rowV, (f:GetHeight() or 0) - GetCellDimension("V", laneV, rowStart[child], row - 1, spaceV))
997+
end
998+
end
999+
1000+
laneV[row] = rowV
1001+
1002+
-- Vertical placement and sizing
1003+
for col=1,#cols do
1004+
local child = t[(row - 1) * #cols + col]
1005+
if child then
1006+
local colObj = cols[colStart[child]]
1007+
local cellObj = child:GetUserData("cell")
1008+
local offsetV = GetCellDimension("V", laneV, 1, rowStart[child] - 1, spaceV) + (rowStart[child] == 1 and 0 or spaceV)
1009+
local cellV = GetCellDimension("V", laneV, rowStart[child], row, spaceV)
1010+
1011+
local f = child.frame
1012+
local childV = f:GetHeight() or 0
1013+
1014+
local alignFn, align = GetCellAlign("V", tableObj, colObj, cellObj, cellV, childV)
1015+
if child:IsFullHeight() or alignFn == "fill" then
1016+
f:SetHeight(cellV)
1017+
end
1018+
f:SetPoint("TOP", content, 0, -(offsetV + align))
1019+
end
1020+
end
1021+
end
1022+
1023+
-- Calculate total height
1024+
local totalV = GetCellDimension("V", laneV, 1, #laneV, spaceV)
1025+
1026+
-- Cleanup
1027+
for _,v in pairs(layoutCache) do wipe(v) end
1028+
1029+
safecall(obj.LayoutFinished, obj, nil, totalV)
1030+
obj:ResumeLayout()
1031+
end)

libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
TreeGroup Container
33
Container that uses a tree control to switch between groups.
44
-------------------------------------------------------------------------------]]
5-
local Type, Version = "TreeGroup", 40
5+
local Type, Version = "TreeGroup", 41
66
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
77
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
88

9+
local WoW80 = select(4, GetBuildInfo()) >= 80000
10+
911
-- Lua APIs
1012
local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type
1113
local math_min, math_max, floor = math.min, math.max, floor
@@ -162,7 +164,7 @@ end
162164
local function FirstFrameUpdate(frame)
163165
local self = frame.obj
164166
frame:SetScript("OnUpdate", nil)
165-
self:RefreshTree()
167+
self:RefreshTree(nil, true)
166168
end
167169

168170
local function BuildUniqueValue(...)
@@ -300,6 +302,8 @@ local methods = {
300302

301303
["OnRelease"] = function(self)
302304
self.status = nil
305+
self.tree = nil
306+
self.frame:SetScript("OnUpdate", nil)
303307
for k, v in pairs(self.localstatus) do
304308
if k == "groups" then
305309
for k2 in pairs(v) do
@@ -388,8 +392,8 @@ local methods = {
388392
end
389393
end,
390394

391-
["RefreshTree"] = function(self,scrollToSelection)
392-
local buttons = self.buttons
395+
["RefreshTree"] = function(self,scrollToSelection,fromOnUpdate)
396+
local buttons = self.buttons
393397
local lines = self.lines
394398

395399
for i, v in ipairs(buttons) do
@@ -420,6 +424,12 @@ local methods = {
420424
local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18))
421425
if maxlines <= 0 then return end
422426

427+
-- workaround for lag spikes on WoW 8.0
428+
if WoW80 and self.frame:GetParent() == UIParent and not fromOnUpdate then
429+
self.frame:SetScript("OnUpdate", FirstFrameUpdate)
430+
return
431+
end
432+
423433
local first, last
424434

425435
scrollToSelection = status.scrollToSelection

libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--[[-----------------------------------------------------------------------------
22
Checkbox Widget
33
-------------------------------------------------------------------------------]]
4-
local Type, Version = "CheckBox", 23
4+
local Type, Version = "CheckBox", 24
55
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
66
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
77

@@ -26,7 +26,7 @@ local function AlignImage(self)
2626
self.text:SetPoint("LEFT", self.checkbg, "RIGHT")
2727
self.text:SetPoint("RIGHT")
2828
else
29-
self.text:SetPoint("LEFT", self.image,"RIGHT", 1, 0)
29+
self.text:SetPoint("LEFT", self.checkbg, "RIGHT", self.image:GetWidth() + 2, 0)
3030
self.text:SetPoint("RIGHT")
3131
end
3232
end
@@ -203,6 +203,7 @@ local methods = {
203203
desc:ClearAllPoints()
204204
desc:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21)
205205
desc:SetWidth(self.frame.width - 30)
206+
desc:SetPoint("RIGHT", self.frame, "RIGHT", -30, 0)
206207
desc:SetJustifyH("LEFT")
207208
desc:SetJustifyV("TOP")
208209
self.desc = desc

libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--[[-----------------------------------------------------------------------------
22
EditBox Widget
33
-------------------------------------------------------------------------------]]
4-
local Type, Version = "EditBox", 27
4+
local Type, Version = "EditBox", 28
55
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
66
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
77

@@ -81,23 +81,21 @@ end
8181
local function EditBox_OnReceiveDrag(frame)
8282
local self = frame.obj
8383
local type, id, info = GetCursorInfo()
84+
local name
8485
if type == "item" then
85-
self:SetText(info)
86-
self:Fire("OnEnterPressed", info)
87-
ClearCursor()
86+
name = info
8887
elseif type == "spell" then
89-
local name = GetSpellInfo(id, info)
90-
self:SetText(name)
91-
self:Fire("OnEnterPressed", name)
92-
ClearCursor()
88+
name = GetSpellInfo(id, info)
9389
elseif type == "macro" then
94-
local name = GetMacroInfo(id)
90+
name = GetMacroInfo(id)
91+
end
92+
if name then
9593
self:SetText(name)
9694
self:Fire("OnEnterPressed", name)
9795
ClearCursor()
96+
HideButton(self)
97+
AceGUI:ClearFocus()
9898
end
99-
HideButton(self)
100-
AceGUI:ClearFocus()
10199
end
102100

103101
local function EditBox_OnTextChanged(frame)

0 commit comments

Comments
 (0)