flickerstreak@25
|
1 --[[
|
flickerstreak@25
|
2 ReAction 'Hide Blizzard' module
|
flickerstreak@25
|
3
|
flickerstreak@25
|
4 Hides Blizzard action bars. This hides the extra action bars, stance bar, pet bar, and
|
flickerstreak@25
|
5 main menu bar, which in turn hides the experience bar, bag bar, micro menu bar, and lag meter.
|
flickerstreak@25
|
6
|
flickerstreak@25
|
7 --]]
|
flickerstreak@25
|
8
|
flickerstreak@25
|
9 -- local imports
|
flickerstreak@25
|
10 local ReAction = ReAction
|
flickerstreak@25
|
11 local L = ReAction.L
|
flickerstreak@25
|
12
|
flickerstreak@25
|
13 -- module declaration
|
flickerstreak@25
|
14 local moduleID = "HideBlizzard"
|
flickerstreak@25
|
15 local module = ReAction:NewModule( moduleID )
|
flickerstreak@25
|
16
|
flickerstreak@25
|
17
|
flickerstreak@25
|
18 -- module methods
|
flickerstreak@25
|
19 function module:OnInitialize()
|
flickerstreak@28
|
20 self.db = ReAction.db:RegisterNamespace( moduleID,
|
flickerstreak@25
|
21 {
|
flickerstreak@28
|
22 profile = {
|
flickerstreak@28
|
23 hide = false
|
flickerstreak@28
|
24 }
|
flickerstreak@25
|
25 }
|
flickerstreak@25
|
26 )
|
flickerstreak@28
|
27 self.db.RegisterCallback(self,"OnProfileChanged")
|
flickerstreak@25
|
28
|
flickerstreak@25
|
29 self.hiddenFrame = CreateFrame("Frame")
|
flickerstreak@25
|
30 self.hiddenFrame:Hide()
|
flickerstreak@25
|
31 end
|
flickerstreak@25
|
32
|
flickerstreak@25
|
33 function module:OnEnable()
|
flickerstreak@25
|
34 if self.db.profile.hide then
|
flickerstreak@25
|
35 self:HideAll(true)
|
flickerstreak@25
|
36 end
|
flickerstreak@30
|
37 ReAction:RegisterOptions("global", self, {
|
flickerstreak@30
|
38 hideBlizzard = {
|
flickerstreak@30
|
39 type = "toggle",
|
flickerstreak@30
|
40 handler = self,
|
flickerstreak@30
|
41 name = L["Hide Blizzard Action Bars"],
|
flickerstreak@30
|
42 desc = L["Hide the default main bar and extra action bars"],
|
flickerstreak@30
|
43 get = "IsHidden",
|
flickerstreak@30
|
44 set = function(info,value) self:SetHidden(value) end,
|
flickerstreak@30
|
45 disabled = InCombatLockdown
|
flickerstreak@30
|
46 }
|
flickerstreak@30
|
47 })
|
flickerstreak@38
|
48
|
flickerstreak@38
|
49 -- reroute blizzard action bar config to ReAction config window
|
flickerstreak@38
|
50 InterfaceOptionsActionBarsPanel:HookScript("OnShow",
|
flickerstreak@38
|
51 function()
|
flickerstreak@38
|
52 if module:IsHidden() then
|
flickerstreak@38
|
53 ReAction:ShowConfig()
|
flickerstreak@38
|
54 end
|
flickerstreak@38
|
55 end )
|
flickerstreak@25
|
56 end
|
flickerstreak@25
|
57
|
flickerstreak@25
|
58 function module:OnDisable()
|
flickerstreak@25
|
59 self:ShowAll(true)
|
flickerstreak@25
|
60 end
|
flickerstreak@25
|
61
|
flickerstreak@28
|
62 function module:OnProfileChanged()
|
flickerstreak@25
|
63 if self.db.profile.hide then
|
flickerstreak@28
|
64 module:HideAll(true)
|
flickerstreak@25
|
65 else
|
flickerstreak@28
|
66 module:ShowAll(true)
|
flickerstreak@25
|
67 end
|
flickerstreak@25
|
68 end
|
flickerstreak@25
|
69
|
flickerstreak@25
|
70 local frames = {
|
flickerstreak@25
|
71 MainMenuBar,
|
flickerstreak@31
|
72 PetActionBarFrame,
|
flickerstreak@25
|
73 BonusActionBarFrame,
|
flickerstreak@25
|
74 ShapeshiftBarFrame,
|
flickerstreak@25
|
75 MultiBarLeft,
|
flickerstreak@25
|
76 MultiBarRight,
|
flickerstreak@25
|
77 MultiBarBottomLeft,
|
flickerstreak@25
|
78 MultiBarBottomRight,
|
flickerstreak@25
|
79 SlidingActionBarTexture0,
|
flickerstreak@25
|
80 SlidingActionBarTexture1,
|
flickerstreak@25
|
81 }
|
flickerstreak@25
|
82
|
flickerstreak@25
|
83 local hidden = { }
|
flickerstreak@25
|
84
|
flickerstreak@25
|
85 function module:HideAll( force )
|
flickerstreak@25
|
86 if not(self.db.profile.hide) or force then
|
flickerstreak@25
|
87 self.db.profile.hide = true
|
flickerstreak@25
|
88 for _, f in pairs(frames) do
|
flickerstreak@25
|
89 hidden[f] = hidden[f] or { parent = f:GetParent(), wasShown = f:IsShown() }
|
flickerstreak@25
|
90 f:SetParent(self.hiddenFrame)
|
flickerstreak@25
|
91 f:Hide()
|
flickerstreak@25
|
92 end
|
flickerstreak@25
|
93 end
|
flickerstreak@25
|
94 end
|
flickerstreak@25
|
95
|
flickerstreak@25
|
96 function module:ShowAll( force )
|
flickerstreak@25
|
97 if self.db.profile.hide or force then
|
flickerstreak@25
|
98 self.db.profile.hide = false
|
flickerstreak@25
|
99
|
flickerstreak@25
|
100 for _, f in pairs(frames) do
|
flickerstreak@25
|
101 local h = hidden[f]
|
flickerstreak@25
|
102 if h then
|
flickerstreak@25
|
103 f:SetParent(h.parent)
|
flickerstreak@25
|
104 if h.wasShown then
|
flickerstreak@25
|
105 f:Show()
|
flickerstreak@25
|
106 end
|
flickerstreak@25
|
107 end
|
flickerstreak@25
|
108 end
|
flickerstreak@25
|
109 end
|
flickerstreak@25
|
110 end
|
flickerstreak@25
|
111
|
flickerstreak@25
|
112 function module:IsHidden()
|
flickerstreak@25
|
113 return self.db.profile.hide
|
flickerstreak@25
|
114 end
|
flickerstreak@25
|
115
|
flickerstreak@25
|
116 function module:SetHidden(h)
|
flickerstreak@25
|
117 if h then
|
flickerstreak@25
|
118 self:HideAll()
|
flickerstreak@25
|
119 else
|
flickerstreak@25
|
120 self:ShowAll()
|
flickerstreak@25
|
121 end
|
flickerstreak@25
|
122 end
|
flickerstreak@25
|
123
|