Quantcast

Merge pull request #18 from tekHudson/version-upgrade-with-minor-fixes

Tek Hudson [01-06-20 - 15:24]
Merge pull request #18 from tekHudson/version-upgrade-with-minor-fixes

Version upgrade with minor fixes
Filename
Bindings.xml
CHANGELOG.md
DruidBar.lua
DruidBar.xml
DruidBarClassic.toc
Options.lua
Options.xml
diff --git a/Bindings.xml b/Bindings.xml
index bdcc678..66c86ea 100644
--- a/Bindings.xml
+++ b/Bindings.xml
@@ -1,5 +1,2 @@
 <Bindings>
-	<Binding name="DruidBarBest" header="DRUIDBAR">
-		DruidBar_ChangeBestForm();
-	</Binding>
-</Bindings>
\ No newline at end of file
+</Bindings>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cd2169c..bfa924b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
 ## Version History

+#### 0.7.3
+Update WoW version compatability to `1.13.3`.
+Fix on draggable bug.
+Little more code cleanup.
+Fix icon position save.
+Remove last traces of Bestform, R.I.P.
+
 #### 0.7.2
 Prevent addon load when player unit is not a druid.

diff --git a/DruidBar.lua b/DruidBar.lua
index cc7d3e5..ac5de07 100644
--- a/DruidBar.lua
+++ b/DruidBar.lua
@@ -29,9 +29,6 @@ function DruidBar_OnLoad()
 		SLASH_DRUIDBARSLASH1 = "/dbar";
 		SLASH_DRUIDBARSLASH2 = "/druidbar";
 		DBarSpellCatch:SetOwner(DruidBarUpdateFrame, "ANCHOR_NONE");
-
-	    -- Creating the minimap config icon
-		DruidBar_MinimapButton:Register("DruidBarMinimapIcon", minimapIconLDB, DruidBarKey);
 	end
 end
 function EventRegistration(event)
@@ -166,6 +163,9 @@ function Load_Variables(className)
 		ShapeshiftBar_ChangeForm = DruidBar_ChangeForm;
 		shiftload = true;
 	end
+
+  -- Creating the minimap config icon
+	DruidBar_MinimapButton:Register("DruidBarMinimapIcon", minimapIconLDB, DruidBarKey);
 end

 function DruidBar_ReflectionCheck()
@@ -306,12 +306,19 @@ function DruidBar_MainGraphics()
 			DruidBar_Anchored = nil;
 		end

+		-- Set the position lock and dragability
 		if DruidBarKey.Lock then
 			dbarShow(DruidBarDontMove);
 			DruidBarFrame:EnableMouse(0);
+			DruidBarFrame:SetMovable(false)
+			DruidBarFrame:RegisterForDrag()
 		else
 			dbarHide(DruidBarDontMove);
 			DruidBarFrame:EnableMouse(1);
+			DruidBarFrame:SetMovable(true)
+			DruidBarFrame:RegisterForDrag("LeftButton")
+			DruidBarFrame:SetScript("OnDragStart", DruidBarFrame.StartMoving)
+			DruidBarFrame:SetScript("OnDragStop", DruidBarFrame.StopMovingOrSizing)
 		end
 	else
 		dbarHide(DruidBarFrame);
@@ -604,8 +611,6 @@ function DruidBar_Enable_ChatCommandHandler(text)
 		DRUIDBAR_FrameSet();
 	elseif msg[1] == "status" then
 		DruidBar_Status();
-	elseif msg[1] == "best" then
-		DruidBar_ChangeBestForm();
 	elseif msg[1] == "color" then
 		if tonumber(msg[3]) then
 			if msg[2] == "r" then
diff --git a/DruidBar.xml b/DruidBar.xml
index 511591e..a65c630 100644
--- a/DruidBar.xml
+++ b/DruidBar.xml
@@ -102,35 +102,9 @@
 					<OnLoad>
 						self:SetFrameLevel("1");
 					</OnLoad>
-					<OnMouseDown>
-						if button == "LeftButton" and not self.isMoving then
-						self:GetParent():StartMoving();
-						self.isMoving = true;
-						end
-					</OnMouseDown>
-					<OnMouseUp>
-						if button == "LeftButton" and self.isMoving then
-						self:GetParent():StopMovingOrSizing();
-						self.isMoving = false;
-						end
-					</OnMouseUp>
-					<OnHide>
-						if self.isMoving then
-						self:GetParent():StopMovingOrSizing();
-						self.isMoving = false;
-						end
-					</OnHide>
 				</Scripts>
 			</StatusBar>
 		</Frames>
-
-		<Scripts>
-			<OnLoad>
-				self:RegisterForDrag("LeftButton");
-			</OnLoad>
-			<OnDragStart>self:StartMoving();</OnDragStart>
-			<OnDragStop>self:StopMovingOrSizing();</OnDragStop>
-		</Scripts>
 	</Frame>

 	<Frame name="DruidBarUpdateFrame">
@@ -155,7 +129,7 @@
 		</Anchors>
 	</Button>

-	<Frame name="DruidBarReplaceText" frameStrata="LOW" enableMouse="true" movable="true" parent="UIParent" hidden="true">
+	<Frame name="DruidBarReplaceText" frameStrata="LOW" enableMouse="true" movable="false" parent="UIParent" hidden="true">
 		<Size>
 			<AbsDimension x="120" y="10"/>
 		</Size>
diff --git a/DruidBarClassic.toc b/DruidBarClassic.toc
index f8c48f1..8f14c11 100644
--- a/DruidBarClassic.toc
+++ b/DruidBarClassic.toc
@@ -1,10 +1,10 @@
-## Interface: 11302
+## Interface: 11303
 ## Title: Druid Bar Classic
 ## Notes: Shows mana in bear/cat form.
 ## Current Author: Tek (port to WoW Classic Beta)
 ## Original Authors: SkaDemon (GUI: DiabloHu)
 ## SavedVariables: DruidBarKey
-## Version: 0.7.2
+## Version: 0.7.3
 ## X-Curse-Project-ID: 334762
 ## X-WoWI-ID: 25036

diff --git a/Options.lua b/Options.lua
index 9b213a1..2704d92 100644
--- a/Options.lua
+++ b/Options.lua
@@ -2,16 +2,18 @@ function DRUIDBAROptions_OnLoad()
 	UIPanelWindows['DRUIDBAROptionsFrame'] = {area = 'center', pushable = 0};
 end

+-- Toggles the visibility of the DruidBar options frame
 function DRUIDBAROptionsFrame_Toggle()
 	if(DRUIDBAROptionsFrame:IsVisible()) then
 		DRUIDBAROptionsFrame:Hide();
 	else
-		DRUIDBAR_FrameSet();
 		DRUIDBAROptionsFrame:Show();
 	end
+	renderOptionsFrame();
 end

-function DRUIDBAROptions_CheckWidth(self)
+-- Updates options related to Width
+function DRUIDBAROptions_Width(self)
 	if ( DRUIDBAROptionsWidthEditBox:GetText() < "1" ) then
 		DRUIDBAROptionsWidthEditBox:SetText("170");
 		DruidBarKey.xvar = self:GetNumber();
@@ -26,7 +28,8 @@ function DRUIDBAROptions_CheckWidth(self)
 	end
 end

-function DRUIDBAROptions_CheckHeight(self)
+-- Updates options related to Height
+function DRUIDBAROptions_Height(self)
 	if ( DRUIDBAROptionsHeightEditBox:GetText() < "1" ) then
 		DRUIDBAROptionsHeightEditBox:SetText("18");
 		DruidBarKey.yvar = self:GetNumber();
@@ -41,6 +44,7 @@ function DRUIDBAROptions_CheckHeight(self)
 	end
 end

+-- Updates options related to Enabled state of addon
 function DRUIDBAROptions_Toggle()
 	if(DruidBarKey.Enabled) then
 		DruidBarKey.Enabled = false;
@@ -50,53 +54,59 @@ function DRUIDBAROptions_Toggle()
 		-- Incase no other event triggers the redraw, we do this now
 		if not DruidBarUpdateFrame:IsVisible() then DruidBarUpdateFrame:Show(); end
 	end
-	DRUIDBAR_FrameSet();
+	renderOptionsFrame();
 end

-function DRUIDBAROptions_Vis()
+-- Updates options related to Graphics
+function DRUIDBAROptions_Graphics()
 	if(DruidBarKey.Graphics) then
 		DruidBarKey.Graphics = false;
 	else
 		DruidBarKey.Graphics = true;
 	end
-	DRUIDBAR_FrameSet();
+	renderOptionsFrame();
 end

+-- Updates options related to Minimap Button
 function DRUIDBAROptions_Minimap()
 	if(DruidBarKey.Minimap) then
 		DruidBarKey.Minimap = false;
 	else
 		DruidBarKey.Minimap = true;
 	end
-	DRUIDBAR_FrameSet();
+	renderOptionsFrame();
 end

+-- Updates options related to Hid in Caster
 function DRUIDBAROptions_HideInCaster()
 	if(DruidBarKey.HideInCaster) then
 		DruidBarKey.HideInCaster = false;
 	else
 		DruidBarKey.HideInCaster = true;
 	end
-	DRUIDBAR_FrameSet();
+	renderOptionsFrame();
 end

-function DRUIDBAROptions_Full()
+-- Updates options related to
+function DRUIDBAROptions_HideWhenFull()
 	if(DruidBarKey.HideWhenFull) then
 		DruidBarKey.HideWhenFull = false;
 	else
 		DruidBarKey.HideWhenFull = true;
 	end
-	DRUIDBAR_FrameSet();
+	renderOptionsFrame();
 end

+-- Updates options related to display location where we replace the default manabar
 function DRUIDBAROptions_Replace()
 	DruidBarKey.Replace = true;
 	DruidBarKey.Player = false;
 	DruidBarKey.Custom = false;
 	DruidBarKey.Lock = true;
-	DRUIDBAR_FrameSet();
+	renderOptionsFrame();
 end

+-- Updates options related to display location where we attach to bottom of player frame
 function DRUIDBAROptions_Player()
 	DruidBarKey.Replace = false;
 	DruidBarKey.Player = true;
@@ -105,9 +115,10 @@ function DRUIDBAROptions_Player()
 	DruidBarKey.xvar = 125;
 	DruidBarKey.yvar = 18;
 	DruidBarKey.Lock = true;
-	DRUIDBAR_FrameSet();
+	renderOptionsFrame();
 end

+-- Updates options related to display location when bar is customaizable
 function DRUIDBAROptions_Custom()
 	DruidBarKey.Custom = true;
 	DruidBarKey.Replace = false;
@@ -115,16 +126,17 @@ function DRUIDBAROptions_Custom()
 	DruidBarKey.Lock = false;
 	DruidBarKey.xvar = DruidBarKey.tempW;
 	DruidBarKey.yvar = DruidBarKey.tempH;
-	DRUIDBAR_FrameSet();
+	renderOptionsFrame();
 end

+-- Updates options related to locking bar in place
 function DRUIDBAROptions_Lock()
 	if(DruidBarKey.Lock) then
 		DruidBarKey.Lock = false;
 	else
 		DruidBarKey.Lock = true;
 	end
-	DRUIDBAR_FrameSet();
+	renderOptionsFrame();
 end

 function DRUIDBAROptions_Text_Initialize()
@@ -204,7 +216,7 @@ function DRUIDBAROptions_Percent_OnClick(self)
 	end
 end

-function DRUIDBAR_FrameSet()
+function renderOptionsFrame()
 	-- DruidBarKey is not set, get out
 	if not DruidBarKey then return end

diff --git a/Options.xml b/Options.xml
index deac170..fe0e52d 100644
--- a/Options.xml
+++ b/Options.xml
@@ -143,7 +143,7 @@
 						getglobal(self:GetName().."Text"):SetText(DRUIDBAR_OPTIONS_Vis);
 					</OnLoad>
 					<OnClick>
-						DRUIDBAROptions_Vis();
+						DRUIDBAROptions_Graphics();
 					</OnClick>
 					<OnEnter>
 						GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
@@ -216,7 +216,7 @@
 					</OnLoad>

 					<OnClick>
-						DRUIDBAROptions_Full();
+						DRUIDBAROptions_HideWhenFull();
 					</OnClick>
 				</Scripts>
 			</CheckButton>
@@ -386,7 +386,7 @@
 					</OnEscapePressed>

 					<OnTextChanged>
-						DRUIDBAROptions_CheckWidth(self);
+						DRUIDBAROptions_Width(self);
 					</OnTextChanged>
 				</Scripts>

@@ -439,7 +439,7 @@
 					</OnEscapePressed>

 					<OnTextChanged>
-						DRUIDBAROptions_CheckHeight(self);
+						DRUIDBAROptions_Height(self);
 					</OnTextChanged>
 				</Scripts>