更新配置相关显示等

This commit is contained in:
rucky
2026-03-20 14:04:51 +08:00
parent 923a1f9ce2
commit 63337b14d2
14 changed files with 886 additions and 98 deletions

View File

@@ -6016,6 +6016,68 @@ function SFrames.Chat:StyleEditBox()
self.emoteButton = eb
end
if not self.langButton then
if RDbItems and RDbItems.TriStateToggle then
local lb = CreateFrame("Button", "SFramesChatLangButton", buttonParent)
lb:SetWidth(18)
lb:SetHeight(18)
lb:SetFrameStrata("DIALOG")
lb:SetFrameLevel(btnLevel)
local fs = lb:CreateFontString(nil, "ARTWORK")
fs:SetFont(cfg.fontPath or "Fonts\\ARIALN.TTF", 11, "OUTLINE")
fs:SetAllPoints(lb)
fs:SetJustifyH("CENTER")
fs:SetJustifyV("MIDDLE")
lb.fontString = fs
local function UpdateLangButtonText()
local mode = RDbItemsCfg and RDbItemsCfg.mode
if mode == "en" then
fs:SetText("E")
fs:SetTextColor(0.4, 0.8, 1.0)
elseif mode == "cn" then
fs:SetText("")
fs:SetTextColor(1.0, 0.82, 0.4)
else
fs:SetText("--")
fs:SetTextColor(0.6, 0.6, 0.6)
end
end
lb:SetScript("OnClick", function()
RDbItems.TriStateToggle(this)
UpdateLangButtonText()
end)
lb:SetScript("OnEnter", function()
GameTooltip:SetOwner(this, "ANCHOR_TOP")
local mode = RDbItemsCfg and RDbItemsCfg.mode
if mode == "en" then
GameTooltip:SetText("物品链接语言: 英文")
elseif mode == "cn" then
GameTooltip:SetText("物品链接语言: 中文")
else
GameTooltip:SetText("物品链接语言: 自动")
end
GameTooltip:AddLine("点击切换 Shift+点击物品时的链接语言", 0.7, 0.7, 0.7)
GameTooltip:Show()
end)
lb:SetScript("OnLeave", function() GameTooltip:Hide() end)
lb:EnableMouse(true)
local hl = lb:CreateTexture(nil, "HIGHLIGHT")
hl:SetTexture("Interface\\Buttons\\WHITE8X8")
hl:SetAllPoints(lb)
hl:SetAlpha(0.15)
UpdateLangButtonText()
lb._UpdateText = UpdateLangButtonText
self.langButton = lb
end
elseif self.langButton and self.langButton._UpdateText then
self.langButton._UpdateText()
end
-- Re-parent in case buttons were created by an older version.
self.rollButton:SetParent(self.editBackdrop)
self.emoteButton:SetParent(self.editBackdrop)
@@ -6025,12 +6087,22 @@ function SFrames.Chat:StyleEditBox()
if self.emoteButton.SetFrameLevel then
self.emoteButton:SetFrameLevel((editBox:GetFrameLevel() or 1) + 2)
end
if self.langButton then
self.langButton:SetParent(self.editBackdrop)
if self.langButton.SetFrameLevel then
self.langButton:SetFrameLevel((editBox:GetFrameLevel() or 1) + 2)
end
end
-- Re-anchor buttons every call so they track editBackdrop position
self.rollButton:ClearAllPoints()
self.rollButton:SetPoint("RIGHT", self.editBackdrop, "RIGHT", -4, 0)
self.emoteButton:ClearAllPoints()
self.emoteButton:SetPoint("RIGHT", self.rollButton, "LEFT", -2, 0)
if self.langButton then
self.langButton:ClearAllPoints()
self.langButton:SetPoint("RIGHT", self.emoteButton, "LEFT", -2, 0)
end
local function SaveFreeEditBoxPosition()
if EnsureDB().editBoxPosition ~= "free" then return end
@@ -6073,7 +6145,8 @@ function SFrames.Chat:StyleEditBox()
editBox:SetParent(self.editBackdrop)
editBox:ClearAllPoints()
editBox:SetPoint("TOPLEFT", self.editBackdrop, "TOPLEFT", 4, -3)
editBox:SetPoint("BOTTOMRIGHT", self.editBackdrop, "BOTTOMRIGHT", -45, 3)
local rightPad = self.langButton and -65 or -45
editBox:SetPoint("BOTTOMRIGHT", self.editBackdrop, "BOTTOMRIGHT", rightPad, 3)
editBox:EnableMouse(true)
self.editBackdrop:SetBackdropColor(CFG_THEME.panelBg[1], CFG_THEME.panelBg[2], CFG_THEME.panelBg[3], 0.96)
local borderR, borderG, borderB = self:GetBorderColorRGB()