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@149
|
36 -- It's fairly normal to use the Blizzard vehicle bar, and to have
|
flickerstreak@149
|
37 -- your regular buttons in the same location. If you do this, and don't
|
flickerstreak@149
|
38 -- bother to hide your buttons, they'll obscure some parts of the vehicle bar.
|
flickerstreak@149
|
39 VehicleMenuBar:SetFrameLevel(VehicleMenuBar:GetFrameLevel()+3)
|
flickerstreak@149
|
40
|
flickerstreak@109
|
41 ReAction:RegisterOptions(self, {
|
flickerstreak@120
|
42 hide = {
|
flickerstreak@109
|
43 name = L["Hide Blizzard Action Bars"],
|
flickerstreak@109
|
44 desc = L["Hide the default main bar and extra action bars"],
|
flickerstreak@120
|
45 type = "toggle",
|
flickerstreak@120
|
46 order = 10,
|
flickerstreak@120
|
47 width = "double",
|
flickerstreak@120
|
48 handler = self,
|
flickerstreak@109
|
49 get = "IsHidden",
|
flickerstreak@120
|
50 set = "SetHidden",
|
flickerstreak@120
|
51 disabled = "OptionDisabled",
|
flickerstreak@120
|
52 },
|
flickerstreak@120
|
53 hideVehicle = {
|
flickerstreak@120
|
54 name = L["Hide Blizzard Vehicle Bar"],
|
flickerstreak@120
|
55 desc = L["Hide the default vechicle action bar"],
|
flickerstreak@120
|
56 type = "toggle",
|
flickerstreak@120
|
57 order = 11,
|
flickerstreak@120
|
58 width = "double",
|
flickerstreak@120
|
59 handler = self,
|
flickerstreak@120
|
60 get = "IsHidden",
|
flickerstreak@120
|
61 set = "SetHidden",
|
flickerstreak@120
|
62 disabled = "OptionDisabled",
|
flickerstreak@109
|
63 },
|
flickerstreak@109
|
64 }, true) -- global
|
flickerstreak@109
|
65
|
flickerstreak@109
|
66 end
|
flickerstreak@109
|
67
|
flickerstreak@109
|
68 function module:OnEnable()
|
flickerstreak@120
|
69 self:UpdateFrames()
|
flickerstreak@109
|
70 end
|
flickerstreak@109
|
71
|
flickerstreak@109
|
72 function module:OnDisable()
|
flickerstreak@120
|
73 self:UpdateFrames(true)
|
flickerstreak@109
|
74 end
|
flickerstreak@109
|
75
|
flickerstreak@109
|
76 function module:OnProfileChanged()
|
flickerstreak@120
|
77 self:UpdateFrames()
|
flickerstreak@109
|
78 end
|
flickerstreak@109
|
79
|
flickerstreak@109
|
80 local frames = {
|
flickerstreak@120
|
81 [ MainMenuBar ] = { },
|
flickerstreak@120
|
82 [ MultiBarLeft ] = { },
|
flickerstreak@120
|
83 [ MultiBarRight ] = { },
|
flickerstreak@120
|
84 [ MultiBarBottomLeft ] = { },
|
flickerstreak@120
|
85 [ MultiBarBottomRight ] = { },
|
flickerstreak@120
|
86 [ VehicleMenuBar ] = { field = "hideVehicle" },
|
flickerstreak@109
|
87 }
|
flickerstreak@109
|
88
|
flickerstreak@120
|
89 function module:UpdateFrames( show )
|
flickerstreak@120
|
90 show = show or not self.db.profile.hide
|
flickerstreak@120
|
91 for frame, info in pairs(frames) do
|
flickerstreak@120
|
92 local show = show -- make a local copy for this frame
|
flickerstreak@120
|
93 if info.field then
|
flickerstreak@120
|
94 show = show or not self.db.profile[info.field]
|
flickerstreak@120
|
95 end
|
flickerstreak@109
|
96
|
flickerstreak@120
|
97 if show then
|
flickerstreak@120
|
98 if info.parent then
|
flickerstreak@120
|
99 frame:SetParent(info.parent)
|
flickerstreak@109
|
100 end
|
flickerstreak@120
|
101 if frame:IsShown() then
|
flickerstreak@120
|
102 frame:Show() -- refresh
|
flickerstreak@120
|
103 end
|
flickerstreak@120
|
104 else
|
flickerstreak@120
|
105 if not info.parent then
|
flickerstreak@120
|
106 info.parent = frame:GetParent()
|
flickerstreak@120
|
107 end
|
flickerstreak@120
|
108 frame:SetParent(self.hiddenFrame)
|
flickerstreak@109
|
109 end
|
flickerstreak@109
|
110 end
|
flickerstreak@109
|
111 end
|
flickerstreak@109
|
112
|
flickerstreak@120
|
113 function module:IsHidden(info)
|
flickerstreak@150
|
114 if info then
|
flickerstreak@150
|
115 return self.db.profile.hide and self.db.profile[info[#info]]
|
flickerstreak@150
|
116 else
|
flickerstreak@150
|
117 return self.db.profile.hide
|
flickerstreak@150
|
118 end
|
flickerstreak@109
|
119 end
|
flickerstreak@109
|
120
|
flickerstreak@120
|
121 function module:SetHidden(info,value)
|
flickerstreak@120
|
122 self.db.profile[info[#info]] = value
|
flickerstreak@120
|
123 self:UpdateFrames()
|
flickerstreak@109
|
124 end
|
flickerstreak@109
|
125
|
flickerstreak@120
|
126 function module:OptionDisabled(info)
|
flickerstreak@120
|
127 local disabled = InCombatLockdown()
|
flickerstreak@120
|
128 if not disabled and info[#info] ~= "hide" then
|
flickerstreak@120
|
129 disabled = not self.db.profile.hide
|
flickerstreak@120
|
130 end
|
flickerstreak@120
|
131 return disabled
|
flickerstreak@120
|
132 end
|
flickerstreak@120
|
133
|
flickerstreak@120
|
134
|
flickerstreak@120
|
135 -- reroute blizzard action bar config to ReAction config window
|
flickerstreak@120
|
136 InterfaceOptionsActionBarsPanel:HookScript("OnShow",
|
flickerstreak@120
|
137 function()
|
flickerstreak@120
|
138 if module:IsEnabled() and module:IsHidden() then
|
flickerstreak@120
|
139 ReAction:ShowConfig()
|
flickerstreak@120
|
140 end
|
flickerstreak@120
|
141 end )
|