2024-08-19 13:08:40 +02:00
|
|
|
local function CreateCheckbox(parent, frame, text, optionKey)
|
|
|
|
local checkbox = CreateFrame("CheckButton", nil, frame, "InterfaceOptionsCheckButtonTemplate")
|
2024-07-07 19:26:28 +02:00
|
|
|
checkbox.Text:SetText(text)
|
2024-08-19 13:08:40 +02:00
|
|
|
checkbox:SetScript("OnClick", function(self)
|
2024-08-25 11:50:46 +02:00
|
|
|
CzechQuestsAddon_Store.config[optionKey] = self:GetChecked()
|
2024-07-07 19:26:28 +02:00
|
|
|
end)
|
|
|
|
checkbox:SetPoint("TOPLEFT", parent, "BOTTOMLEFT", 0, -8)
|
2024-08-25 11:50:46 +02:00
|
|
|
checkbox:SetChecked(CzechQuestsAddon_Store.config[optionKey])
|
2024-07-07 19:26:28 +02:00
|
|
|
return checkbox
|
|
|
|
end
|
|
|
|
|
2024-08-19 13:08:40 +02:00
|
|
|
function CzechQuestsAddon:InitializeOptions()
|
|
|
|
CzechQuestsAddon.optionsFrame = {};
|
2024-07-07 19:26:28 +02:00
|
|
|
|
2024-08-19 13:08:40 +02:00
|
|
|
if (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) then
|
|
|
|
local frame
|
|
|
|
-- Create Frame
|
|
|
|
CzechQuestsAddon.optionsFrame = CreateFrame("Frame", "CzechQuestsOptionsPanel", UIParent)
|
|
|
|
CzechQuestsAddon.optionsFrame.name = "CzechQuests"
|
2024-07-07 19:26:28 +02:00
|
|
|
|
2024-08-19 13:08:40 +02:00
|
|
|
-- Create frame title
|
|
|
|
local title = CzechQuestsAddon.optionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
|
|
title:SetPoint("TOPLEFT", 16, -16)
|
|
|
|
title:SetText("CzechQuests")
|
2024-07-07 19:26:28 +02:00
|
|
|
|
2024-08-19 13:08:40 +02:00
|
|
|
-- Add DEBUG checkbox
|
|
|
|
local debugModeCheckbox = CreateCheckbox(title, CzechQuestsAddon.optionsFrame, "Enable DEBUG mode", "DEBUG_MODE")
|
|
|
|
debugModeCheckbox:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 16, -16)
|
2024-08-13 22:24:45 +02:00
|
|
|
|
2024-08-19 13:08:40 +02:00
|
|
|
-- Add Dark Mode checkbox
|
|
|
|
local darkModeCheckbox = CreateCheckbox(debugModeCheckbox, CzechQuestsAddon.optionsFrame, "Dark mode (require reload)", "DARK_MODE")
|
|
|
|
darkModeCheckbox:SetPoint("TOPLEFT", debugModeCheckbox, "BOTTOMLEFT", 0, -4)
|
|
|
|
|
|
|
|
-- Store it into Addon options
|
|
|
|
InterfaceOptions_AddCategory(CzechQuestsAddon.optionsFrame)
|
|
|
|
|
|
|
|
else
|
|
|
|
CzechQuestsAddon.optionsFrame = Settings.RegisterVerticalLayoutCategory("CzechQuests")
|
|
|
|
|
|
|
|
-- Add DEBUG checkbox
|
|
|
|
local debugCheckbox = Settings.RegisterAddOnSetting(
|
|
|
|
CzechQuestsAddon.optionsFrame,
|
|
|
|
"CzechQuestsAddon__DEBUG_MODE",
|
|
|
|
"DEBUG_MODE",
|
2024-08-25 11:50:46 +02:00
|
|
|
CzechQuestsAddon_Store.config,
|
|
|
|
type(CzechQuestsAddon_Store.config.DEBUG_MODE),
|
2024-08-19 13:08:40 +02:00
|
|
|
"Enable DEBUG mode",
|
2024-08-25 11:50:46 +02:00
|
|
|
CzechQuestsAddon_Store.config.DEBUG_MODE
|
2024-08-19 13:08:40 +02:00
|
|
|
)
|
|
|
|
Settings.CreateCheckbox(CzechQuestsAddon.optionsFrame, debugCheckbox)
|
|
|
|
|
|
|
|
-- Add DARK mode checkbox
|
|
|
|
local darkModeCheckbox = Settings.RegisterAddOnSetting(
|
|
|
|
CzechQuestsAddon.optionsFrame,
|
|
|
|
"CzechQuestsAddon__DARK_MODE",
|
|
|
|
"DARK_MODE",
|
2024-08-25 11:50:46 +02:00
|
|
|
CzechQuestsAddon_Store.config,
|
|
|
|
type(CzechQuestsAddon_Store.config.DARK_MODE),
|
2024-08-19 13:08:40 +02:00
|
|
|
"Use dark mode",
|
2024-08-25 11:50:46 +02:00
|
|
|
CzechQuestsAddon_Store.config.DARK_MODE
|
2024-08-19 13:08:40 +02:00
|
|
|
)
|
|
|
|
Settings.CreateCheckbox(CzechQuestsAddon.optionsFrame, darkModeCheckbox)
|
2024-07-07 19:26:28 +02:00
|
|
|
|
2024-08-25 11:50:46 +02:00
|
|
|
-- define FontOptions
|
|
|
|
local function GetFontOptions()
|
|
|
|
local container = Settings.CreateControlTextContainer()
|
|
|
|
container:Add("morpheus_cz.ttf", "Morpheus (cz)")
|
|
|
|
container:Add("frizquadratatt_cz.ttf", "Friz Quadrata TT (cz)")
|
|
|
|
container:Add("quicksand.ttf", "Quicksand")
|
|
|
|
container:Add("caveat.ttf", "Caveat")
|
|
|
|
return container:GetData()
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Add header font dropdown menu
|
|
|
|
local headerFontFamilyDropdown = Settings.RegisterProxySetting(
|
|
|
|
CzechQuestsAddon.optionsFrame,
|
|
|
|
"CzechQuestsAddon__TRANSLATION_FRAME_HEADER_FONT_FAMILY",
|
|
|
|
type(CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY),
|
|
|
|
"Header font",
|
|
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY,
|
|
|
|
function()
|
|
|
|
return CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY
|
|
|
|
end,
|
|
|
|
function(value)
|
|
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_HEADER_FONT_FAMILY = value
|
|
|
|
CzechQuestsAddon:UpdateTranslationFrameFontSettings()
|
|
|
|
end
|
|
|
|
)
|
|
|
|
Settings.CreateDropdown(CzechQuestsAddon.optionsFrame, headerFontFamilyDropdown, GetFontOptions)
|
|
|
|
|
|
|
|
-- Add text font dropdown menu
|
|
|
|
local textFontFamilyDropdown = Settings.RegisterProxySetting(
|
|
|
|
CzechQuestsAddon.optionsFrame,
|
|
|
|
"CzechQuestsAddon__TRANSLATION_FRAME_TEXT_FONT_FAMILY",
|
|
|
|
type(CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY),
|
|
|
|
"Text font",
|
|
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY,
|
|
|
|
function()
|
|
|
|
return CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY
|
|
|
|
end,
|
|
|
|
function(value)
|
|
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_FAMILY = value
|
|
|
|
CzechQuestsAddon:UpdateTranslationFrameFontSettings()
|
|
|
|
end
|
|
|
|
)
|
|
|
|
Settings.CreateDropdown(CzechQuestsAddon.optionsFrame, textFontFamilyDropdown, GetFontOptions)
|
|
|
|
|
|
|
|
-- Add slider for change primary header font size
|
|
|
|
local primaryHeaderFontSizeSlider = Settings.RegisterProxySetting(
|
|
|
|
CzechQuestsAddon.optionsFrame,
|
|
|
|
"CzechQuestsAddon__TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE",
|
|
|
|
type(CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE),
|
|
|
|
"Quest title size",
|
|
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE,
|
|
|
|
function()
|
|
|
|
return CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE
|
|
|
|
end,
|
|
|
|
function(value)
|
|
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_PRIMARY_HEADER_FONT_SIZE = value
|
|
|
|
CzechQuestsAddon:UpdateTranslationFrameFontSettings()
|
|
|
|
end
|
|
|
|
)
|
|
|
|
local primaryHeaderFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1)
|
|
|
|
primaryHeaderFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
|
|
|
|
Settings.CreateSlider(CzechQuestsAddon.optionsFrame, primaryHeaderFontSizeSlider, primaryHeaderFontSizeSliderOptions)
|
|
|
|
|
|
|
|
-- Add slider for change secondary header font size
|
|
|
|
local secondaryHeaderFontSizeSlider = Settings.RegisterProxySetting(
|
|
|
|
CzechQuestsAddon.optionsFrame,
|
|
|
|
"CzechQuestsAddon__TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE",
|
|
|
|
type(CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE),
|
|
|
|
"Secondary title size",
|
|
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE,
|
|
|
|
function()
|
|
|
|
return CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE
|
|
|
|
end,
|
|
|
|
function(value)
|
|
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_SECONDARY_HEADER_FONT_SIZE = value
|
|
|
|
CzechQuestsAddon:UpdateTranslationFrameFontSettings()
|
|
|
|
end
|
|
|
|
)
|
|
|
|
local secondaryHeaderFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1)
|
|
|
|
secondaryHeaderFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
|
|
|
|
Settings.CreateSlider(CzechQuestsAddon.optionsFrame, secondaryHeaderFontSizeSlider, secondaryHeaderFontSizeSliderOptions)
|
|
|
|
|
|
|
|
|
|
|
|
-- Add slider for change secondary header font size
|
|
|
|
local textFontSizeSlider = Settings.RegisterProxySetting(
|
|
|
|
CzechQuestsAddon.optionsFrame,
|
|
|
|
"CzechQuestsAddon__TRANSLATION_FRAME_TEXT_FONT_SIZE",
|
|
|
|
type(CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE),
|
|
|
|
"Text size",
|
|
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE,
|
|
|
|
function()
|
|
|
|
return CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE
|
|
|
|
end,
|
|
|
|
function(value)
|
|
|
|
local currentFont, _, currentFlags = {}
|
|
|
|
currentFont, _, currentFlags = CzechQuestsAddon.translationFrame.primaryText:GetFont()
|
|
|
|
CzechQuestsAddon.translationFrame.primaryText:SetFont(currentFont, value, currentFlags)
|
|
|
|
currentFont, _, currentFlags = CzechQuestsAddon.translationFrame.secondaryText:GetFont()
|
|
|
|
CzechQuestsAddon.translationFrame.secondaryText:SetFont(currentFont, value, currentFlags)
|
|
|
|
CzechQuestsAddon_Store.config.TRANSLATION_FRAME_TEXT_FONT_SIZE = value
|
|
|
|
end
|
|
|
|
)
|
|
|
|
local textFontSizeSliderOptions = Settings.CreateSliderOptions(10, 30, 1)
|
|
|
|
textFontSizeSliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
|
|
|
|
Settings.CreateSlider(CzechQuestsAddon.optionsFrame, textFontSizeSlider, textFontSizeSliderOptions)
|
|
|
|
|
2024-08-19 13:08:40 +02:00
|
|
|
-- Store it into Addon options
|
|
|
|
Settings.RegisterAddOnCategory(CzechQuestsAddon.optionsFrame)
|
2024-07-07 19:26:28 +02:00
|
|
|
end
|
|
|
|
end
|