110 lines
No EOL
4.7 KiB
Lua
Executable file
110 lines
No EOL
4.7 KiB
Lua
Executable file
function CzechQuestsAddon:CreateTranslationFrame()
|
|
local frame = {};
|
|
|
|
-- Main Translation Frame
|
|
frame = CreateFrame("Frame", "CzechQuestTranslationFrame", nil, BackdropTemplateMixin and "BackdropTemplate")
|
|
frame:SetWidth(300)
|
|
frame:SetBackdrop({ edgeFile = "Interface/Tooltips/UI-Tooltip-Border", edgeSize = 8 })
|
|
frame:Hide()
|
|
|
|
-- Background Parchment texture
|
|
frame.texture = frame:CreateTexture(nil, "BACKGROUND", nil, -1);
|
|
frame.texture:SetAllPoints(true);
|
|
frame.texture:SetHorizTile(true)
|
|
|
|
-- Apply correct texture for wow version
|
|
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
|
|
frame.texture:SetTexture("Interface/QUESTFRAME/QuestBG");
|
|
frame.texture:SetTexCoord(0, .58, 0.005, 0.66)
|
|
else
|
|
frame.texture:SetTexture("Interface/QUESTFRAME/QuestBackgroundParchment");
|
|
CzechQuestsAddon:SetTextureFromSettings(frame)
|
|
end
|
|
|
|
frame.primaryHeader = CzechQuestsAddon:CreateTranslationFont(
|
|
frame,
|
|
"CzechQuestTranslationPrimaryHeader",
|
|
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY,
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE
|
|
)
|
|
frame.secondaryHeader = CzechQuestsAddon:CreateTranslationFont(
|
|
frame,
|
|
"CzechQuestTranslationSecondaryHeader",
|
|
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY,
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE
|
|
)
|
|
frame.primaryText = CzechQuestsAddon:CreateTranslationFont(
|
|
frame,
|
|
"CzechQuestTranslationPrimaryText",
|
|
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY,
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE
|
|
)
|
|
frame.secondaryText = CzechQuestsAddon:CreateTranslationFont(
|
|
frame,
|
|
"CzechQuestTranslationSecondaryText",
|
|
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY,
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE
|
|
)
|
|
|
|
return frame;
|
|
end
|
|
|
|
function CzechQuestsAddon:CreateTranslationFont(frame, name, font, size)
|
|
local label = frame:CreateFontString(name, "OVERLAY")
|
|
label:SetWidth(frame:GetWidth() - 20)
|
|
label:SetJustifyH("LEFT")
|
|
label:SetTextColor(0, 0, 0, 1)
|
|
label:SetFont(font, size, nil)
|
|
return label;
|
|
end
|
|
|
|
function CzechQuestsAddon:ResetTranslationText(frame)
|
|
frame.primaryHeader:SetText("")
|
|
frame.secondaryHeader:SetText("")
|
|
frame.primaryText:SetText("")
|
|
frame.secondaryText:SetText("")
|
|
end
|
|
|
|
function CzechQuestsAddon:SetTextureFromSettings(frame)
|
|
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
|
|
if CzechQuestsAddon_Store.config.DARK_MODE then
|
|
frame:SetBackdropColor(0, 0, 0, 1)
|
|
frame.texture:SetColorTexture(0, 0, 0, 1)
|
|
frame.primaryHeader:SetTextColor(255, 255, 255, 1)
|
|
frame.secondaryHeader:SetTextColor(255, 255, 255, 1)
|
|
frame.primaryText:SetTextColor(255, 255, 255, 1)
|
|
frame.secondaryText:SetTextColor(255, 255, 255, 1)
|
|
end
|
|
else
|
|
-- TODO add DARK MODE support for retail
|
|
-- Read CVar from settings to setup same parchment as Quest frame
|
|
if C_CVar.GetCVar("questTextContrast") == "0" then
|
|
frame.texture:SetTexCoord(0, .01, 0, 0.4) -- Parchment (brown)
|
|
else
|
|
frame.texture:SetTexCoord(0, .01, .4, .8) -- Parchment (white)
|
|
end
|
|
end
|
|
end
|
|
|
|
function CzechQuestsAddon:UpdateTranslationFrameFontSettings()
|
|
CzechQuestsAddon.translationFrame.primaryHeader:SetFont(
|
|
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY,
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE,
|
|
nil
|
|
)
|
|
CzechQuestsAddon.translationFrame.secondaryHeader:SetFont(
|
|
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY,
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE,
|
|
nil
|
|
)
|
|
CzechQuestsAddon.translationFrame.primaryText:SetFont(
|
|
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY,
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE,
|
|
nil
|
|
)
|
|
CzechQuestsAddon.translationFrame.secondaryText:SetFont(
|
|
CzechQuestsAddon.fontPath .. CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY,
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE,
|
|
nil
|
|
)
|
|
end |