Skip to content

Commit d9ea3d5

Browse files
committed
Initial commit
1 parent 8ae9f9c commit d9ea3d5

File tree

4 files changed

+267
-0
lines changed

4 files changed

+267
-0
lines changed

Iconic/Iconic.lua

+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
local _G = getfenv(0)
2+
3+
local lastMacroButtonMousedOver
4+
local numMacroIcons
5+
local availableMacroIcons = {}
6+
7+
local function HookScript(frame, script, hook)
8+
local handler = frame:GetScript(script)
9+
frame:SetScript(script, function(a1, a2, a3, a4, a5, a6, a7)
10+
hook(function(a1, a2, a3, a4, a5, a6, a7)
11+
if handler then
12+
handler(a1, a2, a3, a4, a5, a6, a7)
13+
end
14+
end)
15+
end)
16+
end
17+
18+
local function hooksecurefunc(arg1, arg2, arg3)
19+
if type(arg1) == "string" then
20+
arg1, arg2, arg3 = _G, arg1, arg2
21+
end
22+
local orig = arg1[arg2]
23+
arg1[arg2] = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
24+
local x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20 = orig(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
25+
26+
arg3(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
27+
28+
return x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20
29+
end
30+
end
31+
32+
33+
local function customFind(str, pattern)
34+
local startIdx, endIdx = string.find(str, pattern)
35+
if startIdx then
36+
return string.sub(str, startIdx, endIdx)
37+
end
38+
return nil
39+
end
40+
41+
function Iconic_MacroPopupFrame_Update()
42+
local macroPopupIcon, macroPopupButton
43+
local macroPopupOffset = FauxScrollFrame_GetOffset(MacroPopupScrollFrame)
44+
local numMacroIconsFound, filteredMacroIconID, macroIconID, texturePath, stringFound
45+
local userInput = string.lower(IconicFrame:GetText())
46+
userInput = gsub(userInput, "%%", "")
47+
local filteredMacroIconIDs = {}
48+
49+
for macroIconID = 1, numMacroIcons do
50+
texturePath = GetMacroIconInfo(macroIconID)
51+
if texturePath then
52+
local textureName = string.lower(customFind(texturePath, ".*\\(.*)"))
53+
stringFound = customFind(textureName, userInput)
54+
if stringFound then
55+
tinsert(filteredMacroIconIDs, macroIconID)
56+
end
57+
end
58+
end
59+
numMacroIconsFound = table.getn(filteredMacroIconIDs)
60+
61+
for buttonID = 1, NUM_MACRO_ICONS_SHOWN do
62+
macroPopupIcon = _G["MacroPopupButton" .. buttonID .. "Icon"]
63+
macroPopupButton = _G["MacroPopupButton" .. buttonID]
64+
filteredMacroIconID = (macroPopupOffset * NUM_ICONS_PER_ROW) + buttonID
65+
66+
if filteredMacroIconID <= numMacroIconsFound then
67+
macroIconID = filteredMacroIconIDs[filteredMacroIconID]
68+
texturePath = GetMacroIconInfo(macroIconID)
69+
macroPopupIcon:SetTexture(texturePath)
70+
macroPopupButton:Show()
71+
else
72+
macroPopupIcon:SetTexture("")
73+
macroPopupButton:Hide()
74+
end
75+
76+
if MacroPopupFrame.selectedIcon and (macroIconID == MacroPopupFrame.selectedIcon) then
77+
macroPopupButton:SetChecked(1)
78+
elseif MacroPopupFrame.selectedIconTexture == texturePath then
79+
macroPopupButton:SetChecked(1)
80+
else
81+
macroPopupButton:SetChecked(nil)
82+
end
83+
end
84+
85+
FauxScrollFrame_Update(MacroPopupScrollFrame, ceil(numMacroIconsFound / NUM_ICONS_PER_ROW), NUM_ICON_ROWS, MACRO_ICON_ROW_HEIGHT)
86+
end
87+
88+
function Iconic_MacroPopupButton_OnEnter()
89+
if not customFind(this:GetName(), "MacroPopupButton") then
90+
return
91+
end
92+
local iconName = this:GetName() .. "Icon"
93+
local texturePath = _G[iconName]:GetTexture()
94+
if texturePath then
95+
local textureName = customFind(texturePath, ".*\\(.*)")
96+
local textureNameKeywords = gsub(textureName, "_", ", ")
97+
98+
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
99+
GameTooltip:AddLine(textureNameKeywords)
100+
lastMacroButtonMousedOver = this
101+
GameTooltip:Show()
102+
end
103+
end
104+
105+
local function Iconic_UpdateAfterScroll(frame)
106+
if not customFind(frame:GetName(), "MacroPopupButton") then
107+
return
108+
end
109+
local iconName = frame:GetName() .. "Icon"
110+
local texturePath = _G[iconName]:GetTexture()
111+
if texturePath then
112+
local textureName = customFind(texturePath, ".*\\(.*)")
113+
local textureNameKeywords = gsub(textureName, "_", ", ")
114+
115+
GameTooltip:SetOwner(frame, "ANCHOR_RIGHT")
116+
GameTooltip:AddLine(textureNameKeywords)
117+
lastMacroButtonMousedOver = frame
118+
GameTooltip:Show()
119+
end
120+
end
121+
122+
function Iconic_MacroPopupButton_OnLeave()
123+
GameTooltip:Hide()
124+
lastMacroButtonMousedOver = nil
125+
end
126+
127+
function Iconic_MacroPopupButton_OnClick()
128+
local iconName = this:GetName() .. "Icon"
129+
local texturePath = _G[iconName]:GetTexture()
130+
if texturePath then
131+
MacroPopupFrame.selectedIcon = availableMacroIcons[texturePath]
132+
MacroFrameSelectedMacroButtonIcon:SetTexture(texturePath);
133+
MacroPopupOkayButton_Update();
134+
MacroPopupFrame_Update();
135+
end
136+
end
137+
138+
function Iconic_TooltipRefresh()
139+
if arg1 then
140+
local scrollbar = getglobal("MacroPopupScrollFrameScrollBar");
141+
scrollbar:SetValue(arg1);
142+
this.offset = floor((arg1 / MACRO_ICON_ROW_HEIGHT) + 0.5);
143+
Iconic_MacroPopupFrame_Update();
144+
end
145+
if lastMacroButtonMousedOver then
146+
Iconic_UpdateAfterScroll(GetMouseFocus())
147+
end
148+
end
149+
150+
function Iconic_MacroPopupScroll_ResetPosition()
151+
if MacroPopupScrollFrame:GetVerticalScroll() > 0 then
152+
MacroPopupScrollFrame:SetVerticalScroll(0)
153+
end
154+
end
155+
156+
if not IsAddOnLoaded("Blizzard_MacroUI") then
157+
LoadAddOn("Blizzard_MacroUI")
158+
end
159+
160+
numMacroIcons = GetNumMacroIcons()
161+
for i = 1, numMacroIcons do
162+
local texture = GetMacroIconInfo(i)
163+
if texture then
164+
availableMacroIcons[texture] = i
165+
end
166+
end
167+
168+
for i = 1, NUM_MACRO_ICONS_SHOWN do
169+
local MacroPopupButton = _G["MacroPopupButton" .. i]
170+
HookScript(MacroPopupButton, "OnEnter", Iconic_MacroPopupButton_OnEnter)
171+
HookScript(MacroPopupButton, "OnLeave", Iconic_MacroPopupButton_OnLeave)
172+
HookScript(MacroPopupButton, "OnClick", Iconic_MacroPopupButton_OnClick)
173+
end
174+
175+
HookScript(MacroPopupScrollFrame, "OnVerticalScroll", Iconic_TooltipRefresh)
176+
177+
hooksecurefunc(_G, "MacroPopupFrame_Update", Iconic_MacroPopupFrame_Update)

Iconic/Iconic.toc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Interface: 12200
2+
## Title: |cffe3fdffIconic
3+
## Author: Conj, mod by Alchem1ster
4+
## Version: 1.1_Vanilla
5+
## Notes: Improves the default macro icon selection system by adding a search bar
6+
## LoadOnDemand: 1
7+
## LoadWith: Blizzard_MacroUI
8+
9+
Iconic.lua
10+
Iconic.xml

Iconic/Iconic.xml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<Ui xmlns="http://www.blizzard.com/wow/ui/"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
4+
5+
<EditBox name="IconicFrame" parent="MacroPopupFrame" autoFocus="false">
6+
<Size x="105" y="20" />
7+
8+
<Anchors>
9+
<Anchor point="BOTTOMLEFT">
10+
<Offset x="17" y="13" />
11+
</Anchor>
12+
</Anchors>
13+
14+
<Layers>
15+
<Layer level="BACKGROUND">
16+
<Texture name="IconicFrameLeft" file="Interface\ClassTrainerFrame\UI-ClassTrainer-FilterBorder">
17+
<Size>
18+
<AbsDimension x="12" y="26" />
19+
</Size>
20+
<Anchors>
21+
<Anchor point="LEFT">
22+
<Offset>
23+
<AbsDimension x="-8" y="-3" />
24+
</Offset>
25+
</Anchor>
26+
</Anchors>
27+
<TexCoords left="0" right="0.09375" top="0" bottom="1.0" />
28+
</Texture>
29+
<Texture name="IconicFrameMid" file="Interface\ClassTrainerFrame\UI-ClassTrainer-FilterBorder">
30+
<Size>
31+
<AbsDimension x="94" y="26" />
32+
</Size>
33+
<Anchors>
34+
<Anchor point="LEFT" relativeTo="IconicFrameLeft" relativePoint="RIGHT" />
35+
</Anchors>
36+
<TexCoords left="0.09375" right="0.90625" top="0" bottom="1.0" />
37+
</Texture>
38+
<Texture name="IconicFrameRight" file="Interface\ClassTrainerFrame\UI-ClassTrainer-FilterBorder">
39+
<Size>
40+
<AbsDimension x="12" y="26" />
41+
</Size>
42+
<Anchors>
43+
<Anchor point="LEFT" relativeTo="IconicFrameMid" relativePoint="RIGHT" />
44+
</Anchors>
45+
<TexCoords left="0.90625" right="1.0" top="0" bottom="1.0"/>
46+
</Texture>
47+
</Layer>
48+
</Layers>
49+
50+
<Scripts>
51+
<OnEscapePressed>
52+
IconicFrame:ClearFocus()
53+
</OnEscapePressed>
54+
<OnTextChanged>
55+
Iconic_MacroPopupScroll_ResetPosition()
56+
Iconic_MacroPopupFrame_Update()
57+
Iconic_TooltipRefresh()
58+
</OnTextChanged>
59+
</Scripts>
60+
61+
<FontString inherits="ChatFontNormal" />
62+
</EditBox>
63+
</Ui>

README.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
# Iconic - Vanilla
3+
4+
###### _Original author: [Conj](https://www.wowinterface.com/downloads/info17254)_
5+
### _Tested with 1.17.1 (Turtle - Nordanaar)_
6+
7+
8+
Iconic integrates into Blizzard's default Macro UI. There are no slash commands, no setup, and no preferences to mess with. Simply open up your macro window with /macro, write your macro, name it, then when you go to choose your icon use Iconic's search bar (left of the "Okay" button) to help narrow things down!
9+
10+
11+
==VIDEO MP4==
12+
13+
14+
## How to install
15+
- Download [THIS](==LINK TO LATEST RELEASE==) archive;
16+
- Extract `Iconic` folder to your `Interface/AddOns` folder;
17+
- Enjoy!

0 commit comments

Comments
 (0)