flickerstreak@109: --[[ flickerstreak@109: ReAction 'Hide Blizzard' module flickerstreak@109: flickerstreak@109: Hides Blizzard action bars. This hides the extra action bars, stance bar, pet bar, and flickerstreak@109: main menu bar, which in turn hides the experience bar, bag bar, micro menu bar, and lag meter. flickerstreak@109: flickerstreak@109: --]] flickerstreak@109: flickerstreak@109: -- local imports flickerstreak@175: local addonName, addonTable = ... flickerstreak@175: local ReAction = addonTable.ReAction flickerstreak@109: local L = ReAction.L flickerstreak@109: flickerstreak@109: -- module declaration flickerstreak@109: local moduleID = "HideBlizzard" flickerstreak@109: local module = ReAction:NewModule( moduleID ) flickerstreak@109: flickerstreak@109: flickerstreak@109: -- module methods flickerstreak@109: function module:OnInitialize() flickerstreak@109: self.db = ReAction.db:RegisterNamespace( moduleID, flickerstreak@109: { flickerstreak@109: profile = { flickerstreak@109: hide = false flickerstreak@109: } flickerstreak@109: } flickerstreak@109: ) flickerstreak@109: self.db.RegisterCallback(self,"OnProfileChanged") flickerstreak@109: self.db.RegisterCallback(self,"OnProfileCopied", "OnProfileChanged") flickerstreak@109: self.db.RegisterCallback(self,"OnProfileReset", "OnProfileChanged") flickerstreak@109: flickerstreak@109: self.hiddenFrame = CreateFrame("Frame") flickerstreak@109: self.hiddenFrame:Hide() flickerstreak@109: flickerstreak@149: -- It's fairly normal to use the Blizzard vehicle bar, and to have flickerstreak@149: -- your regular buttons in the same location. If you do this, and don't flickerstreak@149: -- bother to hide your buttons, they'll obscure some parts of the vehicle bar. flickerstreak@149: VehicleMenuBar:SetFrameLevel(VehicleMenuBar:GetFrameLevel()+3) flickerstreak@149: flickerstreak@109: ReAction:RegisterOptions(self, { flickerstreak@120: hide = { flickerstreak@109: name = L["Hide Blizzard Action Bars"], flickerstreak@109: desc = L["Hide the default main bar and extra action bars"], flickerstreak@120: type = "toggle", flickerstreak@120: order = 10, flickerstreak@120: width = "double", flickerstreak@120: handler = self, flickerstreak@109: get = "IsHidden", flickerstreak@120: set = "SetHidden", flickerstreak@120: disabled = "OptionDisabled", flickerstreak@120: }, flickerstreak@120: hideVehicle = { flickerstreak@120: name = L["Hide Blizzard Vehicle Bar"], flickerstreak@120: desc = L["Hide the default vechicle action bar"], flickerstreak@120: type = "toggle", flickerstreak@120: order = 11, flickerstreak@120: width = "double", flickerstreak@120: handler = self, flickerstreak@120: get = "IsHidden", flickerstreak@120: set = "SetHidden", flickerstreak@120: disabled = "OptionDisabled", flickerstreak@109: }, flickerstreak@109: }, true) -- global flickerstreak@109: flickerstreak@109: end flickerstreak@109: flickerstreak@109: function module:OnEnable() flickerstreak@120: self:UpdateFrames() flickerstreak@109: end flickerstreak@109: flickerstreak@109: function module:OnDisable() flickerstreak@120: self:UpdateFrames(true) flickerstreak@109: end flickerstreak@109: flickerstreak@109: function module:OnProfileChanged() flickerstreak@120: self:UpdateFrames() flickerstreak@109: end flickerstreak@109: flickerstreak@109: local frames = { flickerstreak@120: [ MainMenuBar ] = { }, flickerstreak@120: [ MultiBarLeft ] = { }, flickerstreak@120: [ MultiBarRight ] = { }, flickerstreak@120: [ MultiBarBottomLeft ] = { }, flickerstreak@120: [ MultiBarBottomRight ] = { }, flickerstreak@120: [ VehicleMenuBar ] = { field = "hideVehicle" }, flickerstreak@109: } flickerstreak@109: flickerstreak@120: function module:UpdateFrames( show ) flickerstreak@120: show = show or not self.db.profile.hide flickerstreak@120: for frame, info in pairs(frames) do flickerstreak@120: local show = show -- make a local copy for this frame flickerstreak@120: if info.field then flickerstreak@120: show = show or not self.db.profile[info.field] flickerstreak@120: end flickerstreak@109: flickerstreak@120: if show then flickerstreak@120: if info.parent then flickerstreak@120: frame:SetParent(info.parent) flickerstreak@109: end flickerstreak@120: if frame:IsShown() then flickerstreak@120: frame:Show() -- refresh flickerstreak@120: end flickerstreak@120: else flickerstreak@120: if not info.parent then flickerstreak@120: info.parent = frame:GetParent() flickerstreak@120: end flickerstreak@120: frame:SetParent(self.hiddenFrame) flickerstreak@109: end flickerstreak@109: end flickerstreak@109: end flickerstreak@109: flickerstreak@120: function module:IsHidden(info) flickerstreak@150: if info then flickerstreak@150: return self.db.profile.hide and self.db.profile[info[#info]] flickerstreak@150: else flickerstreak@150: return self.db.profile.hide flickerstreak@150: end flickerstreak@109: end flickerstreak@109: flickerstreak@120: function module:SetHidden(info,value) flickerstreak@120: self.db.profile[info[#info]] = value flickerstreak@120: self:UpdateFrames() flickerstreak@109: end flickerstreak@109: flickerstreak@120: function module:OptionDisabled(info) flickerstreak@120: local disabled = InCombatLockdown() flickerstreak@120: if not disabled and info[#info] ~= "hide" then flickerstreak@120: disabled = not self.db.profile.hide flickerstreak@120: end flickerstreak@120: return disabled flickerstreak@120: end flickerstreak@120: flickerstreak@120: flickerstreak@120: -- reroute blizzard action bar config to ReAction config window flickerstreak@120: InterfaceOptionsActionBarsPanel:HookScript("OnShow", flickerstreak@120: function() flickerstreak@120: if module:IsEnabled() and module:IsHidden() then flickerstreak@120: ReAction:ShowConfig() flickerstreak@120: end flickerstreak@120: end )