Added an option to trigger spellcast on the down portion of a click
James Whitehead II [05-03-10 - 09:37]
Added an option to trigger spellcast on the down portion of a click
This option can be found in the Clique UI, under the 'options' panel. When this option is active, any buttons that register for click-casting will be registered for 'AnyDown', which will cause spells to trigger on the down portion of the click. By default, Clique continues to function as usual, triggering spellcasts on the up portion of a click.
diff --git a/Clique.lua b/Clique.lua
index 0951ea3..85f3e8f 100644
--- a/Clique.lua
+++ b/Clique.lua
@@ -11,9 +11,6 @@ if Clique.version == "wowi:revision" then Clique.version = "SVN" end
local L = Clique.Locals
-function Clique:Initialize()
-end
-
function Clique:Enable()
-- Grab the localisation header
L = Clique.Locals
@@ -33,6 +30,7 @@ function Clique:Enable()
},
char = {
switchSpec = false,
+ downClick = false,
},
}
@@ -276,7 +274,8 @@ function Clique:RegisterFrame(frame)
end
end
- frame:RegisterForClicks("AnyUp")
+ -- Register AnyUp or AnyDown on this frame, depending on configuration
+ self:SetClickType(frame)
if frame:CanChangeAttribute() or frame:CanChangeProtectedState() then
if InCombatLockdown() then
@@ -727,6 +726,19 @@ function Clique:ACTIVE_TALENT_GROUP_CHANGED(event, newGroup, prevGroup)
end
end
+function Clique:SetClickType(frame)
+ local clickType = Clique.db.char.downClick and "AnyDown" or "AnyUp"
+ if frame then
+ frame:RegisterForClicks(clickType)
+ else
+ for frame, enabled in pairs(self.ccframes) do
+ if enabled then
+ frame:RegisterForClicks(clickType)
+ end
+ end
+ end
+end
+
function Clique:EnableArenaFrames()
local arenaFrames = {
ArenaEnemyFrame1,
@@ -741,7 +753,6 @@ function Clique:EnableArenaFrames()
end
end
-
function Clique:ADDON_LOADED(event, addon)
if addon == "Blizzard_ArenaUI" then
self:EnableArenaFrames()
diff --git a/CliqueOptions.lua b/CliqueOptions.lua
index d9ce488..001f86a 100644
--- a/CliqueOptions.lua
+++ b/CliqueOptions.lua
@@ -1854,8 +1854,11 @@ function Clique:CreateOptionsWidgets(parent)
button:SetPoint("TOPRIGHT", -5, 3)
button:SetScript("OnClick", function(self) Clique:ButtonOnClick(self) end)
- local switchSpec = makeCheckbox(parent, "CliqueOptionsSpecSwitch", "Change profile when switching talent specs", 300)
- switchSpec:SetPoint("TOPLEFT", 5, -25)
+ local downClick = makeCheckbox(parent, "CliqueOptionsAnyDown", L.DOWNCLICK_LABEL, 300)
+ downClick:SetPoint("TOPLEFT", 5, -25)
+
+ local switchSpec = makeCheckbox(parent, "CliqueOptionsSpecSwitch", L.SPECSWITCH_LABEL, 300)
+ switchSpec:SetPoint("TOPLEFT", 5, -45)
local priDropdown = CreateFrame("Frame", "CliquePriSpecDropDown", parent, "UIDropDownMenuTemplate")
priDropdown:ClearAllPoints()
@@ -1942,7 +1945,10 @@ function Clique:CreateOptionsWidgets(parent)
local function refreshOptions(self)
-- Hide the dropdowns if the spec switch option isn't selected
local switchSpec = Clique.db.char.switchSpec
+ local downClick = Clique.db.char.downClick
CliqueOptionsSpecSwitch:SetChecked(switchSpec)
+ CliqueOptionsAnyDown:SetChecked(downClick)
+
if switchSpec then
CliquePriSpecDropDown:Show()
CliqueSecSpecDropDown:Show()
@@ -1957,6 +1963,7 @@ function Clique:CreateOptionsWidgets(parent)
CliqueSecSpecDropDown:Hide()
end
end
+
parent:SetScript("OnShow", refreshOptions)
switchSpec:SetScript("OnClick", function(self)
if Clique.db.char.switchSpec then
@@ -1967,4 +1974,13 @@ function Clique:CreateOptionsWidgets(parent)
refreshOptions(parent)
Clique:UpdateClicks()
end)
+ downClick:SetScript("OnClick", function(self)
+ if Clique.db.char.downClick then
+ Clique.db.char.downClick = false
+ else
+ Clique.db.char.downClick = true
+ end
+ refreshOptions(parent)
+ Clique:SetClickType()
+ end)
end
diff --git a/Localization.enUS.lua b/Localization.enUS.lua
index 9231a82..f2519a4 100644
--- a/Localization.enUS.lua
+++ b/Localization.enUS.lua
@@ -114,8 +114,11 @@ if GetLocale() then
L.PROFILES = "Profiles"
L.DELETE = "Delete"
L.EDIT = "Edit"
+
L["Clique Options"] = "Clique Options"
L["Primary:"] = "Primary:"
L["Secondary:"] = "Secondary:"
+ L.DOWNCLICK_LABEL = "Trigger clicks on the 'down' portion of the click"
+ L.SPECSWITCH_LABEL = "Change profile when switching talent specs"
end