diff --git a/BuildTime.txt b/BuildTime.txt index 1416272..1198a6f 100644 --- a/BuildTime.txt +++ b/BuildTime.txt @@ -1 +1 @@ -2026-03-02 21:39:15 \ No newline at end of file +2026-03-03 21:19:17 \ No newline at end of file diff --git a/GitCommit.txt b/GitCommit.txt index f6723d1..b3399a8 100644 --- a/GitCommit.txt +++ b/GitCommit.txt @@ -1 +1 @@ -5c952e7 \ No newline at end of file +29a68b4 \ No newline at end of file diff --git a/Gui/Apps/CodeStudio/Ide.cs b/Gui/Apps/CodeStudio/Ide.cs index 84d9f07..40954f7 100644 --- a/Gui/Apps/CodeStudio/Ide.cs +++ b/Gui/Apps/CodeStudio/Ide.cs @@ -1,4 +1,4 @@ -using CMLeonOS; +using CMLeonOS; using CMLeonOS.Gui.UILib; using Cosmos.System.Graphics; using System.Drawing; diff --git a/Gui/Apps/CodeStudio/LuaSyntaxHighlighter.cs b/Gui/Apps/CodeStudio/LuaSyntaxHighlighter.cs index 4375c35..e5b843d 100644 --- a/Gui/Apps/CodeStudio/LuaSyntaxHighlighter.cs +++ b/Gui/Apps/CodeStudio/LuaSyntaxHighlighter.cs @@ -7,12 +7,22 @@ namespace CMLeonOS.Gui.Apps.CodeStudio { private static readonly List Keywords = new List { - "and", "break", "do", "else", "elseif", "end", "false", "for", "function", "if", "in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while" + "and", "break", "do", "else", "elseif", "end", "false", "for", "function", "if", "in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while", + "goto", "self" }; private static readonly List Builtins = new List { - "print", "type", "tostring", "tonumber", "ipairs", "pairs", "table", "string", "math", "io", "os", "coroutine", "debug", "package", "utf8", "bit32" + "print", "type", "tostring", "tonumber", "ipairs", "pairs", "table", "string", "math", "io", "os", "coroutine", "debug", "package", "utf8", "bit32", + "assert", "collectgarbage", "dofile", "error", "getmetatable", "load", "loadfile", "next", "pcall", "rawequal", "rawget", "rawlen", "rawset", "require", "select", "setmetatable", "xpcall", + "byte", "char", "dump", "find", "format", "gmatch", "gsub", "len", "lower", "match", "rep", "reverse", "sub", "upper", + "abs", "acos", "asin", "atan", "atan2", "ceil", "cos", "cosh", "deg", "exp", "floor", "fmod", "frexp", "huge", "ldexp", "log", "log10", "max", "min", "modf", "pi", "pow", "rad", "random", "randomseed", "sin", "sinh", "sqrt", "tan", "tanh", + "close", "flush", "input", "lines", "open", "output", "popen", "read", "tmpfile", "type", "write", + "clock", "date", "difftime", "execute", "exit", "getenv", "remove", "rename", "setlocale", "time", "tmpname", + "create", "resume", "running", "status", "wrap", "yield", + "concat", "insert", "maxn", "remove", "sort", + "getinfo", "getlocal", "getmetatable", "setmetatable", "setlocal", "traceback", + "loadlib", "seeall", "loaded", "loaders", "path", "cpath", "preload" }; private static readonly List Operators = new List @@ -27,7 +37,7 @@ namespace CMLeonOS.Gui.Apps.CodeStudio internal static Color String = Color.FromArgb(163, 21, 21); internal static Color Number = Color.FromArgb(0, 0, 255); internal static Color Comment = Color.FromArgb(128, 128, 128); - internal static Color Operator = Color.FromArgb(0, 0, 0); + internal static Color Operator = Color.FromArgb(255, 128, 0); internal static Color Default = Color.White; } @@ -63,6 +73,25 @@ namespace CMLeonOS.Gui.Apps.CodeStudio continue; } + if (i + 3 < line.Length && line.Substring(i, 4) == "--[[") + { + int start = i; + i += 4; + + int endPos = line.IndexOf("--]]", i); + if (endPos != -1) + { + i = endPos + 4; + } + else + { + i = line.Length; + } + + tokens.Add(new HighlightedToken(line.Substring(start, i - start), Colors.Comment)); + continue; + } + if (c == '-' && i + 1 < line.Length && line[i + 1] == '-') { int start = i; @@ -98,10 +127,11 @@ namespace CMLeonOS.Gui.Apps.CodeStudio continue; } - if (char.IsDigit(c)) + if (char.IsDigit(c) || (c == '0' && i + 1 < line.Length && (line[i + 1] == 'x' || line[i + 1] == 'X'))) { int start = i; - while (i < line.Length && (char.IsDigit(line[i]) || line[i] == '.')) + i++; + while (i < line.Length && (char.IsDigit(line[i]) || line[i] == '.' || line[i] == 'e' || line[i] == 'E' || line[i] == 'x' || line[i] == 'X' || line[i] == 'a' || line[i] == 'A' || line[i] == 'b' || line[i] == 'B' || line[i] == 'c' || line[i] == 'C' || line[i] == 'd' || line[i] == 'D' || line[i] == 'f' || line[i] == 'F')) { i++; } diff --git a/Gui/Apps/Settings.cs b/Gui/Apps/Settings.cs index ab1e966..831acc5 100644 --- a/Gui/Apps/Settings.cs +++ b/Gui/Apps/Settings.cs @@ -253,7 +253,11 @@ namespace CMLeonOS.Gui.Apps { base.Start(); window = new AppWindow(this, 256, 256, 448, 272); - window.Closing = TryStop; + window.Closing = () => + { + SettingsManager.FlushSettings(); + TryStop(); + }; window.Icon = AppManager.GetAppMetadata("Settings").Icon; wm.AddWindow(window); diff --git a/Gui/ShellComponents/Taskbar.cs b/Gui/ShellComponents/Taskbar.cs index 2986634..01410bb 100644 --- a/Gui/ShellComponents/Taskbar.cs +++ b/Gui/ShellComponents/Taskbar.cs @@ -3,6 +3,7 @@ using Cosmos.System.Graphics; using CMLeonOS; using CMLeonOS.Gui.UILib; using CMLeonOS.UILib.Animations; +using CMLeonOS.Settings; using System; using System.Drawing; @@ -55,13 +56,8 @@ namespace CMLeonOS.Gui.ShellComponents internal void UpdateTime() { - if (settingsService == null) - { - settingsService = ProcessManager.GetProcess(); - } - string timeText; - if (settingsService.TwelveHourClock) + if (SettingsManager.GUI_TwelveHourClock) { timeText = DateTime.Now.ToString("ddd h:mm tt"); } @@ -120,6 +116,8 @@ namespace CMLeonOS.Gui.ShellComponents start.OnClick = StartClicked; wm.AddWindow(start); + SetLeftHandStartButton(SettingsManager.GUI_LeftHandStartButton); + UpdateTime(); MovementAnimation animation = new MovementAnimation(window) diff --git a/Gui/WindowManager.cs b/Gui/WindowManager.cs index 2d156a7..2e3715f 100644 --- a/Gui/WindowManager.cs +++ b/Gui/WindowManager.cs @@ -2,6 +2,7 @@ using Cosmos.System; using Cosmos.System.Graphics; using CMLeonOS; using CMLeonOS.Gui.ShellComponents; +using CMLeonOS.Settings; using System; using System.Collections.Generic; using System.Drawing; @@ -381,7 +382,7 @@ namespace CMLeonOS.Gui RenderWallpaper(); fpsCounter = new Window(this, (int)(ScreenWidth) - 64, (int)(ScreenHeight - 16), 64, 16); - if (settingsService.ShowFps) + if (SettingsManager.GUI_ShowFps) { AddWindow(fpsCounter); } diff --git a/Settings/Settings.cs b/Settings/Settings.cs index 76836e3..70ac3a4 100644 --- a/Settings/Settings.cs +++ b/Settings/Settings.cs @@ -8,6 +8,9 @@ namespace CMLeonOS.Settings { private static string settingsFilePath = @"0:\system\settings.dat"; private static Dictionary settings = new Dictionary(); + private static bool savePending = false; + private static int pendingSaveCount = 0; + private const int MAX_PENDING_SAVES = 5; private static Dictionary defaultSettings = new Dictionary { @@ -226,6 +229,8 @@ namespace CMLeonOS.Settings } SaveSettings(); } + + FlushSettings(); } catch (Exception e) { @@ -235,6 +240,22 @@ namespace CMLeonOS.Settings public static void SaveSettings() { + savePending = true; + pendingSaveCount++; + + if (pendingSaveCount >= MAX_PENDING_SAVES) + { + FlushSettings(); + } + } + + public static void FlushSettings() + { + if (!savePending) + { + return; + } + try { Directory.CreateDirectory(Path.GetDirectoryName(settingsFilePath)); @@ -250,6 +271,9 @@ namespace CMLeonOS.Settings writer.WriteLine($"{setting.Key}={setting.Value}"); } } + + savePending = false; + pendingSaveCount = 0; } catch (Exception e) {