Skip to content

Commit 0de8c0e

Browse files
author
michaelspain
committed
Added background indicator.
Changed some border and background settings.
1 parent 1ef0111 commit 0de8c0e

16 files changed

+206
-61
lines changed

Grid2.toc

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ GridDefaultsClassic.lua
6060
# Indicators
6161
modules\IndicatorAlpha.lua
6262
modules\IndicatorBorder.lua
63+
modules\IndicatorBackground.lua
6364
modules\IndicatorBar.lua
6465
modules\IndicatorMultiBar.lua
6566
modules\IndicatorText.lua

GridDefaults.lua

+5-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ end
5151
function Grid2:UpdateDefaults()
5252

5353
local version= Grid2:DbGetValue("versions","Grid2") or 0
54-
if version>=6 then return end
54+
if version>=7 then return end
5555
if version==0 then
5656
self:MakeDefaultsCommon()
5757
self:MakeDefaultsClass()
@@ -86,8 +86,11 @@ function Grid2:UpdateDefaults()
8686
if version<6 then
8787
Grid2:DbSetValue( "indicators", "tooltip", {type = "tooltip", displayUnitOOC = true} )
8888
end
89+
if version<7 then
90+
Grid2:DbSetValue( "indicators", "background", {type = "background"})
91+
end
8992
end
9093
-- Set database version
91-
Grid2:DbSetValue("versions","Grid2",6)
94+
Grid2:DbSetValue("versions","Grid2",7)
9295

9396
end

GridDefaultsClassic.lua

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ local defaultFont = "Friz Quadrata TT"
88

99
-- Default configurations
1010
function Grid2:MakeDefaultsCommon()
11+
Grid2:DbSetValue( "indicators", "background", {type = "background"})
12+
1113
Grid2:DbSetValue( "indicators", "tooltip", {type = "tooltip", showTooltip = 4, showDefault = true} )
1214

1315
Grid2:DbSetValue( "indicators", "alpha", {type = "alpha"})

GridDefaultsRetail.lua

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ local defaultFont = "Friz Quadrata TT"
88

99
-- Default configurations
1010
function Grid2:MakeDefaultsCommon()
11+
Grid2:DbSetValue( "indicators", "background", {type = "background"})
12+
1113
Grid2:DbSetValue( "indicators", "tooltip", {type = "tooltip", showTooltip = 4, showDefault = true} )
1214

1315
Grid2:DbSetValue( "indicators", "alpha", {type = "alpha"})

GridFrame.lua

+5-4
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ function GridFramePrototype:Layout()
136136
-- visible background
137137
local container= self.container
138138
container:SetPoint("CENTER", self, "CENTER")
139-
-- visible background color
140-
local cb = dbx.frameContentColor
141-
container:SetVertexColor(cb.r, cb.g, cb.b, cb.a)
139+
-- visible background color (commented because now this color is set by the background indicator)
140+
-- local cb = dbx.frameContentColor
141+
-- container:SetVertexColor(cb.r, cb.g, cb.b, cb.a)
142142
-- shrink the background, showing part of the real frame background (that is behind) as a inner border.
143143
local inset = (dbx.frameBorder+dbx.frameBorderDistance)*2
144144
container:SetSize( w-inset, h-inset )
@@ -190,6 +190,7 @@ Grid2Frame.defaultDB = {
190190
frameHeight = 48,
191191
frameWidth = 48,
192192
frameBorder = 2,
193+
frameBorderColor = {r=0, g=0, b=0, a=0},
193194
frameBorderTexture = "Grid2 Flat",
194195
frameBorderDistance= 1,
195196
frameTexture = "Gradient",
@@ -441,4 +442,4 @@ _G.Grid2Frame = Grid2Frame
441442
-- Allow other modules/addons to easily modify the grid unit frames
442443
Grid2Frame.Prototype = GridFramePrototype
443444
-- Allow other modules to access the variable for speed optimization
444-
Grid2.frames_of_unit = frames_of_unit
445+
Grid2.frames_of_unit = frames_of_unit

Options/GridIndicators.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Grid2Options.indicatorIconPath = "Interface\\Addons\\Grid2Options\\media\\indica
1212
Grid2Options.indicatorTypes = {}
1313

1414
-- Indicators sort order
15-
Grid2Options.indicatorTypesOrder= { tooltip = 1, alpha = 2, border = 3, multibar = 4, bar = 5, text = 6, square = 7, icon = 8, icons = 9, portrait = 10 }
15+
Grid2Options.indicatorTypesOrder= { tooltip = 1, alpha = 2, background = 3, border = 4, multibar = 5, bar = 6, text = 7, square = 8, icon = 9, icons = 10, portrait = 11 }
1616

1717
do
1818
-- ban these indicator names

Options/GridThemes.lua

+8
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,14 @@ Grid2:RegisterMessage("Grid_ThemeChanged", function() LibStub("AceConfigRegistry
341341

342342
--===========================================================================================
343343

344+
function Grid2Options:ThemesAreEnabled()
345+
return Grid2Frame.dba.profile.extraThemes ~= nil
346+
end
347+
348+
function Grid2Options:ThemesAreDisabled()
349+
return Grid2Frame.dba.profile.extraThemes == nil
350+
end
351+
344352
local order = 0
345353
function Grid2Options:AddThemeOptions( key, name, options )
346354
order = order + 1

Options/locales/esES.lua

+1
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ L["power"] = "poder"
585585
L["poweralt"] = "poder alternativo"
586586
L["alpha"] = "transparencia"
587587
L["border"] = "borde"
588+
L["background"] = "fondo"
588589
L["heals"] = "curas"
589590
L["health"] = "vida"
590591
L["charmed"] = "controlado"
643 Bytes
Binary file not shown.

Options/modules.xml

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
<Script file="modules\indicators\Indicator.lua"/>
3838
<Script file="modules\indicators\IndicatorAlpha.lua"/>
39+
<Script file="modules\indicators\IndicatorBackground.lua"/>
3940
<Script file="modules\indicators\IndicatorBar.lua"/>
4041
<Script file="modules\indicators\IndicatorMultiBar.lua"/>
4142
<Script file="modules\indicators\IndicatorBorder.lua"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
local L = Grid2Options.L
2+
3+
Grid2Options:RegisterIndicatorOptions("background", false, function(self, indicator)
4+
local statuses, options = {}, {}
5+
self:MakeIndicatorBackgroundOptions(indicator, options)
6+
self:MakeIndicatorStatusOptions(indicator, statuses)
7+
self:AddIndicatorOptions(indicator, statuses, options)
8+
end)
9+
10+
function Grid2Options:MakeIndicatorBackgroundOptions(indicator,options)
11+
options.colorBackground = {
12+
type = "color",
13+
hasAlpha = true,
14+
order = 10,
15+
width = "full",
16+
name = L["Default Background Color"],
17+
desc = L["Sets the background color to use when no status is active."],
18+
get = function()
19+
local c= Grid2Frame.db.profile.frameContentColor
20+
return c.r, c.g, c.b, c.a
21+
end,
22+
set = function( info, r,g,b,a )
23+
local c= Grid2Frame.db.profile.frameContentColor
24+
c.r, c.g, c.b, c.a = r, g, b, a
25+
Grid2Frame:UpdateIndicators()
26+
end,
27+
}
28+
options.message = {
29+
type = "description",
30+
order = 100,
31+
name = L['|cFFe0e000\nWarning: These options are applied to the active theme, if you want to change the settings for another theme go to the Appearance tab inside the Themes section.'],
32+
hidden = self.ThemesAreDisabled,
33+
}
34+
return options
35+
end
+29-23
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,34 @@
11
local L = Grid2Options.L
22

33
Grid2Options:RegisterIndicatorOptions("border", false, function(self, indicator)
4-
local options, statuses = {}, {}
5-
self:MakeIndicatorBorderCustomOptions(indicator,options)
6-
self:MakeIndicatorColorOptions(indicator, options, {
7-
color1 = L["Border Background Color"],
8-
colorDesc1 = L["Adjust border background color and alpha."],
9-
typeKey = "indicators",
10-
})
4+
local statuses, options = {}, {}
5+
self:MakeIndicatorBorderCustomOptions(indicator, options)
116
self:MakeIndicatorStatusOptions(indicator, statuses)
127
self:AddIndicatorOptions(indicator, statuses, options )
138
end)
149

1510
function Grid2Options:MakeIndicatorBorderCustomOptions(indicator,options)
11+
options.borderColor = {
12+
type = "color",
13+
order = 10,
14+
name = L["Default Border Color"],
15+
desc = L["Sets the color for the border when no status is active."],
16+
hasAlpha = true,
17+
get = function()
18+
c = Grid2:MakeColor( Grid2Frame.db.profile.frameBorderColor, 'TRANSPARENT' )
19+
return c.r, c.g, c.b, c.a
20+
end,
21+
set = function( info, r,g,b,a )
22+
local c = Grid2Frame.db.profile.frameBorderColor or {}
23+
c.r, c.g, c.b, c.a = r, g, b, a
24+
Grid2Frame.db.profile.frameBorderColor = c
25+
Grid2Frame:UpdateIndicators()
26+
end,
27+
}
28+
options.sepColor = { order = 11, type = "description", name = "" }
1629
options.borderSize = {
1730
type = "range",
18-
order = 10,
31+
order = 20,
1932
name = L["Border Size"],
2033
desc = L["Adjust the border of each unit's frame."],
2134
min = 1,
@@ -28,23 +41,10 @@ function Grid2Options:MakeIndicatorBorderCustomOptions(indicator,options)
2841
end,
2942
disabled = InCombatLockdown,
3043
}
31-
options.borderDistance= {
32-
type = "range",
33-
name = L["Border separation"],
34-
desc = L["Adjust the distance between the border and the frame content."],
35-
min = -16,
36-
max = 16,
37-
step = 1,
38-
order = 15,
39-
get = function () return Grid2Frame.db.profile.frameBorderDistance end,
40-
set = function (_, v)
41-
Grid2Frame.db.profile.frameBorderDistance = v
42-
Grid2Frame:LayoutFrames(true)
43-
end,
44-
}
44+
options.sepSize = { order = 21, type = "description", name = "" }
4545
options.borderTexture = {
4646
type = "select", dialogControl = "LSM30_Border",
47-
order = 25,
47+
order = 30,
4848
name = L["Border Texture"],
4949
desc = L["Adjust the border texture."],
5050
get = function (info) return Grid2Frame.db.profile.frameBorderTexture or "Grid2 Flat" end,
@@ -54,5 +54,11 @@ function Grid2Options:MakeIndicatorBorderCustomOptions(indicator,options)
5454
end,
5555
values = AceGUIWidgetLSMlists.border,
5656
}
57+
options.message = {
58+
type = "description",
59+
order = 100,
60+
name = L['|cFFe0e000\nWarning: These options are applied to the active theme, if you want to change the settings for another theme go to the Appearance tab inside the Themes section.'],
61+
hidden = self.ThemesAreDisabled,
62+
}
5763
end
5864

Options/modules/themes/GridGeneral.lua

+78-26
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,13 @@ local frameOptions = { framewidth = {
301301
Grid2Options:LayoutTestRefresh()
302302
end,
303303
disabled = InCombatLockdown,
304-
}, texture = {
304+
}, headerback = {
305+
type = "header",
306+
order = 21,
307+
name = L["Background"],
308+
}, backgroundTexture = {
305309
type = "select", dialogControl = "LSM30_Statusbar",
306-
order = 25,
310+
order = 22,
307311
name = L["Background Texture"],
308312
desc = L["Select the frame background texture."],
309313
get = function (info) return theme.frame.frameTexture or "Gradient" end,
@@ -312,39 +316,56 @@ local frameOptions = { framewidth = {
312316
Grid2Frame:LayoutFrames(true)
313317
end,
314318
values = AceGUIWidgetLSMlists.statusbar,
315-
}, borderDistance= {
316-
type = "range",
317-
name = L["Inner Border Size"],
318-
desc = L["Sets the size of the inner border of each unit frame"],
319-
min = -16,
320-
max = 16,
321-
step = 1,
322-
order = 27,
323-
get = function ()
324-
return theme.frame.frameBorderDistance
325-
end,
326-
set = function (_, v)
327-
theme.frame.frameBorderDistance = v
328-
Grid2Frame:LayoutFrames(true)
329-
end,
330-
}, colorContent = {
319+
}, backgroundColor = {
331320
type = "color",
332-
order = 30,
321+
order = 23,
333322
name = L["Background Color"],
334-
desc = L["Sets the background color of each unit frame"],
323+
desc = L["Sets the default color for the background indicator."],
335324
get = function()
336325
local c= theme.frame.frameContentColor
337326
return c.r, c.g, c.b, c.a
338327
end,
339328
set = function( info, r,g,b,a )
340-
local c= theme.frame.frameContentColor
329+
local c = theme.frame.frameContentColor
341330
c.r, c.g, c.b, c.a = r, g, b, a
342-
Grid2Frame:LayoutFrames(true)
343331
Grid2Frame:UpdateIndicators()
344332
end,
345333
hasAlpha = true,
346-
347-
}, colorFrame = {
334+
}, headerborder = {
335+
type = "header",
336+
order = 25,
337+
name = L["Borders"],
338+
}, borderIndicatorColor = {
339+
type = "color",
340+
order = 32,
341+
name = L["Outer Border Color"],
342+
desc = L["Sets the default color for the border indicator."],
343+
get = function()
344+
c = Grid2:MakeColor( theme.frame.frameBorderColor, 'TRANSPARENT' )
345+
return c.r, c.g, c.b, c.a
346+
end,
347+
set = function( info, r,g,b,a )
348+
local c = theme.frame.frameBorderColor or {}
349+
c.r, c.g, c.b, c.a = r, g, b, a
350+
theme.frame.frameBorderColor = c
351+
Grid2Frame:UpdateIndicators()
352+
end,
353+
hasAlpha = true,
354+
}, borderIndicatorSize = {
355+
type = "range",
356+
order = 33,
357+
name = L["Outer Border Size"],
358+
desc = L["Adjust the border of each unit's frame."],
359+
min = 1,
360+
max = 20,
361+
step = 1,
362+
get = function () return theme.frame.frameBorder end,
363+
set = function (_, frameBorder)
364+
theme.frame.frameBorder = frameBorder
365+
Grid2Frame:LayoutFrames(true)
366+
end,
367+
disabled = InCombatLockdown,
368+
}, innerBordercolor = {
348369
type = "color",
349370
order = 40,
350371
name = L["Inner Border Color"],
@@ -359,11 +380,42 @@ local frameOptions = { framewidth = {
359380
Grid2Frame:LayoutFrames(true)
360381
end,
361382
hasAlpha = true,
383+
}, innerBorderDistance= {
384+
type = "range",
385+
order = 41,
386+
name = L["Inner Border Size"],
387+
desc = L["Sets the size of the inner border of each unit frame"],
388+
min = -16,
389+
max = 16,
390+
step = 1,
391+
get = function ()
392+
return theme.frame.frameBorderDistance
393+
end,
394+
set = function (_, v)
395+
theme.frame.frameBorderDistance = v
396+
Grid2Frame:LayoutFrames(true)
397+
end,
398+
}, borderIndicatorTexture = {
399+
type = "select", dialogControl = "LSM30_Border",
400+
order = 42,
401+
name = L["Outer Border Texture"],
402+
desc = L["Adjust the border texture."],
403+
get = function (info) return theme.frame.frameBorderTexture or "Grid2 Flat" end,
404+
set = function (info, v)
405+
theme.frame.frameBorderTexture = v
406+
Grid2Frame:LayoutFrames(true)
407+
end,
408+
values = AceGUIWidgetLSMlists.border,
409+
410+
}, headermouse = {
411+
type = "header",
412+
order = 50,
413+
name = L["Mouseover"],
362414
}, mouseoverHighlight = {
363415
type = "toggle",
364416
name = L["Mouseover Highlight"],
365417
desc = L["Toggle mouseover highlight."],
366-
order = 60,
418+
order = 51,
367419
get = function ()
368420
return theme.frame.mouseoverHighlight
369421
end,
@@ -373,7 +425,7 @@ local frameOptions = { framewidth = {
373425
end,
374426
}, mouseoverColor = {
375427
type = "color",
376-
order = 70,
428+
order = 55,
377429
name = L["Highlight Color"],
378430
desc = L["Sets the hightlight color of each unit frame"],
379431
get = function()

0 commit comments

Comments
 (0)