From bdffbff4d51b732d39ee02deaef5da496769040c Mon Sep 17 00:00:00 2001 From: a08381 <632785425@163.com> Date: Wed, 18 Oct 2017 16:06:28 +0800 Subject: [PATCH 1/3] Fix exception when change icon. --- SuperDuperMacro_Frames.lua | 2 ++ SuperDuperMacro_Interface.lua | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/SuperDuperMacro_Frames.lua b/SuperDuperMacro_Frames.lua index 533d2a3..bc8a8e5 100644 --- a/SuperDuperMacro_Frames.lua +++ b/SuperDuperMacro_Frames.lua @@ -13,10 +13,12 @@ f:SetPoint("TOPLEFT", 0, -104) sdm_MakeDraggable(f) f:SetScript("OnShow", function(self) --PlaySound "igCharacterInfoOpen" + PlaySound(839) sdm_UpdateList() end) f:SetScript("OnHide", function(self) --PlaySound "igCharacterInfoClose" + PlaySound(840) sdm_currentlyPlacing=nil sdm_StopMove() self:ClearAllPoints() diff --git a/SuperDuperMacro_Interface.lua b/SuperDuperMacro_Interface.lua index 93d2f82..e3ef695 100644 --- a/SuperDuperMacro_Interface.lua +++ b/SuperDuperMacro_Interface.lua @@ -427,10 +427,16 @@ function sdm_UpdateList() end sdm_SetTooltip(listItem, "Alt-click for folder options and instructions") else - if mTab.icon:upper() == sdm_defaultIcon and mTab.type=="b" and (sdm_UsedByThisChar(mTab)) then - _,texture = GetMacroInfo(sdm_GetMacroIndex(mTab.ID)) - else - texture = "INTERFACE\\ICONS\\"..mTab.icon + -- if mTab.icon:upper() == sdm_defaultIcon and mTab.type=="b" and (sdm_UsedByThisChar(mTab)) then + if type(mTab.icon) == "number" then + texture = mTab.icon + else + if mTab.icon:upper() == sdm_defaultIcon and mTab.type=="b" and (sdm_UsedByThisChar(mTab)) then + _,texture = GetMacroInfo(sdm_GetMacroIndex(mTab.ID)) + else + texture = "INTERFACE\\ICONS\\"..mTab.icon + end + -- texture = "INTERFACE\\ICONS\\"..mTab.icon end if texture then listItem.icon:SetTexture(texture) @@ -633,7 +639,8 @@ function sdm_OnShow_changeIconFrame(f) MacroPopupFrame:SetPoint("TOP", f, "BOTTOM", 0,15) MacroPopupFrame:Show() _,_,_,_,f.fontstring = MacroPopupFrame:GetRegions() - f.fontstring:SetText(" Different name on button:") + -- f.fontstring:SetText(" Different name on button:") + -- I don't know what is it now, and I try print all returns in MacroPopupFrame:GetRegions() but none of them has 'SetText' method. MacroPopupOkayButton:Hide() MacroPopupCancelButton:Hide() MacroPopupFrame_sdmOkayButton:Show() @@ -666,7 +673,7 @@ function sdm_OnHide_changeIconFrame(f) for _,point in ipairs(f.prevpoints) do MacroPopupFrame:SetPoint(point[1], point[2], point[3], point[4], point[5]) end - f.fontstring:SetText(MACRO_POPUP_TEXT) + -- f.fontstring:SetText(MACRO_POPUP_TEXT) f.fontstring:Show() MacroPopupEditBox:Show() MacroPopupOkayButton:Show() @@ -678,7 +685,7 @@ function sdm_OnHide_changeIconFrame(f) end function sdm_GetSelectedIcon() - return GetSpellorMacroIconInfo(MacroPopupFrame.selectedIcon) + return GetSpellorMacroIconInfo(MacroPopupFrame.selectedIcon) -- This will now return a number end function sdm_ChangeIconOkayed() From ca15294323463b933111223179402b28026420aa Mon Sep 17 00:00:00 2001 From: a08381 <632785425@163.com> Date: Wed, 18 Oct 2017 16:12:51 +0800 Subject: [PATCH 2/3] format. --- SuperDuperMacro_Interface.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/SuperDuperMacro_Interface.lua b/SuperDuperMacro_Interface.lua index e3ef695..6076e76 100644 --- a/SuperDuperMacro_Interface.lua +++ b/SuperDuperMacro_Interface.lua @@ -428,14 +428,14 @@ function sdm_UpdateList() sdm_SetTooltip(listItem, "Alt-click for folder options and instructions") else -- if mTab.icon:upper() == sdm_defaultIcon and mTab.type=="b" and (sdm_UsedByThisChar(mTab)) then - if type(mTab.icon) == "number" then - texture = mTab.icon - else - if mTab.icon:upper() == sdm_defaultIcon and mTab.type=="b" and (sdm_UsedByThisChar(mTab)) then - _,texture = GetMacroInfo(sdm_GetMacroIndex(mTab.ID)) - else - texture = "INTERFACE\\ICONS\\"..mTab.icon - end + if type(mTab.icon) == "number" then + texture = mTab.icon + else + if mTab.icon:upper() == sdm_defaultIcon and mTab.type=="b" and (sdm_UsedByThisChar(mTab)) then + _,texture = GetMacroInfo(sdm_GetMacroIndex(mTab.ID)) + else + texture = "INTERFACE\\ICONS\\"..mTab.icon + end -- texture = "INTERFACE\\ICONS\\"..mTab.icon end if texture then @@ -640,7 +640,7 @@ function sdm_OnShow_changeIconFrame(f) MacroPopupFrame:Show() _,_,_,_,f.fontstring = MacroPopupFrame:GetRegions() -- f.fontstring:SetText(" Different name on button:") - -- I don't know what is it now, and I try print all returns in MacroPopupFrame:GetRegions() but none of them has 'SetText' method. + -- I don't know what is it now, and I try print all returns in MacroPopupFrame:GetRegions() but none of them has 'SetText' method. MacroPopupOkayButton:Hide() MacroPopupCancelButton:Hide() MacroPopupFrame_sdmOkayButton:Show() From 1d3673e7e43887aba0ed3caa6272156a6a223b83 Mon Sep 17 00:00:00 2001 From: a08381 <632785425@163.com> Date: Fri, 20 Oct 2017 12:12:09 +0800 Subject: [PATCH 3/3] Fix Upgrade Button. --- SuperDuperMacro_Core.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SuperDuperMacro_Core.lua b/SuperDuperMacro_Core.lua index fbd5842..1afbc3b 100644 --- a/SuperDuperMacro_Core.lua +++ b/SuperDuperMacro_Core.lua @@ -411,7 +411,9 @@ function sdm_UpgradeMacro(index) -- Upgrades the given standard macro to a Super local body = GetMacroBody(index) EditMacro(index, nil, nil, "#sdm"..sdm_numToChars(sdm_GetEmptySlot()).."\n#placeholder") -- let SDM know that this is the macro to edit local _, texture = GetMacroInfo(index) -- This must be done AFTER the macro body is edited, or the question mark could show up as something else. - texture = texture:sub(17) -- remove the "INTERFACE\\ICONS\\" + if type(texture) ~= "number" then + texture = texture:sub(17) -- remove the "INTERFACE\\ICONS\\" + end local newMacro = sdm_CreateNew("b", name, character) newMacro.icon = texture sdm_Edit(newMacro, body) @@ -579,4 +581,4 @@ function sdm_charsToNum(chars) --converts characters back into a number if not found then return nil end --this shouldn't happen unless we give bad chars end return num -end \ No newline at end of file +end