vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 local _G = getfenv(0)
2 -- Frame multipliers
3 local FxMult, FyMult = 0.9, 0.84
4 -- Frame Tab multipliers
5 local FTxMult, FTyMult = 0.5, 0.75
6 -- Character subframe names
7  
8 function oSkin:Tooltips()
9 if not self.db.profile.Tooltips or self.initialized.Tooltips then return end
10 self.initialized.Tooltips = true
11  
12 self:skinTooltip(_G["GameTooltip"])
13 self:skinTooltip(_G["ItemRefTooltip"])
14  
15 end
16  
17 function oSkin:MirrorTimers()
18 if not self.db.profile.MirrorTimers or self.initialized.MirrorTimers then return end
19 self.initialized.MirrorTimers = true
20  
21 for i = 1, MIRRORTIMER_NUMTIMERS do
22 self:removeRegions(_G["MirrorTimer"..i], {1, 3}) -- N.B. region 2 is text
23 _G["MirrorTimer"..i]:SetHeight(_G["MirrorTimer"..i]:GetHeight() - 3)
24 self:moveObject(_G["MirrorTimer"..i.."Text"], nil, nil, "-", 4)
25 self:moveObject(_G["MirrorTimer"..i.."StatusBar"], nil, nil, "-", 3)
26 self:applySkin(_G["MirrorTimer"..i])
27 self:glazeStatusBar(_G["MirrorTimer"..i.."StatusBar"], 0)
28 end
29  
30 end
31  
32 function oSkin:QuestTimers()
33 if not self.db.profile.MirrorTimers or self.initialized.QuestTimers then return end
34 self.initialized.QuestTimers = true
35  
36 self:removeRegions(_G["QuestTimerFrame"], {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}) -- N.B. region 11 is text
37 _G["QuestTimerFrame"]:SetWidth(_G["QuestTimerFrame"]:GetWidth()-40)
38 _G["QuestTimerFrame"]:SetHeight(_G["QuestTimerFrame"]:GetHeight()-20)
39 self:moveObject(_G["QuestTimerHeader"], nil, nil, "-", 4)
40 self:applySkin(_G["QuestTimerFrame"])
41  
42 end
43  
44 function oSkin:CastingBar()
45 if not self.db.profile.CastingBar or self.initialized.CastingBar then return end
46 self.initialized.CastingBar = true
47  
48 self:removeRegions(_G["CastingBarFrame"], {1, 3, 6}) -- N.B. region 2 is text, 4 & 5 are overlays
49 _G["CastingBarFrame"]:SetHeight(_G["CastingBarFrame"]:GetHeight() + 5)
50 self:moveObject(_G["CastingBarText"], nil, nil, "-", 5)
51 self:moveObject(_G["CastingBarSpark"], nil, nil, "-", 5)
52 self:moveObject(_G["CastingBarFlash"], nil, nil, "-", 5)
53 -- _G["CastingBarFlash"]:SetTexture("Interface\\AddOns\\oSkin\\textures\\glaze")
54 self:applySkin(_G["CastingBarFrame"])
55 self:glazeStatusBar(_G["CastingBarFrame"], 0)
56  
57 end
58  
59 function oSkin:StaticPopups()
60 if not self.db.profile.StaticPopups or self.initialized.StaticPopups then return end
61 self.initialized.StaticPopups = true
62  
63 self:Hook("StaticPopup_Show")
64  
65 for i = 1, STATICPOPUP_NUMDIALOGS do
66 self:applySkin(_G["StaticPopup"..i])
67 -- skin WideEditBox
68 local editBox = _G["StaticPopup"..i.."WideEditBox"]
69 self:removeRegions(editBox, {6, 7}) -- N.B. other regions are scripts
70 editBox:SetHeight(editBox:GetHeight() / 2)
71 local left,right,top,bottom = editBox:GetTextInsets()
72 editBox:SetTextInsets(left + 4, right, top, bottom)
73 self:applySkin(editBox)
74 -- skin EditBox
75 local editBox = _G["StaticPopup"..i.."EditBox"]
76 self:removeRegions(editBox, {6, 7}) -- N.B. other regions are scripts
77 local left,right,top,bottom = editBox:GetTextInsets()
78 editBox:SetTextInsets(left + 4, right, top, bottom)
79 self:applySkin(editBox)
80 end
81  
82 end
83  
84 function oSkin:StaticPopup_Show(which, text_arg1, text_arg2, data)
85 if not self.initialized.StaticPopups then
86 return self.hooks["StaticPopup_Show"].orig(which, text_arg1, text_arg2, data)
87 end
88  
89 local info = StaticPopupDialogs[which]
90 local dialog, width = nil, 320
91 dialog = StaticPopup_FindVisible(which, data)
92  
93 if ( not dialog ) then
94 -- Find a free dialog
95 local index = 1
96 if ( StaticPopupDialogs[which].preferredIndex ) then
97 index = StaticPopupDialogs[which].preferredIndex
98 end
99 for i = index, STATICPOPUP_NUMDIALOGS do
100 local frame = getglobal("StaticPopup"..i)
101 if ( not frame:IsShown() ) then
102 dialog = frame
103 break
104 end
105 end
106  
107 if ( not dialog and StaticPopupDialogs[which].preferredIndex ) then
108 for i = 1, StaticPopupDialogs[which].preferredIndex do
109 local frame = getglobal("StaticPopup"..i)
110 if ( not frame:IsShown() ) then
111 dialog = frame
112 break
113 end
114 end
115 end
116 end
117  
118 if ( (which == "SET_GUILDMOTD")
119 or (which == "SET_GUILDPLAYERNOTE")
120 or (which == "SET_GUILDPLAYERNOTE")
121 or (which == "SET_GUILDOFFICERNOTE" )) then
122 width = 420
123 elseif ( which == "HELP_TICKET" ) then
124 width = 350
125 elseif ( info.showAlert ) then
126 width = 420
127 end
128  
129 dialog.tfade:SetWidth(width-8)
130  
131 return self.hooks["StaticPopup_Show"].orig(which, text_arg1, text_arg2, data)
132  
133 end
134  
135 function oSkin:ReadyCheckFrame()
136 if not self.db.profile.StaticPopups then return end
137  
138 self:keepRegions(_G["ReadyCheckFrame"], {3}) -- N.B. region 3 is text
139 _G["ReadyCheckFrame"]:SetWidth(_G["ReadyCheckFrame"]:GetWidth() * FxMult)
140 _G["ReadyCheckFrame"]:SetHeight(_G["ReadyCheckFrame"]:GetHeight() * FyMult)
141 self:moveObject(_G["ReadyCheckFrameText"], nil, nil, "+", 15)
142 self:moveObject(_G["ReadyCheckFrameYesButton"], "-", 20, nil, nil)
143 self:applySkin(_G["ReadyCheckFrame"])
144  
145 end
146  
147 function oSkin:ChatTabs()
148  
149 if not self.db.profile.ChatTabs or self.initialized.ChatTabs then return end
150 self.initialized.ChatTabs = true
151  
152 for i=1, NUM_CHAT_WINDOWS do
153 self:removeRegions(_G["ChatFrame"..i.."Tab"], {1, 2, 3})
154 self:createTab(_G["ChatFrame"..i.."Tab"])
155 end
156  
157 end
158 function oSkin:ChatFrames()
159  
160 if not self.db.profile.ChatFrames or self.initialized.ChatFrames then return end
161 self.initialized.ChatFrames = true
162  
163 for i=1, NUM_CHAT_WINDOWS do
164 self:createCF(_G["ChatFrame"..i])
165 end
166  
167 end
168  
169 function oSkin:createTab(parent)
170 self:Debug("createTab: [%s]", parent)
171  
172 oct = CreateFrame("frame", nil, parent)
173 oct:SetFrameStrata("BACKGROUND")
174 oct:SetFrameLevel(0)
175 oct:ClearAllPoints()
176 oct:SetPoint("TOPLEFT", parent, "TOPLEFT", 0, -8)
177 oct:SetPoint("TOPRIGHT", parent, "TOPRIGHT", 0, -8)
178 oct:SetPoint("BOTTOMLEFT", parent, "BOTTOMLEFT", 0, -5)
179 oct:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", 0, -5)
180 self:applySkin(oct)
181  
182 end
183  
184 function oSkin:createCF(parent)
185 self:Debug("createCF: [%s]", parent)
186  
187 ocf = CreateFrame("frame", nil, parent)
188 ocf:SetFrameStrata("BACKGROUND")
189 ocf:SetFrameLevel(0)
190 ocf:ClearAllPoints()
191 ocf:SetPoint("TOPLEFT", parent, "TOPLEFT", -4, 4)
192 ocf:SetPoint("TOPRIGHT", parent, "TOPRIGHT", 4, 4)
193 ocf:SetPoint("BOTTOMLEFT", parent, "BOTTOMLEFT", -4, -8)
194 ocf:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", 4, -8)
195 self:applySkin(ocf)
196  
197 end
198  
199 function oSkin:ChatEditBox()
200 if not self.db.profile.ChatEditBox or self.initialized.ChatEditBox then return end
201 self.initialized.ChatEditBox = true
202  
203 self:removeRegions(_G["ChatFrameEditBox"], {6, 7, 8})
204 self:applySkin(_G["ChatFrameEditBox"])
205  
206 end
207  
208 function oSkin:LootFrame()
209 if not self.db.profile.LootFrame or self.initialized.LootFrame then return end
210 self.initialized.LootFrame = true
211  
212 self:removeRegions(_G["LootFrame"], {1, 2})
213  
214 _G["LootFrame"]:SetWidth(_G["LootFrame"]:GetWidth() * 0.66)
215 _G["LootFrame"]:SetHeight(_G["LootFrame"]:GetHeight() * FyMult)
216  
217 for i, v in ipairs({ _G["LootFrame"]:GetRegions() }) do
218 -- region 3 is the title
219 if i == 3 then
220 self:moveObject(v, "+", 15, "-", 10)
221 end
222 end
223  
224 self:moveObject(_G["LootCloseButton"], "+", 65, "+", 10)
225  
226 for i=1, NUM_GROUP_LOOT_FRAMES do
227 if i == 1 then
228 self:moveObject(_G["LootButton"..i], "-", 13, "+", 40)
229 else
230 self:moveObject(_G["LootButton"..i], nil, nil, nil, nil)
231 end
232 end
233 self:moveObject(_G["LootFramePrev"], "-", 15, nil, nil)
234 self:moveObject(_G["LootFrameNext"], "-", 0, nil, nil)
235 self:moveObject(_G["LootFrameUpButton"], "-", 15, nil, nil)
236 self:moveObject(_G["LootFrameDownButton"], "-", 0, nil, nil)
237  
238 self:applySkin(_G["LootFrame"], 1)
239  
240 end
241  
242 function oSkin:GroupLoot()
243 if not self.db.profile.GroupLoot.shown or self.initialized.GroupLoot then return end
244 self.initialized.GroupLoot = true
245  
246 self:hookDDScript(GroupLootDropDownButton)
247 self:Hook("GroupLootFrame_OnShow", function()
248 local texture, name, count, quality, bindOnPickUp = GetLootRollItemInfo(this.rollID)
249 _G["GroupLootFrame"..this:GetID().."IconFrameIcon"]:SetTexture(texture)
250 _G["GroupLootFrame"..this:GetID().."Name"]:SetText(name)
251 local color = ITEM_QUALITY_COLORS[quality]
252 _G["GroupLootFrame"..this:GetID().."Name"]:SetVertexColor(color.r, color.g, color.b)
253 _G["GroupLootFrame"..this:GetID().."Timer"]:SetStatusBarColor(color.r, color.g, color.b)
254 end)
255  
256 self:keepRegions(_G["GroupLootDropDown"], {4}) -- N.B. region 4 is text
257 local f = GameFontNormalSmall:GetFont()
258  
259 for i = 1, NUM_GROUP_LOOT_FRAMES do
260  
261 local glf = "GroupLootFrame"..i
262 self:removeRegions(_G[glf], {4, 5}) -- N.B. regions 1-3 are text
263  
264 if not self.db.profile.GroupLoot.small then
265  
266 _G[glf]:SetWidth(_G[glf]:GetWidth() * 0.95)
267 _G[glf]:SetHeight(_G[glf]:GetHeight() * FyMult)
268  
269 self:moveObject(_G[glf.."SlotTexture"], "-", 3, "+", 5)
270 self:moveObject(_G[glf.."RollButton"], "+", 6, "+", 6)
271  
272 else
273  
274 _G[glf]:SetWidth(_G[glf]:GetWidth() * 0.85)
275 _G[glf]:SetHeight(_G[glf]:GetHeight() * 0.675)
276  
277 local xMult, yMult = 0.75, 0.75
278 _G[glf.."SlotTexture"]:SetWidth(_G[glf.."SlotTexture"]:GetWidth() * xMult)
279 _G[glf.."SlotTexture"]:SetHeight(_G[glf.."SlotTexture"]:GetHeight() * yMult)
280 self:moveObject(_G[glf.."SlotTexture"], "-", 2, "+", 4)
281  
282 -- _G[glf.."NameFrame"]:SetWidth(_G[glf.."NameFrame"]:GetWidth() / xMult) -- ???
283 _G[glf.."NameFrame"]:SetHeight(_G[glf.."NameFrame"]:GetHeight() * yMult)
284 self:moveObject(_G[glf.."NameFrame"], "+", 2, "+", 2)
285  
286 _G[glf.."Name"]:SetFont(f, 7)
287 self:moveObject(_G[glf.."Name"], "+", 2, "+", 2)
288  
289 _G[glf.."RollButton"]:SetWidth(_G[glf.."RollButton"]:GetWidth() * xMult)
290 _G[glf.."RollButton"]:SetHeight(_G[glf.."RollButton"]:GetHeight() * yMult)
291 self:moveObject(_G[glf.."RollButton"], "+", 10, "+", 7)
292  
293 _G[glf.."GreedButton"]:SetWidth(_G[glf.."GreedButton"]:GetWidth() * xMult)
294 _G[glf.."GreedButton"]:SetHeight(_G[glf.."GreedButton"]:GetHeight() * yMult)
295  
296 _G[glf.."PassButton"]:SetWidth(_G[glf.."PassButton"]:GetWidth() * xMult)
297 _G[glf.."PassButton"]:SetHeight(_G[glf.."PassButton"]:GetHeight() * yMult)
298 self:moveObject(_G[glf.."PassButton"], nil, nil, "+", 3)
299  
300 _G[glf.."IconFrame"]:SetWidth(_G[glf.."IconFrame"]:GetWidth() * xMult)
301 _G[glf.."IconFrame"]:SetHeight(_G[glf.."IconFrame"]:GetHeight() * yMult)
302  
303 _G[glf.."IconFrameIcon"]:SetWidth(_G[glf.."IconFrameIcon"]:GetWidth() * 0.8)
304 _G[glf.."IconFrameIcon"]:SetHeight(_G[glf.."IconFrameIcon"]:GetHeight() * 0.8)
305 _G[glf.."IconFrameIcon"]:SetAlpha(1)
306 self:moveObject(_G[glf.."IconFrameIcon"], "-", 5, "+", 5)
307  
308 _G[glf.."Timer"]:SetWidth(_G[glf.."Timer"]:GetWidth() * xMult)
309 self:moveObject(_G[glf.."Timer"], "-", 2, "-", 2)
310  
311 end
312  
313 self:removeRegions(_G[glf.."Timer"], {1})
314 self:glazeStatusBar(_G[glf.."Timer"])
315  
316 self:applySkin(_G[glf])
317 end
318  
319 end
320  
321 function oSkin:containerFrames()
322 if not self.db.profile.ContainerFrames or self.initialized.ContainerFrames then return end
323 self.initialized.ContainerFrames = true
324 self:Hook("ContainerFrame_GenerateFrame")
325  
326 for i = 1, NUM_CONTAINER_FRAMES do
327 self:keepRegions(_G["ContainerFrame"..i], {6}) -- N.B. region 6 is text
328 self:moveObject(_G["ContainerFrame"..i.."Name"], "-", 5, "+", 0)
329 self:applySkin(_G["ContainerFrame"..i], nil, nil, nil, 100)
330 end
331  
332 end
333  
334 function oSkin:ContainerFrame_GenerateFrame(frame, size, id)
335 self.hooks["ContainerFrame_GenerateFrame"].orig(frame, size, id)
336 frame = frame:GetName()
337  
338 if ( id > NUM_BAG_FRAMES ) then
339 _G[frame.."Name"]:SetTextColor(.3, .3, 1)
340 elseif ( id == KEYRING_CONTAINER ) then
341 _G[frame.."Name"]:SetTextColor(1, .7, 0)
342 else
343 _G[frame.."Name"]:SetTextColor(1, 1, 1)
344 end
345 end
346  
347 function oSkin:StackSplit()
348 if not self.db.profile.StackSplit or self.initialized.StackSplit then return end
349 self.initialized.StackSplit = true
350  
351 self:removeRegions(_G["StackSplitFrame"], {1}) -- N.B. region 2 is text
352 _G["StackSplitFrame"]:SetWidth(_G["StackSplitFrame"]:GetWidth() - 12)
353 _G["StackSplitFrame"]:SetHeight(_G["StackSplitFrame"]:GetHeight() - 28)
354 self:moveObject(_G["StackSplitText"], nil, nil, "-", 5)
355 self:moveObject(_G["StackSplitLeftButton"], "+", 5, "-", 5)
356 self:moveObject(_G["StackSplitRightButton"], "-", 5, "-", 5)
357 self:moveObject(_G["StackSplitOkayButton"], nil, nil, "-", 13)
358 self:moveObject(_G["StackSplitCancelButton"], nil, nil, "-", 13)
359  
360 self:applySkin(_G["StackSplitFrame"])
361  
362 end
363  
364 function oSkin:ItemText()
365 if not self.db.profile.ItemText or self.initialized.ItemText then return end
366 self.initialized.ItemText = true
367  
368 self:Hook("ItemTextFrame_OnEvent", function(event)
369 self:Debug("ItemTextFrame_OnEvent: [%s]", event)
370 self.hooks.ItemTextFrame_OnEvent(event)
371 if event == "ITEM_TEXT_BEGIN" then
372 _G["ItemTextPageText"]:SetTextColor(0.7, 0.7, 0)
373 end
374 end)
375  
376 self:removeRegions(_G["ItemTextFrame"], {1, 2, 3, 4, 5, 6, 7, 8, 9}) -- N.B. region 10 & 11 are text
377 _G["ItemTextFrame"]:SetWidth(_G["ItemTextFrame"]:GetWidth() - 30)
378 _G["ItemTextFrame"]:SetHeight(_G["ItemTextFrame"]:GetHeight() - 60)
379 self:moveObject(_G["ItemTextTitleText"], nil, nil, "-", 24)
380  
381 self:removeRegions(_G["ItemTextScrollFrame"])
382 self:moveObject(_G["ItemTextScrollFrame"], "+", 30, "+", 20)
383 self:skinScrollBar(_G["ItemTextScrollFrame"])
384 self:moveObject(_G["ItemTextStatusBar"], nil, nil, "-", 115)
385 self:glazeStatusBar(_G["ItemTextStatusBar"], 0)
386 self:moveObject(_G["ItemTextPrevPageButton"], "-", 45, "+", 10)
387 self:moveObject(_G["ItemTextNextPageButton"], "+", 10, "+", 10)
388 self:moveObject(_G["ItemTextCloseButton"], "+", 28, "+", 8)
389  
390 self:applySkin(_G["ItemTextFrame"])
391  
392 end
393  
394 function oSkin:WorldMap()
395 if not self.db.profile.WorldMap or self.initialized.WorldMap then return end
396 self.initialized.WorldMap = true
397  
398 self:hookDDScript(WorldMapContinentDropDownButton)
399 self:hookDDScript(WorldMapZoneDropDownButton)
400  
401 self:keepRegions(_G["WorldMapFrame"], {14}) -- N.B. region 14 is text
402 self:keepRegions(_G["WorldMapContinentDropDown"], {4}) -- N.B. region 4 is text
403 self:keepRegions(_G["WorldMapZoneDropDown"], {4}) -- N.B. region 4 is text
404  
405  
406 if not IsAddOnLoaded("MetaMap") then
407 self:moveObject(_G["WorldMapFrameCloseButton"], "+", 98, "-", 4)
408 self:applySkin(_G["WorldMapFrame"])
409 end
410  
411 end