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@25: self.db = ReAction:AcquireDBNamespace(moduleID) flickerstreak@25: ReAction:RegisterDefaults(moduleID,"profile", flickerstreak@25: { flickerstreak@25: hide = false flickerstreak@25: } flickerstreak@25: ) flickerstreak@25: flickerstreak@25: self.hiddenFrame = CreateFrame("Frame") flickerstreak@25: self.hiddenFrame:Hide() flickerstreak@25: flickerstreak@25: -- disable the buttons to hide/show the blizzard multiaction bars flickerstreak@25: -- see UIOptionsFrame.lua and .xml flickerstreak@25: -- This is called every time the options panel is shown, after it is set up flickerstreak@25: local disabledOptionsButtons = { flickerstreak@25: _G["UIOptionsFrameCheckButton"..UIOptionsFrameCheckButtons["SHOW_MULTIBAR1_TEXT"].index], flickerstreak@25: _G["UIOptionsFrameCheckButton"..UIOptionsFrameCheckButtons["SHOW_MULTIBAR2_TEXT"].index], flickerstreak@25: _G["UIOptionsFrameCheckButton"..UIOptionsFrameCheckButtons["SHOW_MULTIBAR3_TEXT"].index], flickerstreak@25: _G["UIOptionsFrameCheckButton"..UIOptionsFrameCheckButtons["SHOW_MULTIBAR4_TEXT"].index], flickerstreak@25: _G["UIOptionsFrameCheckButton"..UIOptionsFrameCheckButtons["ALWAYS_SHOW_MULTIBARS_TEXT"].index], flickerstreak@25: } flickerstreak@25: hooksecurefunc("UIOptionsFrame_Load", flickerstreak@25: function() flickerstreak@25: if self.db.profile.hide then flickerstreak@25: for _, f in pairs(disabledOptionsButtons) do flickerstreak@25: f.disabled = true flickerstreak@25: OptionsFrame_DisableCheckBox(f) flickerstreak@25: end flickerstreak@25: end flickerstreak@25: end flickerstreak@25: ) 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@25: end flickerstreak@25: flickerstreak@25: function module:OnDisable() flickerstreak@25: self:ShowAll(true) flickerstreak@25: end flickerstreak@25: flickerstreak@25: function module:OnProfileEnable() flickerstreak@25: if self.db.profile.hide then flickerstreak@25: self:HideAll(true) flickerstreak@25: else flickerstreak@25: self:ShowAll(true) flickerstreak@25: end flickerstreak@25: end flickerstreak@25: 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: flickerstreak@25: function module:GetGlobalOptions() flickerstreak@25: if self.globalOptions == nil then flickerstreak@25: self.globalOptions = { flickerstreak@25: hideBlizzard = { flickerstreak@25: type = "toggle", flickerstreak@25: handler = self, flickerstreak@25: name = L["Hide Default Action Bars"], flickerstreak@25: desc = L["Hide the default main bar and extra action bars"], flickerstreak@25: get = "IsHidden", flickerstreak@25: set = "SetHidden", flickerstreak@25: disabled = function() return InCombatLockdown() end flickerstreak@25: } flickerstreak@25: } flickerstreak@25: end flickerstreak@25: return self.globalOptions flickerstreak@25: end