From 2ed22639682f304bc0b9c6d5ec3e3ea47329f009 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Fri, 20 Feb 2009 23:08:35 +0100 Subject: [PATCH] Fix all and any white-space errors --- ActionBar.lua | 18 ++++----- ActionBarStates.lua | 34 ++++++++-------- ActionBars.lua | 22 +++++------ ActionButton.lua | 56 +++++++++++++------------- BagBar.lua | 18 ++++----- Bar.lua | 30 +++++++------- Bartender4.lua | 40 +++++++++---------- Bindings.xml | 1 - ButtonBar.lua | 22 +++++------ MicroMenu.lua | 10 ++--- Options/ActionBar.lua | 26 ++++++------- Options/ActionBarStates.lua | 32 +++++++-------- Options/BagBar.lua | 6 +-- Options/Bar.lua | 22 +++++------ Options/ButtonBar.lua | 8 ++-- Options/MicroMenu.lua | 2 +- Options/Options.lua | 24 ++++++------ Options/PetBar.lua | 8 ++-- Options/RepXPBar.lua | 4 +- Options/StanceBar.lua | 4 +- Options/VehicleBar.lua | 2 +- PetBar.lua | 14 +++---- PetButton.lua | 36 ++++++++--------- RepXPBar.lua | 10 ++--- StanceBar.lua | 50 ++++++++++++------------ VehicleBar.lua | 16 ++++---- libs/SimpleSticky.lua | 78 ++++++++++++++++++------------------- 27 files changed, 296 insertions(+), 297 deletions(-) diff --git a/ActionBar.lua b/ActionBar.lua index 73ef381..eb5f6f8 100644 --- a/ActionBar.lua +++ b/ActionBar.lua @@ -18,9 +18,9 @@ end -- Apply the specified config to the bar and refresh all settings function ActionBar:ApplyConfig(config) ButtonBar.ApplyConfig(self, config) - + if not self.config.position then initialPosition(self) end - + self:UpdateButtons() self:UpdateSelfCast(true) self:UpdateStates() @@ -33,15 +33,15 @@ function ActionBar:UpdateButtons(numbuttons) else numbuttons = min(self.config.buttons, 12) end - + local buttons = self.buttons or {} - + local updateBindings = (numbuttons > #buttons) -- create more buttons if needed for i = (#buttons+1), numbuttons do buttons[i] = Bartender4.Button:Create(i, self) end - + -- show active buttons for i = 1, numbuttons do buttons[i]:SetParent(self) @@ -49,23 +49,23 @@ function ActionBar:UpdateButtons(numbuttons) buttons[i]:SetAttribute("statehidden", nil) buttons[i]:UpdateAction(true) end - + -- hide inactive buttons for i = (numbuttons + 1), #buttons do buttons[i]:Hide() buttons[i]:SetParent(UIParent) buttons[i]:SetAttribute("statehidden", true) end - + self.numbuttons = numbuttons self.buttons = buttons - + self:UpdateButtonLayout() self:SetGrid() if updateBindings and self.id == "1" then self.module:ReassignBindings() end - + -- need to re-set clickthrough after creating new buttons self:SetClickThrough() end diff --git a/ActionBarStates.lua b/ActionBarStates.lua index 3b47dfc..85bae0e 100644 --- a/ActionBarStates.lua +++ b/ActionBarStates.lua @@ -47,7 +47,7 @@ local DefaultStanceMap = setmetatable({}, { __index = function(t,k) } end rawset(t, k, newT) - + return newT end}) Bartender4.StanceMap = DefaultStanceMap @@ -61,24 +61,24 @@ function ActionBar:UpdateStates(returnOnly) if not stancemap and DefaultStanceMap[playerclass] then stancemap = DefaultStanceMap[playerclass] end - + self:ForAll("ClearStateAction") for i=0,11 do self:AddButtonStates(i) end - + local statedriver - + if returnOnly or not self:GetStateOption("customEnabled") then statedriver = {} local stateconfig = self.config.states if self:GetStateOption("enabled") then -- arguments will be parsed from left to right, so we have a priority here - + if self:GetStateOption("possess") then table_insert(statedriver, "[bonusbar:5]11") end - + -- highest priority have our temporary quick-swap keys for _,v in pairs(modifiers) do local page = self:GetStateOption(v) @@ -86,14 +86,14 @@ function ActionBar:UpdateStates(returnOnly) table_insert(statedriver, fmt("[mod:%s]%s", v, page)) end end - + -- second priority the manual changes using the actionbar options if self:GetStateOption("actionbar") then for i=2,6 do table_insert(statedriver, fmt("[bar:%s]%s", i, i)) end end - + -- third priority the stances if stancemap then if not stateconfig.stance[playerclass] then stateconfig.stance[playerclass] = {} end @@ -111,7 +111,7 @@ function ActionBar:UpdateStates(returnOnly) end end end - + table_insert(statedriver, tostring(self:GetDefaultState() or 0)) statedriver = table_concat(statedriver, ";") if returnOnly then @@ -120,38 +120,38 @@ function ActionBar:UpdateStates(returnOnly) else statedriver = self:GetStateOption("custom") end - + self:SetAttribute("_onstate-page", [[ self:SetAttribute("state", newstate) control:ChildUpdate("state", newstate) ]]) - + UnregisterStateDriver(self, "page") RegisterStateDriver(self, "page", statedriver or "") - + self:SetAttribute("_onstate-assist-help", [[ local state = (newstate ~= "nil") and newstate or nil control:ChildUpdate("assist-help", state) ]]) - + self:SetAttribute("_onstate-assist-harm", [[ local state = (newstate ~= "nil") and newstate or nil control:ChildUpdate("assist-harm", state) ]]) - + local preSelf = "" if Bartender4.db.profile.selfcastmodifier then preSelf = "[mod:SELFCAST]player;" end - + local preFocus = "" if Bartender4.db.profile.focuscastmodifier then preFocus = "[mod:FOCUSCAST,target=focus,exists,nodead]focus;" end - + UnregisterStateDriver(self, "assist-help") UnregisterStateDriver(self, "assist-harm") - + if self.config.autoassist then RegisterStateDriver(self, "assist-help", ("%s%s[help]nil; [target=targettarget, help]targettarget; nil"):format(preSelf, preFocus)) RegisterStateDriver(self, "assist-harm", ("%s[harm]nil; [target=targettarget, harm]targettarget; nil"):format(preFocus)) diff --git a/ActionBars.lua b/ActionBars.lua index f72696c..2892411 100644 --- a/ActionBars.lua +++ b/ActionBars.lua @@ -61,7 +61,7 @@ local defaults = { function BT4ActionBars:OnInitialize() self.db = Bartender4.db:RegisterNamespace("ActionBars", defaults) - + -- fetch the prototype information ActionBar = Bartender4.ActionBar ActionBar_MT = {__index = ActionBar} @@ -76,7 +76,7 @@ function BT4ActionBars:OnEnable() if first then self.playerclass = select(2, UnitClass("player")) self.actionbars = {} - + for i=1,10 do local config = self.db.profile.actionbars[i] if config.enabled then @@ -85,10 +85,10 @@ function BT4ActionBars:OnEnable() self:CreateBarOption(i, self.disabledoptions) end end - + first = nil end - + self:RegisterEvent("UPDATE_BINDINGS", "ReassignBindings") self:ReassignBindings() end @@ -97,7 +97,7 @@ function BT4ActionBars:SetupOptions() if not self.options then -- empty table to hold the bar options self.options = {} - + -- template for disabled bars self.disabledoptions = { general = { @@ -116,7 +116,7 @@ function BT4ActionBars:SetupOptions() } } } - + -- iterate over bars and create their option tables for i=1,10 do local config = self.db.profile.actionbars[i] @@ -170,7 +170,7 @@ function BT4ActionBars:ReassignBindings() SetOverrideBindingClick(frame, false, key, real_button) end end - + for i = 1, 120 do -- rename old bindings from Secure to only local button, real_button = ("CLICK BT4Button%dSecure:LeftButton"):format(i), ("BT4Button%d"):format(i) @@ -190,11 +190,11 @@ function BT4ActionBars:Create(id, config) local id = tostring(id) local bar = setmetatable(Bartender4.ButtonBar:Create(id, config, (L["Bar %s"]):format(id)), ActionBar_MT) bar.module = self - + self:CreateBarOption(id) - + bar:ApplyConfig() - + return bar end @@ -202,7 +202,7 @@ function BT4ActionBars:DisableBar(id) id = tonumber(id) local bar = self.actionbars[id] if not bar then return end - + bar.config.enabled = false bar:Disable() self:CreateBarOption(id, self.disabledoptions) diff --git a/ActionButton.lua b/ActionButton.lua index 2a32c89..94d5a6b 100644 --- a/ActionButton.lua +++ b/ActionButton.lua @@ -1,6 +1,6 @@ --[[ Action Button Template - + Note: Some IDs produce a special behaviour! - Button ID 132 (Last Button in Possess Bar) Creates a Leave Vehicle Button @@ -34,20 +34,20 @@ function Bartender4.Button:Create(id, parent) local button = setmetatable(CreateFrame("CheckButton", name, parent, "ActionBarButtonTemplate"), Button_MT) -- work around for "blocked" message when using /click macros GetClickFrame(name) - + -- Backwards Compat to pre-4.2.0 button names/layout _G[name .. "Secure"] = button button.Secure = button - + button.rid = id button.id = absid button.parent = parent button.stateactions = {} - + button:SetRealNormalTexture("") local oldNT = _G[("%sNormalTexture"):format(name)] oldNT:Hide() - + button.normalTexture = button:CreateTexture(("%sBTNT"):format(name)) button.normalTexture:SetWidth(66) button.normalTexture:SetHeight(66) @@ -55,15 +55,15 @@ function Bartender4.Button:Create(id, parent) button.normalTexture:SetPoint("CENTER", 0, -1) button.normalTexture:Show() - + --button:SetFrameStrata("MEDIUM") - + -- overwrite some scripts with out customized versions button:SetScript("OnEnter", onEnter) button:SetScript("OnUpdate", onUpdate) button:SetScript("OnDragStart", onDragStart) button:SetScript("OnReceiveDrag", onReceiveDrag) - + button.icon = _G[("%sIcon"):format(name)] button.border = _G[("%sBorder"):format(name)] button.cooldown = _G[("%sCooldown"):format(name)] @@ -72,14 +72,14 @@ function Bartender4.Button:Create(id, parent) button.count = _G[("%sCount"):format(name)] button.flash = _G[("%sFlash"):format(name)] button.flash:Hide() - + button:SetAttribute("type", "action") button:SetAttribute("action", absid) button:SetAttribute("useparent-unit", nil); button:SetAttribute("useparent-actionpage", nil); - + button:UpdateSelfCast() - + button:SetAttribute('_childupdate-state', [[ self:SetAttribute("state", message) local action = self:GetAttribute("action-" .. message) @@ -101,7 +101,7 @@ function Bartender4.Button:Create(id, parent) end end self:SetAttribute("action", action) - + local unit = nil -- fix unit on state change if action <= 120 then @@ -115,36 +115,36 @@ function Bartender4.Button:Create(id, parent) G_state = message G_action = action ]]) - + button:SetAttribute('_childupdate-assist-help', [[ if self:GetAttribute("assisttype-"..G_state) == 1 and G_action <= 120 then self:SetAttribute("unit", message) end G_assist_help = message ]]) - + button:SetAttribute('_childupdate-assist-harm', [[ if self:GetAttribute("assisttype-"..G_state) == 2 and G_action <= 120 then self:SetAttribute("unit", message) end G_assist_harm = message ]]) - + if LBF and parent.LBFGroup then local group = parent.LBFGroup group:AddButton(button) end - + if button.parent.config.showgrid then button:ShowGrid() end - + --self:UpdateAction(true) button:UpdateHotkeys() button:UpdateUsable() button:UpdateGrid() button:ToggleButtonElements() - + return button end @@ -182,7 +182,7 @@ function onUpdate(self, elapsed) overtime = 0 end self.flashtime = ATTACK_BUTTON_FLASH_TIME - overtime - + local flashTexture = self.flash if flashTexture:IsShown() then flashTexture:Hide() @@ -191,7 +191,7 @@ function onUpdate(self, elapsed) end end end - + if self.rangeTimer then self.rangeTimer = self.rangeTimer - elapsed if self.rangeTimer <= 0 then @@ -265,13 +265,13 @@ function Button:RefreshStateAction(state) local state = tonumber(state or self:GetAttribute("state")) or 0 local action = self.stateactions[state] self:SetAttribute("action-"..state, action) - + if action > 120 and action <= 126 then self:SetAttribute("clickbutton", _G["VehicleMenuBarActionButton"..tostring(action-120)]) elseif action == 132 then self:SetAttribute("clickbutton", PossessButton2) end - + self:SetAttribute("assisttype-"..state, nil) self:SetAttribute("unit", nil) if self.parent.config.autoassist then @@ -333,7 +333,7 @@ end function Button:UpdateHotkeys() local key = self:GetHotkey() or "" local hotkey = self.hotkey - + if key == "" or self.parent.config.hidehotkey then hotkey:SetText(RANGE_INDICATOR) hotkey:SetPoint("TOPLEFT", self, "TOPLEFT", 1, -2) @@ -352,7 +352,7 @@ end function Button:GetBindings() local keys, binding = "" - + if self.id <= 12 then binding = format("ACTIONBUTTON%d", self.id) for i = 1, select('#', GetBindingKey(binding)) do @@ -363,7 +363,7 @@ function Button:GetBindings() keys = keys .. GetBindingText(hotKey,'KEY_') end end - + binding = "CLICK "..self:GetName()..":LeftButton" for i = 1, select('#', GetBindingKey(binding)) do local hotKey = select(i, GetBindingKey(binding)) @@ -413,7 +413,7 @@ function Button:UpdateUsable() local icon, hotkey = self.icon, self.hotkey local oor = Bartender4.db.profile.outofrange local oorcolor, oomcolor = Bartender4.db.profile.colors.range, Bartender4.db.profile.colors.mana - + if oor == "button" and self.outOfRange then icon:SetVertexColor(oorcolor.r, oorcolor.g, oorcolor.b) hotkey:SetVertexColor(1.0, 1.0, 1.0) @@ -423,7 +423,7 @@ function Button:UpdateUsable() else hotkey:SetVertexColor(1.0, 1.0, 1.0) end - + if isUsable or specialButtons[self.action] then icon:SetVertexColor(1.0, 1.0, 1.0) elseif notEnoughMana then @@ -440,7 +440,7 @@ function Button:SetTooltip() else GameTooltip:SetOwner(self, "ANCHOR_RIGHT") end - + if specialButtons[self.action] then GameTooltip:SetText(specialButtons[self.action].tooltip) self.UpdateTooltip = self.SetTooltip diff --git a/BagBar.lua b/BagBar.lua index bd517fe..8b3684a 100644 --- a/BagBar.lua +++ b/BagBar.lua @@ -42,12 +42,12 @@ end function BagBar:ApplyConfig(config) ButtonBar.ApplyConfig(self, config) - + if not self.config.position then self:ClearSetPoint("CENTER", 142, -18) self:SavePosition() end - + self:FeedButtons() self:UpdateButtonLayout() end @@ -76,12 +76,12 @@ function BagBar:FeedButtons() else self.buttons = {} end - + if self.config.keyring then table_insert(self.buttons, KeyRingButton) count = count + 1 end - + if not self.config.onebag then table_insert(self.buttons, CharacterBag3Slot) table_insert(self.buttons, CharacterBag2Slot) @@ -89,15 +89,15 @@ function BagBar:FeedButtons() table_insert(self.buttons, CharacterBag0Slot) count = count + 4 end - + table_insert(self.buttons, MainMenuBarBackpackButton) - + for i,v in pairs(self.buttons) do v:SetParent(self) v:Show() if v ~= KeyRingButton then v:SetNormalTexture("") - + if LBF then local group = self.LBFGroup if not v.LBFButtonData then @@ -109,10 +109,10 @@ function BagBar:FeedButtons() group:AddButton(v, v.LBFButtonData) end end - + v.ClearSetPoint = clearSetPoint end - + BagBarMod.button_count = count if BagBarMod.optionobject then BagBarMod.optionobject.table.general.args.rows.max = count diff --git a/Bar.lua b/Bar.lua index c56737f..e1d5a76 100644 --- a/Bar.lua +++ b/Bar.lua @@ -63,12 +63,12 @@ do parent.isMoving = nil end end - + function barOnClick(self) -- TODO: Hide/Show bar on Click -- TODO: Once dropdown config is stable, show dropdown on rightclick end - + function barOnUpdateFunc(self, elapsed) self.elapsed = self.elapsed + elapsed if self.elapsed > self.config.fadeoutdelay then @@ -76,7 +76,7 @@ do self.elapsed = 0 end end - + function barOnAttributeChanged(self, attribute, value) if attribute == "fade" then if value then @@ -99,16 +99,16 @@ Bartender4.Bar.barregistry = barregistry function Bartender4.Bar:Create(id, config, name) id = tostring(id) assert(not barregistry[id], "duplicated entry in barregistry.") - + local bar = setmetatable(CreateFrame("Frame", ("BT4Bar%s"):format(id), UIParent, "SecureHandlerStateTemplate"), Bar_MT) barregistry[id] = bar table_insert(snapBars, bar) - + bar.id = id bar.name = name or id bar:SetMovable(true) bar:HookScript("OnAttributeChanged", barOnAttributeChanged) - + local overlay = CreateFrame("Button", bar:GetName() .. "Overlay", bar) bar.overlay = overlay overlay:EnableMouse(true) @@ -130,22 +130,22 @@ function Bartender4.Bar:Create(id, config, name) overlay.Text:Show() overlay.Text:ClearAllPoints() overlay.Text:SetPoint("CENTER", overlay, "CENTER") - + overlay:SetScript("OnEnter", barOnEnter) overlay:SetScript("OnLeave", barOnLeave) overlay:SetScript("OnDragStart", barOnDragStart) overlay:SetScript("OnDragStop", barOnDragStop) overlay:SetScript("OnClick", barOnClick) - + overlay:SetFrameLevel(bar:GetFrameLevel() + 10) overlay:ClearAllPoints() overlay:SetAllPoints(bar) overlay:Hide() - + bar.config = config bar.elapsed = 0 bar.hidedriver = {} - + return bar end @@ -195,9 +195,9 @@ function Bar:Lock() if self.disabled or not self.unlocked then return end self.unlocked = nil self:StopDragging() - + self:ApplyVisibilityDriver() - + self.overlay:Hide() end @@ -332,7 +332,7 @@ function Bar:InitVisibilityDriver(returnOnly) UnregisterStateDriver(self, 'vis') end self.hidedriver = {} - + self:SetAttribute("_onstate-vis", [[ if not newstate then return end if newstate == "show" then @@ -345,7 +345,7 @@ function Bar:InitVisibilityDriver(returnOnly) self:Hide() end ]]) - + if self.config.visibility.custom and not returnOnly then table_insert(self.hidedriver, self.config.visibility.customdata or "") else @@ -374,7 +374,7 @@ function Bar:InitVisibilityDriver(returnOnly) end end table_insert(self.hidedriver, self.config.fadeout and "fade" or "show") - + if not returnOnly then self:ApplyVisibilityDriver() else diff --git a/Bartender4.lua b/Bartender4.lua index 11a1e65..0c07f26 100644 --- a/Bartender4.lua +++ b/Bartender4.lua @@ -25,18 +25,18 @@ function Bartender4:OnInitialize() self.db.RegisterCallback(self, "OnProfileChanged", "UpdateModuleConfigs") self.db.RegisterCallback(self, "OnProfileCopied", "UpdateModuleConfigs") self.db.RegisterCallback(self, "OnProfileReset", "UpdateModuleConfigs") - + self:SetupOptions() - + self.Locked = true self:RegisterEvent("PLAYER_REGEN_DISABLED", "CombatLockdown") - + self:HideBlizzard() - + if LDB then createLDBLauncher() end - + BINDING_HEADER_Bartender4 = "Bartender4" BINDING_CATEGORY_Bartender4 = "Action Bars" for i=1,10 do @@ -61,21 +61,21 @@ end function Bartender4:HideBlizzard() --MultiActionBar_Update = function() end MultiActionBar_UpdateGrid = function() end - + -- Hide MultiBar Buttons, but keep the bars alive for i=1,12 do _G["ActionButton" .. i]:Hide() _G["ActionButton" .. i]:UnregisterAllEvents() - + _G["MultiBarBottomLeftButton" .. i]:Hide() _G["MultiBarBottomLeftButton" .. i]:UnregisterAllEvents() - + _G["MultiBarBottomRightButton" .. i]:Hide() _G["MultiBarBottomRightButton" .. i]:UnregisterAllEvents() - + _G["MultiBarRightButton" .. i]:Hide() _G["MultiBarRightButton" .. i]:UnregisterAllEvents() - + _G["MultiBarLeftButton" .. i]:Hide() _G["MultiBarLeftButton" .. i]:UnregisterAllEvents() end @@ -90,7 +90,7 @@ function Bartender4:HideBlizzard() MainMenuBar:UnregisterAllEvents() MainMenuBar:Hide() - + MainMenuBarArtFrame:UnregisterEvent("PLAYER_ENTERING_WORLD") --MainMenuBarArtFrame:UnregisterEvent("BAG_UPDATE") MainMenuBarArtFrame:UnregisterEvent("ACTIONBAR_PAGE_CHANGED") @@ -102,7 +102,7 @@ function Bartender4:HideBlizzard() MainMenuBarArtFrame:UnregisterEvent("UNIT_EXITING_VEHICLE") MainMenuBarArtFrame:UnregisterEvent("UNIT_EXITED_VEHICLE") MainMenuBarArtFrame:Hide() - + --MainMenuExpBar:UnregisterAllEvents() --MainMenuExpBar:Hide() @@ -123,7 +123,7 @@ end function Bartender4:RegisterDefaultsKey(key, subdefaults) defaults.profile[key] = subdefaults - + self.db:RegisterDefaults(defaults) end @@ -133,7 +133,7 @@ function Bartender4:UpdateModuleConfigs() self:Lock() unlock = true end - + for k,v in AceAddon:IterateModulesOfAddon(self) do v:ToggleModule() if v:IsEnabled() and type(v.ApplyConfig) == "function" then @@ -143,7 +143,7 @@ function Bartender4:UpdateModuleConfigs() if LDB and LDBIcon then LDBIcon:Refresh("Bartender4", Bartender4.db.profile.minimapIcon) end - + if unlock then self:Unlock() end @@ -167,7 +167,7 @@ do function getSnap() return Bartender4.db.profile.snapping end - + function setSnap(value) Bartender4.Bar:ForAll("StopDragging") Bartender4.db.profile.snapping = value @@ -179,7 +179,7 @@ function Bartender4:ShowUnlockDialog() if not self.unlock_dialog then local f = CreateFrame('Frame', 'Bartender4Dialog', UIParent) f:SetFrameStrata('DIALOG') - f:SetToplevel(true) + f:SetToplevel(true) f:EnableMouse(true) f:SetClampedToScreen(true) f:SetWidth(360) @@ -199,12 +199,12 @@ function Bartender4:ShowUnlockDialog() local tr = f:CreateTitleRegion() tr:SetAllPoints(f) - + local header = f:CreateTexture(nil, 'ARTWORK') header:SetTexture('Interface\\DialogFrame\\UI-DialogBox-Header') header:SetWidth(256); header:SetHeight(64) header:SetPoint('TOP', 0, 12) - + local title = f:CreateFontString('ARTWORK') title:SetFontObject('GameFontNormal') title:SetPoint('TOP', header, 'TOP', 0, -14) @@ -340,7 +340,7 @@ function createLDBLauncher() tooltip:AddLine(L_BT_RIGHT) end, }) - + if LDBIcon then LDBIcon:Register("Bartender4", LDBObj, Bartender4.db.profile.minimapIcon) end diff --git a/Bindings.xml b/Bindings.xml index 688e2e8..e1a050e 100644 --- a/Bindings.xml +++ b/Bindings.xml @@ -139,5 +139,4 @@ - \ No newline at end of file diff --git a/ButtonBar.lua b/ButtonBar.lua index b003167..688fbad 100644 --- a/ButtonBar.lua +++ b/ButtonBar.lua @@ -26,17 +26,17 @@ local LBF = LibStub("LibButtonFacade", true) function Bartender4.ButtonBar:Create(id, config, name) local bar = setmetatable(Bartender4.Bar:Create(id, config, name), ButtonBar_MT) - + if LBF then bar.LBFGroup = LBF:Group("Bartender4", tostring(id)) bar.LBFGroup.SkinID = config.skin.ID or "Blizzard" bar.LBFGroup.Backdrop = config.skin.Backdrop bar.LBFGroup.Gloss = config.skin.Gloss bar.LBFGroup.Colors = config.skin.Colors - + LBF:RegisterSkinCallback("Bartender4", self.SkinChanged, self) end - + return bar end @@ -44,7 +44,7 @@ local barregistry = Bartender4.Bar.barregistry function Bartender4.ButtonBar:SkinChanged(SkinID, Gloss, Backdrop, Group, Button, Colors) local bar = barregistry[tostring(Group)] if not bar then return end - + bar:SkinChanged(SkinID, Gloss, Backdrop, Colors, Button) end @@ -135,13 +135,13 @@ ButtonBar.button_height = 36 function ButtonBar:UpdateButtonLayout() local buttons = self.buttons local pad = self:GetPadding() - + local numbuttons = self.numbuttons or #buttons - + -- bail out if the bar has no buttons, for whatever reason -- (eg. stanceless class, or no stances learned yet, etc.) if numbuttons == 0 then return end - + local Rows = self:GetRows() local ButtonPerRow = math_ceil(numbuttons / Rows) -- just a precaution Rows = math_ceil(numbuttons / ButtonPerRow) @@ -149,12 +149,12 @@ function ButtonBar:UpdateButtonLayout() Rows = numbuttons ButtonPerRow = 1 end - + local hpad = pad + (self.hpad_offset or 0) local vpad = pad + (self.vpad_offset or 0) - + self:SetSize((self.button_width + hpad) * ButtonPerRow - pad + 8, (self.button_height + vpad) * Rows - pad + 8) - + -- anchor button 1 to the topleft corner of the bar buttons[1]:ClearSetPoint("TOPLEFT", self, "TOPLEFT", 5 - (self.hpad_offset or 0), -3 - (self.vpad_offset or 0)) -- and anchor all other buttons relative to our button 1 @@ -167,7 +167,7 @@ function ButtonBar:UpdateButtonLayout() buttons[i]:ClearSetPoint("TOPLEFT", buttons[i-1], "TOPRIGHT", hpad, 0) end end - + if not LBF then for i = 1, #buttons do local button = buttons[i] diff --git a/MicroMenu.lua b/MicroMenu.lua index e0c193b..8efbc51 100644 --- a/MicroMenu.lua +++ b/MicroMenu.lua @@ -42,12 +42,12 @@ function MicroMenuMod:OnEnable() table_insert(buttons, MainMenuMicroButton) table_insert(buttons, HelpMicroButton) self.bar.buttons = buttons - + MicroMenuMod.button_count = #buttons - + self:RawHook("UpdateTalentButton", noopFunc, true) self:RawHook("AchievementMicroButton_Update", noopFunc, true) - + for i,v in pairs(buttons) do v:SetParent(self.bar) v:Show() @@ -69,11 +69,11 @@ MicroMenuBar.button_height = 58 MicroMenuBar.vpad_offset = -21 function MicroMenuBar:ApplyConfig(config) ButtonBar.ApplyConfig(self, config) - + if not self.config.position then self:ClearSetPoint("CENTER", -105, 27) self:SavePosition() end - + self:UpdateButtonLayout() end diff --git a/Options/ActionBar.lua b/Options/ActionBar.lua index 0f88eec..1392634 100644 --- a/Options/ActionBar.lua +++ b/Options/ActionBar.lua @@ -18,28 +18,28 @@ do enabled = "Enabled", grid = "Grid", } - + -- retrieves a valid bar object from the modules actionbars table function getBar(id) local bar = module.actionbars[tonumber(id)] assert(bar, ("Invalid bar id in options table. (%s)"):format(id)) return bar end - + -- calls a function on the bar function callFunc(bar, type, option, ...) local func = type .. (optionMap[option] or option) assert(bar[func], ("Invalid get/set function %s in bar %s."):format(func, bar.id)) return bar[func](bar, ...) end - + -- universal function to get a option function optGetter(info) local bar = getBar(info[2]) local option = info[#info] return callFunc(bar, "Get", option) end - + -- universal function to set a option function optSetter(info, ...) local bar = getBar(info[2]) @@ -58,7 +58,7 @@ end function module:GetOptionsObject() if not self.baroptions then local obj = ButtonBar.GetOptionObject(self) - + local cat_general = { enabled ={ order = 4, @@ -87,7 +87,7 @@ function module:GetOptionsObject() }, } obj:AddElementGroup("general", cat_general) - + local states = { type = "group", name = L["State Configuration"], @@ -95,20 +95,20 @@ function module:GetOptionsObject() args = self:GetStateOptionsTable(), } obj:NewCategory("state", states) - + self.baroptions = obj end - + return self.baroptions end function module:CreateBarOption(id, options) if not self.options then return end - - if not options then - options = self:GetOptionsTable() + + if not options then + options = self:GetOptionsTable() end - + id = tostring(id) if not self.options[id] then self.options[id] = { @@ -120,7 +120,7 @@ function module:CreateBarOption(id, options) } end self.options[id].args = options - + -- register options in the BT GUI Bartender4:RegisterBarOptions(id, self.options[id]) end diff --git a/Options/ActionBarStates.lua b/Options/ActionBarStates.lua index 7982f4e..e6a713d 100644 --- a/Options/ActionBarStates.lua +++ b/Options/ActionBarStates.lua @@ -6,7 +6,7 @@ local module = Bartender4:GetModule("ActionBars") local optGetter, optSetter do local getBar, optionMap, callFunc - + optionMap = { stance = "StanceStateOption", enabled = "StateOption", @@ -25,21 +25,21 @@ do assert(bar, "Invalid bar id in options table.") return bar end - + -- calls a function on the bar function callFunc(bar, type, option, ...) local func = type .. (optionMap[option] or option) assert(bar[func], "Invalid get/set function."..func) return bar[func](bar, ...) end - + -- universal function to get a option function optGetter(info) local bar = getBar(info[2]) local option = info.arg or info[#info] return callFunc(bar, "Get", option, info[#info]) end - + -- universal function to set a option function optSetter(info, ...) local bar = getBar(info[2]) @@ -51,18 +51,18 @@ end local hasStances -local validStanceTable = { - [0] = L["Don't Page"], +local validStanceTable = { + [0] = L["Don't Page"], (L["Page %2d"]):format(1), - (L["Page %2d"]):format(2), - (L["Page %2d"]):format(3), - (L["Page %2d"]):format(4), - (L["Page %2d"]):format(5), - (L["Page %2d"]):format(6), - (L["Page %2d"]):format(7), + (L["Page %2d"]):format(2), + (L["Page %2d"]):format(3), + (L["Page %2d"]):format(4), + (L["Page %2d"]):format(5), + (L["Page %2d"]):format(6), + (L["Page %2d"]):format(7), (L["Page %2d"]):format(8), - (L["Page %2d"]):format(9), - (L["Page %2d"]):format(10) + (L["Page %2d"]):format(9), + (L["Page %2d"]):format(10) } @@ -255,7 +255,7 @@ function module:GetStateOptionsTable() multiline = true, }, } - + do local defstancemap = Bartender4.StanceMap[playerclass] if defstancemap then @@ -266,6 +266,6 @@ function module:GetStateOptionsTable() end end end - + return options end diff --git a/Options/BagBar.lua b/Options/BagBar.lua index 9ef9b70..bb4b61d 100644 --- a/Options/BagBar.lua +++ b/Options/BagBar.lua @@ -19,7 +19,7 @@ function BagBarMod:SetupOptions() handler = self, } self.optionobject:AddElement("general", "enabled", enabled) - + local onebag = { type = "toggle", order = 80, @@ -29,7 +29,7 @@ function BagBarMod:SetupOptions() set = function(info, state) self.db.profile.onebag = state; self.bar:FeedButtons(); self.bar:UpdateButtonLayout() end, } self.optionobject:AddElement("general", "onebag", onebag) - + local keyring = { type = "toggle", order = 80, @@ -39,7 +39,7 @@ function BagBarMod:SetupOptions() set = function(info, state) self.db.profile.keyring = state; self.bar:FeedButtons(); self.bar:UpdateButtonLayout() end, } self.optionobject:AddElement("general", "keyring", keyring) - + self.disabledoptions = { general = { type = "group", diff --git a/Options/Bar.lua b/Options/Bar.lua index fe8d22b..febf02f 100644 --- a/Options/Bar.lua +++ b/Options/Bar.lua @@ -20,62 +20,62 @@ do fadeoutdelay = "FadeOutDelay", clickthrough = "ClickThrough", } - + -- retrieves a valid bar object from the barregistry table function getBar(id) local bar = barregistry[tostring(id)] assert(bar, ("Invalid bar id in options table. (%s)"):format(id)) return bar end - + -- calls a function on the bar function callFunc(bar, type, option, ...) local func = type .. (optionMap[option] or option) assert(bar[func], ("Invalid get/set function %s in bar %s."):format(func, bar.id)) return bar[func](bar, ...) end - + -- universal function to get a option function optGetter(info) local bar = getBar(info[2]) local option = info[#info] return callFunc(bar, "Get", option) end - + -- universal function to set a option function optSetter(info, ...) local bar = getBar(info[2]) local option = info[#info] return callFunc(bar, "Set", option, ...) end - + function visibilityGetter(info, ...) local bar = getBar(info[2]) local option = info[#info] return bar:GetVisibilityOption(option, ...) end - + function visibilitySetter(info, ...) local bar = getBar(info[2]) local option = info[#info] bar:SetVisibilityOption(option, ...) end - + function customEnabled(info) local bar = getBar(info[2]) return bar:GetVisibilityOption("custom") end - + function customDisabled(info) local bar = getBar(info[2]) return not bar:GetVisibilityOption("custom") end - + function customCopy(info) local bar = getBar(info[2]) bar:CopyCustomConditionals() end - + function clickThroughVis(info) local bar = getBar(info[2]) return (not bar.ClickThroughSupport) @@ -86,7 +86,7 @@ local _, class = UnitClass("player") local function getStanceTable() local num = GetNumShapeshiftForms() - + local tbl = {} for i = 1, num do tbl[i] = select(2, GetShapeshiftFormInfo(i)) diff --git a/Options/ButtonBar.lua b/Options/ButtonBar.lua index 3388bb9..4fdd6b6 100644 --- a/Options/ButtonBar.lua +++ b/Options/ButtonBar.lua @@ -20,28 +20,28 @@ do macrotext = "HideMacroText", hotkey = "HideHotkey", } - + -- retrieves a valid bar object from the barregistry table function getBar(id) local bar = barregistry[tostring(id)] assert(bar, ("Invalid bar id in options table. (%s)"):format(id)) return bar end - + -- calls a function on the bar function callFunc(bar, type, option, ...) local func = type .. (optionMap[option] or option) assert(bar[func], ("Invalid get/set function %s in bar %s."):format(func, bar.id)) return bar[func](bar, ...) end - + -- universal function to get a option function optGetter(info) local bar = getBar(info[2]) local option = info[#info] return callFunc(bar, "Get", option) end - + -- universal function to set a option function optSetter(info, ...) local bar = getBar(info[2]) diff --git a/Options/MicroMenu.lua b/Options/MicroMenu.lua index 959b4b8..ff559a9 100644 --- a/Options/MicroMenu.lua +++ b/Options/MicroMenu.lua @@ -19,7 +19,7 @@ function MicroMenuMod:SetupOptions() handler = self, } self.optionobject:AddElement("general", "enabled", enabled) - + self.disabledoptions = { general = { type = "group", diff --git a/Options/Options.lua b/Options/Options.lua index 536cb83..0edf333 100644 --- a/Options/Options.lua +++ b/Options/Options.lua @@ -7,7 +7,7 @@ do function getFunc(info) return (info.arg and Bartender4.db.profile[info.arg] or Bartender4.db.profile[info[#info]]) end - + function setFunc(info, value) local key = info.arg or info[#info] Bartender4.db.profile[key] = value @@ -147,7 +147,7 @@ local function getOptions() get = function() return Bartender4.db.profile.outofrange end, - set = function(info, value) + set = function(info, value) Bartender4.db.profile.outofrange = value Bartender4.Bar:ForAll("ApplyConfig") end, @@ -220,12 +220,12 @@ local function getOptions() end function Bartender4:ChatCommand(input) - if InCombatLockdown() then + if InCombatLockdown() then self:Print(L["Cannot access options during combat."]) return end if not input or input:trim() == "" then - LibStub("AceConfigDialog-3.0"):Open("Bartender4") + LibStub("AceConfigDialog-3.0"):Open("Bartender4") else LibStub("AceConfigCmd-3.0").HandleCommand(Bartender4, "bt", "Bartender4", input) end @@ -234,14 +234,14 @@ end function Bartender4:SetupOptions() LibStub("AceConfig-3.0"):RegisterOptionsTable("Bartender4", getOptions) AceConfigDialog:SetDefaultSize("Bartender4", 680,525) - local optFunc = function() + local optFunc = function() if InCombatLockdown() then return end - AceConfigDialog:Open("Bartender4") - --[[ + AceConfigDialog:Open("Bartender4") + --[[ local status = AceConfigDialog:GetStatusTable("Bartender4") - if not status.groups then status.groups = {} end - if not status.groups.groups then status.groups.groups = {} end - status.groups.groups["actionbars"] = true + if not status.groups then status.groups = {} end + if not status.groups.groups then status.groups.groups = {} end + status.groups.groups["actionbars"] = true ]] end self:RegisterChatCommand( "bar", "ChatCommand") @@ -280,7 +280,7 @@ function optionParent:AddElement(category, element, data, ...) end lvl = lvl.args[key] end - + lvl.args[element] = data end @@ -298,6 +298,6 @@ function Bartender4:NewOptionObject(otbl) for k, v in pairs(optionParent) do tbl[k] = v end - + return tbl end diff --git a/Options/PetBar.lua b/Options/PetBar.lua index 6c46e76..09533ec 100644 --- a/Options/PetBar.lua +++ b/Options/PetBar.lua @@ -8,9 +8,9 @@ local ButtonBar = Bartender4.ButtonBar.prototype function PetBarMod:SetupOptions() if not self.options then self.optionobject = ButtonBar:GetOptionObject() - + self.optionobject.table.general.args.rows.max = 10 - + local enabled = { type = "toggle", order = 1, @@ -21,7 +21,7 @@ function PetBarMod:SetupOptions() handler = self, } self.optionobject:AddElement("general", "enabled", enabled) - + self.disabledoptions = { general = { type = "group", @@ -33,7 +33,7 @@ function PetBarMod:SetupOptions() } } } - + self.options = { order = 30, type = "group", diff --git a/Options/RepXPBar.lua b/Options/RepXPBar.lua index fe295bd..03b81f5 100644 --- a/Options/RepXPBar.lua +++ b/Options/RepXPBar.lua @@ -17,7 +17,7 @@ function RepBarMod:SetupOptions() handler = self, } self.optionobject:AddElement("general", "enabled", enabled) - + self.disabledoptions = { general = { type = "group", @@ -56,7 +56,7 @@ function XPBarMod:SetupOptions() handler = self, } self.optionobject:AddElement("general", "enabled", enabled) - + self.disabledoptions = { general = { type = "group", diff --git a/Options/StanceBar.lua b/Options/StanceBar.lua index 67b056b..3fb5428 100644 --- a/Options/StanceBar.lua +++ b/Options/StanceBar.lua @@ -20,7 +20,7 @@ function StanceBarMod:SetupOptions() handler = self, } self.optionobject:AddElement("general", "enabled", enabled) - + self.disabledoptions = { general = { type = "group", @@ -32,7 +32,7 @@ function StanceBarMod:SetupOptions() } } } - + self.options = { order = 30, type = "group", diff --git a/Options/VehicleBar.lua b/Options/VehicleBar.lua index 141cfde..b58b5fa 100644 --- a/Options/VehicleBar.lua +++ b/Options/VehicleBar.lua @@ -19,7 +19,7 @@ function VehicleBarMod:SetupOptions() handler = self, } self.optionobject:AddElement("general", "enabled", enabled) - + self.disabledoptions = { general = { type = "group", diff --git a/PetBar.lua b/PetBar.lua index fe400ea..f24e726 100644 --- a/PetBar.lua +++ b/PetBar.lua @@ -27,17 +27,17 @@ end function PetBarMod:OnEnable() if not self.bar then self.bar = setmetatable(Bartender4.ButtonBar:Create("PetBar", self.db.profile, L["Pet Bar"]), {__index = PetBar}) - + local buttons = {} for i=1,10 do buttons[i] = Bartender4.PetButton:Create(i, self.bar) end self.bar.buttons = buttons - + self.bar:SetScript("OnEvent", PetBar.OnEvent) end self.bar:Enable() - + self.bar:RegisterEvent("PLAYER_CONTROL_LOST") self.bar:RegisterEvent("PLAYER_CONTROL_GAINED") self.bar:RegisterEvent("PLAYER_FARSIGHT_FOCUS_CHANGED") @@ -48,10 +48,10 @@ function PetBarMod:OnEnable() self.bar:RegisterEvent("PET_BAR_UPDATE_COOLDOWN") self.bar:RegisterEvent("PET_BAR_SHOWGRID") self.bar:RegisterEvent("PET_BAR_HIDEGRID") - + self:ApplyConfig() self:ToggleOptions() - + self:RegisterEvent("UPDATE_BINDINGS", "ReassignBindings") self:ReassignBindings() end @@ -95,12 +95,12 @@ end function PetBar:ApplyConfig(config) ButtonBar.ApplyConfig(self, config) - + if not self.config.position then self:ClearSetPoint("CENTER", 0, 70) self:SavePosition() end - + self:UpdateButtonLayout() self:ForAll("Update") self:ForAll("ApplyStyle", self.config.style) diff --git a/PetButton.lua b/PetButton.lua index b1edfa6..e28566e 100644 --- a/PetButton.lua +++ b/PetButton.lua @@ -43,40 +43,40 @@ function Bartender4.PetButton:Create(id, parent) button.showgrid = 0 button.id = id button.parent = parent - + button:SetFrameStrata("MEDIUM") button:SetID(id) - + button:UnregisterAllEvents() button:SetScript("OnEvent", nil) - + button.OnEnter = button:GetScript("OnEnter") button:SetScript("OnEnter", onEnter) - + button:SetScript("OnDragStart", onDragStart) button:SetScript("OnReceiveDrag", onReceiveDrag) - + button.flash = _G[name .. "Flash"] button.cooldown = _G[name .. "Cooldown"] button.icon = _G[name .. "Icon"] button.autocastable = _G[name .. "AutoCastable"] button.autocast = _G[name .. "Shine"] button.hotkey = _G[name .. "HotKey"] - + button:SetNormalTexture("") local oldNT = button:GetNormalTexture() oldNT:Hide() - + button.normalTexture = button:CreateTexture(("%sBTNT"):format(name)) button.normalTexture:SetAllPoints(oldNT) - + button.pushedTexture = button:GetPushedTexture() button.highlightTexture = button:GetHighlightTexture() - + button.textureCache = {} button.textureCache.pushed = button.pushedTexture:GetTexture() button.textureCache.highlight = button.highlightTexture:GetTexture() - + if LBF then local group = parent.LBFGroup button.LBFButtonData = { @@ -90,7 +90,7 @@ end function PetButtonPrototype:Update() local name, subtext, texture, isToken, isActive, autoCastAllowed, autoCastEnabled = GetPetActionInfo(self.id) - + if not isToken then self.icon:SetTexture(texture) self.tooltipName = name; @@ -98,7 +98,7 @@ function PetButtonPrototype:Update() self.icon:SetTexture(_G[texture]) self.tooltipName = _G[name] end - + self.isToken = isToken self.tooltipSubtext = subtext self:SetChecked(isActive and 1 or 0) @@ -112,7 +112,7 @@ function PetButtonPrototype:Update() self.autocastable:Hide() AutoCastShine_AutoCastStop(self.autocast) end - + if texture then if GetPetActionsUsable() then SetDesaturation(self.icon, nil) @@ -146,7 +146,7 @@ end function PetButtonPrototype:UpdateHotkeys() local key = self:GetHotkey() or "" local hotkey = self.hotkey - + if key == "" or self.parent.config.hidehotkey then hotkey:Hide() else @@ -172,7 +172,7 @@ end function PetButtonPrototype:HideButton() self.textureCache.pushed = self.pushedTexture:GetTexture() self.textureCache.highlight = self.highlightTexture:GetTexture() - + self.pushedTexture:SetTexture("") self.highlightTexture:SetTexture("") if LBF then @@ -210,7 +210,7 @@ end function PetButtonPrototype:GetBindings() local keys, binding = "" - + binding = format("BONUSACTIONBUTTON%d", self.id) for i = 1, select('#', GetBindingKey(binding)) do local hotKey = select(i, GetBindingKey(binding)) @@ -219,7 +219,7 @@ function PetButtonPrototype:GetBindings() end keys = keys .. GetBindingText(hotKey,'KEY_') end - + binding = "CLICK "..self:GetName()..":LeftButton" for i = 1, select('#', GetBindingKey(binding)) do local hotKey = select(i, GetBindingKey(binding)) @@ -241,7 +241,7 @@ function PetButtonPrototype:ClearBindings() while GetBindingKey(binding) do SetBinding(GetBindingKey(binding), nil) end - + binding = "CLICK "..self:GetName()..":LeftButton" while GetBindingKey(binding) do SetBinding(GetBindingKey(binding), nil) diff --git a/RepXPBar.lua b/RepXPBar.lua index 089de8b..38bdf22 100644 --- a/RepXPBar.lua +++ b/RepXPBar.lua @@ -24,9 +24,9 @@ function RepBarMod:OnEnable() if not self.bar then self.bar = setmetatable(Bartender4.Bar:Create("Rep", self.db.profile, L["Reputation Bar"]), {__index = RepBar}) self.bar.content = ReputationWatchBar - + hooksecurefunc("ReputationWatchBar_Update", function() self.bar:PerformLayout() end) - + self.bar.content:SetParent(self.bar) self.bar.content:Show() self.bar.content:SetFrameLevel(self.bar:GetFrameLevel() + 1) @@ -42,12 +42,12 @@ end function RepBar:ApplyConfig(config) Bar.ApplyConfig(self, config) - + if not self.config.position then self:ClearSetPoint("CENTER") self:SavePosition() end - + self:PerformLayout() end @@ -79,7 +79,7 @@ function XPBarMod:OnEnable() if not self.bar then self.bar = setmetatable(Bartender4.Bar:Create("XP", self.db.profile, L["XP Bar"]), {__index = XPBar}) self.bar.content = MainMenuExpBar - + self.bar.content:SetParent(self.bar) self.bar.content:Show() self.bar.content:SetFrameLevel(self.bar:GetFrameLevel() + 1) diff --git a/StanceBar.lua b/StanceBar.lua index 928bcdd..8de7a52 100644 --- a/StanceBar.lua +++ b/StanceBar.lua @@ -32,7 +32,7 @@ function StanceBarMod:OnEnable() self.bar:SetScript("OnEvent", StanceBar.OnEvent) end self.bar:Enable() - + self:ToggleOptions() self.bar:RegisterEvent("PLAYER_ENTERING_WORLD") self.bar:RegisterEvent("UPDATE_SHAPESHIFT_FORMS") @@ -51,7 +51,7 @@ StanceBarMod.button_count = 10 function StanceBarMod:ApplyConfig() if not self:IsEnabled() then return end self.bar:ApplyConfig(self.db.profile) - + if GetNumShapeshiftForms() == 0 then self:Disable() end @@ -74,9 +74,9 @@ function StanceButtonPrototype:Update() if not self:IsShown() then return end local id = self:GetID() local texture, name, isActive, isCastable = GetShapeshiftFormInfo(id) - + self.icon:SetTexture(texture) - + -- manage cooldowns if texture then self.cooldown:Show() @@ -85,26 +85,26 @@ function StanceButtonPrototype:Update() end local start, duration, enable = GetShapeshiftFormCooldown(id) CooldownFrame_SetTimer(self.cooldown, start, duration, enable) - + if isActive then self:SetChecked(1) else self:SetChecked(0) end - + if isCastable then self.icon:SetVertexColor(1.0, 1.0, 1.0) else self.icon:SetVertexColor(0.4, 0.4, 0.4) end - + self:UpdateHotkeys() end function StanceButtonPrototype:UpdateHotkeys() local key = self:GetHotkey() or "" local hotkey = self.hotkey - + if key == "" or self.parent.config.hidehotkey then hotkey:Hide() else @@ -120,7 +120,7 @@ end function StanceButtonPrototype:GetBindings() local keys, binding = "" - + binding = format("SHAPESHIFTBUTTON%d", self:GetID()) for i = 1, select('#', GetBindingKey(binding)) do local hotKey = select(i, GetBindingKey(binding)) @@ -129,7 +129,7 @@ function StanceButtonPrototype:GetBindings() end keys = keys .. GetBindingText(hotKey,'KEY_') end - + binding = "CLICK "..self:GetName()..":LeftButton" for i = 1, select('#', GetBindingKey(binding)) do local hotKey = select(i, GetBindingKey(binding)) @@ -151,7 +151,7 @@ function StanceButtonPrototype:ClearBindings() while GetBindingKey(binding) do SetBinding(GetBindingKey(binding), nil) end - + binding = "CLICK "..self:GetName()..":LeftButton" while GetBindingKey(binding) do SetBinding(GetBindingKey(binding), nil) @@ -188,10 +188,10 @@ function StanceBarMod:CreateStanceButton(id) button.normalTexture:SetTexture("") -- button.checkedTexture = button:GetCheckedTexture() -- button.checkedTexture:SetTexture("") - + button.OnEnter = button:GetScript("OnEnter") button:SetScript("OnEnter", onEnter) - + if LBF then local group = self.bar.LBFGroup button.LBFButtonData = { @@ -199,18 +199,18 @@ function StanceBarMod:CreateStanceButton(id) } group:AddButton(button, button.LBFButtonData) end - + return button end function StanceBar:ApplyConfig(config) ButtonBar.ApplyConfig(self, config) - + if not self.config.position then self:ClearSetPoint("CENTER", -55, -10) self:SavePosition() end - + self:UpdateStanceButtons() self:ForAll("ApplyStyle", self.config.style) end @@ -219,37 +219,37 @@ StanceBar.button_width = 30 StanceBar.button_height = 30 function StanceBar:UpdateStanceButtons() local buttons = self.buttons or {} - + local num_stances = GetNumShapeshiftForms() - + local updateBindings = (num_stances > #buttons) - + for i = (#buttons+1), num_stances do buttons[i] = StanceBarMod:CreateStanceButton(i) end - + for i = 1, num_stances do buttons[i]:Show() buttons[i]:Update() end - + for i = num_stances+1, #buttons do buttons[i]:Hide() end - + StanceBarMod.button_count = num_stances if StanceBarMod.optionobject then StanceBarMod.optionobject.table.general.args.rows.max = num_stances end - + self.buttons = buttons - + self:UpdateButtonLayout() if updateBindings then StanceBarMod:ReassignBindings() end self.disabled = (GetNumShapeshiftForms() == 0) and true or nil - + -- need to re-set clickthrough after creating new buttons self:SetClickThrough() end diff --git a/VehicleBar.lua b/VehicleBar.lua index 11b948f..0eb5e30 100644 --- a/VehicleBar.lua +++ b/VehicleBar.lua @@ -28,7 +28,7 @@ function VehicleBarMod:OnEnable() self.bar = setmetatable(Bartender4.ButtonBar:Create("Vehicle", self.db.profile, L["Vehicle Bar"], true), {__index = VehicleBar}) local buttons = {VehicleMenuBarLeaveButton, VehicleMenuBarPitchUpButton, VehicleMenuBarPitchDownButton} self.bar.buttons = buttons - + VehicleBarMod.button_count = 3 for i,v in pairs(buttons) do @@ -36,21 +36,21 @@ function VehicleBarMod:OnEnable() v:Show() v.ClearSetPoint = self.bar.ClearSetPoint end - + self.bar:SetScript("OnEvent", self.bar.OnEvent) self.bar:RegisterEvent("UNIT_ENTERED_VEHICLE") - + -- setup button skins VehicleMenuBarPitchUpButton:GetNormalTexture():SetTexture([[Interface\Vehicles\UI-Vehicles-Button-Pitch-Up]]) VehicleMenuBarPitchUpButton:GetNormalTexture():SetTexCoord(0.21875, 0.765625, 0.234375, 0.78125) VehicleMenuBarPitchUpButton:GetPushedTexture():SetTexture([[Interface\Vehicles\UI-Vehicles-Button-Pitch-Down]]) VehicleMenuBarPitchUpButton:GetPushedTexture():SetTexCoord(0.21875, 0.765625, 0.234375, 0.78125) - + VehicleMenuBarPitchDownButton:GetNormalTexture():SetTexture([[Interface\Vehicles\UI-Vehicles-Button-PitchDown-Up]]) VehicleMenuBarPitchDownButton:GetNormalTexture():SetTexCoord(0.21875, 0.765625, 0.234375, 0.78125) VehicleMenuBarPitchDownButton:GetPushedTexture():SetTexture([[Interface\Vehicles\UI-Vehicles-Button-PitchDown-Down]]) VehicleMenuBarPitchDownButton:GetPushedTexture():SetTexCoord(0.21875, 0.765625, 0.234375, 0.78125) - + VehicleMenuBarLeaveButton:GetNormalTexture():SetTexture([[Interface\Vehicles\UI-Vehicles-Button-Exit-Up]]) VehicleMenuBarLeaveButton:GetNormalTexture():SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375) VehicleMenuBarLeaveButton:GetPushedTexture():SetTexture([[Interface\Vehicles\UI-Vehicles-Button-Exit-Down]]) @@ -70,12 +70,12 @@ VehicleBar.button_height = 30 VehicleBar.LBFOverride = true function VehicleBar:ApplyConfig(config) ButtonBar.ApplyConfig(self, config) - + if not self.config.position then self:ClearSetPoint("CENTER", -105, 27) self:SavePosition() end - + self:UpdateButtonLayout() end @@ -95,7 +95,7 @@ function VehicleBar:UpdateButtonVisibility() _G["VehicleMenuBarPitchUpButton"]:Hide() _G["VehicleMenuBarPitchDownButton"]:Hide() end - + if CanExitVehicle() then _G["VehicleMenuBarLeaveButton"]:Show() else diff --git a/libs/SimpleSticky.lua b/libs/SimpleSticky.lua index f49afaa..43096ac 100644 --- a/libs/SimpleSticky.lua +++ b/libs/SimpleSticky.lua @@ -1,19 +1,19 @@ --[[--------------------------------------------------------------------------------- General Library providing an alternate StartMoving() that allows you to specify a number of frames to snap-to when moving the frame around - + Example Usage: - + this:RegisterForDrag("LeftButton") - + StickyFrames:StartMoving(this, {WatchDogFrame_player, WatchDogFrame_target, WatchDogFrame_party1, WatchDogFrame_party2, WatchDogFrame_party3, WatchDogFrame_party4},3,3,3,3) StickyFrames:StopMoving(this) StickyFrames:AnchorFrame(this) - + ------------------------------------------------------------------------------------ This is a modified version by Nevcairiel for Bartender4 @@ -25,7 +25,7 @@ local StickyFrames, oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not StickyFrames then return end --[[--------------------------------------------------------------------------------- - Class declaration, along with a temporary table to hold any existing OnUpdate + Class declaration, along with a temporary table to hold any existing OnUpdate scripts. ------------------------------------------------------------------------------------]] @@ -37,22 +37,22 @@ StickyFrames.sticky = StickyFrames.sticky or {} --[[--------------------------------------------------------------------------------- StickyFrames:StartMoving() - Sets a custom OnUpdate for the frame so it follows the mouse and snaps to the frames you specify - + frame: The frame we want to move. Is typically "this" frameList: A integer indexed list of frames that the given frame should try to stick to. These don't have to have anything special done to them, - and they don't really even need to exist. You can inclue the - moving frame in this list, it will be ignored. This helps you + and they don't really even need to exist. You can inclue the + moving frame in this list, it will be ignored. This helps you if you have a number of frames, just make ONE list to pass. - + {WatchDogFrame_player, WatchDogFrame_party1, .. WatchDogFrame_party4} - left: If your frame has a tranparent border around the entire frame + left: If your frame has a tranparent border around the entire frame (think backdrops with borders). This can be used to fine tune the - edges when you're stickying groups. Refers to any offset on the + edges when you're stickying groups. Refers to any offset on the LEFT edge of the frame being moved. - + top: same right: same bottom: same @@ -62,7 +62,7 @@ function StickyFrames:StartMoving(frame, frameList, left, top, right, bottom) local x,y = GetCursorPosition() local aX,aY = frame:GetCenter() local aS = frame:GetEffectiveScale() - + aX,aY = aX*aS,aY*aS local xoffset,yoffset = (aX - x),(aY - y) self.scripts[frame] = frame:GetScript("OnUpdate") @@ -71,25 +71,25 @@ end --[[--------------------------------------------------------------------------------- This stops the OnUpdate, leaving the frame at its last position. This will - leave it anchored to UIParent. You can call StickyFrames:AnchorFrame() to + leave it anchored to UIParent. You can call StickyFrames:AnchorFrame() to anchor it back "TOPLEFT" , "TOPLEFT" to the parent. ------------------------------------------------------------------------------------]] function StickyFrames:StopMoving(frame) frame:SetScript("OnUpdate", self.scripts[frame]) self.scripts[frame] = nil - + if StickyFrames.sticky[frame] then local sticky = StickyFrames.sticky[frame] StickyFrames.sticky[frame] = nil return true, sticky else return false, nil - end + end end --[[--------------------------------------------------------------------------------- - This can be called in conjunction with StickyFrames:StopMoving() to anchor the + This can be called in conjunction with StickyFrames:StopMoving() to anchor the frame right back to the parent, so you can manipulate its children as a group (This is useful in WatchDog) ------------------------------------------------------------------------------------]] @@ -99,14 +99,14 @@ function StickyFrames:AnchorFrame(frame) local parent = frame:GetParent() or UIParent local xP,yP = parent:GetCenter() local sA,sP = frame:GetEffectiveScale(), parent:GetEffectiveScale() - + xP,yP = (xP*sP) / sA, (yP*sP) / sA local xo,yo = (xP - xA)*-1, (yP - yA)*-1 - + frame:ClearAllPoints() frame:SetPoint("CENTER", parent, "CENTER", xo, yo) -end +end --[[--------------------------------------------------------------------------------- @@ -127,12 +127,12 @@ function StickyFrames:GetUpdateFunc(frame, frameList, xoffset, yoffset, left, to local x,y = GetCursorPosition() local s = frame:GetEffectiveScale() local sticky = nil - + x,y = x/s,y/s frame:ClearAllPoints() frame:SetPoint("CENTER", UIParent, "BOTTOMLEFT", x+xoffset, y+yoffset) - + StickyFrames.sticky[frame] = nil for i = 1, #frameList do local v = frameList[i] @@ -167,7 +167,7 @@ function StickyFrames:SnapFrame(frameA, frameB, left, top, right, bottom) local xB, yB = frameB:GetCenter() local hA, hB = frameA:GetHeight() / 2, ((frameB:GetHeight() * sB) / sA) / 2 local wA, wB = frameA:GetWidth() / 2, ((frameB:GetWidth() * sB) / sA) / 2 - + local newX, newY = xA, yA if not left then left = 0 end @@ -182,81 +182,81 @@ function StickyFrames:SnapFrame(frameA, frameB, left, top, right, bottom) local stickyBx, stickyBy = wB * 0.75, hB * 0.75 -- Grab the edges of each frame, for easier comparison - + local lA, tA, rA, bA = frameA:GetLeft(), frameA:GetTop(), frameA:GetRight(), frameA:GetBottom() local lB, tB, rB, bB = frameB:GetLeft(), frameB:GetTop(), frameB:GetRight(), frameB:GetBottom() local snap = nil - + -- Translate into A's scale lB, tB, rB, bB = (lB * sB) / sA, (tB * sB) / sA, (rB * sB) / sA, (bB * sB) / sA if (bA <= tB and bB <= tA) then - + -- Horizontal Centers if xA <= (xB + StickyFrames.rangeX) and xA >= (xB - StickyFrames.rangeX) then - newX = xB + newX = xB snap = true end - + -- Interior Left if lA <= (lB + StickyFrames.rangeX) and lA >= (lB - StickyFrames.rangeX) then newX = lB + wA if frameB == UIParent or frameB == WorldFrame then newX = newX - left/2 end snap = true end - + -- Interior Right if rA <= (rB + StickyFrames.rangeX) and rA >= (rB - StickyFrames.rangeX) then newX = rB - wA if frameB == UIParent or frameB == WorldFrame then newX = newX + right/2 end snap = true end - + -- Exterior Left to Right if lA <= (rB + StickyFrames.rangeX) and lA >= (rB - StickyFrames.rangeX) then newX = rB + (wA - left) if frameB == UIParent or frameB == WorldFrame then newX = newX + left/2 end snap = true end - + -- Exterior Right to Left if rA <= (lB + StickyFrames.rangeX) and rA >= (lB - StickyFrames.rangeX) then newX = lB - (wA - right) if frameB == UIParent or frameB == WorldFrame then newX = newX - right/2 end snap = true end - + end - + if (lA <= rB and lB <= rA) then - + -- Vertical Centers if yA <= (yB + StickyFrames.rangeY) and yA >= (yB - StickyFrames.rangeY) then newY = yB snap = true end - + -- Interior Top if tA <= (tB + StickyFrames.rangeY) and tA >= (tB - StickyFrames.rangeY) then newY = tB - hA if frameB == UIParent or frameB == WorldFrame then newY = newY + top/2 end snap = true end - + -- Interior Bottom if bA <= (bB + StickyFrames.rangeY) and bA >= (bB - StickyFrames.rangeY) then newY = bB + hA if frameB == UIParent or frameB == WorldFrame then newY = newY - bottom/2 end snap = true end - + -- Exterior Top to Bottom if tA <= (bB + StickyFrames.rangeY + bottom) and tA >= (bB - StickyFrames.rangeY + bottom) then newY = bB - (hA - top) if frameB == UIParent or frameB == WorldFrame then newY = newY - top/2 end snap = true end - + -- Exterior Bottom to Top if bA <= (tB + StickyFrames.rangeY - top) and bA >= (tB - StickyFrames.rangeY - top) then newY = tB + (hA - bottom) @@ -265,7 +265,7 @@ function StickyFrames:SnapFrame(frameA, frameB, left, top, right, bottom) end end - + if snap then frameA:ClearAllPoints() frameA:SetPoint("CENTER", UIParent, "BOTTOMLEFT", newX, newY)