from retail
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
if not WeakAuras.IsCorrectVersion() or not WeakAuras.IsLibsOK() then return end
|
||||
if not WeakAuras.IsLibsOK() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
-- Lua APIs
|
||||
@@ -55,6 +55,7 @@ local editor_themes = {
|
||||
}
|
||||
|
||||
if not WeakAurasSaved.editor_tab_spaces then WeakAurasSaved.editor_tab_spaces = 4 end
|
||||
if not WeakAurasSaved.editor_font_size then WeakAurasSaved.editor_font_size = 12 end -- set default font size if missing
|
||||
local color_scheme = {[0] = "|r"}
|
||||
local function set_scheme()
|
||||
if not WeakAurasSaved.editor_theme then
|
||||
@@ -162,7 +163,7 @@ local function ConstructTextEditor(frame)
|
||||
editor:DisableButton(true)
|
||||
local fontPath = SharedMedia:Fetch("font", "Fira Mono Medium")
|
||||
if (fontPath) then
|
||||
editor.editBox:SetFont(fontPath, 12)
|
||||
editor.editBox:SetFont(fontPath, WeakAurasSaved.editor_font_size)
|
||||
end
|
||||
group:AddChild(editor)
|
||||
|
||||
@@ -263,6 +264,14 @@ local function ConstructTextEditor(frame)
|
||||
menuList = "spaces"
|
||||
},
|
||||
level)
|
||||
UIDropDownMenu_AddButton(
|
||||
{
|
||||
text = WeakAuras.newFeatureString .. L["Font Size"],
|
||||
hasArrow = true,
|
||||
notCheckable = true,
|
||||
menuList = "sizes"
|
||||
},
|
||||
level)
|
||||
elseif menu == "spaces" then
|
||||
local spaces = {2,4}
|
||||
for _, i in pairs(spaces) do
|
||||
@@ -282,6 +291,23 @@ local function ConstructTextEditor(frame)
|
||||
},
|
||||
level)
|
||||
end
|
||||
elseif menu == "sizes" then
|
||||
local sizes = {10, 12, 14, 16}
|
||||
for _, i in pairs(sizes) do
|
||||
UIDropDownMenu_AddButton(
|
||||
{
|
||||
text = i,
|
||||
isNotRadio = false,
|
||||
checked = function()
|
||||
return WeakAurasSaved.editor_font_size == i
|
||||
end,
|
||||
func = function()
|
||||
WeakAurasSaved.editor_font_size = i
|
||||
editor.editBox:SetFont(fontPath, WeakAurasSaved.editor_font_size)
|
||||
end
|
||||
},
|
||||
level)
|
||||
end
|
||||
end
|
||||
end
|
||||
UIDropDownMenu_Initialize(dropdown, settings_dropdown_initialize, "MENU")
|
||||
@@ -475,16 +501,13 @@ local function ConstructTextEditor(frame)
|
||||
end
|
||||
)
|
||||
|
||||
-- CTRL + S saves and closes, ESC cancels and closes
|
||||
-- CTRL + S saves and closes
|
||||
editor.editBox:HookScript(
|
||||
"OnKeyDown",
|
||||
function(_, key)
|
||||
if IsControlKeyDown() and key == "S" then
|
||||
group:Close()
|
||||
end
|
||||
if key == "ESCAPE" then
|
||||
group:CancelClose()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user