mirror of
https://github.com/asherao/dcs-scratchpad.git
synced 2025-10-29 16:56:22 +00:00
code cleanup
This commit is contained in:
parent
5fc89eb71a
commit
cc777d8aff
@ -1,15 +1,13 @@
|
|||||||
function scratchpad_load()
|
function scratchpad_load()
|
||||||
|
|
||||||
package.path = package.path..";.\\LuaSocket\\?.lua;"..'.\\Scripts\\?.lua;'.. '.\\Scripts\\UI\\?.lua;'
|
package.path = package.path..";.\\Scripts\\?.lua;.\\Scripts\\UI\\?.lua;"
|
||||||
package.cpath = package.cpath..";.\\LuaSocket\\?.dll;"
|
|
||||||
|
|
||||||
local JSON = loadfile("Scripts\\JSON.lua")()
|
local lfs = require("lfs")
|
||||||
local lfs = require('lfs')
|
local U = require("me_utilities")
|
||||||
local U = require('me_utilities')
|
local Skin = require("Skin")
|
||||||
local Skin = require('Skin')
|
local DialogLoader = require("DialogLoader")
|
||||||
local DialogLoader = require('DialogLoader')
|
local Tools = require("tools")
|
||||||
local Tools = require('tools')
|
local Input = require("Input")
|
||||||
local Input = require('Input')
|
|
||||||
|
|
||||||
local isHidden = true
|
local isHidden = true
|
||||||
local keyboardLocked = false
|
local keyboardLocked = false
|
||||||
@ -25,7 +23,7 @@ function scratchpad_load()
|
|||||||
|
|
||||||
function scratchpad.loadConfiguration()
|
function scratchpad.loadConfiguration()
|
||||||
scratchpad.log("Loading config file...")
|
scratchpad.log("Loading config file...")
|
||||||
local tbl = Tools.safeDoFile(lfs.writedir() .. 'Config/ScratchpadConfig.lua', false)
|
local tbl = Tools.safeDoFile(lfs.writedir() .. "Config/ScratchpadConfig.lua", false)
|
||||||
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
|
||||||
@ -49,7 +47,7 @@ function scratchpad_load()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function scratchpad.saveConfiguration()
|
function scratchpad.saveConfiguration()
|
||||||
U.saveInFile(scratchpad.config, 'config', lfs.writedir() .. 'Config/ScratchpadConfig.lua')
|
U.saveInFile(scratchpad.config, "config", lfs.writedir() .. "Config/ScratchpadConfig.lua")
|
||||||
end
|
end
|
||||||
|
|
||||||
function scratchpad.log(str)
|
function scratchpad.log(str)
|
||||||
@ -81,13 +79,11 @@ function scratchpad_load()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function scratchpad.createWindow()
|
function scratchpad.createWindow()
|
||||||
window = DialogLoader.spawnDialogFromFile(lfs.writedir() .. 'Scripts\\Scratchpad\\ScratchpadWindow.dlg', cdata)
|
window = DialogLoader.spawnDialogFromFile(lfs.writedir() .. "Scripts\\Scratchpad\\ScratchpadWindow.dlg", cdata)
|
||||||
windowDefaultSkin = window:getSkin()
|
windowDefaultSkin = window:getSkin()
|
||||||
panel = window.Box
|
panel = window.Box
|
||||||
textarea = panel.ScratchpadEditBox
|
textarea = panel.ScratchpadEditBox
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- setup textarea
|
-- setup textarea
|
||||||
local skin = textarea:getSkin()
|
local skin = textarea:getSkin()
|
||||||
skin.skinData.states.released[1].text.fontSize = scratchpad.config.fontSize
|
skin.skinData.states.released[1].text.fontSize = scratchpad.config.fontSize
|
||||||
@ -106,7 +102,7 @@ function scratchpad_load()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
textarea:addKeyDownCallback(function(self, keyName, unicode)
|
textarea:addKeyDownCallback(function(self, keyName, unicode)
|
||||||
if keyName == 'escape' then
|
if keyName == "escape" then
|
||||||
self:setFocused(false)
|
self:setFocused(false)
|
||||||
unlockKeyboardInput(true)
|
unlockKeyboardInput(true)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user