Version 0.9.0-rc1
- enable/disable from slash command - matching conditions (never, always, start, end, start or end) - support capturing groups - import examples - testing capabilities - compatibility with WoW Retail - adapted help texts - spelling errors
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
-- read namespace from global env
|
||||
local _G = _G
|
||||
local Grichelde = _G.Grichelde
|
||||
local Grichelde = _G.Grichelde or {}
|
||||
|
||||
--- add Minimap button
|
||||
function Grichelde:MinimapButton()
|
||||
local function clickHandler(_, button)
|
||||
if button == 'LeftButton' then
|
||||
if (button == "LeftButton") then
|
||||
self:ToggleOptions()
|
||||
elseif button == 'RightButton' then
|
||||
elseif (button == "RightButton") then
|
||||
self:ToggleActivation()
|
||||
end
|
||||
end
|
||||
|
||||
local function updateTooltip(tooltip)
|
||||
if not tooltip or not tooltip.AddLine then return end
|
||||
if (tooltip == nil) or (tooltip.AddLine == nil) then return end
|
||||
|
||||
local tooltipTitle = self:Format(self.L.Minimap_Tooltip_Enabled, self.L.AddonName)
|
||||
if not self.db.profile.enabled then
|
||||
@@ -35,7 +35,7 @@ function Grichelde:MinimapButton()
|
||||
end
|
||||
|
||||
local darkened = Grichelde.MINIMAP_ENABLED
|
||||
if not self.db.profile.enabled then
|
||||
if (self.db.profile.enabled == false) then
|
||||
darkened = Grichelde.MINIMAP_DARKENDED
|
||||
end
|
||||
|
||||
@@ -63,7 +63,7 @@ function Grichelde:ToggleMinimapButton()
|
||||
self.db.profile.minimapButton.hide = not self.db.profile.minimapButton.hide
|
||||
self:DebugPrint("ToggleMinimapButton : hidden: ", self.db.profile.minimapButton.hide)
|
||||
|
||||
if self.db.profile.minimapButton.hide then
|
||||
if (self.db.profile.minimapButton.hide == true) then
|
||||
self:HideMinimapButton()
|
||||
else
|
||||
self:ShowMinimapButton()
|
||||
@@ -71,37 +71,54 @@ function Grichelde:ToggleMinimapButton()
|
||||
end
|
||||
|
||||
function Grichelde:ShowMinimapButton()
|
||||
if self.icon then
|
||||
if (self.icon ~= nil) then
|
||||
self.icon:Show(self.name)
|
||||
end
|
||||
end
|
||||
|
||||
function Grichelde:HideMinimapButton()
|
||||
if self.icon then
|
||||
if (self.icon ~= nil) then
|
||||
self.icon:Hide(self.name)
|
||||
end
|
||||
end
|
||||
|
||||
function Grichelde:ToggleActivation()
|
||||
self.db.profile.enabled = not self.db.profile.enabled
|
||||
-- refresh option UI if open at the moment
|
||||
self.dialog:SelectGroup(self.name, "enabled")
|
||||
|
||||
local formatString = self.L.AddonLoaded
|
||||
local darkened = Grichelde.MINIMAP_ENABLED
|
||||
if not self.db.profile.enabled then
|
||||
formatString = self.L.AddonUnloaded
|
||||
darkened = Grichelde.MINIMAP_DARKENDED
|
||||
if (self.db.profile.enabled == true) then
|
||||
self:Deactivate()
|
||||
else
|
||||
self:Activate()
|
||||
end
|
||||
end
|
||||
|
||||
if self.dialog ~= nil and self.dialog.OpenFrames[self.name] ~= nil then
|
||||
function Grichelde:Activate()
|
||||
self.db.profile.enabled = true
|
||||
|
||||
-- refresh option UI if open at the moment
|
||||
if (self.dialog ~= nil) and (self.dialog.OpenFrames[self.name] ~= nil) then
|
||||
self.dialog:SelectGroup(self.name, "enabled")
|
||||
local namePlusVersion = self:Format(self.L.AddonNamePlusVersion, self.L.AddonName, self.version)
|
||||
local statusText = self:Format(formatString, namePlusVersion)
|
||||
local statusText = self:Format(self.L.AddonLoaded, namePlusVersion)
|
||||
self.dialog.OpenFrames[self.name]:SetStatusText(statusText)
|
||||
end
|
||||
|
||||
self.ldb.iconR = darkened
|
||||
self.ldb.iconG = darkened
|
||||
self.ldb.iconB = darkened
|
||||
self.ldb.iconR = Grichelde.MINIMAP_ENABLED
|
||||
self.ldb.iconG = Grichelde.MINIMAP_ENABLED
|
||||
self.ldb.iconB = Grichelde.MINIMAP_ENABLED
|
||||
end
|
||||
|
||||
function Grichelde:Deactivate()
|
||||
self.db.profile.enabled = false
|
||||
|
||||
-- refresh option UI if open at the moment
|
||||
if (self.dialog ~= nil) and (self.dialog.OpenFrames[self.name] ~= nil) then
|
||||
self.dialog:SelectGroup(self.name, "enabled")
|
||||
local namePlusVersion = self:Format(self.L.AddonNamePlusVersion, self.L.AddonName, self.version)
|
||||
local statusText = self:Format(self.L.AddonUnloaded, namePlusVersion)
|
||||
self.dialog.OpenFrames[self.name]:SetStatusText(statusText)
|
||||
end
|
||||
|
||||
self.ldb.iconR = Grichelde.MINIMAP_DARKENDED
|
||||
self.ldb.iconG = Grichelde.MINIMAP_DARKENDED
|
||||
self.ldb.iconB = Grichelde.MINIMAP_DARKENDED
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user