├── Artwork
└── LeaveVehicle.tga
├── .editorconfig
├── locale
├── deDE.lua
├── frFR.lua
├── itIT.lua
├── koKR.lua
├── ptBR.lua
├── ruRU.lua
├── zhCN.lua
├── zhTW.lua
├── esES.lua
├── enUS.lua
├── locale.xml
├── wowace-locale-import.sh
└── find-locale-strings.lua
├── .github
├── workflows
│ ├── pull_request.yml
│ └── packager.yml
└── FUNDING.yml
├── ArtBarTemplates.xml
├── Options
├── VehicleBar.lua
├── MultiCastBar.lua
├── StanceBar.lua
├── StatusTrackingBar.lua
├── PetBar.lua
├── ExtraActionBar.lua
├── XPBarClassic.lua
├── MicroMenu.lua
├── BagBar.lua
├── BlizzardArt.lua
├── ButtonBar.lua
├── AceGUIWidget-NumberEditBox.lua
├── StateBar.lua
├── ActionBar.lua
└── PresetsClassic.lua
├── .pkgmeta
├── MultiCastBar.lua
├── Bartender4.toc
├── libs
├── LibDataBroker-1.1.lua
└── SimpleSticky.lua
├── StatusTrackingBar.lua
├── XPBarClassic.lua
├── HideBlizzard.lua
├── VehicleBar.lua
├── BagBarClassic.lua
├── ExtraActionBar.lua
├── BagBar.lua
├── .luacheckrc
├── PetBar.lua
├── HideBlizzardClassic.lua
├── ButtonBar.lua
├── StanceBar.lua
├── PetButton.lua
├── MicroMenu.lua
├── Bindings.xml
├── ActionBars.lua
└── Bindings_Mainline.xml
/Artwork/LeaveVehicle.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Nevcairiel/Bartender4/HEAD/Artwork/LeaveVehicle.tga
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = tab
5 | indent_size = 4
6 | charset = utf-8
7 | trim_trailing_whitespace = true
8 | insert_final_newline = true
9 |
10 | [{*.yml,.pkgmeta}]
11 | indent_style = space
12 | indent_size = 2
13 |
--------------------------------------------------------------------------------
/locale/deDE.lua:
--------------------------------------------------------------------------------
1 | -- Bartender4 Locale
2 | -- Please use the Localization App on WoWAce to Update this
3 | -- http://www.wowace.com/projects/bartender4/localization/ ;¶
4 |
5 | local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "deDE")
6 | if not L then return end
7 |
8 | --@localization(locale="deDE", format="lua_additive_table", handle-unlocalized="ignore")@
9 |
--------------------------------------------------------------------------------
/locale/frFR.lua:
--------------------------------------------------------------------------------
1 | -- Bartender4 Locale
2 | -- Please use the Localization App on WoWAce to Update this
3 | -- http://www.wowace.com/projects/bartender4/localization/ ;¶
4 |
5 | local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "frFR")
6 | if not L then return end
7 |
8 | --@localization(locale="frFR", format="lua_additive_table", handle-unlocalized="ignore")@
9 |
--------------------------------------------------------------------------------
/locale/itIT.lua:
--------------------------------------------------------------------------------
1 | -- Bartender4 Locale
2 | -- Please use the Localization App on WoWAce to Update this
3 | -- http://www.wowace.com/projects/bartender4/localization/ ;¶
4 |
5 | local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "itIT")
6 | if not L then return end
7 |
8 | --@localization(locale="itIT", format="lua_additive_table", handle-unlocalized="ignore")@
9 |
--------------------------------------------------------------------------------
/locale/koKR.lua:
--------------------------------------------------------------------------------
1 | -- Bartender4 Locale
2 | -- Please use the Localization App on WoWAce to Update this
3 | -- http://www.wowace.com/projects/bartender4/localization/ ;¶
4 |
5 | local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "koKR")
6 | if not L then return end
7 |
8 | --@localization(locale="koKR", format="lua_additive_table", handle-unlocalized="ignore")@
9 |
--------------------------------------------------------------------------------
/locale/ptBR.lua:
--------------------------------------------------------------------------------
1 | -- Bartender4 Locale
2 | -- Please use the Localization App on WoWAce to Update this
3 | -- http://www.wowace.com/projects/bartender4/localization/ ;¶
4 |
5 | local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "ptBR")
6 | if not L then return end
7 |
8 | --@localization(locale="ptBR", format="lua_additive_table", handle-unlocalized="ignore")@
9 |
--------------------------------------------------------------------------------
/locale/ruRU.lua:
--------------------------------------------------------------------------------
1 | -- Bartender4 Locale
2 | -- Please use the Localization App on WoWAce to Update this
3 | -- http://www.wowace.com/projects/bartender4/localization/ ;¶
4 |
5 | local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "ruRU")
6 | if not L then return end
7 |
8 | --@localization(locale="ruRU", format="lua_additive_table", handle-unlocalized="ignore")@
9 |
--------------------------------------------------------------------------------
/locale/zhCN.lua:
--------------------------------------------------------------------------------
1 | -- Bartender4 Locale
2 | -- Please use the Localization App on WoWAce to Update this
3 | -- http://www.wowace.com/projects/bartender4/localization/ ;¶
4 |
5 | local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "zhCN")
6 | if not L then return end
7 |
8 | --@localization(locale="zhCN", format="lua_additive_table", handle-unlocalized="ignore")@
9 |
--------------------------------------------------------------------------------
/locale/zhTW.lua:
--------------------------------------------------------------------------------
1 | -- Bartender4 Locale
2 | -- Please use the Localization App on WoWAce to Update this
3 | -- http://www.wowace.com/projects/bartender4/localization/ ;¶
4 |
5 | local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "zhTW")
6 | if not L then return end
7 |
8 | --@localization(locale="zhTW", format="lua_additive_table", handle-unlocalized="ignore")@
9 |
--------------------------------------------------------------------------------
/locale/esES.lua:
--------------------------------------------------------------------------------
1 | -- Bartender4 Locale
2 | -- Please use the Localization App on WoWAce to Update this
3 | -- http://www.wowace.com/projects/bartender4/localization/ ;¶
4 |
5 | local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "esES") or LibStub("AceLocale-3.0"):NewLocale("Bartender4", "esMX")
6 | if not L then return end
7 |
8 | --@localization(locale="esES", format="lua_additive_table", handle-unlocalized="ignore")@
9 |
--------------------------------------------------------------------------------
/locale/enUS.lua:
--------------------------------------------------------------------------------
1 | -- Bartender4 Locale
2 | -- Please use the Localization App on WoWAce to Update this
3 | -- http://www.wowace.com/projects/bartender4/localization/ ;¶
4 |
5 | local debug = false
6 | --@debug@
7 | debug = true
8 | --@end-debug@
9 |
10 | local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "enUS", true, debug)
11 |
12 | --@localization(locale="enUS", format="lua_additive_table", same-key-is-true=true)@
13 |
--------------------------------------------------------------------------------
/locale/locale.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.github/workflows/pull_request.yml:
--------------------------------------------------------------------------------
1 | # This is a basic workflow to help you get started with Actions
2 |
3 | name: CI-PR
4 |
5 | on: [pull_request]
6 |
7 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel
8 | jobs:
9 | # This workflow contains a single job called "build"
10 | build:
11 | # The type of runner that the job will run on
12 | runs-on: ubuntu-latest
13 |
14 | steps:
15 | - uses: actions/checkout@v2
16 | - name: Install and run Luacheck
17 | run: |
18 | sudo apt-get install luarocks
19 | luarocks install --local luacheck
20 | /home/runner/.luarocks/bin/luacheck . --no-color -q
21 |
22 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: Nevcairiel # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
14 |
--------------------------------------------------------------------------------
/locale/wowace-locale-import.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | tempfile=$( mktemp )
4 |
5 | cleanup() {
6 | rm -f $tempfile
7 | rm -f exported-locale-strings.lua
8 | }
9 | trap cleanup EXIT
10 |
11 | do_import() {
12 | namespace="$1"
13 | file="$2"
14 | : > "$tempfile"
15 |
16 | echo -n "Importing $namespace..."
17 | result=$( curl -sS -X POST -w "%{http_code}" -o "$tempfile" \
18 | -H "X-Api-Token: $CF_API_KEY" \
19 | -F "metadata={ language: \"enUS\", namespace: \"$namespace\", \"missing-phrase-handling\": \"DeletePhrase\" }" \
20 | -F "localizations=<$file" \
21 | "https://www.wowace.com/api/projects/13501/localization/import"
22 | ) || exit 1
23 | case $result in
24 | 200) echo "done." ;;
25 | *)
26 | echo "error! ($result)"
27 | [ -s "$tempfile" ] && grep -q "errorMessage" "$tempfile" && cat "$tempfile" | jq --raw-output '.errorMessage'
28 | exit 1
29 | ;;
30 | esac
31 | }
32 |
33 | lua locale/find-locale-strings.lua || exit 1
34 |
35 | do_import "" "exported-locale-strings.lua"
36 |
37 | exit 0
38 |
--------------------------------------------------------------------------------
/ArtBarTemplates.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/.github/workflows/packager.yml:
--------------------------------------------------------------------------------
1 | # This is a basic workflow to help you get started with Actions
2 |
3 | name: CI
4 |
5 | # Controls when the action will run. Triggers the workflow on push or pull request
6 | # events but only for the master branch
7 | on:
8 | push:
9 | branches: [ master ]
10 | tags:
11 | - '**'
12 |
13 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel
14 | jobs:
15 | # This workflow contains a single job called "build"
16 | build:
17 | # The type of runner that the job will run on
18 | runs-on: ubuntu-latest
19 |
20 | env:
21 | CF_API_KEY: ${{ secrets.CF_API_KEY }}
22 | WOWI_API_TOKEN: ${{ secrets.WOWI_API_TOKEN }}
23 | GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}
24 | WAGO_API_TOKEN: ${{ secrets.WAGO_API_TOKEN }}
25 |
26 |
27 | # Steps represent a sequence of tasks that will be executed as part of the job
28 | steps:
29 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
30 | - uses: actions/checkout@v2
31 | with:
32 | fetch-depth: 0
33 |
34 | - name: Luacheck
35 | run: |
36 | sudo apt-get install luarocks
37 | luarocks install --local luacheck
38 | /home/runner/.luarocks/bin/luacheck . --no-color -q
39 |
40 | - name: Update Locale
41 | if: github.ref == 'refs/heads/master'
42 | run: ./locale/wowace-locale-import.sh
43 |
44 | - uses: BigWigsMods/packager@v2
45 |
--------------------------------------------------------------------------------
/Options/VehicleBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 |
8 | local VehicleBarMod = Bartender4:GetModule("Vehicle", true)
9 | if not VehicleBarMod then return end
10 |
11 | -- fetch upvalues
12 | local Bar = Bartender4.Bar.prototype
13 |
14 | function VehicleBarMod:SetupOptions()
15 | if not self.options then
16 | self.optionobject = Bar:GetOptionObject()
17 | local enabled = {
18 | type = "toggle",
19 | order = 1,
20 | name = L["Enabled"],
21 | desc = L["Enable the Vehicle Bar"],
22 | get = function() return self.db.profile.enabled end,
23 | set = "ToggleModule",
24 | handler = self,
25 | width = "full",
26 | }
27 | self.optionobject:AddElement("general", "enabled", enabled)
28 |
29 | self.disabledoptions = {
30 | general = {
31 | type = "group",
32 | name = L["General Settings"],
33 | cmdInline = true,
34 | order = 1,
35 | args = {
36 | enabled = enabled,
37 | }
38 | }
39 | }
40 | self.options = {
41 | order = 30,
42 | type = "group",
43 | name = L["Vehicle Bar"],
44 | desc = L["The Vehicle Bar contains the \"Leave Vehicle\" button"],
45 | childGroups = "tab",
46 | }
47 | Bartender4:RegisterBarOptions("Vehicle", self.options)
48 | end
49 | self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
50 | end
51 |
--------------------------------------------------------------------------------
/Options/MultiCastBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2012, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 |
6 | local WoWRetail = (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE)
7 | if WoWRetail or not HasMultiCastActionBar or not MultiCastActionBarFrame or select(2, UnitClass("player")) ~= "SHAMAN" then return end
8 |
9 | -- fetch upvalues
10 | local _, Bartender4 = ...
11 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
12 | local Bar = Bartender4.Bar.prototype
13 |
14 | local MultiCastMod = Bartender4:GetModule("MultiCast")
15 |
16 | function MultiCastMod:SetupOptions()
17 | if not self.options then
18 | self.optionobject = Bar:GetOptionObject()
19 | local enabled = {
20 | type = "toggle",
21 | order = 1,
22 | name = L["Enabled"],
23 | desc = L["Enable the Totem Bar"],
24 | get = function() return self.db.profile.enabled end,
25 | set = "ToggleModule",
26 | handler = self,
27 | width = "full",
28 | }
29 | self.optionobject:AddElement("general", "enabled", enabled)
30 |
31 | self.disabledoptions = {
32 | general = {
33 | type = "group",
34 | name = L["General Settings"],
35 | cmdInline = true,
36 | order = 1,
37 | args = {
38 | enabled = enabled,
39 | }
40 | }
41 | }
42 | self.options = {
43 | order = 100,
44 | type = "group",
45 | name = L["Totem Bar"],
46 | desc = L["Configure the Totem Bar"],
47 | childGroups = "tab",
48 | }
49 | Bartender4:RegisterBarOptions("MultiCast", self.options)
50 | end
51 | self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
52 | end
53 |
--------------------------------------------------------------------------------
/Options/StanceBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 |
8 | -- module
9 | local StanceBarMod = Bartender4:GetModule("StanceBar")
10 |
11 | -- fetch upvalues
12 | local ButtonBar = Bartender4.ButtonBar.prototype
13 |
14 | -- GLOBALS: GetNumShapeshiftForms
15 |
16 | function StanceBarMod:SetupOptions()
17 | if not self.options then
18 | self.optionobject = ButtonBar:GetOptionObject()
19 | self.optionobject.table.general.args.rows.max = self.button_count
20 | local enabled = {
21 | type = "toggle",
22 | order = 1,
23 | name = L["Enabled"],
24 | desc = L["Enable the Stance Bar"],
25 | get = function() return self.db.profile.enabled end,
26 | set = "ToggleModule",
27 | handler = self,
28 | width = "full",
29 | }
30 | self.optionobject:AddElement("general", "enabled", enabled)
31 |
32 | self.disabledoptions = {
33 | general = {
34 | type = "group",
35 | name = L["General Settings"],
36 | cmdInline = true,
37 | order = 1,
38 | args = {
39 | enabled = enabled,
40 | }
41 | }
42 | }
43 |
44 | self.options = {
45 | order = 30,
46 | type = "group",
47 | name = L["Stance Bar"],
48 | desc = L["Manages the Stance/Form buttons"],
49 | childGroups = "tab",
50 | disabled = function(info) return GetNumShapeshiftForms() == 0 end,
51 | }
52 | Bartender4:RegisterActionBarOptions("StanceBar", self.options)
53 | end
54 | self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
55 | end
56 |
--------------------------------------------------------------------------------
/.pkgmeta:
--------------------------------------------------------------------------------
1 | package-as: Bartender4
2 | externals:
3 | libs/LibStub: https://repos.wowace.com/wow/libstub/tags/1.0
4 | libs/CallbackHandler-1.0: https://repos.wowace.com/wow/callbackhandler/trunk/CallbackHandler-1.0
5 | libs/AceAddon-3.0: https://repos.wowace.com/wow/ace3/trunk/AceAddon-3.0
6 | libs/AceConsole-3.0: https://repos.wowace.com/wow/ace3/trunk/AceConsole-3.0
7 | libs/AceEvent-3.0: https://repos.wowace.com/wow/ace3/trunk/AceEvent-3.0
8 | libs/AceHook-3.0: https://repos.wowace.com/wow/ace3/trunk/AceHook-3.0
9 | libs/AceDB-3.0: https://repos.wowace.com/wow/ace3/trunk/AceDB-3.0
10 | libs/AceDBOptions-3.0: https://repos.wowace.com/wow/ace3/trunk/AceDBOptions-3.0
11 | libs/AceLocale-3.0: https://repos.wowace.com/wow/ace3/trunk/AceLocale-3.0
12 | libs/AceGUI-3.0: https://repos.wowace.com/wow/ace3/trunk/AceGUI-3.0
13 | libs/AceConfig-3.0: https://repos.wowace.com/wow/ace3/trunk/AceConfig-3.0
14 | libs/AceGUI-3.0-SharedMediaWidgets: https://repos.wowace.com/wow/ace-gui-3-0-shared-media-widgets/trunk/AceGUI-3.0-SharedMediaWidgets
15 | libs/LibActionButton-1.0: https://repos.wowace.com/wow/libactionbutton-1-0
16 | libs/LibButtonGlow-1.0: https://repos.wowace.com/wow/libbuttonglow-1-0
17 | libs/LibKeyBound-1.0: https://repos.wowace.com/wow/libkeybound-1-0/trunk/LibKeyBound-1.0
18 | libs/LibDBIcon-1.0: https://repos.wowace.com/wow/libdbicon-1-0/trunk/LibDBIcon-1.0
19 | libs/LibWindow-1.1: https://repos.wowace.com/wow/libwindow-1-1/trunk/LibWindow-1.1
20 | libs/LibSharedMedia-3.0: https://repos.wowace.com/wow/libsharedmedia-3-0/trunk/LibSharedMedia-3.0
21 | libs/LibDualSpec-1.0: https://repos.wowace.com/wow/libdualspec-1-0
22 | libs/LibClassicSpellActionCount-1.0: https://github.com/Ennea/LibClassicSpellActionCount-1.0.git
23 |
24 | ignore:
25 | - .travis.yml
26 | - .luacheckrc
27 | - .editorconfig
28 | - locale/find-locale-strings.lua
29 | - locale/wowace-locale-import.sh
30 |
--------------------------------------------------------------------------------
/Options/StatusTrackingBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2018, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 |
7 | -- only in 8.0
8 | if not StatusTrackingBarManager then return end
9 |
10 | -- fetch upvalues
11 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
12 | local Bar = Bartender4.Bar.prototype
13 |
14 | local StatusBarMod = Bartender4:GetModule("StatusTrackingBar")
15 |
16 | function StatusBarMod:SetupOptions()
17 | if not self.options then
18 | self.optionobject = Bar:GetOptionObject()
19 | local enabled = {
20 | type = "toggle",
21 | order = 1,
22 | name = L["Enabled"],
23 | desc = L["Enable the Status Tracking Bar"],
24 | get = function() return self.db.profile.enabled end,
25 | set = "ToggleModule",
26 | handler = self,
27 | width = "full",
28 | }
29 | self.optionobject:AddElement("general", "enabled", enabled)
30 |
31 | local width = {
32 | order = 80,
33 | name = L["Width"],
34 | desc = L["Width of the Status Bars"],
35 | type = "range",
36 | min = 10, softMin = 200, softMax = 2000, step = 1,
37 | get = function() return self.db.profile.width end,
38 | set = function(info, state) self.db.profile.width = state; self.bar:PerformLayout() end,
39 | }
40 | self.optionobject:AddElement("general", "width", width)
41 |
42 | self.disabledoptions = {
43 | general = {
44 | type = "group",
45 | name = L["General Settings"],
46 | cmdInline = true,
47 | order = 1,
48 | args = {
49 | enabled = enabled,
50 | }
51 | }
52 | }
53 | self.options = {
54 | order = 100,
55 | type = "group",
56 | name = L["Status Tracking Bar"],
57 | desc = L["The Status Tracking Bar combines XP/Reputation/Honor into one bar, stacking up to two tracked elements"],
58 | childGroups = "tab",
59 | }
60 | Bartender4:RegisterBarOptions("Status", self.options)
61 | end
62 | self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
63 | end
64 |
--------------------------------------------------------------------------------
/MultiCastBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2012, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 |
6 | local WoWRetail = (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE)
7 | if WoWRetail or not HasMultiCastActionBar or not MultiCastActionBarFrame or select(2, UnitClass("player")) ~= "SHAMAN" then return end
8 |
9 | -- fetch upvalues
10 | local _, Bartender4 = ...
11 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
12 | local Bar = Bartender4.Bar.prototype
13 |
14 | local defaults = { profile = Bartender4.Util:Merge({
15 | enabled = true,
16 | }, Bartender4.Bar.defaults) }
17 |
18 | -- register module
19 | local MultiCastMod = Bartender4:NewModule("MultiCast")
20 |
21 | -- create prototype information
22 | local MultiCastBar = setmetatable({}, {__index = Bar})
23 |
24 | function MultiCastMod:OnInitialize()
25 | self.db = Bartender4.db:RegisterNamespace("MultiCast", defaults)
26 | self:SetEnabledState(self.db.profile.enabled)
27 | end
28 |
29 | function MultiCastMod:OnEnable()
30 | if not self.bar then
31 | self.bar = setmetatable(Bartender4.Bar:Create("MultiCast", self.db.profile, L["Totem Bar"]), {__index = MultiCastBar})
32 | self.bar.content = MultiCastActionBarFrame
33 | self.bar.content:SetScript("OnShow", nil)
34 | self.bar.content:SetScript("OnHide", nil)
35 | self.bar.content:SetScript("OnUpdate", nil)
36 | self.bar.content.ignoreFramePositionManager = true
37 |
38 | self.bar.content:SetParent(self.bar)
39 | self.bar.content:Show()
40 | self.bar.content:SetFrameLevel(self.bar:GetFrameLevel() + 1)
41 | end
42 | self.bar:Enable()
43 | self:ToggleOptions()
44 | self:ApplyConfig()
45 | end
46 |
47 | function MultiCastMod:ApplyConfig()
48 | if not self:IsEnabled() then return end
49 | self.bar:ApplyConfig(self.db.profile)
50 | end
51 |
52 | function MultiCastBar:ApplyConfig(config)
53 | Bar.ApplyConfig(self, config)
54 |
55 | self:PerformLayout()
56 | end
57 |
58 | function MultiCastBar:PerformLayout()
59 | self:SetSize(230, 40)
60 | local bar = self.content
61 | bar:ClearAllPoints()
62 | bar:SetPoint("TOPLEFT", self, "TOPLEFT", 3, 1)
63 | end
64 |
--------------------------------------------------------------------------------
/Options/PetBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 |
8 | local PetBarMod = Bartender4:GetModule("PetBar")
9 |
10 | local WoW10 = select(4, GetBuildInfo()) >= 100000
11 |
12 | -- fetch upvalues
13 | local ButtonBar = Bartender4.ButtonBar.prototype
14 |
15 | function PetBarMod:SetupOptions()
16 | if not self.options then
17 | self.optionobject = ButtonBar:GetOptionObject()
18 |
19 | self.optionobject.table.general.args.rows.max = 10
20 |
21 | local enabled = {
22 | type = "toggle",
23 | order = 1,
24 | name = L["Enabled"],
25 | desc = L["Enable the Pet Bar"],
26 | get = function() return self.db.profile.enabled end,
27 | set = "ToggleModule",
28 | handler = self,
29 | width = "full",
30 | }
31 |
32 | local cat_general = {
33 | enabled = enabled,
34 | grid = {
35 | order = 79,
36 | type = "toggle",
37 | name = L["Button Grid"],
38 | desc = L["Toggle the button grid."],
39 | set = function(info, ...) PetBarMod:SetGrid(...) end,
40 | get = function(info) return PetBarMod:GetGrid() end,
41 | },
42 | border = {
43 | order = 84,
44 | type = "toggle",
45 | name = L["Hide Border"],
46 | desc = L["Hide the border around the action button."],
47 | set = function(info, ...) PetBarMod:SetHideBorder(...) end,
48 | get = function(info) return PetBarMod:GetHideBorder() end,
49 | hidden = not WoW10,
50 | },
51 | }
52 | self.optionobject:AddElementGroup("general", cat_general)
53 |
54 | self.disabledoptions = {
55 | general = {
56 | type = "group",
57 | name = L["General Settings"],
58 | cmdInline = true,
59 | order = 1,
60 | args = {
61 | enabled = enabled,
62 | }
63 | }
64 | }
65 |
66 | self.options = {
67 | order = 30,
68 | type = "group",
69 | name = L["Pet Bar"],
70 | desc = L["Manage the abilities of your trusted companion"],
71 | childGroups = "tab",
72 | }
73 | Bartender4:RegisterActionBarOptions("PetBar", self.options)
74 | end
75 | self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
76 | end
77 |
--------------------------------------------------------------------------------
/Options/ExtraActionBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 |
8 | local ExtraActionBarMod = Bartender4:GetModule("ExtraActionBar", true)
9 | if not ExtraActionBarMod then return end
10 |
11 | -- fetch upvalues
12 | local Bar = Bartender4.Bar.prototype
13 |
14 | function ExtraActionBarMod:SetupOptions()
15 | if not self.options then
16 | self.optionobject = Bar:GetOptionObject()
17 | local enabled = {
18 | type = "toggle",
19 | order = 1,
20 | name = L["Enabled"],
21 | desc = L["Enable the Extra Action Bar"],
22 | get = function() return self.db.profile.enabled end,
23 | set = "ToggleModule",
24 | handler = self,
25 | width = "full",
26 | }
27 | self.optionobject:AddElement("general", "enabled", enabled)
28 |
29 | local editmode = {
30 | type = "description",
31 | order = 2,
32 | name = L["NOTE: It is strongly recommended to use Edit Mode to move the Extra Action Bar to avoid any complications in Raid Encounters, and leave the Bartender4 Extra Action Bar disabled."] .."\n\n"..L["After disabling the Extra Action Bar, you should reload your UI to fully reset it to vanilla."],
33 | width = "full",
34 | }
35 | self.optionobject:AddElement("general", "editmode", editmode)
36 |
37 | local hideArtwork = {
38 | type = "toggle",
39 | order = 80,
40 | name = L["Hide Artwork"],
41 | desc = L["Hide the Extra Action Button artwork."],
42 | get = function() return self.db.profile.hideArtwork end,
43 | set = function(info, state) self.db.profile.hideArtwork = state; self:UpdateArtwork() end,
44 | }
45 | self.optionobject:AddElement("general", "hideArtwork", hideArtwork)
46 |
47 | self.disabledoptions = {
48 | general = {
49 | type = "group",
50 | name = L["General Settings"],
51 | cmdInline = true,
52 | order = 1,
53 | args = {
54 | enabled = enabled,
55 | editmode = editmode,
56 | }
57 | }
58 | }
59 | self.options = {
60 | order = 50,
61 | type = "group",
62 | name = L["Extra Action Bar"],
63 | desc = L["Manages the Extra Action Button used in many quests and encounters, as well as Zone specific abilities"],
64 | childGroups = "tab",
65 | }
66 | Bartender4:RegisterActionBarOptions("ExtraActionBar", self.options)
67 | end
68 | self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
69 | end
70 |
--------------------------------------------------------------------------------
/Options/XPBarClassic.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2019, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 |
7 | -- only on Classic
8 | if not MainMenuExpBar then return end
9 |
10 | -- fetch upvalues
11 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
12 | local Bar = Bartender4.Bar.prototype
13 |
14 | local XPBarMod = Bartender4:GetModule("XPBar")
15 |
16 | function XPBarMod:SetupOptions()
17 | if not self.options then
18 | self.optionobject = Bar:GetOptionObject()
19 | local enabled = {
20 | type = "toggle",
21 | order = 1,
22 | name = L["Enabled"],
23 | desc = L["Enable the XP Bar"],
24 | get = function() return self.db.profile.enabled end,
25 | set = "ToggleModule",
26 | handler = self,
27 | width = "full",
28 | }
29 | self.optionobject:AddElement("general", "enabled", enabled)
30 |
31 | self.disabledoptions = {
32 | general = {
33 | type = "group",
34 | name = L["General Settings"],
35 | cmdInline = true,
36 | order = 1,
37 | args = {
38 | enabled = enabled,
39 | }
40 | }
41 | }
42 | self.options = {
43 | order = 100,
44 | type = "group",
45 | name = L["XP Bar"],
46 | desc = L["Configure the XP Bar"],
47 | childGroups = "tab",
48 | }
49 | Bartender4:RegisterBarOptions("XP", self.options)
50 | end
51 | self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
52 | end
53 |
54 | local RepBarMod = Bartender4:GetModule("RepBar")
55 |
56 | function RepBarMod:SetupOptions()
57 | if not self.options then
58 | self.optionobject = Bar:GetOptionObject()
59 | local enabled = {
60 | type = "toggle",
61 | order = 1,
62 | name = L["Enabled"],
63 | desc = L["Enable the Reputation Bar"],
64 | get = function() return self.db.profile.enabled end,
65 | set = "ToggleModule",
66 | handler = self,
67 | }
68 | self.optionobject:AddElement("general", "enabled", enabled)
69 |
70 | self.disabledoptions = {
71 | general = {
72 | type = "group",
73 | name = L["General Settings"],
74 | cmdInline = true,
75 | order = 1,
76 | args = {
77 | enabled = enabled,
78 | }
79 | }
80 | }
81 | self.options = {
82 | order = 100,
83 | type = "group",
84 | name = L["Reputation Bar"],
85 | desc = L["Configure the Reputation Bar"],
86 | childGroups = "tab",
87 | }
88 | Bartender4:RegisterBarOptions("Rep", self.options)
89 | end
90 | self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
91 | end
92 |
--------------------------------------------------------------------------------
/Options/MicroMenu.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 |
8 | local MicroMenuMod = Bartender4:GetModule("MicroMenu")
9 |
10 | -- fetch upvalues
11 | local Bar = Bartender4.Bar.prototype
12 | local ButtonBar = Bartender4.ButtonBar.prototype
13 |
14 | function MicroMenuMod:SetupOptions()
15 | if not self.options then
16 | self.optionobject = ButtonBar:GetOptionObject()
17 | self.optionobject.table.general.args.rows.max = self.button_count
18 | local enabled = {
19 | type = "toggle",
20 | order = 1,
21 | name = L["Enabled"],
22 | desc = L["Enable the Micro Menu"],
23 | get = function() return self.db.profile.enabled end,
24 | set = "ToggleModule",
25 | handler = self,
26 | width = "full",
27 | }
28 | self.optionobject:AddElement("general", "enabled", enabled)
29 |
30 | self.disabledoptions = {
31 | general = {
32 | type = "group",
33 | name = L["General Settings"],
34 | cmdInline = true,
35 | order = 1,
36 | args = {
37 | enabled = enabled,
38 | }
39 | }
40 | }
41 | self.options = {
42 | order = 30,
43 | type = "group",
44 | name = L["Micro Menu"],
45 | desc = L["Manages the Micro Menu buttons"],
46 | childGroups = "tab",
47 | }
48 | self.optionobject.table.general.args.padding.min = -30
49 | Bartender4:RegisterBarOptions("MicroMenu", self.options)
50 | end
51 | self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
52 | end
53 |
54 | local QueueStatusMod = Bartender4:GetModule("QueueStatusButtonBar", true)
55 | if QueueStatusMod then
56 | function QueueStatusMod:SetupOptions()
57 | if not self.options then
58 | self.optionobject = Bar:GetOptionObject()
59 | local enabled = {
60 | type = "toggle",
61 | order = 1,
62 | name = L["Enabled"],
63 | desc = L["Enable the Queue Status Bar"],
64 | get = function() return self.db.profile.enabled end,
65 | set = "ToggleModule",
66 | handler = self,
67 | width = "full",
68 | }
69 | self.optionobject:AddElement("general", "enabled", enabled)
70 |
71 | self.disabledoptions = {
72 | general = {
73 | type = "group",
74 | name = L["General Settings"],
75 | cmdInline = true,
76 | order = 1,
77 | args = {
78 | enabled = enabled,
79 | }
80 | }
81 | }
82 | self.options = {
83 | order = 100,
84 | type = "group",
85 | name = L["Queue Status Bar"],
86 | desc = L["Contains the \"Green Eye\" when signing up for groups or raids"],
87 | childGroups = "tab",
88 | }
89 | Bartender4:RegisterBarOptions("QueueStatus", self.options)
90 | end
91 | self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
92 | end
93 | end
94 |
--------------------------------------------------------------------------------
/locale/find-locale-strings.lua:
--------------------------------------------------------------------------------
1 | -- Need to hardcode the project id here
2 | local TOC_FILE
3 | -- Automatically find the TOC in the given path, set to false to disable
4 | local AUTO_FIND_TOC = "./"
5 | -- Patterns that should not be scrapped, case-insensitive
6 | -- Anything between the no-lib-strip is automatically ignored
7 | local FILE_BLACKLIST = {"^locale", "^libs"}
8 |
9 |
10 | -- No more modifying!
11 | local OS_TYPE = os.getenv("HOME") and "linux" or "windows"
12 |
13 | -- Find the TOC now
14 | if( AUTO_FIND_TOC ) then
15 | local pipe = OS_TYPE == "windows" and io.popen(string.format("dir /B \"%s\"", AUTO_FIND_TOC)) or io.popen(string.format("ls -1 \"%s\"", AUTO_FIND_TOC))
16 | if( type(pipe) == "userdata" ) then
17 | for file in pipe:lines() do
18 | if( string.match(file, "(.+)%.toc") ) then
19 | TOC_FILE = file
20 | break
21 | end
22 | end
23 |
24 | pipe:close()
25 | if( not TOC_FILE ) then print("Failed to auto detect toc file.") end
26 | else
27 | print("Failed to auto find toc, cannot run dir /B or ls -1")
28 | end
29 | end
30 |
31 | if( not TOC_FILE ) then
32 | return
33 | end
34 |
35 | print(string.format("Using TOC file %s", TOC_FILE))
36 | print("")
37 |
38 | -- Parse through the TOC file so we know what to scan
39 | local ignore
40 | local localizedKeys = {}
41 | for line in io.lines(TOC_FILE) do
42 | line = string.gsub(line, "\r", "")
43 |
44 | if( string.match(line, "#@no%-lib%-strip@") ) then
45 | ignore = true
46 | elseif( string.match(line, "#@end%-no%-lib%-strip@") ) then
47 | ignore = nil
48 | end
49 |
50 | if( not ignore and string.match(line, "%.lua") and not string.match(line, "^%s*#")) then
51 | -- Make sure it's a valid file
52 | local blacklist
53 | for _, check in pairs(FILE_BLACKLIST) do
54 | if( string.match(string.lower(line), check) ) then
55 | blacklist = true
56 | break
57 | end
58 | end
59 |
60 | -- File checks out, scrap everything
61 | if( not blacklist ) then
62 | -- Fix slashes
63 | if( OS_TYPE == "linux" ) then
64 | line = string.gsub(line, "\\", "/")
65 | end
66 |
67 | local keys = 0
68 | local contents = io.open(line):read("*all")
69 |
70 | for match in string.gmatch(contents, "L%[\"(.-)%\"]") do
71 | if( not localizedKeys[match] ) then keys = keys + 1 end
72 | localizedKeys[match] = true
73 | end
74 |
75 | print(string.format("%s (%d keys)", line, keys))
76 | end
77 | end
78 | end
79 |
80 | -- Compile all of the localization we found into string form
81 | local totalLocalizedKeys = 0
82 | local localization = ""
83 | for key in pairs(localizedKeys) do
84 | localization = string.format("%sL[\"%s\"] = true\n", localization, key, key)
85 | totalLocalizedKeys = totalLocalizedKeys + 1
86 | end
87 |
88 | if( totalLocalizedKeys == 0 ) then
89 | print("Warning, failed to find any localizations, perhaps you messed up a configuration variable?")
90 | return
91 | end
92 |
93 | local file = assert(io.open("exported-locale-strings.lua", "w", "Error opening file"))
94 | file:write(localization)
95 | file:close()
96 |
97 | print(string.format("Written %d keys to exported-locale-strings.lua", totalLocalizedKeys))
98 |
--------------------------------------------------------------------------------
/Bartender4.toc:
--------------------------------------------------------------------------------
1 | ## Interface: 110207,120000,120001,11508,50503,20505
2 |
3 | ## Title: Bartender4
4 | ## Notes: Simple and Advanced combined - Bartender4 ActionBar AddOn
5 | ## IconTexture: Interface\Icons\INV_Drink_05
6 |
7 | ## Version: @project-version@
8 |
9 | ## Author: Nevcairiel
10 | ## X-Email: h.leppkes at gmail dot com
11 |
12 | ## X-Category: Action Bars
13 | ## X-Website: https://www.wowace.com/projects/bartender4/
14 | ## X-License: All rights reserved.
15 | ## X-Curse-Project-ID: 13501
16 | ## X-WoWI-ID: 11190
17 | ## X-Wago-ID: v63oVn6b
18 |
19 | ## SavedVariables: Bartender4DB
20 | ## OptionalDeps: Ace3, Masque, LibButtonGlow-1.0, LibActionButton-1.0, LibKeyBound-1.0, LibDBIcon-1.0, LibWindow-1.1, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, LibDualSpec-1.0, LibClassicSpellActionCount-1.0
21 |
22 | #@no-lib-strip@
23 | libs\LibStub\LibStub.lua
24 | libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
25 | #@end-no-lib-strip@
26 |
27 | libs\LibDataBroker-1.1.lua
28 |
29 | #@no-lib-strip@
30 | libs\AceAddon-3.0\AceAddon-3.0.xml
31 | libs\AceDB-3.0\AceDB-3.0.xml
32 | libs\AceDBOptions-3.0\AceDBOptions-3.0.xml
33 | libs\AceEvent-3.0\AceEvent-3.0.xml
34 | libs\AceConsole-3.0\AceConsole-3.0.xml
35 | libs\AceHook-3.0\AceHook-3.0.xml
36 | libs\AceLocale-3.0\AceLocale-3.0.xml
37 | libs\AceGUI-3.0\AceGUI-3.0.xml
38 | libs\AceConfig-3.0\AceConfig-3.0.xml
39 |
40 | libs\LibClassicSpellActionCount-1.0\LibClassicSpellActionCount-1.0.lua [AllowLoadGameType vanilla]
41 |
42 | libs\LibKeyBound-1.0\lib.xml
43 | libs\LibButtonGlow-1.0\LibButtonGlow-1.0.lua
44 | libs\LibActionButton-1.0\LibActionButton-1.0.lua
45 | libs\LibDBIcon-1.0\LibDBIcon-1.0.lua
46 | libs\LibWindow-1.1\LibWindow-1.1.lua
47 | libs\LibDualSpec-1.0\LibDualSpec-1.0.lua
48 |
49 | libs\LibSharedMedia-3.0\lib.xml
50 | libs\AceGUI-3.0-SharedMediaWidgets\widget.xml
51 | #@end-no-lib-strip@
52 |
53 | libs\SimpleSticky.lua
54 |
55 | locale\locale.xml
56 |
57 | ## Core ##
58 | Bartender4.lua
59 | HideBlizzard.lua
60 | HideBlizzardClassic.lua
61 |
62 | ## Prototypes ##
63 | Bar.lua
64 | ButtonBar.lua
65 | StateBar.lua
66 | ActionBar.lua
67 |
68 | ## Buttons ##
69 | PetButton.lua
70 |
71 | ## Modules ##
72 | ActionBars.lua
73 | BagBar.lua
74 | BagBarClassic.lua
75 | PetBar.lua
76 | StanceBar.lua
77 | MicroMenu.lua
78 | VehicleBar.lua
79 | BlizzardArt.lua
80 | ExtraActionBar.lua
81 | StatusTrackingBar.lua
82 |
83 | ## Classic-only ##
84 | XPBarClassic.lua
85 | MultiCastBar.lua
86 |
87 | ## Options ##
88 | Options\AceGUIWidget-NumberEditBox.lua
89 |
90 | Options\Options.lua
91 | Options\Bar.lua
92 | Options\ButtonBar.lua
93 | Options\StateBar.lua
94 |
95 | Options\ActionBar.lua
96 | Options\BagBar.lua
97 | Options\MicroMenu.lua
98 | Options\PetBar.lua
99 | Options\StanceBar.lua
100 | Options\VehicleBar.lua
101 | Options\BlizzardArt.lua
102 | Options\ExtraActionBar.lua
103 | Options\StatusTrackingBar.lua
104 |
105 | ## Classic-only ##
106 | Options\XPBarClassic.lua
107 | Options\MultiCastBar.lua
108 |
109 | ## XML
110 | ArtBarTemplates.xml
111 |
112 | ## Presets -- needs to be the last ##
113 | Options\Presets.lua
114 | Options\PresetsClassic.lua
115 |
--------------------------------------------------------------------------------
/libs/LibDataBroker-1.1.lua:
--------------------------------------------------------------------------------
1 |
2 | assert(LibStub, "LibDataBroker-1.1 requires LibStub")
3 | assert(LibStub:GetLibrary("CallbackHandler-1.0", true), "LibDataBroker-1.1 requires CallbackHandler-1.0")
4 |
5 | local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 4)
6 | if not lib then return end
7 | oldminor = oldminor or 0
8 |
9 |
10 | lib.callbacks = lib.callbacks or LibStub:GetLibrary("CallbackHandler-1.0"):New(lib)
11 | lib.attributestorage, lib.namestorage, lib.proxystorage = lib.attributestorage or {}, lib.namestorage or {}, lib.proxystorage or {}
12 | local attributestorage, namestorage, callbacks = lib.attributestorage, lib.namestorage, lib.callbacks
13 |
14 | if oldminor < 2 then
15 | lib.domt = {
16 | __metatable = "access denied",
17 | __index = function(self, key) return attributestorage[self] and attributestorage[self][key] end,
18 | }
19 | end
20 |
21 | if oldminor < 3 then
22 | lib.domt.__newindex = function(self, key, value)
23 | if not attributestorage[self] then attributestorage[self] = {} end
24 | if attributestorage[self][key] == value then return end
25 | attributestorage[self][key] = value
26 | local name = namestorage[self]
27 | if not name then return end
28 | callbacks:Fire("LibDataBroker_AttributeChanged", name, key, value, self)
29 | callbacks:Fire("LibDataBroker_AttributeChanged_"..name, name, key, value, self)
30 | callbacks:Fire("LibDataBroker_AttributeChanged_"..name.."_"..key, name, key, value, self)
31 | callbacks:Fire("LibDataBroker_AttributeChanged__"..key, name, key, value, self)
32 | end
33 | end
34 |
35 | if oldminor < 2 then
36 | function lib:NewDataObject(name, dataobj)
37 | if self.proxystorage[name] then return end
38 |
39 | if dataobj then
40 | assert(type(dataobj) == "table", "Invalid dataobj, must be nil or a table")
41 | self.attributestorage[dataobj] = {}
42 | for i,v in pairs(dataobj) do
43 | self.attributestorage[dataobj][i] = v
44 | dataobj[i] = nil
45 | end
46 | end
47 | dataobj = setmetatable(dataobj or {}, self.domt)
48 | self.proxystorage[name], self.namestorage[dataobj] = dataobj, name
49 | self.callbacks:Fire("LibDataBroker_DataObjectCreated", name, dataobj)
50 | return dataobj
51 | end
52 | end
53 |
54 | if oldminor < 1 then
55 | function lib:DataObjectIterator()
56 | return pairs(self.proxystorage)
57 | end
58 |
59 | function lib:GetDataObjectByName(dataobjectname)
60 | return self.proxystorage[dataobjectname]
61 | end
62 |
63 | function lib:GetNameByDataObject(dataobject)
64 | return self.namestorage[dataobject]
65 | end
66 | end
67 |
68 | if oldminor < 4 then
69 | local next = pairs(attributestorage)
70 | function lib:pairs(dataobject_or_name)
71 | local t = type(dataobject_or_name)
72 | assert(t == "string" or t == "table", "Usage: ldb:pairs('dataobjectname') or ldb:pairs(dataobject)")
73 |
74 | local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name
75 | assert(attributestorage[dataobj], "Data object not found")
76 |
77 | return next, attributestorage[dataobj], nil
78 | end
79 |
80 | local ipairs_iter = ipairs(attributestorage)
81 | function lib:ipairs(dataobject_or_name)
82 | local t = type(dataobject_or_name)
83 | assert(t == "string" or t == "table", "Usage: ldb:ipairs('dataobjectname') or ldb:ipairs(dataobject)")
84 |
85 | local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name
86 | assert(attributestorage[dataobj], "Data object not found")
87 |
88 | return ipairs_iter, attributestorage[dataobj], 0
89 | end
90 | end
91 |
--------------------------------------------------------------------------------
/Options/BagBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 |
8 | local WoWClassicEra = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC)
9 | local WoW10 = select(4, GetBuildInfo()) >= 100000
10 |
11 | local BagBarMod = Bartender4:GetModule("BagBar")
12 |
13 | -- fetch upvalues
14 | local ButtonBar = Bartender4.ButtonBar.prototype
15 |
16 | function BagBarMod:SetupOptions()
17 | if not self.options then
18 | self.optionobject = ButtonBar:GetOptionObject()
19 | self.optionobject.table.general.args.rows.max = self.button_count
20 | local enabled = {
21 | type = "toggle",
22 | order = 1,
23 | name = L["Enabled"],
24 | desc = L["Enable the Bag Bar"],
25 | get = function() return self.db.profile.enabled end,
26 | set = "ToggleModule",
27 | handler = self,
28 | width = "full",
29 | }
30 | self.optionobject:AddElement("general", "enabled", enabled)
31 |
32 | local verticalAlignment = {
33 | type = "select",
34 | order = 79,
35 | name = L["Vertical Button Alignment"],
36 | desc = L["Vertical button alignment for this bar."],
37 | get = function() return self.db.profile.verticalAlignment end,
38 | set = function(info, state) self.db.profile.verticalAlignment = state; self.bar:UpdateButtonLayout() end,
39 | values = { TOP = L["TOP"], CENTER = L["CENTER"], BOTTOM = L["BOTTOM"] },
40 | }
41 | self.optionobject:AddElement("general", "verticalAlignment", verticalAlignment)
42 |
43 | local onebag = {
44 | type = "toggle",
45 | order = 80,
46 | name = L["One Bag"],
47 | desc = L["Only show one Bag Button in the BagBar."],
48 | get = function() return self.db.profile.onebag end,
49 | set = function(info, state) self.db.profile.onebag = state; self.bar:FeedButtons(); self.bar:UpdateButtonLayout() end,
50 | }
51 | self.optionobject:AddElement("general", "onebag", onebag)
52 |
53 | if WoW10 then
54 | local onebagreagents = {
55 | type = "toggle",
56 | order = 80,
57 | name = L["One Bag, Show Reagents"],
58 | desc = L["Show the Reagent Bag in One Bag mode"],
59 | get = function() return self.db.profile.onebagreagents end,
60 | width = 1.25,
61 | set = function(info, state) self.db.profile.onebagreagents = state; self.bar:FeedButtons(); self.bar:UpdateButtonLayout() end,
62 | }
63 | self.optionobject:AddElement("general", "onebagreagents", onebagreagents)
64 | end
65 |
66 | if WoWClassicEra then
67 | local keyring = {
68 | type = "toggle",
69 | order = 80,
70 | name = L["Keyring"],
71 | desc = L["Show the keyring button."],
72 | get = function() return self.db.profile.keyring end,
73 | set = function(info, state) self.db.profile.keyring = state; self.bar:FeedButtons(); self.bar:UpdateButtonLayout() end,
74 | }
75 | self.optionobject:AddElement("general", "keyring", keyring)
76 | end
77 |
78 | self.disabledoptions = {
79 | general = {
80 | type = "group",
81 | name = L["General Settings"],
82 | cmdInline = true,
83 | order = 1,
84 | args = {
85 | enabled = enabled,
86 | }
87 | }
88 | }
89 | self.options = {
90 | order = 30,
91 | type = "group",
92 | name = L["Bag Bar"],
93 | desc = L["Manages the Backpack and all the extra bags"],
94 | childGroups = "tab",
95 | }
96 | Bartender4:RegisterBarOptions("BagBar", self.options)
97 | end
98 | self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
99 | end
100 |
--------------------------------------------------------------------------------
/StatusTrackingBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2018, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 |
8 | -- fetch upvalues
9 | local Bar = Bartender4.Bar.prototype
10 |
11 | -- only available on 8.0
12 | if not StatusTrackingBarManager then return end
13 |
14 | local defaults = { profile = Bartender4.Util:Merge({
15 | enabled = false,
16 | width = 571,
17 | twentySections = true,
18 | }, Bartender4.Bar.defaults) }
19 |
20 | -- register module
21 | local StatusBarMod = Bartender4:NewModule("StatusTrackingBar", "AceHook-3.0")
22 |
23 | -- create prototype information
24 | local StatusBar = setmetatable({}, {__index = Bar})
25 |
26 | function StatusBarMod:OnInitialize()
27 | self.db = Bartender4.db:RegisterNamespace("StatusTrackingBar", defaults)
28 | self:SetEnabledState(self.db.profile.enabled)
29 | end
30 |
31 | function StatusBarMod:OnEnable()
32 | if not self.bar then
33 | self.bar = setmetatable(Bartender4.Bar:Create("Status", self.db.profile, L["Status Tracking Bar"], 1), {__index = StatusBar})
34 | self.bar.content = CreateFrame("Frame", nil, self.bar)
35 | self.bar.content:SetSize(self.db.profile.width, 14)
36 | self.bar.content:Show()
37 | self.bar.content.OnStatusBarsUpdated = function() end
38 |
39 | self.bar.manager = StatusTrackingBarManager
40 | self.bar.manager:SetParent(self.bar.content)
41 | self.bar.manager:ClearAllPoints()
42 | self.bar.manager:SetPoint("BOTTOMLEFT", self.bar.content, "BOTTOMLEFT")
43 |
44 | -- add additional anchors to the textures to allow re-sizing the bars
45 | if self.bar.manager.MainStatusTrackingBarContainer then
46 | self.bar.manager.MainStatusTrackingBarContainer:SetWidth(self.db.profile.width)
47 | self.bar.manager.SecondaryStatusTrackingBarContainer:SetWidth(self.db.profile.width)
48 | else
49 | self.bar.manager.BottomBarFrameTexture:SetPoint("BOTTOMRIGHT")
50 | self.bar.manager.TopBarFrameTexture:SetPoint("BOTTOMRIGHT", self.bar.manager.BottomBarFrameTexture, "TOPRIGHT", 0, -3)
51 | end
52 | self.bar.manager:Show()
53 | self.bar.manager:SetFrameLevel(2)
54 | end
55 | self.bar:Enable()
56 | self:ToggleOptions()
57 | self:ApplyConfig()
58 | end
59 |
60 | function StatusBarMod:ApplyConfig()
61 | self.bar:ApplyConfig(self.db.profile)
62 | end
63 |
64 | function StatusBarMod:UpdateLayout()
65 | self.bar:PerformLayout()
66 | end
67 |
68 | function StatusBarMod:ManagerTextLock(_, lock)
69 | self.bar.manager:SetTextLocked(lock)
70 | end
71 |
72 | function StatusBarMod:ManagerUpdateBars()
73 | self.bar.manager:UpdateBarsShown()
74 | end
75 |
76 | function StatusBar:ApplyConfig(config)
77 | Bar.ApplyConfig(self, config)
78 |
79 | self:PerformLayout()
80 | end
81 |
82 | StatusBar.width = 571 + 8
83 | StatusBar.height = 34
84 | StatusBar.offsetX = 7
85 | StatusBar.offsetY = 2
86 | function StatusBar:PerformLayout()
87 | self.manager:SetWidth(self.config.width)
88 | self.manager.MainStatusTrackingBarContainer:SetWidth(self.config.width)
89 | self.manager.SecondaryStatusTrackingBarContainer:SetWidth(self.config.width)
90 |
91 | self.manager:UpdateBarsShown()
92 |
93 | StatusBar.width = self.config.width + 8
94 | self:SetSize(self.width, self.height)
95 |
96 | local bar = self.content
97 | bar:SetSize(self.config.width, self.height)
98 | bar:ClearAllPoints()
99 | bar:SetPoint("TOPLEFT", self, "TOPLEFT", self.offsetX, self.offsetY)
100 | end
101 |
102 | StatusBar.ClickThroughSupport = false
103 | function StatusBar:ControlClickThrough()
104 | --self.content:EnableMouse(not self.config.clickthrough)
105 | end
106 |
--------------------------------------------------------------------------------
/XPBarClassic.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2019, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 |
8 | -- fetch upvalues
9 | local Bar = Bartender4.Bar.prototype
10 |
11 | -- only available on Classic
12 | if not MainMenuExpBar then return end
13 |
14 | local defaults = { profile = Bartender4.Util:Merge({
15 | enabled = false,
16 | }, Bartender4.Bar.defaults) }
17 |
18 | -- register module
19 | local XPBarMod = Bartender4:NewModule("XPBar", "AceHook-3.0")
20 |
21 | -- create prototype information
22 | local XPBar = setmetatable({}, {__index = Bar})
23 |
24 | function XPBarMod:OnInitialize()
25 | self.db = Bartender4.db:RegisterNamespace("XPBar", defaults)
26 | self:SetEnabledState(self.db.profile.enabled)
27 | end
28 |
29 | function XPBarMod:OnEnable()
30 | if not self.bar then
31 | self.bar = setmetatable(Bartender4.Bar:Create("XP", self.db.profile, L["XP Bar"], 1), {__index = XPBar})
32 | self.bar.content = MainMenuExpBar
33 | self.bar.content:SetParent(self.bar)
34 | self.bar.content:SetFrameLevel(self.bar:GetFrameLevel() + 1)
35 | end
36 | self:SecureHook("MainMenuBar_UpdateExperienceBars", "UpdateLayout")
37 | self.bar:Enable()
38 | self:ToggleOptions()
39 | self:ApplyConfig()
40 | end
41 |
42 | function XPBarMod:ApplyConfig()
43 | self.bar:ApplyConfig(self.db.profile)
44 | end
45 |
46 | function XPBarMod:UpdateLayout()
47 | self.bar:PerformLayout()
48 | end
49 |
50 | function XPBar:ApplyConfig(config)
51 | Bar.ApplyConfig(self, config)
52 |
53 | self:PerformLayout()
54 | end
55 |
56 | XPBar.width = 1024
57 | XPBar.height = 13
58 | XPBar.offsetX = 0
59 | XPBar.offsetY = 0
60 | function XPBar:PerformLayout()
61 | self:SetSize(self.width, self.height)
62 | local bar = self.content
63 | bar:ClearAllPoints()
64 | bar:SetPoint("TOPLEFT", self, "TOPLEFT", self.offsetX, self.offsetY)
65 | end
66 |
67 | XPBar.ClickThroughSupport = true
68 | function XPBar:ControlClickThrough()
69 | self.content:EnableMouse(not self.config.clickthrough)
70 | end
71 |
72 | -- register module
73 | local RepBarMod = Bartender4:NewModule("RepBar", "AceHook-3.0")
74 |
75 | -- create prototype information
76 | local RepBar = setmetatable({}, {__index = Bar})
77 |
78 | function RepBarMod:OnInitialize()
79 | self.db = Bartender4.db:RegisterNamespace("RepBar", defaults)
80 | self:SetEnabledState(self.db.profile.enabled)
81 | end
82 |
83 | function RepBarMod:OnEnable()
84 | if not self.bar then
85 | self.bar = setmetatable(Bartender4.Bar:Create("Rep", self.db.profile, L["Reputation Bar"], 1), {__index = RepBar})
86 | self.bar.content = ReputationWatchBar
87 | self.bar.content:SetParent(self.bar)
88 | self.bar.content:SetFrameLevel(self.bar:GetFrameLevel() + 1)
89 | end
90 | self:SecureHook("MainMenuBar_UpdateExperienceBars", "UpdateLayout")
91 | self.bar:Enable()
92 | self:ToggleOptions()
93 | self:ApplyConfig()
94 | end
95 |
96 | function RepBarMod:ApplyConfig()
97 | self.bar:ApplyConfig(self.db.profile)
98 | end
99 |
100 | function RepBarMod:UpdateLayout()
101 | self.bar:PerformLayout()
102 | end
103 |
104 | function RepBar:ApplyConfig(config)
105 | Bar.ApplyConfig(self, config)
106 |
107 | self:PerformLayout()
108 | end
109 |
110 | RepBar.width = 1024
111 | RepBar.height = 11
112 | RepBar.offsetX = 0
113 | RepBar.offsetY = 0
114 | function RepBar:PerformLayout()
115 | self:SetSize(self.width, self.height)
116 | local bar = self.content
117 | bar:ClearAllPoints()
118 | bar:SetPoint("TOPLEFT", self, "TOPLEFT", self.offsetX, self.offsetY)
119 | end
120 |
121 | RepBar.ClickThroughSupport = true
122 | function RepBar:ControlClickThrough()
123 | self.content:EnableMouse(not self.config.clickthrough)
124 | end
125 |
--------------------------------------------------------------------------------
/HideBlizzard.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2022, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 |
7 | local WoWClassic = (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE)
8 | local WoWBCC = (WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC)
9 |
10 | if WoWClassic and not WoWBCC then
11 | return
12 | end
13 |
14 | local function hideActionBarFrame(frame, clearEvents)
15 | if frame then
16 | if clearEvents then
17 | frame:UnregisterAllEvents()
18 | end
19 |
20 | -- remove some EditMode hooks
21 | if frame.system then
22 | -- purge the show state to avoid any taint concerns
23 | Bartender4.Util:PurgeKey(frame, "isShownExternal")
24 | end
25 |
26 | -- EditMode overrides the Hide function, avoid calling it as it can taint
27 | if frame.HideBase then
28 | frame:HideBase()
29 | else
30 | frame:Hide()
31 | end
32 | frame:SetParent(Bartender4.UIHider)
33 | end
34 | end
35 |
36 | local function hideActionButton(button)
37 | if not button then return end
38 |
39 | button:Hide()
40 | button:UnregisterAllEvents()
41 | button:SetAttribute("statehidden", true)
42 |
43 | button.bar = nil
44 | end
45 |
46 | function Bartender4:HideBlizzard()
47 | -- Hidden parent frame
48 | local UIHider = CreateFrame("Frame")
49 | UIHider:Hide()
50 | self.UIHider = UIHider
51 |
52 | hideActionBarFrame(MainMenuBar, false) -- <= 11.2.5
53 | hideActionBarFrame(MainActionBar, false) -- >= 11.2.7/12.0
54 | hideActionBarFrame(MultiBarBottomLeft, true)
55 | hideActionBarFrame(MultiBarBottomRight, true)
56 | hideActionBarFrame(MultiBarLeft, true)
57 | hideActionBarFrame(MultiBarRight, true)
58 | hideActionBarFrame(MultiBar5, true)
59 | hideActionBarFrame(MultiBar6, true)
60 | hideActionBarFrame(MultiBar7, true)
61 |
62 | -- Hide MultiBar Buttons, but keep the bars alive
63 | for i=1,12 do
64 | hideActionButton(_G["ActionButton" .. i])
65 | hideActionButton(_G["MultiBarBottomLeftButton" .. i])
66 | hideActionButton(_G["MultiBarBottomRightButton" .. i])
67 | hideActionButton(_G["MultiBarRightButton" .. i])
68 | hideActionButton(_G["MultiBarLeftButton" .. i])
69 | hideActionButton(_G["MultiBar5Button" .. i])
70 | hideActionButton(_G["MultiBar6Button" .. i])
71 | hideActionButton(_G["MultiBar7Button" .. i])
72 | end
73 |
74 | hideActionBarFrame(MicroButtonAndBagsBar, false)
75 | hideActionBarFrame(StanceBar, true)
76 | hideActionBarFrame(PossessActionBar, true)
77 | hideActionBarFrame(MultiCastActionBarFrame, false)
78 | hideActionBarFrame(PetActionBar, true)
79 | hideActionBarFrame(StatusTrackingBarManager, false)
80 | hideActionBarFrame(BagsBar, true)
81 | hideActionBarFrame(MicroMenu, true)
82 |
83 | -- these events drive visibility, we want the MainMenuBar to remain invisible
84 | if MainMenuBar then -- <= 11.2.5
85 | MainMenuBar:UnregisterEvent("PLAYER_REGEN_ENABLED")
86 | MainMenuBar:UnregisterEvent("PLAYER_REGEN_DISABLED")
87 | MainMenuBar:UnregisterEvent("ACTIONBAR_SHOWGRID")
88 | MainMenuBar:UnregisterEvent("ACTIONBAR_HIDEGRID")
89 | end
90 |
91 | if C_AddOns.IsAddOnLoaded("Blizzard_NewPlayerExperience") then
92 | self:NPE_LoadUI()
93 | elseif NPE_LoadUI ~= nil then
94 | self:SecureHook("NPE_LoadUI")
95 | end
96 | end
97 |
98 | function Bartender4:NPE_LoadUI()
99 | if not (Tutorials and Tutorials.AddSpellToActionBar) then return end
100 |
101 | -- Action Bar drag tutorials
102 | Tutorials.AddSpellToActionBar:Disable()
103 | Tutorials.AddClassSpellToActionBar:Disable()
104 |
105 | -- these tutorials rely on finding valid action bar buttons, and error otherwise
106 | Tutorials.Intro_CombatTactics:Disable()
107 |
108 | -- enable spell pushing because the drag tutorial is turned off
109 | Tutorials.AutoPushSpellWatcher:Complete()
110 | end
111 |
--------------------------------------------------------------------------------
/VehicleBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 |
8 | -- register module
9 | local VehicleBarMod = Bartender4:NewModule("Vehicle", "AceHook-3.0")
10 |
11 | -- fetch upvalues
12 | local Bar = Bartender4.Bar.prototype
13 |
14 | local table_insert, setmetatable, pairs = table.insert, setmetatable, pairs
15 |
16 | -- GLOBALS: MainMenuBarVehicleLeaveButton, CanExitVehicle
17 |
18 | -- create prototype information
19 | local VehicleBar = setmetatable({}, {__index = Bar})
20 |
21 | local defaults = { profile = Bartender4.Util:Merge({
22 | enabled = true,
23 | visibility = {
24 | vehicleui = false,
25 | overridebar = false,
26 | },
27 | }, Bartender4.Bar.defaults) }
28 |
29 | function VehicleBarMod:OnInitialize()
30 | self.db = Bartender4.db:RegisterNamespace("Vehicle", defaults)
31 | self:SetEnabledState(self.db.profile.enabled)
32 | end
33 |
34 | function VehicleBarMod:OnEnable()
35 | if not self.bar then
36 | self.bar = setmetatable(Bartender4.Bar:Create("Vehicle", self.db.profile, L["Vehicle Bar"]), {__index = VehicleBar})
37 | self.bar.content = MainMenuBarVehicleLeaveButton
38 |
39 | -- remove EditMode hooks
40 | self.bar.content.ClearAllPoints = nil
41 | self.bar.content.SetPoint = nil
42 | self.bar.content.SetScale = nil
43 |
44 | self.bar.content:SetParent(self.bar)
45 | self.bar.content:SetScript("OnShow", nil)
46 | self.bar.content:SetScript("OnHide", nil)
47 | end
48 | if MainMenuBarVehicleLeaveButton_Update then
49 | self:RawHook("MainMenuBarVehicleLeaveButton_Update", true)
50 | else
51 | self:SecureHook(MainMenuBarVehicleLeaveButton, "Update", "MainMenuBarVehicleLeaveButton_Update")
52 | end
53 |
54 | if MainMenuBarVehicleLeaveButton.ApplySystemAnchor then
55 | self:SecureHook(MainMenuBarVehicleLeaveButton, "ApplySystemAnchor")
56 | self:SecureHook(MainMenuBarVehicleLeaveButton, "HighlightSystem")
57 | end
58 |
59 | if EditModeManagerFrame and EditModeManagerFrame.UpdateBottomActionBarPositions then
60 | self:SecureHook(EditModeManagerFrame, "UpdateBottomActionBarPositions", "ApplySystemAnchor")
61 | end
62 |
63 | if UIParentBottomManagedFrameContainer then
64 | UIParentBottomManagedFrameContainer.showingFrames[MainMenuBarVehicleLeaveButton] = nil
65 | end
66 |
67 | self.bar:Enable()
68 | self:ToggleOptions()
69 | self:ApplyConfig()
70 | end
71 |
72 | function VehicleBarMod:ApplyConfig()
73 | self.bar:ApplyConfig(self.db.profile)
74 | end
75 |
76 | local function ShouldVehicleButtonBeShown()
77 | if not CanExitVehicle then
78 | return UnitOnTaxi("player")
79 | else
80 | return CanExitVehicle()
81 | end
82 | end
83 |
84 | function VehicleBarMod:MainMenuBarVehicleLeaveButton_Update()
85 | if ShouldVehicleButtonBeShown() then
86 | self.bar:PerformLayout()
87 | MainMenuBarVehicleLeaveButton:Show()
88 | MainMenuBarVehicleLeaveButton:Enable()
89 | else
90 | MainMenuBarVehicleLeaveButton:SetHighlightTexture([[Interface\Buttons\ButtonHilight-Square]], "ADD")
91 | MainMenuBarVehicleLeaveButton:UnlockHighlight()
92 | MainMenuBarVehicleLeaveButton:Hide()
93 | end
94 | end
95 |
96 | function VehicleBarMod:ApplySystemAnchor()
97 | self.bar:PerformLayout()
98 | end
99 |
100 | function VehicleBarMod:HighlightSystem()
101 | MainMenuBarVehicleLeaveButton.Selection:Hide()
102 | EditModeMagnetismManager:UnregisterFrame(MainMenuBarVehicleLeaveButton)
103 | end
104 |
105 | function VehicleBar:ApplyConfig(config)
106 | Bar.ApplyConfig(self, config)
107 |
108 | if not self.config.position.x then
109 | self:ClearSetPoint("CENTER", 120, 27)
110 | self:PerformLayout()
111 | self:SavePosition()
112 | end
113 |
114 | self:PerformLayout()
115 | end
116 |
117 | function VehicleBar:PerformLayout()
118 | self:SetSize(32,32)
119 | local bar = self.content
120 | bar:ClearAllPoints()
121 | bar:SetPoint("TOPLEFT", 0, 0)
122 | end
123 |
--------------------------------------------------------------------------------
/Options/BlizzardArt.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009, CMTitan
3 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
4 | Based on Nevcairiel's RepXPBar.lua
5 | All rights to be transferred to Nevcairiel upon inclusion into Bartender4.
6 | All rights reserved, otherwise.
7 | ]]
8 | -- fetch upvalues
9 | local _, Bartender4 = ...
10 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
11 | local Bar = Bartender4.Bar.prototype
12 |
13 | local BlizzardArtMod = Bartender4:GetModule("BlizzardArt")
14 |
15 | local WoW10 = select(4, GetBuildInfo()) >= 100000
16 |
17 | function BlizzardArtMod:SetupOptions()
18 | if not self.options then
19 | self.optionobject = Bar:GetOptionObject()
20 | local enabled = {
21 | type = "toggle",
22 | order = 1,
23 | name = L["Enabled"],
24 | desc = L["Enable the Blizzard Art Bar"],
25 | get = function() return self.db.profile.enabled end,
26 | set = "ToggleModule",
27 | handler = self,
28 | width = "full",
29 | }
30 | self.optionobject:AddElement("general", "enabled", enabled)
31 | local layout = {
32 | type = "select",
33 | order = 40,
34 | name = L["Layout"],
35 | desc = L["Choose between the classic WoW layout and two variations"],
36 | values = WoW10 and {MODERN=L["Modern"], MODERNARTCLASSIC=L["Modern Art, Classic"], CLASSIC=L["Classic"], ONEBAR=L["One action bar only"], TWOBAR=L["Two action bars"]} or {CLASSIC=L["Classic"], ONEBAR=L["One action bar only"], TWOBAR=L["Two action bars"]},
37 | get = function() return self.db.profile.artLayout end,
38 | set = function(info, val) self.db.profile.artLayout = val; BlizzardArtMod:ApplyConfig() end,
39 | }
40 | self.optionobject:AddElement("general", "artlayout", layout)
41 | local background = {
42 | type = "select",
43 | order = 41,
44 | name = L["Empty button background"],
45 | desc = L["The background of button places where no buttons are placed"],
46 | values = {DWARF=L["Griffin"], HUMAN=L["Lion"]},
47 | get = function() return self.db.profile.artSkin end,
48 | set = function(info, val) self.db.profile.artSkin = val; BlizzardArtMod:ApplyConfig() end,
49 | hidden = function() return self.db.profile.artLayout == "MODERN" or self.db.profile.artLayout == "MODERNARTCLASSIC" end,
50 | }
51 | self.optionobject:AddElement("general", "artskin", background)
52 | local endcapleft = {
53 | type = "select",
54 | order = 42,
55 | name = L["Left ending"],
56 | desc = L["Choose the ending to the left"],
57 | values = {NONE=L["None"], DWARF=L["Griffin"], HUMAN=L["Lion"]},
58 | get = function() return self.db.profile.leftCap end,
59 | set = function(info, val) self.db.profile.leftCap = val; BlizzardArtMod:ApplyConfig() end,
60 | hidden = function() return self.db.profile.artLayout == "MODERN" or self.db.profile.artLayout == "MODERNARTCLASSIC" end,
61 | }
62 | self.optionobject:AddElement("general", "endcapleft", endcapleft)
63 | local endcapright = {
64 | type = "select",
65 | order = 43,
66 | name = L["Right ending"],
67 | desc = L["Choose the ending to the right"],
68 | values = {NONE=L["None"], DWARF=L["Griffin"], HUMAN=L["Lion"]},
69 | get = function() return self.db.profile.rightCap end,
70 | set = function(info, val) self.db.profile.rightCap = val; BlizzardArtMod:ApplyConfig() end,
71 | hidden = function() return self.db.profile.artLayout == "MODERN" or self.db.profile.artLayout == "MODERNARTCLASSIC" end,
72 | }
73 | self.optionobject:AddElement("general", "endcapright", endcapright)
74 |
75 | self.disabledoptions = {
76 | general = {
77 | type = "group",
78 | name = L["General Settings"],
79 | cmdInline = true,
80 | order = 1,
81 | args = {
82 | enabled = enabled,
83 | }
84 | }
85 | }
86 | self.options = {
87 | order = 101,
88 | type = "group",
89 | name = L["Blizzard Art Bar"],
90 | desc = L["The Blizzard Art Bar manages the background artwork to re-create a good looking bottom action bar cluster"],
91 | childGroups = "tab",
92 | }
93 | Bartender4:RegisterBarOptions("BlizzardArt", self.options)
94 | end
95 | self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
96 | end
97 |
--------------------------------------------------------------------------------
/BagBarClassic.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 |
7 | local WoW10 = select(4, GetBuildInfo()) >= 100000
8 | if WoW10 then return end
9 |
10 | local WoWClassicEra = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC)
11 |
12 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
13 | -- register module
14 | local BagBarMod = Bartender4:NewModule("BagBar", "AceHook-3.0")
15 |
16 | -- fetch upvalues
17 | local ButtonBar = Bartender4.ButtonBar.prototype
18 | local Masque = LibStub("Masque", true)
19 |
20 | local _G = _G
21 | local next, pairs, setmetatable = next, pairs, setmetatable
22 | local table_insert, table_remove = table.insert, table.remove
23 |
24 | -- GLOBALS: UIParent, MainMenuBarBackpackButton, CharacterBag0Slot, CharacterBag1Slot, CharacterBag2Slot, CharacterBag3Slot, KeyRingButton
25 |
26 | -- create prototype information
27 | local BagBar = setmetatable({}, {__index = ButtonBar})
28 |
29 | local defaults = { profile = Bartender4.Util:Merge({
30 | enabled = true,
31 | verticalAlignment = "BOTTOM",
32 | keyring = true,
33 | onebag = false,
34 | visibility = {
35 | possess = false,
36 | },
37 | }, Bartender4.ButtonBar.defaults) }
38 |
39 | function BagBarMod:OnInitialize()
40 | self.db = Bartender4.db:RegisterNamespace("BagBar", defaults)
41 | self:SetEnabledState(self.db.profile.enabled)
42 | end
43 |
44 | local noopFunc = function() end
45 |
46 | function BagBarMod:OnEnable()
47 | if not self.bar then
48 | self.bar = setmetatable(Bartender4.ButtonBar:Create("BagBar", self.db.profile, L["Bag Bar"]), {__index = BagBar})
49 | end
50 | self.bar:Enable()
51 | self:ToggleOptions()
52 | self:ApplyConfig()
53 | end
54 |
55 | function BagBarMod:ApplyConfig()
56 | self.bar:ApplyConfig(self.db.profile)
57 | end
58 |
59 | function BagBar:ApplyConfig(config)
60 | ButtonBar.ApplyConfig(self, config)
61 |
62 | if not self.config.position.x then
63 | self:ClearSetPoint("CENTER", 142, -18)
64 | self:SavePosition()
65 | end
66 |
67 | self:FeedButtons()
68 | self:UpdateButtonLayout()
69 | end
70 |
71 | local function clearSetPoint(btn, ...)
72 | btn:ClearAllPoints()
73 | btn:SetPoint(...)
74 | end
75 |
76 | BagBar.button_width = 37
77 | BagBar.button_height = 37
78 | BagBarMod.button_count = 5
79 | function BagBar:FeedButtons()
80 | local count = 1
81 | if self.buttons then
82 | while next(self.buttons) do
83 | local btn = table_remove(self.buttons)
84 | btn:Hide()
85 | btn:SetParent(UIParent)
86 | btn:ClearSetPoint("CENTER")
87 |
88 | if btn ~= KeyRingButton then
89 | if btn.MasqueButtonData then
90 | local group = self.MasqueGroup
91 | group:RemoveButton(btn)
92 | end
93 | end
94 | end
95 | else
96 | self.buttons = {}
97 | end
98 |
99 | if KeyRingButton and WoWClassicEra and self.config.keyring then
100 | table_insert(self.buttons, KeyRingButton)
101 | count = count + 1
102 | elseif KeyRingButton then
103 | KeyRingButton:Hide()
104 | KeyRingButton:ClearAllPoints()
105 | end
106 |
107 | if not self.config.onebag then
108 | table_insert(self.buttons, CharacterBag3Slot)
109 | table_insert(self.buttons, CharacterBag2Slot)
110 | table_insert(self.buttons, CharacterBag1Slot)
111 | table_insert(self.buttons, CharacterBag0Slot)
112 | count = count + 4
113 | end
114 |
115 | table_insert(self.buttons, MainMenuBarBackpackButton)
116 |
117 | for i,v in pairs(self.buttons) do
118 | v:SetParent(self)
119 | v:Show()
120 | if v ~= KeyRingButton then
121 | v:ClearNormalTexture()
122 |
123 | if Masque then
124 | local group = self.MasqueGroup
125 | if not v.MasqueButtonData then
126 | v.MasqueButtonData = {
127 | Button = v,
128 | Icon = _G[v:GetName() .. "IconTexture"],
129 | }
130 | end
131 | group:AddButton(v, v.MasqueButtonData, "Item")
132 | end
133 | end
134 |
135 | v.ClearSetPoint = clearSetPoint
136 | end
137 |
138 | BagBarMod.button_count = count
139 | if BagBarMod.optionobject then
140 | BagBarMod.optionobject.table.general.args.rows.max = count
141 | end
142 | end
143 |
--------------------------------------------------------------------------------
/Options/ButtonBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 |
8 | local Bar = Bartender4.Bar.prototype
9 | local ButtonBar = Bartender4.ButtonBar.prototype
10 |
11 | local tostring, assert = tostring, assert
12 |
13 | -- GLOBALS: LibStub
14 |
15 | --[[===================================================================================
16 | Bar Options
17 | ===================================================================================]]--
18 |
19 | -- option utilty functions
20 | local optGetter, optSetter
21 | do
22 | local getBar, optionMap, callFunc
23 | local barregistry = Bartender4.Bar.barregistry
24 | -- maps option keys to function names
25 | optionMap = {
26 | rows = "Rows",
27 | padding = "Padding",
28 | zoom = "Zoom",
29 | macrotext = "HideMacroText",
30 | hotkey = "HideHotkey",
31 | equipped = "HideEquipped",
32 | border = "HideBorder",
33 | vgrowth = "VGrowth",
34 | hgrowth = "HGrowth",
35 | }
36 |
37 | -- retrieves a valid bar object from the barregistry table
38 | function getBar(id)
39 | local bar = barregistry[tostring(id)]
40 | assert(bar, ("Invalid bar id in options table. (%s)"):format(id))
41 | return bar
42 | end
43 |
44 | -- calls a function on the bar
45 | function callFunc(bar, type, option, ...)
46 | local func = type .. (optionMap[option] or option)
47 | assert(bar[func], ("Invalid get/set function %s in bar %s."):format(func, bar.id))
48 | return bar[func](bar, ...)
49 | end
50 |
51 | -- universal function to get a option
52 | function optGetter(info)
53 | local bar = getBar(info[2])
54 | local option = info[#info]
55 | return callFunc(bar, "Get", option)
56 | end
57 |
58 | -- universal function to set a option
59 | function optSetter(info, ...)
60 | local bar = getBar(info[2])
61 | local option = info[#info]
62 | return callFunc(bar, "Set", option, ...)
63 | end
64 | end
65 |
66 | function ButtonBar:GetOptionObject()
67 | local obj = Bar.GetOptionObject()
68 | local otbl_general = {
69 | padding = {
70 | order = 40,
71 | type = "range",
72 | name = L["Padding"],
73 | desc = L["Configure the padding of the buttons."],
74 | softMin = -10, softMax = 20, bigStep = 1,
75 | set = optSetter,
76 | get = optGetter,
77 | },
78 | rows = {
79 | order = 70,
80 | name = L["Rows"],
81 | desc = L["Number of rows."],
82 | type = "range",
83 | min = 1, max = 12, step = 1,
84 | set = optSetter,
85 | get = optGetter,
86 | },
87 | vgrowth = {
88 | order = 75,
89 | name = L["Vertical Growth"],
90 | desc = L["Vertical growth direction for this bar."],
91 | type = "select",
92 | values = {UP = L["Up"], DOWN = L["Down"]},
93 | set = optSetter,
94 | get = optGetter,
95 | },
96 | hgrowth = {
97 | order = 76,
98 | name = L["Horizontal Growth"],
99 | desc = L["Horizontal growth direction for this bar."],
100 | type = "select",
101 | values = {LEFT = L["Left"], RIGHT = L["Right"], BOTH = L["Both"]},
102 | set = optSetter,
103 | get = optGetter,
104 | },
105 | hidedesc = {
106 | order = 80,
107 | name = L["Button Look"],
108 | type = "header",
109 | },
110 | macrotext = {
111 | order = 81,
112 | type = "toggle",
113 | name = L["Hide Macro Text"],
114 | desc = L["Hide the Macro Text on the buttons of this bar."],
115 | set = optSetter,
116 | get = optGetter,
117 | },
118 | hotkey = {
119 | order = 82,
120 | type = "toggle",
121 | name = L["Hide Hotkey"],
122 | desc = L["Hide the Hotkey on the buttons of this bar."],
123 | set = optSetter,
124 | get = optGetter,
125 | },
126 | equipped = {
127 | order = 83,
128 | type = "toggle",
129 | name = L["Hide Equipped Border"],
130 | desc = L["Hide the inner border indicating the equipped status on the buttons of this bar."],
131 | set = optSetter,
132 | get = optGetter,
133 | },
134 | zoom = {
135 | order = 85,
136 | name = L["Zoom"],
137 | type = "toggle",
138 | desc = L["Toggle Button Zoom\nFor more style options you need to install Masque"],
139 | get = optGetter,
140 | set = optSetter,
141 | hidden = function() return LibStub("Masque", true) and true or false end,
142 | },
143 | }
144 | obj:AddElementGroup("general", otbl_general)
145 | return obj
146 | end
147 |
--------------------------------------------------------------------------------
/ExtraActionBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 |
8 | if not ExtraAbilityContainer and not ExtraActionBarFrame then return end
9 |
10 | -- register module
11 | local ExtraActionBarMod = Bartender4:NewModule("ExtraActionBar", "AceHook-3.0")
12 |
13 | -- fetch upvalues
14 | local Bar = Bartender4.Bar.prototype
15 |
16 | local setmetatable = setmetatable
17 |
18 | -- create prototype information
19 | local ExtraActionBar = setmetatable({}, {__index = Bar})
20 |
21 | local defaults = { profile = Bartender4.Util:Merge({
22 | enabled = true,
23 | hideArtwork = false,
24 | visibility = {
25 | vehicleui = false,
26 | overridebar = false,
27 | },
28 | }, Bartender4.Bar.defaults) }
29 |
30 | function ExtraActionBarMod:OnInitialize()
31 | self.db = Bartender4.db:RegisterNamespace("ExtraActionBar", defaults)
32 | self:SetEnabledState(self.db.profile.enabled)
33 | end
34 |
35 | local SetPointFromBT = nil
36 | function ExtraActionBarMod:OnEnable()
37 | if not self.bar then
38 | self.bar = setmetatable(Bartender4.Bar:Create("ExtraActionBar", self.db.profile, L["Extra Action Bar"], 2), {__index = ExtraActionBar})
39 | self.bar.content = ExtraAbilityContainer or ExtraActionBarFrame
40 |
41 | -- remove EditMode hooks
42 | self.bar.content.ClearAllPoints = nil
43 | self.bar.content.SetPoint = nil
44 | self.bar.content.SetScale = nil
45 |
46 | self.bar.content:SetToplevel(false)
47 | self.bar.content:SetParent(self.bar)
48 | if ExtraAbilityContainer then
49 | self.bar.content:SetScript("OnShow", nil)
50 | self.bar.content:SetScript("OnHide", nil)
51 |
52 | -- can't fully take it of EditMode, but can override it
53 | hooksecurefunc(ExtraAbilityContainer, "SetPoint", function() if not SetPointFromBT then self.bar:PerformLayout() end end)
54 | end
55 | end
56 | self.bar:Enable()
57 | self:ToggleOptions()
58 | self:ApplyConfig()
59 |
60 | if _G["ExtraActionBar_Update"] and ZoneAbilityFrame then
61 | self:SecureHook("ExtraActionBar_Update")
62 | self:SecureHook(ZoneAbilityFrame, "UpdateDisplayedZoneAbilities")
63 | end
64 | if ExtraAbilityContainer and ExtraAbilityContainer.ApplySystemAnchor then
65 | self:SecureHook(ExtraAbilityContainer, "ApplySystemAnchor")
66 | self:SecureHook(ExtraAbilityContainer, "HighlightSystem")
67 | end
68 |
69 | if UIParentBottomManagedFrameContainer and ExtraAbilityContainer then
70 | UIParentBottomManagedFrameContainer.showingFrames[ExtraAbilityContainer] = nil
71 | end
72 | end
73 |
74 | function ExtraActionBarMod:ApplyConfig()
75 | self.bar:ApplyConfig(self.db.profile)
76 | self:UpdateArtwork()
77 | end
78 |
79 | function ExtraActionBarMod:UpdateArtwork()
80 | self:ExtraActionBar_Update()
81 | self:UpdateDisplayedZoneAbilities()
82 | end
83 |
84 | function ExtraActionBarMod:ExtraActionBar_Update()
85 | if HasExtraActionBar() then
86 | ExtraActionBarFrame.button.style:SetShown(not self.db.profile.hideArtwork)
87 | end
88 | end
89 |
90 | function ExtraActionBarMod:UpdateDisplayedZoneAbilities()
91 | if ZoneAbilityFrame then
92 | ZoneAbilityFrame.Style:SetShown(not self.db.profile.hideArtwork)
93 | end
94 | end
95 |
96 | function ExtraActionBarMod:HighlightSystem()
97 | ExtraAbilityContainer.Selection:Hide()
98 | EditModeMagnetismManager:UnregisterFrame(ExtraAbilityContainer)
99 | end
100 |
101 | function ExtraActionBarMod:ApplySystemAnchor()
102 | if UIParentBottomManagedFrameContainer then
103 | UIParentBottomManagedFrameContainer.showingFrames[ExtraAbilityContainer] = nil
104 | end
105 |
106 | self.bar:PerformLayout()
107 | end
108 |
109 | if ExtraAbilityContainer then
110 | ExtraActionBar.width = 128
111 | ExtraActionBar.height = 128
112 | end
113 |
114 | function ExtraActionBar:ApplyConfig(config)
115 | Bar.ApplyConfig(self, config)
116 |
117 | if not self.config.position.x then
118 | self:ClearSetPoint("BOTTOM", 0, 160)
119 | self:SavePosition()
120 | end
121 |
122 | self:PerformLayout()
123 | end
124 |
125 | function ExtraActionBar:PerformLayout()
126 | if InCombatLockdown() then return end
127 |
128 | SetPointFromBT = true
129 |
130 | self:SetSize(128, 128)
131 | local bar = self.content
132 | bar:SetParent(self)
133 | bar:ClearAllPoints()
134 | bar:SetPoint("CENTER", self, "TOPLEFT", 64, -64)
135 |
136 | SetPointFromBT = nil
137 | end
138 |
--------------------------------------------------------------------------------
/BagBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 |
7 | local WoW10 = select(4, GetBuildInfo()) >= 100000
8 | if not WoW10 then return end
9 |
10 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
11 | -- register module
12 | local BagBarMod = Bartender4:NewModule("BagBar", "AceHook-3.0")
13 |
14 | -- fetch upvalues
15 | local ButtonBar = Bartender4.ButtonBar.prototype
16 | local Masque = LibStub("Masque", true)
17 |
18 | local _G = _G
19 | local next, pairs, setmetatable = next, pairs, setmetatable
20 | local table_insert, table_remove = table.insert, table.remove
21 |
22 | -- create prototype information
23 | local BagBar = setmetatable({}, {__index = ButtonBar})
24 |
25 | local defaults = { profile = Bartender4.Util:Merge({
26 | enabled = true,
27 | verticalAlignment = "CENTER",
28 | onebag = false,
29 | onebagreagents = true,
30 | visibility = {
31 | possess = false,
32 | },
33 | }, Bartender4.ButtonBar.defaults) }
34 |
35 | function BagBarMod:OnInitialize()
36 | self.db = Bartender4.db:RegisterNamespace("BagBar", defaults)
37 | self:SetEnabledState(self.db.profile.enabled)
38 | end
39 |
40 | local noopFunc = function() end
41 |
42 | function BagBarMod:OnEnable()
43 | if not self.bar then
44 | self.bar = setmetatable(Bartender4.ButtonBar:Create("BagBar", self.db.profile, L["Bag Bar"]), {__index = BagBar})
45 |
46 | CharacterReagentBag0Slot.SetBarExpanded = noopFunc
47 | CharacterBag3Slot.SetBarExpanded = noopFunc
48 | CharacterBag2Slot.SetBarExpanded = noopFunc
49 | CharacterBag1Slot.SetBarExpanded = noopFunc
50 | CharacterBag0Slot.SetBarExpanded = noopFunc
51 | end
52 | self.bar:Enable()
53 | self:ToggleOptions()
54 | self:ApplyConfig()
55 |
56 | if BagsBar and BagsBar.Layout then
57 | self:SecureHook(BagsBar, "Layout", "BagsBar_Layout")
58 | EventRegistry:UnregisterCallback("MainMenuBarManager.OnExpandChanged", BagsBar);
59 | end
60 | end
61 |
62 | function BagBarMod:ApplyConfig()
63 | self.bar:ApplyConfig(self.db.profile)
64 | end
65 |
66 | function BagBarMod:BagsBar_Layout()
67 | self.bar:UpdateButtonLayout()
68 | end
69 |
70 | function BagBar:ApplyConfig(config)
71 | ButtonBar.ApplyConfig(self, config)
72 |
73 | if not self.config.position.x then
74 | self:ClearSetPoint("CENTER", 142, -18)
75 | self:SavePosition()
76 | end
77 |
78 | self:FeedButtons()
79 | self:UpdateButtonLayout()
80 | end
81 |
82 | local function clearSetPoint(btn, ...)
83 | btn:ClearAllPoints()
84 | btn:SetPoint(...)
85 | end
86 |
87 | local function MasqueButtonType(button)
88 | if button == CharacterReagentBag0Slot then
89 | return "ReagentBag"
90 | elseif button == MainMenuBarBackpackButton then
91 | return "Backpack"
92 | else
93 | return "BagSlot"
94 | end
95 | end
96 |
97 | BagBar.button_width = 30
98 | BagBar.button_height = 30
99 | BagBarMod.button_count = 6
100 | function BagBar:FeedButtons()
101 | local count = 1
102 | local group = self.MasqueGroup
103 |
104 | if self.buttons then
105 | while next(self.buttons) do
106 | local btn = table_remove(self.buttons)
107 | btn:Hide()
108 | btn:SetParent(UIParent)
109 | btn:ClearSetPoint("CENTER")
110 |
111 | if group and btn.MasqueButtonData then
112 | group:RemoveButton(btn)
113 | end
114 | end
115 | else
116 | self.buttons = {}
117 | end
118 |
119 | if not self.config.onebag or self.config.onebagreagents then
120 | table_insert(self.buttons, CharacterReagentBag0Slot)
121 | count = count + 1
122 | end
123 |
124 | if not self.config.onebag then
125 | table_insert(self.buttons, CharacterBag3Slot)
126 | table_insert(self.buttons, CharacterBag2Slot)
127 | table_insert(self.buttons, CharacterBag1Slot)
128 | table_insert(self.buttons, CharacterBag0Slot)
129 |
130 | count = count + 4
131 | end
132 |
133 | table_insert(self.buttons, MainMenuBarBackpackButton)
134 |
135 | for i,v in pairs(self.buttons) do
136 | v:SetParent(self)
137 | v:Show()
138 |
139 | if group then
140 | if not v.MasqueButtonData then
141 | v.MasqueButtonData = {
142 | Button = v,
143 | Icon = v.icon
144 | }
145 | end
146 | group:AddButton(v, v.MasqueButtonData, MasqueButtonType(v))
147 | end
148 |
149 | v.ClearSetPoint = clearSetPoint
150 | end
151 |
152 | BagBarMod.button_count = count
153 | if BagBarMod.optionobject then
154 | BagBarMod.optionobject.table.general.args.rows.max = count
155 | end
156 | end
157 |
158 | function BagBar:UpdateButtonLayout()
159 | ButtonBar.UpdateButtonLayout(self)
160 | local w, h = self:GetSize()
161 | self:SetSize(w + 14, h)
162 | end
163 |
--------------------------------------------------------------------------------
/.luacheckrc:
--------------------------------------------------------------------------------
1 | std = "lua51"
2 | max_line_length = false
3 | exclude_files = {
4 | "libs/",
5 | "locale/find-locale-strings.lua",
6 | ".luacheckrc"
7 | }
8 |
9 | ignore = {
10 | "11./BINDING_.*", -- Setting an undefined (Keybinding) global variable
11 | "211", -- Unused local variable
12 | "211/L", -- Unused local variable "L"
13 | "212", -- Unused argument
14 | "213", -- Unused loop variable
15 | "311", -- Value assigned to a local variable is unused
16 | "542", -- empty if branch
17 | }
18 |
19 | globals = {
20 | "_G",
21 | "UIPARENT_MANAGED_FRAME_POSITIONS",
22 | "ShowPetActionBar",
23 |
24 | "CharacterReagentBag0Slot",
25 | "CharacterBag3Slot",
26 | "CharacterBag2Slot",
27 | "CharacterBag1Slot",
28 | "CharacterBag0Slot",
29 | "MainMenuBarBackpackButton",
30 | "MicroMenu",
31 |
32 | "UIParentBottomManagedFrameContainer",
33 | }
34 |
35 | read_globals = {
36 | "bit",
37 | "max", "min", "floor", "ceil",
38 | "format",
39 | "hooksecurefunc",
40 | "issecurevariable",
41 | "CopyTable",
42 | "tDeleteItem",
43 | "table.wipe",
44 |
45 | -- misc custom, third party libraries
46 | "LibStub",
47 | "KeyboundDialog",
48 | "AceGUIWidgetLSMlists",
49 |
50 | -- API groups
51 | "C_AddOns",
52 | "C_LFGList",
53 | "C_PetBattles",
54 | "C_SpecializationInfo",
55 | "C_Spell",
56 | "C_SpellBook",
57 |
58 | -- API functions
59 | "AttemptToSaveBindings",
60 | "CanExitVehicle",
61 | "ClearOverrideBindings",
62 | "CreateFrame",
63 | "GetBindingKey",
64 | "GetBindingText",
65 | "GetBuildInfo",
66 | "GetClassicExpansionLevel",
67 | "GetCurrentBindingSet",
68 | "GetCursorInfo",
69 | "GetCVarBool",
70 | "GetModifiedClick",
71 | "GetNumShapeshiftForms",
72 | "GetPetActionCooldown",
73 | "GetPetActionInfo",
74 | "GetPetActionsUsable",
75 | "GetShapeshiftFormCooldown",
76 | "GetShapeshiftFormInfo",
77 | "GetSpecialization",
78 | "GetSpellBookItemInfo",
79 | "GetSpellInfo",
80 | "HasExtraActionBar",
81 | "InCombatLockdown",
82 | "IsKeyRingEnabled",
83 | "IsModifiedClick",
84 | "IsPetAttackAction",
85 | "MouseIsOver",
86 | "PickupPetAction",
87 | "PlaySound",
88 | "SaveBindings",
89 | "SetBinding",
90 | "SetBindingClick",
91 | "SetCVar",
92 | "SetModifiedClick",
93 | "SetOverrideBinding",
94 | "SetOverrideBindingClick",
95 | "UnitClass",
96 | "UnitFactionGroup",
97 | "UnitHasVehicleUI",
98 | "UnitOnTaxi",
99 | "VehicleExit",
100 |
101 | -- FrameXML functions
102 | "ActionBarController_GetCurrentActionBarState",
103 | "AnchorUtil",
104 | "AutoCastShine_AutoCastStart",
105 | "AutoCastShine_AutoCastStop",
106 | "CooldownFrame_Set",
107 | "EditModeMagnetismManager",
108 | "GridLayoutUtil",
109 | "HasMultiCastActionBar",
110 | "MainMenuBarVehicleLeaveButton_Update",
111 | "NPE_LoadUI",
112 | "RegisterStateDriver",
113 | "SetDesaturation",
114 | "Tutorials",
115 | "UnregisterStateDriver",
116 | "UpdateMicroButtonsParent",
117 |
118 | -- FrameXML Frames
119 | "AchievementMicroButton",
120 | "BagsBar",
121 | "CharacterMicroButton",
122 | "CollectionsMicroButton",
123 | "EditModeManagerFrame",
124 | "EJMicroButton",
125 | "EventRegistry",
126 | "ExtraAbilityContainer",
127 | "ExtraActionBarFrame",
128 | "GameTooltip",
129 | "GuildMicroButton",
130 | "HelpMicroButton",
131 | "PVPMicroButton",
132 | "MainActionBar",
133 | "MainMenuBar",
134 | "MainMenuBarArtFrame",
135 | "MainMenuBarArtFrameBackground",
136 | "MainMenuBarMaxLevelBar",
137 | "MainMenuMicroButton",
138 | "MainMenuBarVehicleLeaveButton",
139 | "MicroButtonAndBagsBar",
140 | "MultiBarBottomLeft",
141 | "MultiBarBottomRight",
142 | "MultiBarLeft",
143 | "MultiBarRight",
144 | "MultiBar5",
145 | "MultiBar6",
146 | "MultiBar7",
147 | "MultiCastActionBarFrame",
148 | "OverrideActionBar",
149 | "PetActionBar",
150 | "PetActionBarFrame",
151 | "PetBattleFrame",
152 | "PlayerTalentFrame",
153 | "PossessActionBar",
154 | "PossessBarFrame",
155 | "QueueStatusButton",
156 | "QueueStatusFrame",
157 | "QuestLogMicroButton",
158 | "SocialsMicroButton",
159 | "SpellbookMicroButton",
160 | "SpellFlyout",
161 | "StanceBar",
162 | "StanceBarFrame",
163 | "StatusTrackingBarManager",
164 | "StoreMicroButton",
165 | "TalentMicroButton",
166 | "UIParent",
167 | "WorldFrame",
168 | "ZoneAbilityFrame",
169 |
170 | -- FrameXML Misc
171 | "BackdropTemplateMixin",
172 | "ChatFontNormal",
173 | "GameFontNormal",
174 | "MICRO_BUTTONS",
175 | "Spell",
176 |
177 | -- FrameXML Constants
178 | "Enum",
179 | "LE_ACTIONBAR_STATE_MAIN",
180 | "LE_ACTIONBAR_STATE_OVERRIDE",
181 | "LEAVE_VEHICLE",
182 | "OKAY",
183 | "SOUNDKIT",
184 | "WOW_PROJECT_ID",
185 | "WOW_PROJECT_MAINLINE",
186 | "WOW_PROJECT_CLASSIC",
187 | "WOW_PROJECT_BURNING_CRUSADE_CLASSIC",
188 | "WOW_PROJECT_WRATH_CLASSIC",
189 | "WOW_PROJECT_CATACLYSM_CLASSIC",
190 | "WOW_PROJECT_MISTS_CLASSIC",
191 |
192 | -- Classic-only
193 | "KeyRingButton",
194 | "MainMenuBar_UpdateKeyRing",
195 | "MainMenuBarPerformanceBarFrame",
196 | "MainMenuExpBar",
197 | "ReputationWatchBar",
198 | }
199 |
--------------------------------------------------------------------------------
/PetBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 | -- register module
8 | local PetBarMod = Bartender4:NewModule("PetBar", "AceEvent-3.0")
9 |
10 | -- fetch upvalues
11 | local ActionBars = Bartender4:GetModule("ActionBars")
12 | local ButtonBar = Bartender4.ButtonBar.prototype
13 |
14 | local WoWClassicEra = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC)
15 | local WoWRetail = (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE)
16 |
17 | local setmetatable, select = setmetatable, select
18 |
19 | -- GLOBALS: InCombatLockdown, ClearOverrideBindings, GetBindingKey, SetOverrideBindingClick
20 |
21 | -- create prototype information
22 | local PetBar = setmetatable({}, {__index = ButtonBar})
23 |
24 | local defaults = { profile = Bartender4.Util:Merge({
25 | enabled = true,
26 | hidehotkey = true,
27 | showgrid = false,
28 | visibility = {
29 | nopet = true,
30 | vehicle = true,
31 | },
32 | }, Bartender4.ButtonBar.defaults) }
33 |
34 | function PetBarMod:OnInitialize()
35 | self.db = Bartender4.db:RegisterNamespace("PetBar", defaults)
36 | self:SetEnabledState(self.db.profile.enabled)
37 | end
38 |
39 | function PetBarMod:OnEnable()
40 | if not self.bar then
41 | self.bar = setmetatable(Bartender4.ButtonBar:Create("PetBar", self.db.profile, L["Pet Bar"]), {__index = PetBar})
42 |
43 | local buttons = {}
44 | for i=1,10 do
45 | buttons[i] = Bartender4.PetButton:Create(i, self.bar)
46 | end
47 | self.bar.buttons = buttons
48 |
49 | self.bar:SetScript("OnEvent", PetBar.OnEvent)
50 | end
51 | self.bar:Enable()
52 |
53 | self.bar:RegisterEvent("PLAYER_CONTROL_LOST")
54 | self.bar:RegisterEvent("PLAYER_CONTROL_GAINED")
55 | self.bar:RegisterEvent("PLAYER_FARSIGHT_FOCUS_CHANGED")
56 | self.bar:RegisterEvent("UNIT_PET")
57 | self.bar:RegisterEvent("UNIT_FLAGS")
58 | self.bar:RegisterEvent("PET_BAR_UPDATE")
59 | self.bar:RegisterEvent("PET_BAR_UPDATE_COOLDOWN")
60 | self.bar:RegisterEvent("PET_BAR_UPDATE_USABLE")
61 | self.bar:RegisterEvent("PET_UI_UPDATE")
62 | self.bar:RegisterEvent("PLAYER_TARGET_CHANGED")
63 | if not WoWClassicEra then
64 | self.bar:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR")
65 | end
66 | self.bar:RegisterEvent("PLAYER_MOUNT_DISPLAY_CHANGED")
67 | self.bar:RegisterUnitEvent("UNIT_AURA", "pet")
68 | self.bar:RegisterEvent("PET_BAR_SHOWGRID")
69 | self.bar:RegisterEvent("PET_BAR_HIDEGRID")
70 |
71 | self:ApplyConfig()
72 | self:ToggleOptions()
73 |
74 | self:RegisterEvent("UPDATE_BINDINGS", "ReassignBindings")
75 | self:ReassignBindings()
76 | end
77 |
78 | function PetBarMod:ReassignBindings()
79 | if InCombatLockdown() then return end
80 | if not self.bar or not self.bar.buttons then return end
81 | ClearOverrideBindings(self.bar)
82 |
83 | if not WoWRetail then
84 | for i = 1, 10 do
85 | local button, real_button = ("BONUSACTIONBUTTON%d"):format(i), ("CLICK BT4PetButton%d:LeftButton"):format(i)
86 | for k=1, select('#', GetBindingKey(real_button)) do
87 | local key = select(k, GetBindingKey(real_button))
88 | SetOverrideBinding(self.bar, false, key, button)
89 | end
90 | end
91 | else
92 | for i = 1, 10 do
93 | local button, real_button = ("BONUSACTIONBUTTON%d"):format(i), ("BT4PetButton%d"):format(i)
94 | for k=1, select('#', GetBindingKey(button)) do
95 | local key = select(k, GetBindingKey(button))
96 | SetOverrideBindingClick(self.bar, false, key, real_button)
97 | end
98 | end
99 | end
100 | end
101 |
102 | function PetBarMod:GetGrid()
103 | return self.db.profile.showgrid
104 | end
105 |
106 | function PetBarMod:SetGrid(grid)
107 | self.db.profile.showgrid = grid
108 | self.bar:ForAll("ShowGrid")
109 | self.bar:ForAll("HideGrid")
110 | end
111 |
112 | function PetBarMod:SetHideBorder(state)
113 | if state ~= nil then
114 | self.db.profile.hideborder = state
115 | end
116 | self.bar:ForAll("Update")
117 | end
118 |
119 | function PetBarMod:GetHideBorder()
120 | return self.db.profile.hideborder
121 | end
122 |
123 | function PetBarMod:ApplyConfig()
124 | if not self:IsEnabled() then return end
125 | self.bar:ApplyConfig(self.db.profile)
126 | self:ReassignBindings()
127 | end
128 |
129 | PetBar.button_width = 30
130 | PetBar.button_height = 30
131 | function PetBar:OnEvent(event, arg1)
132 | if ( event == "PET_BAR_UPDATE" or (event == "UNIT_PET" and arg1 == "player") or event == "PET_UI_UPDATE" or event == "UPDATE_VEHICLE_ACTIONBAR") then
133 | self:ForAll("Update")
134 | elseif ( event == "PLAYER_CONTROL_LOST" or event == "PLAYER_CONTROL_GAINED" or event == "PLAYER_FARSIGHT_FOCUS_CHANGED" or event == "PET_BAR_UPDATE_USABLE" or event == "PLAYER_TARGET_CHANGED" or event == "PLAYER_MOUNT_DISPLAY_CHANGED" ) then
135 | self:ForAll("Update")
136 | elseif ( (event == "UNIT_FLAGS") or (event == "UNIT_AURA") ) then
137 | if arg1 == "pet" then
138 | self:ForAll("Update")
139 | end
140 | elseif ( event =="PET_BAR_UPDATE_COOLDOWN" ) then
141 | self:ForAll("UpdateCooldown")
142 | elseif event == "PET_BAR_SHOWGRID" then
143 | self:ForAll("ShowGrid")
144 | elseif event == "PET_BAR_HIDEGRID" then
145 | self:ForAll("HideGrid")
146 | end
147 | end
148 |
149 | function PetBar:UpdateButtonConfig()
150 | self:ForAll("Update")
151 | end
152 |
153 | function PetBar:ApplyConfig(config)
154 | ButtonBar.ApplyConfig(self, config)
155 |
156 | if not self.config.position.x then
157 | self:ClearSetPoint("CENTER", 0, 70)
158 | self:SavePosition()
159 | end
160 |
161 | self:UpdateButtonLayout()
162 | self:ForAll("Update")
163 | self:ForAll("ApplyStyle", self.config.style)
164 | end
165 |
--------------------------------------------------------------------------------
/HideBlizzardClassic.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2022, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 |
7 | local WoWClassic = (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE)
8 | local WoWBCC = (WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC)
9 |
10 | if not WoWClassic or WoWBCC then
11 | return
12 | end
13 |
14 | local function hideActionBarFrame(frame, clearEvents, reanchor, noAnchorChanges)
15 | if frame then
16 | if clearEvents then
17 | frame:UnregisterAllEvents()
18 | end
19 |
20 | frame:Hide()
21 | frame:SetParent(Bartender4.UIHider)
22 |
23 | -- setup faux anchors so the frame position data returns valid
24 | if reanchor and not noAnchorChanges then
25 | local left, right, top, bottom = frame:GetLeft(), frame:GetRight(), frame:GetTop(), frame:GetBottom()
26 | frame:ClearAllPoints()
27 | if left and right and top and bottom then
28 | frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", left, top)
29 | frame:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMLEFT", right, bottom)
30 | else
31 | frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", 10, 10)
32 | frame:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMLEFT", 20, 20)
33 | end
34 | elseif not noAnchorChanges then
35 | frame:ClearAllPoints()
36 | end
37 | end
38 | end
39 |
40 | function Bartender4:HideBlizzard()
41 | -- Hidden parent frame
42 | local UIHider = CreateFrame("Frame")
43 | UIHider:Hide()
44 | self.UIHider = UIHider
45 |
46 | MultiBarBottomLeft:SetParent(UIHider)
47 | MultiBarBottomRight:SetParent(UIHider)
48 | MultiBarLeft:SetParent(UIHider)
49 | MultiBarRight:SetParent(UIHider)
50 |
51 | -- Hide MultiBar Buttons, but keep the bars alive
52 | for i=1,12 do
53 | _G["ActionButton" .. i]:Hide()
54 | _G["ActionButton" .. i]:UnregisterAllEvents()
55 | _G["ActionButton" .. i]:SetAttribute("statehidden", true)
56 |
57 | _G["MultiBarBottomLeftButton" .. i]:Hide()
58 | _G["MultiBarBottomLeftButton" .. i]:UnregisterAllEvents()
59 | _G["MultiBarBottomLeftButton" .. i]:SetAttribute("statehidden", true)
60 |
61 | _G["MultiBarBottomRightButton" .. i]:Hide()
62 | _G["MultiBarBottomRightButton" .. i]:UnregisterAllEvents()
63 | _G["MultiBarBottomRightButton" .. i]:SetAttribute("statehidden", true)
64 |
65 | _G["MultiBarRightButton" .. i]:Hide()
66 | _G["MultiBarRightButton" .. i]:UnregisterAllEvents()
67 | _G["MultiBarRightButton" .. i]:SetAttribute("statehidden", true)
68 |
69 | _G["MultiBarLeftButton" .. i]:Hide()
70 | _G["MultiBarLeftButton" .. i]:UnregisterAllEvents()
71 | _G["MultiBarLeftButton" .. i]:SetAttribute("statehidden", true)
72 | end
73 | UIPARENT_MANAGED_FRAME_POSITIONS["MainMenuBar"] = nil
74 | UIPARENT_MANAGED_FRAME_POSITIONS["StanceBarFrame"] = nil
75 | UIPARENT_MANAGED_FRAME_POSITIONS["PossessBarFrame"] = nil
76 | UIPARENT_MANAGED_FRAME_POSITIONS["MultiCastActionBarFrame"] = nil
77 | UIPARENT_MANAGED_FRAME_POSITIONS["PETACTIONBAR_YPOS"] = nil
78 | UIPARENT_MANAGED_FRAME_POSITIONS["ExtraAbilityContainer"] = nil
79 |
80 | --MainMenuBar:UnregisterAllEvents()
81 | --MainMenuBar:SetParent(UIHider)
82 | --MainMenuBar:Hide()
83 | MainMenuBar:EnableMouse(false)
84 | MainMenuBar:UnregisterEvent("DISPLAY_SIZE_CHANGED")
85 | MainMenuBar:UnregisterEvent("UI_SCALE_CHANGED")
86 |
87 |
88 | local animations = {MainMenuBar.slideOut:GetAnimations()}
89 | animations[1]:SetOffset(0,0)
90 |
91 | if OverrideActionBar then -- classic doesn't have this
92 | animations = {OverrideActionBar.slideOut:GetAnimations()}
93 | animations[1]:SetOffset(0,0)
94 |
95 | -- when blizzard vehicle is turned off, we need to manually fix the state since the OverrideActionBar animation wont run
96 | hooksecurefunc("BeginActionBarTransition", function(bar, animIn)
97 | if bar == OverrideActionBar and not self.db.profile.blizzardVehicle then
98 | OverrideActionBar.slideOut:Stop()
99 | MainMenuBar:Show()
100 | end
101 | end)
102 | end
103 |
104 | hideActionBarFrame(MainMenuBarArtFrame, false, true)
105 | hideActionBarFrame(MainMenuBarArtFrameBackground)
106 | hideActionBarFrame(MicroButtonAndBagsBar, false, false, true)
107 |
108 | if KeyRingButton then
109 | hideActionBarFrame(KeyRingButton, false, false)
110 | end
111 |
112 | if StatusTrackingBarManager then
113 | StatusTrackingBarManager:Hide()
114 | --StatusTrackingBarManager:SetParent(UIHider)
115 | end
116 |
117 | hideActionBarFrame(StanceBarFrame, true, true)
118 | hideActionBarFrame(PossessBarFrame, false, true)
119 | hideActionBarFrame(MultiCastActionBarFrame, false, true)
120 | hideActionBarFrame(PetActionBarFrame, true, true)
121 | ShowPetActionBar = function() end
122 |
123 | --BonusActionBarFrame:UnregisterAllEvents()
124 | --BonusActionBarFrame:Hide()
125 | --BonusActionBarFrame:SetParent(UIHider)
126 |
127 | if not WoWClassic then
128 | if PlayerTalentFrame then
129 | PlayerTalentFrame:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
130 | else
131 | hooksecurefunc("TalentFrame_LoadUI", function() PlayerTalentFrame:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED") end)
132 | end
133 | end
134 |
135 | hideActionBarFrame(MainMenuBarPerformanceBarFrame, false, false, true)
136 | hideActionBarFrame(MainMenuExpBar, false, false, true)
137 | hideActionBarFrame(ReputationWatchBar, false, false, true)
138 | hideActionBarFrame(MainMenuBarMaxLevelBar, false, false, true)
139 |
140 | if C_AddOns.IsAddOnLoaded("Blizzard_NewPlayerExperience") then
141 | self:NPE_LoadUI()
142 | elseif NPE_LoadUI ~= nil then
143 | self:SecureHook("NPE_LoadUI")
144 | end
145 | end
146 |
147 | function Bartender4:NPE_LoadUI()
148 | if not (Tutorials and Tutorials.AddSpellToActionBar) then return end
149 |
150 | -- Action Bar drag tutorials
151 | Tutorials.AddSpellToActionBar:Disable()
152 | Tutorials.AddClassSpellToActionBar:Disable()
153 |
154 | -- these tutorials rely on finding valid action bar buttons, and error otherwise
155 | Tutorials.Intro_CombatTactics:Disable()
156 |
157 | -- enable spell pushing because the drag tutorial is turned off
158 | Tutorials.AutoPushSpellWatcher:Complete()
159 | end
160 |
--------------------------------------------------------------------------------
/Options/AceGUIWidget-NumberEditBox.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local AceGUI = LibStub("AceGUI-3.0")
6 |
7 | --------------------------
8 | -- Edit box --
9 | --------------------------
10 | --[[
11 | Events :
12 | OnTextChanged
13 | OnEnterPressed
14 |
15 | ]]
16 | do
17 | local Type = "NumberEditBox"
18 | local Version = 1
19 |
20 | local function OnAcquire(self)
21 | self:SetDisabled(false)
22 | self.showbutton = true
23 | end
24 |
25 | local function OnRelease(self)
26 | self.frame:ClearAllPoints()
27 | self.frame:Hide()
28 | self:SetDisabled(false)
29 | end
30 |
31 | local function Control_OnEnter(this)
32 | this.obj:Fire("OnEnter")
33 | end
34 |
35 | local function Control_OnLeave(this)
36 | this.obj:Fire("OnLeave")
37 | end
38 |
39 | local function EditBox_OnEscapePressed(this)
40 | this:ClearFocus()
41 | end
42 |
43 | local function ShowButton(self)
44 | if self.showbutton then
45 | self.button:Show()
46 | self.editbox:SetTextInsets(0,20,3,3)
47 | end
48 | end
49 |
50 | local function HideButton(self)
51 | self.button:Hide()
52 | self.editbox:SetTextInsets(0,0,3,3)
53 | end
54 |
55 | local function EditBox_OnEnterPressed(this)
56 | local self = this.obj
57 | local value = tonumber(this:GetText()) or 0
58 | local cancel = self:Fire("OnEnterPressed",value)
59 | if not cancel then
60 | HideButton(self)
61 | end
62 | end
63 |
64 | local function Button_OnClick(this)
65 | local editbox = this.obj.editbox
66 | editbox:ClearFocus()
67 | EditBox_OnEnterPressed(editbox)
68 | end
69 |
70 | local function EditBox_OnTextChanged(this)
71 | local self = this.obj
72 | local value = tonumber(this:GetText()) or 0
73 | if value ~= self.lastvalue then
74 | self:Fire("OnTextChanged",value)
75 | self.lastvalue = value
76 | ShowButton(self)
77 | end
78 | end
79 |
80 | local function SetDisabled(self, disabled)
81 | self.disabled = disabled
82 | if disabled then
83 | self.editbox:EnableMouse(false)
84 | self.editbox:ClearFocus()
85 | self.editbox:SetTextColor(0.5,0.5,0.5)
86 | self.label:SetTextColor(0.5,0.5,0.5)
87 | else
88 | self.editbox:EnableMouse(true)
89 | self.editbox:SetTextColor(1,1,1)
90 | self.label:SetTextColor(1,.82,0)
91 | end
92 | end
93 |
94 | local function SetText(self, text)
95 | self.lastvalue = tonumber(text) or 0
96 | self.editbox:SetText(tostring(self.lastvalue))
97 | self.editbox:SetCursorPosition(0)
98 | HideButton(self)
99 | end
100 |
101 | local function SetWidth(self, width)
102 | self.frame:SetWidth(width)
103 | end
104 |
105 | local function SetLabel(self, text)
106 | if text and text ~= "" then
107 | self.label:SetText(text)
108 | self.label:Show()
109 | self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,-18)
110 | self.frame:SetHeight(60)
111 | self.alignoffset = 30
112 | else
113 | self.label:SetText("")
114 | self.label:Hide()
115 | self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,0)
116 | self.frame:SetHeight(42)
117 | self.alignoffset = 12
118 | end
119 | end
120 |
121 | local function ModButton_OnClick(self)
122 | local value = self.obj.lastvalue
123 | value = math.floor(value + 0.5) + self.adjust
124 | self.obj.editbox:SetText(tostring(value))
125 | EditBox_OnEnterPressed(self.obj.editbox)
126 | end
127 |
128 | local function Constructor()
129 | local num = AceGUI:GetNextWidgetNum(Type)
130 | local frame = CreateFrame("Frame",nil,UIParent)
131 | local editbox = CreateFrame("EditBox","AceGUI-3.0NumberEditBox"..num,frame,"InputBoxTemplate")
132 |
133 | local self = {}
134 | self.type = Type
135 | self.num = num
136 |
137 | self.OnRelease = OnRelease
138 | self.OnAcquire = OnAcquire
139 |
140 | self.SetDisabled = SetDisabled
141 | self.SetText = SetText
142 | self.SetWidth = SetWidth
143 | self.SetLabel = SetLabel
144 |
145 | self.frame = frame
146 | frame.obj = self
147 | self.editbox = editbox
148 | editbox.obj = self
149 |
150 | self.alignoffset = 30
151 |
152 | frame:SetHeight(60)
153 | frame:SetWidth(200)
154 |
155 | editbox:SetScript("OnEnter",Control_OnEnter)
156 | editbox:SetScript("OnLeave",Control_OnLeave)
157 |
158 | editbox:SetAutoFocus(false)
159 | editbox:SetFontObject(ChatFontNormal)
160 | editbox:SetScript("OnEscapePressed",EditBox_OnEscapePressed)
161 | editbox:SetScript("OnEnterPressed",EditBox_OnEnterPressed)
162 | editbox:SetScript("OnTextChanged",EditBox_OnTextChanged)
163 |
164 | editbox:SetTextInsets(0,0,3,3)
165 | editbox:SetMaxLetters(256)
166 |
167 | editbox:SetPoint("BOTTOMLEFT",frame,"BOTTOMLEFT",6,15)
168 | editbox:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",0,15)
169 | editbox:SetHeight(19)
170 |
171 | local label = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall")
172 | label:SetPoint("TOPLEFT",frame,"TOPLEFT",0,-2)
173 | label:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,-2)
174 | label:SetJustifyH("LEFT")
175 | label:SetHeight(18)
176 | self.label = label
177 |
178 | local button = CreateFrame("Button",nil,editbox,"UIPanelButtonTemplate")
179 | button:SetWidth(40)
180 | button:SetHeight(20)
181 | button:SetPoint("RIGHT",editbox,"RIGHT",-2,0)
182 | button:SetText(OKAY)
183 | button:SetScript("OnClick", Button_OnClick)
184 | button:Hide()
185 |
186 | self.button = button
187 | button.obj = self
188 |
189 | local minus = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
190 | minus:SetWidth(20)
191 | minus:SetHeight(15)
192 | minus:SetPoint("TOPLEFT", editbox, "BOTTOMLEFT", -4, 0)
193 | minus:SetText("-")
194 | minus:Show()
195 | minus.adjust = -1
196 | minus:SetScript("OnClick", ModButton_OnClick)
197 | minus:SetFrameLevel(editbox:GetFrameLevel() + 2)
198 |
199 | self.minus = minus
200 | minus.obj = self
201 |
202 | local plus = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
203 | plus:SetWidth(20)
204 | plus:SetHeight(15)
205 | plus:SetPoint("TOPRIGHT", editbox, "BOTTOMRIGHT", -2, 0)
206 | plus:SetText("+")
207 | plus:Show()
208 | plus.adjust = 1
209 | plus:SetScript("OnClick", ModButton_OnClick)
210 | plus:SetFrameLevel(editbox:GetFrameLevel() + 2)
211 |
212 | self.plus = plus
213 | plus.obj = self
214 |
215 | AceGUI:RegisterAsWidget(self)
216 | return self
217 | end
218 |
219 | AceGUI:RegisterWidgetType(Type,Constructor,Version)
220 | end
221 |
--------------------------------------------------------------------------------
/ButtonBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | --[[ Generic Template for a Bar which contains Buttons ]]
6 | local _, Bartender4 = ...
7 | local Bar = Bartender4.Bar.prototype
8 |
9 | local WoW10 = select(4, GetBuildInfo()) >= 100000
10 |
11 | local setmetatable, tostring, pairs = setmetatable, tostring, pairs
12 |
13 | local ButtonBar = setmetatable({}, {__index = Bar})
14 | local ButtonBar_MT = {__index = ButtonBar}
15 |
16 | local defaults = Bartender4.Util:Merge({
17 | padding = 2,
18 | rows = 1,
19 | hidemacrotext = false,
20 | hidehotkey = false,
21 | hideequipped = false,
22 | hideborder = false,
23 | skin = {
24 | Zoom = false,
25 | },
26 | }, Bartender4.Bar.defaults)
27 |
28 | Bartender4.ButtonBar = {}
29 | Bartender4.ButtonBar.prototype = ButtonBar
30 | Bartender4.ButtonBar.defaults = defaults
31 |
32 | local Masque = LibStub("Masque", true)
33 |
34 | function Bartender4.ButtonBar:Create(id, config, name, noSkinning)
35 | local bar = setmetatable(Bartender4.Bar:Create(id, config, name), ButtonBar_MT)
36 |
37 | if Masque and not noSkinning then
38 | bar.MasqueGroup = Masque:Group("Bartender4", name, tostring(id))
39 | end
40 |
41 | return bar
42 | end
43 |
44 | ButtonBar.BT4BarType = "ButtonBar"
45 |
46 | function ButtonBar:ApplyConfig(config)
47 | Bar.ApplyConfig(self, config)
48 | -- any module inherting this template should call UpdateButtonLayout after setting up its buttons, we cannot call it here
49 | --self:UpdateButtonLayout()
50 | end
51 |
52 | function ButtonBar:UpdateButtonConfig()
53 |
54 | end
55 |
56 | -- get the current padding
57 | function ButtonBar:GetPadding()
58 | return self.config.padding
59 | end
60 |
61 | -- set the padding and refresh layout
62 | function ButtonBar:SetPadding(pad)
63 | if pad ~= nil then
64 | self.config.padding = pad
65 | end
66 | self:UpdateButtonLayout()
67 | end
68 |
69 |
70 | -- get the current number of rows
71 | function ButtonBar:GetRows()
72 | return self.config.rows
73 | end
74 |
75 | -- set the number of rows and refresh layout
76 | function ButtonBar:SetRows(rows)
77 | if rows ~= nil then
78 | self.config.rows = rows
79 | end
80 | self:UpdateButtonLayout()
81 | end
82 |
83 | function ButtonBar:GetZoom()
84 | return self.config.skin.Zoom
85 | end
86 |
87 | function ButtonBar:SetZoom(zoom)
88 | self.config.skin.Zoom = zoom
89 | self:UpdateButtonConfig()
90 | self:UpdateButtonLayout()
91 | end
92 |
93 | function ButtonBar:SetHideMacroText(state)
94 | if state ~= nil then
95 | self.config.hidemacrotext = state
96 | end
97 | self:UpdateButtonConfig()
98 | end
99 |
100 | function ButtonBar:GetHideMacroText()
101 | return self.config.hidemacrotext
102 | end
103 |
104 | function ButtonBar:SetHideHotkey(state)
105 | if state ~= nil then
106 | self.config.hidehotkey = state
107 | end
108 | self:UpdateButtonConfig()
109 | end
110 |
111 | function ButtonBar:GetHideHotkey()
112 | return self.config.hidehotkey
113 | end
114 |
115 | function ButtonBar:SetHideEquipped(state)
116 | if state ~= nil then
117 | self.config.hideequipped = state
118 | end
119 | self:UpdateButtonConfig()
120 | end
121 |
122 | function ButtonBar:GetHideEquipped()
123 | return self.config.hideequipped
124 | end
125 |
126 | function ButtonBar:SetHideBorder(state)
127 | if state ~= nil then
128 | self.config.hideborder = state
129 | end
130 | self:UpdateButtonConfig()
131 | end
132 |
133 | function ButtonBar:GetHideBorder()
134 | return self.config.hideborder
135 | end
136 |
137 | function ButtonBar:SetHGrowth(value)
138 | self.config.position.growHorizontal = value
139 | self:AnchorOverlay()
140 | self:UpdateButtonLayout()
141 | end
142 |
143 | function ButtonBar:GetHGrowth()
144 | return self.config.position.growHorizontal
145 | end
146 |
147 | function ButtonBar:SetVGrowth(value)
148 | self.config.position.growVertical = value
149 | self:AnchorOverlay()
150 | self:UpdateButtonLayout()
151 | end
152 |
153 | function ButtonBar:GetVGrowth()
154 | return self.config.position.growVertical
155 | end
156 |
157 |
158 | ButtonBar.ClickThroughSupport = true
159 | function ButtonBar:SetClickThrough(click)
160 | if click ~= nil then
161 | self.config.clickthrough = click
162 | end
163 | self:ForAll("EnableMouse", not self.config.clickthrough)
164 | end
165 |
166 | local math_floor = math.floor
167 | local math_ceil = math.ceil
168 | -- align the buttons and correct the size of the bar overlay frame
169 | ButtonBar.button_width = WoW10 and 45 or 36
170 | ButtonBar.button_height = WoW10 and 45 or 36
171 | function ButtonBar:UpdateButtonLayout()
172 | local buttons = self.buttons
173 | local pad = self:GetPadding()
174 |
175 | local numbuttons = self.numbuttons or #buttons
176 |
177 | -- bail out if the bar has no buttons, for whatever reason
178 | -- (eg. stanceless class, or no stances learned yet, etc.)
179 | if numbuttons == 0 then return end
180 |
181 | local Rows = self:GetRows()
182 | local ButtonPerRow = math_ceil(numbuttons / Rows) -- just a precaution
183 | Rows = math_ceil(numbuttons / ButtonPerRow)
184 | if Rows > numbuttons then
185 | Rows = numbuttons
186 | ButtonPerRow = 1
187 | end
188 |
189 | local hpad = pad + (self.hpad_offset or 0)
190 | local vpad = pad + (self.vpad_offset or 0)
191 |
192 | self:SetSize((self.button_width + hpad) * ButtonPerRow - hpad + 8, (self.button_height + vpad) * Rows - vpad + 8)
193 |
194 | local h1, h2, v1, v2
195 | local xOff, yOff
196 | if self.config.position.growHorizontal == "RIGHT" then
197 | h1, h2 = "LEFT", "RIGHT"
198 | xOff = 5
199 | elseif self.config.position.growHorizontal == "LEFT" then
200 | h1, h2 = "RIGHT", "LEFT"
201 | xOff = -3
202 |
203 | hpad = -hpad
204 | elseif self.config.position.growHorizontal == "BOTH" then
205 | h1, h2 = "LEFT", "RIGHT"
206 | xOff = (self.button_width + hpad) * (ButtonPerRow - 1) / -2
207 | end
208 |
209 | if self.config.position.growVertical == "DOWN" then
210 | v1, v2 = "TOP", "BOTTOM"
211 | yOff = -3
212 | else
213 | v1, v2 = "BOTTOM", "TOP"
214 | yOff = 5
215 |
216 | vpad = -vpad
217 | end
218 |
219 | local valign = "TOP"
220 | -- variable in-row button alignment
221 | if self.config.verticalAlignment then
222 | if self.config.verticalAlignment == "CENTER" then
223 | valign = ""
224 | elseif self.config.verticalAlignment == "BOTTOM" then
225 | valign = "BOTTOM"
226 | end
227 | -- otherwise, top
228 | end
229 |
230 | -- anchor button 1
231 | local anchor = self:GetAnchor()
232 | buttons[1]:ClearSetPoint(anchor, self, anchor, xOff, yOff - (self.vpad_offset or 0))
233 |
234 | -- and anchor all other buttons relative to our button 1
235 | for i = 2, numbuttons do
236 | -- jump into a new row
237 | if ((i-1) % ButtonPerRow) == 0 then
238 | buttons[i]:ClearSetPoint(v1 .. h1, buttons[i-ButtonPerRow], v2 .. h1, 0, -vpad)
239 | -- align to the previous button
240 | else
241 | buttons[i]:ClearSetPoint(valign .. h1, buttons[i-1], valign .. h2, hpad, 0)
242 | end
243 | end
244 |
245 | if not Masque then
246 | for i = 1, #buttons do
247 | local button = buttons[i]
248 | if button.icon and self.config.skin.Zoom then
249 | button.icon:SetTexCoord(0.07,0.93,0.07,0.93)
250 | elseif button.icon then
251 | button.icon:SetTexCoord(0,1,0,1)
252 | end
253 | end
254 | end
255 | end
256 |
257 | --[[===================================================================================
258 | Utility function
259 | ===================================================================================]]--
260 |
261 | -- get a iterator over all buttons
262 | function ButtonBar:GetAll()
263 | return pairs(self.buttons)
264 | end
265 |
266 | -- execute a member function on all buttons
267 | function ButtonBar:ForAll(method, ...)
268 | if not self.buttons then return end
269 | for _, button in self:GetAll() do
270 | local func = button[method]
271 | if func then
272 | func(button, ...)
273 | end
274 | end
275 | end
276 |
--------------------------------------------------------------------------------
/StanceBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 | -- register module
8 | local StanceBarMod = Bartender4:NewModule("StanceBar", "AceEvent-3.0")
9 |
10 | -- fetch upvalues
11 | local ButtonBar = Bartender4.ButtonBar.prototype
12 |
13 | local WoWClassicEra = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC)
14 |
15 | local _G = _G
16 | local format, setmetatable, min, select = string.format, setmetatable, min, select
17 |
18 | -- GLOBALS: CreateFrame, InCombatLockdown, ClearOverrideBindings, GetBindingKey, GetBindingText, SetOverrideBindingClick, SetBinding
19 | -- GLOBALS: GetNumShapeshiftForms, GetShapeshiftFormInfo, GetShapeshiftFormCooldown, CooldownFrame_Set
20 |
21 | -- create prototype information
22 | local StanceBar = setmetatable({}, {__index = ButtonBar})
23 | local StanceButtonPrototype = CreateFrame("CheckButton")
24 | local StanceButton_MT = {__index = StanceButtonPrototype}
25 |
26 | local Masque = LibStub("Masque", true)
27 | local KeyBound = LibStub("LibKeyBound-1.0")
28 |
29 | local defaults = { profile = Bartender4.Util:Merge({
30 | enabled = true,
31 | position = {
32 | scale = 1.5,
33 | },
34 | hidehotkey = true,
35 | }, Bartender4.ButtonBar.defaults) }
36 |
37 | function StanceBarMod:OnInitialize()
38 | self.db = Bartender4.db:RegisterNamespace("StanceBar", defaults)
39 | self:SetEnabledState(self.db.profile.enabled)
40 | end
41 |
42 | function StanceBarMod:OnEnable()
43 | if not self.bar then
44 | self.bar = setmetatable(Bartender4.ButtonBar:Create("StanceBar", self.db.profile, L["Stance Bar"]), {__index = StanceBar})
45 | self.bar:SetScript("OnEvent", StanceBar.OnEvent)
46 | end
47 | self.bar:Enable()
48 |
49 | self:ToggleOptions()
50 | self.bar:RegisterEvent("PLAYER_ENTERING_WORLD")
51 | self.bar:RegisterEvent("UPDATE_BONUS_ACTIONBAR")
52 | self.bar:RegisterEvent("ACTIONBAR_PAGE_CHANGED")
53 | self.bar:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
54 | self.bar:RegisterEvent("UPDATE_SHAPESHIFT_FORMS")
55 | self.bar:RegisterEvent("UPDATE_SHAPESHIFT_USABLE")
56 | self.bar:RegisterEvent("UPDATE_SHAPESHIFT_COOLDOWN")
57 | self.bar:RegisterEvent("PLAYER_REGEN_ENABLED")
58 | if not WoWClassicEra then
59 | self.bar:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR")
60 | self.bar:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR")
61 | self.bar:RegisterEvent("UPDATE_POSSESS_BAR")
62 | end
63 | self:RegisterEvent("UPDATE_BINDINGS", "ReassignBindings")
64 | self:ReassignBindings()
65 | self:ApplyConfig()
66 | end
67 |
68 | StanceBarMod.button_count = 10
69 |
70 | function StanceBarMod:ApplyConfig()
71 | if not self:IsEnabled() then return end
72 | self.bar:ApplyConfig(self.db.profile)
73 |
74 | if GetNumShapeshiftForms() == 0 then
75 | self:Disable()
76 | end
77 | end
78 |
79 | function StanceBarMod:ReassignBindings()
80 | if InCombatLockdown() then return end
81 | if not self.bar or not self.bar.buttons then return end
82 | ClearOverrideBindings(self.bar)
83 | for i = 1, min(#self.bar.buttons, 10) do
84 | local button, real_button = ("SHAPESHIFTBUTTON%d"):format(i), ("BT4StanceButton%d"):format(i)
85 | for k=1, select('#', GetBindingKey(button)) do
86 | local key = select(k, GetBindingKey(button))
87 | SetOverrideBindingClick(self.bar, false, key, real_button)
88 | end
89 | end
90 | end
91 |
92 | function StanceButtonPrototype:Update()
93 | if not self:IsShown() then return end
94 | local id = self:GetID()
95 | local texture, isActive, isCastable, spellID = GetShapeshiftFormInfo(id)
96 |
97 | self.icon:SetTexture(texture)
98 |
99 | -- manage cooldowns
100 | if texture then
101 | self.cooldown:Show()
102 | else
103 | self.cooldown:Hide()
104 | end
105 | local start, duration, enable = GetShapeshiftFormCooldown(id)
106 | CooldownFrame_Set(self.cooldown, start, duration, enable)
107 |
108 | if isActive then
109 | self:SetChecked(true)
110 | else
111 | self:SetChecked(false)
112 | end
113 |
114 | if isCastable then
115 | self.icon:SetVertexColor(1.0, 1.0, 1.0)
116 | else
117 | self.icon:SetVertexColor(0.4, 0.4, 0.4)
118 | end
119 |
120 | self:UpdateHotkeys()
121 | end
122 |
123 | function StanceButtonPrototype:UpdateHotkeys()
124 | local key = self:GetHotkey() or ""
125 | local hotkey = self.hotkey
126 |
127 | if key == "" or self.parent.config.hidehotkey then
128 | hotkey:Hide()
129 | else
130 | hotkey:SetText(key)
131 | hotkey:Show()
132 | end
133 | end
134 |
135 | function StanceButtonPrototype:GetHotkey()
136 | local key = GetBindingKey(format("SHAPESHIFTBUTTON%d", self:GetID())) or GetBindingKey("CLICK "..self:GetName()..":LeftButton")
137 | return key and KeyBound:ToShortKey(key)
138 | end
139 |
140 | function StanceButtonPrototype:GetBindings()
141 | local keys, binding = ""
142 |
143 | binding = format("SHAPESHIFTBUTTON%d", self:GetID())
144 | for i = 1, select('#', GetBindingKey(binding)) do
145 | local hotKey = select(i, GetBindingKey(binding))
146 | if keys ~= "" then
147 | keys = keys .. ', '
148 | end
149 | keys = keys .. GetBindingText(hotKey,'KEY_')
150 | end
151 |
152 | binding = "CLICK "..self:GetName()..":LeftButton"
153 | for i = 1, select('#', GetBindingKey(binding)) do
154 | local hotKey = select(i, GetBindingKey(binding))
155 | if keys ~= "" then
156 | keys = keys .. ', '
157 | end
158 | keys = keys.. GetBindingText(hotKey,'KEY_')
159 | end
160 |
161 | return keys
162 | end
163 |
164 | function StanceButtonPrototype:SetKey(key)
165 | SetBinding(key, format("SHAPESHIFTBUTTON%d", self:GetID()))
166 | end
167 |
168 | function StanceButtonPrototype:ClearBindings()
169 | local binding = format("SHAPESHIFTBUTTON%d", self:GetID())
170 | while GetBindingKey(binding) do
171 | SetBinding(GetBindingKey(binding), nil)
172 | end
173 |
174 | binding = "CLICK "..self:GetName()..":LeftButton"
175 | while GetBindingKey(binding) do
176 | SetBinding(GetBindingKey(binding), nil)
177 | end
178 | end
179 |
180 | local actionTmpl = "Stance Button %d (%s)"
181 | function StanceButtonPrototype:GetActionName()
182 | local id = self:GetID()
183 | local name = Bartender4.Compat.GetSpellName(select(4, GetShapeshiftFormInfo(id)))
184 | return format(actionTmpl, id, name)
185 | end
186 |
187 |
188 | function StanceButtonPrototype:ClearSetPoint(...)
189 | self:ClearAllPoints()
190 | self:SetPoint(...)
191 | end
192 |
193 | local function onEnter(self, ...)
194 | if not (Bartender4.db.profile.tooltip == "nocombat" and InCombatLockdown()) and Bartender4.db.profile.tooltip ~= "disabled" then
195 | self:OnEnter(...)
196 | end
197 | KeyBound:Set(self)
198 | end
199 |
200 | function StanceBarMod:CreateStanceButton(id)
201 | local button = setmetatable(CreateFrame("CheckButton", "BT4StanceButton" .. id, self.bar, "StanceButtonTemplate"), StanceButton_MT)
202 | button.parent = self.bar
203 | button:SetID(id)
204 | button.icon = _G[button:GetName() .. "Icon"]
205 | button.cooldown = _G[button:GetName() .. "Cooldown"]
206 | button.hotkey = _G[button:GetName() .. "HotKey"]
207 | button.normalTexture = button:GetNormalTexture()
208 | button.normalTexture:SetTexture("")
209 | -- button.checkedTexture = button:GetCheckedTexture()
210 | -- button.checkedTexture:SetTexture("")
211 |
212 | button.OnEnter = button:GetScript("OnEnter")
213 | button:SetScript("OnEnter", onEnter)
214 |
215 | if Masque then
216 | local group = self.bar.MasqueGroup
217 | button.MasqueButtonData = {
218 | Button = button
219 | }
220 | group:AddButton(button, button.MasqueButtonData, "Action")
221 | end
222 |
223 | return button
224 | end
225 |
226 | function StanceBar:ApplyConfig(config)
227 | ButtonBar.ApplyConfig(self, config)
228 |
229 | if not self.config.position.x then
230 | self:ClearSetPoint("CENTER", -55, -10)
231 | self:SavePosition()
232 | end
233 |
234 | self:UpdateStanceButtons()
235 | self:ForAll("ApplyStyle", self.config.style)
236 | end
237 |
238 | StanceBar.button_width = 30
239 | StanceBar.button_height = 30
240 | function StanceBar:UpdateStanceButtons()
241 | local buttons = self.buttons or {}
242 |
243 | local num_stances = GetNumShapeshiftForms()
244 |
245 | local updateBindings = (num_stances > #buttons)
246 |
247 | for i = (#buttons+1), num_stances do
248 | buttons[i] = StanceBarMod:CreateStanceButton(i)
249 | end
250 |
251 | for i = 1, num_stances do
252 | buttons[i]:Show()
253 | buttons[i]:Update()
254 | end
255 |
256 | for i = num_stances+1, #buttons do
257 | buttons[i]:Hide()
258 | end
259 |
260 | self.numbuttons = num_stances
261 | StanceBarMod.button_count = num_stances
262 | if StanceBarMod.optionobject then
263 | StanceBarMod.optionobject.table.general.args.rows.max = num_stances
264 | end
265 |
266 | self.buttons = buttons
267 |
268 | self:UpdateButtonLayout()
269 | if updateBindings then
270 | StanceBarMod:ReassignBindings()
271 | end
272 | self.disabled = (GetNumShapeshiftForms() == 0) and true or nil
273 |
274 | -- need to re-set clickthrough after creating new buttons
275 | self:SetClickThrough()
276 | end
277 |
278 | function StanceBar:OnEvent(event, ...)
279 | if event == "UPDATE_SHAPESHIFT_COOLDOWN" then
280 | self:ForAll("Update")
281 | elseif event == "PLAYER_REGEN_ENABLED" then
282 | if self.updateStateOnCombatLeave and not InCombatLockdown() then
283 | self.updateStateOnCombatLeave = nil
284 | self:UpdateStanceButtons()
285 | end
286 | else
287 | if InCombatLockdown() then
288 | self.updateStateOnCombatLeave = true
289 | self:ForAll("Update")
290 | else
291 | self:UpdateStanceButtons()
292 | end
293 | end
294 | end
295 |
--------------------------------------------------------------------------------
/PetButton.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | --[[
6 | Pet Button template
7 | ]]
8 | local _, Bartender4 = ...
9 | local PetButtonPrototype = CreateFrame("CheckButton")
10 | local PetButton_MT = {__index = PetButtonPrototype}
11 |
12 | local Masque = LibStub("Masque", true)
13 | local KeyBound = LibStub("LibKeyBound-1.0")
14 |
15 | local WoWRetail = (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE)
16 |
17 | -- upvalues
18 | local _G = _G
19 | local format, select, setmetatable = string.format, select, setmetatable
20 |
21 | -- GLOBALS: InCombatLockdown, CreateFrame, SetDesaturation, IsModifiedClick, GetBindingKey, GetBindingText, SetBinding
22 | -- GLOBALS: AutoCastShine_AutoCastStop, AutoCastShine_AutoCastStart, CooldownFrame_Set
23 | -- GLOBALS: PickupPetAction, , GetPetActionInfo, GetPetActionsUsable, GetPetActionCooldown
24 |
25 | local function onEnter(self, ...)
26 | if not (Bartender4.db.profile.tooltip == "nocombat" and InCombatLockdown()) and Bartender4.db.profile.tooltip ~= "disabled" then
27 | self:OnEnter(...)
28 | end
29 | KeyBound:Set(self)
30 | end
31 |
32 | local function onDragStart(self)
33 | if InCombatLockdown() then return end
34 | if not Bartender4.db.profile.buttonlock or IsModifiedClick("PICKUPACTION") then
35 | self:SetChecked(false)
36 | PickupPetAction(self.id)
37 | self:Update()
38 | end
39 | end
40 |
41 | local function onReceiveDrag(self)
42 | if InCombatLockdown() then return end
43 | if GetCursorInfo() == "petaction" then
44 | self:SetChecked(false)
45 | PickupPetAction(self.id)
46 | self:Update()
47 | end
48 | end
49 |
50 | Bartender4.PetButton = {}
51 | Bartender4.PetButton.prototype = PetButtonPrototype
52 | function Bartender4.PetButton:Create(id, parent)
53 | local name = "BT4PetButton" .. id
54 | local button = setmetatable(CreateFrame("CheckButton", name, parent, "PetActionButtonTemplate"), PetButton_MT)
55 | button.showgrid = 0
56 | button.id = id
57 | button.parent = parent
58 |
59 | button:SetFrameStrata("MEDIUM")
60 | button:SetID(id)
61 |
62 | button:UnregisterAllEvents()
63 | button:SetScript("OnEvent", nil)
64 |
65 | button.OnEnter = button:GetScript("OnEnter")
66 | button:SetScript("OnEnter", onEnter)
67 |
68 | button:SetScript("OnDragStart", onDragStart)
69 | button:SetScript("OnReceiveDrag", onReceiveDrag)
70 |
71 | if not WoWRetail then
72 | button.NormalTexture = button:GetNormalTexture()
73 | end
74 |
75 | if Masque then
76 | local group = parent.MasqueGroup
77 | group:AddButton(button, nil, "Pet")
78 | end
79 | return button
80 | end
81 |
82 | function PetButtonPrototype:Update()
83 | local name, texture, isToken, isActive, autoCastAllowed, autoCastEnabled, spellID = GetPetActionInfo(self.id)
84 |
85 | if not isToken then
86 | self.icon:SetTexture(texture)
87 | self.tooltipName = name
88 | else
89 | self.icon:SetTexture(_G[texture])
90 | self.tooltipName = _G[name]
91 | end
92 |
93 | self.isToken = isToken
94 |
95 | if spellID then
96 | local spell = Spell:CreateFromSpellID(spellID)
97 | self.spellDataLoadedCancelFunc = spell:ContinueWithCancelOnSpellLoad(function()
98 | self.tooltipSubtext = spell:GetSpellSubtext()
99 | end)
100 | end
101 |
102 | if isActive then
103 | if IsPetAttackAction(self.id) then
104 | if self.StartFlash then
105 | self:StartFlash()
106 | end
107 | -- the checked texture looks a little confusing at full alpha (looks like you have an extra ability selected)
108 | self:GetCheckedTexture():SetAlpha(0.5)
109 | else
110 | if self.StopFlash then
111 | self:StopFlash()
112 | end
113 | self:GetCheckedTexture():SetAlpha(1.0)
114 | end
115 | self:SetChecked(not self.parent.config.hideequipped)
116 | else
117 | if self.StopFlash then
118 | self:StopFlash()
119 | end
120 | self:SetChecked(false)
121 | end
122 |
123 | if self.AutoCastOverlay then -- 11.0
124 | self.AutoCastOverlay:SetShown(autoCastAllowed)
125 | self.AutoCastOverlay:ShowAutoCastEnabled(autoCastEnabled)
126 | else
127 | if autoCastAllowed then
128 | self.AutoCastable:Show()
129 |
130 | if autoCastEnabled then
131 | AutoCastShine_AutoCastStart(self.AutoCastShine)
132 | else
133 | AutoCastShine_AutoCastStop(self.AutoCastShine)
134 | end
135 | else
136 | self.AutoCastable:Hide()
137 | AutoCastShine_AutoCastStop(self.AutoCastShine)
138 | end
139 | end
140 |
141 | if texture then
142 | if GetPetActionsUsable() then
143 | SetDesaturation(self.icon, nil)
144 | else
145 | SetDesaturation(self.icon, 1)
146 | end
147 | self.icon:Show()
148 |
149 |
150 | if not self.parent.MasqueGroup then
151 | if WoWRetail then
152 | self.SlotBackground:Hide()
153 | if self.parent.config.hideborder then
154 | self.NormalTexture:SetTexture()
155 | self.icon:RemoveMaskTexture(self.IconMask)
156 | self.HighlightTexture:SetSize(34, 33)
157 | self.HighlightTexture:SetPoint("TOPLEFT", self, "TOPLEFT", -1.5, 1.5)
158 | self.CheckedTexture:SetSize(34, 33)
159 | self.CheckedTexture:SetPoint("TOPLEFT", self, "TOPLEFT", -1.5, 1.5)
160 | self.cooldown:ClearAllPoints()
161 | self.cooldown:SetAllPoints()
162 | else
163 | self:SetNormalAtlas("UI-HUD-ActionBar-IconFrame-AddRow")
164 | self.icon:AddMaskTexture(self.IconMask)
165 | self.HighlightTexture:SetSize(31.6, 30.9)
166 | self.HighlightTexture:SetPoint("TOPLEFT")
167 | self.CheckedTexture:SetSize(31.6, 30.9)
168 | self.CheckedTexture:SetPoint("TOPLEFT")
169 | self.cooldown:ClearAllPoints()
170 | self.cooldown:SetPoint("TOPLEFT", self, "TOPLEFT", 1.7, -1.7)
171 | self.cooldown:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -1, 1)
172 | end
173 | else
174 | self.NormalTexture:SetTexture("Interface\\Buttons\\UI-Quickslot2")
175 | self.NormalTexture:SetTexCoord(0, 0, 0, 0)
176 | end
177 | end
178 | self:ShowButton()
179 | if self.overlay then
180 | self.overlay:Show()
181 | end
182 | else
183 | self.icon:Hide()
184 |
185 | if not self.parent.MasqueGroup then
186 | if WoWRetail then
187 | self.SlotBackground:Show()
188 | self:SetNormalAtlas("UI-HUD-ActionBar-IconFrame-AddRow")
189 | else
190 | self.NormalTexture:SetTexture("Interface\\Buttons\\UI-Quickslot")
191 | self.NormalTexture:SetTexCoord(-0.1, 1.1, -0.1, 1.12)
192 | end
193 | end
194 | self:HideButton()
195 | if self.showgrid == 0 and not self.parent.config.showgrid then
196 | if self.overlay then
197 | self.overlay:Hide()
198 | end
199 | end
200 | end
201 |
202 | self:UpdateCooldown()
203 | self:UpdateHotkeys()
204 | end
205 |
206 | function PetButtonPrototype:UpdateHotkeys()
207 | local key = self:GetHotkey() or ""
208 | local hotkey = self.HotKey
209 |
210 | if key == "" or self.parent.config.hidehotkey then
211 | hotkey:Hide()
212 | else
213 | hotkey:SetText(key)
214 | hotkey:Show()
215 | end
216 | end
217 |
218 | -- override the mixin hotkey function
219 | PetButtonPrototype.SetHotkeys = PetButtonPrototype.UpdateHotkeys
220 |
221 | function PetButtonPrototype:ShowButton()
222 | self:SetAlpha(1.0)
223 | end
224 |
225 | function PetButtonPrototype:HideButton()
226 | if self.showgrid == 0 and not self.parent.config.showgrid then
227 | self:SetAlpha(0.0)
228 | end
229 | end
230 |
231 | function PetButtonPrototype:ShowGrid()
232 | self.showgrid = self.showgrid + 1
233 | self:SetAlpha(1.0)
234 | end
235 |
236 | function PetButtonPrototype:HideGrid()
237 | if self.showgrid > 0 then self.showgrid = self.showgrid - 1 end
238 | if self.showgrid == 0 and not (GetPetActionInfo(self.id)) and not self.parent.config.showgrid then
239 | self:SetAlpha(0.0)
240 | end
241 | end
242 |
243 | function PetButtonPrototype:UpdateCooldown()
244 | local start, duration, enable = GetPetActionCooldown(self.id)
245 | CooldownFrame_Set(self.cooldown, start, duration, enable)
246 |
247 | if not GameTooltip:IsForbidden() and GameTooltip:GetOwner() == self then
248 | self:OnEnter()
249 | end
250 | end
251 |
252 | function PetButtonPrototype:GetHotkey()
253 | local key = GetBindingKey(format("BONUSACTIONBUTTON%d", self.id)) or GetBindingKey("CLICK "..self:GetName()..":LeftButton")
254 | return key and KeyBound:ToShortKey(key)
255 | end
256 |
257 | function PetButtonPrototype:GetBindings()
258 | local keys, binding = ""
259 |
260 | binding = format("BONUSACTIONBUTTON%d", self.id)
261 | for i = 1, select('#', GetBindingKey(binding)) do
262 | local hotKey = select(i, GetBindingKey(binding))
263 | if keys ~= "" then
264 | keys = keys .. ', '
265 | end
266 | keys = keys .. GetBindingText(hotKey,'KEY_')
267 | end
268 |
269 | binding = "CLICK "..self:GetName()..":LeftButton"
270 | for i = 1, select('#', GetBindingKey(binding)) do
271 | local hotKey = select(i, GetBindingKey(binding))
272 | if keys ~= "" then
273 | keys = keys .. ', '
274 | end
275 | keys = keys.. GetBindingText(hotKey,'KEY_')
276 | end
277 |
278 | return keys
279 | end
280 |
281 | function PetButtonPrototype:SetKey(key)
282 | SetBinding(key, format("BONUSACTIONBUTTON%d", self.id))
283 | end
284 |
285 | function PetButtonPrototype:ClearBindings()
286 | local binding = format("BONUSACTIONBUTTON%d", self:GetID())
287 | while GetBindingKey(binding) do
288 | SetBinding(GetBindingKey(binding), nil)
289 | end
290 |
291 | binding = "CLICK "..self:GetName()..":LeftButton"
292 | while GetBindingKey(binding) do
293 | SetBinding(GetBindingKey(binding), nil)
294 | end
295 | end
296 |
297 | local actionTmpl = "Pet Button %d (%s)"
298 | function PetButtonPrototype:GetActionName()
299 | local id = self.id
300 | local name, _, _, token = GetPetActionInfo(id)
301 | if token and name then name = _G[name] end
302 | return format(actionTmpl, id, name or "empty")
303 | end
304 |
305 | function PetButtonPrototype:ClearSetPoint(...)
306 | self:ClearAllPoints()
307 | self:SetPoint(...)
308 | end
309 |
--------------------------------------------------------------------------------
/MicroMenu.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 | -- register module
8 | local MicroMenuMod = Bartender4:NewModule("MicroMenu", "AceHook-3.0", "AceEvent-3.0")
9 |
10 | -- fetch upvalues
11 | local Bar = Bartender4.Bar.prototype
12 | local ButtonBar = Bartender4.ButtonBar.prototype
13 |
14 | local pairs, setmetatable, table_insert = pairs, setmetatable, table.insert
15 |
16 | local WoWClassic = (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE)
17 | local WoWClassicEra = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC)
18 | local WoWClassicMists = (WOW_PROJECT_ID == WOW_PROJECT_MISTS_CLASSIC)
19 |
20 | -- GLOBALS: CharacterMicroButton, SpellbookMicroButton, TalentMicroButton, AchievementMicroButton, QuestLogMicroButton, GuildMicroButton
21 | -- GLOBALS: LFDMicroButton, CollectionsMicroButton, EJMicroButton, MainMenuMicroButton
22 | -- GLOBALS: HasVehicleActionBar, UnitVehicleSkin, HasOverrideActionBar, GetOverrideBarSkin
23 |
24 | local BT_MICRO_BUTTONS
25 | if WoWClassicMists then
26 | BT_MICRO_BUTTONS = {
27 | "CharacterMicroButton",
28 | "SpellbookMicroButton",
29 | "TalentMicroButton",
30 | "AchievementMicroButton",
31 | "QuestLogMicroButton",
32 | "SocialsMicroButton",
33 | "GuildMicroButton",
34 | "PVPMicroButton",
35 | "LFGMicroButton",
36 | "CollectionsMicroButton",
37 | "EJMicroButton",
38 | --"HelpMicroButton",
39 | "StoreMicroButton",
40 | "MainMenuMicroButton",
41 | }
42 | elseif WoWClassic then
43 | BT_MICRO_BUTTONS = CopyTable(MICRO_BUTTONS)
44 | else
45 | BT_MICRO_BUTTONS = {
46 | "CharacterMicroButton",
47 | "ProfessionMicroButton",
48 | "PlayerSpellsMicroButton",
49 | "AchievementMicroButton",
50 | "QuestLogMicroButton",
51 | "HousingMicroButton",
52 | "GuildMicroButton",
53 | "LFDMicroButton",
54 | "CollectionsMicroButton",
55 | "EJMicroButton",
56 | "StoreMicroButton",
57 | "MainMenuMicroButton",
58 | }
59 | end
60 |
61 | -- create prototype information
62 | local MicroMenuBar = setmetatable({}, {__index = ButtonBar})
63 |
64 | local defaults = { profile = Bartender4.Util:Merge({
65 | enabled = true,
66 | vertical = false,
67 | visibility = {
68 | possess = false,
69 | },
70 | padding = (WoWClassicEra or WoWClassicMists) and -3 or (WoWClassic and -4 or 1),
71 | position = {
72 | scale = WoWClassic and 0.8 or 1.0,
73 | },
74 | }, Bartender4.ButtonBar.defaults) }
75 |
76 | function MicroMenuMod:OnInitialize()
77 | self.db = Bartender4.db:RegisterNamespace("MicroMenu", defaults)
78 | self:SetEnabledState(self.db.profile.enabled)
79 | end
80 |
81 | function MicroMenuMod:OnEnable()
82 | if not self.bar then
83 | self.bar = setmetatable(Bartender4.ButtonBar:Create("MicroMenu", self.db.profile, L["Micro Menu"], true), {__index = MicroMenuBar})
84 | local buttons = {}
85 |
86 | -- remove the LFG button on classic era
87 | if WoWClassicEra then
88 | tDeleteItem(BT_MICRO_BUTTONS, "LFGMicroButton")
89 | end
90 |
91 | -- guild and social share a spot
92 | if WoWClassic then
93 | tDeleteItem(BT_MICRO_BUTTONS, "GuildMicroButton")
94 | end
95 |
96 | -- these are handled below, if both are in here it'll error
97 | if HelpMicroButton and StoreMicroButton then
98 | tDeleteItem(BT_MICRO_BUTTONS, "HelpMicroButton")
99 | end
100 |
101 | for i=1, #BT_MICRO_BUTTONS do
102 | local button = _G[BT_MICRO_BUTTONS[i]]
103 | if button then
104 | table_insert(buttons, button)
105 | end
106 | end
107 | self.bar.buttons = buttons
108 |
109 | -- check if its owned by the UI on initial load
110 | if MicroMenu then
111 | self.ownedByUI = (MicroMenu:GetParent() ~= UIParent)
112 |
113 | if not self.ownedByUI then
114 | for i,v in pairs(buttons) do
115 | v:SetParent(self.bar)
116 | end
117 | end
118 |
119 | elseif self.bar.buttons[1]:GetParent() ~= MainMenuBarArtFrame then
120 | self.ownedByUI = true
121 | end
122 |
123 | MicroMenuMod.button_count = #buttons
124 |
125 | self.bar.anchors = {}
126 | for i,v in pairs(buttons) do
127 | self.bar.anchors[i] = { v:GetPoint() } -- Save orig button anchors.
128 | v:SetFrameLevel(self.bar:GetFrameLevel() + 1)
129 | v.ClearSetPoint = self.bar.ClearSetPoint
130 | end
131 | end
132 |
133 | self:SecureHook("UpdateMicroButtons", "MicroMenuBarShow")
134 | if UpdateMicroButtonsParent then
135 | self:SecureHook("UpdateMicroButtonsParent")
136 | UpdateMicroButtonsParent(self.bar)
137 | end
138 | if MicroMenu then
139 | self:SecureHook(MicroMenu, "SetParent", "MicroMenuSetParent")
140 | end
141 | self:SecureHook("ActionBarController_UpdateAll")
142 | if C_PetBattles then
143 | self:RegisterEvent("PET_BATTLE_CLOSE")
144 | end
145 |
146 | self.bar:Enable()
147 | self:ToggleOptions()
148 | self:ApplyConfig()
149 |
150 | self:MicroMenuBarShow()
151 | end
152 |
153 | function MicroMenuMod:ApplyConfig()
154 | self.bar:ApplyConfig(self.db.profile)
155 | end
156 |
157 | function MicroMenuMod:RestoreMicroButtonParent()
158 | if UpdateMicroButtonsParent then
159 | UpdateMicroButtonsParent(self.bar)
160 | end
161 | if MicroMenu then
162 | MicroMenu:SetParent(UIParent)
163 | end
164 | end
165 |
166 | function MicroMenuMod:PET_BATTLE_CLOSE()
167 | self:RestoreMicroButtonParent()
168 | self:MicroMenuBarShow()
169 | end
170 |
171 | function MicroMenuMod:ActionBarController_UpdateAll()
172 | if self.ownedByUI and ActionBarController_GetCurrentActionBarState() == LE_ACTIONBAR_STATE_MAIN and not (C_PetBattles and C_PetBattles.IsInBattle()) then
173 | self:RestoreMicroButtonParent()
174 | self:MicroMenuBarShow()
175 | end
176 | end
177 |
178 | function MicroMenuMod:MicroMenuSetParent(_, parent)
179 | if parent == UIParent then
180 | for i,v in pairs(self.bar.buttons) do
181 | v:SetParent(self.bar)
182 | end
183 |
184 | self.ownedByUI = false
185 | self:MicroMenuBarShow()
186 | return
187 | end
188 |
189 | for i,v in pairs(self.bar.buttons) do
190 | v:SetParent(MicroMenu)
191 | end
192 |
193 | self.ownedByUI = true
194 | MicroMenu.oldGridSettings = nil -- reset grid settings so that layout always runs
195 | end
196 |
197 | function MicroMenuMod:UpdateMicroButtonsParent(parent)
198 | -- our own parent, ignore
199 | if parent == self.bar then
200 | self.ownedByUI = false
201 | return
202 | end
203 |
204 | -- any other parent then MainMenuBarArtFrame means its taken over by the Override bar or the PetBattleFrame
205 | if parent and ((Bartender4.db.profile.blizzardVehicle and parent == OverrideActionBar) or parent == (PetBattleFrame and PetBattleFrame.BottomFrame.MicroButtonFrame)) then
206 | self.ownedByUI = true
207 | self:BlizzardBarShow()
208 | return
209 | end
210 | self.ownedByUI = false
211 | self:MicroMenuBarShow()
212 | end
213 |
214 | function MicroMenuMod:MicroMenuBarShow()
215 | -- Only "fix" button anchors if another frame that uses the MicroButtonBar isn't active.
216 | if not self.ownedByUI then
217 | if UpdateMicroButtonsParent then
218 | UpdateMicroButtonsParent(self.bar)
219 | end
220 | self.bar:UpdateButtonLayout()
221 | end
222 | end
223 |
224 | function MicroMenuMod:BlizzardBarShow()
225 | if WoWClassic then
226 | -- Only reset button positions not set in MoveMicroButtons()
227 | for i,v in pairs(self.bar.buttons) do
228 | if v ~= CharacterMicroButton and v ~= PVPMicroButton then
229 | v:ClearSetPoint(unpack(self.bar.anchors[i]))
230 | end
231 | end
232 | end
233 | end
234 |
235 |
236 | if WoWClassic then
237 | MicroMenuBar.button_width = 29
238 | MicroMenuBar.button_height = 58
239 | MicroMenuBar.vpad_offset = -20
240 | else
241 | MicroMenuBar.button_width = 32
242 | MicroMenuBar.button_height = 40
243 | MicroMenuBar.vpad_offset = 0
244 | MicroMenuBar.hpad_offset = -8
245 | end
246 | function MicroMenuBar:ApplyConfig(config)
247 | ButtonBar.ApplyConfig(self, config)
248 |
249 | if not self.config.position.x then
250 | self:ClearSetPoint("CENTER", -105, 30)
251 | self:SavePosition()
252 | end
253 |
254 | self:UpdateButtonLayout()
255 | end
256 |
257 | function MicroMenuBar:UpdateButtonLayout()
258 | ButtonBar.UpdateButtonLayout(self)
259 |
260 | if HelpMicroButton and StoreMicroButton then
261 | HelpMicroButton:ClearAllPoints()
262 | HelpMicroButton:SetAllPoints(StoreMicroButton)
263 | -- If the StoreButton is hidden we want to replace it with the Help button
264 | if not StoreMicroButton:IsShown() then
265 | HelpMicroButton:Show()
266 | else
267 | HelpMicroButton:Hide()
268 | end
269 | end
270 |
271 | if WoWClassic and GuildMicroButton then
272 | GuildMicroButton:ClearAllPoints()
273 | GuildMicroButton:SetAllPoints(SocialsMicroButton)
274 | end
275 | end
276 |
277 | if not WoWClassic and QueueStatusButton then
278 | local QueueStatusMod = Bartender4:NewModule("QueueStatusButtonBar", "AceHook-3.0")
279 |
280 | -- create prototype information
281 | local QueueStatusBar = setmetatable({}, {__index = Bar})
282 |
283 | local queuedefaults = { profile = Bartender4.Util:Merge({
284 | enabled = true,
285 | visibility = {
286 | possess = false,
287 | },
288 | position = {
289 | x = -315,
290 | y = 150,
291 | point = "BOTTOMRIGHT",
292 | },
293 | }, Bartender4.Bar.defaults) }
294 |
295 | function QueueStatusMod:OnInitialize()
296 | self.db = Bartender4.db:RegisterNamespace("QueueStatus", queuedefaults)
297 | self:SetEnabledState(self.db.profile.enabled)
298 | end
299 |
300 | function QueueStatusMod:OnEnable()
301 | if not self.bar then
302 | self.bar = setmetatable(Bartender4.Bar:Create("QueueStatus", self.db.profile, L["Queue Status"], 1), {__index = QueueStatusBar})
303 | self.bar:SetSize(45, 45)
304 | self.bar.content = QueueStatusButton
305 | self.bar.content:SetParent(self.bar)
306 | end
307 | self:SecureHook(QueueStatusButton, "UpdatePosition", "UpdateLayout")
308 | self.bar:Enable()
309 | self:ToggleOptions()
310 | self:ApplyConfig()
311 | end
312 |
313 | function QueueStatusMod:ApplyConfig()
314 | self.bar:ApplyConfig(self.db.profile)
315 | end
316 |
317 | function QueueStatusMod:UpdateLayout()
318 | self.bar:PerformLayout()
319 | end
320 |
321 | function QueueStatusBar:ApplyConfig(config)
322 | Bar.ApplyConfig(self, config)
323 |
324 | self:PerformLayout()
325 | end
326 |
327 | QueueStatusBar.width = 45
328 | QueueStatusBar.height = 45
329 |
330 | function QueueStatusBar:PerformLayout()
331 | local bar = self.content
332 | bar:ClearAllPoints()
333 | bar:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0)
334 | end
335 | end
336 |
--------------------------------------------------------------------------------
/Bindings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | if InCombatLockdown() then
4 | print("Cannot change the button lock during combat.")
5 | return
6 | end
7 | Bartender4.db.profile.buttonlock = not Bartender4.db.profile.buttonlock
8 | Bartender4.Bar:ForAll("ForAll", "SetAttribute", "buttonlock", Bartender4.db.profile.buttonlock)
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
--------------------------------------------------------------------------------
/Options/StateBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 |
8 | local WoW10 = select(4, GetBuildInfo()) >= 100000
9 |
10 | local Bar = Bartender4.Bar.prototype
11 | local ButtonBar = Bartender4.ButtonBar.prototype
12 | local StateBar = Bartender4.StateBar.prototype
13 |
14 | local tostring, assert, pairs = tostring, assert, pairs
15 |
16 | local optGetter, optSetter, getBar
17 | do
18 | local optionMap, callFunc
19 | local barregistry = Bartender4.Bar.barregistry
20 |
21 | optionMap = {
22 | stance = "StanceStateOption",
23 | enabled = "StateOption",
24 | def_state = "DefaultState",
25 | states = "StateOption",
26 | actionbar = "StateOption",
27 | possess = "StateOption",
28 | autoassist = "ConfigAutoAssist",
29 | mouseover = "ConfigMouseOver",
30 | customEnabled = "StateOption",
31 | custom = "StateOption",
32 | customCopy = "CopyCustomConditionals",
33 | }
34 | -- retrieves a valid bar object from the barregistry table
35 | function getBar(id)
36 | local bar = barregistry[tostring(id)]
37 | assert(bar, ("Invalid bar id in options table. (%s)"):format(id))
38 | return bar
39 | end
40 |
41 | -- calls a function on the bar
42 | function callFunc(bar, type, option, ...)
43 | local func = type .. (optionMap[option] or option)
44 | assert(bar[func], ("Invalid get/set function %s in bar %s."):format(func, bar.id))
45 | return bar[func](bar, ...)
46 | end
47 |
48 | -- universal function to get a option
49 | function optGetter(info)
50 | local bar = getBar(info[2])
51 | local option = info.arg or info[#info]
52 | return callFunc(bar, "Get", option, info[#info])
53 | end
54 |
55 | -- universal function to set a option
56 | function optSetter(info, ...)
57 | local bar = getBar(info[2])
58 | local option = info.arg or info[#info]
59 | return callFunc(bar, "Set", option, info[#info], ...)
60 | end
61 | end
62 |
63 |
64 | local hasStances
65 |
66 | local validStanceTable = WoW10 and {
67 | [0] = L["Don't Page"],
68 | [1] = (L["Page %2d (%s)"]):format(1, (L["Bar %s"]):format("1")),
69 | [2] = (L["Page %2d (%s)"]):format(2, (L["Bonus Bar"])),
70 | [3] = (L["Page %2d (%s)"]):format(3, (L["Bar %s"]):format("4")),
71 | [4] = (L["Page %2d (%s)"]):format(4, (L["Bar %s"]):format("5")),
72 | [5] = (L["Page %2d (%s)"]):format(5, (L["Bar %s"]):format("3")),
73 | [6] = (L["Page %2d (%s)"]):format(6, (L["Bar %s"]):format("2")),
74 | [7] = (L["Page %2d (%s)"]):format(7, (L["Class Bar %d"]):format(1)),
75 | [8] = (L["Page %2d (%s)"]):format(8, (L["Class Bar %d"]):format(2)),
76 | [9] = (L["Page %2d (%s)"]):format(9, (L["Class Bar %d"]):format(3)),
77 | [10] = (L["Page %2d (%s)"]):format(10, (L["Class Bar %d"]):format(4)),
78 | [13] = (L["Page %2d (%s)"]):format(13, (L["Bar %s"]):format("6")),
79 | [14] = (L["Page %2d (%s)"]):format(14, (L["Bar %s"]):format("7")),
80 | [15] = (L["Page %2d (%s)"]):format(15, (L["Bar %s"]):format("8")),
81 | } or {
82 | [0] = L["Don't Page"],
83 | (L["Page %2d"]):format(1),
84 | (L["Page %2d"]):format(2),
85 | (L["Page %2d"]):format(3),
86 | (L["Page %2d"]):format(4),
87 | (L["Page %2d"]):format(5),
88 | (L["Page %2d"]):format(6),
89 | (L["Page %2d"]):format(7),
90 | (L["Page %2d"]):format(8),
91 | (L["Page %2d"]):format(9),
92 | (L["Page %2d"]):format(10)
93 | }
94 |
95 |
96 | local _, playerclass = UnitClass("player")
97 |
98 | local function createOptionGroup(k, id)
99 | local tbl = {
100 | order = 10 * k,
101 | type = "select",
102 | arg = "stance",
103 | values = validStanceTable,
104 | name = Bartender4.StanceMap[playerclass][k].name,
105 | }
106 | return tbl
107 | end
108 |
109 | local disabledFunc = function(info)
110 | local bar = getBar(info[2])
111 | return not bar:GetStateOption("enabled")
112 | end
113 |
114 | local stateOffOrCustomOn = function(info)
115 | local bar = getBar(info[2])
116 | return (not bar:GetStateOption("enabled")) or (bar:GetStateOption("customEnabled"))
117 | end
118 |
119 | local stateOffOrCustomOff = function(info)
120 | local bar = getBar(info[2])
121 | return (not bar:GetStateOption("enabled")) or (not bar:GetStateOption("customEnabled"))
122 | end
123 |
124 | function StateBar:GetOptionObject()
125 | local obj = ButtonBar.GetOptionObject()
126 | local options = {
127 | enabled = {
128 | order = 1,
129 | type = "toggle",
130 | name = L["Enabled"],
131 | desc = L["Enable State-based Button Swaping"],
132 | get = optGetter,
133 | set = optSetter,
134 | },
135 | header_target = {
136 | order = 2,
137 | type = "header",
138 | name = L["Smart Target selection"],
139 | },
140 | target = {
141 | order = 3,
142 | type = "group",
143 | inline = true,
144 | name = "",
145 | get = optGetter,
146 | set = optSetter,
147 | args = {
148 | autoassist = {
149 | order = 2,
150 | type = "toggle",
151 | name = L["Auto-Assist Casting"],
152 | desc = L["Enable Auto-Assist for this bar.\nAuto-Assist will automatically try to cast on your target's target if your target is no valid target for the selected spell."],
153 | get = optGetter,
154 | set = optSetter,
155 | },
156 | mouseover = {
157 | order = 3,
158 | type = "toggle",
159 | name = L["Mouse-Over Casting"],
160 | desc = L["Enable Mouse-Over Casting for this bar.\nMouse-Over Casting will automatically cast onto the unit under your mouse without targeting it, if possible."],
161 | get = optGetter,
162 | set = optSetter,
163 | },
164 | target_desc = {
165 | order = 10,
166 | type = "description",
167 | name = L["These options can automatically select a different target for your spell, based on macro conditions. Note however that they will overrule any target changes from normal macros."],
168 | },
169 | mouseover_desc = {
170 | order = 11,
171 | type = "description",
172 | name = L["Mouse-Over casting can be limited to be only active when a modifier key is being held down. You can configure the modifier in the global \"Bar\" Options."],
173 | },
174 | }
175 | },
176 | header_paging = {
177 | order = 4,
178 | type = "header",
179 | name = L["Bar Paging"],
180 | },
181 | possess = {
182 | order = 5,
183 | type = "toggle",
184 | name = L["Possess Bar"],
185 | desc = L["Switch this bar to the Possess Bar when possessing a npc (eg. Mind Control)"],
186 | get = optGetter,
187 | set = optSetter,
188 | disabled = stateOffOrCustomOn,
189 | },
190 | actionbar = {
191 | order = 6,
192 | type = "toggle",
193 | name = L["ActionBar Paging"],
194 | desc = L["Enable Bar Switching based on the actionbar controls provided by the game. \nSee Blizzard Key Bindings for assignments - Usually Shift-Mouse Wheel and Shift+1 - Shift+6."],
195 | get = optGetter,
196 | set = optSetter,
197 | disabled = stateOffOrCustomOn,
198 | },
199 | def_desc = {
200 | order = 10,
201 | type = "description",
202 | name = L["The default behaviour of this bar when no state-based paging option affects it."],
203 | },
204 | def_state = {
205 | order = 11,
206 | type = "select",
207 | name = L["Default Bar State"],
208 | values = validStanceTable,
209 | get = optGetter,
210 | set = optSetter,
211 | disabled = stateOffOrCustomOn,
212 | },
213 | modifiers = {
214 | order = 30,
215 | type = "group",
216 | inline = true,
217 | name = "",
218 | get = optGetter,
219 | set = optSetter,
220 | disabled = stateOffOrCustomOn,
221 | args = {
222 | header = {
223 | order = 1,
224 | type = "header",
225 | name = L["Modifier Based Switching"],
226 | },
227 | ctrl = {
228 | order = 10,
229 | type = "select",
230 | name = L["CTRL"],
231 | arg = "states",
232 | values = validStanceTable,
233 | desc = (L["Configure actionbar paging when the %s key is down."]):format(L["CTRL"]),
234 | --width = "half",
235 | },
236 | alt = {
237 | order = 15,
238 | type = "select",
239 | name = L["ALT"],
240 | arg = "states",
241 | values = validStanceTable,
242 | desc = (L["Configure actionbar paging when the %s key is down."]):format(L["ALT"]),
243 | --width = "half",
244 | },
245 | shift = {
246 | order = 20,
247 | type = "select",
248 | name = L["SHIFT"],
249 | arg = "states",
250 | values = validStanceTable,
251 | desc = (L["Configure actionbar paging when the %s key is down."]):format(L["SHIFT"]),
252 | --width = "half",
253 | },
254 | },
255 | },
256 | stances = {
257 | order = 20,
258 | type = "group",
259 | inline = true,
260 | name = "",
261 | hidden = function() return not (Bartender4.StanceMap[playerclass]) end,
262 | get = optGetter,
263 | set = optSetter,
264 | disabled = stateOffOrCustomOn,
265 | args = {
266 | stance_header = {
267 | order = 1,
268 | type = "header",
269 | name = L["Stance Configuration"],
270 | },
271 | },
272 | },
273 | customNl = {
274 | order = 48,
275 | type = "description",
276 | name = "\n",
277 | },
278 | customHeader = {
279 | order = 49,
280 | type = "header",
281 | name = L["Custom Conditionals"],
282 | },
283 | customEnabled = {
284 | order = 50,
285 | type = "toggle",
286 | name = L["Use Custom Condition"],
287 | desc = L["Enable the use of a custom condition, disabling all of the above."],
288 | get = optGetter,
289 | set = optSetter,
290 | disabled = disabledFunc,
291 | --width = "double",
292 | },
293 | customCopy = {
294 | order = 51,
295 | type = "execute",
296 | name = L["Copy Conditionals"],
297 | desc = L["Create a copy of the auto-generated conditionals in the custom configuration as a base template."],
298 | func = optSetter,
299 | disabled = disabledFunc,
300 | },
301 | customDesc = {
302 | order = 52,
303 | type = "description",
304 | name = L["Note: Enabling Custom Conditionals will disable all of the above settings!"],
305 | },
306 | custom = {
307 | order = 55,
308 | type = "input",
309 | name = L["Custom Conditionals"],
310 | desc = L["You can use any macro conditionals in the custom string, using the number of the bar as target value.\nExample: [form:1]9;0"],
311 | width = "full",
312 | get = optGetter,
313 | set = optSetter,
314 | disabled = stateOffOrCustomOff,
315 | multiline = true,
316 | },
317 | }
318 |
319 | do
320 | local defstancemap = Bartender4.StanceMap[playerclass]
321 | if defstancemap then
322 | for k,v in pairs(defstancemap) do
323 | if not options.stances.args[v.id] then
324 | options.stances.args[v.id] = createOptionGroup(k, v.id)
325 | end
326 | end
327 | end
328 | end
329 |
330 | local states = {
331 | type = "group",
332 | name = L["State Configuration"],
333 | order = 25,
334 | args = options,
335 | }
336 | obj:NewCategory("state", states)
337 |
338 | return obj
339 | end
340 |
--------------------------------------------------------------------------------
/libs/SimpleSticky.lua:
--------------------------------------------------------------------------------
1 | --[[---------------------------------------------------------------------------------
2 | General Library providing an alternate StartMoving() that allows you to
3 | specify a number of frames to snap-to when moving the frame around
4 |
5 | Example Usage:
6 |
7 |
8 | this:RegisterForDrag("LeftButton")
9 |
10 |
11 | StickyFrames:StartMoving(this, {WatchDogFrame_player, WatchDogFrame_target, WatchDogFrame_party1, WatchDogFrame_party2, WatchDogFrame_party3, WatchDogFrame_party4},3,3,3,3)
12 |
13 |
14 | StickyFrames:StopMoving(this)
15 | StickyFrames:AnchorFrame(this)
16 |
17 |
18 | ------------------------------------------------------------------------------------
19 | This is a modified version by Nevcairiel for Bartender4
20 | ------------------------------------------------------------------------------------]]
21 |
22 | local MAJOR, MINOR = "LibSimpleSticky-1.0", 2
23 | local StickyFrames, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
24 |
25 | if not StickyFrames then return end
26 |
27 | --[[---------------------------------------------------------------------------------
28 | Class declaration, along with a temporary table to hold any existing OnUpdate
29 | scripts.
30 | ------------------------------------------------------------------------------------]]
31 |
32 | StickyFrames.scripts = StickyFrames.scripts or {}
33 | StickyFrames.rangeX = 15
34 | StickyFrames.rangeY = 15
35 | StickyFrames.sticky = StickyFrames.sticky or {}
36 |
37 | --[[---------------------------------------------------------------------------------
38 | StickyFrames:StartMoving() - Sets a custom OnUpdate for the frame so it follows
39 | the mouse and snaps to the frames you specify
40 |
41 | frame: The frame we want to move. Is typically "this"
42 |
43 | frameList: A integer indexed list of frames that the given frame should try to
44 | stick to. These don't have to have anything special done to them,
45 | and they don't really even need to exist. You can inclue the
46 | moving frame in this list, it will be ignored. This helps you
47 | if you have a number of frames, just make ONE list to pass.
48 |
49 | {WatchDogFrame_player, WatchDogFrame_party1, .. WatchDogFrame_party4}
50 |
51 | left: If your frame has a tranparent border around the entire frame
52 | (think backdrops with borders). This can be used to fine tune the
53 | edges when you're stickying groups. Refers to any offset on the
54 | LEFT edge of the frame being moved.
55 |
56 | top: same
57 | right: same
58 | bottom: same
59 | ------------------------------------------------------------------------------------]]
60 |
61 | function StickyFrames:StartMoving(frame, frameList, left, top, right, bottom)
62 | local x,y = GetCursorPosition()
63 | local aX,aY = frame:GetCenter()
64 | local aS = frame:GetEffectiveScale()
65 |
66 | aX,aY = aX*aS,aY*aS
67 | local xoffset,yoffset = (aX - x),(aY - y)
68 | self.scripts[frame] = frame:GetScript("OnUpdate")
69 | frame:SetScript("OnUpdate", self:GetUpdateFunc(frame, frameList, xoffset, yoffset, left, top, right, bottom))
70 | end
71 |
72 | --[[---------------------------------------------------------------------------------
73 | This stops the OnUpdate, leaving the frame at its last position. This will
74 | leave it anchored to UIParent. You can call StickyFrames:AnchorFrame() to
75 | anchor it back "TOPLEFT" , "TOPLEFT" to the parent.
76 | ------------------------------------------------------------------------------------]]
77 |
78 | function StickyFrames:StopMoving(frame)
79 | frame:SetScript("OnUpdate", self.scripts[frame])
80 | self.scripts[frame] = nil
81 |
82 | if StickyFrames.sticky[frame] then
83 | local sticky = StickyFrames.sticky[frame]
84 | StickyFrames.sticky[frame] = nil
85 | return true, sticky
86 | else
87 | return false, nil
88 | end
89 | end
90 |
91 | --[[---------------------------------------------------------------------------------
92 | This can be called in conjunction with StickyFrames:StopMoving() to anchor the
93 | frame right back to the parent, so you can manipulate its children as a group
94 | (This is useful in WatchDog)
95 | ------------------------------------------------------------------------------------]]
96 |
97 | function StickyFrames:AnchorFrame(frame)
98 | local xA,yA = frame:GetCenter()
99 | local parent = frame:GetParent() or UIParent
100 | local xP,yP = parent:GetCenter()
101 | local sA,sP = frame:GetEffectiveScale(), parent:GetEffectiveScale()
102 |
103 | xP,yP = (xP*sP) / sA, (yP*sP) / sA
104 |
105 | local xo,yo = (xP - xA)*-1, (yP - yA)*-1
106 |
107 | frame:ClearAllPoints()
108 | frame:SetPoint("CENTER", parent, "CENTER", xo, yo)
109 | end
110 |
111 |
112 | --[[---------------------------------------------------------------------------------
113 | Internal Functions -- Do not call these.
114 | ------------------------------------------------------------------------------------]]
115 |
116 |
117 |
118 | --[[---------------------------------------------------------------------------------
119 | Returns an anonymous OnUpdate function for the frame in question. Need
120 | to provide the frame, frameList along with the x and y offset (difference between
121 | where the mouse picked up the frame, and the insets (left,top,right,bottom) in the
122 | case of borders, etc.w
123 | ------------------------------------------------------------------------------------]]
124 |
125 | function StickyFrames:GetUpdateFunc(frame, frameList, xoffset, yoffset, left, top, right, bottom)
126 | return function()
127 | local x,y = GetCursorPosition()
128 | local s = frame:GetEffectiveScale()
129 | local sticky = nil
130 |
131 | x,y = x/s,y/s
132 |
133 | frame:ClearAllPoints()
134 | frame:SetPoint("CENTER", UIParent, "BOTTOMLEFT", x+xoffset, y+yoffset)
135 |
136 | StickyFrames.sticky[frame] = nil
137 | for i = 1, #frameList do
138 | local v = frameList[i]
139 | if frame ~= v and frame ~= v:GetParent() and not IsShiftKeyDown() and v:IsVisible() then
140 | if self:SnapFrame(frame, v, left, top, right, bottom) then
141 | StickyFrames.sticky[frame] = v
142 | break
143 | end
144 | end
145 | end
146 | end
147 | end
148 |
149 |
150 | --[[---------------------------------------------------------------------------------
151 | Internal debug function.
152 | ------------------------------------------------------------------------------------]]
153 |
154 | function StickyFrames:debug(msg)
155 | DEFAULT_CHAT_FRAME:AddMessage("|cffffff00StickyFrames: |r"..tostring(msg))
156 | end
157 |
158 | --[[---------------------------------------------------------------------------------
159 | This is called when finding an overlap between two sticky frame. If frameA is near
160 | a sticky edge of frameB, then it will snap to that edge and return true. If there
161 | is no sticky edge collision, will return false so we can test other frames for
162 | stickyness.
163 | ------------------------------------------------------------------------------------]]
164 | function StickyFrames:SnapFrame(frameA, frameB, left, top, right, bottom)
165 | local sA, sB = frameA:GetEffectiveScale(), frameB:GetEffectiveScale()
166 | local xA, yA = frameA:GetCenter()
167 | local xB, yB = frameB:GetCenter()
168 | local hA, hB = frameA:GetHeight() / 2, ((frameB:GetHeight() * sB) / sA) / 2
169 | local wA, wB = frameA:GetWidth() / 2, ((frameB:GetWidth() * sB) / sA) / 2
170 |
171 | local newX, newY = xA, yA
172 |
173 | if not left then left = 0 end
174 | if not top then top = 0 end
175 | if not right then right = 0 end
176 | if not bottom then bottom = 0 end
177 |
178 | -- Lets translate B's coords into A's scale
179 | xB, yB = (xB*sB) / sA, (yB*sB) / sA
180 |
181 | local stickyAx, stickyAy = wA * 0.75, hA * 0.75
182 | local stickyBx, stickyBy = wB * 0.75, hB * 0.75
183 |
184 | -- Grab the edges of each frame, for easier comparison
185 |
186 | local lA, tA, rA, bA = frameA:GetLeft(), frameA:GetTop(), frameA:GetRight(), frameA:GetBottom()
187 | local lB, tB, rB, bB = frameB:GetLeft(), frameB:GetTop(), frameB:GetRight(), frameB:GetBottom()
188 | local snap = nil
189 |
190 | -- Translate into A's scale
191 | lB, tB, rB, bB = (lB * sB) / sA, (tB * sB) / sA, (rB * sB) / sA, (bB * sB) / sA
192 |
193 | if (bA <= tB and bB <= tA) then
194 |
195 | -- Horizontal Centers
196 | if xA <= (xB + StickyFrames.rangeX) and xA >= (xB - StickyFrames.rangeX) then
197 | newX = xB
198 | snap = true
199 | end
200 |
201 | -- Interior Left
202 | if lA <= (lB + StickyFrames.rangeX) and lA >= (lB - StickyFrames.rangeX) then
203 | newX = lB + wA
204 | if frameB == UIParent or frameB == WorldFrame then newX = newX - left/2 end
205 | snap = true
206 | end
207 |
208 | -- Interior Right
209 | if rA <= (rB + StickyFrames.rangeX) and rA >= (rB - StickyFrames.rangeX) then
210 | newX = rB - wA
211 | if frameB == UIParent or frameB == WorldFrame then newX = newX + right/2 end
212 | snap = true
213 | end
214 |
215 | -- Exterior Left to Right
216 | if lA <= (rB + StickyFrames.rangeX) and lA >= (rB - StickyFrames.rangeX) then
217 | newX = rB + (wA - left)
218 | if frameB == UIParent or frameB == WorldFrame then newX = newX + left/2 end
219 | snap = true
220 | end
221 |
222 | -- Exterior Right to Left
223 | if rA <= (lB + StickyFrames.rangeX) and rA >= (lB - StickyFrames.rangeX) then
224 | newX = lB - (wA - right)
225 | if frameB == UIParent or frameB == WorldFrame then newX = newX - right/2 end
226 | snap = true
227 | end
228 |
229 | end
230 |
231 | if (lA <= rB and lB <= rA) then
232 |
233 | -- Vertical Centers
234 | if yA <= (yB + StickyFrames.rangeY) and yA >= (yB - StickyFrames.rangeY) then
235 | newY = yB
236 | snap = true
237 | end
238 |
239 | -- Interior Top
240 | if tA <= (tB + StickyFrames.rangeY) and tA >= (tB - StickyFrames.rangeY) then
241 | newY = tB - hA
242 | if frameB == UIParent or frameB == WorldFrame then newY = newY + top/2 end
243 | snap = true
244 | end
245 |
246 | -- Interior Bottom
247 | if bA <= (bB + StickyFrames.rangeY) and bA >= (bB - StickyFrames.rangeY) then
248 | newY = bB + hA
249 | if frameB == UIParent or frameB == WorldFrame then newY = newY - bottom/2 end
250 | snap = true
251 | end
252 |
253 | -- Exterior Top to Bottom
254 | if tA <= (bB + StickyFrames.rangeY + bottom) and tA >= (bB - StickyFrames.rangeY + bottom) then
255 | newY = bB - (hA - top)
256 | if frameB == UIParent or frameB == WorldFrame then newY = newY - top/2 end
257 | snap = true
258 | end
259 |
260 | -- Exterior Bottom to Top
261 | if bA <= (tB + StickyFrames.rangeY - top) and bA >= (tB - StickyFrames.rangeY - top) then
262 | newY = tB + (hA - bottom)
263 | if frameB == UIParent or frameB == WorldFrame then newY = newY + bottom/2 end
264 | snap = true
265 | end
266 |
267 | end
268 |
269 | if snap then
270 | frameA:ClearAllPoints()
271 | frameA:SetPoint("CENTER", UIParent, "BOTTOMLEFT", newX, newY)
272 | return true
273 | end
274 | end
275 |
--------------------------------------------------------------------------------
/Options/ActionBar.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 | local StateBar = Bartender4.StateBar.prototype
8 | local ActionBar = Bartender4.ActionBar
9 |
10 | local lsmlist = AceGUIWidgetLSMlists
11 |
12 | local WoW10 = select(4, GetBuildInfo()) >= 100000
13 |
14 | local tonumber, tostring, assert = tonumber, tostring, assert
15 |
16 | --[[===================================================================================
17 | ActionBar Options
18 | ===================================================================================]]--
19 |
20 | local module = Bartender4:GetModule("ActionBars")
21 |
22 | -- option utilty functions
23 | local optGetter, optSetter
24 | do
25 | local optionMap, getBar, callFunc
26 | -- maps option keys to function names
27 | optionMap = {
28 | buttons = "Buttons",
29 | enabled = "Enabled",
30 | grid = "Grid",
31 | flyoutDirection = "FlyoutDirection",
32 | buttonOffset = "ButtonOffset",
33 | border = "HideBorder",
34 | }
35 |
36 | -- retrieves a valid bar object from the modules actionbars table
37 | function getBar(id)
38 | local bar = module.actionbars[tonumber(id)]
39 | assert(bar, ("Invalid bar id in options table. (%s)"):format(id))
40 | return bar
41 | end
42 |
43 | -- calls a function on the bar
44 | function callFunc(bar, type, option, ...)
45 | local func = type .. (optionMap[option] or option)
46 | assert(bar[func], ("Invalid get/set function %s in bar %s."):format(func, bar.id))
47 | return bar[func](bar, ...)
48 | end
49 |
50 | -- universal function to get a option
51 | function optGetter(info)
52 | local bar = getBar(info[2])
53 | local option = info[#info]
54 | return callFunc(bar, "Get", option)
55 | end
56 |
57 | -- universal function to set a option
58 | function optSetter(info, ...)
59 | local bar = getBar(info[2])
60 | local option = info[#info]
61 | return callFunc(bar, "Set", option, ...)
62 | end
63 | end
64 |
65 | local optStyleSetter, optStyleGetter
66 | do
67 | local optionMap, getBar, callStyleFunc
68 | -- maps option keys to function names
69 | optionMap = {
70 | font = "Font",
71 | size = "FontSize",
72 | flags = "FontFlags",
73 | color = "FontColor",
74 | anchor = "TextAnchor",
75 | offsetX = "TextOffsetX",
76 | offsetY = "TextOffsetY",
77 | justify = "TextJustifyH",
78 | }
79 |
80 | -- retrieves a valid bar object from the modules actionbars table
81 | function getBar(id)
82 | local bar = module.actionbars[tonumber(id)]
83 | assert(bar, ("Invalid bar id in options table. (%s)"):format(id))
84 | return bar
85 | end
86 |
87 | -- calls a style function on the bar
88 | function callStyleFunc(bar, element, type, option, ...)
89 | local func = type .. "Style" .. (optionMap[option] or option)
90 | assert(bar[func], ("Invalid get/set function %s in bar %s."):format(func, bar.id))
91 | return bar[func](bar, element, ...)
92 | end
93 |
94 | -- universal function to get a style option
95 | function optStyleGetter(info)
96 | local bar = getBar(info[2])
97 | local option = info[#info]
98 | local element = info[#info - 1]
99 | return callStyleFunc(bar, element, "Get", option)
100 | end
101 |
102 | -- universal function to set a style option
103 | function optStyleSetter(info, ...)
104 | local bar = getBar(info[2])
105 | local option = info[#info]
106 | local element = info[#info - 1]
107 | return callStyleFunc(bar, element, "Set", option, ...)
108 | end
109 | end
110 |
111 | -- returns the option table used for all action bars
112 | -- creates it, if the first time called
113 | -- the Universal Bar option table is merged into this, alot of stuff gets inherited.
114 | function module:GetOptionsTable()
115 | return self:GetOptionsObject().table
116 | end
117 |
118 | function module:GetOptionsObject()
119 | if not self.baroptions then
120 | local obj = StateBar.GetOptionObject(self)
121 |
122 | local cat_general = {
123 | enabled ={
124 | order = 4,
125 | name = L["Enabled"],
126 | desc = L["Enable/Disable the bar."],
127 | type = "toggle",
128 | width = "full",
129 | set = optSetter,
130 | get = optGetter,
131 | },
132 | grid = {
133 | order = 60,
134 | type = "toggle",
135 | name = L["Button Grid"],
136 | desc = L["Toggle the button grid."],
137 | set = optSetter,
138 | get = optGetter,
139 | },
140 | buttons = {
141 | order = 50,
142 | name = L["Buttons"],
143 | desc = L["Number of buttons."],
144 | type = "range",
145 | min = 1, max = 12, step = 1,
146 | set = optSetter,
147 | get = optGetter,
148 | },
149 | flyoutDirection = {
150 | order = 79,
151 | name = L["Flyout Direction"],
152 | desc = L["Direction of the button flyouts on this bar (eg. summon demon/pet)"],
153 | type = "select",
154 | values = {LEFT = L["Left"], RIGHT = L["Right"], UP = L["Up"], DOWN = L["Down"]},
155 | set = optSetter,
156 | get = optGetter,
157 | },
158 | buttonOffset = {
159 | order = 202,
160 | name = L["Button Offset"],
161 | desc = L["How many buttons to offset the action to the left. This can be used, for example, to use the same actions on two individual shorter bars (front and back)."],
162 | type = "range",
163 | min = 0, max = 11, step = 1,
164 | set = optSetter,
165 | get = optGetter,
166 | },
167 | border = {
168 | order = 84,
169 | type = "toggle",
170 | name = L["Hide Border"],
171 | desc = L["Hide the border around the action button."],
172 | set = optSetter,
173 | get = optGetter,
174 | hidden = not WoW10,
175 | },
176 | }
177 |
178 | local text_style = {
179 | font = {
180 | order = 11,
181 | type = "select",
182 | name = L["Font"],
183 | desc = L["Select the font for this text element"],
184 | dialogControl = "LSM30_Font",
185 | values = lsmlist.font,
186 | set = optStyleSetter,
187 | get = optStyleGetter,
188 | },
189 | flags = {
190 | order = 12,
191 | type = "select",
192 | name = L["Outline"],
193 | desc = L["Select the type of outline"],
194 | values = {["OUTLINE"] = L["Thin outline"], ["THICKOUTLINE"] = L["Thick outline"], [""] = L["None"]},
195 | set = optStyleSetter,
196 | get = optStyleGetter,
197 | },
198 | size = {
199 | order = 13,
200 | name = L["Font Size"],
201 | desc = L["Set the font size of this element"],
202 | type = "range",
203 | min = 8, max = 28, step = 1,
204 | set = optStyleSetter,
205 | get = optStyleGetter,
206 | },
207 | color = {
208 | order = 14,
209 | type = "color",
210 | name = L["Text Color"],
211 | desc = L["Select the color of this element"],
212 | set = optStyleSetter,
213 | get = optStyleGetter,
214 | },
215 | nl1 = {
216 | order = 20,
217 | type = "description",
218 | name = "",
219 | },
220 | anchor = {
221 | order = 21,
222 | type = "select",
223 | name = L["Anchor point"],
224 | desc = L["Anchor point for this text element"],
225 | values = {
226 | ["TOP"] = L["Top"],
227 | ["RIGHT"] = L["Right"],
228 | ["BOTTOM"] = L["Bottom"],
229 | ["LEFT"] = L["Left"],
230 | ["TOPRIGHT"] = L["Top Right"],
231 | ["TOPLEFT"] = L["Top Left"],
232 | ["BOTTOMLEFT"] = L["Bottom Left"],
233 | ["BOTTOMRIGHT"] = L["Bottom Right"],
234 | ["CENTER"] = L["Center"]
235 | },
236 | set = optStyleSetter,
237 | get = optStyleGetter,
238 | },
239 | justify = {
240 | order = 22,
241 | type = "select",
242 | name = L["Text Alignment"],
243 | desc = L["Alignment of the text"],
244 | values = {
245 | ["RIGHT"] = L["Right"],
246 | ["LEFT"] = L["Left"],
247 | ["CENTER"] = L["Center"],
248 | },
249 | set = optStyleSetter,
250 | get = optStyleGetter,
251 | },
252 | nl2 = {
253 | order = 23,
254 | type = "description",
255 | name = "",
256 | },
257 | offsetX = {
258 | order = 25,
259 | name = L["Anchor X Offset"],
260 | desc = L["Set X offset from the anchor point"],
261 | type = "range",
262 | min = -10, max = 10, bigStep = 1, step = 0.1,
263 | set = optStyleSetter,
264 | get = optStyleGetter,
265 | },
266 | offsetY = {
267 | order = 26,
268 | name = L["Anchor Y Offset"],
269 | desc = L["Set Y offset from the anchor point"],
270 | type = "range",
271 | min = -10, max = 10, bigStep = 1, step = 0.1,
272 | set = optStyleSetter,
273 | get = optStyleGetter,
274 | },
275 | }
276 |
277 | local style_cat = {
278 | type = "group",
279 | name = L["Text Style"],
280 | order = 29,
281 | args = {
282 | buttonstyleheader = {
283 | order = 1,
284 | type = "description",
285 | width = "full",
286 | name = L["These options allow you to configure the font style and size used for all textual elements of the buttons on this bar."],
287 | },
288 | hotkey = {
289 | order = 10,
290 | type = "group",
291 | name = L["Hotkey"],
292 | guiInline = true,
293 | args = {},
294 | },
295 | count = {
296 | order = 20,
297 | type = "group",
298 | name = L["Count"],
299 | guiInline = true,
300 | args = {},
301 | },
302 | macro = {
303 | order = 30,
304 | type = "group",
305 | name = L["Macro Text"],
306 | guiInline = true,
307 | args = {},
308 | },
309 | },
310 | }
311 |
312 | obj:AddElementGroup("general", cat_general)
313 |
314 | obj:NewCategory("style", style_cat)
315 | obj:AddElementGroup("style", text_style, "hotkey")
316 | obj:AddElementGroup("style", text_style, "count")
317 | obj:AddElementGroup("style", text_style, "macro")
318 | self.baroptions = obj
319 | end
320 |
321 | return self.baroptions
322 | end
323 |
324 | function module:CreateBarOption(id, options)
325 | if not self.options then return end
326 |
327 | if not options then
328 | options = self:GetOptionsTable()
329 | end
330 |
331 | id = tostring(id)
332 | if not self.options[id] then
333 | local barID = tonumber(id)
334 | local order = 10 + barID
335 | local name = self:GetBarName(id)
336 | local desc = (L["Configure Bar %s"]):format(id)
337 | -- remap WoW10 bars
338 | if WoW10 then
339 | if barID == 7 or barID == 8 or barID == 9 or barID == 10 then
340 | order = 13 + barID
341 | desc = (L["Configure Class Bar %d"]):format(barID - 6) .. "\n\n" .. L["Usually used for druid shapeshift forms, but can be re-used for additional bars on other classes"]
342 | elseif self.BLIZZARD_BAR_MAP[barID] then
343 | barID = self.BLIZZARD_BAR_MAP[barID]
344 | order = 10 + barID
345 | desc = (L["Configure Bar %s"]):format(tostring(barID))
346 | elseif barID == 2 then
347 | order = 19
348 | desc = L["Configure the Bonus Action Bar"] .. "\n\n" .. L["By default this bar is used as the second page of the primary action bar."]
349 | end
350 | end
351 | self.options[id] = {
352 | order = order,
353 | type = "group",
354 | name = name,
355 | desc = desc,
356 | childGroups = "tab",
357 | }
358 | end
359 | self.options[id].args = options
360 |
361 | -- register options in the BT GUI
362 | Bartender4:RegisterActionBarOptions(id, self.options[id])
363 | end
364 |
--------------------------------------------------------------------------------
/ActionBars.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
3 | All rights reserved.
4 | ]]
5 | local _, Bartender4 = ...
6 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
7 | local BT4ActionBars = Bartender4:NewModule("ActionBars", "AceEvent-3.0")
8 |
9 | local select, ipairs, pairs, tostring, tonumber, min, setmetatable = select, ipairs, pairs, tostring, tonumber, min, setmetatable
10 |
11 | local WoWRetail = (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE)
12 | local WoWClassic = (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE)
13 | local WoWTBC = (WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC)
14 | local WoWWrath = (WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC)
15 | local WoWCata = (WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC)
16 | local WoWMists = (WOW_PROJECT_ID == WOW_PROJECT_MISTS_CLASSIC)
17 | local WoWMidnight = select(4, GetBuildInfo()) >= 120000
18 |
19 | local LAB10 = LibStub("LibActionButton-1.0")
20 | local LSM = LibStub("LibSharedMedia-3.0")
21 | local Masque = LibStub("Masque", true)
22 |
23 | -- GLOBALS: UnitClass, InCombatLockdown, GetBindingKey, ClearOverrideBindings, SetOverrideBindingClick
24 |
25 | local abdefaults = {
26 | ['**'] = Bartender4.Util:Merge({
27 | enabled = true,
28 | buttons = 12,
29 | buttonOffset = 0,
30 | hidemacrotext = false,
31 | showgrid = false,
32 | flyoutDirection = "UP",
33 | elements = {
34 | ['**'] = {
35 | font = "Arial Narrow",
36 | fontSize = 13,
37 | fontFlags = "OUTLINE",
38 | fontColor = {1, 1, 1},
39 | textAnchor = "CENTER",
40 | textOffsetX = 0,
41 | textOffsetY = 0,
42 | textJustifyH = "CENTER",
43 | },
44 | hotkey = {
45 | fontSize = WoWRetail and 16 or 13,
46 | fontColor = {0.9, 0.9, 0.9},
47 | textAnchor = "TOPRIGHT",
48 | textOffsetX = -2,
49 | textOffsetY = -4,
50 | textJustifyH = "RIGHT",
51 | },
52 | count = {
53 | fontSize = WoWRetail and 19 or 16,
54 | textAnchor = "BOTTOMRIGHT",
55 | textOffsetX = -2,
56 | textOffsetY = 4,
57 | textJustifyH = "RIGHT",
58 | },
59 | macro = {
60 | font = "Friz Quadrata TT",
61 | fontSize = WoWRetail and 11 or 10,
62 | textAnchor = "BOTTOM",
63 | textOffsetX = 0,
64 | textOffsetY = 2,
65 | },
66 | },
67 | }, Bartender4.StateBar.defaults),
68 | [1] = {
69 | states = {
70 | enabled = true,
71 | possess = true,
72 | actionbar = false,
73 | stance = {
74 | DRUID = { bear = 9, cat = 7, prowl = 8 },
75 | ROGUE = (WoWWrath or WoWCata or WoWMists) and { stealth = 7, shadowdance = 8 } or { stealth = 7 },
76 | WARRIOR = (WoWClassic and not WoWMists) and { battle = 7, def = 8, berserker = 9 } or nil,
77 | PRIEST = WoWClassic and { shadowform = 7 } or nil,
78 | EVOKER = { soar = 7 },
79 | MONK = WoWMists and { tiger = 7, ox = 8, serpent = 9 } or nil,
80 | },
81 | },
82 | visibility = {
83 | vehicleui = false,
84 | overridebar = false,
85 | },
86 | },
87 | [7] = {
88 | enabled = false,
89 | },
90 | [8] = {
91 | enabled = false,
92 | },
93 | [9] = {
94 | enabled = false,
95 | },
96 | [10] = {
97 | enabled = false,
98 | },
99 | [13] = {
100 | enabled = false,
101 | },
102 | [14] = {
103 | enabled = false,
104 | },
105 | [15] = {
106 | enabled = false,
107 | },
108 | }
109 |
110 | local LIST_ACTIONBARS = WoWRetail and { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15 } or { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
111 | BT4ActionBars.LIST_ACTIONBARS = LIST_ACTIONBARS
112 |
113 | local BINDING_MAPPINGS = {
114 | [1] = "ACTIONBUTTON%d",
115 | [3] = "MULTIACTIONBAR3BUTTON%d",
116 | [4] = "MULTIACTIONBAR4BUTTON%d",
117 | [5] = "MULTIACTIONBAR2BUTTON%d",
118 | [6] = "MULTIACTIONBAR1BUTTON%d",
119 | [13] = "MULTIACTIONBAR5BUTTON%d",
120 | [14] = "MULTIACTIONBAR6BUTTON%d",
121 | [15] = "MULTIACTIONBAR7BUTTON%d",
122 | }
123 |
124 |
125 | local defaults = {
126 | profile = {
127 | actionbars = abdefaults,
128 | }
129 | }
130 |
131 | local ActionBar_MT = {__index = Bartender4.ActionBar}
132 |
133 | -- export defaults for other modules
134 | Bartender4.ActionBar.defaults = abdefaults['**']
135 |
136 | function BT4ActionBars:OnInitialize()
137 | self.db = Bartender4.db:RegisterNamespace("ActionBars", defaults)
138 | end
139 |
140 | -- setup the 10 actionbars
141 | local first = true
142 | function BT4ActionBars:OnEnable()
143 | if first then
144 | self.playerclass = select(2, UnitClass("player"))
145 | self.actionbars = {}
146 |
147 | for _, i in ipairs(LIST_ACTIONBARS) do
148 | local config = self.db.profile.actionbars[i]
149 | if config.enabled then
150 | self.actionbars[i] = self:Create(i, config, BINDING_MAPPINGS[i])
151 | else
152 | self:CreateBarOption(i, self.disabledoptions)
153 | end
154 | end
155 |
156 | first = nil
157 | end
158 |
159 | self:RegisterEvent("UPDATE_BINDINGS", "ReassignBindings")
160 | self:ReassignBindings()
161 |
162 | LSM.RegisterCallback(self, "LibSharedMedia_Registered", function(mtype, key)
163 | if mtype == "font" then
164 | for k, bar in pairs(self.actionbars) do
165 | if bar.config.elements.hotkey.font == key or bar.config.elements.count.font == key or bar.config.elements.macro.font == key then
166 | bar:UpdateButtonConfig()
167 | end
168 | end
169 | end
170 | end)
171 |
172 | if Masque then
173 | self.MasqueFlyoutGroup = Masque:Group("Bartender4", "Flyout")
174 | for _, button in pairs(LAB10.FlyoutButtons) do
175 | button:AddToMasque(self.MasqueFlyoutGroup)
176 | end
177 |
178 | LAB10:RegisterCallback("OnFlyoutButtonCreated", function(event, button) button:AddToMasque(self.MasqueFlyoutGroup) end)
179 | end
180 |
181 | if EventRegistry then
182 | EventRegistry:RegisterCallback("HouseEditor.StateUpdated", function(_, state) self:HousingStateChanged(state) end, self)
183 | end
184 | end
185 |
186 | function BT4ActionBars:SetupOptions()
187 | if not self.options then
188 | -- empty table to hold the bar options
189 | self.options = {}
190 |
191 | -- template for disabled bars
192 | self.disabledoptions = {
193 | general = {
194 | type = "group",
195 | name = L["General Settings"],
196 | cmdInline = true,
197 | order = 1,
198 | args = {
199 | enabled = {
200 | type = "toggle",
201 | name = L["Enabled"],
202 | desc = L["Enable/Disable the bar."],
203 | set = function(info, v) if v then BT4ActionBars:EnableBar(info[2]) end end,
204 | get = function() return false end,
205 | }
206 | }
207 | }
208 | }
209 |
210 | -- iterate over bars and create their option tables
211 | for _, i in ipairs(LIST_ACTIONBARS) do
212 | local config = self.db.profile.actionbars[i]
213 | if config.enabled then
214 | self:CreateBarOption(i)
215 | else
216 | self:CreateBarOption(i, self.disabledoptions)
217 | end
218 | end
219 | end
220 | end
221 |
222 | -- Applys the config in the current profile to all active Bars
223 | function BT4ActionBars:ApplyConfig()
224 | for _, i in ipairs(LIST_ACTIONBARS) do
225 | local config = self.db.profile.actionbars[i]
226 | -- make sure the bar has its current config object if it exists already
227 | if self.actionbars[i] then
228 | self.actionbars[i].config = config
229 | end
230 | if config.enabled then
231 | self:EnableBar(i)
232 | else
233 | self:DisableBar(i)
234 | end
235 | end
236 |
237 | if LibStub("LibActionButton-1.0").flyoutHandler then
238 | LibStub("LibActionButton-1.0").flyoutHandler.Background:SetShown(Bartender4.db.profile.flyoutBackground)
239 | end
240 | end
241 |
242 | -- we do not allow to disable the actionbars module
243 | function BT4ActionBars:ToggleModule()
244 | return
245 | end
246 |
247 | function BT4ActionBars:UpdateButtons(force)
248 | for i,v in ipairs(self.actionbars) do
249 | for j,button in ipairs(v.buttons) do
250 | button:UpdateAction(force)
251 | end
252 | end
253 | end
254 |
255 | local function MigrateKeybindBindings(target, ...)
256 | local needSaving = false
257 | for k=1, select('#', ...) do
258 | local key = select(k, ...)
259 | if key and key ~= "" then
260 | SetBindingClick(key, target, "Keybind")
261 | needSaving = true
262 | end
263 | end
264 | return needSaving
265 | end
266 |
267 | function BT4ActionBars:HousingStateChanged(state)
268 | self.InHousing = state
269 | if state and self.actionbars then
270 | for id in pairs(BINDING_MAPPINGS) do
271 | local frame = self.actionbars[id]
272 | if frame then
273 | ClearOverrideBindings(frame)
274 | end
275 | end
276 | elseif not state then
277 | self:ReassignBindings()
278 | end
279 | end
280 |
281 | local s_inReassignBindings = false
282 | function BT4ActionBars:ReassignBindings()
283 | if InCombatLockdown() or s_inReassignBindings or self.InHousing then return end
284 | s_inReassignBindings = true
285 |
286 | if self.actionbars then
287 | for id, mapping in pairs(BINDING_MAPPINGS) do
288 | local frame = self.actionbars[id]
289 | if frame then
290 | ClearOverrideBindings(frame)
291 | for i = 1,min(#frame.buttons, 12) do
292 | local button, real_button = mapping:format(i), frame.buttons[i]:GetName()
293 | for k=1, select('#', GetBindingKey(button)) do
294 | local key = select(k, GetBindingKey(button))
295 | if key and key ~= "" then
296 | SetOverrideBindingClick(frame, false, key, real_button, "Keybind")
297 | end
298 | end
299 | end
300 | end
301 | end
302 | end
303 |
304 | -- re-assign bindings from LeftButton to Keybind buttons
305 | local needSaving = false
306 | for i = 1,180 do
307 | local button = ("BT4Button%d"):format(i)
308 | local clickbutton = ("CLICK %s:LeftButton"):format(button)
309 | if MigrateKeybindBindings(button, GetBindingKey(clickbutton)) then
310 | needSaving = true
311 | end
312 | end
313 |
314 | if needSaving then
315 | SaveBindings(GetCurrentBindingSet())
316 | end
317 |
318 | s_inReassignBindings = false
319 | end
320 |
321 | BT4ActionBars.BLIZZARD_BAR_MAP = {
322 | [6] = 2,
323 | [5] = 3,
324 | [3] = 4,
325 | [4] = 5,
326 | [13] = 6,
327 | [14] = 7,
328 | [15] = 8,
329 | }
330 |
331 | function BT4ActionBars:GetBarName(id)
332 | if WoWRetail then
333 | local barID = tonumber(id)
334 | if barID == 7 or barID == 8 or barID == 9 or barID == 10 then
335 | return (L["Class Bar %d"]):format(barID - 6)
336 | elseif self.BLIZZARD_BAR_MAP[barID] then
337 | return (L["Bar %s"]):format(tostring(self.BLIZZARD_BAR_MAP[barID]))
338 | elseif barID == 2 then
339 | return L["Bonus Action Bar"]
340 | end
341 | end
342 | return (L["Bar %s"]):format(id)
343 | end
344 |
345 | -- Creates a new bar object based on the id and the specified config
346 | function BT4ActionBars:Create(id, config, bindingmapping)
347 | id = tostring(id)
348 | local bar = setmetatable(Bartender4.StateBar:Create(id, config, self:GetBarName(id)), ActionBar_MT)
349 | bar.module = self
350 | bar.bindingmapping = bindingmapping
351 |
352 | bar:SetScript("OnEvent", bar.OnEvent)
353 | if not WoWClassic or WoWCata or WoWMists then
354 | bar:RegisterEvent("PLAYER_TALENT_UPDATE")
355 | bar:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
356 | end
357 |
358 | if WoWMidnight or WoWTBC then
359 | bar:RegisterEvent("LEARNED_SPELL_IN_SKILL_LINE")
360 | else
361 | bar:RegisterEvent("LEARNED_SPELL_IN_TAB")
362 | end
363 | bar:RegisterEvent("PLAYER_REGEN_ENABLED")
364 |
365 | self:CreateBarOption(id)
366 |
367 | bar:ApplyConfig()
368 |
369 | return bar
370 | end
371 |
372 | function BT4ActionBars:DisableBar(id)
373 | id = tonumber(id)
374 | local bar = self.actionbars[id]
375 | if not bar then return end
376 |
377 | bar.config.enabled = false
378 | bar:Disable()
379 | self:CreateBarOption(id, self.disabledoptions)
380 | end
381 |
382 | function BT4ActionBars:EnableBar(id)
383 | id = tonumber(id)
384 | local bar = self.actionbars[id]
385 | local config = self.db.profile.actionbars[id]
386 | config.enabled = true
387 | if not bar then
388 | bar = self:Create(id, config, BINDING_MAPPINGS[id])
389 | self.actionbars[id] = bar
390 | else
391 | bar.disabled = nil
392 | self:CreateBarOption(id)
393 | bar:ApplyConfig(config)
394 | end
395 | if not Bartender4.Locked then
396 | bar:Unlock()
397 | end
398 | end
399 |
400 | function BT4ActionBars:GetAll()
401 | return pairs(self.actionbars)
402 | end
403 |
404 | function BT4ActionBars:ForAll(method, ...)
405 | for _, bar in self:GetAll() do
406 | local func = bar[method]
407 | if func then
408 | func(bar, ...)
409 | end
410 | end
411 | end
412 |
413 | function BT4ActionBars:ForAllButtons(...)
414 | self:ForAll("ForAll", ...)
415 | end
416 |
--------------------------------------------------------------------------------
/Bindings_Mainline.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | if InCombatLockdown() then
4 | print("Cannot change the button lock during combat.")
5 | return
6 | end
7 | Bartender4.db.profile.buttonlock = not Bartender4.db.profile.buttonlock
8 | Bartender4.Bar:ForAll("ForAll", "SetAttribute", "buttonlock", Bartender4.db.profile.buttonlock)
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
--------------------------------------------------------------------------------
/Options/PresetsClassic.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Copyright (c) 2009, CMTitan
3 | Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
4 | Based on Nevcairiel's RepXPBar.lua
5 | All rights to be transferred to Nevcairiel upon inclusion into Bartender4.
6 | All rights reserved, otherwise.
7 | ]]
8 | local _, Bartender4 = ...
9 | -- fetch upvalues
10 | local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
11 | local Bar = Bartender4.Bar.prototype
12 |
13 | local WoW10 = select(4, GetBuildInfo()) >= 100000
14 | if WoW10 then return end
15 |
16 | local WoWCata = (WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC)
17 | local WoWMists = (WOW_PROJECT_ID == WOW_PROJECT_MISTS_CLASSIC)
18 |
19 | local PresetsMod = Bartender4:NewModule("Presets")
20 |
21 | PresetsMod.showXPBar = true
22 | PresetsMod.showStatusBar = true
23 |
24 | function PresetsMod:ToggleModule(info, val)
25 | -- We are always enabled. Period.
26 | if not self:IsEnabled() then
27 | self:Enabled()
28 | end
29 | end
30 |
31 | local function SetBarLocation(config, point, x, y)
32 | config.position.point = point
33 | config.position.x = x
34 | config.position.y = y
35 | end
36 |
37 | local function BuildSingleProfile()
38 | local dy, config
39 | dy = 0
40 | if not PresetsMod.showXPBar then
41 | dy = dy - 7
42 | end
43 |
44 | local actionButtonScale = 1.0
45 |
46 | Bartender4.db.profile.blizzardVehicle = false
47 | Bartender4.db.profile.outofrange = "hotkey"
48 | Bartender4.db.profile.focuscastmodifier = false
49 |
50 | config = Bartender4.db:GetNamespace("ActionBars").profile
51 | config.actionbars[1].padding = 6
52 | config.actionbars[1].position.scale = actionButtonScale
53 | SetBarLocation( config.actionbars[1], "BOTTOM", -256, 41.75 )
54 | config.actionbars[2].position.scale = actionButtonScale
55 | config.actionbars[2].enabled = false
56 | config.actionbars[3].padding = 5
57 | config.actionbars[3].rows = 12
58 | config.actionbars[3].position.scale = actionButtonScale
59 | SetBarLocation( config.actionbars[3], "BOTTOMRIGHT", -42, 610 )
60 | config.actionbars[4].padding = 5
61 | config.actionbars[4].rows = 12
62 | config.actionbars[4].position.scale = actionButtonScale
63 | config.actionbars[5].position.scale = actionButtonScale
64 | config.actionbars[6].position.scale = actionButtonScale
65 | SetBarLocation( config.actionbars[4], "BOTTOMRIGHT", -82, 610 )
66 | SetBarLocation( config.actionbars[5], "BOTTOM", -232, 94 + dy )
67 | SetBarLocation( config.actionbars[6], "BOTTOM", -232, 132 + dy )
68 |
69 | config = Bartender4.db:GetNamespace("BagBar").profile
70 | config.enabled = false
71 | Bartender4:GetModule("BagBar"):Disable()
72 | config = Bartender4.db:GetNamespace("MicroMenu").profile
73 | config.enabled = false
74 | Bartender4:GetModule("MicroMenu"):Disable()
75 | config = Bartender4.db:GetNamespace("StanceBar").profile
76 | config.enabled = false
77 | Bartender4:GetModule("StanceBar"):Disable()
78 |
79 | if PresetsMod.showXPBar then
80 | config = Bartender4.db:GetNamespace("XPBar").profile
81 | config.enabled = true
82 | config.scale = 0.5
83 | Bartender4:GetModule("XPBar"):Enable()
84 | SetBarLocation( config, "BOTTOM", -256, 48)
85 |
86 | config = Bartender4.db:GetNamespace("RepBar").profile
87 | config.enabled = true
88 | config.scale = 0.5
89 | Bartender4:GetModule("RepBar"):Enable()
90 | SetBarLocation( config, "BOTTOM", -256, 51)
91 | end
92 |
93 | config = Bartender4.db:GetNamespace("BlizzardArt").profile
94 | config.enabled = true
95 | config.artLayout = "ONEBAR"
96 | Bartender4:GetModule("BlizzardArt"):Enable()
97 | SetBarLocation( config, "BOTTOM", -256, 47 )
98 |
99 | config = Bartender4.db:GetNamespace("PetBar").profile
100 | SetBarLocation( config, "BOTTOM", -164, 164 + dy )
101 | end
102 |
103 | local function BuildDoubleProfile()
104 | local dy, config
105 | dy = 0
106 | if not PresetsMod.showXPBar then
107 | dy = dy - 13
108 | end
109 |
110 | local actionButtonScale = 1.0
111 |
112 | Bartender4.db.profile.blizzardVehicle = true
113 | Bartender4.db.profile.outofrange = "hotkey"
114 | Bartender4.db.profile.focuscastmodifier = false
115 |
116 | config = Bartender4.db:GetNamespace("ActionBars").profile
117 | config.actionbars[1].padding = 6
118 | config.actionbars[1].position.scale = actionButtonScale
119 | SetBarLocation( config.actionbars[1], "BOTTOM", -510, 41.75 )
120 | config.actionbars[2].padding = 6
121 | config.actionbars[2].position.scale = actionButtonScale
122 | SetBarLocation( config.actionbars[2], "BOTTOM", 3, 41.75 )
123 | config.actionbars[3].padding = 5
124 | config.actionbars[3].rows = 12
125 | config.actionbars[3].position.scale = actionButtonScale
126 | SetBarLocation( config.actionbars[3], "BOTTOMRIGHT", -42, 610 )
127 | config.actionbars[4].padding = 5
128 | config.actionbars[4].rows = 12
129 | config.actionbars[4].position.scale = actionButtonScale
130 | SetBarLocation( config.actionbars[4], "BOTTOMRIGHT", -82, 610 )
131 | config.actionbars[5].padding = 6
132 | config.actionbars[5].position.scale = actionButtonScale
133 | SetBarLocation( config.actionbars[5], "BOTTOM", 3, 102 + dy )
134 | config.actionbars[6].padding = 6
135 | config.actionbars[6].position.scale = actionButtonScale
136 | SetBarLocation( config.actionbars[6], "BOTTOM", -510, 102 + dy )
137 |
138 | config = Bartender4.db:GetNamespace("BagBar").profile
139 | config.enabled = false
140 | Bartender4:GetModule("BagBar"):Disable()
141 |
142 | config = Bartender4.db:GetNamespace("MicroMenu").profile
143 | config.enabled = false
144 | Bartender4:GetModule("MicroMenu"):Disable()
145 |
146 | if PresetsMod.showXPBar then
147 | config = Bartender4.db:GetNamespace("XPBar").profile
148 | config.enabled = true
149 | Bartender4:GetModule("XPBar"):Enable()
150 | SetBarLocation( config, "BOTTOM", -514, 54)
151 |
152 | config = Bartender4.db:GetNamespace("RepBar").profile
153 | config.enabled = true
154 | Bartender4:GetModule("RepBar"):Enable()
155 | SetBarLocation( config, "BOTTOM", -514, 61)
156 | end
157 |
158 | config = Bartender4.db:GetNamespace("BlizzardArt").profile
159 | config.enabled = true
160 | config.artLayout = "TWOBAR"
161 | Bartender4:GetModule("BlizzardArt"):Enable()
162 | SetBarLocation( config, "BOTTOM", -512, 47 )
163 |
164 | config = Bartender4.db:GetNamespace("PetBar").profile
165 | if GetNumShapeshiftForms() > 0 then
166 | SetBarLocation( config, "BOTTOM", -120, 135 + dy )
167 | config = Bartender4.db:GetNamespace("StanceBar").profile
168 | config.position.scale = 1.0
169 | SetBarLocation( config, "BOTTOM", -460, 135 + dy )
170 | else
171 | SetBarLocation( config, "BOTTOM", -460, 135 + dy )
172 | end
173 | end
174 |
175 | local function BuildBlizzardProfile()
176 | local dy, config
177 | dy = 0
178 | if not PresetsMod.showXPBar then
179 | dy = dy - 13
180 | end
181 |
182 | local showKeyRing = KeyRingButton and GetCVarBool("showKeyring") or nil
183 | local actionButtonScale = 1.0
184 |
185 | Bartender4.db.profile.blizzardVehicle = true
186 | Bartender4.db.profile.outofrange = "hotkey"
187 | Bartender4.db.profile.focuscastmodifier = false
188 |
189 | config = Bartender4.db:GetNamespace("ActionBars").profile
190 | config.actionbars[1].padding = 6
191 | config.actionbars[1].position.scale = actionButtonScale
192 | SetBarLocation( config.actionbars[1], "BOTTOM", -510, 41.75 )
193 | config.actionbars[2].enabled = false
194 | config.actionbars[2].position.scale = actionButtonScale
195 | config.actionbars[3].padding = 5
196 | config.actionbars[3].rows = 12
197 | config.actionbars[3].position.scale = actionButtonScale
198 | SetBarLocation( config.actionbars[3], "BOTTOMRIGHT", -82, 610 )
199 | config.actionbars[4].padding = 5
200 | config.actionbars[4].rows = 12
201 | config.actionbars[4].position.scale = actionButtonScale
202 | SetBarLocation( config.actionbars[4], "BOTTOMRIGHT", -42, 610 )
203 | config.actionbars[5].padding = 6
204 | config.actionbars[5].position.scale = actionButtonScale
205 | SetBarLocation( config.actionbars[5], "BOTTOM", 3, 110 + dy )
206 | config.actionbars[6].padding = 6
207 | config.actionbars[6].position.scale = actionButtonScale
208 | SetBarLocation( config.actionbars[6], "BOTTOM", -510, 110 + dy )
209 |
210 | config = Bartender4.db:GetNamespace("BagBar").profile
211 | config.onebag = false
212 | config.keyring = showKeyRing
213 | config.verticalAlignment = "CENTER"
214 | if WoWMists then
215 | config.keyring = false
216 | config.padding = 2
217 | config.scale = 0.9
218 | SetBarLocation( config, "BOTTOM", 346, 38)
219 | elseif WoWCata then
220 | config.keyring = false
221 | config.padding = 4
222 | config.scale = 0.9
223 | SetBarLocation( config, "BOTTOM", 346, 38)
224 | elseif GetClassicExpansionLevel() >= 2 --[[Wrath]] then
225 | config.padding = 4
226 | SetBarLocation( config, "BOTTOM", 304, 42)
227 | else
228 | config.padding = 5
229 | SetBarLocation( config, "BOTTOM", 272, 42)
230 | end
231 |
232 | config = Bartender4.db:GetNamespace("MicroMenu").profile
233 | config.position.scale = 1.0
234 | config.padding = (WoWCata or WoWMists) and -3 or -2
235 | SetBarLocation( config, "BOTTOM", 33, 42)
236 |
237 | if PresetsMod.showXPBar then
238 | config = Bartender4.db:GetNamespace("XPBar").profile
239 | config.enabled = true
240 | Bartender4:GetModule("XPBar"):Enable()
241 | SetBarLocation( config, "BOTTOM", -514, 54)
242 |
243 | config = Bartender4.db:GetNamespace("RepBar").profile
244 | config.enabled = true
245 | Bartender4:GetModule("RepBar"):Enable()
246 | SetBarLocation( config, "BOTTOM", -514, 61)
247 | end
248 |
249 | if HasMultiCastActionBar and HasMultiCastActionBar() then
250 | config = Bartender4.db:GetNamespace("MultiCast").profile
251 | config.enabled = true
252 | end
253 |
254 | config = Bartender4.db:GetNamespace("BlizzardArt").profile
255 | config.enabled = true
256 | Bartender4:GetModule("BlizzardArt"):Enable()
257 | SetBarLocation( config, "BOTTOM", -512, 47 )
258 |
259 | config = Bartender4.db:GetNamespace("PetBar").profile
260 | if GetNumShapeshiftForms() > 0 or HasMultiCastActionBar and HasMultiCastActionBar() then
261 | SetBarLocation( config, "BOTTOM", -120, 143 + dy )
262 | if GetNumShapeshiftForms() > 0 then
263 | config = Bartender4.db:GetNamespace("StanceBar").profile
264 | config.position.scale = 1.0
265 | SetBarLocation( config, "BOTTOM", -460, 143 + dy )
266 | elseif HasMultiCastActionBar and HasMultiCastActionBar() then
267 | config = Bartender4.db:GetNamespace("MultiCast").profile
268 | config.position.scale = 1.0
269 | Bartender4:GetModule("MultiCast"):Enable()
270 | SetBarLocation( config, "BOTTOM", -460, 143 + dy )
271 | end
272 | else
273 | SetBarLocation( config, "BOTTOM", -460, 143 + dy )
274 | end
275 | end
276 |
277 | function PresetsMod:ResetProfile(type)
278 | if not type then type = PresetsMod.defaultType end
279 | Bartender4.db:ResetProfile()
280 | if type == "BLIZZARD" then
281 | BuildBlizzardProfile()
282 | elseif type == "DOUBLE" then
283 | BuildDoubleProfile()
284 | elseif type == "SINGLE" then
285 | BuildSingleProfile()
286 | end
287 | Bartender4:UpdateModuleConfigs()
288 | end
289 |
290 | function PresetsMod:OnEnable()
291 | Bartender4.finishedLoading = true
292 | if self.applyBlizzardOnEnable then
293 | self:ResetProfile("BLIZZARD")
294 | self.applyBlizzardOnEnable = nil
295 | end
296 | end
297 |
298 | function PresetsMod:SetupOptions()
299 | if not self.options then
300 | PresetsMod.defaultType = "BLIZZARD"
301 | self.showStatusBar = true
302 | self.showXPBar = true
303 | local otbl = {
304 | message1 = {
305 | order = 1,
306 | type = "description",
307 | name = L["You can use the preset defaults as a starting point for setting up your interface. Just choose your preferences here and click the button below to reset your profile to the preset default. Note that not all defaults show all bars."]
308 | },
309 | message2 = {
310 | order = 2,
311 | type = "description",
312 | name = L["|cffff0000WARNING|cffffffff: Pressing the button will reset your complete profile! If you're not sure about this, create a new profile and use that to experiment."],
313 | },
314 | preset = {
315 | order = 10,
316 | type = "select",
317 | name = L["Presets"],
318 | values = { BLIZZARD = L["Blizzard interface"], DOUBLE = L["Two bars wide"], SINGLE = L["Three bars stacked"], ZRESET = L["Full reset"] },
319 | get = function() return PresetsMod.defaultType end,
320 | set = function(info, val) PresetsMod.defaultType = val end
321 | },
322 | nl1 = {
323 | order = 11,
324 | type = "description",
325 | name = ""
326 | },
327 | xpbar = {
328 | order = 20,
329 | type = "toggle",
330 | width = "full",
331 | name = L["XP Bar"],
332 | get = function() return PresetsMod.showXPBar end,
333 | set = function(info, val) PresetsMod.showXPBar = val end,
334 | disabled = function() return PresetsMod.defaultType == "RESET" end,
335 | },
336 | nl2 = {
337 | order = 36,
338 | type = "description",
339 | name = ""
340 | },
341 | button = {
342 | order = 40,
343 | type = "execute",
344 | name = L["Apply Preset"],
345 | func = function() PresetsMod.ResetProfile() end,
346 | }
347 | }
348 | self.optionobject = Bartender4:NewOptionObject( otbl )
349 | self.options = {
350 | order = 99,
351 | type = "group",
352 | name = L["Presets"],
353 | desc = L["Configure all of Bartender to preset defaults"],
354 | childGroups = "tab",
355 | }
356 | Bartender4:RegisterModuleOptions("Presets", self.options)
357 | end
358 | self.options.args = self.optionobject.table
359 | end
360 |
--------------------------------------------------------------------------------