Commit f9871506 authored by Darth Predator's avatar Darth Predator
Browse files

Try this tabs nonsense

parent 4a19abf3
......@@ -120,6 +120,7 @@ P["sle"] = {
["select"] = false,
["style"] = "DEFAULT",
["color"] = {r = 1, g = 1, b = 1},
["resize"] = false,
},
["invite"] = {
["altInv"] = false,
......
......@@ -324,6 +324,7 @@ L["Link Color"] = true
L["Invite Keywords"] = true
L["Chat Setup Delay"] = true
L["Manages the delay before S&L will execute hooks to ElvUI's chat positioning. Prevents some weird positioning issues."] = true
L["Attempt to resize chat tabs to stop title throttling. This may cause unwanted results with many tabs."] = true
--Databars
L["Full value on Exp Bar"] = true
......
......@@ -315,6 +315,7 @@ L["Link Color"] = "Link Farbe"
L["Invite Keywords"] = "Einladungs-Schlüsselwörter"
L["Chat Setup Delay"] = "Chateinstellung Verzögerung"
L["Manages the delay before S&L will execute hooks to ElvUI's chat positioning. Prevents some weird positioning issues."] = "Legt die Verzögerung fest, wann S&L die Chatposition vonn ElvUI verändert. Beugt ungewollten Positionen vor."
L["Attempt to resize chat tabs to stop title throttling. This may cause unwanted results with many tabs."] = true
--Databars
L["Full value on Exp Bar"] = "Voller Wert auf Erfahrungsleiste"
......
......@@ -308,6 +308,7 @@ L["Link Color"] = true
L["Invite Keywords"] = "키워드 초대"
L["Chat Setup Delay"] = true
L["Manages the delay before S&L will execute hooks to ElvUI's chat positioning. Prevents some weird positioning issues."] = true
L["Attempt to resize chat tabs to stop title throttling. This may cause unwanted results with many tabs."] = true
--Databars
L["Full value on Exp Bar"] = "경험치바 실수치 사용"
......
......@@ -312,6 +312,7 @@ L["Link Color"] = "Цвет ссылки"
L["Invite Keywords"] = "Ключевые слова для приглашения"
L["Chat Setup Delay"] = "Задержка подключения ата"
L["Manages the delay before S&L will execute hooks to ElvUI's chat positioning. Prevents some weird positioning issues."] = "задает задержку до выполнения хуков к функция позиционирования ElvUI. Предотвращает некоторые проблемы расположения окон чата."
L["Attempt to resize chat tabs to stop title throttling. This may cause unwanted results with many tabs."] = "Пытается изменить ширину вкладок, подстраивая под размер заголовка. Может приводить к нежелательных последствиям при большом кол-ве вкладок."
--Databars
L["Full value on Exp Bar"] = "Полное значение опыта"
......
......@@ -25,6 +25,21 @@ local function Style(self, frame)
local name = frame:GetName()
local tab = _G[name..'Tab']
tab.isTemporary = frame.isTemporary
-- Mark current selected tab if renamed
hooksecurefunc(tab, "SetText", function(self)
if self.isDocked and _G["GeneralDockManager"].selected:GetID() == self:GetID() and not self.isTemporary and C.db.tab.select then
C:ApplySelectedTabIndicator(tab, self.text:GetText())
end
end)
-- Prevent text from jumping from left to right when tab is clicked.
hooksecurefunc(tab, "SetWidth", function(self)
self.text:ClearAllPoints()
self.text:SetPoint("CENTER", self, "CENTER", 0, -4)
end)
-- Mark current selected tab when clicked
tab:HookScript("OnClick", function()
C:SetSelectedTab()
end)
......
......@@ -7,6 +7,7 @@ local _G = _G
local FCF_GetChatWindowInfo = FCF_GetChatWindowInfo
local FCF_GetCurrentChatFrameID = FCF_GetCurrentChatFrameID
local PanelTemplates_TabResize = PanelTemplates_TabResize
local GENERAL_CHAT_DOCK = GENERAL_CHAT_DOCK
C.SelectedStrings = {
["DEFAULT"] = "|cff%02x%02x%02x>|r %s |cff%02x%02x%02x<|r",
......@@ -16,6 +17,19 @@ C.SelectedStrings = {
["ARROWRIGHT"] = [[|TInterface\BUTTONS\UI-SpellbookIcon-NextPage-Up:%s|t%s]],
["ARROWDOWN"] = [[|TInterface\BUTTONS\UI-MicroStream-Green:%s|t%s]],
}
function C:ApplySelectedTabIndicator(tab, title)
local color = C.db.tab.color
if C.db.tab.style == "DEFAULT" or C.db.tab.style == "SQUARE" then
tab.text:SetText(T.format(C.SelectedStrings[C.db.tab.style], color.r * 255, color.g * 255, color.b * 255, title, color.r * 255, color.g * 255, color.b * 255))
elseif C.db.tab.style == "HALFDEFAULT" then
tab.text:SetText(T.format(C.SelectedStrings[C.db.tab.style], color.r * 255, color.g * 255, color.b * 255, title))
else
tab.text:SetText(T.format(C.SelectedStrings[C.db.tab.style], (E.db.chat.tabFontSize + 12), title))
end
tab.hasBracket = true
end
function C:SetSelectedTab(isForced)
if C.CreatedFrames == 0 then C:DelaySetSelectedTab() return end
local selectedId = _G["GeneralDockManager"].selected:GetID()
......@@ -26,17 +40,8 @@ function C:SetSelectedTab(isForced)
if tab.isDocked then
--Brackets
if selectedId == tab:GetID() and C.db.tab.select then
if tab.hasBracket ~= true or isForced then
local color = C.db.tab.color
if C.db.tab.style == "DEFAULT" or C.db.tab.style == "SQUARE" then
tab.text:SetText(T.format(C.SelectedStrings[C.db.tab.style], color.r * 255, color.g * 255, color.b * 255, (FCF_GetChatWindowInfo(tab:GetID())), color.r * 255, color.g * 255, color.b * 255))
elseif C.db.tab.style == "HALFDEFAULT" then
tab.text:SetText(T.format(C.SelectedStrings[C.db.tab.style], color.r * 255, color.g * 255, color.b * 255, (FCF_GetChatWindowInfo(tab:GetID()))))
else
tab.text:SetText(T.format(C.SelectedStrings[C.db.tab.style], (E.db.chat.tabFontSize + 12), (FCF_GetChatWindowInfo(tab:GetID()))))
end
tab.hasBracket = true
end
local title = FCF_GetChatWindowInfo(tab:GetID())
if tab.hasBracket ~= true or isForced then C:ApplySelectedTabIndicator(tab, title) end
else
if tab.hasBracket == true then
local tabText = tab.isTemporary and tab.origText or (FCF_GetChatWindowInfo(tab:GetID()))
......@@ -46,7 +51,11 @@ function C:SetSelectedTab(isForced)
end
end
--Prevent chat tabs changing width on each click.
PanelTemplates_TabResize(tab, tab.isTemporary and 20 or 10, nil, nil, nil, tab.textWidth);
-- if C.db.tab.resize then
PanelTemplates_TabResize(tab, tab.isTemporary and 20 or 10, nil, nil, nil, tab.textWidth);
-- else
-- FCFDock_UpdateTabs(GENERAL_CHAT_DOCK, true)
-- end
end
end
......@@ -58,10 +67,14 @@ function C:OpenTemporaryWindow()
end
function C:SetTabWidth()
for chatID = 1, C.CreatedFrames do
local tab = _G[T.format("ChatFrame%sTab", chatID)]
PanelTemplates_TabResize(tab, tab.isTemporary and 20 or 10, nil, nil, nil, tab.textWidth);
end
-- if C.db.tab.resize then
for chatID = 1, C.CreatedFrames do
local tab = _G[T.format("ChatFrame%sTab", chatID)]
PanelTemplates_TabResize(tab, tab.isTemporary and 20 or 10, nil, nil, nil, tab.textWidth);
end
-- else
-- FCFDock_UpdateTabs(GENERAL_CHAT_DOCK, true)
-- end
end
function C:DelaySetSelectedTab()
......@@ -74,5 +87,6 @@ function C:InitTabs()
hooksecurefunc("FCF_OpenNewWindow", C.DelaySetSelectedTab)
hooksecurefunc("FCF_OpenTemporaryWindow", C.OpenTemporaryWindow)
hooksecurefunc("FCF_DockUpdate", C.SetTabWidth)
C:DelaySetSelectedTab()
end
\ No newline at end of file
......@@ -32,9 +32,15 @@ local function configTable()
["ARROWDOWN"] = [[|TInterface\BUTTONS\UI-MicroStream-Green:26|t]]..NAME,
}
},
resize = {
order = 3,
type = "toggle",
name = L["Automatic Width"],
desc = L["Attempt to resize chat tabs to stop title throttling. This may cause unwanted results with many tabs."],
},
color = {
type = 'color',
order = 3,
order = 10,
name = COLOR,
hasAlpha = false,
disabled = function() return not E.db.sle.chat.tab.select or not (E.db.sle.chat.tab.style == "DEFAULT" or E.db.sle.chat.tab.style == "SQUARE" or E.db.sle.chat.tab.style == "HALFDEFAULT") end,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment