flickerstreak@25: --[[ flickerstreak@25: ReAction 'Hide Blizzard' module flickerstreak@25: flickerstreak@25: Hides Blizzard action bars. This hides the extra action bars, stance bar, pet bar, and flickerstreak@25: main menu bar, which in turn hides the experience bar, bag bar, micro menu bar, and lag meter. flickerstreak@25: flickerstreak@25: --]] flickerstreak@25: flickerstreak@25: -- local imports flickerstreak@25: local ReAction = ReAction flickerstreak@25: local L = ReAction.L flickerstreak@25: flickerstreak@25: -- module declaration flickerstreak@25: local moduleID = "HideBlizzard" flickerstreak@25: local module = ReAction:NewModule( moduleID ) flickerstreak@25: flickerstreak@25: flickerstreak@25: -- module methods flickerstreak@25: function module:OnInitialize() flickerstreak@28: self.db = ReAction.db:RegisterNamespace( moduleID, flickerstreak@25: { flickerstreak@28: profile = { flickerstreak@28: hide = false flickerstreak@28: } flickerstreak@25: } flickerstreak@25: ) flickerstreak@28: self.db.RegisterCallback(self,"OnProfileChanged") flickerstreak@25: flickerstreak@25: self.hiddenFrame = CreateFrame("Frame") flickerstreak@25: self.hiddenFrame:Hide() flickerstreak@25: end flickerstreak@25: flickerstreak@25: function module:OnEnable() flickerstreak@25: if self.db.profile.hide then flickerstreak@25: self:HideAll(true) flickerstreak@25: end flickerstreak@30: ReAction:RegisterOptions("global", self, { flickerstreak@30: hideBlizzard = { flickerstreak@30: type = "toggle", flickerstreak@30: handler = self, flickerstreak@30: name = L["Hide Blizzard Action Bars"], flickerstreak@30: desc = L["Hide the default main bar and extra action bars"], flickerstreak@30: get = "IsHidden", flickerstreak@30: set = function(info,value) self:SetHidden(value) end, flickerstreak@30: disabled = InCombatLockdown flickerstreak@30: } flickerstreak@30: }) flickerstreak@38: flickerstreak@38: -- reroute blizzard action bar config to ReAction config window flickerstreak@38: InterfaceOptionsActionBarsPanel:HookScript("OnShow", flickerstreak@38: function() flickerstreak@41: if module:IsEnabled() and module:IsHidden() then flickerstreak@38: ReAction:ShowConfig() flickerstreak@38: end flickerstreak@38: end ) flickerstreak@25: end flickerstreak@25: flickerstreak@25: function module:OnDisable() flickerstreak@25: self:ShowAll(true) flickerstreak@25: end flickerstreak@25: flickerstreak@28: function module:OnProfileChanged() flickerstreak@25: if self.db.profile.hide then flickerstreak@28: module:HideAll(true) flickerstreak@25: else flickerstreak@28: module:ShowAll(true) flickerstreak@25: end flickerstreak@25: end flickerstreak@25: flickerstreak@25: local frames = { flickerstreak@25: MainMenuBar, flickerstreak@31: PetActionBarFrame, flickerstreak@25: BonusActionBarFrame, flickerstreak@25: ShapeshiftBarFrame, flickerstreak@25: MultiBarLeft, flickerstreak@25: MultiBarRight, flickerstreak@25: MultiBarBottomLeft, flickerstreak@25: MultiBarBottomRight, flickerstreak@25: SlidingActionBarTexture0, flickerstreak@25: SlidingActionBarTexture1, flickerstreak@25: } flickerstreak@25: flickerstreak@25: local hidden = { } flickerstreak@25: flickerstreak@25: function module:HideAll( force ) flickerstreak@25: if not(self.db.profile.hide) or force then flickerstreak@25: self.db.profile.hide = true flickerstreak@25: for _, f in pairs(frames) do flickerstreak@25: hidden[f] = hidden[f] or { parent = f:GetParent(), wasShown = f:IsShown() } flickerstreak@25: f:SetParent(self.hiddenFrame) flickerstreak@25: f:Hide() flickerstreak@25: end flickerstreak@25: end flickerstreak@25: end flickerstreak@25: flickerstreak@25: function module:ShowAll( force ) flickerstreak@25: if self.db.profile.hide or force then flickerstreak@25: self.db.profile.hide = false flickerstreak@25: flickerstreak@25: for _, f in pairs(frames) do flickerstreak@25: local h = hidden[f] flickerstreak@25: if h then flickerstreak@25: f:SetParent(h.parent) flickerstreak@25: if h.wasShown then flickerstreak@25: f:Show() flickerstreak@25: end flickerstreak@25: end flickerstreak@25: end flickerstreak@25: end flickerstreak@25: end flickerstreak@25: flickerstreak@25: function module:IsHidden() flickerstreak@25: return self.db.profile.hide flickerstreak@25: end flickerstreak@25: flickerstreak@25: function module:SetHidden(h) flickerstreak@25: if h then flickerstreak@25: self:HideAll() flickerstreak@25: else flickerstreak@25: self:ShowAll() flickerstreak@25: end flickerstreak@25: end flickerstreak@25: