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