From 5a32927beb8c34c57bf480404bc6da0b4b8113dd Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Thu, 14 Oct 2010 16:04:53 +0100 Subject: [PATCH] Allow editing of macros, both binding and text --- BindConfig.lua | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/BindConfig.lua b/BindConfig.lua index 195fd34..62f4ab2 100755 --- a/BindConfig.lua +++ b/BindConfig.lua @@ -228,15 +228,26 @@ function CliqueConfig:Button_OnClick(button) -- Check the input local key = self.page2.key local macrotext = self.page2.editbox:GetText() - local succ, err = addon:AddBinding{ - key = key, - type = "macro", - macrotext = macrotext, - } + + if self.page2.binding then + self.page2.binding.key = key + self.page2.binding.macrotext = macrotext + self.page2.binding = nil + if not InCombatLockdown() then + addon:UpdateEverything() + end + else + local succ, err = addon:AddBinding{ + key = key, + type = "macro", + macrotext = macrotext, + } + end self:UpdateList() self.page2:Hide() self.page1:Show() elseif button == self.page2.button_cancel then + self.page2.binding = nil self.page2:Hide() self.page1:Show() end @@ -448,7 +459,7 @@ function CliqueConfig:Row_OnClick(frame, button) local menu = { { - text = L["Configure binding: '%s'"]:format(actionText), + text = L["Configure binding: '%s'"]:format(actionText:sub(1,15)), notCheckable = true, isTitle = true, }, @@ -470,6 +481,24 @@ function CliqueConfig:Row_OnClick(frame, button) }, } + if binding.type == "macro" then + -- Add an edit binding menu + table.insert(menu, 3, { + text = L["Edit macro"], + func = function() + self.page2.bindType = "macro" + local bindText = addon:GetBindingKeyComboText(binding) + self.page2.bindText:SetText(bindText) + self.page2.binding = binding + self.page2.editbox:SetText(binding.macrotext) + self.page2.button_save:Enable() + self.page1:Hide() + self.page2:Show() + end, + notCheckable = true, + }) + end + local submenu = { text = L["Enable/Disable click-sets"], hasArrow = true, -- 1.7.9.5