Quantcast

Fix: Header menu status was not remembered between sessions

Alar of Daggerspine [09-07-15 - 13:06]
Fix: Header menu status was not remembered between sessions

Signed-off-by: Alar of Daggerspine <alar@aspide.it>
Filename
CHANGELOG.txt
GarrisonCommander.lua
ShipYard.lua
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index b6d521f..c1d5c59 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -2,6 +2,7 @@

 * *2.7.5*
 Fix: Seal of Tempered Fate were marked as a limited resource. Turned out they are not
+Fix: Header menu status was not remembered between sessions

 * *2.7.4*
 Fix: Removed chat spam
diff --git a/GarrisonCommander.lua b/GarrisonCommander.lua
index 3ddf398..728a225 100644
--- a/GarrisonCommander.lua
+++ b/GarrisonCommander.lua
@@ -1130,12 +1130,11 @@ end
 function addon:GetMain()
 	return GMF
 end
-function addon:CreateHeader(module)
+function addon:CreateHeader(module,PIN)
 	if not module then module=self end
 	-- Main Garrison Commander Header
 	local GCF=CreateFrame("Frame","GCF",UIParent,"GarrisonCommanderTitle")
 	local signature=me .. " " .. self.version
-	local PIN=module and "SHIPPIN" or "PIN"
 	local MOVEPANEL =module and "SHIPMOVEPANEL" or "MOVEPANEL"
 	GCF.Signature:SetText(signature)
 --@alpha@
@@ -1149,7 +1148,6 @@ function addon:CreateHeader(module)
 	local main=module:GetMain()
 	GCF:SetFrameStrata(main:GetFrameStrata())
 	GCF:SetFrameLevel(main:GetFrameLevel()-2)
-	--if (not ns.bigscreen and module == self) then GCF:SetHeight(130) end
 	if module == self then GCF:SetHeight(130) end
 --@debug@
 print(GCF:GetHeight())
@@ -1162,8 +1160,10 @@ print(GCF:GetHeight())
 	GCF:SetPoint("TOP",UIParent,0,-60)
 	if (self:GetBoolean(PIN)) then
 		GCF.Pin:SetChecked(true)
+		GCF:SetHeight(baseHeight)
 	else
 		GCF.Pin:SetChecked(false)
+		GCF:SetHeight(minHeight)
 	end

 	do
@@ -1217,6 +1217,7 @@ print(GCF:GetHeight())
 	GCF:RegisterForDrag("LeftButton")
 	GCF:SetScript("OnDragStart",function(frame)if self:GetBoolean(MOVEPANEL) then frame:StartMoving() end end)
 	GCF:SetScript("OnDragStop",function(frame) frame:StopMovingOrSizing() end)
+	GCF:Show()
 	self:Trigger(MOVEPANEL)
 	return GCF
 end
@@ -1497,7 +1498,7 @@ print("Setup")
 	self:CheckMP()
 	if MP then self:AddToggle("CKMP",true,L["Use GC Interface"],L["Switch between Garrison Commander and Master Plan interface for missions"]) end
 	self:CheckGMM()
-	GCF=self:CreateHeader()
+	GCF=self:CreateHeader(self,"PIN")
 	local tabMC=CreateFrame("CheckButton",nil,GMF,"SpellBookSkillLineTabTemplate")
 	GMF.tabMC=tabMC
 	tabMC.tooltip="Open Garrison Commander Mission Control"
@@ -1519,7 +1520,7 @@ print("Setup")
 	tabHP:SetPushedTexture("Interface\\ICONS\\INV_Misc_QuestionMark.blp")
 	tabHP:Show()
 	tabMC:SetScript("OnClick",function(this,...) addon:OpenMissionControlTab() end)
-	tabCF:SetScript("OnClick",function(this,...) addon:Gui() end)
+	tabCF:SetScript("OnClick",function(this,...) GMF:Hide() addon:Gui() end)
 	tabHP:SetScript("OnClick",function(this,button) addon:ShowHelpWindow(this,button) end)
 	tabHP:SetPoint('TOPLEFT',GCF,'TOPRIGHT',0,-10)
 	tabCF:SetPoint('TOPLEFT',GCF,'TOPRIGHT',0,-60)
diff --git a/ShipYard.lua b/ShipYard.lua
index 6a1a970..aa1a660 100644
--- a/ShipYard.lua
+++ b/ShipYard.lua
@@ -172,7 +172,7 @@ print("Doing one time initialization for",this:GetName(),...)
 	addon:CheckMP()
 	self:SafeSecureHookScript("GarrisonShipyardFrame","OnShow")
 	self:SafeSecureHookScript(GSF.FollowerTab,"OnShow","FollowerOnShow")
-	GCS=addon:CreateHeader(self)
+	GCS=addon:CreateHeader(self,'SHIPPIN')
 	GSF.FollowerStatusInfo=GSF.BorderFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
 	GSF.ResourceInfo=GSF.BorderFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
 	GSF.ResourceFormat="|TInterface\\Icons\\garrison_oil:0|t %s " .. GetCurrencyInfo(GARRISON_SHIP_OIL_CURRENCY)