Skip to content

Commit

Permalink
Merge pull request #707 from Elitesparkle/windows-grouping
Browse files Browse the repository at this point in the history
Update Windows Grouping
  • Loading branch information
Tercioo authored May 1, 2024
2 parents 833afd2 + 03a1efe commit 2f0148c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
24 changes: 12 additions & 12 deletions classes/class_instance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ function Details:BaseFrameSnap()
if (instancia_alvo) then
if (instancia_alvo.ativa and instancia_alvo.baseframe) then
if (lado == 1) then --a esquerda
instancia_alvo.baseframe:SetPoint("TOPRIGHT", my_baseframe, "TOPLEFT")
instancia_alvo.baseframe:SetPoint("TOPRIGHT", my_baseframe, "TOPLEFT", -Details.grouping_horizontal_gap, 0)

elseif (lado == 2) then --em baixo
local statusbar_y_mod = 0
Expand All @@ -1423,7 +1423,7 @@ function Details:BaseFrameSnap()
instancia_alvo.baseframe:SetPoint("TOPLEFT", my_baseframe, "BOTTOMLEFT", 0, -34 + statusbar_y_mod)

elseif (lado == 3) then --a direita
instancia_alvo.baseframe:SetPoint("BOTTOMLEFT", my_baseframe, "BOTTOMRIGHT")
instancia_alvo.baseframe:SetPoint("BOTTOMLEFT", my_baseframe, "BOTTOMRIGHT", Details.grouping_horizontal_gap, 0)

elseif (lado == 4) then --em cima
local statusbar_y_mod = 0
Expand Down Expand Up @@ -1466,7 +1466,7 @@ function Details:BaseFrameSnap()
if (instancia_alvo.ativa and instancia_alvo.baseframe) then

if (lado_reverso == 1) then --a esquerda
instancia_alvo.baseframe:SetPoint("BOTTOMLEFT", instancia.baseframe, "BOTTOMRIGHT")
instancia_alvo.baseframe:SetPoint("BOTTOMLEFT", instancia.baseframe, "BOTTOMRIGHT", Details.grouping_horizontal_gap, 0)

elseif (lado_reverso == 2) then --em baixo

Expand All @@ -1478,7 +1478,7 @@ function Details:BaseFrameSnap()
instancia_alvo.baseframe:SetPoint("BOTTOMLEFT", instancia.baseframe, "TOPLEFT", 0, 34 + statusbar_y_mod) -- + (statusbar_y_mod*-1)

elseif (lado_reverso == 3) then --a direita
instancia_alvo.baseframe:SetPoint("TOPRIGHT", instancia.baseframe, "TOPLEFT")
instancia_alvo.baseframe:SetPoint("TOPRIGHT", instancia.baseframe, "TOPLEFT", -Details.grouping_horizontal_gap, 0)

elseif (lado_reverso == 4) then --em cima

Expand All @@ -1505,7 +1505,7 @@ function Details:BaseFrameSnap()

if (instancia_alvo.ativa and instancia_alvo.baseframe) then
if (lado == 1) then --a esquerda
instancia_alvo.baseframe:SetPoint("TOPRIGHT", instancia.baseframe, "TOPLEFT")
instancia_alvo.baseframe:SetPoint("TOPRIGHT", instancia.baseframe, "TOPLEFT", -Details.grouping_horizontal_gap, 0)

elseif (lado == 2) then --em baixo
local statusbar_y_mod = 0
Expand All @@ -1515,7 +1515,7 @@ function Details:BaseFrameSnap()
instancia_alvo.baseframe:SetPoint("TOPLEFT", instancia.baseframe, "BOTTOMLEFT", 0, -34 + statusbar_y_mod)

elseif (lado == 3) then --a direita
instancia_alvo.baseframe:SetPoint("BOTTOMLEFT", instancia.baseframe, "BOTTOMRIGHT")
instancia_alvo.baseframe:SetPoint("BOTTOMLEFT", instancia.baseframe, "BOTTOMRIGHT", Details.grouping_horizontal_gap, 0)

elseif (lado == 4) then --em cima

Expand Down Expand Up @@ -1547,9 +1547,9 @@ function Details:agrupar_janelas(lados)

if (lado == 3) then --direita
--mover frame
instancia.baseframe:SetPoint("TOPRIGHT", esta_instancia.baseframe, "TOPLEFT")
instancia.baseframe:SetPoint("RIGHT", esta_instancia.baseframe, "LEFT")
instancia.baseframe:SetPoint("BOTTOMRIGHT", esta_instancia.baseframe, "BOTTOMLEFT")
instancia.baseframe:SetPoint("TOPRIGHT", esta_instancia.baseframe, "TOPLEFT", -Details.grouping_horizontal_gap, 0)
instancia.baseframe:SetPoint("RIGHT", esta_instancia.baseframe, "LEFT", -Details.grouping_horizontal_gap, 0)
instancia.baseframe:SetPoint("BOTTOMRIGHT", esta_instancia.baseframe, "BOTTOMLEFT", -Details.grouping_horizontal_gap, 0)

local _, height = esta_instancia:GetSize()
instancia:SetSize(nil, height)
Expand Down Expand Up @@ -1580,9 +1580,9 @@ function Details:agrupar_janelas(lados)
elseif (lado == 1) then --esquerda
--mover frame

instancia.baseframe:SetPoint("TOPLEFT", esta_instancia.baseframe, "TOPRIGHT")
instancia.baseframe:SetPoint("LEFT", esta_instancia.baseframe, "RIGHT")
instancia.baseframe:SetPoint("BOTTOMLEFT", esta_instancia.baseframe, "BOTTOMRIGHT")
instancia.baseframe:SetPoint("TOPLEFT", esta_instancia.baseframe, "TOPRIGHT", Details.grouping_horizontal_gap, 0)
instancia.baseframe:SetPoint("LEFT", esta_instancia.baseframe, "RIGHT", Details.grouping_horizontal_gap, 0)
instancia.baseframe:SetPoint("BOTTOMLEFT", esta_instancia.baseframe, "BOTTOMRIGHT", Details.grouping_horizontal_gap, 0)

local _, height = esta_instancia:GetSize()
instancia:SetSize(nil, height)
Expand Down
17 changes: 17 additions & 0 deletions frames/window_options2_sections.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2917,6 +2917,23 @@ do
},
{type = "blank"},

{--grouped windows horizontal gap
type = "range",
get = function() return tonumber(Details.grouping_horizontal_gap) end,
set = function(self, fixedparam, value)
Details.grouping_horizontal_gap = value
currentInstance:BaseFrameSnap()
afterUpdate()
end,
min = 0,
max = 20,
usedecimals = true,
step = 0.5,
name = Loc ["STRING_OPTIONS_GROUPING_HORIZONTAL_GAP"],
desc = Loc ["STRING_OPTIONS_GROUPING_HORIZONTAL_GAP_DESC"],
thumbscale = 2.2,
},

{--disable grouping
type = "toggle",
get = function() return Details.disable_window_groups end,
Expand Down
4 changes: 1 addition & 3 deletions functions/profiles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ local default_profile = {
max_window_size = {width = 480, height = 450},
new_window_size = {width = 310, height = 158},
window_clamp = {-8, 0, 21, -14},
grouping_horizontal_gap = 0,
disable_window_groups = false,
disable_reset_button = false,
disable_lock_ungroup_buttons = false,
Expand Down Expand Up @@ -2145,6 +2146,3 @@ function Details.ShowImportProfileConfirmation(message, callback)
Details.profileConfirmationDialog.button_true.true_function = callback
Details.profileConfirmationDialog.textbox:SetFocus(true)
end



2 changes: 2 additions & 0 deletions locales/Details-enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,8 @@ L["STRING_OPTIONS_DISABLE_ALLDISPLAYSWINDOW"] = "Disable 'All Displays' Menu"
L["STRING_OPTIONS_DISABLE_ALLDISPLAYSWINDOW_DESC"] = "If enabled, right clicking on title bar shows your bookmark instead."
L["STRING_OPTIONS_DISABLE_BARHIGHLIGHT"] = "Disable Bar Highlight"
L["STRING_OPTIONS_DISABLE_BARHIGHLIGHT_DESC"] = "Hovering over a bar won't make it brighter."
L["STRING_OPTIONS_GROUPING_HORIZONTAL_GAP"] = "Grouping Horizontal Gap"
L["STRING_OPTIONS_GROUPING_HORIZONTAL_GAP_DESC"] = "Change the horizontal gap between grouped windows."
L["STRING_OPTIONS_DISABLE_GROUPS"] = "Disable Grouping"
L["STRING_OPTIONS_DISABLE_GROUPS_DESC"] = "Windows won't make groups anymore when placed near each other."
L["STRING_OPTIONS_DISABLE_LOCK_RESIZE"] = "Disable Resize Buttons"
Expand Down

0 comments on commit 2f0148c

Please sign in to comment.