Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Clicked/Clicked2.toc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Core\StringUtils.lua
Core\Serializer.lua
Core\Upgrader.lua

Modules\Minimap.lua

Conditions\ConditionRegistry.lua
Conditions\ConditionUtils.lua
Conditions\LoadConditions.lua
Expand Down
58 changes: 15 additions & 43 deletions Clicked/Config/Addon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

local AceConfig = LibStub("AceConfig-3.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local LibDBIcon = LibStub("LibDBIcon-1.0")
local LibLog = LibStub("LibLog-1.0")

--- @class Addon
local Addon = select(2, ...)
Expand All @@ -33,47 +31,10 @@ end
--- @private
--- @return AceConfig.OptionsTable
function AddonOptions:CreateOptionsTable()
return {
local result = {
type = "group",
name = Addon.L["Clicked2"],
args = {
minimapIcon = {
name = Addon.L["Enable minimap icon"],
desc = Addon.L["Enable or disable the minimap icon."],
type = "toggle",
order = 100,
width = "full",
set = function(_, val)
Addon.db.profile.options.minimap.hide = not val

if val then
LibDBIcon:Show(Addon.L["Clicked2"])
else
LibDBIcon:Hide(Addon.L["Clicked2"])
end
end,
get = function(_)
return not Addon.db.profile.options.minimap.hide
end
},
addonCompartmentButton = {
name = Addon.L["Enable addon compartment button"],
desc = Addon.L["Enable or disable the addon compartment button."],
type = "toggle",
order = 101,
width = "full",
hidden = Addon.EXPANSION < Addon.Expansion.DF,
set = function (_, val)
if val then
LibDBIcon:AddButtonToCompartment(Addon.L["Clicked2"])
else
LibDBIcon:RemoveButtonFromCompartment(Addon.L["Clicked2"])
end
end,
get = function(_)
return LibDBIcon:IsButtonInCompartment(Addon.L["Clicked2"])
end
},
onKeyDown = {
name = Addon.L["Cast on key down rather than key up"],
desc = Addon.L["This option will make bindings trigger on the 'down' portion of a button press rather than the 'up' portion."],
Expand Down Expand Up @@ -130,9 +91,7 @@ function AddonOptions:CreateOptionsTable()
type = "toggle",
order = 600,
width = "full",
hidden = function()
return Addon.EXPANSION < Addon.Expansion.TWW
end,
hidden = Addon.EXPANSION < Addon.Expansion.TWW,
set = function (_, val)
Addon.db.profile.options.disableInHouse = val
Addon:ReloadBindings("HOUSE_EDITOR_MODE_CHANGED")
Expand All @@ -146,6 +105,19 @@ function AddonOptions:CreateOptionsTable()
})
}
}

for _, module in Clicked2:IterateModules() do
--- @cast module AceModule|AddonOptionsProvider
local handler = module.GetAddonOptions

if type(handler) == "function" then
for key, option in pairs(handler(module)) do
result.args[module.moduleName .. "_" .. key] = option
end
end
end

return result
end

Addon.AddonOptions = AddonOptions
23 changes: 0 additions & 23 deletions Clicked/Core/Clicked.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
-- along with this program. If not, see <https://www.gnu.org/licenses/>.

local AceConsole = LibStub("AceConsole-3.0")
local LibDataBroker = LibStub("LibDataBroker-1.1")
local LibDBIcon = LibStub("LibDBIcon-1.0")

--- @class Addon
local Addon = select(2, ...)
Expand All @@ -29,25 +27,6 @@ local wasHouseEditorActive = false
--- @type table<string, boolean>
local playerFlagsCache = {}

-- Local support functions

local function RegisterIcons()
local iconData = LibDataBroker:NewDataObject("Clicked2", {
type = "launcher",
label = Addon.L["Clicked2"],
icon = "Interface\\Icons\\inv_misc_punchcards_yellow",
OnClick = function()
Addon.BindingConfig.Window:Open()
end,
OnTooltipShow = function(tooltip)
tooltip:AddLine(Addon.L["Clicked2"])
end
})

LibDBIcon:Register(Addon.L["Clicked2"], iconData, Addon.db.profile.options.minimap)
LibDBIcon:AddButtonToCompartment(Addon.L["Clicked2"])
end

--- Parse a chat command input and handle it appropriately.
---
--- @param input string The data of the chat command, excluding the first word
Expand Down Expand Up @@ -360,8 +339,6 @@ function Clicked2:OnInitialize()

Addon:UpgradeDatabase()

RegisterIcons()

Addon:RegisterClickCastHeader()
Addon:RegisterBlizzardUnitFrames()

Expand Down
1 change: 1 addition & 0 deletions Clicked/Core/Init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
Clicked2 = LibStub("AceAddon-3.0"):NewAddon("Clicked2", "AceEvent-3.0", "LibLog-1.0")
Clicked2.VERSION = C_AddOns.GetAddOnMetadata("Clicked2", "Version")

Clicked2:SetDefaultModuleLibraries("LibLog-1.0")
Clicked2:LogVerbose("Initializing Clicked")

--@debug@
Expand Down
8 changes: 2 additions & 6 deletions Clicked/Definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@

--- @meta

--- @class Clicked : AceAddon, AceEvent-3.0
--- @field public VERSION string

--- @class Addon : AceEvent-3.0
--- @field public L table<string,string>
--- @field public db AceDBObject-3.0
--- @class AddonOptionsProvider
--- @field public GetAddonOptions fun(self: AddonOptionsProvider): table<string, AceConfig.OptionsTable>

--- @class Profile
--- @field public version integer
Expand Down
113 changes: 113 additions & 0 deletions Clicked/Modules/Minimap.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
-- Clicked, a World of Warcraft keybind manager.
-- Copyright (C) 2026 Kevin Krol
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.

local LibDataBroker = LibStub("LibDataBroker-1.1")
local LibDBIcon = LibStub("LibDBIcon-1.0")

--- @class Addon
local Addon = select(2, ...)

--- @class MinimapModule : AceModule, LibLog-1.0.Logger, AddonOptionsProvider
local Prototype = {}

--- @protected
function Prototype:OnInitialize()
local iconData = LibDataBroker:NewDataObject("Clicked2", {
type = "launcher",
label = Addon.L["Clicked2"],
icon = "Interface\\Icons\\inv_misc_punchcards_yellow",
OnClick = function()
Addon.BindingConfig.Window:Open()
end,
OnTooltipShow = function(tooltip)
tooltip:AddLine(Addon.L["Clicked2"])
end
})

LibDBIcon:Register(Addon.L["Clicked2"], iconData, Addon.db.profile.options.minimap)
LibDBIcon:AddButtonToCompartment(Addon.L["Clicked2"])

self:LogDebug("Initialized minimap module")
end

--- @param enabled boolean
function Prototype:SetMinimapButtonEnabled(enabled)
self:LogDebug("Set minimap button visibility to {visible}", enabled)

Addon.db.profile.options.minimap.hide = not enabled

if enabled then
LibDBIcon:Show(Addon.L["Clicked2"])
else
LibDBIcon:Hide(Addon.L["Clicked2"])
end
end

--- @param enabled boolean
function Prototype:SetCompartmentButtonEnabled(enabled)
self:LogDebug("Set addon compartment button visibility to {visible}", enabled)

if enabled then
LibDBIcon:AddButtonToCompartment(Addon.L["Clicked2"])
else
LibDBIcon:RemoveButtonFromCompartment(Addon.L["Clicked2"])
end
end

--- @return boolean
function Prototype:IsMinimapButtonEnabled()
return not Addon.db.profile.options.minimap.hide
end

--- @return boolean
function Prototype:IsCompartmentButtonEnabled()
return LibDBIcon:IsButtonInCompartment(Addon.L["Clicked2"])
end

--- @return table<string, AceConfig.OptionsTable>
function Prototype:GetAddonOptions()
return {
minimapIcon = {
name = Addon.L["Enable minimap icon"],
desc = Addon.L["Enable or disable the minimap icon."],
type = "toggle",
order = 100,
width = "full",
set = function(_, val)
self:SetMinimapButtonEnabled(val)
end,
get = function(_)
return self:IsMinimapButtonEnabled()
end
},
addonCompartmentButton = {
name = Addon.L["Enable addon compartment button"],
desc = Addon.L["Enable or disable the addon compartment button."],
type = "toggle",
order = 101,
width = "full",
hidden = Addon.EXPANSION < Addon.Expansion.DF,
set = function (_, val)
self:SetCompartmentButtonEnabled(val)
end,
get = function()
return self:IsCompartmentButtonEnabled()
end
}
}
end

Clicked2:NewModule("Minimap", Prototype)