Skip to content

Commit

Permalink
Increased the Key bind only macro cap from 120 to 1000 (closes #46)
Browse files Browse the repository at this point in the history
  • Loading branch information
Numynum committed Apr 20, 2024
1 parent b1a2f75 commit ede1076
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 13 deletions.
23 changes: 14 additions & 9 deletions MacroToolkit/MacroToolkit.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @class MacroToolkit
local MT = MacroToolkit
local MTF
local L, _G = MT.L, _G
Expand Down Expand Up @@ -463,9 +464,13 @@ function MT:SetMacros(account, extra, copy)
MTF.macroBase = account and 0 or _G.MAX_ACCOUNT_MACROS
MTF.macroMax = account and _G.MAX_ACCOUNT_MACROS or _G.MAX_CHARACTER_MACROS
if extra then
if MT:CountExtra() > 0 then MTF.selectedMacro = 1001
else MTF.selectedMacro = nil end
if MT:CountExtra() > 0 then
MTF.selectedMacro = 1001
else
MTF.selectedMacro = nil
end
MTF.macroBase = 1000
MTF.macroMax = MT.MAX_EXTRA_MACROS
elseif copy then
MTF.selectedMacro = 1
MTF.macroBase = 1
Expand Down Expand Up @@ -520,7 +525,7 @@ function MT:GetNextIndex()
if tab == 3 then
index = 1001
mstart = 1001
mend = 1000 + _G.MAX_ACCOUNT_MACROS
mend = 1000 + MT.MAX_EXTRA_MACROS
end
for m = mstart, mend do
local var = (m > _G.MAX_ACCOUNT_MACROS) and "char" or "global"
Expand Down Expand Up @@ -718,16 +723,16 @@ function MT:SelOnClick(this)
end

function MT:MacroFrameUpdate()
local numMacros, tab
local numMacros
local numAccountMacros, numCharacterMacros = GetNumMacros()
local macroButtonName, macroButton, macroIcon, macroName, macroUnbound
local name, texture, body
local selectedName, selectedBody, selectedIcon
local tab = PanelTemplates_GetSelectedTab(MTF)
local exmacros = {}

numMacros = (MTF.macroBase == 0) and numAccountMacros or numCharacterMacros
if MT.MTCF then if MT.MTCF:IsShown() then tab = 4 end end
local maxMacroButtons = max(_G.MAX_ACCOUNT_MACROS, _G.MAX_CHARACTER_MACROS, MT.MAX_EXTRA_MACROS)
if tab == 3 then
numMacros = MT:CountExtra()
for i, exm in pairs(MT.db.global.extra) do table.insert(exmacros, {name = exm.name, texture = exm.texture, body = exm.body, index = i}) end
Expand All @@ -736,6 +741,7 @@ function MT:MacroFrameUpdate()
if numMacros == _G.MAX_CHARACTER_MACROS then MacroToolkitCopyButton:Disable()
else MacroToolkitCopyButton:Enable() end
elseif tab == 4 then
maxMacroButtons = _G.MAX_CHARACTER_MACROS
numMacros = 0
if MT.charcopy then
if MacroToolkitDB.char[MT.charcopy].extended then
Expand All @@ -759,7 +765,6 @@ function MT:MacroFrameUpdate()
table.sort(exmacros, function(a, b) return a.name < b.name end)
end
end
local maxMacroButtons = (tab == 4) and _G.MAX_CHARACTER_MACROS or max(_G.MAX_ACCOUNT_MACROS, _G.MAX_CHARACTER_MACROS)
--local fsize = select(2, MacroToolkitButton1Name:GetFont())
local font = LSM:Fetch(LSM.MediaType.FONT, MT.db.profile.fonts.mifont)
local k1, k2
Expand Down Expand Up @@ -888,7 +893,7 @@ function MT:MacroFrameUpdate()
if tab == 4 then macroButton.extended = exmacros[i].extended end
else
macroButton:SetChecked(false)
if tab == 3 then macroButton.extra = 1001 end
if tab == 3 then macroButton.extra = 1000 + i end
macroIcon:SetTexture("")
macroName:SetText("")
macroUnbound:Hide()
Expand Down Expand Up @@ -969,7 +974,7 @@ function MT:ContainerOnLoad(container)
container:SetSelectedIndex(1)
container.initialized = true

local maxMacroButtons = (container:GetName() == "MacroToolkitCButtonContainer") and _G.MAX_CHARACTER_MACROS or max(_G.MAX_ACCOUNT_MACROS, _G.MAX_CHARACTER_MACROS)
local maxMacroButtons = (container:GetName() == "MacroToolkitCButtonContainer") and _G.MAX_CHARACTER_MACROS or max(_G.MAX_ACCOUNT_MACROS, _G.MAX_CHARACTER_MACROS, MT.MAX_EXTRA_MACROS)
local bname = (container:GetName() == "MacroToolkitCButtonContainer") and "MacroToolkitCButton" or "MacroToolkitButton"
local OnDragStart = function(button) if not InCombatLockdown() then PickupMacro(MTF.macroBase + button:GetID()) end end
local OnClick = function(button, btn) self:MacroButtonOnClick(button, btn) end
Expand All @@ -985,7 +990,7 @@ function MT:ContainerOnLoad(container)
end

function MT:RepositionContainerButtons(container)
local maxMacroButtons = (container:GetName() == "MacroToolkitCButtonContainer") and _G.MAX_CHARACTER_MACROS or max(_G.MAX_ACCOUNT_MACROS, _G.MAX_CHARACTER_MACROS)
local maxMacroButtons = (container:GetName() == "MacroToolkitCButtonContainer") and _G.MAX_CHARACTER_MACROS or max(_G.MAX_ACCOUNT_MACROS, _G.MAX_CHARACTER_MACROS, MT.MAX_EXTRA_MACROS)
local bname = (container:GetName() == "MacroToolkitCButtonContainer") and "MacroToolkitCButton" or "MacroToolkitButton"
local buttonWidth = 49
local oldButtonsPerRow = container.buttonsPerRow
Expand Down
1 change: 1 addition & 0 deletions MacroToolkit/modules/bindingframe.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @class MacroToolkit
local MT = MacroToolkit
local MTB
local GetBindingText, LoadBindings, SetBinding, GetBindingKey = GetBindingText, LoadBindings, SetBinding, GetBindingKey
Expand Down
2 changes: 1 addition & 1 deletion MacroToolkit/modules/builderframe.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--- @type MacroToolkit
--- @class MacroToolkit
local MT = MacroToolkit
local L = MT.L
local AceGUI = MT.LS("AceGUI-3.0")
Expand Down
1 change: 1 addition & 0 deletions MacroToolkit/modules/copyframe.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local _G = _G
--- @class MacroToolkit
local MT = MacroToolkit
local L = MT.L
local AceGUI = MT.LS("AceGUI-3.0")
Expand Down
3 changes: 2 additions & 1 deletion MacroToolkit/modules/elvskin.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local _G = _G
local format, unpack, string = format, unpack, string
--- @class MacroToolkit
local MT = MacroToolkit
MT.skinned = {}

Expand Down Expand Up @@ -217,7 +218,7 @@ function MT:LoadElvSkin(frame)
end

if frame == MacroToolkitFrame or frame == MacroToolkitCopyFrame or frame == MacroToolkitPopup then
for i = 1, _G.MAX_ACCOUNT_MACROS do
for i = 1, MT.MAX_EXTRA_MACROS do
local b = _G[format("MacroToolkitButton%d", i)]
local c = _G[format("MacroToolkitCButton%d", i)]
local t = _G[format("MacroToolkitButton%dIcon", i)]
Expand Down
3 changes: 2 additions & 1 deletion MacroToolkit/modules/initialise.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local _G = _G
--- @type MacroToolkit
--- @class MacroToolkit
local MT = MacroToolkit
MT.LS = LibStub
MT.L = MT.LS("AceLocale-3.0"):GetLocale("MacroToolkit")
Expand All @@ -8,6 +8,7 @@ MT.LDB = MT.LS("LibDataBroker-1.1")
MT.slash = string.sub(_G.SLASH_CAST1, 1, 1)
MT.click = _G.SLASH_CLICK1
MT.target = _G.SLASH_TARGET1
MT.MAX_EXTRA_MACROS = 1000 -- I'd like to see you try to hit this limit :P
local L = MT.L
local SendChatMessage, format = SendChatMessage, format

Expand Down
1 change: 1 addition & 0 deletions MacroToolkit/modules/macrobroker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
--* Code based on the abandoned addon -- Macro Broker by Tuhljin *
--****************************************************************

--- @class MacroToolkit
local MT = MacroToolkit
local assert, type, strlower, select, strmatch, format, tonumber, strsub, strlen, strtrim = assert, type, strlower, select, strmatch, format, tonumber, strsub, strlen, strtrim
local ipairs, error, pcall, loadstring, tinsert = ipairs, error, pcall, loadstring, tinsert
Expand Down
3 changes: 2 additions & 1 deletion MacroToolkit/modules/mainframe.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local _G = _G
--- @class MacroToolkit
local MT = MacroToolkit
local CreateFrame, PlaySound, GameTooltip, GameTooltip_Hide, UnitName = CreateFrame, PlaySound, GameTooltip, GameTooltip_Hide, UnitName
local UIParent = UIParent
Expand Down Expand Up @@ -1087,7 +1088,7 @@ function MT:CreateSecureFrames()
end

--extra macros
for b = 1001, 1000 + _G.MAX_ACCOUNT_MACROS do
for b = 1001, 1000 + MT.MAX_EXTRA_MACROS do
self:CreateSecureActionButton(b)
end
end
Expand Down
1 change: 1 addition & 0 deletions MacroToolkit/modules/options.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local _G = _G
--- @class MacroToolkit
local MT = MacroToolkit
local AceConfig = MT.LS("AceConfig-3.0")
local AceConfigDialog = MT.LS("AceConfigDialog-3.0")
Expand Down
1 change: 1 addition & 0 deletions MacroToolkit/modules/parser.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @class MacroToolkit
local MT = MacroToolkit
local string, table, ipairs, pairs, type, math = string, table, ipairs, pairs, type, math
local strsplit, select, wipe, tonumber = strsplit, select, wipe, tonumber
Expand Down
1 change: 1 addition & 0 deletions MacroToolkit/modules/popupframe.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @class MacroToolkit
local MT = MacroToolkit
local mtpf
local L = MT.L
Expand Down
1 change: 1 addition & 0 deletions MacroToolkit/modules/restoreframe.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @class MacroToolkit
local MT = MacroToolkit
local L = MT.L
local AceGUI = MT.LS("AceGUI-3.0")
Expand Down
1 change: 1 addition & 0 deletions MacroToolkit/modules/scriptframe.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @class MacroToolkit
local MT = MacroToolkit
local L = MT.L
local string, format = string, format
Expand Down
1 change: 1 addition & 0 deletions MacroToolkit/modules/shareframe.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @class MacroToolkit
local MT = MacroToolkit
local L = MT.L
local string, format, strsplit = string, format, strsplit
Expand Down
1 change: 1 addition & 0 deletions MacroToolkit/modules/showtooltipMock.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- @class MacroToolkit
local MT = MacroToolkit

-- copied the update timing concept from SecureStateDriverManager
Expand Down

0 comments on commit ede1076

Please sign in to comment.