# HG changeset patch # User Flick # Date 1290113940 28800 # Node ID 97949dbe987f8e8a96c6807f71db2295c9bd8220 # Parent c24ac8ee1e45857c35b8f241a3782e884ee9c7c0 Demodularize HideBlizzard - added framework for updating profile database - removed unused profile.defaultBars[] diff -r c24ac8ee1e45 -r 97949dbe987f Options.lua --- a/Options.lua Tue Nov 16 21:49:54 2010 -0800 +++ b/Options.lua Thu Nov 18 12:59:00 2010 -0800 @@ -40,10 +40,9 @@ type = "toggle", name = L["Hide Blizzard Action Bars"], desc = L["Hide the default main bar and extra action bars"], - handler = self:GetModule("HideBlizzard"), - get = "IsHidden", - set = "SetHidden", - disabled = "OptionDisabled", + get = "OptionGetHideBlizzardBars", + set = "OptionSetHideBlizzardBars", + disabled = InCombatLockdown, width = "full", order = 3, }, @@ -51,10 +50,9 @@ type = "toggle", name = L["Hide Blizzard Vehicle Bar"], desc = L["Hide the default vechicle action bar"], - handler = self:GetModule("HideBlizzard"), - get = "IsHidden", - set = "SetHidden", - disabled = "OptionDisabled", + get = "OptionGetHideBlizzardVehicleBar", + set = "OptionSetHideBlizzardVehicleBar", + disabled = function() return InCombatLockdown() or ReAction:OptionGetHideBlizzardBars() == false end, width = "full", order = 4, }, @@ -139,6 +137,14 @@ showAlert = true, whileDead = true, } + + -- reroute blizzard action bar config to ReAction config window + InterfaceOptionsActionBarsPanel:HookScript("OnShow", + function() + if ReAction:OptionGetHideBlizzardBars() then + ReAction:ShowOptions() + end + end ) end @@ -181,6 +187,25 @@ end +function ReAction:OptionSetHideBlizzardBars( info, hide ) + self.db.profile.options.hideBlizzardBars = hide + self:ManageBlizzardBars() +end + +function ReAction:OptionGetHideBlizzardBars() + return self.db.profile.options.hideBlizzardBars +end + +function ReAction:OptionSetHideBlizzardVehicleBar( info, hide ) + self.db.profile.options.hideBlizzardVehicleBar = hide + self:ManageBlizzardBars() +end + +function ReAction:OptionGetHideBlizzardVehicleBar() + return self.db.profile.options.hideBlizzardVehicleBar +end + + -- export to LDB local LDB = LibStub:GetLibrary("LibDataBroker-1.1") if LDB then diff -r c24ac8ee1e45 -r 97949dbe987f ReAction.lua --- a/ReAction.lua Tue Nov 16 21:49:54 2010 -0800 +++ b/ReAction.lua Thu Nov 18 12:59:00 2010 -0800 @@ -36,16 +36,30 @@ self.db = LibStub("AceDB-3.0"):New("ReAction_DB", { profile = { + dbversion = nil, bars = { }, - defaultBar = { }, + options = { + hideBlizzardBars = false, + hideBlizzardVehicleBar = false, + }, + }, + global = { + skipKeybindWarning = false, } }, true -- use global 'Default' (locale-specific) ) + self:UpdateDB() + self.bars = { } self.defaultBarConfig = { } + -- It's fairly normal to use the Blizzard vehicle bar, and to have + -- your regular buttons in the same location. If you do this, and don't + -- bother to hide your buttons, they'll obscure some parts of the vehicle bar. + VehicleMenuBar:SetFrameLevel(VehicleMenuBar:GetFrameLevel()+3) + self.callbacks = LibStub("CallbackHandler-1.0"):New(self) LKB.RegisterCallback(self,"LIBKEYBOUND_ENABLED") LKB.RegisterCallback(self,"LIBKEYBOUND_DISABLED") @@ -143,7 +157,7 @@ config.y = config.y or 200 config.x = config.x or 0 end - config = config or profile.bars[name] or tcopy(profile.defaultBar) + config = config or profile.bars[name] or { } profile.bars[name] = config local bar = self.Bar:New( name, config ) -- ReAction.Bar defined in Bar.lua @@ -174,6 +188,8 @@ function ReAction:InitializeBars() if not self.barsInitialized then + self:ManageBlizzardBars() + for name, config in pairs(self.db.profile.bars) do if config then self:CreateBar(name, config) @@ -232,6 +248,37 @@ end end +local blizzFrames = { + MainMenuBar, + MultiBarLeft, + MultiBarRight, + MultiBarBottomLeft, + MultiBarBottomRight, +} + +local hideFrame = CreateFrame("Frame") +hideFrame:Hide() +local hiddenParents = { } +local function ManageBlizzFrame(f, hide) + if hide and not hiddenParents[f] then + hiddenParents[f] = f:GetParent() + f:SetParent(hideFrame) + elseif not hide and hiddenParents[f] then + f:SetParent(hiddenParents[f]) + hiddenParents[f] = nil + if f:IsShown() then + f:Show() -- refresh + end + end +end + +function ReAction:ManageBlizzardBars() + for _, f in pairs(blizzFrames) do + ManageBlizzFrame(f, self.db.profile.options.hideBlizzardBars) + end + ManageBlizzFrame(VehicleMenuBar, self.db.profile.options.hideBlizzardVehicleBar) +end + function ReAction:RegisterBarType( name, config, isDefaultChoice ) self.defaultBarConfig[name] = config if isDefaultChoice then diff -r c24ac8ee1e45 -r 97949dbe987f ReAction.xml --- a/ReAction.xml Tue Nov 16 21:49:54 2010 -0800 +++ b/ReAction.xml Thu Nov 18 12:59:00 2010 -0800 @@ -8,6 +8,7 @@