Quantcast

fixed QuestReward configuration window position, see ticket on curseforge

Alex Shubert [05-01-12 - 13:53]
fixed QuestReward configuration window position, see ticket on curseforge
Filename
AutoTurnIn.lua
RewardOptions.lua
options.lua
diff --git a/AutoTurnIn.lua b/AutoTurnIn.lua
index bba4d0c..f4c7098 100644
--- a/AutoTurnIn.lua
+++ b/AutoTurnIn.lua
@@ -9,6 +9,7 @@ AutoTurnIn.defaults = {enabled = true, all = false, lootreward = 1, tournament =
 AutoTurnIn.ldb, AutoTurnIn.allowed = nil, nil
 AutoTurnIn.caption = addonName ..' [%s]'
 AutoTurnIn.funcList = {[1] = function() return false end, [2]=IsAltKeyDown, [3]=IsControlKeyDown, [4]=IsShiftKeyDown}
+AutoTurnIn.OptionsPanel, AutoTurnIn.RewardPanel = nil, nil

 AutoTurnIn.ldbstruct = {
 		type = "data source",
@@ -17,13 +18,13 @@ AutoTurnIn.ldbstruct = {
 		text = addonName,
 		OnClick = function(clickedframe, button)
 			if InterfaceOptionsFrame:IsVisible() then
-				if (InterfaceOptionsFrameAddOns.selection:GetName() == "AutoTurnInOptionsPanel") then
-					InterfaceOptionsFrame_OpenToCategory(_G["AutoTurnInRewardPanel"])
-				elseif (InterfaceOptionsFrameAddOns.selection:GetName() == "AutoTurnInRewardPanel") then
+				if (InterfaceOptionsFrameAddOns.selection:GetName() == AutoTurnIn.OptionsPanel:GetName()) then --"AutoTurnInOptionsPanel"
+					InterfaceOptionsFrame_OpenToCategory(AutoTurnIn.RewardPanel)
+				elseif (InterfaceOptionsFrameAddOns.selection:GetName() == AutoTurnIn.RewardPanel:GetName() ) then --"AutoTurnInRewardPanel"
 					InterfaceOptionsFrameCancel:Click()
 				end
 			else
-				InterfaceOptionsFrame_OpenToCategory(_G["AutoTurnInOptionsPanel"])
+				InterfaceOptionsFrame_OpenToCategory(AutoTurnIn.OptionsPanel)
 			end
 		end,
 	}
@@ -85,7 +86,7 @@ local p2 = {[true]=L["all"], [false]=L["list"]}
 function AutoTurnIn:ConsoleComand(arg)
 	arg = strlower(arg)
 	if (#arg == 0) then
-		InterfaceOptionsFrame_OpenToCategory(_G["AutoTurnInOptionsPanel"])
+		InterfaceOptionsFrame_OpenToCategory(AutoTurnIn.OptionsPanel)
 	elseif arg == "on" then
 		self:SetEnabled(true)
 		self:Print(L["enabled"])
diff --git a/RewardOptions.lua b/RewardOptions.lua
index 90c3502..dd10f47 100644
--- a/RewardOptions.lua
+++ b/RewardOptions.lua
@@ -1,9 +1,10 @@
 local addonName, ptable = ...
-local C = ptable.CONST
-local L = ptable.L
+local L, C = ptable.L, ptable.CONST
 local O = addonName .. "RewardPanel"
-local RewardPanel = CreateFrame("Frame", O)
-RewardPanel.name = QUEST_REWARDS
+AutoTurnIn.RewardPanel = CreateFrame("Frame", O)
+AutoTurnIn.RewardPanel.name = QUEST_REWARDS
+AutoTurnIn.RewardPanel.parent = addonName
+local RewardPanel = AutoTurnIn.RewardPanel

 local function CreateCheckbox(name, parent, marginx, marginy, text)
 	local cb = CreateFrame("CheckButton", "$parent"..name,  parent, "OptionsCheckButtonTemplate")
@@ -43,7 +44,7 @@ end
 -- Description
 local description = RewardPanel:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
 description:SetText(L["rewardlootoptions"])
-RewardPanel.parent = _G["AutoTurnInOptionsPanel"]
+

 local weapon = {GetAuctionItemSubClasses(1)}
 local armor = {GetAuctionItemSubClasses(2)}
diff --git a/options.lua b/options.lua
index 4ebb91e..b566e7a 100644
--- a/options.lua
+++ b/options.lua
@@ -1,8 +1,10 @@
 local addonName, ptable = ...
 local L = ptable.L
 local O = addonName .. "OptionsPanel"
-local OptionsPanel = CreateFrame("Frame", O)
-OptionsPanel.name=addonName
+AutoTurnIn.OptionsPanel = CreateFrame("Frame", O)
+AutoTurnIn.OptionsPanel.name=addonName
+local OptionsPanel = AutoTurnIn.OptionsPanel
+
 -- Title
 local title = OptionsPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
 title:SetText(addonName)