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@77: ReAction:UpdateRevision("$Revision: 103 $") flickerstreak@77: 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@43: self.db.RegisterCallback(self,"OnProfileReset","OnProfileChanged") flickerstreak@25: flickerstreak@25: self.hiddenFrame = CreateFrame("Frame") flickerstreak@25: self.hiddenFrame:Hide() flickerstreak@60: flickerstreak@60: ReAction:RegisterOptions(self, { flickerstreak@60: hideBlizzard = { flickerstreak@60: type = "toggle", flickerstreak@60: handler = self, flickerstreak@60: name = L["Hide Blizzard Action Bars"], flickerstreak@60: desc = L["Hide the default main bar and extra action bars"], flickerstreak@60: get = "IsHidden", flickerstreak@60: set = function(info,value) self:SetHidden(value) end, flickerstreak@60: disabled = InCombatLockdown flickerstreak@60: }, flickerstreak@60: }, true) -- global flickerstreak@60: 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@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@25: MultiBarLeft, flickerstreak@25: MultiBarRight, flickerstreak@25: MultiBarBottomLeft, flickerstreak@25: MultiBarBottomRight, flickerstreak@54: -- possess bar frame needs to be pulled out separately: stash its children away flickerstreak@54: PossessBarLeft, flickerstreak@54: PossessBarRight, flickerstreak@54: PossessButton1, flickerstreak@54: PossessButton2 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@54: PossessBarFrame:SetParent(UIParent) flickerstreak@54: PossessBarFrame:EnableMouse(false) flickerstreak@25: end flickerstreak@25: flickerstreak@25: function module:ShowAll( force ) flickerstreak@54: PossessBarFrame:EnableMouse(true) flickerstreak@54: PossessBarFrame:SetParent(MainMenuBar) 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: