Skip to content

Commit 656ea52

Browse files
committed
BugFix: Statuses Class&Spec Load filter did not work (ticket #1017).
1 parent 6e3fb10 commit 656ea52

File tree

9 files changed

+32
-32
lines changed

9 files changed

+32
-32
lines changed

GridStatusLoad.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ local next = next
77
-- local variables
88
local indicators = {} -- indicators marked for update
99
local registered = {} -- registered messages
10-
local statuses = { playerSpec = {}, groupInstType = {}, instNameID = {} }
10+
local statuses = { playerClassSpec = {}, groupInstType = {}, instNameID = {} }
1111

1212
-- local functions
1313
local function RegisterMessage(message, enabled)
@@ -22,11 +22,11 @@ local function RegisterMessage(message, enabled)
2222
end
2323

2424
local function UpdateMessages(status, load)
25-
statuses.playerSpec[status] = load and load.playerSpec~=nil or nil
25+
statuses.playerClassSpec[status] = load and load.playerClassSpec~=nil or nil
2626
statuses.instNameID[status] = load and load.instNameID~=nil or nil
2727
statuses.groupInstType[status] = load and (load.groupType~=nil or load.instType~=nil) or nil
2828
RegisterMessage( "Grid_GroupTypeChanged", next(statuses.groupInstType) )
29-
RegisterMessage( "Grid_PlayerSpecChanged", next(statuses.playerSpec) )
29+
RegisterMessage( "Grid_PlayerSpecChanged", next(statuses.playerClassSpec) )
3030
RegisterMessage( "Grid_ZoneChangedNewArea", next(statuses.instNameID) )
3131
end
3232

@@ -85,12 +85,17 @@ local function RefreshStatus(self)
8585
end
8686

8787
local function RefreshStatuses(filterType)
88+
local notify
8889
for status in pairs(statuses[filterType]) do
8990
if UpdateStatus(status) then
9091
RegisterIndicators(status)
92+
notify = true
9193
end
9294
end
9395
UpdateIndicators()
96+
if notify then
97+
Grid2:SendMessage("Grid_StatusLoadChanged")
98+
end
9499
end
95100

96101
-- message events
@@ -99,7 +104,7 @@ function Grid2:Grid_GroupTypeChanged()
99104
end
100105

101106
function Grid2:Grid_PlayerSpecChanged()
102-
RefreshStatuses('playerSpec')
107+
RefreshStatuses('playerClassSpec')
103108
end
104109

105110
function Grid2:Grid_ZoneChangedNewArea()

Options/GridIndicators.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ do
185185
if len>2 or len==0 then
186186
Grid2Options.LI[name] = len>2 and text or nil
187187
Grid2Options:MakeIndicatorOptions(Grid2.indicators[name])
188-
LibStub("AceConfigRegistry-3.0"):NotifyChange("Grid2")
188+
Grid2Options:NotifyChange()
189189
end
190190
end)
191191
end

Options/GridStatuses.lua

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,23 +246,24 @@ end
246246
function Grid2Options:MakeStatusOptions(status)
247247
local catGroup, name, desc, icon, coords, deletable, params = self:GetStatusInfo(status)
248248
if catGroup then
249-
local order = params and params.groupOrder
250-
local group = catGroup.args[status.name]
249+
local gorder = params and params.groupOrder
250+
local order = (type(gorder)=='function' and gorder(status) or gorder) or (status.name==status.dbx.type and 100 or 200)
251+
local group = catGroup.args[status.name]
251252
if group then
252253
wipe(group.args)
253254
else
254255
group = { type = "group", args = {} }
255256
catGroup.args[status.name] = group
256257
end
257-
group.name = name
258258
group.desc = desc
259259
group.icon = icon
260260
group.iconCoords = coords
261261
group.childGroups = params and params.childGroups or "tab"
262-
group.order = (type(order)=='function' and order(status) or order) or (status.name==status.dbx.type and 100 or 200)
263-
if status.suspended then
264-
group.order = group.order+500
265-
group.name = string.format('|cFF808080%s|r',group.name)
262+
group.order = function(info)
263+
return status.suspended and order+500 or order
264+
end
265+
group.name = function(info)
266+
return status.suspended and string.format('|cFF808080%s|r',name) or name
266267
end
267268
self:MakeStatusChildOptions(status, group.args)
268269
end

Options/GridThemes.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ do
241241
db.extraThemes[index] = CopyTheme( itemp==0 and db or db.extraThemes[itemp] )
242242
end
243243
Grid2Options:MakeThemeOptions(index)
244-
LibStub("AceConfigRegistry-3.0"):NotifyChange("Grid2")
244+
Grid2Options:NotifyChange()
245245
end)
246246
end,
247247
values = GetThemes,
@@ -257,7 +257,7 @@ do
257257
local name = editedTheme.db.names[index] or L['Default']
258258
Grid2Options:ShowEditDialog( L["Rename Theme:"], name, function(text)
259259
editedTheme.db.names[index] = text
260-
LibStub("AceConfigRegistry-3.0"):NotifyChange("Grid2")
260+
Grid2Options:NotifyChange()
261261
end)
262262
end,
263263
values = GetThemes,
@@ -356,7 +356,7 @@ function Grid2Options:MakeThemeOptions( index )
356356
options[tostring(index)] = { type = "group", childGroups = "tab", order = index+300, name = GetThemeName, desc = "", arg = index, args = themeOptions }
357357
end
358358

359-
Grid2:RegisterMessage("Grid_ThemeChanged", function() LibStub("AceConfigRegistry-3.0"):NotifyChange("Grid2") end)
359+
Grid2:RegisterMessage("Grid_ThemeChanged", Grid2Options.NotifyChange)
360360

361361
--===========================================================================================
362362

Options/GridUtils.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ function Grid2Options:PackColor( r,g,b,a, dbx, key )
130130
return { r=r, g=g, b=b, a=a }
131131
end
132132

133+
-- Refresh AceConfig options window
134+
function Grid2Options:NotifyChange() -- do not use self variable inside this function (self can be nil or ~=Grid2Options)
135+
LibStub("AceConfigRegistry-3.0"):NotifyChange("Grid2")
136+
end
137+
133138
-- Grid2Options:EnableLoadOnDemand()
134139
-- Delays the creation of indicators and statuses options, until the user clicks on each option,
135140
-- reducing initial memory usage and load time. Instead of the real options, a "description" type option
@@ -153,7 +158,7 @@ do
153158
else
154159
methods[typ..'_']( Grid2Options, Grid2[typ][key] )
155160
end
156-
LibStub("AceConfigRegistry-3.0"):NotifyChange("Grid2")
161+
Grid2Options:NotifyChange()
157162
end
158163
}
159164
local function hook(self, options, extraOptions)

Options/modules/general/GridExportImport.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ local function ImportProfile(sender, data, Hex, importCustomLayouts)
181181
end
182182
end
183183
self:ProfileChanged()
184-
LibStub("AceConfigRegistry-3.0"):NotifyChange("Grid2")
184+
Grid2Options:NotifyChange()
185185
end
186186
Grid2.db:SetProfile(profileName)
187187
if importCustomLayouts then

Options/modules/statuses/Status.lua

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,11 @@ do
4848
end
4949
end
5050

51-
local function RefreshStatusOptions(status)
52-
local name = Grid2Options.LocalizeStatus(status, true)
53-
local group = Grid2Options:GetStatusGroup(status)
54-
if status.suspended then
55-
group.order = group.order - 500
56-
group.name = string.format('|cFF808080%s|r',name)
57-
else
58-
group.order = group.order + 500
59-
group.name = name
60-
end
61-
end
62-
6351
local function RefreshStatus(status, isUnitFilter)
6452
if isUnitFilter then
6553
status:Refresh(true)
6654
elseif status:RefreshLoad() then
67-
RefreshStatusOptions(status)
55+
Grid2Options:NotifyChange()
6856
end
6957
end
7058

@@ -279,6 +267,7 @@ do
279267
end
280268
return options
281269
end
270+
Grid2:RegisterMessage("Grid_StatusLoadChanged", Grid2Options.NotifyChange)
282271
end
283272

284273
-- Grid2Options:MakeStatusDeleteOptions()

Options/modules/statuses/StatusAura.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function Grid2Options:MakeStatusAuraUseSpellIdOptions(status, options, optionPar
130130
status.dbx.useSpellId = (type(text)=="number") or nil
131131
status:UpdateDB()
132132
Grid2Options:MakeStatusOptions(status)
133-
LibStub("AceConfigRegistry-3.0"):NotifyChange("Grid2")
133+
Grid2Options:NotifyChange()
134134
end
135135
end,
136136
}

Options/modules/themes/GridGeneral.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,4 +451,4 @@ Grid2Options:AddThemeOptions( "appearance", "Appearance", options )
451451
-- Refresh theme general options the first time they are displayed, it's a workaround to a weird bug in AceConfig/AceGUI:
452452
-- sometimes all editboxes of sliders do not display any value, this only happens when we have 3 nested groups like in:
453453
-- "Themes>Default>General Tab>options width sliders", and clicking very fast to open general theme options.
454-
options.bugfix = { type = "header", order = 500, name = "", hidden = function() options.bugfix = nil; LibStub("AceConfigRegistry-3.0"):NotifyChange("Grid2"); return true end }
454+
options.bugfix = { type = "header", order = 500, name = "", hidden = function() options.bugfix = nil; Grid2Options:NotifyChange(); return true end }

0 commit comments

Comments
 (0)