Add Minimap button and option to hide it
Tek Hudson [08-11-19 - 05:30]
Add Minimap button and option to hide it
diff --git a/DruidBar.lua b/DruidBar.lua
index c24ccf8..c4b3a63 100644
--- a/DruidBar.lua
+++ b/DruidBar.lua
@@ -172,6 +172,7 @@ function Load_Variables(className)
DruidBarKey.extra = 0;
DruidBarKey.Enabled = true;
DruidBarKey.Graphics = true;
+ DruidBarKey.Minimap = true;
DruidBarKey.DontShiftBack = false;
DruidBarKey.tempW = 170;
DruidBarKey.tempH = 18;
@@ -429,6 +430,12 @@ function DruidBar_MainGraphics()
if PlayerFrameManaBar:GetWidth() < 100 then PlayerFrameManaBar:SetWidth(120); end
+ -- If Minimap Icon should show based on settings
+ if DruidBarKey.Minimap then
+ DruidBar_MinimapButton:Show();
+ else
+ DruidBar_MinimapButton:Hide();
+ end
-- If DruidBar should show based on settings
if DruidBar_ShouldBeVisible() then
-- Render DruidBar
diff --git a/DruidBar.xml b/DruidBar.xml
index 1e0f49d..c079b81 100644
--- a/DruidBar.xml
+++ b/DruidBar.xml
@@ -147,28 +147,28 @@
</Anchors>
<Layers>
- <Layer level="BACKGROUND">
- <Texture name="DruidBar_MinimapButton_Icon" file="Interface\Icons\ABILITY_DRUID_DEMORALIZINGROAR">
+ <Layer level="OVERLAY">
+ <Texture name="DruidBar_MinimapButton_Border" file="Interface\Minimap\MiniMap-TrackingBorder">
<Size>
- <AbsDimension x="21" y="21"/>
+ <AbsDimension x="56" y="56"/>
</Size>
<Anchors>
- <Anchor point="TOPLEFT">
- <Offset>
- <AbsDimension x="7" y="-6"/>
- </Offset>
- </Anchor>
+ <Anchor point="TOPLEFT"/>
</Anchors>
</Texture>
</Layer>
- <Layer level="OVERLAY">
- <Texture file="Interface\Minimap\MiniMap-TrackingBorder">
+ <Layer level="ARTWORK">
+ <Texture name="DruidBar_MinimapButton_Icon" file="Interface\Icons\ABILITY_DRUID_DEMORALIZINGROAR">
<Size>
- <AbsDimension x="56" y="56"/>
+ <AbsDimension x="21" y="21"/>
</Size>
<Anchors>
- <Anchor point="TOPLEFT"/>
+ <Anchor point="TOPLEFT">
+ <Offset>
+ <AbsDimension x="7" y="-6"/>
+ </Offset>
+ </Anchor>
</Anchors>
</Texture>
</Layer>
diff --git a/Options.lua b/Options.lua
index 4aac886..ea5f512 100644
--- a/Options.lua
+++ b/Options.lua
@@ -62,6 +62,15 @@ function DRUIDBAROptions_Vis()
DRUIDBAR_FrameSet();
end
+function DRUIDBAROptions_Minimap()
+ if(DruidBarKey.Minimap) then
+ DruidBarKey.Minimap = false;
+ else
+ DruidBarKey.Minimap = true;
+ end
+ DRUIDBAR_FrameSet();
+end
+
function DRUIDBAROptions_Replace()
DruidBarKey.Replace = true;
DruidBarKey.Player = false;
@@ -416,10 +425,12 @@ function DRUIDBAR_FrameSet()
local gold = {1, 0.82, 0}
local grey = {0.5, 0.5, 0.5}
- local allDisplayStyleTexts = {DRUIDBAROptionsVisText, DRUIDBAROptionsReplaceText,
- DRUIDBAROptionsPlayerText, DRUIDBAROptionsCustomText, DRUIDBAROptionsHideText,
- DRUIDBAROptionsFullText, DRUIDBAROptionsLockText, DRUIDBAROptionsTextDropDownText,
- DRUIDBAROptionsPercentDropDownText}
+ local allDisplayStyleTexts = {
+ DRUIDBAROptionsVisText,DRUIDBAROptionsReplaceText, DRUIDBAROptionsPlayerText,
+ DRUIDBAROptionsCustomText, DRUIDBAROptionsHideText, DRUIDBAROptionsFullText,
+ DRUIDBAROptionsLockText, DRUIDBAROptionsTextDropDownText,
+ DRUIDBAROptionsPercentDropDownText
+ }
-- Check temp width and temp height
if not DruidBarKey.tempW then DruidBarKey.tempW = 0; end
@@ -428,6 +439,7 @@ function DRUIDBAR_FrameSet()
-- Toggle Checkboxes/Buttons
DRUIDBAROptionsToggle:SetChecked(DruidBarKey.Enabled);
DRUIDBAROptionsVis:SetChecked(DruidBarKey.Graphics);
+ DRUIDBAROptionsMinimap:SetChecked(DruidBarKey.Minimap);
DRUIDBAROptionsReplace:SetChecked(DruidBarKey.Replace);
DRUIDBAROptionsPlayer:SetChecked(DruidBarKey.Player);
DRUIDBAROptionsCustom:SetChecked(DruidBarKey.Custom);
diff --git a/Options.xml b/Options.xml
index e3c08b4..2e9e239 100644
--- a/Options.xml
+++ b/Options.xml
@@ -104,23 +104,26 @@
</Scripts>
</Frame>
- <!-- Toggle for 'Enable' -->
- <CheckButton name="DRUIDBAROptionsToggle" inherits="OptionsCheckButtonTemplate">
+ <!-- IMPORTANT -->
+ <!-- Element order required to prevent overlapping checkboxs -->
+
+ <!-- ROW 1 -->
+ <!-- Toggle for 'Hide Minimap Button' -->
+ <CheckButton name="DRUIDBAROptionsMinimap" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DRUIDBAROptions_Bar" relativePoint="TOPLEFT">
<Offset>
- <AbsDimension x="30" y="-30"/>
+ <AbsDimension x="225" y="-30"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
- getglobal(self:GetName().."Text"):SetText(DRUIDBAR_OPTIONS_Toggle);
+ getglobal(self:GetName().."Text"):SetText(DRUIDBAR_OPTIONS_Minimap);
</OnLoad>
-
<OnClick>
- DRUIDBAROptions_Toggle();
+ DRUIDBAROptions_Minimap();
</OnClick>
</Scripts>
</CheckButton>
@@ -130,7 +133,7 @@
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DRUIDBAROptions_Bar" relativePoint="TOPLEFT">
<Offset>
- <AbsDimension x="175" y="-30"/>
+ <AbsDimension x="125" y="-30"/>
</Offset>
</Anchor>
</Anchors>
@@ -153,6 +156,29 @@
</Scripts>
</CheckButton>
+ <!-- Toggle for 'Enable' -->
+ <CheckButton name="DRUIDBAROptionsToggle" inherits="OptionsCheckButtonTemplate">
+ <Size><AbsDimension x="30" y="30"/></Size>
+ <Anchors>
+ <Anchor point="TOPLEFT" relativeTo="DRUIDBAROptions_Bar" relativePoint="TOPLEFT">
+ <Offset>
+ <AbsDimension x="30" y="-30"/>
+ </Offset>
+ </Anchor>
+ </Anchors>
+
+ <Scripts>
+ <OnLoad>
+ getglobal(self:GetName().."Text"):SetText(DRUIDBAR_OPTIONS_Toggle);
+ </OnLoad>
+
+ <OnClick>
+ DRUIDBAROptions_Toggle();
+ </OnClick>
+ </Scripts>
+ </CheckButton>
+
+ <!-- ROW 2 -->
<!-- Toggle for 'Hide when in caster form' -->
<CheckButton name="DRUIDBAROptionsHide" inherits="OptionsCheckButtonTemplate">
<Anchors>
@@ -195,6 +221,7 @@
</Scripts>
</CheckButton>
+ <!-- ROW 3 -->
<!-- Radio for style 'Replace' -->
<CheckButton name="DRUIDBAROptionsReplace" inherits="UIRadioButtonTemplate">
<Anchors>
@@ -278,6 +305,59 @@
</Scripts>
</CheckButton>
+ <!-- Toggle for 'Lock' -->
+ <CheckButton name="DRUIDBAROptionsLock" inherits="OptionsCheckButtonTemplate">
+ <Anchors>
+ <Anchor point="RIGHT" relativeTo="DRUIDBAROptionsCustom" relativePoint="LEFT">
+ <Offset>
+ <AbsDimension x="100" y=""/>
+ </Offset>
+ </Anchor>
+ </Anchors>
+
+ <Scripts>
+ <OnLoad>
+ getglobal(self:GetName().."Text"):SetText(DRUIDBAR_OPTIONS_Lock);
+ </OnLoad>
+
+ <OnClick>
+ DRUIDBAROptions_Lock();
+ </OnClick>
+ </Scripts>
+ </CheckButton>
+
+ <!-- ROW 4 -->
+ <!-- Dropdown to select 'Text Style' -->
+ <Frame name="DRUIDBAROptionsTextDropDown" inherits="UIDropDownMenuTemplate">
+ <Anchors>
+ <Anchor point="TOPLEFT" relativeTo="DRUIDBAROptions_Bar" relativePoint="TOPLEFT">
+ <Offset>
+ <AbsDimension x="75" y="-130"/>
+ </Offset>
+ </Anchor>
+ </Anchors>
+
+ <Layers>
+ <Layer level="BACKGROUND">
+ <FontString name="$parentLabel" inherits="GameFontNormalSmall" text="DRUIDBAR_OPTIONS_Text">
+ <Anchors>
+ <Anchor point="RIGHT" relativeTo="DRUIDBAROptionsTextDropDown" relativePoint="LEFT">
+ <Offset>
+ <AbsDimension x="10" y="2"/>
+ </Offset>
+ </Anchor>
+ </Anchors>
+ </FontString>
+ </Layer>
+ </Layers>
+
+ <Scripts>
+ <OnShow>
+ DRUIDBAROptions_Text_OnShow(self);
+ </OnShow>
+ </Scripts>
+ </Frame>
+
<!-- Input for 'Width' -->
<EditBox name="DRUIDBAROptionsWidthEditBox" autoFocus="false" inherits="InputBoxTemplate" bytes="64">
<Size>
@@ -384,58 +464,7 @@
</Layers>
</EditBox>
- <!-- Toggle for 'Lock' -->
- <CheckButton name="DRUIDBAROptionsLock" inherits="OptionsCheckButtonTemplate">
- <Anchors>
- <Anchor point="RIGHT" relativeTo="DRUIDBAROptionsCustom" relativePoint="LEFT">
- <Offset>
- <AbsDimension x="100" y=""/>
- </Offset>
- </Anchor>
- </Anchors>
-
- <Scripts>
- <OnLoad>
- getglobal(self:GetName().."Text"):SetText(DRUIDBAR_OPTIONS_Lock);
- </OnLoad>
-
- <OnClick>
- DRUIDBAROptions_Lock();
- </OnClick>
- </Scripts>
- </CheckButton>
-
- <!-- Dropdown to select 'Text Style' -->
- <Frame name="DRUIDBAROptionsTextDropDown" inherits="UIDropDownMenuTemplate">
- <Anchors>
- <Anchor point="TOPLEFT" relativeTo="DRUIDBAROptions_Bar" relativePoint="TOPLEFT">
- <Offset>
- <AbsDimension x="75" y="-130"/>
- </Offset>
- </Anchor>
- </Anchors>
-
- <Layers>
- <Layer level="BACKGROUND">
- <FontString name="$parentLabel" inherits="GameFontNormalSmall" text="DRUIDBAR_OPTIONS_Text">
- <Anchors>
- <Anchor point="RIGHT" relativeTo="DRUIDBAROptionsTextDropDown" relativePoint="LEFT">
- <Offset>
- <AbsDimension x="10" y="2"/>
- </Offset>
- </Anchor>
- </Anchors>
- </FontString>
- </Layer>
- </Layers>
-
- <Scripts>
- <OnShow>
- DRUIDBAROptions_Text_OnShow(self);
- </OnShow>
- </Scripts>
- </Frame>
-
+ <!-- ROW 5 -->
<!-- Dropdown to select 'Number Style' -->
<Frame name="DRUIDBAROptionsPercentDropDown" inherits="UIDropDownMenuTemplate" enableMouse="true">
<Anchors>
diff --git a/localization.lua b/localization.lua
index 4820afc..3a426ea 100644
--- a/localization.lua
+++ b/localization.lua
@@ -38,6 +38,7 @@ DRUIDBAR_OPTIONS_MiscO = "Misc";
DRUIDBAR_OPTIONS_Toggle = "Enable";
DRUIDBAR_OPTIONS_Vis = "Graphics";
DRUIDBAR_OPTIONS_VisTT = "Enable or disable any and all graphical stuff.\nIf you use with other addons like StatusBars or Linoleum, turn it off. If not, leave it on.";
+DRUIDBAR_OPTIONS_Minimap = "Show Minimap Button"
DRUIDBAR_OPTIONS_Replace = "Replace";
DRUIDBAR_OPTIONS_ReplaceTT = "Replace the Player Frame's mana bar, splitting it into two when shifted.";
DRUIDBAR_OPTIONS_Player = "Player Frame";