Skip to content

Commit 9452e5e

Browse files
committed
Add an addon compartment entry
1 parent db8e848 commit 9452e5e

2 files changed

Lines changed: 38 additions & 18 deletions

File tree

UnifiedProfileManager.lua

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ UPM:SetScript('OnEvent', function(self, event, ...)
5757
end);
5858
UPM:RegisterEvent('ADDON_LOADED');
5959

60+
do
61+
function UnifiedProfileManager_OnAddonCompartmentClick()
62+
UPM:OpenConfigUI();
63+
end
64+
function UnifiedProfileManager_OnAddonCompartmentEnter(_, button)
65+
GameTooltip:SetOwner(button, 'ANCHOR_RIGHT');
66+
GameTooltip:SetText('Unified Profile Manager');
67+
GameTooltip:AddLine(CreateAtlasMarkup('NPE_LeftClick', 18, 18) .. ' to manage your profiles', 1, 1, 1);
68+
GameTooltip:Show();
69+
end
70+
function UnifiedProfileManager_OnAddonCompartmentLeave()
71+
GameTooltip:Hide();
72+
end
73+
end
74+
6075
function UPM:ADDON_LOADED()
6176
if NumyProfiler then
6277
--- @type NumyProfiler
@@ -92,24 +107,26 @@ function UPM:ADDON_LOADED()
92107

93108
_G.SLASH_UNIFIED_PROFILE_MANAGER1 = '/upm';
94109
_G.SLASH_UNIFIED_PROFILE_MANAGER2 = '/profiles';
95-
SlashCmdList['UNIFIED_PROFILE_MANAGER'] = function()
96-
AceConfig:RegisterOptionsTable(name, self:GetOptionsTable());
97-
AceConfigDialog:Open(name);
98-
local container = AceConfigDialog.OpenFrames[name];
99-
if not container or not container.frame then return; end
100-
container:SetTitle('Unified Profile Manager');
101-
container.SetTitle = nop;
102-
local frame = container.frame;
103-
frame:SetMovable(true);
104-
frame:SetScript('OnMouseDown', function(self)
105-
self:StartMoving();
106-
end);
107-
frame:SetScript('OnMouseUp', function(self)
108-
self:StopMovingOrSizing();
109-
end);
110-
frame.ClearAllPoints = nop;
111-
frame.SetPoint = nop;
112-
end;
110+
SlashCmdList['UNIFIED_PROFILE_MANAGER'] = function() UPM:OpenConfigUI(); end;
111+
end
112+
113+
function UPM:OpenConfigUI()
114+
AceConfig:RegisterOptionsTable(name, self:GetOptionsTable());
115+
AceConfigDialog:Open(name);
116+
local container = AceConfigDialog.OpenFrames[name];
117+
if not container or not container.frame then return; end
118+
container:SetTitle('Unified Profile Manager');
119+
container.SetTitle = nop;
120+
local frame = container.frame;
121+
frame:SetMovable(true);
122+
frame:SetScript('OnMouseDown', function(self)
123+
self:StartMoving();
124+
end);
125+
frame:SetScript('OnMouseUp', function(self)
126+
self:StopMovingOrSizing();
127+
end);
128+
frame.ClearAllPoints = nop;
129+
frame.SetPoint = nop;
113130
end
114131

115132
UPM.resultCache = {};

UnifiedProfileManager.toc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
## Notes: A simple overview of all addon profiles for addons that use AceDB
99
## Author: Numy
1010
## SavedVariables: UnifiedProfileManagerDB
11+
## AddonCompartmentFunc: UnifiedProfileManager_OnAddonCompartmentClick
12+
## AddonCompartmentFuncOnEnter: UnifiedProfileManager_OnAddonCompartmentEnter
13+
## AddonCompartmentFuncOnLeave: UnifiedProfileManager_OnAddonCompartmentLeave
1114
## IconTexture: Interface\Addons\UnifiedProfileManager\media\icon
1215
## Version: @project-version@
1316
## X-Curse-Project-ID: 1033706

0 commit comments

Comments
 (0)