mirror of
https://github.com/asherao/dcs-scratchpad.git
synced 2025-10-29 16:56:22 +00:00
implement font size option
This commit is contained in:
@@ -29,12 +29,19 @@ function scratchpad_load()
|
|||||||
if (tbl and tbl.config) then
|
if (tbl and tbl.config) then
|
||||||
scratchpad.log("Configuration exists...")
|
scratchpad.log("Configuration exists...")
|
||||||
scratchpad.config = tbl.config
|
scratchpad.config = tbl.config
|
||||||
|
|
||||||
|
-- config migration
|
||||||
|
if scratchpad.config.fontSize == nil then
|
||||||
|
scratchpad.config.fontSize = 14
|
||||||
|
scratchpad.saveConfiguration()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
scratchpad.log("Configuration not found, creating defaults...")
|
scratchpad.log("Configuration not found, creating defaults...")
|
||||||
scratchpad.config = {
|
scratchpad.config = {
|
||||||
hotkey = "Ctrl+Shift+x",
|
hotkey = "Ctrl+Shift+x",
|
||||||
windowPosition = { x = 200, y = 200 },
|
windowPosition = { x = 200, y = 200 },
|
||||||
windowSize = { w = 350, h = 150 },
|
windowSize = { w = 350, h = 150 },
|
||||||
|
fontSize = 14,
|
||||||
content = "Start writing here ...",
|
content = "Start writing here ...",
|
||||||
}
|
}
|
||||||
scratchpad.saveConfiguration()
|
scratchpad.saveConfiguration()
|
||||||
@@ -79,7 +86,13 @@ function scratchpad_load()
|
|||||||
panel = window.Box
|
panel = window.Box
|
||||||
textarea = panel.ScratchpadEditBox
|
textarea = panel.ScratchpadEditBox
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- setup textarea
|
-- setup textarea
|
||||||
|
local skin = textarea:getSkin()
|
||||||
|
skin.skinData.states.released[1].text.fontSize = scratchpad.config.fontSize
|
||||||
|
textarea:setSkin(skin)
|
||||||
|
|
||||||
textarea:setText(scratchpad.config.content)
|
textarea:setText(scratchpad.config.content)
|
||||||
textarea:addChangeCallback(function(self)
|
textarea:addChangeCallback(function(self)
|
||||||
scratchpad.config.content = self:getText()
|
scratchpad.config.content = self:getText()
|
||||||
|
|||||||
Reference in New Issue
Block a user