From 907352fb7adb84748b2c5b0efd490776f125fe36 Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Mon, 11 Nov 2024 16:06:21 -0800 Subject: [PATCH 01/51] previewer seems to work pretty well --- Directory.Build.props | 2 +- src/Consolonia.Core/Drawing/RenderTarget.cs | 4 +- .../InputLessDefaultNetConsole.cs | 7 +- .../Consolonia.Gallery.csproj | 3 +- .../GalleryViews/GalleryAnimatedLines.axaml | 3 + .../Gallery/GalleryViews/GalleryButton.axaml | 3 + .../GalleryViews/GalleryCalendar.axaml | 5 +- .../GalleryViews/GalleryCalendarPicker.axaml | 5 +- .../Gallery/GalleryViews/GalleryCanvas.axaml | 3 + .../GalleryViews/GalleryCheckBox.axaml | 3 + .../Gallery/GalleryViews/GalleryColors.axaml | 12 +- .../GalleryViews/GalleryComboBox.axaml | 3 + .../GalleryViews/GalleryDataGrid.axaml | 3 + .../Gallery/GalleryViews/GalleryDialog.axaml | 3 + .../Gallery/GalleryViews/GalleryFlyout.axaml | 3 + .../GalleryViews/GalleryGradientBrush.axaml | 6 +- .../Gallery/GalleryViews/GalleryImage.axaml | 6 +- .../Gallery/GalleryViews/GalleryListBox.axaml | 3 + .../Gallery/GalleryViews/GalleryMenu.axaml | 3 + .../GalleryViews/GalleryProgressBar.axaml | 3 + .../GalleryViews/GalleryRadioButton.axaml | 3 + .../GalleryViews/GalleryScrollViewer.axaml | 3 + .../GalleryViews/GalleryTabControl.axaml | 3 + .../GalleryViews/GalleryTextBlock.axaml | 3 + .../Gallery/GalleryViews/GalleryTextBox.axaml | 3 + .../Gallery/GalleryViews/GalleryWelcome.axaml | 3 + .../GalleryViews/SomeDialogWindow.axaml | 3 + .../View/ControlsListView.axaml | 3 + src/Consolonia.Previewer/App.axaml | 8 + src/Consolonia.Previewer/App.axaml.cs | 188 ++++++++++++++++++ .../Consolonia.Previewer.csproj | 24 +++ src/Consolonia.Previewer/Program.cs | 35 ++++ .../Properties/launchSettings.json | 8 + src/Consolonia.sln | 6 + 34 files changed, 353 insertions(+), 23 deletions(-) create mode 100644 src/Consolonia.Previewer/App.axaml create mode 100644 src/Consolonia.Previewer/App.axaml.cs create mode 100644 src/Consolonia.Previewer/Consolonia.Previewer.csproj create mode 100644 src/Consolonia.Previewer/Program.cs create mode 100644 src/Consolonia.Previewer/Properties/launchSettings.json diff --git a/Directory.Build.props b/Directory.Build.props index 31a7bf2b..23802a0a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,7 +5,7 @@ disable - 11.0.9 + 11.2.0 https://github.com/jinek/Consolonia/graphs/contributors Text User Interface implementation of Avalonia UI (GUI Framework) Copyright © Evgeny Gorbovoy 2021 - 2022 diff --git a/src/Consolonia.Core/Drawing/RenderTarget.cs b/src/Consolonia.Core/Drawing/RenderTarget.cs index 680eab71..440ef2cd 100644 --- a/src/Consolonia.Core/Drawing/RenderTarget.cs +++ b/src/Consolonia.Core/Drawing/RenderTarget.cs @@ -139,7 +139,7 @@ private void RenderToDevice() flushingBuffer.WritePixel(new PixelBufferCoordinate(x, y), pixel); - x += pixel.Foreground.Symbol.Width; + x += pixel.Foreground.Symbol?.Width ?? 1; } flushingBuffer.Flush(); @@ -197,7 +197,7 @@ public void WritePixel( _lastBufferPointStart = _currentBufferPoint = bufferPoint; } - if (pixel.Foreground.Symbol.Text.Length == 0) + if ((pixel.Foreground.Symbol?.Text.Length ?? 0) == 0) _stringBuilder.Append(' '); else _stringBuilder.Append(pixel.Foreground.Symbol.Text); diff --git a/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs b/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs index d23a5d3d..1751b29c 100644 --- a/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs +++ b/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs @@ -138,15 +138,16 @@ public virtual void PauseIO(Task task) } #pragma warning disable CA1063 // Implement IDisposable Correctly +#pragma warning disable CA1303 // Do not pass literals as localized parameters public void Dispose() -#pragma warning restore CA1063 // Implement IDisposable Correctly { Dispose(true); GC.SuppressFinalize(this); -#pragma warning disable CA1303 // Do not pass literals as localized parameters Console.Write(ConsoleUtils.DisableAlternateBuffer); -#pragma warning restore CA1303 // Do not pass literals as localized parameters + Console.CursorVisible = true; } +#pragma warning restore CA1063 // Implement IDisposable Correctly +#pragma warning restore CA1303 // Do not pass literals as localized parameters public void ClearOutput() { diff --git a/src/Consolonia.Gallery/Consolonia.Gallery.csproj b/src/Consolonia.Gallery/Consolonia.Gallery.csproj index 440f9853..aaa86821 100644 --- a/src/Consolonia.Gallery/Consolonia.Gallery.csproj +++ b/src/Consolonia.Gallery/Consolonia.Gallery.csproj @@ -5,9 +5,8 @@ False - - + diff --git a/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryAnimatedLines.axaml b/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryAnimatedLines.axaml index 6d15341c..307d63ec 100644 --- a/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryAnimatedLines.axaml +++ b/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryAnimatedLines.axaml @@ -1,5 +1,8 @@ diff --git a/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryButton.axaml b/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryButton.axaml index cc026bbc..cecf5aac 100644 --- a/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryButton.axaml +++ b/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryButton.axaml @@ -1,6 +1,9 @@ diff --git a/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryCalendar.axaml b/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryCalendar.axaml index affbacab..462fc743 100644 --- a/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryCalendar.axaml +++ b/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryCalendar.axaml @@ -1,5 +1,8 @@ - diff --git a/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryCalendarPicker.axaml b/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryCalendarPicker.axaml index 4dc9f356..fe820a9c 100644 --- a/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryCalendarPicker.axaml +++ b/src/Consolonia.Gallery/Gallery/GalleryViews/GalleryCalendarPicker.axaml @@ -1,7 +1,10 @@ -