- fixed up a few areas that were expecting moduleSettings.markers to be non-nil; this isn't the case on user-created custom bars that existed prior to the marker code coming in

- hide the marker settings on the GCD module as they don't make much sense to have there
This commit is contained in:
Parnic
2010-09-13 05:45:45 +00:00
parent e6185049f6
commit f12ee4110d
2 changed files with 16 additions and 7 deletions

View File

@ -692,8 +692,10 @@ if not self.moduleSettings.bHideMarkerSettings then
desc = "Choose a marker to edit. This will place the marker's settings in the fields above here.", desc = "Choose a marker to edit. This will place the marker's settings in the fields above here.",
values = function() values = function()
local retval = {} local retval = {}
for i=1, #self.moduleSettings.markers do if self.moduleSettings.markers then
retval[i] = ((self.moduleSettings.markers[i].position + 0.5) * 100) .. "%" for i=1, #self.moduleSettings.markers do
retval[i] = ((self.moduleSettings.markers[i].position + 0.5) * 100) .. "%"
end
end end
return retval return retval
end, end,
@ -714,7 +716,7 @@ if not self.moduleSettings.bHideMarkerSettings then
name = "Update", name = "Update",
desc = "This will update the marker selected in the 'edit marker' box with the values specified.", desc = "This will update the marker selected in the 'edit marker' box with the values specified.",
func = function() func = function()
if lastEditMarkerConfig <= #self.moduleSettings.markers then if self.moduleSettings.markers and lastEditMarkerConfig <= #self.moduleSettings.markers then
self:EditMarker(lastEditMarkerConfig, lastMarkerPosConfig / 100, lastMarkerColorConfig, lastMarkerHeightConfig) self:EditMarker(lastEditMarkerConfig, lastMarkerPosConfig / 100, lastMarkerColorConfig, lastMarkerHeightConfig)
end end
end, end,
@ -725,7 +727,7 @@ if not self.moduleSettings.bHideMarkerSettings then
name = "Remove", name = "Remove",
desc = "This will remove the marker selected in the 'edit marker' box. This action is irreversible.", desc = "This will remove the marker selected in the 'edit marker' box. This action is irreversible.",
func = function() func = function()
if lastEditMarkerConfig <= #self.moduleSettings.markers then if self.moduleSettings.markers and lastEditMarkerConfig <= #self.moduleSettings.markers then
self:RemoveMarker(lastEditMarkerConfig) self:RemoveMarker(lastEditMarkerConfig)
end end
end, end,
@ -1057,9 +1059,11 @@ function IceBarElement.prototype:UpdateBar(scale, color, alpha)
self.frame.bg:SetVertexColor(r, g, b, self.backgroundAlpha) self.frame.bg:SetVertexColor(r, g, b, self.backgroundAlpha)
self.barFrame.bar:SetVertexColor(self:GetColor(color)) self.barFrame.bar:SetVertexColor(self:GetColor(color))
for i=1, #self.Markers do if self.moduleSettings.markers then
local color = self.moduleSettings.markers[i].color for i=1, #self.Markers do
self.Markers[i].bar:SetVertexColor(color.r, color.g, color.b, self.alpha) local color = self.moduleSettings.markers[i].color
self.Markers[i].bar:SetVertexColor(color.r, color.g, color.b, self.alpha)
end
end end
if self.DesiredScale ~= scale then if self.DesiredScale ~= scale then
@ -1241,6 +1245,10 @@ function IceBarElement.prototype:NotifyBarOverrideChanged()
end end
function IceBarElement.prototype:AddNewMarker(inPosition, inColor, inHeight) function IceBarElement.prototype:AddNewMarker(inPosition, inColor, inHeight)
if not self.moduleSettings.markers then
self.moduleSettings.markers = {}
end
local idx = #self.moduleSettings.markers + 1 local idx = #self.moduleSettings.markers + 1
self.moduleSettings.markers[idx] = { self.moduleSettings.markers[idx] = {
position = inPosition - 0.5, -- acceptable range is -0.5 to +0.5 position = inPosition - 0.5, -- acceptable range is -0.5 to +0.5

View File

@ -83,6 +83,7 @@ function GlobalCoolDown.prototype:GetDefaultSettings()
settings["lowThreshold"] = 0 settings["lowThreshold"] = 0
settings["barVisible"]["bg"] = false settings["barVisible"]["bg"] = false
settings["usesDogTagStrings"] = false settings["usesDogTagStrings"] = false
settings["bHideMarkerSettings"] = true
return settings return settings
end end