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: local _G = _G 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@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: PetActionButton1, flickerstreak@25: PetActionButton2, flickerstreak@25: PetActionButton3, flickerstreak@25: PetActionButton4, flickerstreak@25: PetActionButton5, flickerstreak@25: PetActionButton6, flickerstreak@25: PetActionButton7, flickerstreak@25: PetActionButton8, flickerstreak@25: PetActionButton9, flickerstreak@25: PetActionButton10, 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: -- the pet bar is a child of MainMenuBar, but can't be permanently hidden because it will flickerstreak@25: -- break automatic pet bar show/hide. Need to reparent it instead. flickerstreak@25: PetActionBarFrame:SetParent(UIParent) flickerstreak@25: -- for some odd reason PetActionBarFrame has mouse input enabled even though it has no mouse flickerstreak@25: -- input handlers. Because of this it can potentially trap mouse clicks from getting through flickerstreak@25: -- to things behind it. It's not feasible to move it, either, since UIParent_ManageFramePositions() flickerstreak@25: -- will move it back to its original position whenever it's called. flickerstreak@25: PetActionBarFrame:EnableMouse(false) flickerstreak@25: 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: PetActionBarFrame:SetParent(MainMenuBar) 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: