Skip to content

Commit

Permalink
Added option to hide MicroMenu and BagButtons
Browse files Browse the repository at this point in the history
  • Loading branch information
muleyo committed Jul 2, 2024
1 parent 1bd56ee commit 1c14092
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 50 deletions.
64 changes: 38 additions & 26 deletions Config/_Gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -736,77 +736,89 @@ function Gui:OnEnable()
size = {
key = 'buttons.size',
type = 'slider',
label = 'Size',
label = 'Button Size',
max = 50,
column = 4,
order = 1
},
padding = {
key = 'buttons.padding',
type = 'slider',
label = 'Padding',
label = 'Button Padding',
min = 1,
max = 5,
column = 4,
order = 2
}
},
{
micromenu = {
key = 'micromenu',
type = 'dropdown',
label = 'MicroMenu',
options = {
{ value = 'always', text = 'Show always' },
{ value = 'mouseover', text = 'Show on Mouseover' },
{ value = 'hidden', text = 'Hide always' }
},
initialValue = 1,
column = 5,
order = 1
},
bagbuttons = {
key = 'bagbuttons',
type = 'dropdown',
label = 'Bag Buttons',
options = {
{ value = 'always', text = 'Show always' },
{ value = 'mouseover', text = 'Show on Mouseover' },
{ value = 'hidden', text = 'Hide always' }
},
initialValue = 1,
column = 5,
order = 2
}
},
{
header = {
type = 'header',
label = 'Mouseover'
},
},
{
mouseoverMicro = {
key = 'menu.mouseovermicro',
type = 'checkbox',
label = 'MicroMenu',
tooltip = 'Show MicroMenu on mouseover',
column = 4,
order = 1
},
mouseoverBagButtons = {
key = 'menu.mouseoverbags',
type = 'checkbox',
label = 'BagButtons',
tooltip = 'Show Bag Buttons on mouseover',
column = 4,
order = 2
},
actionBar3 = {
key = 'mouseover.bar3',
type = 'checkbox',
label = 'ActionBar 3',
tooltip = 'Show ActionBar 3 on mouseover',
column = 4,
order = 3
}
},
{
order = 1
},
actionBar4 = {
key = 'mouseover.bar4',
type = 'checkbox',
label = 'ActionBar 4',
tooltip = 'Show ActionBar 4 on mouseover',
column = 4,
order = 1
order = 2
},
actionBar5 = {
key = 'mouseover.bar5',
type = 'checkbox',
label = 'ActionBar 5',
tooltip = 'Show ActionBar 5 on mouseover',
column = 4,
order = 2
},
order = 3
}
},
{
stanceBar = {
key = 'mouseover.stancebar',
type = 'checkbox',
label = 'Stance Bar',
tooltip = 'Show Stance Bar on mouseover',
column = 4,
order = 3
order = 1
}
}
},
Expand Down
7 changes: 2 additions & 5 deletions Core/Init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,8 @@ local defaults = {
size = 38,
padding = 5
},
menu = {
style = 'Default',
mouseovermicro = false,
mouseoverbags = false,
},
micromenu = 'mouseover',
bagbuttons = 'mouseover',
mouseover = {
bar3 = false,
bar4 = false,
Expand Down
49 changes: 30 additions & 19 deletions Modules/ActionBars/_Menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ local Module = SUI:NewModule("ActionBars.Menu");
function Module:OnEnable()
local db = {
style = SUI.db.profile.actionbar.style,
mouseovermicro = SUI.db.profile.actionbar.menu.mouseovermicro,
mouseoverbags = SUI.db.profile.actionbar.menu.mouseoverbags,
micromenu = SUI.db.profile.actionbar.micromenu,
bagbuttons = SUI.db.profile.actionbar.bagbuttons,
module = SUI.db.profile.modules.actionbar
}

if ((db.style == 'Small' or db.style == 'BFA' or db.style == 'BFATransparent') and (db.module)) then
if ((db.style == 'Small' or db.style == 'BFA' or db.style == 'BFATransparent') and db.module) then
-- Bag Buttons Table
local BagButtons = {
MainMenuBarBackpackButton,
Expand Down Expand Up @@ -68,30 +68,32 @@ function Module:OnEnable()
end

-- MicroMenu Position
MoveMicroButtons("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -275, 0)
if (db.micromenu ~= 'hidden') then
MoveMicroButtons("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -275, 0)

local vehicle = CreateFrame("Frame")
vehicle:RegisterEvent("UNIT_ENTERED_VEHICLE")
vehicle:RegisterEvent("UNIT_EXITED_VEHICLE")
vehicle:HookScript("OnEvent", function(self, event, unit)
if unit == "player" then
if event == "UNIT_EXITED_VEHICLE" then
MoveMicroButtons("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -275, 0)
if (GetNumShapeshiftForms() > 0) then
SUIStanceBar:Show()
local vehicle = CreateFrame("Frame")
vehicle:RegisterEvent("UNIT_ENTERED_VEHICLE")
vehicle:RegisterEvent("UNIT_EXITED_VEHICLE")
vehicle:HookScript("OnEvent", function(self, event, unit)
if unit == "player" then
if event == "UNIT_EXITED_VEHICLE" then
MoveMicroButtons("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -275, 0)
if (GetNumShapeshiftForms() > 0) then
SUIStanceBar:Show()
end
else
SUIStanceBar:Hide()
end
else
SUIStanceBar:Hide()
end
end
end)
end)
end

-- Bag Buttons Position
MainMenuBarBackpackButton:ClearAllPoints()
MainMenuBarBackpackButton:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -2.5, 40)

-- MicroMenu Mouseover
if (db.mouseovermicro) then
if (db.micromenu == 'mouseover') then
for _, frame in ipairs(MICRO_BUTTONS) do
frame = _G[frame]
hooksecurefunc(frame, "SetAlpha", setFrameAlpha)
Expand All @@ -103,10 +105,14 @@ function Module:OnEnable()
end)
frame:SetAlpha(0)
end
elseif (db.micromenu == 'hidden') then
for _, frame in ipairs(MICRO_BUTTONS) do
_G[frame]:Hide()
end
end

-- Bag Buttons Mouseover
if (db.mouseoverbags) then
if (db.bagbuttons == 'mouseover') then
-- Bags bar
for frame, _ in pairs(BagButtons) do
frame = BagButtons[frame]
Expand All @@ -120,6 +126,11 @@ function Module:OnEnable()
end)
frame:SetAlpha(0)
end
elseif (db.bagbuttons == 'hidden') then
for frame, _ in pairs(BagButtons) do
frame = BagButtons[frame]
frame:Hide()
end
end
end
end

0 comments on commit 1c14092

Please sign in to comment.