MicroMenu now uses the default ButtonBar template, which enables it to use full Row control
This commit is contained in:
+7
-4
@@ -140,18 +140,21 @@ function ButtonBar:UpdateButtonLayout()
|
||||
ButtonPerRow = 1
|
||||
end
|
||||
|
||||
self:SetSize((self.button_width + pad) * ButtonPerRow - pad + 8, (self.button_height + pad) * Rows - pad + 8)
|
||||
local hpad = pad + (self.hpad_offset or 0)
|
||||
local vpad = pad + (self.vpad_offset or 0)
|
||||
|
||||
self:SetSize((self.button_width + hpad) * ButtonPerRow - pad + 8, (self.button_height + vpad) * Rows - pad + 8)
|
||||
|
||||
-- anchor button 1 to the topleft corner of the bar
|
||||
buttons[1]:ClearSetPoint("TOPLEFT", self, "TOPLEFT", 5, -3)
|
||||
buttons[1]:ClearSetPoint("TOPLEFT", self, "TOPLEFT", 5 - (self.hpad_offset or 0), -3 - (self.vpad_offset or 0))
|
||||
-- and anchor all other buttons relative to our button 1
|
||||
for i = 2, numbuttons do
|
||||
-- jump into a new row
|
||||
if ((i-1) % ButtonPerRow) == 0 then
|
||||
buttons[i]:ClearSetPoint("TOPLEFT", buttons[i-ButtonPerRow], "BOTTOMLEFT", 0, -pad)
|
||||
buttons[i]:ClearSetPoint("TOPLEFT", buttons[i-ButtonPerRow], "BOTTOMLEFT", 0, -vpad)
|
||||
-- align to the previous button
|
||||
else
|
||||
buttons[i]:ClearSetPoint("TOPLEFT", buttons[i-1], "TOPRIGHT", pad, 0)
|
||||
buttons[i]:ClearSetPoint("TOPLEFT", buttons[i-1], "TOPRIGHT", hpad, 0)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+12
-26
@@ -3,10 +3,10 @@ local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
|
||||
local MicroMenuMod = Bartender4:NewModule("MicroMenu", "AceHook-3.0")
|
||||
|
||||
-- fetch upvalues
|
||||
local Bar = Bartender4.Bar.prototype
|
||||
local ButtonBar = Bartender4.ButtonBar.prototype
|
||||
|
||||
-- create prototype information
|
||||
local MicroMenuBar = setmetatable({}, {__index = Bar})
|
||||
local MicroMenuBar = setmetatable({}, {__index = ButtonBar})
|
||||
|
||||
local table_insert = table.insert
|
||||
|
||||
@@ -16,7 +16,7 @@ local defaults = { profile = Bartender4:Merge({
|
||||
visibility = {
|
||||
possess = false,
|
||||
},
|
||||
}, Bartender4.Bar.defaults) }
|
||||
}, Bartender4.ButtonBar.defaults) }
|
||||
|
||||
function MicroMenuMod:OnInitialize()
|
||||
self.db = Bartender4.db:RegisterNamespace("MicroMenu", defaults)
|
||||
@@ -27,7 +27,7 @@ local noopFunc = function() end
|
||||
|
||||
function MicroMenuMod:OnEnable()
|
||||
if not self.bar then
|
||||
self.bar = setmetatable(Bartender4.Bar:Create("MicroMenu", self.db.profile, L["Micro Menu"]), {__index = MicroMenuBar})
|
||||
self.bar = setmetatable(Bartender4.ButtonBar:Create("MicroMenu", self.db.profile, L["Micro Menu"]), {__index = MicroMenuBar})
|
||||
local buttons = {}
|
||||
table_insert(buttons, CharacterMicroButton)
|
||||
table_insert(buttons, SpellbookMicroButton)
|
||||
@@ -41,6 +41,8 @@ function MicroMenuMod:OnEnable()
|
||||
table_insert(buttons, HelpMicroButton)
|
||||
self.bar.buttons = buttons
|
||||
|
||||
MicroMenuMod.button_count = #buttons
|
||||
|
||||
self:RawHook("UpdateTalentButton", noopFunc, true)
|
||||
self:RawHook("AchievementMicroButton_Update", noopFunc, true)
|
||||
|
||||
@@ -48,6 +50,7 @@ function MicroMenuMod:OnEnable()
|
||||
v:SetParent(self.bar)
|
||||
v:Show()
|
||||
v:SetFrameLevel(self.bar:GetFrameLevel() + 1)
|
||||
v.ClearSetPoint = self.bar.ClearSetPoint
|
||||
end
|
||||
|
||||
self.bar:SetPoint("CENTER", -105, 27)
|
||||
@@ -61,27 +64,10 @@ function MicroMenuMod:ApplyConfig()
|
||||
self.bar:ApplyConfig(self.db.profile)
|
||||
end
|
||||
|
||||
MicroMenuBar.button_width = 28
|
||||
MicroMenuBar.button_height = 58
|
||||
MicroMenuBar.vpad_offset = -21
|
||||
function MicroMenuBar:ApplyConfig(config)
|
||||
Bar.ApplyConfig(self, config)
|
||||
self:PerformLayout()
|
||||
end
|
||||
|
||||
function MicroMenuBar:PerformLayout()
|
||||
if self.config.vertical then
|
||||
self:SetSize(35, 377)
|
||||
self.buttons[1]:ClearAllPoints()
|
||||
self.buttons[1]:SetPoint("TOPLEFT", self, "TOPLEFT", 5, 18)
|
||||
for i = 2, #self.buttons do
|
||||
self.buttons[i]:ClearAllPoints()
|
||||
self.buttons[i]:SetPoint("TOPLEFT", self.buttons[i-1], "BOTTOMLEFT", 0, 21)
|
||||
end
|
||||
else
|
||||
self:SetSize(252, 45)
|
||||
self.buttons[1]:ClearAllPoints()
|
||||
self.buttons[1]:SetPoint("TOPLEFT", self, "TOPLEFT", 5, 18)
|
||||
for i = 2, #self.buttons do
|
||||
self.buttons[i]:ClearAllPoints()
|
||||
self.buttons[i]:SetPoint("TOPLEFT", self.buttons[i-1], "TOPRIGHT", -4, 0)
|
||||
end
|
||||
end
|
||||
ButtonBar.ApplyConfig(self, config)
|
||||
self:UpdateButtonLayout()
|
||||
end
|
||||
|
||||
+4
-12
@@ -3,11 +3,12 @@ local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
|
||||
local MicroMenuMod = Bartender4:GetModule("MicroMenu")
|
||||
|
||||
-- fetch upvalues
|
||||
local Bar = Bartender4.Bar.prototype
|
||||
local ButtonBar = Bartender4.ButtonBar.prototype
|
||||
|
||||
function MicroMenuMod:SetupOptions()
|
||||
if not self.options then
|
||||
self.optionobject = Bar:GetOptionObject()
|
||||
self.optionobject = ButtonBar:GetOptionObject()
|
||||
self.optionobject.table.general.args.rows.max = self.button_count
|
||||
local enabled = {
|
||||
type = "toggle",
|
||||
order = 1,
|
||||
@@ -19,16 +20,6 @@ function MicroMenuMod:SetupOptions()
|
||||
}
|
||||
self.optionobject:AddElement("general", "enabled", enabled)
|
||||
|
||||
local vertical = {
|
||||
type = "toggle",
|
||||
order = 150,
|
||||
name = L["Vertical MicroMenu"],
|
||||
desc = L["Show the MicroMenu vertically."],
|
||||
get = function() return self.db.profile.vertical end,
|
||||
set = function(info, state) self.db.profile.vertical = state; self.bar:PerformLayout() end,
|
||||
}
|
||||
self.optionobject:AddElement("general", "vertical", vertical)
|
||||
|
||||
self.disabledoptions = {
|
||||
general = {
|
||||
type = "group",
|
||||
@@ -47,6 +38,7 @@ function MicroMenuMod:SetupOptions()
|
||||
desc = L["Configure the Micro Menu"],
|
||||
childGroups = "tab",
|
||||
}
|
||||
self.optionobject.table.general.args.padding.min = -30
|
||||
Bartender4:RegisterBarOptions("MicroMenu", self.options)
|
||||
end
|
||||
self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
|
||||
|
||||
@@ -109,7 +109,6 @@ if not L then return end
|
||||
-- L["Self-Cast Modifier"] = true
|
||||
-- L["Self-Cast by modifier"] = true
|
||||
-- L["Show a Icon to open the config at the Minimap"] = true
|
||||
-- L["Show the MicroMenu vertically."] = true
|
||||
-- L["Show the keyring button."] = true
|
||||
-- L["Specify the Color of the Out of Mana Indicator"] = true
|
||||
-- L["Specify the Color of the Out of Range Indicator"] = true
|
||||
@@ -129,7 +128,6 @@ if not L then return end
|
||||
-- L["Toggle the use of the modifier-based self-cast functionality."] = true
|
||||
-- L["Toggle the use of the right-click self-cast functionality."] = true
|
||||
-- L["Use Custom Condition"] = true
|
||||
-- L["Vertical MicroMenu"] = true
|
||||
-- L["Visibility"] = true
|
||||
-- L["XP Bar"] = true
|
||||
-- L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
|
||||
@@ -109,7 +109,6 @@ L["Select the Self-Cast Modifier"] = true
|
||||
L["Self-Cast Modifier"] = true
|
||||
L["Self-Cast by modifier"] = true
|
||||
L["Show a Icon to open the config at the Minimap"] = true
|
||||
L["Show the MicroMenu vertically."] = true
|
||||
L["Show the keyring button."] = true
|
||||
L["Specify the Color of the Out of Mana Indicator"] = true
|
||||
L["Specify the Color of the Out of Range Indicator"] = true
|
||||
@@ -129,7 +128,6 @@ L["Toggle the use of the modifier-based focus-cast functionality."] = true
|
||||
L["Toggle the use of the modifier-based self-cast functionality."] = true
|
||||
L["Toggle the use of the right-click self-cast functionality."] = true
|
||||
L["Use Custom Condition"] = true
|
||||
L["Vertical MicroMenu"] = true
|
||||
L["Visibility"] = true
|
||||
L["XP Bar"] = true
|
||||
L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
|
||||
@@ -109,7 +109,6 @@ if not L then return end
|
||||
-- L["Self-Cast Modifier"] = true
|
||||
-- L["Self-Cast by modifier"] = true
|
||||
-- L["Show a Icon to open the config at the Minimap"] = true
|
||||
-- L["Show the MicroMenu vertically."] = true
|
||||
-- L["Show the keyring button."] = true
|
||||
-- L["Specify the Color of the Out of Mana Indicator"] = true
|
||||
-- L["Specify the Color of the Out of Range Indicator"] = true
|
||||
@@ -129,7 +128,6 @@ if not L then return end
|
||||
-- L["Toggle the use of the modifier-based self-cast functionality."] = true
|
||||
-- L["Toggle the use of the right-click self-cast functionality."] = true
|
||||
-- L["Use Custom Condition"] = true
|
||||
-- L["Vertical MicroMenu"] = true
|
||||
-- L["Visibility"] = true
|
||||
-- L["XP Bar"] = true
|
||||
-- L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
|
||||
@@ -109,7 +109,6 @@ if not L then return end
|
||||
-- L["Self-Cast Modifier"] = true
|
||||
-- L["Self-Cast by modifier"] = true
|
||||
-- L["Show a Icon to open the config at the Minimap"] = true
|
||||
-- L["Show the MicroMenu vertically."] = true
|
||||
-- L["Show the keyring button."] = true
|
||||
-- L["Specify the Color of the Out of Mana Indicator"] = true
|
||||
-- L["Specify the Color of the Out of Range Indicator"] = true
|
||||
@@ -129,7 +128,6 @@ if not L then return end
|
||||
-- L["Toggle the use of the modifier-based self-cast functionality."] = true
|
||||
-- L["Toggle the use of the right-click self-cast functionality."] = true
|
||||
-- L["Use Custom Condition"] = true
|
||||
-- L["Vertical MicroMenu"] = true
|
||||
-- L["Visibility"] = true
|
||||
-- L["XP Bar"] = true
|
||||
-- L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
|
||||
@@ -109,7 +109,6 @@ L["Scale"] = "Échelle"
|
||||
-- L["Self-Cast Modifier"] = true
|
||||
L["Self-Cast by modifier"] = "Ciblage auto. modific."
|
||||
-- L["Show a Icon to open the config at the Minimap"] = true
|
||||
-- L["Show the MicroMenu vertically."] = true
|
||||
L["Show the keyring button."] = "Affiche le bouton du trousseau de clés."
|
||||
L["Specify the Color of the Out of Mana Indicator"] = "Spécifie la couleur de l'indicateur Plus de mana."
|
||||
L["Specify the Color of the Out of Range Indicator"] = "Spécifie la couleur de l'indicateur Hors de portée."
|
||||
@@ -129,7 +128,6 @@ L["Toggle the button grid."] = "Affiche ou non la grille des boutons."
|
||||
L["Toggle the use of the modifier-based self-cast functionality."] = "Utilise ou non la fonctionnalité de ciblage auto. basé sur les modificateurs."
|
||||
L["Toggle the use of the right-click self-cast functionality."] = "Utilise ou non la fonctionnalité de ciblage auto. au clic droit."
|
||||
-- L["Use Custom Condition"] = true
|
||||
-- L["Vertical MicroMenu"] = true
|
||||
-- L["Visibility"] = true
|
||||
-- L["XP Bar"] = true
|
||||
-- L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
|
||||
@@ -109,7 +109,6 @@ L["Scale"] = "크기"
|
||||
-- L["Self-Cast Modifier"] = true
|
||||
L["Self-Cast by modifier"] = "기능키에 의한 자신-시전"
|
||||
-- L["Show a Icon to open the config at the Minimap"] = true
|
||||
-- L["Show the MicroMenu vertically."] = true
|
||||
L["Show the keyring button."] = "열쇠 고리 버튼을 표시합니다."
|
||||
L["Specify the Color of the Out of Mana Indicator"] = "마나 부족 지시기의 색상을 지정합니다."
|
||||
L["Specify the Color of the Out of Range Indicator"] = "사정 거리밖 지시기의 색상을 지정합니다."
|
||||
@@ -129,7 +128,6 @@ L["Toggle the button grid."] = "버튼 무늬를 전환합니다."
|
||||
L["Toggle the use of the modifier-based self-cast functionality."] = "기능키-기반 자신에게 시전 기능의 사용을 전환합니다."
|
||||
L["Toggle the use of the right-click self-cast functionality."] = "우-클릭시 자신에게 시전 기능의 사용을 전환합니다."
|
||||
L["Use Custom Condition"] = "사용자 설정 사용"
|
||||
-- L["Vertical MicroMenu"] = true
|
||||
L["Visibility"] = "보이기"
|
||||
-- L["XP Bar"] = true
|
||||
L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = "단축키로 지정해서 사용한다면 모든 바를 숨길 수 있습니다."
|
||||
|
||||
@@ -109,7 +109,6 @@ L["Scale"] = "Масштаб"
|
||||
-- L["Self-Cast Modifier"] = true
|
||||
L["Self-Cast by modifier"] = "Чтение на себя по умолчанию"
|
||||
-- L["Show a Icon to open the config at the Minimap"] = true
|
||||
-- L["Show the MicroMenu vertically."] = true
|
||||
L["Show the keyring button."] = "Показывать кнопку для связки ключей"
|
||||
L["Specify the Color of the Out of Mana Indicator"] = "Выберите цвет для индикации нехватки маны"
|
||||
L["Specify the Color of the Out of Range Indicator"] = "Выберите цвет для индикации 'Вне Зоны'"
|
||||
@@ -129,7 +128,6 @@ L["Toggle the button grid."] = "Переключение отображения
|
||||
L["Toggle the use of the modifier-based self-cast functionality."] = "Переключение использования функции Чтение на себя по умолчанию."
|
||||
L["Toggle the use of the right-click self-cast functionality."] = "Переключение использования функции ПКМ Чтение на себя."
|
||||
-- L["Use Custom Condition"] = true
|
||||
-- L["Vertical MicroMenu"] = true
|
||||
-- L["Visibility"] = true
|
||||
-- L["XP Bar"] = true
|
||||
-- L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
|
||||
@@ -109,7 +109,6 @@ L["Select the Self-Cast Modifier"] = "选择自我施法"
|
||||
L["Self-Cast Modifier"] = "自身施法"
|
||||
L["Self-Cast by modifier"] = "自我施法"
|
||||
L["Show a Icon to open the config at the Minimap"] = "显示小地图配置图标"
|
||||
L["Show the MicroMenu vertically."] = "显示垂直的微型菜单."
|
||||
L["Show the keyring button."] = "显示钥匙链"
|
||||
L["Specify the Color of the Out of Mana Indicator"] = "设置法力不足的标识颜色"
|
||||
L["Specify the Color of the Out of Range Indicator"] = "设置射程之外的标识颜色"
|
||||
@@ -129,7 +128,6 @@ L["Toggle the use of the modifier-based focus-cast functionality."] = "关闭/
|
||||
L["Toggle the use of the modifier-based self-cast functionality."] = "关闭/开启 自我施法功能。"
|
||||
L["Toggle the use of the right-click self-cast functionality."] = "关闭/开启 使用右键点击对自己施法功能。"
|
||||
L["Use Custom Condition"] = "使用自定义条件"
|
||||
L["Vertical MicroMenu"] = "垂直微型菜单"
|
||||
L["Visibility"] = "垂直"
|
||||
L["XP Bar"] = "经验条"
|
||||
L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = "你能设置动作条一直隐藏,仅用按键绑定来使用动作条."
|
||||
|
||||
@@ -109,7 +109,6 @@ L["Scale"] = "大小"
|
||||
-- L["Self-Cast Modifier"] = true
|
||||
L["Self-Cast by modifier"] = "自我施法"
|
||||
-- L["Show a Icon to open the config at the Minimap"] = true
|
||||
-- L["Show the MicroMenu vertically."] = true
|
||||
L["Show the keyring button."] = "顯示鑰匙圈按鈕"
|
||||
L["Specify the Color of the Out of Mana Indicator"] = "指定法力不足提示的顏色"
|
||||
L["Specify the Color of the Out of Range Indicator"] = "指定超出距離提示的顏色"
|
||||
@@ -129,7 +128,6 @@ L["Toggle the button grid."] = "顯示空白按鈕"
|
||||
L["Toggle the use of the modifier-based self-cast functionality."] = "切換使用自我施法功能"
|
||||
L["Toggle the use of the right-click self-cast functionality."] = "切換使用右鍵自我施法功能"
|
||||
-- L["Use Custom Condition"] = true
|
||||
-- L["Vertical MicroMenu"] = true
|
||||
-- L["Visibility"] = true
|
||||
-- L["XP Bar"] = true
|
||||
-- L["You can set the bar to be always hidden, if you only wish to access it using key-bindings."] = true
|
||||
|
||||
Reference in New Issue
Block a user