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) 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 ) -- Apply correct texture for wow version CzechQuestsAddon:SetTextureFromSettings(frame) 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 -- setup default frame.texture:SetTexture("Interface/QUESTFRAME/QuestBG"); frame.texture:SetTexCoord(0, .58, 0.005, 0.66) frame.primaryHeader:SetTextColor(0, 0, 0, 1) frame.secondaryHeader:SetTextColor(0, 0, 0, 1) frame.primaryText:SetTextColor(0, 0, 0, 1) frame.secondaryText:SetTextColor(0, 0, 0, 1) 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 -- setup default frame.texture:SetTexture("Interface/QUESTFRAME/QuestBackgroundParchment"); frame.texture:SetTexCoord(0, .01, 0, 0.4) frame.primaryHeader:SetTextColor(0, 0, 0, 1) frame.secondaryHeader:SetTextColor(0, 0, 0, 1) frame.primaryText:SetTextColor(0, 0, 0, 1) frame.secondaryText:SetTextColor(0, 0, 0, 1) -- Read CVar from settings to setup same parchment as Quest frame if C_CVar.GetCVar("questTextContrast") == "1" then -- Brown frame.texture:SetTexCoord(0, .01, .4, .8) elseif C_CVar.GetCVar("questTextContrast") == "2" or C_CVar.GetCVar("questTextContrast") == "3" then -- Gray frame.texture:SetColorTexture(255, 255, 255, 1) elseif C_CVar.GetCVar("questTextContrast") == "4" then -- Black 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 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 ) CzechQuestsAddon.translationFrame.texture:SetAlpha( CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXTURE_ALPHA / 100 ) end