Skip to content

Commit

Permalink
✨ Resize console in terminal app
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinbreiz committed Mar 1, 2024
1 parent 653417e commit ce8fe91
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion SRC/Aura_OS/Properties/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ namespace Aura_OS
{
public class VersionInfo
{
public static string revision = "010320241920";
public static string revision = "010320241932";
}
}
8 changes: 7 additions & 1 deletion SRC/Aura_OS/System/Graphics/UI/GUI/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,15 @@ public override void Update()
{
_newX = _firstX - currentX;
int newWidth = Window.Width + _newX;
Window.Resize(newWidth, Window.Height);
ResizeWindow(newWidth, Window.Height);
Window.X = currentX;
}

if (_resizeHeightPressed)
{
_newY = _firstY - currentY;
int newHeight = Window.Height + _newY;
ResizeWindow(Window.Width, newHeight);
Window.Resize(Window.Width, newHeight);
Window.Y = currentY;
}
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions SRC/Aura_OS/System/Graphics/UI/GUI/Components/Console.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
12 changes: 12 additions & 0 deletions SRC/Aura_OS/System/Processing/Applications/Terminal/TerminalApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit ce8fe91

Please sign in to comment.