Add options panel, remove page3
James Whitehead II [10-03-10 - 20:39]
Add options panel, remove page3
diff --git a/Clique.xml b/Clique.xml
index 0a6c4f7..9493d27 100755
--- a/Clique.xml
+++ b/Clique.xml
@@ -248,11 +248,16 @@
</OnClick>
</Scripts>
</Button>
- <Button name="$parentButtonEdit" parentKey="button_edit" inherits="MagicButtonTemplate">
+ <Button name="$parentButtonOptions" parentKey="button_options" inherits="MagicButtonTemplate">
<Size x="80" y="22"/>
<Anchors>
<Anchor point="BOTTOMRIGHT" relativeTo="CliqueConfig"/>
</Anchors>
+ <Scripts>
+ <OnClick>
+ CliqueConfig:Button_OnClick(self)
+ </OnClick>
+ </Scripts>
</Button>
</Frames>
<Scripts>
@@ -265,35 +270,8 @@
</Scripts>
</Frame> <!-- Page 1 - Configuration List -->
- <Frame name="$parentPage2" parentKey="page2" hidden="true">
- <Frames>
- <Button name="$parentButtonSave" parentKey="button_save" inherits="MagicButtonTemplate">
- <Size x="80" y="22"/>
- <Anchors>
- <Anchor point="BOTTOMLEFT" relativeTo="CliqueConfig"/>
- </Anchors>
- <Scripts>
- <OnClick>
- CliqueConfig:Button_OnClick(self)
- </OnClick>
- </Scripts>
- </Button>
- <Button name="$parentButtonCancel" parentKey="button_cancel" inherits="MagicButtonTemplate">
- <Size x="80" y="22"/>
- <Anchors>
- <Anchor point="BOTTOMRIGHT" relativeTo="CliqueConfig"/>
- </Anchors>
- <Scripts>
- <OnClick>
- CliqueConfig:Button_OnClick(self)
- </OnClick>
- </Scripts>
- </Button>
- </Frames>
- </Frame> <!-- End of target/menu edit page -->
-
- <!-- Page definitions - Edit Page -->
- <Frame name="$parentPage3" parentKey="page3" hidden="true">
+ <!-- Page definitions - Edit Page -->
+ <Frame name="$parentPage3" parentKey="page2" hidden="true">
<Frames>
<!-- Wrap the scroll frame in a frame that can capture clicks -->
<Button name="CliqueClickGrabber" parentKey="clickGrabber">
@@ -388,10 +366,8 @@
CliqueConfigPortrait:SetTexture("Interface\\FriendsFrame\\FriendsFrameScrollIcon");
CliqueConfig.page1:SetParent(CliqueConfig.Inset)
CliqueConfig.page2:SetParent(CliqueConfig.Inset)
- CliqueConfig.page3:SetParent(CliqueConfig.Inset)
CliqueConfig.page1:SetAllPoints(CliqueConfig.Inset)
CliqueConfig.page2:SetAllPoints(CliqueConfig.Inset)
- CliqueConfig.page3:SetAllPoints(CliqueConfig.Inset)
</OnLoad>
<OnShow>
CliqueConfig:OnShow()
diff --git a/CliqueConfig.lua b/CliqueConfig.lua
index 3709e9d..5b7aad2 100755
--- a/CliqueConfig.lua
+++ b/CliqueConfig.lua
@@ -32,7 +32,7 @@ function CliqueConfig:SetupGUI()
end
-- Set text elements using localized values
- _G[self:GetName() .. "TitleText"]:SetText(L["Clique Configuration"])
+ _G[self:GetName() .. "TitleText"]:SetText(L["Clique Binding Configuration"])
self.dialog = _G["CliqueDialog"]
self.dialog.title = _G["CliqueDialogTitleText"]
@@ -55,15 +55,11 @@ function CliqueConfig:SetupGUI()
self.page1.button_spell:SetText(L["Bind spell"])
self.page1.button_other:SetText(L["Bind other"])
- self.page1.button_edit:SetText(L["Edit"])
+ self.page1.button_options:SetText(L["Options"])
self.page2.button_save:SetText(L["Save"])
self.page2.button_cancel:SetText(L["Cancel"])
- self.page3.button_save:SetText(L["Save"])
- self.page3.button_cancel:SetText(L["Cancel"])
-
-
self.page1:Show()
end
@@ -217,7 +213,8 @@ function CliqueConfig:Button_OnClick(button)
text = L["Run custom macro"],
func = function()
config.page1:Hide()
- config.page3:Show()
+ config.page2.bindType = "macro"
+ config.page2:Show()
end,
},
}
@@ -225,9 +222,10 @@ function CliqueConfig:Button_OnClick(button)
EasyMenu(menu, self.dropdown, nil, 0, 0, nil, nil)
-- Click handler for "Edit" button
- elseif button == self.page1.button_edit then
- elseif button == self.page3.button_cancel then
- self.page3:Hide()
+ elseif button == self.page1.button_options then
+ InterfaceOptionsFrame_OpenToCategory("Clique")
+ elseif button == self.page2.button_cancel then
+ self.page2:Hide()
self.page1:Show()
elseif button == self.page2.button_cancel then
self.page2:Hide()
diff --git a/CliqueOptionsPanel.lua b/CliqueOptionsPanel.lua
index a9ed2df..27f067b 100644
--- a/CliqueOptionsPanel.lua
+++ b/CliqueOptionsPanel.lua
@@ -1 +1,15 @@
local addonName, addon = ...
+
+local panel = CreateFrame("Frame")
+panel.name = "Clique"
+
+panel:SetScript("OnShow", function(self)
+ if not panel.initialized then
+ panel:CreateOptions()
+ end
+end)
+
+function panel:CreateOptions()
+end
+
+InterfaceOptions_AddCategory(panel)