vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2 Name: FuBarPlugin-2.0
3 Revision: $Rev: 8997 $
4 Author: Cameron Kenneth Knight (ckknight@gmail.com)
5 Website: http://wiki.wowace.com/index.php/FuBarPlugin-2.0
6 Documentation: http://wiki.wowace.com/index.php/FuBarPlugin-2.0
7 SVN: svn://svn.wowace.com/root/branches/FuBar/FuBarPlugin-2.0/FuBarPlugin-2.0/
8 Description: Plugin for FuBar.
9 Dependencies: AceLibrary, AceOO-2.0, AceEvent-2.0, Tablet-2.0, Dewdrop-2.0
10 ]]
11  
12 local MAJOR_VERSION = "FuBarPlugin-2.0"
13 local MINIMAPCONTAINER_MAJOR_VERSION = "FuBarPlugin-MinimapContainer-2.0"
14 local MINOR_VERSION = "$Revision: 8997 $"
15  
16 -- This ensures the code is only executed if the libary doesn't already exist, or is a newer version
17 if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary.") end
18 if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
19  
20 if not AceLibrary:HasInstance("AceOO-2.0") then error(MAJOR_VERSION .. " requires AceOO-2.0.") end
21  
22 local AceEvent = AceLibrary:HasInstance("AceEvent-2.0") and AceLibrary("AceEvent-2.0")
23 local Tablet = AceLibrary:HasInstance("Tablet-2.0") and AceLibrary("Tablet-2.0")
24 local Dewdrop = AceLibrary:HasInstance("Dewdrop-2.0") and AceLibrary("Dewdrop-2.0")
25  
26 local epsilon = 1e-5
27 local _G = getfenv(0)
28  
29 local FuBarPlugin = AceLibrary("AceOO-2.0").Mixin {
30 "GetTitle",
31 "GetName",
32 "GetCategory",
33 "SetFontSize",
34 "GetFrame",
35 "Show",
36 "Hide",
37 "GetPanel",
38 "IsTextColored",
39 "ToggleTextColored",
40 "IsMinimapAttached",
41 "ToggleMinimapAttached",
42 "Update",
43 "UpdateDisplay",
44 "UpdateData",
45 "UpdateText",
46 "UpdateTooltip",
47 "SetIcon",
48 "GetIcon",
49 "CheckWidth",
50 "SetText",
51 "GetText",
52 "IsIconShown",
53 "ToggleIconShown",
54 "ShowIcon",
55 "HideIcon",
56 "IsTextShown",
57 "ToggleTextShown",
58 "ShowText",
59 "HideText",
60 "IsTooltipDetached",
61 "ToggleTooltipDetached",
62 "DetachTooltip",
63 "ReattachTooltip",
64 "GetDefaultPosition",
65 "SetPanel",
66 "IsLoadOnDemand",
67 "IsDisabled",
68 "CreateBasicPluginFrame",
69 "CreatePluginChildFrame",
70 "OpenMenu",
71 "AddImpliedMenuOptions",
72 }
73  
74 local good = nil
75 local function CheckFuBar()
76 if not good then
77 good = FuBar and tonumber(string.sub(FuBar.version, 1, 3)) and tonumber(string.sub(FuBar.version, 1, 3)) >= 2 and true
78 end
79 return good
80 end
81  
82 function FuBarPlugin:GetTitle()
83 local name = self.title or self.name
84 FuBarPlugin:assert(name, "You must provide self.title or self.name")
85 local _,_,title = string.find(name, "FuBar %- (.+)")
86 if not title then
87 title = name
88 end
89 return (string.gsub(string.gsub(title, "|c%x%x%x%x%x%x%x%x", ""), "|r", ""))
90 end
91  
92 function FuBarPlugin:GetName()
93 return self.name
94 end
95  
96 function FuBarPlugin:GetCategory()
97 return self.category or "Other"
98 end
99  
100 function FuBarPlugin:GetFrame()
101 return self.frame
102 end
103  
104 function FuBarPlugin:GetPanel()
105 return self.panel
106 end
107  
108 function FuBarPlugin:IsTextColored()
109 return not self.db or not self.db.profile or not self.db.profile.uncolored
110 end
111  
112 function FuBarPlugin:ToggleTextColored()
113 FuBarPlugin:assert(self.db, "Cannot change text color if self.db is not available. (" .. self:GetTitle() .. ")")
114 self.db.profile.uncolored = not self.db.profile.uncolored or nil
115 self:UpdateText()
116 end
117  
118 function FuBarPlugin:ToggleMinimapAttached()
119 if CheckFuBar() and not self.cannotAttachToMinimap then
120 local value = self:IsMinimapAttached()
121 if value then
122 self.panel:RemovePlugin(self)
123 FuBar:GetPanel(1):AddPlugin(self, nil, self.defaultPosition)
124 else
125 self.panel:RemovePlugin(self)
126 AceLibrary(MINIMAPCONTAINER_MAJOR_VERSION):AddPlugin(self)
127 end
128 end
129 Dewdrop:Close()
130 end
131  
132 function FuBarPlugin:IsMinimapAttached()
133 if not CheckFuBar() then
134 return true
135 end
136 return self.panel == AceLibrary(MINIMAPCONTAINER_MAJOR_VERSION)
137 end
138  
139 function FuBarPlugin:Update()
140 self:UpdateData()
141 self:UpdateText()
142 self:UpdateTooltip()
143 end
144  
145 function FuBarPlugin:UpdateDisplay()
146 self:UpdateText()
147 self:UpdateTooltip()
148 end
149  
150 function FuBarPlugin:UpdateData()
151 if type(self.OnDataUpdate) == "function" then
152 if not self:IsDisabled() then
153 self:OnDataUpdate()
154 end
155 end
156 end
157  
158 function FuBarPlugin:UpdateText()
159 if type(self.OnTextUpdate) == "function" then
160 if not self:IsDisabled() then
161 self:OnTextUpdate()
162 end
163 elseif self:IsTextShown() then
164 self:SetText(self:GetTitle())
165 end
166 end
167  
168 function FuBarPlugin:RegisterTablet()
169 if not Tablet:IsRegistered(self.frame) then
170 if self.db and self.db.profile and not self.db.profile.detachedTooltip then
171 self.db.profile.detachedTooltip = {}
172 end
173 Tablet:Register(self.frame,
174 'children', function()
175 Tablet:SetTitle(self:GetTitle())
176 if type(self.OnTooltipUpdate) == "function" then
177 if not self:IsDisabled() then
178 self:OnTooltipUpdate()
179 end
180 end
181 end,
182 'clickable', self.clickableTooltip,
183 'data', CheckFuBar() and FuBar.db.profile.tooltip or self.db and self.db.profile.detachedTooltip or {},
184 'detachedData', self.db and self.db.profile.detachedTooltip or {},
185 'point', function(frame)
186 if frame:GetTop() > GetScreenHeight() / 2 then
187 local x = frame:GetCenter()
188 if x < GetScreenWidth() / 3 then
189 return "TOPLEFT", "BOTTOMLEFT"
190 elseif x < GetScreenWidth() * 2 / 3 then
191 return "TOP", "BOTTOM"
192 else
193 return "TOPRIGHT", "BOTTOMRIGHT"
194 end
195 else
196 local x = frame:GetCenter()
197 if x < GetScreenWidth() / 3 then
198 return "BOTTOMLEFT", "TOPLEFT"
199 elseif x < GetScreenWidth() * 2 / 3 then
200 return "BOTTOM", "TOP"
201 else
202 return "BOTTOMRIGHT", "TOPRIGHT"
203 end
204 end
205 end,
206 'menu', self.OnMenuRequest and function(level, value, valueN_1, valueN_2, valueN_3, valueN_4)
207 if level == 1 then
208 local name = tostring(self)
209 if not string.find(name, '^table:') then
210 name = string.gsub(name, "|c%x%x%x%x%x%x%x%x(.-)|r", "%1")
211 Dewdrop:AddLine(
212 'text', name,
213 'isTitle', true
214 )
215 end
216 end
217 if type(self.OnMenuRequest) == "function" then
218 self:OnMenuRequest(level, value, true, valueN_1, valueN_2, valueN_3, valueN_4)
219 elseif type(self.OnMenuRequest) == "table" then
220 Dewdrop:FeedAceOptionsTable(self.OnMenuRequest)
221 end
222 end,
223 'hideWhenEmpty', self.tooltipHiddenWhenEmpty
224 )
225 end
226 end
227  
228 function FuBarPlugin:UpdateTooltip()
229 FuBarPlugin.RegisterTablet(self)
230 if self:IsMinimapAttached() and not self:IsTooltipDetached() then
231 Tablet:Refresh(self.minimapFrame)
232 else
233 Tablet:Refresh(self.frame)
234 end
235 end
236  
237 function FuBarPlugin:OnProfileEnable()
238 self:Update()
239 end
240  
241 function FuBarPlugin:Show(panelId)
242 if self.frame:IsShown() or (self.minimapFrame and self.minimapFrame:IsShown()) then
243 return
244 end
245 if panelId ~= false then
246 if self.db then
247 self.db.profile.hidden = nil
248 end
249 end
250 if self.IsActive and not self:IsActive() then
251 self.panelIdTmp = panelId
252 self:ToggleActive()
253 self.panelIdTmp = nil
254 if self.db then
255 self.db.profile.disabled = nil
256 end
257 elseif not self.db or not self.db.profile.hidden then
258 if panelId == 0 or not CheckFuBar() then
259 AceLibrary(MINIMAPCONTAINER_MAJOR_VERSION):AddPlugin(self)
260 else
261 FuBar:ShowPlugin(self, panelId or self.panelIdTmp)
262 end
263 if not self:IsTextShown() then
264 self.textFrame:SetText("")
265 self.textFrame:SetWidth(epsilon)
266 self.textFrame:Hide()
267 end
268 if not self:IsIconShown() then
269 self.iconFrame:SetWidth(epsilon)
270 self.iconFrame:Hide()
271 end
272 self:Update()
273 end
274 end
275  
276 function FuBarPlugin:Hide()
277 if not self.frame:IsShown() and (not self.minimapFrame or not self.minimapFrame:IsShown()) then
278 return
279 end
280 if self.hideWithoutStandby then
281 if self.db then
282 self.db.profile.hidden = true
283 end
284 end
285 if not self.hideWithoutStandby then
286 if self.db and not self.overrideTooltip and not self.cannotDetachTooltip and self:IsTooltipDetached() and self.db.profile.detachedTooltip and self.db.profile.detachedTooltip.detached then
287 self:ReattachTooltip()
288 self.db.profile.detachedTooltip.detached = true
289 end
290 if self.IsActive and self:IsActive() and self.ToggleActive and (not CheckFuBar() or not FuBar:IsChangingProfile()) then
291 self:ToggleActive()
292 end
293 end
294 if self.panel then
295 self.panel:RemovePlugin(self)
296 end
297 self.frame:Hide()
298 if self.minimapFrame then
299 self.minimapFrame:Hide()
300 end
301  
302 if Dewdrop:IsOpen(self.frame) or (self.minimapFrame and Dewdrop:IsOpen(self.minimapFrame)) then
303 Dewdrop:Close()
304 end
305 end
306  
307 function FuBarPlugin:SetIcon(path)
308 if not path then
309 return
310 end
311 FuBarPlugin:argCheck(path, 2, "string", "boolean")
312 FuBarPlugin:assert(self.hasIcon, "Cannot set icon unless self.hasIcon is set. (" .. self:GetTitle() .. ")")
313 if not self.iconFrame then
314 return
315 end
316 if type(path) ~= "string" then
317 path = format("Interface\\AddOns\\%s\\icon", self.folderName)
318 elseif not string.find(path, '^Interface[\\/]') then
319 path = format("Interface\\AddOns\\%s\\%s", self.folderName, path)
320 end
321 if string.sub(path, 1, 16) == "Interface\\Icons\\" then
322 self.iconFrame:SetTexCoord(0.05, 0.95, 0.05, 0.95)
323 else
324 self.iconFrame:SetTexCoord(0, 1, 0, 1)
325 end
326 self.iconFrame:SetTexture(path)
327 if self.minimapIcon then
328 if string.sub(path, 1, 16) == "Interface\\Icons\\" then
329 self.minimapIcon:SetTexCoord(0.05, 0.95, 0.05, 0.95)
330 else
331 self.minimapIcon:SetTexCoord(0, 1, 0, 1)
332 end
333 self.minimapIcon:SetTexture(path)
334 end
335 end
336  
337 function FuBarPlugin:GetIcon()
338 if self.hasIcon then
339 return self.iconFrame:GetTexture()
340 end
341 end
342  
343 function FuBarPlugin:CheckWidth(force)
344 FuBarPlugin:argCheck(force, 2, "boolean", "nil")
345 if (self.iconFrame and self.iconFrame:IsShown()) or (self.textFrame and self.textFrame:IsShown()) then
346 if (self.db and self.db.profile and not self:IsIconShown()) or not self.hasIcon then
347 self.iconFrame:SetWidth(epsilon)
348 end
349 local width
350 if not self.hasNoText then
351 self.textFrame:SetHeight(0)
352 self.textFrame:SetWidth(500)
353 width = self.textFrame:GetStringWidth() + 1
354 self.textFrame:SetWidth(width)
355 self.textFrame:SetHeight(self.textFrame:GetHeight())
356 end
357 if self.hasNoText or not self.textFrame:IsShown() then
358 self.frame:SetWidth(self.iconFrame:GetWidth())
359 if self.panel and self.panel:GetPluginSide(self) == "CENTER" then
360 self.panel:UpdateCenteredPosition()
361 end
362 elseif force or not self.textWidth or self.textWidth < width or self.textWidth - 8 > width then
363 self.textWidth = width
364 self.textFrame:SetWidth(width)
365 if self.iconFrame and self.iconFrame:IsShown() then
366 self.frame:SetWidth(width + self.iconFrame:GetWidth())
367 else
368 self.frame:SetWidth(width)
369 end
370 if self.panel and self.panel:GetPluginSide(self) == "CENTER" then
371 self.panel:UpdateCenteredPosition()
372 end
373 end
374 end
375 end
376  
377 function FuBarPlugin:SetText(text)
378 if not self.textFrame then
379 return
380 end
381 FuBarPlugin:assert(not self.hasNoText, "Cannot set text if self.hasNoText has been set. (" .. self:GetTitle() .. ")")
382 FuBarPlugin:argCheck(text, 2, "string", "number")
383 if text == "" then
384 if self.hasIcon then
385 self:ShowIcon()
386 else
387 text = self:GetTitle()
388 end
389 end
390 if not self:IsTextColored() then
391 text = string.gsub(text, "|c%x%x%x%x%x%x%x%x(.-)|r", "%1")
392 end
393 self.textFrame:SetText(text)
394 self:CheckWidth()
395 end
396  
397 function FuBarPlugin:GetText()
398 FuBarPlugin:assert(self.textFrame, "Cannot get text without a self.textFrame (" .. self:GetTitle() .. ")")
399 if not self.hasNoText then
400 return self.textFrame:GetText() or ""
401 end
402 end
403  
404 function FuBarPlugin:IsIconShown()
405 if not self.hasIcon then
406 return false
407 elseif self.hasNoText then
408 return true
409 elseif not self.db then
410 return true
411 elseif self.db.profile.showIcon == nil then
412 return true
413 else
414 return (self.db.profile.showIcon == 1 or self.db.profile.showIcon == true) and true or false
415 end
416 end
417  
418 function FuBarPlugin:ToggleIconShown()
419 FuBarPlugin:assert(self.iconFrame, "Cannot toggle icon without a self.iconFrame (" .. self:GetTitle() .. ")")
420 FuBarPlugin:assert(self.hasIcon, "Cannot show icon unless self.hasIcon is set. (" .. self:GetTitle() .. ")")
421 FuBarPlugin:assert(not self.hasNoText, "Cannot hide icon if self.hasNoText is set. (" .. self:GetTitle() .. ")")
422 FuBarPlugin:assert(self.textFrame, "Cannot hide icon if self.textFrame is not set. (" .. self:GetTitle() .. ")")
423 FuBarPlugin:assert(self.iconFrame, "Cannot hide icon if self.iconFrame is not set. (" .. self:GetTitle() .. ")")
424 FuBarPlugin:assert(self.db, "Cannot hide icon if self.db is not available. (" .. self:GetTitle() .. ")")
425 local value = not self:IsIconShown()
426 self.db.profile.showIcon = value
427 if value then
428 if not self:IsTextShown() and self.textFrame:IsShown() and self.textFrame:GetText() == self:GetTitle() then
429 self.textFrame:Hide()
430 self.textFrame:SetText("")
431 end
432 self.iconFrame:Show()
433 self.iconFrame:SetWidth(self.iconFrame:GetHeight())
434 else
435 if not self.textFrame:IsShown() or not self.textFrame:GetText() then
436 self.textFrame:Show()
437 self.textFrame:SetText(self:GetTitle())
438 end
439 self.iconFrame:Hide()
440 self.iconFrame:SetWidth(epsilon)
441 end
442 self:CheckWidth(true)
443 return value
444 end
445  
446 function FuBarPlugin:ShowIcon()
447 if not self:IsIconShown() then
448 self:ToggleIconShown()
449 end
450 end
451  
452 function FuBarPlugin:HideIcon()
453 if self:IsIconShown() then
454 self:ToggleIconShown()
455 end
456 end
457  
458 function FuBarPlugin:IsTextShown()
459 if self.hasNoText then
460 return false
461 elseif not self.hasIcon then
462 return true
463 elseif not self.db then
464 return true
465 elseif self.db.profile.showText == nil then
466 return true
467 else
468 return (self.db.profile.showText == 1 or self.db.profile.showText == true) and true or false
469 end
470 end
471  
472 function FuBarPlugin:ToggleTextShown()
473 FuBarPlugin:assert(not self.cannotHideText, "Cannot hide text unless self.cannotHideText is unset. (" .. self:GetTitle() .. ")")
474 FuBarPlugin:assert(self.hasIcon, "Cannot show text unless self.hasIcon is set. (" .. self:GetTitle() .. ")")
475 FuBarPlugin:assert(not self.hasNoText, "Cannot hide text if self.hasNoText is set. (" .. self:GetTitle() .. ")")
476 FuBarPlugin:assert(self.textFrame, "Cannot hide text if self.textFrame is not set. (" .. self:GetTitle() .. ")")
477 FuBarPlugin:assert(self.iconFrame, "Cannot hide text if self.iconFrame is not set. (" .. self:GetTitle() .. ")")
478 FuBarPlugin:assert(self.db, "Cannot hide text if self.db is not available. (" .. self:GetTitle() .. ")")
479 local value = not self:IsTextShown()
480 self.db.profile.showText = value
481 if value then
482 self.textFrame:Show()
483 self:UpdateText()
484 else
485 self.textFrame:SetText("")
486 self.textFrame:SetWidth(epsilon)
487 self.textFrame:Hide()
488 if not self:IsIconShown() then
489 DropDownList1:Hide()
490 end
491 self:ShowIcon()
492 end
493 self:CheckWidth(true)
494 return value
495 end
496  
497 function FuBarPlugin:ShowText()
498 if not self:IsTextShown() then
499 self:ToggleTextShown()
500 end
501 end
502  
503 function FuBarPlugin:HideText()
504 if self:IsTextShown() then
505 self:ToggleTextShown()
506 end
507 end
508  
509 function FuBarPlugin:IsTooltipDetached()
510 if not Tablet.registry[self.frame] then
511 self:UpdateTooltip()
512 end
513 return not Tablet:IsAttached(self.frame)
514 end
515  
516 function FuBarPlugin:ToggleTooltipDetached()
517 if not Tablet.registry[self.frame] then
518 self:UpdateTooltip()
519 end
520 if self:IsTooltipDetached() then
521 Tablet:Attach(self.frame)
522 else
523 Tablet:Detach(self.frame)
524 end
525 end
526  
527 function FuBarPlugin:DetachTooltip()
528 if not Tablet.registry[self.frame] then
529 self:UpdateTooltip()
530 end
531 Tablet:Detach(self.frame)
532 end
533  
534 function FuBarPlugin:ReattachTooltip()
535 if not Tablet.registry[self.frame] then
536 self:UpdateTooltip()
537 end
538 Tablet:Attach(self.frame)
539 end
540  
541 function FuBarPlugin:GetDefaultPosition()
542 return self.defaultPosition or "LEFT"
543 end
544  
545 local function IsCorrectPanel(panel)
546 if type(panel) ~= "table" then
547 return false
548 elseif type(panel.AddPlugin) ~= "function" then
549 return false
550 elseif type(panel.RemovePlugin) ~= "function" then
551 return false
552 elseif type(panel.GetNumPlugins) ~= "function" then
553 return false
554 elseif type(panel:GetNumPlugins()) ~= "number" then
555 return false
556 elseif type(panel.GetPlugin) ~= "function" then
557 return false
558 elseif type(panel.HasPlugin) ~= "function" then
559 return false
560 elseif type(panel.GetPluginSide) ~= "function" then
561 return false
562 end
563 return true
564 end
565  
566 function FuBarPlugin:SetPanel(panel)
567 if panel then
568 FuBarPlugin:assert(IsCorrectPanel(panel), "Bad argument #2 to `SetPanel'. Panel does not have the correct API.")
569 end
570 self.panel = panel
571 end
572  
573 function FuBarPlugin:SetFontSize(size)
574 FuBarPlugin:assert(not self.userDefinedFrame, "You must provide a SetFontSize(size) method if you provide your own frame.")
575 if self.hasIcon then
576 FuBarPlugin:assert(self.iconFrame, (self.name and self.name .. ": " or "") .. "No iconFrame found")
577 self.iconFrame:SetWidth(size + 3)
578 self.iconFrame:SetHeight(size + 3)
579 end
580 if not self.hasNoText then
581 FuBarPlugin:assert(self.textFrame, (self.name and self.name .. ": " or "") .. "No textFrame found")
582 local font, _, flags = self.textFrame:GetFont()
583 self.textFrame:SetFont(font, size, flags)
584 end
585 self:CheckWidth()
586 end
587  
588 function FuBarPlugin:IsLoadOnDemand()
589 return IsAddOnLoadOnDemand(self.folderName)
590 end
591  
592 function FuBarPlugin:IsDisabled()
593 return self.IsActive and not self:IsActive() or false
594 end
595  
596 function FuBarPlugin:OnInstanceInit(target)
597 if not AceEvent then
598 self:error(MAJOR_VERSION .. " requires AceEvent-2.0.")
599 elseif not Tablet then
600 self:error(MAJOR_VERSION .. " requires Tablet-2.0.")
601 elseif not Dewdrop then
602 self:error(MAJOR_VERSION .. " requires Dewdrop-2.0.")
603 end
604 self.registry[target] = true
605  
606 local _,_,folderName = string.find(debugstack(6, 1, 0), "\\AddOns\\(.*)\\")
607 target.folderName = folderName
608 self.folderNames[target] = folderName
609 end
610  
611 function FuBarPlugin:CreateBasicPluginFrame(name)
612 local frame = CreateFrame("Button", name, UIParent)
613 frame:SetFrameStrata("HIGH")
614 frame:EnableMouse(true)
615 frame:EnableMouseWheel(true)
616 frame:SetMovable(true)
617 frame:SetWidth(150)
618 frame:SetHeight(24)
619 frame:SetPoint("CENTER", UIParent, "CENTER")
620  
621 frame:SetScript("OnClick", function()
622 if type(self.OnClick) == "function" then
623 self:OnClick(arg1)
624 end
625 end)
626 frame:SetScript("OnDoubleClick", function()
627 if type(self.OnDoubleClick) == "function" then
628 self:OnDoubleClick(arg1)
629 end
630 end)
631 frame:SetScript("OnMouseDown", function()
632 if arg1 == "RightButton" and not IsShiftKeyDown() and not IsControlKeyDown() and not IsAltKeyDown() then
633 self:OpenMenu()
634 return
635 else
636 HideDropDownMenu(1)
637 if type(self.OnMouseDown) == "function" then
638 self:OnMouseDown(arg1)
639 end
640 end
641 end)
642 frame:SetScript("OnMouseUp", function()
643 if type(self.OnMouseUp) == "function" then
644 self:OnMouseUp(arg1)
645 end
646 end)
647 frame:SetScript("OnReceiveDrag", function()
648 if type(self.OnReceiveDrag) == "function" then
649 self:OnReceiveDrag()
650 end
651 end)
652 return frame
653 end
654  
655 function FuBarPlugin:CreatePluginChildFrame(frameType, name, parent)
656 FuBarPlugin:assert(self.frame, "You must have self.frame declared in order to add child frames")
657 FuBarPlugin:argCheck(frameType, 1, "string")
658 local child = CreateFrame(frameType, name, parent)
659 if parent then
660 child:SetFrameLevel(parent:GetFrameLevel() + 2)
661 end
662 child:SetScript("OnEnter", function()
663 if self.frame:GetScript("OnEnter") then
664 self.frame:GetScript("OnEnter")()
665 end
666 end)
667 child:SetScript("OnLeave", function()
668 if self.frame:GetScript("OnLeave") then
669 self.frame:GetScript("OnLeave")()
670 end
671 end)
672 if child:HasScript("OnClick") then
673 child:SetScript("OnClick", function()
674 if self.frame:HasScript("OnClick") and self.frame:GetScript("OnClick") then
675 self.frame:GetScript("OnClick")()
676 end
677 end)
678 end
679 if child:HasScript("OnDoubleClick") then
680 child:SetScript("OnDoubleClick", function()
681 if self.frame:HasScript("OnDoubleClick") and self.frame:GetScript("OnDoubleClick") then
682 self.frame:GetScript("OnDoubleClick")()
683 end
684 end)
685 end
686 child:SetScript("OnMouseDown", function()
687 if self.frame:GetScript("OnMouseDown") then
688 self.frame:GetScript("OnMouseDown")()
689 end
690 end)
691 child:SetScript("OnMouseUp", function()
692 if self.frame:GetScript("OnMouseUp") then
693 self.frame:GetScript("OnMouseUp")()
694 end
695 end)
696 child:SetScript("OnReceiveDrag", function()
697 if self.frame:GetScript("OnReceiveDrag") then
698 self.frame:GetScript("OnReceiveDrag")()
699 end
700 end)
701 return child
702 end
703  
704 function FuBarPlugin:OpenMenu(frame)
705 if not frame then
706 frame = self:GetFrame()
707 end
708 if not frame or not self:GetFrame() or Dewdrop:IsOpen(frame) then
709 Dewdrop:Close()
710 return
711 end
712 Tablet:Close()
713  
714 if not Dewdrop:IsRegistered(self:GetFrame()) then
715 if type(self.OnMenuRequest) == "table" and (not self.OnMenuRequest.handler or self.OnMenuRequest.handler == self) and self.OnMenuRequest.type == "group" then
716 Dewdrop:InjectAceOptionsTable(self, self.OnMenuRequest)
717 if self.OnMenuRequest.args and CheckFuBar() and not self.independentProfile then
718 self.OnMenuRequest.args.profile = nil
719 end
720 end
721 Dewdrop:Register(self:GetFrame(),
722 'children', type(self.OnMenuRequest) == "table" and self.OnMenuRequest or function(level, value, valueN_1, valueN_2, valueN_3, valueN_4)
723 if level == 1 then
724 Dewdrop:AddLine(
725 'text', self:GetTitle(),
726 'isTitle', true
727 )
728 end
729  
730 if level == 1 then
731 if self.OnMenuRequest then
732 self:OnMenuRequest(level, value, false, valueN_1, valueN_2, valueN_3, valueN_4)
733 end
734  
735 if not self.overrideMenu then
736 if self.MenuSettings then
737 Dewdrop:AddLine()
738 end
739 self:AddImpliedMenuOptions()
740 end
741 else
742 if not self.overrideMenu and self:AddImpliedMenuOptions() then
743 else
744 if self.OnMenuRequest then
745 self:OnMenuRequest(level, value, false, valueN_1, valueN_2, valueN_3, valueN_4)
746 end
747 end
748 end
749 if level == 1 then
750 Dewdrop:AddLine(
751 'text', CLOSE,
752 'func', Dewdrop.Close,
753 'arg1', Dewdrop
754 )
755 end
756 end,
757 'point', function(frame)
758 local x, y = frame:GetCenter()
759 local leftRight
760 if x < GetScreenWidth() / 2 then
761 leftRight = "LEFT"
762 else
763 leftRight = "RIGHT"
764 end
765 if y < GetScreenHeight() / 2 then
766 return "BOTTOM" .. leftRight, "TOP" .. leftRight
767 else
768 return "TOP" .. leftRight, "BOTTOM" .. leftRight
769 end
770 end,
771 'dontHook', true
772 )
773 end
774 if frame == self:GetFrame() then
775 Dewdrop:Open(self:GetFrame())
776 else
777 Dewdrop:Open(frame, self:GetFrame())
778 end
779 end
780  
781 local impliedMenuOptions
782 function FuBarPlugin:AddImpliedMenuOptions(level)
783 FuBarPlugin:argCheck(level, 2, "number", "nil")
784 if not impliedMenuOptions then
785 impliedMenuOptions = {}
786 end
787 if not impliedMenuOptions[self] then
788 impliedMenuOptions[self] = { type = 'group', args = {} }
789 Dewdrop:InjectAceOptionsTable(self, impliedMenuOptions[self])
790 if impliedMenuOptions[self].args and CheckFuBar() and not self.independentProfile then
791 impliedMenuOptions[self].args.profile = nil
792 end
793 end
794 return Dewdrop:FeedAceOptionsTable(impliedMenuOptions[self], level and level - 1)
795 end
796  
797 function FuBarPlugin.OnEmbedInitialize(FuBarPlugin, self)
798 if not self.frame then
799 local name = "FuBarPlugin" .. self:GetTitle() .. "Frame"
800 local frame = _G[name]
801 if not frame or not _G[self.frame:GetName() .. "Text"] or not _G[self.frame:GetName() .. "Icon"] then
802 frame = self:CreateBasicPluginFrame(name)
803  
804 local icon = frame:CreateTexture(name .. "Icon", "ARTWORK")
805 icon:SetWidth(16)
806 icon:SetHeight(16)
807 icon:SetPoint("LEFT", frame, "LEFT")
808  
809 local text = frame:CreateFontString(name .. "Text", "ARTWORK")
810 text:SetWidth(134)
811 text:SetHeight(24)
812 text:SetPoint("LEFT", icon, "RIGHT", 0, 1)
813 text:SetFontObject(GameFontNormal)
814 end
815 self.frame = frame
816 self.textFrame = _G[self.frame:GetName() .. "Text"]
817 self.iconFrame = _G[self.frame:GetName() .. "Icon"]
818 else
819 self.userDefinedFrame = true
820 end
821  
822 self.frame.plugin = self
823 self.frame:SetParent(UIParent)
824 self.frame:SetPoint("RIGHT", UIParent, "LEFT", -5, 0)
825 self.frame:Hide()
826  
827 if self.hasIcon then
828 self:SetIcon(self.hasIcon)
829 end
830  
831 if CheckFuBar() then
832 FuBar:RegisterPlugin(self)
833 end
834 end
835  
836 local CheckShow = function(self, panelId)
837 if not self.frame:IsShown() and (not self.minimapFrame or not self.minimapFrame:IsShown()) then
838 self:Show(panelId)
839 Dewdrop:Refresh(2)
840 end
841 end
842  
843 local recheckPlugins
844 function FuBarPlugin.OnEmbedEnable(FuBarPlugin, self)
845 if self:IsIconShown() then
846 self.iconFrame:Show()
847 else
848 self.iconFrame:Hide()
849 end
850 self:CheckWidth(true)
851  
852 if not self.hideWithoutStandby or not self.db.profile.hidden then
853 if FuBarPlugin.enabledPlugins[self] then
854 CheckShow(self, self.panelIdTmp)
855 else
856 FuBarPlugin:ScheduleEvent(CheckShow, 0, self, self.panelIdTmp)
857 end
858 end
859 FuBarPlugin.enabledPlugins[self] = true
860  
861 if not self.overrideTooltip and not self.cannotDetachTooltip and self.db and self.db.profile.detachedTooltip and self.db.profile.detachedTooltip.detached then
862 FuBarPlugin:ScheduleEvent(self.DetachTooltip, 0, self)
863 end
864  
865 if self:IsLoadOnDemand() and CheckFuBar() then
866 if not FuBar.db.profile.loadOnDemand then
867 FuBar.db.profile.loadOnDemand = {}
868 end
869 if not FuBar.db.profile.loadOnDemand[self.folderName] then
870 FuBar.db.profile.loadOnDemand[self.folderName] = {}
871 end
872 FuBar.db.profile.loadOnDemand[self.folderName].disabled = nil
873 end
874  
875 if CheckFuBar() and AceLibrary:HasInstance("AceConsole-2.0") then
876 if not recheckPlugins then
877 local AceConsole = AceLibrary("AceConsole-2.0")
878 local AceOO = AceLibrary("AceOO-2.0")
879 function recheckPlugins()
880 for k,v in pairs(AceConsole.registry) do
881 if type(v) == "table" and v.args and AceOO.inherits(v.handler, FuBarPlugin) and not v.independentProfile then
882 v.args.profile = nil
883 end
884 end
885 end
886 end
887 FuBarPlugin:ScheduleEvent(recheckPlugins, 0)
888 end
889 end
890  
891 function FuBarPlugin.OnEmbedDisable(FuBarPlugin, self)
892 self:Hide()
893  
894 if self:IsLoadOnDemand() and CheckFuBar() then
895 if not FuBar.db.profile.loadOnDemand then
896 FuBar.db.profile.loadOnDemand = {}
897 end
898 if not FuBar.db.profile.loadOnDemand[self.folderName] then
899 FuBar.db.profile.loadOnDemand[self.folderName] = {}
900 end
901 FuBar.db.profile.loadOnDemand[self.folderName].disabled = true
902 end
903 end
904  
905 function FuBarPlugin.OnEmbedProfileEnable(FuBarPlugin, self)
906 self:Update()
907 if self.db and self.db.profile then
908 if not self.db.profile.detachedTooltip then
909 self.db.profile.detachedTooltip = {}
910 end
911 if Tablet.registry[self.frame] then
912 Tablet:UpdateDetachedData(self.frame, self.db.profile.detachedTooltip)
913 else
914 self:UpdateTooltip()
915 end
916 end
917 end
918  
919 function FuBarPlugin.GetAceOptionsDataTable(FuBarPlugin, self)
920 return {
921 icon = {
922 type = "toggle",
923 name = "Show icon",
924 desc = "Show icon",
925 set = "ToggleIconShown",
926 get = "IsIconShown",
927 hidden = function()
928 return not self.hasIcon or self.hasNoText or self:IsMinimapAttached() or not self.db
929 end,
930 order = -13.7,
931 handler = self,
932 },
933 text = {
934 type = "toggle",
935 name = "Show text",
936 desc = "Show text",
937 set = "ToggleTextShown",
938 get = "IsTextShown",
939 hidden = function()
940 return self.cannotHideText or not self.hasIcon or self.hasNoText or self:IsMinimapAttached() or not self.db
941 end,
942 order = -13.6,
943 handler = self,
944 },
945 colorText = {
946 type = "toggle",
947 name = "Show colored text",
948 desc = "Show colored text",
949 set = "ToggleTextColored",
950 get = "IsTextColored",
951 hidden = function()
952 return self.userDefinedFrame or self.hasNoText or self.hasNoColor or self:IsMinimapAttached() or not self.db
953 end,
954 order = -13.5,
955 handler = self,
956 },
957 detachTooltip = {
958 type = "toggle",
959 name = "Detach tooltip",
960 desc = "Detach tooltip",
961 get = "IsTooltipDetached",
962 set = "ToggleTooltipDetached",
963 hidden = function()
964 return self.overrideTooltip or self.cannotDetachTooltip
965 end,
966 order = -13.4,
967 handler = self,
968 },
969 lockTooltip = {
970 type = "toggle",
971 name = "Lock tooltip",
972 desc = "Lock tooltip",
973 get = function()
974 return Tablet:IsLocked(self.frame)
975 end,
976 set = function()
977 return Tablet:ToggleLocked(self.frame)
978 end,
979 disabled = function()
980 return not self:IsTooltipDetached()
981 end,
982 hidden = function()
983 return self.overrideTooltip or self.cannotDetachTooltip
984 end,
985 order = -13.3,
986 handler = self,
987 },
988 position = {
989 type = "text",
990 name = "Position",
991 desc = "Position",
992 validate = {
993 LEFT = "Left",
994 CENTER = "Center",
995 RIGHT = "Right"
996 },
997 get = function()
998 return self.panel:GetPluginSide(self)
999 end,
1000 set = function(value)
1001 self.panel:SetPluginSide(self, value)
1002 end,
1003 hidden = function()
1004 return self:IsMinimapAttached() or self:IsDisabled() or not self.panel
1005 end,
1006 order = -13.2,
1007 handler = self,
1008 },
1009 minimapAttach = {
1010 type = "toggle",
1011 name = "Attach to minimap",
1012 desc = "Attach to minimap",
1013 get = "IsMinimapAttached",
1014 set = "ToggleMinimapAttached",
1015 hidden = function()
1016 return (self.cannotAttachToMinimap and not self:IsMinimapAttached()) or not CheckFuBar() or self:IsDisabled()
1017 end,
1018 order = -13.1,
1019 handler = self,
1020 },
1021 hide = {
1022 type = "toggle",
1023 name = "Hidden",
1024 desc = "Hidden",
1025 get = function()
1026 return not self.frame:IsShown() and (not self.minimapFrame or not self.minimapFrame:IsShown())
1027 end,
1028 set = function()
1029 if not self.frame:IsShown() and (not self.minimapFrame or not self.minimapFrame:IsShown()) then
1030 self:Show()
1031 else
1032 self:Hide()
1033 end
1034 end,
1035 hidden = function()
1036 return not self.hideWithoutStandby or self:IsDisabled()
1037 end,
1038 order = -13,
1039 handler = self,
1040 },
1041 }
1042 end
1043  
1044 local function activate(self, oldLib, oldDeactivate)
1045 FuBarPlugin = self
1046  
1047 if oldLib then
1048 self.registry = oldLib.registry
1049 self.folderNames = oldLib.folderNames
1050 self.enabledPlugins = oldLib.enabledPlugins
1051 end
1052  
1053 if not self.registry then
1054 self.registry = {}
1055 end
1056 if not self.folderNames then
1057 self.folderNames = {}
1058 end
1059 if not self.enabledPlugins then
1060 self.enabledPlugins = {}
1061 end
1062  
1063 FuBarPlugin.activate(self, oldLib, oldDeactivate)
1064  
1065 if oldDeactivate then
1066 oldDeactivate(oldLib)
1067 end
1068 end
1069  
1070 local function external(self, major, instance)
1071 if major == "AceEvent-2.0" then
1072 AceEvent = instance
1073  
1074 AceEvent:embed(self)
1075 elseif major == "Tablet-2.0" then
1076 Tablet = instance
1077 elseif major == "Dewdrop-2.0" then
1078 Dewdrop = instance
1079 end
1080 end
1081  
1082 AceLibrary:Register(FuBarPlugin, MAJOR_VERSION, MINOR_VERSION, activate, nil, external)
1083  
1084 local MinimapContainer = {}
1085  
1086 function MinimapContainer:AddPlugin(plugin)
1087 if CheckFuBar() and FuBar:IsChangingProfile() then
1088 return
1089 end
1090 if plugin.panel ~= nil then
1091 plugin.panel:RemovePlugin(plugin)
1092 end
1093 plugin.panel = self
1094 if not plugin.minimapFrame then
1095 local frame = CreateFrame("Button", plugin.frame:GetName() .. "MinimapButton", Minimap)
1096 plugin.minimapFrame = frame
1097 AceLibrary(MAJOR_VERSION).RegisterTablet(plugin)
1098 Tablet:Register(frame, plugin.frame)
1099 frame.plugin = plugin
1100 frame:SetWidth(31)
1101 frame:SetHeight(31)
1102 frame:SetFrameStrata("BACKGROUND")
1103 frame:SetFrameLevel(4)
1104 frame:SetHighlightTexture("Interface\\Minimap\\UI-Minimap-ZoomButton-Highlight")
1105 local icon = frame:CreateTexture(frame:GetName() .. "Icon", "BACKGROUND")
1106 plugin.minimapIcon = icon
1107 local path = plugin:GetIcon() or (plugin.iconFrame and plugin.iconFrame:GetTexture()) or "Interface\\Icons\\INV_Misc_QuestionMark"
1108 icon:SetTexture(path)
1109 if string.sub(path, 1, 16) == "Interface\\Icons\\" then
1110 icon:SetTexCoord(0.05, 0.95, 0.05, 0.95)
1111 else
1112 icon:SetTexCoord(0, 1, 0, 1)
1113 end
1114 icon:SetWidth(20)
1115 icon:SetHeight(20)
1116 icon:SetPoint("TOPLEFT", frame, "TOPLEFT", 7, -5)
1117 local overlay = frame:CreateTexture(frame:GetName() .. "Overlay","OVERLAY")
1118 overlay:SetTexture("Interface\\Minimap\\MiniMap-TrackingBorder")
1119 overlay:SetWidth(53)
1120 overlay:SetHeight(53)
1121 overlay:SetPoint("TOPLEFT",frame,"TOPLEFT")
1122 frame:EnableMouse(true)
1123 frame:RegisterForClicks("LeftButtonUp")
1124 frame.plugin = plugin
1125 frame:SetScript("OnClick", function()
1126 if type(plugin.OnClick) == "function" then
1127 if not this.dragged then
1128 plugin:OnClick(arg1)
1129 end
1130 end
1131 end)
1132 frame:SetScript("OnDoubleClick", function()
1133 if type(plugin.OnDoubleClick) == "function" then
1134 plugin:OnDoubleClick(arg1)
1135 end
1136 end)
1137 frame:SetScript("OnReceiveDrag", function()
1138 if type(plugin.OnReceiveDrag) == "function" then
1139 if not this.dragged then
1140 plugin:OnReceiveDrag()
1141 end
1142 end
1143 end)
1144 frame:SetScript("OnMouseDown", function()
1145 this.dragged = false
1146 if arg1 == "LeftButton" and not IsShiftKeyDown() and not IsControlKeyDown() and not IsAltKeyDown() then
1147 HideDropDownMenu(1)
1148 if type(plugin.OnMouseDown) == "function" then
1149 plugin:OnMouseDown(arg1)
1150 end
1151 elseif arg1 == "RightButton" and not IsShiftKeyDown() and not IsControlKeyDown() and not IsAltKeyDown() then
1152 plugin:OpenMenu(frame)
1153 else
1154 HideDropDownMenu(1)
1155 if type(plugin.OnMouseDown) == "function" then
1156 plugin:OnMouseDown(arg1)
1157 end
1158 end
1159 if plugin.OnClick or plugin.OnMouseDown or plugin.OnMouseUp or plugin.OnDoubleClick then
1160 if string.sub(this.plugin.minimapIcon:GetTexture(), 1, 16) == "Interface\\Icons\\" then
1161 plugin.minimapIcon:SetTexCoord(0.14, 0.86, 0.14, 0.86)
1162 else
1163 plugin.minimapIcon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
1164 end
1165 end
1166 end)
1167 frame:SetScript("OnMouseUp", function()
1168 if not this.dragged and type(plugin.OnMouseUp) == "function" then
1169 plugin:OnMouseUp(arg1)
1170 end
1171 if string.sub(this.plugin.minimapIcon:GetTexture(), 1, 16) == "Interface\\Icons\\" then
1172 plugin.minimapIcon:SetTexCoord(0.05, 0.95, 0.05, 0.95)
1173 else
1174 plugin.minimapIcon:SetTexCoord(0, 1, 0, 1)
1175 end
1176 end)
1177 frame:RegisterForDrag("LeftButton")
1178 frame:SetScript("OnDragStart", self.OnDragStart)
1179 frame:SetScript("OnDragStop", self.OnDragStop)
1180 end
1181 plugin.frame:Hide()
1182 plugin.minimapFrame:Show()
1183 self:ReadjustLocation(plugin)
1184 table.insert(self.plugins, plugin)
1185 local exists = false
1186 return true
1187 end
1188  
1189 function MinimapContainer:RemovePlugin(index)
1190 if CheckFuBar() and FuBar:IsChangingProfile() then
1191 return
1192 end
1193 if type(index) == "table" then
1194 index = self:IndexOfPlugin(index)
1195 if not index then
1196 return
1197 end
1198 end
1199 local t = self.plugins
1200 local plugin = t[index]
1201 assert(plugin.panel == self, "Plugin has improper panel field")
1202 plugin:SetPanel(nil)
1203 table.remove(t, index)
1204 return true
1205 end
1206  
1207 function MinimapContainer:ReadjustLocation(plugin)
1208 local frame = plugin.minimapFrame
1209 if plugin.db and plugin.db.profile.minimapPositionWild then
1210 frame:SetPoint("CENTER", UIParent, "BOTTOMLEFT", plugin.db.profile.minimapPositionX, plugin.db.profile.minimapPositionY)
1211 elseif not plugin.db and plugin.minimapPositionWild then
1212 frame:SetPoint("CENTER", UIParent, "BOTTOMLEFT", plugin.minimapPositionX, plugin.minimapPositionY)
1213 else
1214 local position
1215 if plugin.db then
1216 position = plugin.db.profile.minimapPosition or plugin.defaultMinimapPosition or math.random(1, 360)
1217 else
1218 position = plugin.minimapPosition or plugin.defaultMinimapPosition or math.random(1, 360)
1219 end
1220 local angle = math.rad(position or 0)
1221 local x = math.cos(angle) * 80
1222 local y = math.sin(angle) * 80
1223 frame:SetPoint("CENTER", Minimap, "CENTER", x, y)
1224 end
1225 end
1226  
1227 function MinimapContainer:GetPlugin(index)
1228 return self.plugins[index]
1229 end
1230  
1231 function MinimapContainer:GetNumPlugins()
1232 return table.getn(self.plugins)
1233 end
1234  
1235 function MinimapContainer:IndexOfPlugin(plugin)
1236 for i,p in ipairs(self.plugins) do
1237 if p == plugin then
1238 return i, "MINIMAP"
1239 end
1240 end
1241 end
1242  
1243 function MinimapContainer:HasPlugin(plugin)
1244 return self:IndexOfPlugin(plugin) ~= nil
1245 end
1246  
1247 function MinimapContainer:GetPluginSide(plugin)
1248 local index = self:IndexOfPlugin(plugin)
1249 assert(index, "Plugin not in panel")
1250 return "MINIMAP"
1251 end
1252  
1253 function MinimapContainer.OnDragStart()
1254 this.dragged = true
1255 this:LockHighlight()
1256 this:SetScript("OnUpdate", MinimapContainer.OnUpdate)
1257 if string.sub(this.plugin.minimapIcon:GetTexture(), 1, 16) == "Interface\\Icons\\" then
1258 this.plugin.minimapIcon:SetTexCoord(0.05, 0.95, 0.05, 0.95)
1259 else
1260 this.plugin.minimapIcon:SetTexCoord(0, 1, 0, 1)
1261 end
1262 end
1263  
1264 function MinimapContainer.OnDragStop()
1265 this:SetScript("OnUpdate", nil)
1266 this:UnlockHighlight()
1267 end
1268  
1269 function MinimapContainer.OnUpdate()
1270 if not IsAltKeyDown() then
1271 local mx, my = Minimap:GetCenter()
1272 local px, py = GetCursorPosition()
1273 local scale = UIParent:GetEffectiveScale()
1274 px, py = px / scale, py / scale
1275 local position = math.deg(math.atan2(py - my, px - mx))
1276 if position <= 0 then
1277 position = position + 360
1278 elseif position > 360 then
1279 position = position - 360
1280 end
1281 if this.plugin.db then
1282 this.plugin.db.profile.minimapPosition = position
1283 this.plugin.db.profile.minimapPositionX = nil
1284 this.plugin.db.profile.minimapPositionY = nil
1285 this.plugin.db.profile.minimapPositionWild = nil
1286 else
1287 this.plugin.minimapPosition = position
1288 this.plugin.minimapPositionX = nil
1289 this.plugin.minimapPositionY = nil
1290 this.plugin.minimapPositionWild = nil
1291 end
1292 else
1293 local px, py = GetCursorPosition()
1294 local scale = UIParent:GetEffectiveScale()
1295 px, py = px / scale, py / scale
1296 if this.plugin.db then
1297 this.plugin.db.profile.minimapPositionX = px
1298 this.plugin.db.profile.minimapPositionY = py
1299 this.plugin.db.profile.minimapPosition = nil
1300 this.plugin.db.profile.minimapPositionWild = true
1301 else
1302 this.plugin.minimapPositionX = px
1303 this.plugin.minimapPositionY = py
1304 this.plugin.minimapPosition = nil
1305 this.plugin.minimapPositionWild = true
1306 end
1307 end
1308 MinimapContainer:ReadjustLocation(this.plugin)
1309 end
1310  
1311 local function activate(self, oldLib, oldDeactivate)
1312 MinimapContainer = self
1313  
1314 if oldLib then
1315 self.plugins = oldLib.plugins
1316 end
1317  
1318 if not self.plugins then
1319 self.plugins = {}
1320 end
1321  
1322 if oldDeactivate then
1323 oldDeactivate(oldLib)
1324 end
1325 end
1326  
1327 AceLibrary:Register(MinimapContainer, MINIMAPCONTAINER_MAJOR_VERSION, MINOR_VERSION, activate)