Quantcast

Continued revmap of Clique user interface

James Whitehead II [10-03-10 - 19:21]
Continued revmap of Clique user interface
Filename
Clique.xml
CliqueOptions.lua
CliqueUtils.lua
diff --git a/Clique.xml b/Clique.xml
index 384ad93..0a6c4f7 100755
--- a/Clique.xml
+++ b/Clique.xml
@@ -115,6 +115,43 @@
         <HighlightTexture file="Interface\BUTTONS\ButtonHilight-Square" alphaMode="ADD"/>
     </Button>

+    <Frame name="CliqueDialog" toplevel="true" inherits="BasicFrameTemplate" parent="UIParent" frameStrata="DIALOG" hidden="true">
+        <Size x="350" y="160"/>
+        <Anchors>
+            <Anchor point="CENTER"/>
+        </Anchors>
+        <Layers>
+            <Layer level="OVERLAY">
+                <FontString name="$parentDesc" parentKey="desc" inherits="GameFontHighlightSmallLeftTop">
+                    <Size x="340" y="60"/>
+                    <Anchors>
+                        <Anchor point="TOPLEFT" x="5" y="-25"/>
+                    </Anchors>
+                </FontString>
+                <FontString name="$parentBindText" parentKey="bindText" inherits="GameFontHighlightSmallLeftTop">
+                    <Size x="100" y="12"/>
+                    <Anchors>
+                        <Anchor point="BOTTOM" x="0" y="35"/>
+                    </Anchors>
+                </FontString>
+            </Layer>
+        </Layers>
+        <Frames>
+            <Button name="$parentButtonBinding" parentKey="button_binding" inherits="UIPanelButtonTemplate2">
+                <Size x="160" y="22"/>
+                <Anchors>
+                    <Anchor point="TOP" relativeTo="$parentDesc" relativePoint="BOTTOM" x="0" y="0"/>
+                </Anchors>
+            </Button>
+            <Button name="$parentButtonAccept" parentKey="button_accept" inherits="UIPanelButtonTemplate">
+                <Size x="80" y="22"/>
+                <Anchors>
+                    <Anchor point="BOTTOMRIGHT" x="-3" y="3"/>
+                </Anchors>
+            </Button>
+        </Frames>
+    </Frame>
+
     <!-- Main configuration frame -->
     <Frame name="CliqueConfig" inherits="ButtonFrameTemplate" parent="UIParent" hidden="true">
         <Size>
@@ -124,6 +161,9 @@
             <Anchor point="CENTER" x="0" y="0"/>
         </Anchors>
         <Frames>
+            <!-- Dropdown menu for utility -->
+            <Frame name="$parentDropdown" parentKey="dropdown" inherits="UIDropDownMenuTemplate"/>
+
             <!-- Page definitions - Configuration List -->
             <Frame name="$parentPage1" parentKey="page1" hidden="true">
                 <Frames>
@@ -225,10 +265,36 @@
                 </Scripts>
             </Frame> <!-- Page 1 - Configuration List -->

-            <!-- Page definitions - Edit Page -->
-
             <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">
+                <Frames>
                     <!-- Wrap the scroll frame in a frame that can capture clicks -->
                     <Button name="CliqueClickGrabber" parentKey="clickGrabber">
                         <Size x="320" y="160"/>
@@ -293,7 +359,7 @@
                         </Frames>
                     </Button>
                     <Button name="$parentButtonSave" parentKey="button_save" inherits="MagicButtonTemplate">
-                        <Size x="100" y="22"/>
+                        <Size x="80" y="22"/>
                         <Anchors>
                             <Anchor point="BOTTOMLEFT" relativeTo="CliqueConfig"/>
                         </Anchors>
@@ -315,15 +381,17 @@
                         </Scripts>
                     </Button>
                  </Frames>
-            </Frame> <!-- Page 2 - Edit Page -->
+            </Frame> <!-- Page 3 - Macro Edit Page -->
         </Frames>
         <Scripts>
             <OnLoad>
                 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/CliqueOptions.lua b/CliqueOptions.lua
index f8c5e90..3709e9d 100755
--- a/CliqueOptions.lua
+++ b/CliqueOptions.lua
@@ -33,6 +33,18 @@ function CliqueConfig:SetupGUI()

     -- Set text elements using localized values
     _G[self:GetName() .. "TitleText"]:SetText(L["Clique Configuration"])
+
+    self.dialog = _G["CliqueDialog"]
+    self.dialog.title = _G["CliqueDialogTitleText"]
+
+    self.dialog.title:SetText(L["Clique: Set binding"])
+    self.dialog.button_accept:SetText(L["Accept"])
+    self.dialog.bindText:SetText(L["Alt-Control-Shift-F"])
+
+    self.dialog.button_binding:SetText(L["Set binding"])
+    local desc = L["In order to specify a binding, move your mouse over the button labelled 'Set binding' and either click with your mouse or press a key on your keyboard. You can modify the binding by holding down a combination of the alt, control and shift keys on your keyboard."]
+    self.dialog.desc:SetText(desc)
+
     self.page1.column1:SetText(L["Action"])
     self.page1.column2:SetText(L["Binding"])

@@ -44,10 +56,14 @@ 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.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

@@ -175,11 +191,44 @@ function CliqueConfig:Button_OnClick(button)

     -- Click handler for "Bind other" button
     elseif button == self.page1.button_other then
-        self.page1:Hide()
-        self.page2:Show()
+        local config = CliqueConfig
+        local menu = {
+            {
+                text = L["Select a binding type"],
+                isTitle = true
+            },
+            {
+                text = L["Target clicked unit"],
+                func = function()
+                    config.page1:Hide()
+                    config.page2.bindType = "target"
+                    config.page2:Show()
+                end,
+            },
+            {
+                text = L["Open unit menu"],
+                func = function()
+                    config.page1:Hide()
+                    config.page2.bindType = "menu"
+                    config.page2:Show()
+                end,
+            },
+            {
+                text = L["Run custom macro"],
+                func = function()
+                    config.page1:Hide()
+                    config.page3:Show()
+                end,
+            },
+        }
+        UIDropDownMenu_SetAnchor(self.dropdown, 0, 0, "BOTTOMLEFT", self.page1.button_other, "TOP")
+        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()
+        self.page1:Show()
     elseif button == self.page2.button_cancel then
         self.page2:Hide()
         self.page1:Show()
@@ -290,7 +339,7 @@ end
 function CliqueConfig:ShowEditPage()
     self:ClearEditPage()
     self.page1:Hide()
-    self.page2:Show()
+    self.page3:Show()
 end

 function CliqueConfig:Save_OnClick(button, button, down)
@@ -298,7 +347,7 @@ end

 function CliqueConfig:Cancel_OnClick(button, button, down)
     self:ClearEditPage()
-    self.page2:Hide()
+    self.page3:Hide()
     self.page1:Show()
 end

diff --git a/CliqueUtils.lua b/CliqueUtils.lua
index 775dc3c..e7b29ac 100644
--- a/CliqueUtils.lua
+++ b/CliqueUtils.lua
@@ -95,7 +95,7 @@ function addon:GetBindingActionText(binding)
     if btype == "menu" then
         return L["Show unit menu"]
     elseif btype == "target" then
-        return L["Target '%s' unit"]:format(binding.unit)
+        return L["Target clicked unit"]
     elseif btype == "spell" then
         if binding.rank then
             return L["Cast %s (Rank %d)"]:format(binding.spell, binding.rank)