mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-25 21:40:49 +00:00
pull request modification from @Doite for actionbar
This commit is contained in:
+17
-3
@@ -1276,6 +1276,19 @@ pfUI:RegisterModule("actionbar", "vanilla", function ()
|
|||||||
local spacing = C.bars["bar"..i].spacing
|
local spacing = C.bars["bar"..i].spacing
|
||||||
local background = C.bars["bar"..i].background
|
local background = C.bars["bar"..i].background
|
||||||
local formfactor = C.bars["bar"..i].formfactor
|
local formfactor = C.bars["bar"..i].formfactor
|
||||||
|
local uneven = C.bars["bar"..i].uneven or "Down"
|
||||||
|
-- validate uneven against bar shape and reset if incompatible
|
||||||
|
local _, _, fcols2, frows2 = string.find(tostring(formfactor or ""), "(%d+)%s*x%s*(%d+)")
|
||||||
|
fcols2, frows2 = tonumber(fcols2), tonumber(frows2)
|
||||||
|
local f_is_square = fcols2 == 3 and frows2 == 3
|
||||||
|
local f_is_vertical = fcols2 and fcols2 <= 3 and not f_is_square
|
||||||
|
local f_is_horizontal = frows2 and frows2 <= 3 and not f_is_square
|
||||||
|
if f_is_vertical then
|
||||||
|
if uneven ~= "Up" and uneven ~= "Down" then uneven = "Down" end
|
||||||
|
elseif f_is_horizontal then
|
||||||
|
if uneven ~= "Left" and uneven ~= "Right" then uneven = "Down" end
|
||||||
|
end
|
||||||
|
C.bars["bar"..i].uneven = uneven
|
||||||
local autohide = C.bars["bar"..i].autohide
|
local autohide = C.bars["bar"..i].autohide
|
||||||
local hide_time = C.bars["bar"..i].hide_time
|
local hide_time = C.bars["bar"..i].hide_time
|
||||||
local hide_combat = C.bars["bar"..i].hide_combat == "1" and true or nil
|
local hide_combat = C.bars["bar"..i].hide_combat == "1" and true or nil
|
||||||
@@ -1298,7 +1311,8 @@ pfUI:RegisterModule("actionbar", "vanilla", function ()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- the stored layout is invalid, temporary fallback
|
-- the stored layout is invalid, temporary fallback
|
||||||
if not pfGridmath[buttons][BarLayoutFormfactor(formfactor)] then
|
local _, _, fcols, frows = string.find(tostring(formfactor or ""), "(%d+)%s*x%s*(%d+)")
|
||||||
|
if not ((fcols and frows) or pfGridmath[buttons][BarLayoutFormfactor(formfactor)]) then
|
||||||
formfactor = BarLayoutOptions(buttons)[1]
|
formfactor = BarLayoutOptions(buttons)[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1407,7 +1421,7 @@ pfUI:RegisterModule("actionbar", "vanilla", function ()
|
|||||||
bars[i][j] = CreateActionButton(bars[i], i, j)
|
bars[i][j] = CreateActionButton(bars[i], i, j)
|
||||||
bars[i][j].bar = i
|
bars[i][j].bar = i
|
||||||
|
|
||||||
BarButtonAnchor(bars[i][j], buttonbasename, j, buttons, formfactor, size, border, spacing)
|
BarButtonAnchor(bars[i][j], buttonbasename, j, buttons, formfactor, size, border, spacing, uneven)
|
||||||
bars[i][j]:ClearAllPoints()
|
bars[i][j]:ClearAllPoints()
|
||||||
bars[i][j]:SetPoint(unpack(bars[i][j]._anchor))
|
bars[i][j]:SetPoint(unpack(bars[i][j]._anchor))
|
||||||
bars[i][j]:Show()
|
bars[i][j]:Show()
|
||||||
@@ -1438,7 +1452,7 @@ pfUI:RegisterModule("actionbar", "vanilla", function ()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- adjust actionbar size
|
-- adjust actionbar size
|
||||||
BarLayoutSize(bars[i], buttons, formfactor, size, border, spacing)
|
BarLayoutSize(bars[i], buttons, formfactor, size, border, spacing, uneven)
|
||||||
bars[i]:SetWidth(bars[i]._size[1])
|
bars[i]:SetWidth(bars[i]._size[1])
|
||||||
bars[i]:SetHeight(bars[i]._size[2])
|
bars[i]:SetHeight(bars[i]._size[2])
|
||||||
bars[i]:ClearAllPoints()
|
bars[i]:ClearAllPoints()
|
||||||
|
|||||||
+36
-1
@@ -2609,6 +2609,21 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
|
|||||||
local formfactors = function()
|
local formfactors = function()
|
||||||
return BarLayoutOptions(tonumber(C.bars["bar"..id].buttons) or id < 11 and NUM_ACTIONBAR_BUTTONS or id > 11 and NUM_SHAPESHIFT_SLOTS or NUM_PET_ACTION_SLOTS)
|
return BarLayoutOptions(tonumber(C.bars["bar"..id].buttons) or id < 11 and NUM_ACTIONBAR_BUTTONS or id > 11 and NUM_SHAPESHIFT_SLOTS or NUM_PET_ACTION_SLOTS)
|
||||||
end
|
end
|
||||||
|
local uneven_options = function()
|
||||||
|
local formfactor = tostring(C.bars["bar"..id].formfactor or "")
|
||||||
|
local _, _, cols, rows = string.find(formfactor, "(%d+)%s*x%s*(%d+)")
|
||||||
|
cols, rows = tonumber(cols), tonumber(rows)
|
||||||
|
|
||||||
|
if cols == 3 and rows == 3 then
|
||||||
|
return { "Up", "Down", "Left", "Right" }
|
||||||
|
elseif cols and cols <= 3 then
|
||||||
|
return { "Up", "Down" }
|
||||||
|
elseif rows and rows <= 3 then
|
||||||
|
return { "Left", "Right" }
|
||||||
|
end
|
||||||
|
|
||||||
|
return { "Up", "Down", "Left", "Right" }
|
||||||
|
end
|
||||||
|
|
||||||
CreateGUIEntry(T["Actionbar"], caption, function()
|
CreateGUIEntry(T["Actionbar"], caption, function()
|
||||||
CreateConfig(U["bars"], T["Enable"], C.bars["bar"..id], "enable", "checkbox")
|
CreateConfig(U["bars"], T["Enable"], C.bars["bar"..id], "enable", "checkbox")
|
||||||
@@ -2626,7 +2641,27 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
|
|||||||
|
|
||||||
CreateConfig(U["bars"], T["Icon Size"], C.bars["bar"..id], "icon_size")
|
CreateConfig(U["bars"], T["Icon Size"], C.bars["bar"..id], "icon_size")
|
||||||
CreateConfig(U["bars"], T["Spacing"], C.bars["bar"..id], "spacing", "dropdown", pfUI.gui.dropdowns.actionbarbuttons)
|
CreateConfig(U["bars"], T["Spacing"], C.bars["bar"..id], "spacing", "dropdown", pfUI.gui.dropdowns.actionbarbuttons)
|
||||||
CreateConfig(U["bars"], T["Layout"], C.bars["bar"..id], "formfactor", "dropdown", formfactors)
|
local uneven_frame = nil
|
||||||
|
local layout_ufunc = function()
|
||||||
|
local formfactor = tostring(C.bars["bar"..id].formfactor or "")
|
||||||
|
local _, _, cols, rows = string.find(formfactor, "(%d+)%s*x%s*(%d+)")
|
||||||
|
cols, rows = tonumber(cols), tonumber(rows)
|
||||||
|
local is_square = cols == 3 and rows == 3
|
||||||
|
local is_vertical = cols and cols <= 3 and not is_square
|
||||||
|
local is_horizontal = rows and rows <= 3 and not is_square
|
||||||
|
local uneven = C.bars["bar"..id].uneven
|
||||||
|
if is_vertical then
|
||||||
|
if uneven ~= "Up" and uneven ~= "Down" then C.bars["bar"..id].uneven = "Down" end
|
||||||
|
elseif is_horizontal then
|
||||||
|
if uneven ~= "Left" and uneven ~= "Right" then C.bars["bar"..id].uneven = "Left" end
|
||||||
|
end
|
||||||
|
if uneven_frame and uneven_frame.input and uneven_frame.input.UpdateMenu then
|
||||||
|
uneven_frame.input:UpdateMenu()
|
||||||
|
end
|
||||||
|
if U["bars"] then U["bars"]() end
|
||||||
|
end
|
||||||
|
CreateConfig(layout_ufunc, T["Layout"], C.bars["bar"..id], "formfactor", "dropdown", formfactors)
|
||||||
|
uneven_frame = CreateConfig(U["bars"], T["Layout Uneven Orientation"], C.bars["bar"..id], "uneven", "dropdown", uneven_options)
|
||||||
CreateConfig(U["bars"], T["Bar Background"], C.bars["bar"..id], "background", "checkbox")
|
CreateConfig(U["bars"], T["Bar Background"], C.bars["bar"..id], "background", "checkbox")
|
||||||
CreateConfig(U["bars"], T["Show Hotkey Text"], C.bars["bar"..id], "showkeybind", "checkbox")
|
CreateConfig(U["bars"], T["Show Hotkey Text"], C.bars["bar"..id], "showkeybind", "checkbox")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user