annotate modules/ReAction_HideBlizzard/ReAction_HideBlizzard.lua @ 80:42ec2938d65a

- Added Revision keyword on all .lua files (except ReAction_Action, which is under dev) - Removed ReAction_Paging module stub
author Flick <flickerstreak@gmail.com>
date Tue, 24 Jun 2008 23:47:27 +0000
parents da8ba8783924
children 168cae4aa8bd
rev   line source
flickerstreak@25 1 --[[
flickerstreak@25 2 ReAction 'Hide Blizzard' module
flickerstreak@25 3
flickerstreak@25 4 Hides Blizzard action bars. This hides the extra action bars, stance bar, pet bar, and
flickerstreak@25 5 main menu bar, which in turn hides the experience bar, bag bar, micro menu bar, and lag meter.
flickerstreak@25 6
flickerstreak@25 7 --]]
flickerstreak@25 8
flickerstreak@25 9 -- local imports
flickerstreak@25 10 local ReAction = ReAction
flickerstreak@25 11 local L = ReAction.L
flickerstreak@25 12
flickerstreak@80 13 ReAction:UpdateRevision("$Revision$")
flickerstreak@77 14
flickerstreak@25 15 -- module declaration
flickerstreak@25 16 local moduleID = "HideBlizzard"
flickerstreak@25 17 local module = ReAction:NewModule( moduleID )
flickerstreak@25 18
flickerstreak@25 19
flickerstreak@25 20 -- module methods
flickerstreak@25 21 function module:OnInitialize()
flickerstreak@28 22 self.db = ReAction.db:RegisterNamespace( moduleID,
flickerstreak@25 23 {
flickerstreak@28 24 profile = {
flickerstreak@28 25 hide = false
flickerstreak@28 26 }
flickerstreak@25 27 }
flickerstreak@25 28 )
flickerstreak@28 29 self.db.RegisterCallback(self,"OnProfileChanged")
flickerstreak@43 30 self.db.RegisterCallback(self,"OnProfileReset","OnProfileChanged")
flickerstreak@25 31
flickerstreak@25 32 self.hiddenFrame = CreateFrame("Frame")
flickerstreak@25 33 self.hiddenFrame:Hide()
flickerstreak@60 34
flickerstreak@60 35 ReAction:RegisterOptions(self, {
flickerstreak@60 36 hideBlizzard = {
flickerstreak@60 37 type = "toggle",
flickerstreak@60 38 handler = self,
flickerstreak@60 39 name = L["Hide Blizzard Action Bars"],
flickerstreak@60 40 desc = L["Hide the default main bar and extra action bars"],
flickerstreak@60 41 get = "IsHidden",
flickerstreak@60 42 set = function(info,value) self:SetHidden(value) end,
flickerstreak@60 43 disabled = InCombatLockdown
flickerstreak@60 44 },
flickerstreak@60 45 }, true) -- global
flickerstreak@60 46
flickerstreak@25 47 end
flickerstreak@25 48
flickerstreak@25 49 function module:OnEnable()
flickerstreak@25 50 if self.db.profile.hide then
flickerstreak@25 51 self:HideAll(true)
flickerstreak@25 52 end
flickerstreak@38 53
flickerstreak@38 54 -- reroute blizzard action bar config to ReAction config window
flickerstreak@38 55 InterfaceOptionsActionBarsPanel:HookScript("OnShow",
flickerstreak@38 56 function()
flickerstreak@41 57 if module:IsEnabled() and module:IsHidden() then
flickerstreak@38 58 ReAction:ShowConfig()
flickerstreak@38 59 end
flickerstreak@38 60 end )
flickerstreak@25 61 end
flickerstreak@25 62
flickerstreak@25 63 function module:OnDisable()
flickerstreak@25 64 self:ShowAll(true)
flickerstreak@25 65 end
flickerstreak@25 66
flickerstreak@28 67 function module:OnProfileChanged()
flickerstreak@25 68 if self.db.profile.hide then
flickerstreak@28 69 module:HideAll(true)
flickerstreak@25 70 else
flickerstreak@28 71 module:ShowAll(true)
flickerstreak@25 72 end
flickerstreak@25 73 end
flickerstreak@25 74
flickerstreak@25 75 local frames = {
flickerstreak@25 76 MainMenuBar,
flickerstreak@25 77 MultiBarLeft,
flickerstreak@25 78 MultiBarRight,
flickerstreak@25 79 MultiBarBottomLeft,
flickerstreak@25 80 MultiBarBottomRight,
flickerstreak@54 81 -- possess bar frame needs to be pulled out separately: stash its children away
flickerstreak@54 82 PossessBarLeft,
flickerstreak@54 83 PossessBarRight,
flickerstreak@54 84 PossessButton1,
flickerstreak@54 85 PossessButton2
flickerstreak@25 86 }
flickerstreak@25 87
flickerstreak@25 88 local hidden = { }
flickerstreak@25 89
flickerstreak@25 90 function module:HideAll( force )
flickerstreak@25 91 if not(self.db.profile.hide) or force then
flickerstreak@25 92 self.db.profile.hide = true
flickerstreak@25 93 for _, f in pairs(frames) do
flickerstreak@25 94 hidden[f] = hidden[f] or { parent = f:GetParent(), wasShown = f:IsShown() }
flickerstreak@25 95 f:SetParent(self.hiddenFrame)
flickerstreak@25 96 f:Hide()
flickerstreak@25 97 end
flickerstreak@25 98 end
flickerstreak@54 99 PossessBarFrame:SetParent(UIParent)
flickerstreak@54 100 PossessBarFrame:EnableMouse(false)
flickerstreak@25 101 end
flickerstreak@25 102
flickerstreak@25 103 function module:ShowAll( force )
flickerstreak@54 104 PossessBarFrame:EnableMouse(true)
flickerstreak@54 105 PossessBarFrame:SetParent(MainMenuBar)
flickerstreak@25 106 if self.db.profile.hide or force then
flickerstreak@25 107 self.db.profile.hide = false
flickerstreak@25 108
flickerstreak@25 109 for _, f in pairs(frames) do
flickerstreak@25 110 local h = hidden[f]
flickerstreak@25 111 if h then
flickerstreak@25 112 f:SetParent(h.parent)
flickerstreak@25 113 if h.wasShown then
flickerstreak@25 114 f:Show()
flickerstreak@25 115 end
flickerstreak@25 116 end
flickerstreak@25 117 end
flickerstreak@25 118 end
flickerstreak@25 119 end
flickerstreak@25 120
flickerstreak@25 121 function module:IsHidden()
flickerstreak@25 122 return self.db.profile.hide
flickerstreak@25 123 end
flickerstreak@25 124
flickerstreak@25 125 function module:SetHidden(h)
flickerstreak@25 126 if h then
flickerstreak@25 127 self:HideAll()
flickerstreak@25 128 else
flickerstreak@25 129 self:ShowAll()
flickerstreak@25 130 end
flickerstreak@25 131 end
flickerstreak@25 132