From ce8fe9179d1c3119f91f54b66a8287fd64e480fc Mon Sep 17 00:00:00 2001 From: valentinbreiz Date: Fri, 1 Mar 2024 19:35:39 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Resize=20console=20in=20terminal=20?= =?UTF-8?q?app?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SRC/Aura_OS/Properties/VersionInfo.cs | 2 +- SRC/Aura_OS/System/Graphics/UI/GUI/Application.cs | 8 +++++++- .../System/Graphics/UI/GUI/Components/Console.cs | 5 +++++ .../Processing/Applications/Terminal/TerminalApp.cs | 12 ++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/SRC/Aura_OS/Properties/VersionInfo.cs b/SRC/Aura_OS/Properties/VersionInfo.cs index 9ab826e4..d14dc46f 100644 --- a/SRC/Aura_OS/Properties/VersionInfo.cs +++ b/SRC/Aura_OS/Properties/VersionInfo.cs @@ -2,6 +2,6 @@ namespace Aura_OS { public class VersionInfo { - public static string revision = "010320241920"; + public static string revision = "010320241932"; } } diff --git a/SRC/Aura_OS/System/Graphics/UI/GUI/Application.cs b/SRC/Aura_OS/System/Graphics/UI/GUI/Application.cs index 34457f91..a4bdb2a1 100644 --- a/SRC/Aura_OS/System/Graphics/UI/GUI/Application.cs +++ b/SRC/Aura_OS/System/Graphics/UI/GUI/Application.cs @@ -247,7 +247,7 @@ public override void Update() { _newX = _firstX - currentX; int newWidth = Window.Width + _newX; - Window.Resize(newWidth, Window.Height); + ResizeWindow(newWidth, Window.Height); Window.X = currentX; } @@ -255,6 +255,7 @@ public override void Update() { _newY = _firstY - currentY; int newHeight = Window.Height + _newY; + ResizeWindow(Window.Width, newHeight); Window.Resize(Window.Width, newHeight); Window.Y = currentY; } @@ -300,6 +301,11 @@ public virtual void Draw() } } + public virtual void ResizeWindow(int width, int height) + { + Window.Resize(width, height); + } + public bool IsDirty() { return _isDirty; diff --git a/SRC/Aura_OS/System/Graphics/UI/GUI/Components/Console.cs b/SRC/Aura_OS/System/Graphics/UI/GUI/Components/Console.cs index 8a8d4ee9..36ff0f87 100644 --- a/SRC/Aura_OS/System/Graphics/UI/GUI/Components/Console.cs +++ b/SRC/Aura_OS/System/Graphics/UI/GUI/Components/Console.cs @@ -94,6 +94,11 @@ public Console(int x, int y, int width, int height) : base(x, y, width, height) _pallete[14] = 0xFFFFFF55; // Yellow _pallete[15] = 0xFFFFFFFF; //White + InitConsole(width, height); + } + + public void InitConsole(int width, int height) + { mCols = width / Kernel.font.Width - 1; mRows = height / Kernel.font.Height - 2; diff --git a/SRC/Aura_OS/System/Processing/Applications/Terminal/TerminalApp.cs b/SRC/Aura_OS/System/Processing/Applications/Terminal/TerminalApp.cs index 2c3401c7..63f82f50 100644 --- a/SRC/Aura_OS/System/Processing/Applications/Terminal/TerminalApp.cs +++ b/SRC/Aura_OS/System/Processing/Applications/Terminal/TerminalApp.cs @@ -184,6 +184,18 @@ public override void Draw() Console.DrawInParent(); } + public override void ResizeWindow(int width, int height) + { + base.ResizeWindow(width, height); + + int newWidth = width - 7; + int newHeight = height - Window.TopBar.Height - 9; + + Console.Resize(newWidth, newHeight); + Console.InitConsole(newWidth, newHeight); + BeforeCommand(); + } + public override void MarkDirty() { base.MarkDirty();