Explorar o código

Merge branch 'v2_develop' into v2_release

Tig hai 3 meses
pai
achega
1945b03ac1
Modificáronse 100 ficheiros con 1436 adicións e 529 borrados
  1. 1 1
      .github/workflows/publish.yml
  2. 43 50
      Directory.Packages.props
  3. 1 1
      Examples/CommunityToolkitExample/CommunityToolkitExample.csproj
  4. 0 0
      Examples/CommunityToolkitExample/LoginActions.cs
  5. 0 0
      Examples/CommunityToolkitExample/LoginView.Designer.cs
  6. 7 7
      Examples/CommunityToolkitExample/LoginView.cs
  7. 3 3
      Examples/CommunityToolkitExample/LoginViewModel.cs
  8. 0 0
      Examples/CommunityToolkitExample/Message.cs
  9. 2 1
      Examples/CommunityToolkitExample/Program.cs
  10. 2 2
      Examples/CommunityToolkitExample/README.md
  11. 0 0
      Examples/DemoFiles/example_config.json
  12. 4 4
      Examples/Example/Example.cs
  13. 14 14
      Examples/Example/Example.csproj
  14. 0 0
      Examples/Example/README.md
  15. 0 0
      Examples/FSharpExample/.editorconfig
  16. 0 0
      Examples/FSharpExample/FSharpExample.fsproj
  17. 0 0
      Examples/FSharpExample/FSharpExample.sln
  18. 48 48
      Examples/FSharpExample/Program.fs
  19. 1 1
      Examples/NativeAot/NativeAot.csproj
  20. 3 2
      Examples/NativeAot/Program.cs
  21. 0 0
      Examples/NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Debug.pubxml
  22. 0 0
      Examples/NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Release.pubxml
  23. 0 0
      Examples/NativeAot/Properties/launchSettings.json
  24. 0 0
      Examples/NativeAot/Publish_linux-x64_Debug.sh
  25. 0 0
      Examples/NativeAot/Publish_linux-x64_Release.sh
  26. 0 0
      Examples/NativeAot/Publish_osx-x64_Debug.sh
  27. 0 0
      Examples/NativeAot/Publish_osx-x64_Release.sh
  28. 0 0
      Examples/NativeAot/README.md
  29. 2 2
      Examples/ReactiveExample/LoginView.cs
  30. 4 3
      Examples/ReactiveExample/LoginViewModel.cs
  31. 1 0
      Examples/ReactiveExample/Program.cs
  32. 0 0
      Examples/ReactiveExample/README.md
  33. 1 1
      Examples/ReactiveExample/ReactiveExample.csproj
  34. 0 0
      Examples/ReactiveExample/TerminalScheduler.cs
  35. 0 0
      Examples/ReactiveExample/ViewExtensions.cs
  36. 3 2
      Examples/SelfContained/Program.cs
  37. 0 0
      Examples/SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_linux-x64_Debug.pubxml
  38. 0 0
      Examples/SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_linux-x64_Release.pubxml
  39. 0 0
      Examples/SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_osx-x64_Debug.pubxml
  40. 0 0
      Examples/SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_osx-x64_Release.pubxml
  41. 0 0
      Examples/SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Debug.pubxml
  42. 0 0
      Examples/SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Release.pubxml
  43. 0 0
      Examples/SelfContained/README.md
  44. 1 1
      Examples/SelfContained/SelfContained.csproj
  45. 0 0
      Examples/UICatalog/.gitignore
  46. 0 0
      Examples/UICatalog/BenchmarkResults.cs
  47. 0 0
      Examples/UICatalog/Dockerfile
  48. 0 0
      Examples/UICatalog/NumberToWords.cs
  49. 13 4
      Examples/UICatalog/Properties/launchSettings.json
  50. 0 0
      Examples/UICatalog/README.md
  51. 20 31
      Examples/UICatalog/Resources/config.json
  52. 0 2
      Examples/UICatalog/Scenario.cs
  53. 0 0
      Examples/UICatalog/ScenarioCategory.cs
  54. 0 0
      Examples/UICatalog/ScenarioMetadata.cs
  55. 13 11
      Examples/UICatalog/Scenarios/Adornments.cs
  56. 36 72
      Examples/UICatalog/Scenarios/AllViewsTester.cs
  57. 0 1
      Examples/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs
  58. 0 0
      Examples/UICatalog/Scenarios/AnimationScenario/Spinning_globe_dark_small.gif
  59. 0 0
      Examples/UICatalog/Scenarios/AnimationScenario/spinning-globe-attribution.txt
  60. 9 9
      Examples/UICatalog/Scenarios/AnsiRequestsScenario.cs
  61. 45 61
      Examples/UICatalog/Scenarios/Arrangement.cs
  62. 11 11
      Examples/UICatalog/Scenarios/Bars.cs
  63. 28 27
      Examples/UICatalog/Scenarios/Buttons.cs
  64. 20 13
      Examples/UICatalog/Scenarios/CharacterMap/CharacterMap.cs
  65. 0 0
      Examples/UICatalog/Scenarios/ChineseUI.cs
  66. 0 0
      Examples/UICatalog/Scenarios/ClassExplorer.cs
  67. 1 1
      Examples/UICatalog/Scenarios/Clipping.cs
  68. 2 2
      Examples/UICatalog/Scenarios/CollectionNavigatorTester.cs
  69. 14 12
      Examples/UICatalog/Scenarios/ColorPicker.cs
  70. 0 0
      Examples/UICatalog/Scenarios/CombiningMarks.cs
  71. 1 1
      Examples/UICatalog/Scenarios/ComboBoxIteration.cs
  72. 17 17
      Examples/UICatalog/Scenarios/ComputedLayout.cs
  73. 67 45
      Examples/UICatalog/Scenarios/ConfigurationEditor.cs
  74. 271 0
      Examples/UICatalog/Scenarios/ContextMenus.cs
  75. 0 0
      Examples/UICatalog/Scenarios/CsvEditor.cs
  76. 0 0
      Examples/UICatalog/Scenarios/DatePickers.cs
  77. 6 6
      Examples/UICatalog/Scenarios/Dialogs.cs
  78. 5 5
      Examples/UICatalog/Scenarios/DimAutoDemo.cs
  79. 5 4
      Examples/UICatalog/Scenarios/DynamicMenuBar.cs
  80. 4 4
      Examples/UICatalog/Scenarios/DynamicStatusBar.cs
  81. 5 5
      Examples/UICatalog/Scenarios/Editor.cs
  82. 6 5
      Examples/UICatalog/Scenarios/EditorsAndHelpers/AdornmentEditor.cs
  83. 2 0
      Examples/UICatalog/Scenarios/EditorsAndHelpers/AdornmentsEditor.cs
  84. 195 0
      Examples/UICatalog/Scenarios/EditorsAndHelpers/AllViewsView.cs
  85. 2 2
      Examples/UICatalog/Scenarios/EditorsAndHelpers/ArrangementEditor.cs
  86. 1 1
      Examples/UICatalog/Scenarios/EditorsAndHelpers/BorderEditor.cs
  87. 4 4
      Examples/UICatalog/Scenarios/EditorsAndHelpers/DimEditor.cs
  88. 7 5
      Examples/UICatalog/Scenarios/EditorsAndHelpers/EditorBase.cs
  89. 0 0
      Examples/UICatalog/Scenarios/EditorsAndHelpers/EventLog.cs
  90. 0 0
      Examples/UICatalog/Scenarios/EditorsAndHelpers/ExpanderButton.cs
  91. 0 0
      Examples/UICatalog/Scenarios/EditorsAndHelpers/LayoutEditor.cs
  92. 90 0
      Examples/UICatalog/Scenarios/EditorsAndHelpers/MarginEditor.cs
  93. 0 0
      Examples/UICatalog/Scenarios/EditorsAndHelpers/PaddingEditor.cs
  94. 3 3
      Examples/UICatalog/Scenarios/EditorsAndHelpers/PosEditor.cs
  95. 47 0
      Examples/UICatalog/Scenarios/EditorsAndHelpers/SchemeViewer.cs
  96. 121 0
      Examples/UICatalog/Scenarios/EditorsAndHelpers/ThemeViewer.cs
  97. 127 0
      Examples/UICatalog/Scenarios/EditorsAndHelpers/ViewPropertiesEditor.cs
  98. 41 20
      Examples/UICatalog/Scenarios/EditorsAndHelpers/ViewportSettingsEditor.cs
  99. 39 0
      Examples/UICatalog/Scenarios/EditorsAndHelpers/VisualRoleViewer.cs
  100. 17 2
      Examples/UICatalog/Scenarios/FileDialogExamples.cs

+ 1 - 1
.github/workflows/publish.yml

@@ -2,7 +2,7 @@ name: Publish Terminal.Gui
 
 on:
   push:
-    branches: [ v1_release, v1_develop, v2_release, v2_develop ]
+    branches: [ v2_release, v2_develop ]
     tags:
       - v*
     paths-ignore:

+ 43 - 50
Directory.Packages.props

@@ -1,52 +1,45 @@
 <Project>
-	<PropertyGroup>
-		<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
-	</PropertyGroup>
-	<ItemGroup>
-		<!-- Enable Nuget Source Link for github -->
-		<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="[8,9)" />
-
-		<PackageVersion Include="ColorHelper" Version="[1.8.1,2)" />
-		<PackageVersion Include="JetBrains.Annotations" Version="[2024.3.0,)" />
-		<PackageVersion Include="Microsoft.CodeAnalysis" Version="[4.13,5)" />
-		<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="[4.13,5)" />
-		<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="[4.13,5)" />
-		<PackageVersion Include="Microsoft.Extensions.Logging" Version="[9.0.2,10)" />
-		<PackageVersion Include="System.IO.Abstractions" Version="[22.0.11,23)" />
-		<PackageVersion Include="System.Text.Json" Version="[8.0.5,9)" />
-		<PackageVersion Include="Wcwidth" Version="[2,3)" />
-
-		<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="[1.21.2,2)" />
-		<PackageVersion Include="Serilog" Version="4.2.0" />
-		<PackageVersion Include="Serilog.Extensions.Logging" Version="9.0.0" />
-		<PackageVersion Include="Serilog.Sinks.Debug" Version="3.0.0" />
-		<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
-		<PackageVersion Include="SixLabors.ImageSharp" Version="[3.1.7,4)" />
-		<PackageVersion Include="CsvHelper" Version="[33.0.1,34)" />
-		<PackageVersion Include="Microsoft.DotNet.PlatformAbstractions" Version="[3.1.6,4)" />
-		<PackageVersion Include="System.CommandLine" Version="[2.0.0-beta4.22272.1,3)" />
-
-		<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
-
-		<PackageVersion Include="CommunityToolkit.Mvvm" Version="[8.4.0,9)" />
-		<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="[9.0.2,10)" />	
-		<PackageVersion Include="ReactiveUI" Version="[20.1.63,21)" />
-		<PackageVersion Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="[1.3.1,2)" />
-		<PackageVersion Include="ReactiveUI.SourceGenerators" Version="[2.1.8,3)"/>	
-
-		<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="[17.13,18)" />
-		<PackageVersion Include="Moq" Version="[4.20.72,5)" />
-		<PackageVersion Include="ReportGenerator" Version="[5.4.4,6)" />
-		<PackageVersion Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="[22.0.11,23)" />
-		<PackageVersion Include="xunit" Version="[2.9.3,3)" />
-		<PackageVersion Include="Xunit.Combinatorial" Version="[1.6.24,2)" />
-		<PackageVersion Include="xunit.runner.visualstudio" Version="[2.8.2,3)"/> 
-		<PackageVersion Include="coverlet.collector" Version="[6.0.4,7)" />
-		
-	</ItemGroup>
-
-	<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
-        <PackageVersion Include="Terminal.Gui" Version="2.0.0" />
-	</ItemGroup>
-
+  <PropertyGroup>
+    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
+  </PropertyGroup>
+  <ItemGroup>
+    <!-- Enable Nuget Source Link for github -->
+    <PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
+    <PackageVersion Include="Microsoft.SourceLink.GitHub" Version="[8,9)" />
+    <PackageVersion Include="ColorHelper" Version="[1.8.1,2)" />
+    <PackageVersion Include="JetBrains.Annotations" Version="[2024.3.0,)" />
+    <PackageVersion Include="Microsoft.CodeAnalysis" Version="[4.11,4.12)" />
+    <PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="[4.11,4.12)" />
+    <PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
+    <PackageVersion Include="Microsoft.Extensions.Logging" Version="[9.0.2,10)" />
+    <PackageVersion Include="System.IO.Abstractions" Version="[22.0.11,23)" />
+    <PackageVersion Include="System.Text.Json" Version="[8.0.5,9)" />
+    <PackageVersion Include="Wcwidth" Version="[2,3)" />
+    <PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="[1.21.2,2)" />
+    <PackageVersion Include="Serilog" Version="4.2.0" />
+    <PackageVersion Include="Serilog.Extensions.Logging" Version="9.0.0" />
+    <PackageVersion Include="Serilog.Sinks.Debug" Version="3.0.0" />
+    <PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
+    <PackageVersion Include="SixLabors.ImageSharp" Version="[3.1.7,4)" />
+    <PackageVersion Include="CsvHelper" Version="[33.0.1,34)" />
+    <PackageVersion Include="Microsoft.DotNet.PlatformAbstractions" Version="[3.1.6,4)" />
+    <PackageVersion Include="System.CommandLine" Version="[2.0.0-beta4.22272.1,3)" />
+    <PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
+    <PackageVersion Include="CommunityToolkit.Mvvm" Version="[8.4.0,9)" />
+    <PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="[9.0.2,10)" />
+    <PackageVersion Include="ReactiveUI" Version="[20.1.63,21)" />
+    <PackageVersion Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="[1.3.1,2)" />
+    <PackageVersion Include="ReactiveUI.SourceGenerators" Version="[2.1.8,3)" />
+    <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="[17.13,18)" />
+    <PackageVersion Include="Moq" Version="[4.20.72,5)" />
+    <PackageVersion Include="ReportGenerator" Version="5.4.5" />
+    <PackageVersion Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="22.0.14" />
+    <PackageVersion Include="xunit" Version="[2.9.3,3)" />
+    <PackageVersion Include="Xunit.Combinatorial" Version="[1.6.24,2)" />
+    <PackageVersion Include="xunit.runner.visualstudio" Version="[2.8.2,3)" />
+    <PackageVersion Include="coverlet.collector" Version="[6.0.4,7)" />
+  </ItemGroup>
+  <ItemGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
+    <PackageVersion Include="Terminal.Gui" Version="2.0.0" />
+  </ItemGroup>
 </Project>

+ 1 - 1
CommunityToolkitExample/CommunityToolkitExample.csproj → Examples/CommunityToolkitExample/CommunityToolkitExample.csproj

@@ -8,7 +8,7 @@
   <ItemGroup>
     <PackageReference Include="CommunityToolkit.Mvvm" />
     <PackageReference Include="Microsoft.Extensions.DependencyInjection" />
-    <ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" />
+    <ProjectReference Include="..\..\Terminal.Gui\Terminal.Gui.csproj" />
   </ItemGroup>
 
 </Project>

+ 0 - 0
CommunityToolkitExample/LoginActions.cs → Examples/CommunityToolkitExample/LoginActions.cs


+ 0 - 0
CommunityToolkitExample/LoginView.Designer.cs → Examples/CommunityToolkitExample/LoginView.Designer.cs


+ 7 - 7
CommunityToolkitExample/LoginView.cs → Examples/CommunityToolkitExample/LoginView.cs

@@ -23,15 +23,15 @@ internal partial class LoginView : IRecipient<Message<LoginActions>>
                               {
                                   if (!ViewModel.CanLogin) { return; }
                                   ViewModel.LoginCommand.Execute (null);
-                                  // Anytime Accepting is handled, make sure to set e.Cancel to false.
-                                  e.Cancel = false;
+                                  // When Accepting is handled, set e.Handled to true to prevent further processing.
+                                  e.Handled = true;
                               };
 
         clearButton.Accepting += (_, e) =>
                               {
                                   ViewModel.ClearCommand.Execute (null);
-                                  // Anytime Accepting is handled, make sure to set e.Cancel to false.
-                                  e.Cancel = false;
+                                  // When Accepting is handled, set e.Handled to true to prevent further processing.
+                                  e.Handled = true;
                               };
 
         Initialized += (_, _) => { ViewModel.Initialized (); };
@@ -47,7 +47,7 @@ internal partial class LoginView : IRecipient<Message<LoginActions>>
                 {
                     loginProgressLabel.Text = ViewModel.LoginProgressMessage;
                     validationLabel.Text = ViewModel.ValidationMessage;
-                    validationLabel.ColorScheme = ViewModel.ValidationColorScheme;
+                    validationLabel.SetScheme (ViewModel.ValidationScheme);
                     break;
                 }
             case LoginActions.LoginProgress:
@@ -58,11 +58,11 @@ internal partial class LoginView : IRecipient<Message<LoginActions>>
             case LoginActions.Validation:
                 {
                     validationLabel.Text = ViewModel.ValidationMessage;
-                    validationLabel.ColorScheme = ViewModel.ValidationColorScheme;
+                    validationLabel.SetScheme (ViewModel.ValidationScheme);
                     break;
                 }
         }
-        SetText();
+        SetText ();
         // BUGBUG: This should not be needed:
         Application.LayoutAndDraw ();
     }

+ 3 - 3
CommunityToolkitExample/LoginViewModel.cs → Examples/CommunityToolkitExample/LoginViewModel.cs

@@ -29,7 +29,7 @@ internal partial class LoginViewModel : ObservableObject
     private string _usernameLengthMessage;
     
     [ObservableProperty]
-    private ColorScheme? _validationColorScheme;
+    private Scheme? _validationScheme;
 
     [ObservableProperty]
     private string _validationMessage;
@@ -107,14 +107,14 @@ internal partial class LoginViewModel : ObservableObject
              case LoginActions.Clear:
                 LoginProgressMessage = message;
                 ValidationMessage = INVALID_LOGIN_MESSAGE;
-                ValidationColorScheme = Colors.ColorSchemes ["Error"];
+                ValidationScheme = SchemeManager.GetScheme ("Error");
                 break;
             case LoginActions.LoginProgress:
                 LoginProgressMessage = message;
                 break;
             case LoginActions.Validation:
                 ValidationMessage = CanLogin ? VALID_LOGIN_MESSAGE : INVALID_LOGIN_MESSAGE;
-                ValidationColorScheme = CanLogin ? Colors.ColorSchemes ["Base"] : Colors.ColorSchemes ["Error"];
+                ValidationScheme = CanLogin ? SchemeManager.GetScheme ("Base") : SchemeManager.GetScheme("Error");
                 break;
         }
         WeakReferenceMessenger.Default.Send (new Message<LoginActions> { Value = loginAction });

+ 0 - 0
CommunityToolkitExample/Message.cs → Examples/CommunityToolkitExample/Message.cs


+ 2 - 1
CommunityToolkitExample/Program.cs → Examples/CommunityToolkitExample/Program.cs

@@ -9,10 +9,11 @@ public static class Program
 
     private static void Main (string [] args)
     {
+        ConfigurationManager.Enable (ConfigLocations.All);
         Services = ConfigureServices ();
         Application.Init ();
         Application.Run (Services.GetRequiredService<LoginView> ());
-        Application.Top?.Dispose();
+        Application.Top?.Dispose ();
         Application.Shutdown ();
     }
 

+ 2 - 2
CommunityToolkitExample/README.md → Examples/CommunityToolkitExample/README.md

@@ -115,7 +115,7 @@ private void SendMessage (LoginAction loginAction, string message = "")
             break;
         case LoginAction.Validation:
             ValidationMessage = CanLogin ? VALID_LOGIN_MESSAGE : INVALID_LOGIN_MESSAGE;
-            ValidationColorScheme = CanLogin ? Colors.ColorSchemes ["Base"] : Colors.ColorSchemes ["Error"];
+            ValidationScheme = CanLogin ? Colors.Schemes ["Base"] : Colors.Schemes ["Error"];
             break;
     }
     WeakReferenceMessenger.Default.Send (new Message<LoginAction> { Value = loginAction });
@@ -144,7 +144,7 @@ public void Receive (Message<LoginAction> message)
         case LoginAction.Validation:
             {
                 validationLabel.Text = ViewModel.ValidationMessage;
-                validationLabel.ColorScheme = ViewModel.ValidationColorScheme;
+                validationLabel.Scheme = ViewModel.ValidationScheme;
                 break;
             }
     }

+ 0 - 0
DemoFiles/example_config.json → Examples/DemoFiles/example_config.json


+ 4 - 4
Example/Example.cs → Examples/Example/Example.cs

@@ -3,11 +3,11 @@
 
 // A simple Terminal.Gui example in C# - using C# 9.0 Top-level statements
 
-using System;
 using Terminal.Gui;
 
 // Override the default configuration for the application to use the Light theme
 ConfigurationManager.RuntimeConfig = """{ "Theme": "Light" }""";
+ConfigurationManager.Enable(ConfigLocations.All);
 
 Application.Run<ExampleWindow> ().Dispose ();
 
@@ -21,7 +21,7 @@ Console.WriteLine ($@"Username: {ExampleWindow.UserName}");
 // Defines a top-level window with border and title
 public class ExampleWindow : Window
 {
-    public static string UserName;
+    public static string UserName { get; set; }
 
     public ExampleWindow ()
     {
@@ -78,8 +78,8 @@ public class ExampleWindow : Window
                                {
                                    MessageBox.ErrorQuery ("Logging In", "Incorrect username or password", "Ok");
                                }
-                               // Anytime Accepting is handled, make sure to set e.Cancel to false.
-                               e.Cancel = false;
+                               // When Accepting is handled, set e.Handled to true to prevent further processing.
+                               e.Handled = true;
                            };
 
         // Add the views to the Window

+ 14 - 14
Example/Example.csproj → Examples/Example/Example.csproj

@@ -1,15 +1,15 @@
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <OutputType>Exe</OutputType>
-    <!-- Version numbers are automatically updated by gitversion when a release is released -->
-    <!-- In the source tree the version will always be 1.0 for all projects. -->
-    <!-- Do not modify these. -->
-    <AssemblyVersion>2.0</AssemblyVersion>
-    <FileVersion>2.0</FileVersion>
-    <Version>2.0</Version>
-    <InformationalVersion>2.0</InformationalVersion>
-  </PropertyGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" />
-  </ItemGroup>
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <!-- Version numbers are automatically updated by gitversion when a release is released -->
+    <!-- In the source tree the version will always be 1.0 for all projects. -->
+    <!-- Do not modify these. -->
+    <AssemblyVersion>2.0</AssemblyVersion>
+    <FileVersion>2.0</FileVersion>
+    <Version>2.0</Version>
+    <InformationalVersion>2.0</InformationalVersion>
+  </PropertyGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\Terminal.Gui\Terminal.Gui.csproj" />
+  </ItemGroup>
 </Project>

+ 0 - 0
Example/README.md → Examples/Example/README.md


+ 0 - 0
FSharpExample/.editorconfig → Examples/FSharpExample/.editorconfig


+ 0 - 0
FSharpExample/FSharpExample.fsproj → Examples/FSharpExample/FSharpExample.fsproj


+ 0 - 0
FSharpExample/FSharpExample.sln → Examples/FSharpExample/FSharpExample.sln


+ 48 - 48
FSharpExample/Program.fs → Examples/FSharpExample/Program.fs

@@ -1,48 +1,48 @@
-open Terminal.Gui
-
-type ExampleWindow() as this =
-    inherit Window()
-    
-    do
-        this.Title <- sprintf "Example App (%O to quit)" Application.QuitKey
-
-        // Create input components and labels
-        let usernameLabel = new Label(Text = "Username:")
-
-        let userNameText = new TextField(X = Pos.Right(usernameLabel) + Pos.op_Implicit(1), Width = Dim.Fill())
-
-        let passwordLabel = new Label(Text = "Password:", X = Pos.Left(usernameLabel), Y = Pos.Bottom(usernameLabel) +  Pos.op_Implicit(1))
-
-        let passwordText = new TextField(Secret = true, X = Pos.Left(userNameText), Y = Pos.Top(passwordLabel), Width = Dim.Fill())
-
-        // Create login button
-        let btnLogin = new Button(Text = "Login", Y = Pos.Bottom(passwordLabel) +  Pos.op_Implicit(1), X = Pos.Center(), IsDefault = true)
-
-        // When login button is clicked display a message popup
-        btnLogin.Accepting.Add(fun _ ->
-            if userNameText.Text = "admin" && passwordText.Text = "password" then
-                MessageBox.Query("Logging In", "Login Successful", "Ok") |> ignore
-                ExampleWindow.UserName <- userNameText.Text.ToString()
-                Application.RequestStop()
-            else
-                MessageBox.ErrorQuery("Logging In", "Incorrect username or password", "Ok") |> ignore
-        )
-
-        // Add the views to the Window
-        this.Add(usernameLabel, userNameText, passwordLabel, passwordText, btnLogin)
-
-    static member val UserName = "" with get, set
-
-[<EntryPoint>]
-let main argv =
-    Application.Init()
-    Application.Run<ExampleWindow>().Dispose()
-    
-    // Before the application exits, reset Terminal.Gui for clean shutdown
-    Application.Shutdown()
-    
-    // To see this output on the screen it must be done after shutdown,
-    // which restores the previous screen.
-    printfn "Username: %s" ExampleWindow.UserName
-    
-    0 // return an integer exit code
+open Terminal.Gui
+
+type ExampleWindow() as this =
+    inherit Window()
+    
+    do
+        this.Title <- sprintf "Example App (%O to quit)" Application.QuitKey
+
+        // Create input components and labels
+        let usernameLabel = new Label(Text = "Username:")
+
+        let userNameText = new TextField(X = Pos.Right(usernameLabel) + Pos.op_Implicit(1), Width = Dim.Fill())
+
+        let passwordLabel = new Label(Text = "Password:", X = Pos.Left(usernameLabel), Y = Pos.Bottom(usernameLabel) +  Pos.op_Implicit(1))
+
+        let passwordText = new TextField(Secret = true, X = Pos.Left(userNameText), Y = Pos.Top(passwordLabel), Width = Dim.Fill())
+
+        // Create login button
+        let btnLogin = new Button(Text = "Login", Y = Pos.Bottom(passwordLabel) +  Pos.op_Implicit(1), X = Pos.Center(), IsDefault = true)
+
+        // When login button is clicked display a message popup
+        btnLogin.Accepting.Add(fun _ ->
+            if userNameText.Text = "admin" && passwordText.Text = "password" then
+                MessageBox.Query("Logging In", "Login Successful", "Ok") |> ignore
+                ExampleWindow.UserName <- userNameText.Text.ToString()
+                Application.RequestStop()
+            else
+                MessageBox.ErrorQuery("Logging In", "Incorrect username or password", "Ok") |> ignore
+        )
+
+        // Add the views to the Window
+        this.Add(usernameLabel, userNameText, passwordLabel, passwordText, btnLogin)
+
+    static member val UserName = "" with get, set
+
+[<EntryPoint>]
+let main argv =
+    Application.Init()
+    Application.Run<ExampleWindow>().Dispose()
+    
+    // Before the application exits, reset Terminal.Gui for clean shutdown
+    Application.Shutdown()
+    
+    // To see this output on the screen it must be done after shutdown,
+    // which restores the previous screen.
+    printfn "Username: %s" ExampleWindow.UserName
+    
+    0 // return an integer exit code

+ 1 - 1
NativeAot/NativeAot.csproj → Examples/NativeAot/NativeAot.csproj

@@ -8,7 +8,7 @@
   </PropertyGroup>
 
   <ItemGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
-    <ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" />
+    <ProjectReference Include="..\..\Terminal.Gui\Terminal.Gui.csproj" />
     <TrimmerRootAssembly Include="Terminal.Gui" />
   </ItemGroup>
 

+ 3 - 2
NativeAot/Program.cs → Examples/NativeAot/Program.cs

@@ -13,6 +13,7 @@ public static class Program
     [RequiresDynamicCode ("Calls Terminal.Gui.Application.Init(IConsoleDriver, String)")]
     private static void Main (string [] args)
     {
+        ConfigurationManager.Enable(ConfigLocations.All);
         Application.Init ();
 
         #region The code in this region is not intended for use in a native Aot self-contained. It's just here to make sure there is no functionality break with localization in Terminal.Gui using self-contained
@@ -105,8 +106,8 @@ public class ExampleWindow : Window
             {
                 MessageBox.ErrorQuery ("Logging In", "Incorrect username or password", "Ok");
             }
-            // Anytime Accepting is handled, make sure to set e.Cancel to false.
-            e.Cancel = false;
+            // Anytime Accepting is handled, make sure to set e.Handled to true.
+            e.Handled = true;
         };
 
         // Add the views to the Window

+ 0 - 0
NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Debug.pubxml → Examples/NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Debug.pubxml


+ 0 - 0
NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Release.pubxml → Examples/NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Release.pubxml


+ 0 - 0
NativeAot/Properties/launchSettings.json → Examples/NativeAot/Properties/launchSettings.json


+ 0 - 0
NativeAot/Publish_linux-x64_Debug.sh → Examples/NativeAot/Publish_linux-x64_Debug.sh


+ 0 - 0
NativeAot/Publish_linux-x64_Release.sh → Examples/NativeAot/Publish_linux-x64_Release.sh


+ 0 - 0
NativeAot/Publish_osx-x64_Debug.sh → Examples/NativeAot/Publish_osx-x64_Debug.sh


+ 0 - 0
NativeAot/Publish_osx-x64_Release.sh → Examples/NativeAot/Publish_osx-x64_Release.sh


+ 0 - 0
NativeAot/README.md → Examples/NativeAot/README.md


+ 2 - 2
ReactiveExample/LoginView.cs → Examples/ReactiveExample/LoginView.cs

@@ -96,8 +96,8 @@ public class LoginView : Window, IViewFor<LoginViewModel>
 
                 ViewModel
                     .WhenAnyValue (x => x.IsValid)
-                    .Select (valid => valid ? Colors.ColorSchemes ["Base"] : Colors.ColorSchemes ["Error"])
-                    .BindTo (validation, x => x.ColorScheme)
+                    .Select (valid => valid ? SchemeManager.GetScheme ("Base") : SchemeManager.GetScheme ("Error"))
+                    .BindTo (validation, x => x.GetScheme ())
                     .DisposeWith (_disposable);
             })
             .AddControlAfter<Button> ((previous, login) =>

+ 4 - 3
ReactiveExample/LoginViewModel.cs → Examples/ReactiveExample/LoginViewModel.cs

@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
 using System.Threading.Tasks;
 using ReactiveUI;
 using ReactiveUI.SourceGenerators;
+using Terminal.Gui;
 
 namespace ReactiveExample;
 
@@ -50,7 +51,7 @@ public partial class LoginViewModel : ReactiveObject
 
         _isValidHelper = canLogin.ToProperty (this, x => x.IsValid);
 
-        Login = ReactiveCommand.CreateFromTask<HandledEventArgs>
+        Login = ReactiveCommand.CreateFromTask<CommandEventArgs>
             (
                 e => Task.Delay (TimeSpan.FromSeconds (1)),
                 canLogin
@@ -76,8 +77,8 @@ public partial class LoginViewModel : ReactiveObject
     }
 
     [ReactiveCommand]
-    public void Clear (HandledEventArgs args) { }
+    public void Clear (CommandEventArgs args) { }
 
     [IgnoreDataMember]
-    public ReactiveCommand<HandledEventArgs, Unit> Login { get; }
+    public ReactiveCommand<CommandEventArgs, Unit> Login { get; }
 }

+ 1 - 0
ReactiveExample/Program.cs → Examples/ReactiveExample/Program.cs

@@ -8,6 +8,7 @@ public static class Program
 {
     private static void Main (string [] args)
     {
+        ConfigurationManager.Enable (ConfigLocations.All);
         Application.Init ();
         RxApp.MainThreadScheduler = TerminalScheduler.Default;
         RxApp.TaskpoolScheduler = TaskPoolScheduler.Default;

+ 0 - 0
ReactiveExample/README.md → Examples/ReactiveExample/README.md


+ 1 - 1
ReactiveExample/ReactiveExample.csproj → Examples/ReactiveExample/ReactiveExample.csproj

@@ -15,6 +15,6 @@
     <PackageReference Include="ReactiveUI.SourceGenerators" PrivateAssets="all" />
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" />
+    <ProjectReference Include="..\..\Terminal.Gui\Terminal.Gui.csproj" />
   </ItemGroup>
 </Project>

+ 0 - 0
ReactiveExample/TerminalScheduler.cs → Examples/ReactiveExample/TerminalScheduler.cs


+ 0 - 0
ReactiveExample/ViewExtensions.cs → Examples/ReactiveExample/ViewExtensions.cs


+ 3 - 2
SelfContained/Program.cs → Examples/SelfContained/Program.cs

@@ -12,6 +12,7 @@ public static class Program
     [RequiresUnreferencedCode ("Calls Terminal.Gui.Application.Run<T>(Func<Exception, Boolean>, IConsoleDriver)")]
     private static void Main (string [] args)
     {
+        ConfigurationManager.Enable (ConfigLocations.All);
         Application.Init ();
 
         #region The code in this region is not intended for use in a self-contained single-file. It's just here to make sure there is no functionality break with localization in Terminal.Gui using single-file
@@ -104,8 +105,8 @@ public class ExampleWindow : Window
                                {
                                    MessageBox.ErrorQuery ("Logging In", "Incorrect username or password", "Ok");
                                }
-                               // Anytime Accepting is handled, make sure to set e.Cancel to false.
-                               e.Cancel = false;
+                               // When Accepting is handled, set e.Handled to true to prevent further processing.
+                               e.Handled = true;
                            };
 
         // Add the views to the Window

+ 0 - 0
SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_linux-x64_Debug.pubxml → Examples/SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_linux-x64_Debug.pubxml


+ 0 - 0
SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_linux-x64_Release.pubxml → Examples/SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_linux-x64_Release.pubxml


+ 0 - 0
SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_osx-x64_Debug.pubxml → Examples/SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_osx-x64_Debug.pubxml


+ 0 - 0
SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_osx-x64_Release.pubxml → Examples/SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_osx-x64_Release.pubxml


+ 0 - 0
SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Debug.pubxml → Examples/SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Debug.pubxml


+ 0 - 0
SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Release.pubxml → Examples/SelfContained/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Release.pubxml


+ 0 - 0
SelfContained/README.md → Examples/SelfContained/README.md


+ 1 - 1
SelfContained/SelfContained.csproj → Examples/SelfContained/SelfContained.csproj

@@ -11,7 +11,7 @@
   </PropertyGroup>
 
   <ItemGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
-    <ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" />
+    <ProjectReference Include="..\..\Terminal.Gui\Terminal.Gui.csproj" />
     <TrimmerRootAssembly Include="Terminal.Gui" />
   </ItemGroup>
 

+ 0 - 0
UICatalog/.gitignore → Examples/UICatalog/.gitignore


+ 0 - 0
UICatalog/BenchmarkResults.cs → Examples/UICatalog/BenchmarkResults.cs


+ 0 - 0
UICatalog/Dockerfile → Examples/UICatalog/Dockerfile


+ 0 - 0
UICatalog/NumberToWords.cs → Examples/UICatalog/NumberToWords.cs


+ 13 - 4
UICatalog/Properties/launchSettings.json → Examples/UICatalog/Properties/launchSettings.json

@@ -1,7 +1,8 @@
 {
   "profiles": {
     "UICatalog": {
-      "commandName": "Project"
+      "commandName": "Project",
+      "commandLineArgs": "--debug-log-level Debug"
     },
     "UICatalog --driver NetDriver": {
       "commandName": "Project",
@@ -13,7 +14,7 @@
     },
     "UICatalog --driver v2win": {
       "commandName": "Project",
-      "commandLineArgs": "--driver v2win"
+      "commandLineArgs": "--driver v2win -dl Trace"
     },
     "UICatalog --driver v2net": {
       "commandName": "Project",
@@ -60,9 +61,17 @@
       "commandName": "Project",
       "commandLineArgs": "\"All Views Tester\" -b -t 5000"
     },
-    "Charmap": {
+    "UICatalog --disable-cm": {
+      "commandName": "Project",
+      "commandLineArgs": "--disable-cm\r\n"
+    },
+    "UICatalog --disable-cm --driver v2win": {
+      "commandName": "Project",
+      "commandLineArgs": "--disable-cm --driver v2win"
+    },
+    "Themes": {
       "commandName": "Project",
-      "commandLineArgs": "Bars -b"
+      "commandLineArgs": "Themes"
     }
   }
 }

+ 0 - 0
UICatalog/README.md → Examples/UICatalog/README.md


+ 20 - 31
UICatalog/Resources/config.json → Examples/UICatalog/Resources/config.json

@@ -4,37 +4,12 @@
   "FileDialogStyle.DefaultUseColors": false,
   "FileDialogStyle.DefaultUseUnicodeCharacters": false,
   "AppSettings": {
-    "UICatalog.StatusBar": true,
-    "ConfigurationEditor.EditorColorScheme": {
-      "Normal": {
-        "Foreground": "Red",
-        "Background": "White"
-      },
-      "Focus": {
-        "Foreground": "Green",
-        "Background": "White"
-      },
-      "HotNormal": {
-        "Foreground": "Black",
-        "Background": "White"
-      },
-      "HotFocus": {
-        "Foreground": "White",
-        "Background": "BrightRed"
-      },
-      "Disabled": {
-        "Foreground": "DarkGray",
-        "Background": "White"
-      }
-    }
+    "UICatalog.StatusBar": true
   },
   "Themes": [
     {
       "Hot Dog Stand": {
-        "Button.DefaultShadow": "Opaque",
-        "Dialog.DefaultShadow": "Transparent",
-        "Dialog.DefaultButtonAlignment": "Center",
-        "ColorSchemes": [
+        "Schemes": [
           {
             "Toplevel": {
               "Normal": {
@@ -160,10 +135,24 @@
     },
     {
       "UI Catalog Theme": {
-        "Button.DefaultShadow": "Opaque",
-        "Dialog.DefaultShadow": "Transparent",
-        "Dialog.DefaultButtonAlignment": "Center",
-        "ColorSchemes": [
+        "Window.DefaultShadow": "Transparent",
+        "CheckBox.DefaultHighlightStyle": "Hover, Pressed, PressedOutside",
+        "MessageBox.DefaultButtonAlignment": "Start",
+        "StatusBar.DefaultSeparatorLineStyle": "Single",
+        "Dialog.DefaultMinimumWidth": 80,
+        "MessageBox.DefaultBorderStyle": "Dotted",
+        "NerdFonts.Enable": false,
+        "MessageBox.DefaultMinimumWidth": 0,
+        "Window.DefaultBorderStyle": "Double",
+        "Dialog.DefaultShadow": "Opaque",
+        "Dialog.DefaultButtonAlignment": "Start",
+        "Button.DefaultShadow": "Transparent",
+        "FrameView.DefaultBorderStyle": "Double",
+        "MessageBox.DefaultMinimumHeight": 0,
+        "Button.DefaultHighlightStyle": "Hover, Pressed",
+        "Menuv2.DefaultBorderStyle": "Heavy",
+        "MenuBarv2.DefaultBorderStyle": "Heavy",
+        "Schemes": [
           {
             "UI Catalog Scheme": {
               "Normal": {

+ 0 - 2
UICatalog/Scenario.cs → Examples/UICatalog/Scenario.cs

@@ -84,8 +84,6 @@ namespace UICatalog;
 public class Scenario : IDisposable
 {
     private static int _maxScenarioNameLen = 30;
-    public string TopLevelColorScheme { get; set; } = "Base";
-
     public BenchmarkResults BenchmarkResults
     {
         get { return _benchmarkResults; }

+ 0 - 0
UICatalog/ScenarioCategory.cs → Examples/UICatalog/ScenarioCategory.cs


+ 0 - 0
UICatalog/ScenarioMetadata.cs → Examples/UICatalog/ScenarioMetadata.cs


+ 13 - 11
UICatalog/Scenarios/Adornments.cs → Examples/UICatalog/Scenarios/Adornments.cs

@@ -36,7 +36,7 @@ public class Adornments : Scenario
             Title = "The _Window",
             Arrangement = ViewArrangement.Overlapped | ViewArrangement.Movable,
 
-            Width = Dim.Fill (Dim.Func (() => editor.Frame.Width )),
+            Width = Dim.Fill (Dim.Func (() => editor.Frame.Width)),
             Height = Dim.Fill ()
         };
         app.Add (window);
@@ -47,13 +47,15 @@ public class Adornments : Scenario
 
         color.ColorChanged += (s, e) =>
                               {
-                                  color.SuperView.ColorScheme = new (color.SuperView.ColorScheme)
-                                  {
-                                      Normal = new (
-                                                    color.SuperView.ColorScheme.Normal.Foreground,
-                                                    e.CurrentValue
-                                                   )
-                                  };
+                                  color.SuperView!.SetScheme (
+                                                             new (color.SuperView.GetScheme ())
+                                                             {
+                                                                 Normal = new (
+                                                                               color.SuperView.GetAttributeForRole (VisualRole.Normal).Foreground,
+                                                                               e.CurrentValue,
+                                                                               color.SuperView.GetAttributeForRole (VisualRole.Normal).Style
+                                                                              )
+                                                             });
                               };
 
         var button = new Button { X = Pos.Center (), Y = Pos.Center (), Text = "Press me!" };
@@ -80,7 +82,7 @@ public class Adornments : Scenario
             Width = 40,
             Height = Dim.Percent (20),
             Text = "Label\nY=AnchorEnd(),Height=Dim.Percent(10)",
-            ColorScheme = Colors.ColorSchemes ["Dialog"]
+            SchemeName = "Dialog"
         };
 
         window.Margin.Data = "Margin";
@@ -94,7 +96,7 @@ public class Adornments : Scenario
         window.Padding.Data = "Padding";
         window.Padding.Text = "Padding Text line 1\nPadding Text line 3\nPadding Text line 3\nPadding Text line 4\nPadding Text line 5";
         window.Padding.Thickness = new (3);
-        window.Padding.ColorScheme = Colors.ColorSchemes ["Error"];
+        window.Padding.SchemeName = "Error";
         window.Padding.CanFocus = true;
 
         var longLabel = new Label
@@ -143,7 +145,7 @@ public class Adornments : Scenario
                                 view.Border.CloseButton.Accept += (s, e) =>
                                                                   {
                                                                       MessageBox.Query (20, 7, "Hi", "Window Close Button Pressed!", "Ok");
-                                                                      e.Cancel = true;
+                                                                      e.Handled = true;
                                                                   };
 
                                 view.Accept += (s, e) => MessageBox.Query (20, 7, "Hi", "Window Close Button Pressed!", "Ok");

+ 36 - 72
UICatalog/Scenarios/AllViewsTester.cs → Examples/UICatalog/Scenarios/AllViewsTester.cs

@@ -21,10 +21,7 @@ public class AllViewsTester : Scenario
     private ArrangementEditor? _arrangementEditor;
     private LayoutEditor? _layoutEditor;
     private ViewportSettingsEditor? _viewportSettingsEditor;
-    private FrameView? _settingsPane;
-    private RadioGroup? _orientation;
-    private string _demoText = "This, that, and the other thing.";
-    private TextView? _demoTextView;
+    private ViewPropertiesEditor? _propertiesEditor;
 
     private FrameView? _hostPane;
     private View? _curView;
@@ -38,13 +35,13 @@ public class AllViewsTester : Scenario
         var app = new Window
         {
             Title = GetQuitKeyAndName (),
-            ColorScheme = Colors.ColorSchemes ["TopLevel"],
         };
 
         // Set the BorderStyle we use for all subviews, but disable the app border thickness
         app.Border!.LineStyle = LineStyle.Heavy;
         app.Border.Thickness = new (0);
 
+
         _viewClasses = GetAllViewClassesCollection ()
                        .OrderBy (t => t.Name)
                        .Select (t => new KeyValuePair<string, Type> (t.Name, t))
@@ -83,7 +80,7 @@ public class AllViewsTester : Scenario
         _classListView.Accepting += (sender, args) =>
                                     {
                                         _curView?.SetFocus ();
-                                        args.Cancel = true;
+                                        args.Handled = true;
                                     };
 
         _adornmentsEditor = new ()
@@ -148,9 +145,9 @@ public class AllViewsTester : Scenario
         };
         _viewportSettingsEditor.Border!.Thickness = new (1, 1, 1, 1);
 
-        _settingsPane = new ()
+        _propertiesEditor = new ()
         {
-            Title = "Misc Settings [_6]",
+            Title = "View Properties [_6]",
             X = Pos.Right (_adornmentsEditor) - 1,
             Y = Pos.Bottom (_viewportSettingsEditor) - Pos.Func (() => _viewportSettingsEditor.Frame.Height == 1 ? 0 : 1),
             Width = Dim.Width (_layoutEditor),
@@ -158,49 +155,7 @@ public class AllViewsTester : Scenario
             CanFocus = true,
             SuperViewRendersLineCanvas = true
         };
-        _settingsPane.Border!.Thickness = new (1, 1, 1, 0);
-
-        Label label = new () { X = 0, Y = 0, Text = "_Orientation:" };
-
-        _orientation = new ()
-        {
-            X = Pos.Right (label) + 1,
-            Y = Pos.Top (label),
-            RadioLabels = new [] { "Horizontal", "Vertical" },
-            Orientation = Orientation.Horizontal
-        };
-
-        _orientation.SelectedItemChanged += (s, selected) =>
-                                            {
-                                                if (_curView is IOrientation orientatedView)
-                                                {
-                                                    orientatedView.Orientation = (Orientation)_orientation.SelectedItem;
-                                                }
-                                            };
-        _settingsPane.Add (label, _orientation);
-
-        label = new () { X = 0, Y = Pos.Bottom (_orientation), Text = "_Text:" };
-
-        _demoTextView = new ()
-        {
-            X = Pos.Right (label) + 1,
-            Y = Pos.Top (label),
-            Width = Dim.Fill (),
-            Height = Dim.Auto (minimumContentDim: 2),
-            Text = _demoText
-        };
-
-        _demoTextView.ContentsChanged += (s, e) =>
-                                         {
-                                             _demoText = _demoTextView.Text;
-
-                                             if (_curView is { })
-                                             {
-                                                 _curView.Text = _demoText;
-                                             }
-                                         };
-
-        _settingsPane.Add (label, _demoTextView);
+        _propertiesEditor.Border!.Thickness = new (1, 1, 1, 0);
 
         _eventLog = new ()
         {
@@ -235,22 +190,22 @@ public class AllViewsTester : Scenario
         {
             Id = "_hostPane",
             X = Pos.Right (_adornmentsEditor),
-            Y = Pos.Bottom (_settingsPane),
+            Y = Pos.Bottom (_propertiesEditor),
             Width = Dim.Width (_layoutEditor) - 2,
             Height = Dim.Fill (),
             CanFocus = true,
             TabStop = TabBehavior.TabStop,
-            ColorScheme = Colors.ColorSchemes ["Base"],
+            //SchemeName = SchemeManager.SchemesToSchemeName (Schemes.Base),
             Arrangement = ViewArrangement.LeftResizable | ViewArrangement.BottomResizable | ViewArrangement.RightResizable,
             BorderStyle = LineStyle.Double,
             SuperViewRendersLineCanvas = true
         };
-        _hostPane.Border!.ColorScheme = app.ColorScheme;
+        _hostPane.Border!.SetScheme (app.GetScheme ());
         _hostPane.Padding!.Thickness = new (1);
         _hostPane.Padding.Diagnostics = ViewDiagnosticFlags.Ruler;
-        _hostPane.Padding.ColorScheme = app.ColorScheme;
+        _hostPane.Padding.SetScheme (app.GetScheme ());
 
-        app.Add (_classListView, _adornmentsEditor, _arrangementEditor, _layoutEditor, _viewportSettingsEditor, _settingsPane, _eventLog, _hostPane);
+        app.Add (_classListView, _adornmentsEditor, _arrangementEditor, _layoutEditor, _viewportSettingsEditor, _propertiesEditor, _eventLog, _hostPane);
 
         app.Initialized += App_Initialized;
 
@@ -276,54 +231,62 @@ public class AllViewsTester : Scenario
             // For each of the <T> arguments
             List<Type> typeArguments = new ();
 
-            // use <object>
+            // use <object> or the original type if applicable
             foreach (Type arg in type.GetGenericArguments ())
             {
-                typeArguments.Add (typeof (object));
+                if (arg.IsValueType && Nullable.GetUnderlyingType (arg) == null)
+                {
+                    typeArguments.Add (arg);
+                }
+                else
+                {
+                    typeArguments.Add (typeof (object));
+                }
             }
 
-            // And change what type we are instantiating from MyClass<T> to MyClass<object>
+            // And change what type we are instantiating from MyClass<T> to MyClass<object> or MyClass<T>
             type = type.MakeGenericType (typeArguments.ToArray ());
         }
 
+        // Ensure the type does not contain any generic parameters
+        if (type.ContainsGenericParameters)
+        {
+            Logging.Warning ($"Cannot create an instance of {type} because it contains generic parameters.");
+            //throw new ArgumentException ($"Cannot create an instance of {type} because it contains generic parameters.");
+            return;
+        }
+
         // Instantiate view
         var view = (View)Activator.CreateInstance (type)!;
         _eventLog!.ViewToLog = view;
 
         if (view is IDesignable designable)
         {
-            designable.EnableForDesign (ref _demoText);
+            string settingsEditorDemoText = _propertiesEditor!.DemoText;
+            designable.EnableForDesign (ref settingsEditorDemoText);
         }
         else
         {
-            view.Text = _demoText;
+            view.Text = _propertiesEditor!.DemoText;
             view.Title = "_Test Title";
         }
 
-        if (view is IOrientation orientatedView)
-        {
-            _orientation!.SelectedItem = (int)orientatedView.Orientation;
-            _orientation.Enabled = true;
-        }
-        else
-        {
-            _orientation!.Enabled = false;
-        }
 
         view.Initialized += CurrentView_Initialized;
         view.SubViewsLaidOut += CurrentView_LayoutComplete;
 
         view.Id = "_curView";
         _curView = view;
-        _curView = view;
 
         _hostPane!.Add (_curView);
         _layoutEditor!.ViewToEdit = _curView;
         _viewportSettingsEditor!.ViewToEdit = _curView;
         _arrangementEditor!.ViewToEdit = _curView;
+        _propertiesEditor!.ViewToEdit = _curView;
         _curView.SetNeedsLayout ();
     }
 
+
     private void DisposeCurrentView ()
     {
         if (_curView != null)
@@ -334,6 +297,7 @@ public class AllViewsTester : Scenario
             _layoutEditor!.ViewToEdit = null;
             _viewportSettingsEditor!.ViewToEdit = null;
             _arrangementEditor!.ViewToEdit = null;
+            _propertiesEditor!.ViewToEdit = null;
 
             _curView.Dispose ();
             _curView = null;
@@ -364,7 +328,7 @@ public class AllViewsTester : Scenario
             return;
         }
 
-        if (view.Width == Dim.Absolute(0) || view.Width is null)
+        if (view.Width == Dim.Absolute (0) || view.Width is null)
         {
             view.Width = Dim.Fill ();
         }

+ 0 - 1
UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs → Examples/UICatalog/Scenarios/AnimationScenario/AnimationScenario.cs

@@ -51,7 +51,6 @@ public class AnimationScenario : Scenario
         Application.Run (win);
         win.Dispose ();
         Application.Shutdown ();
-        Debug.Assert (!Application.Initialized);
     }
 
 

+ 0 - 0
UICatalog/Scenarios/AnimationScenario/Spinning_globe_dark_small.gif → Examples/UICatalog/Scenarios/AnimationScenario/Spinning_globe_dark_small.gif


+ 0 - 0
UICatalog/Scenarios/AnimationScenario/spinning-globe-attribution.txt → Examples/UICatalog/Scenarios/AnimationScenario/spinning-globe-attribution.txt


+ 9 - 9
UICatalog/Scenarios/AnsiRequestsScenario.cs → Examples/UICatalog/Scenarios/AnsiRequestsScenario.cs

@@ -7,7 +7,7 @@ using Terminal.Gui;
 namespace UICatalog.Scenarios;
 
 [ScenarioMetadata ("AnsiEscapeSequenceRequest", "Ansi Escape Sequence Request")]
-[ScenarioCategory ("Ansi Escape Sequence")]
+[ScenarioCategory ("Tests")]
 public sealed class AnsiEscapeSequenceRequests : Scenario
 {
     private GraphView _graphView;
@@ -169,8 +169,8 @@ public sealed class AnsiEscapeSequenceRequests : Scenario
                                                                           {
                                                                               Request = ansiEscapeSequenceRequest.Request,
                                                                               Terminator = ansiEscapeSequenceRequest.Terminator,
-                                                                              ResponseReceived = (s)=>OnSuccess(s, tvResponse, tvError, tvValue, tvTerminator,lblSuccess),
-                                                                              Abandoned =()=> OnFail (tvResponse, tvError, tvValue, tvTerminator, lblSuccess)
+                                                                              ResponseReceived = (s) => OnSuccess (s, tvResponse, tvError, tvValue, tvTerminator, lblSuccess),
+                                                                              Abandoned = () => OnFail (tvResponse, tvError, tvValue, tvTerminator, lblSuccess)
                                                                           });
                                  };
 
@@ -181,15 +181,15 @@ public sealed class AnsiEscapeSequenceRequests : Scenario
         return w;
     }
 
-    private void OnSuccess (string response, TextView tvResponse, TextView tvError, TextView tvValue, TextView tvTerminator,Label lblSuccess)
+    private void OnSuccess (string response, TextView tvResponse, TextView tvError, TextView tvValue, TextView tvTerminator, Label lblSuccess)
     {
         tvResponse.Text = response;
         tvError.Text = string.Empty;
         tvValue.Text = string.Empty;
         tvTerminator.Text = string.Empty;
 
-            lblSuccess.ColorScheme = Colors.ColorSchemes ["Base"];
-            lblSuccess.Text = "Successful";
+        lblSuccess.SchemeName = SchemeManager.SchemesToSchemeName (Schemes.Base);
+        lblSuccess.Text = "Successful";
     }
 
     private void OnFail (TextView tvResponse, TextView tvError, TextView tvValue, TextView tvTerminator, Label lblSuccess)
@@ -199,7 +199,7 @@ public sealed class AnsiEscapeSequenceRequests : Scenario
         tvValue.Text = string.Empty;
         tvTerminator.Text = string.Empty;
 
-        lblSuccess.ColorScheme = Colors.ColorSchemes ["Error"];
+        lblSuccess.SchemeName = SchemeManager.SchemesToSchemeName (Schemes.Error);
         lblSuccess.Text = "Error";
     }
 
@@ -320,7 +320,7 @@ public sealed class AnsiEscapeSequenceRequests : Scenario
     private void UpdateResponses ()
     {
         _lblSummary.Text = GetSummary ();
-        _lblSummary.SetNeedsDraw();
+        _lblSummary.SetNeedsDraw ();
     }
 
     private string GetSummary ()
@@ -369,7 +369,7 @@ public sealed class AnsiEscapeSequenceRequests : Scenario
                                         .Select (g => new PointF (g.Key, g.Count ()))
                                         .ToList ();
         //  _graphView.ScrollOffset  = new PointF(,0);
-        _graphView.SetNeedsDraw();
+        _graphView.SetNeedsDraw ();
 
     }
 

+ 45 - 61
UICatalog/Scenarios/Arrangement.cs → Examples/UICatalog/Scenarios/Arrangement.cs

@@ -19,7 +19,8 @@ public class Arrangement : Scenario
         Window app = new ()
         {
             Title = GetQuitKeyAndName (),
-            TabStop = TabBehavior.TabGroup
+            TabStop = TabBehavior.TabGroup,
+            ShadowStyle = ShadowStyle.None
         };
 
         var adornmentsEditor = new AdornmentsEditor
@@ -33,7 +34,7 @@ public class Arrangement : Scenario
 
         app.Add (adornmentsEditor);
 
-        adornmentsEditor.ExpanderButton.Orientation = Orientation.Horizontal;
+        adornmentsEditor!.ExpanderButton!.Orientation = Orientation.Horizontal;
 
         //  adornmentsEditor.ExpanderButton!.Collapsed = true;
 
@@ -165,8 +166,8 @@ public class Arrangement : Scenario
         };
         colorPicker.ApplyStyleChanges ();
 
-        colorPicker.SelectedColor = testFrame.ColorScheme!.Normal.Background;
-        colorPicker.ColorChanged += ColorPicker_ColorChanged;
+        colorPicker.SelectedColor = testFrame.GetAttributeForRole (VisualRole.Normal).Background;
+        colorPicker.ColorChanged += ColorPickerColorChanged;
         overlappedView2.Add (colorPicker);
         overlappedView2.Width = 50;
 
@@ -176,16 +177,22 @@ public class Arrangement : Scenario
             Y = 17,
             Id = "datePicker",
             Title = "Not _Sizeable",
-            ColorScheme = Colors.ColorSchemes ["Toplevel"],
             ShadowStyle = ShadowStyle.Transparent,
             BorderStyle = LineStyle.Double,
             TabStop = TabBehavior.TabGroup,
             Arrangement = ViewArrangement.Movable | ViewArrangement.Overlapped
         };
 
+        datePicker.SetScheme (new Scheme (
+                                          new Attribute (
+                                                         SchemeManager.GetScheme (Schemes.Toplevel).Normal.Foreground.GetBrighterColor (),
+                                                         SchemeManager.GetScheme (Schemes.Toplevel).Normal.Background.GetBrighterColor (),
+                                                         SchemeManager.GetScheme (Schemes.Toplevel).Normal.Style)));
+
         TransparentView transparentView = new ()
         {
-            Id = "transparentView",
+            Title = "Transparent",
+            ViewportSettings = Terminal.Gui.ViewportSettings.Transparent,
             X = 30,
             Y = 5,
             Width = 35,
@@ -198,6 +205,13 @@ public class Arrangement : Scenario
         testFrame.Add (movableSizeableWithProgress);
         testFrame.Add (transparentView);
 
+
+        testFrame.Add (new TransparentView ()
+        {
+            Title = "Transparent|TransparentMouse",
+            ViewportSettings = Terminal.Gui.ViewportSettings.TransparentMouse | Terminal.Gui.ViewportSettings.Transparent
+        });
+
         adornmentsEditor.AutoSelectSuperView = testFrame;
         arrangementEditor.AutoSelectSuperView = testFrame;
 
@@ -210,9 +224,9 @@ public class Arrangement : Scenario
 
         return;
 
-        void ColorPicker_ColorChanged (object sender, ColorEventArgs e)
+        void ColorPickerColorChanged (object sender, ColorEventArgs e)
         {
-            testFrame.ColorScheme = testFrame.ColorScheme! with { Normal = new (testFrame.ColorScheme.Normal.Foreground, e.CurrentValue) };
+            testFrame.SetScheme (testFrame.GetScheme () with { Normal = new (testFrame.GetAttributeForRole (VisualRole.Normal).Foreground, e.CurrentValue) });
         }
     }
 
@@ -225,7 +239,7 @@ public class Arrangement : Scenario
             Width = Dim.Auto (minimumContentDim: 15),
             Height = Dim.Auto (minimumContentDim: 3),
             Title = $"Overlapped{id} _{GetNextHotKey ()}",
-            ColorScheme = Colors.ColorSchemes ["Toplevel"],
+            SchemeName = SchemeManager.SchemesToSchemeName (Schemes.Toplevel),
             Id = $"Overlapped{id}",
             ShadowStyle = ShadowStyle.Transparent,
             BorderStyle = LineStyle.Double,
@@ -251,8 +265,6 @@ public class Arrangement : Scenario
             CanFocus = true,
             TabStop = TabBehavior.TabStop,
             Arrangement = ViewArrangement.Resizable
-
-            //            SuperViewRendersLineCanvas = true
         };
 
         return tiled;
@@ -312,58 +324,30 @@ public class Arrangement : Scenario
 
         return keys;
     }
-}
 
-public class TransparentView : FrameView
-{
-    public TransparentView ()
+    public class TransparentView : FrameView
     {
-        Title = "Transparent View";
-        base.Text = "View.Text.\nThis should be opaque.\nNote how clipping works?";
-        TextFormatter.Alignment = Alignment.Center;
-        TextFormatter.VerticalAlignment = Alignment.Center;
-        Arrangement = ViewArrangement.Overlapped | ViewArrangement.Resizable | ViewArrangement.Movable;
-        ViewportSettings |= Terminal.Gui.ViewportSettings.Transparent | Terminal.Gui.ViewportSettings.TransparentMouse;
-        BorderStyle = LineStyle.RoundedDotted;
-        base.ColorScheme = Colors.ColorSchemes ["Menu"];
-
-        var transparentSubView = new View ()
-        {
-            Text = "Sizable/Movable View with border. Should be opaque. The shadow should be semi-opaque.",
-            Id = "transparentSubView",
-            X = 4,
-            Y = 8,
-            Width = 20,
-            Height = 8,
-            BorderStyle = LineStyle.Dashed,
-            Arrangement = ViewArrangement.Movable | ViewArrangement.Resizable,
-            ShadowStyle = ShadowStyle.Transparent,
-            //ViewportSettings = Terminal.Gui.ViewportSettings.Transparent
-        };
-        transparentSubView.Border.Thickness = new (1, 1, 1, 1);
-        transparentSubView.ColorScheme = Colors.ColorSchemes ["Dialog"];
-
-        Button button = new Button ()
+        public TransparentView ()
         {
-            Title = "_Opaque Shadows No Worky",
-            X = Pos.Center (),
-            Y = 4,
-            ColorScheme = Colors.ColorSchemes ["Dialog"],
-        };
-
-        button.ClearingViewport += (sender, args) =>
-                                   {
-                                       args.Cancel = true;
-                                   };
-
-
-        base.Add (button);
-        base.Add (transparentSubView);
+            Title = "Transparent";
+            Text = "TransparentView Text";
+            X = 0;
+            Y = 0;
+            Width = 30;
+            Height = 10;
+            Arrangement = ViewArrangement.Overlapped | ViewArrangement.Resizable | ViewArrangement.Movable;
+            ViewportSettings |= Terminal.Gui.ViewportSettings.Transparent | Terminal.Gui.ViewportSettings.TransparentMouse;
+
+            Padding!.Thickness = new Thickness (1);
+
+            Add (
+                 new Button ()
+                 {
+                     Title = "_Hi",
+                     X = Pos.Center (),
+                     Y = Pos.Center ()
+                 });
+        }
     }
-
-    /// <inheritdoc />
-    protected override bool OnClearingViewport () { return false; }
-
-    /// <inheritdoc />
-    protected override bool OnMouseEvent (MouseEventArgs mouseEvent) { return false; }
 }
+

+ 11 - 11
UICatalog/Scenarios/Bars.cs → Examples/UICatalog/Scenarios/Bars.cs

@@ -38,7 +38,7 @@ public class Bars : Scenario
             X = Pos.AnchorEnd (),
             Width = Dim.Auto (),
             Height = Dim.Fill (), // Make room for some wide things
-            ColorScheme = Colors.ColorSchemes ["Toplevel"],
+            SchemeName = "Toplevel",
             Source = new ListWrapper<string> (eventSource)
         };
         eventLog.Border.Thickness = new (0, 1, 0, 0);
@@ -81,15 +81,15 @@ public class Bars : Scenario
         };
         menuBarLikeExamples.Add (label);
 
-        bar = new MenuBarv2
-        {
-            Id = "menuBar",
-            X = Pos.Right (label),
-            Y = Pos.Top (label),
-        };
+        //bar = new MenuBarv2
+        //{
+        //    Id = "menuBar",
+        //    X = Pos.Right (label),
+        //    Y = Pos.Top (label),
+        //};
 
-        ConfigMenuBar (bar);
-        menuBarLikeExamples.Add (bar);
+        //ConfigMenuBar (bar);
+        //menuBarLikeExamples.Add (bar);
 
         FrameView menuLikeExamples = new ()
         {
@@ -486,7 +486,7 @@ public class Bars : Scenario
             CanFocus = false
         };
         // This ensures the checkbox state toggles when the hotkey of Title is pressed.
-        shortcut4.Accepting += (sender, args) => args.Cancel = true;
+        shortcut4.Accepting += (sender, args) => args.Handled = true;
 
         bar.Add (shortcut1, shortcut2, shortcut3, line, shortcut4);
     }
@@ -536,7 +536,7 @@ public class Bars : Scenario
                                                     {
                                                         button1.Visible = !button1.Visible;
                                                         button1.Enabled = button1.Visible;
-                                                        e.Cancel = false;
+                                                        e.Handled = true;
                                                     };
 
         bar.Add (new Label

+ 28 - 27
UICatalog/Scenarios/Buttons.cs → Examples/UICatalog/Scenarios/Buttons.cs

@@ -44,21 +44,21 @@ public class Buttons : Scenario
             Width = 45,
             Height = 3,
             Text = "S_wap Default (Size = 45, 3)",
-            ColorScheme = Colors.ColorSchemes ["Error"]
+            SchemeName = "Error"
         };
 
         swapButton.Accepting += (s, e) =>
                              {
-                                 e.Cancel = !swapButton.IsDefault;
+                                 e.Handled = !swapButton.IsDefault;
                                  defaultButton.IsDefault = !defaultButton.IsDefault;
                                  swapButton.IsDefault = !swapButton.IsDefault;
                              };
 
         defaultButton.Accepting += (s, e) =>
                                 {
-                                    e.Cancel = !defaultButton.IsDefault;
+                                    e.Handled = !defaultButton.IsDefault;
 
-                                    if (e.Cancel)
+                                    if (e.Handled)
                                     {
                                         MessageBox.ErrorQuery ("Error", "This button is no longer the Quit button; the Swap Default button is.", "_Ok");
                                     }
@@ -71,7 +71,7 @@ public class Buttons : Scenario
                              {
                                  string btnText = button.Text;
                                  MessageBox.Query ("Message", $"Did you click {txt}?", "Yes", "No");
-                                 e.Cancel = true;
+                                 e.Handled = true;
                              };
         }
 
@@ -80,14 +80,14 @@ public class Buttons : Scenario
 
         View prev = colorButtonsLabel;
 
-        foreach (KeyValuePair<string, ColorScheme> colorScheme in Colors.ColorSchemes)
+        foreach (KeyValuePair<string, Scheme> scheme in SchemeManager.GetSchemesForCurrentTheme ())
         {
             var colorButton = new Button
             {
                 X = Pos.Right (prev),
                 Y = Pos.Y (colorButtonsLabel),
-                Text = $"_{colorScheme.Key}",
-                ColorScheme = colorScheme.Value,
+                Text = $"_{scheme.Key}",
+                SchemeName = scheme.Key,
             };
             DoMessage (colorButton, colorButton.Text);
             main.Add (colorButton);
@@ -114,7 +114,7 @@ public class Buttons : Scenario
         button.Accepting += (s, e) =>
                          {
                              MessageBox.Query ("Message", "Question?", "Yes", "No");
-                             e.Cancel = true;
+                             e.Handled = true;
                          };
 
         var textChanger = new Button { X = 2, Y = Pos.Bottom (button) + 1, Text = "Te_xt Changer" };
@@ -122,7 +122,7 @@ public class Buttons : Scenario
         textChanger.Accepting += (s, e) =>
                               {
                                   textChanger.Text += "!";
-                                  e.Cancel = true;
+                                  e.Handled = true;
                               };
 
         main.Add (
@@ -133,12 +133,13 @@ public class Buttons : Scenario
                       Text = "Lets see if this will move as \"Text Changer\" grows"
                   }
                  );
-        button.Accepting += (sender, args) => { args.Cancel = true; };
+        button.Accepting += (sender, args) => { args.Handled = true; };
 
         var removeButton = new Button
         {
             X = 2, Y = Pos.Bottom (button) + 1,
-            ColorScheme = Colors.ColorSchemes ["Error"], Text = "Remove this button"
+            SchemeName = SchemeManager.SchemesToSchemeName (Schemes.Error),
+            Text = "Remove this button"
         };
         main.Add (removeButton);
 
@@ -146,7 +147,7 @@ public class Buttons : Scenario
         removeButton.Accepting += (s, e) =>
                                {
                                    removeButton.Visible = false;
-                                   e.Cancel = true;
+                                   e.Handled = true;
                                };
 
         var computedFrame = new FrameView
@@ -165,14 +166,14 @@ public class Buttons : Scenario
             X = 0,
             Y = Pos.Center () - 1,
             Width = 30,
-            ColorScheme = Colors.ColorSchemes ["Error"],
+            SchemeName = "Error",
             Text = "Move This \u263b Button v_ia Pos"
         };
 
         moveBtn.Accepting += (s, e) =>
                           {
                               moveBtn.X = moveBtn.Frame.X + 5;
-                              e.Cancel = true;
+                              e.Handled = true;
                           };
         computedFrame.Add (moveBtn);
 
@@ -183,13 +184,13 @@ public class Buttons : Scenario
             X = 0,
             Width = 30,
             Text = "Grow This \u263a Button _via Pos",
-            ColorScheme = Colors.ColorSchemes ["Error"],
+            SchemeName = "Error",
         };
 
         sizeBtn.Accepting += (s, e) =>
                           {
                               sizeBtn.Width = sizeBtn.Frame.Width + 5;
-                              e.Cancel = true;
+                              e.Handled = true;
                           };
         computedFrame.Add (sizeBtn);
 
@@ -204,7 +205,7 @@ public class Buttons : Scenario
         main.Add (absoluteFrame);
 
         // Demonstrates how changing the View.Frame property can move Views
-        var moveBtnA = new Button { ColorScheme = Colors.ColorSchemes ["Error"], Text = "Move This Button via Frame" };
+        var moveBtnA = new Button { SchemeName = "Error", Text = "Move This Button via Frame" };
 
         moveBtnA.Accepting += (s, e) =>
                            {
@@ -214,14 +215,14 @@ public class Buttons : Scenario
                                                      moveBtnA.Frame.Width,
                                                      moveBtnA.Frame.Height
                                                     );
-                               e.Cancel = true;
+                               e.Handled = true;
                            };
         absoluteFrame.Add (moveBtnA);
 
         // Demonstrates how changing the View.Frame property can SIZE Views (#583)
         var sizeBtnA = new Button
         {
-            Y = 2, ColorScheme = Colors.ColorSchemes ["Error"], Text = " ~  s  gui.cs   master ↑_10 = Сохранить"
+            Y = 2, SchemeName = "Error", Text = " ~  s  gui.cs   master ↑_10 = Сохранить"
         };
 
         sizeBtnA.Accepting += (s, e) =>
@@ -232,7 +233,7 @@ public class Buttons : Scenario
                                                      sizeBtnA.Frame.Width + 5,
                                                      sizeBtnA.Frame.Height
                                                     );
-                               e.Cancel = true;
+                               e.Handled = true;
                            };
         absoluteFrame.Add (sizeBtnA);
 
@@ -294,13 +295,13 @@ public class Buttons : Scenario
             X = 2,
             Y = Pos.Bottom (radioGroup) + 1,
             Width = Dim.Width (computedFrame) - 2,
-            ColorScheme = Colors.ColorSchemes ["TopLevel"],
+            SchemeName = "TopLevel",
             Text = mhkb
         };
         moveHotKeyBtn.Accepting += (s, e) =>
                                 {
                                     moveHotKeyBtn.Text = MoveHotkey (moveHotKeyBtn.Text);
-                                    e.Cancel = true;
+                                    e.Handled = true;
                                 };
         main.Add (moveHotKeyBtn);
 
@@ -311,13 +312,13 @@ public class Buttons : Scenario
             X = Pos.Left (absoluteFrame) + 1,
             Y = Pos.Bottom (radioGroup) + 1,
             Width = Dim.Width (absoluteFrame) - 2,
-            ColorScheme = Colors.ColorSchemes ["TopLevel"],
+            SchemeName = "TopLevel",
             Text = muhkb
         };
         moveUnicodeHotKeyBtn.Accepting += (s, e) =>
                                        {
                                            moveUnicodeHotKeyBtn.Text = MoveHotkey (moveUnicodeHotKeyBtn.Text);
-                                           e.Cancel = true;
+                                           e.Handled = true;
                                        };
         main.Add (moveUnicodeHotKeyBtn);
 
@@ -401,7 +402,7 @@ public class Buttons : Scenario
         noRepeatButton.Accepting += (s, e) =>
                                  {
                                      noRepeatButton.Title = $"Accept Cou_nt: {++noRepeatAcceptCount}";
-                                     e.Cancel = true;
+                                     e.Handled = true;
                                  };
         main.Add (label, noRepeatButton);
 
@@ -423,7 +424,7 @@ public class Buttons : Scenario
         repeatButton.Accepting += (s, e) =>
                                {
                                    repeatButton.Title = $"Accept Co_unt: {++acceptCount}";
-                                   e.Cancel = true;
+                                   e.Handled = true;
                                };
 
         var enableCB = new CheckBox

+ 20 - 13
UICatalog/Scenarios/CharacterMap/CharacterMap.cs → Examples/UICatalog/Scenarios/CharacterMap/CharacterMap.cs

@@ -41,7 +41,9 @@ public class CharacterMap : Scenario
             X = 0,
             Y = 1,
             Width = Dim.Fill (Dim.Func (() => _categoryList!.Frame.Width)),
-            Height = Dim.Fill ()
+            Height = Dim.Fill (),
+           // SchemeName = "Base"
+
         };
         top.Add (_charMap);
 
@@ -50,7 +52,8 @@ public class CharacterMap : Scenario
             X = Pos.Right (_charMap) + 1,
             Y = Pos.Y (_charMap),
             HotKeySpecifier = (Rune)'_',
-            Text = "_Jump To:"
+            Text = "_Jump To:",
+            //SchemeName = "Dialog"
         };
         top.Add (jumpLabel);
 
@@ -60,6 +63,7 @@ public class CharacterMap : Scenario
             Y = Pos.Y (_charMap),
             Width = 17,
             Caption = "e.g. 01BE3 or ✈",
+            //SchemeName = "Dialog"
         };
         top.Add (jumpEdit);
 
@@ -79,10 +83,9 @@ public class CharacterMap : Scenario
         {
             X = Pos.Right (jumpEdit) + 1,
             Y = Pos.Y (_charMap),
-            ColorScheme = Colors.ColorSchemes ["error"],
+            SchemeName = "error",
             Text = "err",
             Visible = false
-
         };
         top.Add (_errorLabel);
 
@@ -92,6 +95,7 @@ public class CharacterMap : Scenario
             X = Pos.Right (_charMap), 
             Y = Pos.Bottom (jumpLabel), 
             Height = Dim.Fill (),
+            //SchemeName = "Dialog"
         };
         _categoryList.FullRowSelect = true;
         _categoryList.MultiSelect = false;
@@ -146,13 +150,13 @@ public class CharacterMap : Scenario
 
         top.Add (_categoryList);
 
-        var menu = new MenuBar
+        var menu = new MenuBarv2
         {
             Menus =
             [
                 new (
                      "_File",
-                     new MenuItem []
+                     new MenuItemv2 []
                      {
                          new (
                               "_Quit",
@@ -163,7 +167,7 @@ public class CharacterMap : Scenario
                     ),
                 new (
                      "_Options",
-                     new [] { CreateMenuShowWidth () }
+                     new MenuItemv2 [] { CreateMenuShowWidth () }
                     )
             ]
         };
@@ -256,7 +260,7 @@ public class CharacterMap : Scenario
             _charMap.SetFocus ();
 
             // Cancel the event to prevent ENTER from being handled elsewhere
-            e.Cancel = true;
+            e.Handled = true;
         }
     }
 
@@ -305,16 +309,19 @@ public class CharacterMap : Scenario
                    );
     }
 
-    private MenuItem CreateMenuShowWidth ()
+    private MenuItemv2 CreateMenuShowWidth ()
     {
-        var item = new MenuItem { Title = "_Show Glyph Width" };
-        item.CheckType |= MenuItemCheckStyle.Checked;
-        item.Checked = _charMap?.ShowGlyphWidths;
+        CheckBox cb = new ()
+        {
+            Title = "_Show Glyph Width",
+            CheckedState = _charMap!.ShowGlyphWidths ? CheckState.Checked : CheckState.None
+        };
+        var item = new MenuItemv2 { CommandView = cb };
         item.Action += () =>
                        {
                            if (_charMap is { })
                            {
-                               _charMap.ShowGlyphWidths = (bool)(item.Checked = !item.Checked)!;
+                               _charMap.ShowGlyphWidths = cb.CheckedState == CheckState.Checked;
                            }
                        };
 

+ 0 - 0
UICatalog/Scenarios/ChineseUI.cs → Examples/UICatalog/Scenarios/ChineseUI.cs


+ 0 - 0
UICatalog/Scenarios/ClassExplorer.cs → Examples/UICatalog/Scenarios/ClassExplorer.cs


+ 1 - 1
UICatalog/Scenarios/Clipping.cs → Examples/UICatalog/Scenarios/Clipping.cs

@@ -120,7 +120,7 @@ public class Clipping : Scenario
             Height = Dim.Auto (minimumContentDim: 4),
             Width = Dim.Auto (minimumContentDim: 14),
             Title = $"Overlapped{id} _{GetNextHotKey ()}",
-            ColorScheme = Colors.ColorSchemes ["Toplevel"],
+            SchemeName = SchemeManager.SchemesToSchemeName(Schemes.Toplevel),
             Id = $"Overlapped{id}",
             ShadowStyle = ShadowStyle.Transparent,
             BorderStyle = LineStyle.Double,

+ 2 - 2
UICatalog/Scenarios/CollectionNavigatorTester.cs → Examples/UICatalog/Scenarios/CollectionNavigatorTester.cs

@@ -58,7 +58,7 @@ public class CollectionNavigatorTester : Scenario
         "$200.00",
         "$210.99",
         "$$",
-        "appricot",
+        "apricot",
         "arm",
         "丗丙业丞",
         "丗丙丛",
@@ -82,7 +82,7 @@ public class CollectionNavigatorTester : Scenario
     public override void Main ()
     {
         Application.Init ();
-        top = new Toplevel { ColorScheme = Colors.ColorSchemes ["Base"] };
+        top = new Toplevel { SchemeName = "Base" };
 
         var allowMarking = new MenuItem ("Allow _Marking", "", null)
         {

+ 14 - 12
UICatalog/Scenarios/ColorPicker.cs → Examples/UICatalog/Scenarios/ColorPicker.cs

@@ -45,7 +45,8 @@ public class ColorPickers : Scenario
         ///////////////////////////////////////
 
         // Foreground ColorPicker.
-        foregroundColorPicker = new ColorPicker {
+        foregroundColorPicker = new ColorPicker
+        {
             Title = "_Foreground Color",
             BorderStyle = LineStyle.Single,
             Width = Dim.Percent (50)
@@ -154,7 +155,7 @@ public class ColorPickers : Scenario
                                                     backgroundColorPicker.Visible = false;
 
                                                     // Switching to 16 colors
-                                                    ForegroundColor_ColorChanged (null,null);
+                                                    ForegroundColor_ColorChanged (null, null);
                                                     BackgroundColor_ColorChanged (null, null);
                                                 }
                                                 else
@@ -182,10 +183,10 @@ public class ColorPickers : Scenario
         var cbShowTextFields = new CheckBox ()
         {
             Text = "Show _Text Fields",
-            Y = Pos.Bottom (rgColorModel)+1,
+            Y = Pos.Bottom (rgColorModel) + 1,
             Width = Dim.Auto (),
             Height = Dim.Auto (),
-            CheckedState = foregroundColorPicker.Style.ShowTextFields ? CheckState.Checked: CheckState.UnChecked,
+            CheckedState = foregroundColorPicker.Style.ShowTextFields ? CheckState.Checked : CheckState.UnChecked,
         };
 
         cbShowTextFields.CheckedStateChanging += (_, e) =>
@@ -217,8 +218,8 @@ public class ColorPickers : Scenario
         app.Add (cbShowName);
 
         // Set default colors.
-        foregroundColorPicker.SelectedColor = _demoView.SuperView.ColorScheme.Normal.Foreground.GetClosestNamedColor16 ();
-        backgroundColorPicker.SelectedColor = _demoView.SuperView.ColorScheme.Normal.Background.GetClosestNamedColor16 ();
+        foregroundColorPicker.SelectedColor = _demoView.SuperView!.GetAttributeForRole (VisualRole.Normal).Foreground.GetClosestNamedColor16 ();
+        backgroundColorPicker.SelectedColor = _demoView.SuperView.GetAttributeForRole (VisualRole.Normal).Background.GetClosestNamedColor16 ();
 
         Application.Run (app);
         app.Dispose ();
@@ -250,7 +251,7 @@ public class ColorPickers : Scenario
     /// <summary>Update a color label from his ColorPicker.</summary>
     private void UpdateColorLabel (Label label, Color color)
     {
-        label.ClearViewport ();
+        label.ClearViewport (null);
 
         label.Text =
             $"{color} ({(int)color}) #{color.R:X2}{color.G:X2}{color.B:X2}";
@@ -259,7 +260,7 @@ public class ColorPickers : Scenario
     /// <summary>Update Demo Label.</summary>
     private void UpdateDemoLabel ()
     {
-        _demoView.ColorScheme = new ColorScheme
+        _demoView.SetScheme (new Scheme
         {
             Normal = new Attribute (
                                     foregroundColorPicker.Visible ?
@@ -269,14 +270,15 @@ public class ColorPickers : Scenario
                                         backgroundColorPicker.SelectedColor :
                                         backgroundColorPicker16.SelectedColor
                                    )
-        };
+        });
     }
 
     public override List<Key> GetDemoKeyStrokes ()
     {
-        var keys = new List<Key> ();
-
-        keys.Add (Key.B.WithAlt);
+        List<Key> keys =
+        [
+            Key.B.WithAlt
+        ];
 
         for (int i = 0; i < 200; i++)
         {

+ 0 - 0
UICatalog/Scenarios/CombiningMarks.cs → Examples/UICatalog/Scenarios/CombiningMarks.cs


+ 1 - 1
UICatalog/Scenarios/ComboBoxIteration.cs → Examples/UICatalog/Scenarios/ComboBoxIteration.cs

@@ -26,7 +26,7 @@ public class ComboBoxIteration : Scenario
 
         var lbComboBox = new Label
         {
-            ColorScheme = Colors.ColorSchemes ["TopLevel"],
+            SchemeName = "TopLevel",
             X = Pos.Right (lbListView) + 1,
             Width = Dim.Percent (40)
         };

+ 17 - 17
UICatalog/Scenarios/ComputedLayout.cs → Examples/UICatalog/Scenarios/ComputedLayout.cs

@@ -30,7 +30,7 @@ public class ComputedLayout : Scenario
             Y = 0,
             Width = Dim.Fill (),
             Height = 1,
-            ColorScheme = Colors.ColorSchemes ["Error"],
+            SchemeName = "Error",
             Text = rule
         };
 
@@ -45,7 +45,7 @@ public class ComputedLayout : Scenario
             Y = 0,
             Width = 1,
             Height = Dim.Fill (),
-            ColorScheme = Colors.ColorSchemes ["Error"],
+            SchemeName = "Error",
             Text = vrule
         };
 
@@ -103,7 +103,7 @@ public class ComputedLayout : Scenario
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
-                           ColorScheme = Colors.ColorSchemes ["Dialog"],
+                           SchemeName = "Dialog",
                            Text = $"{i++}-{txt}"
                        }
                       );
@@ -115,7 +115,7 @@ public class ComputedLayout : Scenario
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
-                           ColorScheme = Colors.ColorSchemes ["Dialog"],
+                           SchemeName = "Dialog",
                            Text = $"{i++}-{txt}"
                        }
                       );
@@ -127,7 +127,7 @@ public class ComputedLayout : Scenario
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
-                           ColorScheme = Colors.ColorSchemes ["Dialog"],
+                           SchemeName = "Dialog",
                            Text = $"{i++}-{txt}"
                        }
                       );
@@ -139,7 +139,7 @@ public class ComputedLayout : Scenario
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
-                           ColorScheme = Colors.ColorSchemes ["Dialog"],
+                           SchemeName = "Dialog",
                            Text = $"{i++}-{txt}"
                        }
                       );
@@ -165,7 +165,7 @@ public class ComputedLayout : Scenario
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
-                           ColorScheme = Colors.ColorSchemes ["Dialog"],
+                           SchemeName = "Dialog",
                            Text = $"{i++}-{txt}"
                        }
                       );
@@ -177,7 +177,7 @@ public class ComputedLayout : Scenario
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
-                           ColorScheme = Colors.ColorSchemes ["Dialog"],
+                           SchemeName = "Dialog",
                            Text = $"{i++}-{txt}"
                        }
                       );
@@ -189,7 +189,7 @@ public class ComputedLayout : Scenario
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
-                           ColorScheme = Colors.ColorSchemes ["Dialog"],
+                           SchemeName = "Dialog",
                            Text = $"{i++}-{txt}"
                        }
                       );
@@ -201,7 +201,7 @@ public class ComputedLayout : Scenario
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
-                           ColorScheme = Colors.ColorSchemes ["Dialog"],
+                           SchemeName = "Dialog",
                            Text = $"{i++}-{txt}"
                        }
                       );
@@ -231,7 +231,7 @@ public class ComputedLayout : Scenario
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
-                           ColorScheme = Colors.ColorSchemes ["Dialog"],
+                           SchemeName = "Dialog",
                            Text = $"{i++}-{txt}"
                        }
                       );
@@ -243,7 +243,7 @@ public class ComputedLayout : Scenario
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
-                           ColorScheme = Colors.ColorSchemes ["Dialog"],
+                           SchemeName = "Dialog",
                            Text = $"{i++}-{txt}"
                        }
                       );
@@ -255,7 +255,7 @@ public class ComputedLayout : Scenario
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
-                           ColorScheme = Colors.ColorSchemes ["Dialog"],
+                           SchemeName = "Dialog",
                            Text = $"{i++}-{txt}"
                        }
                       );
@@ -267,7 +267,7 @@ public class ComputedLayout : Scenario
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
-                           ColorScheme = Colors.ColorSchemes ["Dialog"],
+                           SchemeName = "Dialog",
                            Text = $"{i++}-{txt}"
                        }
                       );
@@ -281,7 +281,7 @@ public class ComputedLayout : Scenario
             Y = Pos.Percent (50),
             Width = Dim.Percent (80),
             Height = Dim.Percent (10),
-            ColorScheme = Colors.ColorSchemes ["TopLevel"]
+            SchemeName = "TopLevel"
         };
 
         textView.Text =
@@ -384,7 +384,7 @@ public class ComputedLayout : Scenario
         {
             Text = "This Label should be the 3rd to last line (AnchorEnd (3)).",
             TextAlignment = Alignment.Center,
-            ColorScheme = Colors.ColorSchemes ["Menu"],
+            SchemeName = "Menu",
             Width = Dim.Fill (5),
             X = 5,
             Y = Pos.AnchorEnd (3)
@@ -398,7 +398,7 @@ public class ComputedLayout : Scenario
             Text =
                 "This TextField should be the 4th to last line (AnchorEnd (3) - 1).",
             TextAlignment = Alignment.Start,
-            ColorScheme = Colors.ColorSchemes ["Menu"],
+            SchemeName = "Menu",
             Width = Dim.Fill (5),
             X = 5,
             Y = Pos.AnchorEnd (3) - 1 // Pos.Combine

+ 67 - 45
UICatalog/Scenarios/ConfigurationEditor.cs → Examples/UICatalog/Scenarios/ConfigurationEditor.cs

@@ -7,41 +7,36 @@ using Terminal.Gui;
 
 namespace UICatalog.Scenarios;
 
-[ScenarioMetadata ("Configuration Editor", "Edits Terminal.Gui Config Files.")]
+[ScenarioMetadata ("Configuration Editor", "Editor of Terminal.Gui Config Files")]
 [ScenarioCategory ("TabView")]
 [ScenarioCategory ("Colors")]
 [ScenarioCategory ("Files and IO")]
 [ScenarioCategory ("TextView")]
+[ScenarioCategory ("Configuration")]
 public class ConfigurationEditor : Scenario
 {
-    private static ColorScheme _editorColorScheme = new ()
-    {
-        Normal = new Attribute (Color.Red, Color.White),
-        Focus = new Attribute (Color.Red, Color.Black),
-        HotFocus = new Attribute (Color.BrightRed, Color.Black),
-        HotNormal = new Attribute (Color.Magenta, Color.White)
-    };
+    //private static Scheme _editorScheme = SchemeManager.GetScheme (Schemes.Base);
 
-    private static Action? _editorColorSchemeChanged;
+    //private static Action? _editorSchemeChanged;
     private TabView? _tabView;
     private Shortcut? _lenShortcut;
 
-    [SerializableConfigurationProperty (Scope = typeof (AppScope))]
-    public static ColorScheme EditorColorScheme
-    {
-        get => _editorColorScheme;
-        set
-        {
-            _editorColorScheme = value;
-            _editorColorSchemeChanged?.Invoke ();
-        }
-    }
+    //[ConfigurationProperty (Scope = typeof (AppSettingsScope))]
+    //public static Scheme EditorScheme
+    //{
+    //    get => _editorScheme;
+    //    set
+    //    {
+    //        _editorScheme = value;
+    //        _editorSchemeChanged?.Invoke ();
+    //    }
+    //}
 
     public override void Main ()
     {
         Application.Init ();
 
-        Toplevel top = new ();
+        Window? win = new ();
 
         _lenShortcut = new Shortcut ()
         {
@@ -77,34 +72,49 @@ public class ConfigurationEditor : Scenario
             Height = Dim.Fill (Dim.Func (() => statusBar.Frame.Height))
         };
 
-        top.Add (_tabView, statusBar);
+        win.Add (_tabView, statusBar);
 
-        top.Loaded += (s, a) =>
+        win.Loaded += (s, a) =>
                       {
                           Open ();
-                          _editorColorSchemeChanged?.Invoke ();
+                          //_editorSchemeChanged?.Invoke ();
                       };
 
-        void OnEditorColorSchemeChanged ()
-        {
-            if (Application.Top is { })
-            {
-                return;
-            }
 
-            foreach (ConfigTextView t in _tabView.SubViews.Where (v => v is ConfigTextView).Cast<ConfigTextView> ())
-            {
-                t.ColorScheme = EditorColorScheme;
-            }
-        }
 
-        _editorColorSchemeChanged += OnEditorColorSchemeChanged;
+        //_editorSchemeChanged += OnEditorSchemeChanged;
 
-        Application.Run (top);
-        _editorColorSchemeChanged -= OnEditorColorSchemeChanged;
-        top.Dispose ();
+        ConfigurationManager.Applied += ConfigurationManagerOnApplied;
+
+        Application.Run (win);
+        //_editorSchemeChanged -= OnEditorSchemeChanged;
+        win.Dispose ();
+        win = null;
 
         Application.Shutdown ();
+
+        return;
+
+        //void OnEditorSchemeChanged ()
+        //{
+        //    if (Application.Top is { })
+        //    {
+        //        return;
+        //    }
+
+        //    foreach (ConfigTextView t in _tabView.SubViews.OfType<ConfigTextView> ())
+        //    {
+        //        t.SetScheme (EditorScheme);
+        //    }
+        //}
+
+        void ConfigurationManagerOnApplied (object? sender, ConfigurationManagerEventArgs e)
+        {
+            if (win is { })
+            {
+                win.SetNeedsDraw ();
+            }
+        }
     }
     public void Save ()
     {
@@ -116,7 +126,7 @@ public class ConfigurationEditor : Scenario
 
     private void Open ()
     {
-        foreach (var config in ConfigurationManager.Settings!.Sources)
+        foreach (var config in ConfigurationManager.SourcesManager!.Sources)
         {
             var homeDir = $"{Environment.GetFolderPath (Environment.SpecialFolder.UserProfile)}";
             var fileInfo = new FileInfo (config.Value.Replace ("~", homeDir));
@@ -125,10 +135,16 @@ public class ConfigurationEditor : Scenario
             {
                 Title = config.Value.StartsWith ("resource://") ? fileInfo.Name : config.Value,
                 Width = Dim.Fill (),
-                Height = Dim.Fill(),
+                Height = Dim.Fill (),
                 FileInfo = fileInfo,
             };
 
+            if (config.Value == "HardCoded")
+            {
+                editor.Title = "HardCoded";
+
+            }
+
             Tab tab = new Tab ()
             {
                 View = editor,
@@ -160,7 +176,7 @@ public class ConfigurationEditor : Scenario
 
     private void Quit ()
     {
-        foreach (ConfigTextView editor in _tabView!.Tabs.Select(v =>
+        foreach (ConfigTextView editor in _tabView!.Tabs.Select (v =>
                                                                 {
                                                                     if (v.View is ConfigTextView ctv)
                                                                     {
@@ -244,14 +260,20 @@ public class ConfigurationEditor : Scenario
                 return;
             }
 
-            if (FileInfo!.FullName.Contains ("RuntimeConfig"))
+            if (FileInfo!.FullName.Contains ("HardCoded"))
+            {
+                Text = ConfigurationManager.GetHardCodedConfig ()!;
+                ReadOnly = true;
+                Enabled = true;
+            }
+            else if (FileInfo!.FullName.Contains ("RuntimeConfig"))
             {
                 Text = ConfigurationManager.RuntimeConfig!;
-
-            } else if (!FileInfo.Exists)
+            }
+            else if (!FileInfo.Exists)
             {
                 // Create empty config file
-                Text = ConfigurationManager.GetEmptyJson ();
+                Text = ConfigurationManager.GetEmptyConfig ();
             }
             else
             {

+ 271 - 0
Examples/UICatalog/Scenarios/ContextMenus.cs

@@ -0,0 +1,271 @@
+using System.Globalization;
+using JetBrains.Annotations;
+using Terminal.Gui;
+
+namespace UICatalog.Scenarios;
+
+[ScenarioMetadata ("ContextMenus", "Context Menu Sample.")]
+[ScenarioCategory ("Menus")]
+public class ContextMenus : Scenario
+{
+    [CanBeNull]
+    private PopoverMenu _winContextMenu;
+    private TextField _tfTopLeft, _tfTopRight, _tfMiddle, _tfBottomLeft, _tfBottomRight;
+    private readonly List<CultureInfo> _cultureInfos = Application.SupportedCultures;
+    private readonly Key _winContextMenuKey = Key.Space.WithCtrl;
+
+    public override void Main ()
+    {
+        // Init
+        Application.Init ();
+
+        // Setup - Create a top-level application window and configure it.
+        Window appWindow = new ()
+        {
+            Title = GetQuitKeyAndName (),
+            Arrangement = ViewArrangement.Fixed,
+            SchemeName = "Toplevel"
+        };
+
+        var text = "Context Menu";
+        var width = 20;
+
+        CreateWinContextMenu ();
+
+        var label = new Label
+        {
+            X = Pos.Center (), Y = 1, Text = $"Press '{_winContextMenuKey}' to open the Window context menu."
+        };
+        appWindow.Add (label);
+
+        label = new ()
+        {
+            X = Pos.Center (),
+            Y = Pos.Bottom (label),
+            Text = $"Press '{PopoverMenu.DefaultKey}' to open the TextField context menu."
+        };
+        appWindow.Add (label);
+
+        _tfTopLeft = new () { Id = "_tfTopLeft", Width = width, Text = text };
+        appWindow.Add (_tfTopLeft);
+
+        _tfTopRight = new () { Id = "_tfTopRight", X = Pos.AnchorEnd (width), Width = width, Text = text };
+        appWindow.Add (_tfTopRight);
+
+        _tfMiddle = new () { Id = "_tfMiddle", X = Pos.Center (), Y = Pos.Center (), Width = width, Text = text };
+        appWindow.Add (_tfMiddle);
+
+        _tfBottomLeft = new () { Id = "_tfBottomLeft", Y = Pos.AnchorEnd (1), Width = width, Text = text };
+        appWindow.Add (_tfBottomLeft);
+
+        _tfBottomRight = new () { Id = "_tfBottomRight", X = Pos.AnchorEnd (width), Y = Pos.AnchorEnd (1), Width = width, Text = text };
+        appWindow.Add (_tfBottomRight);
+
+        appWindow.KeyDown += OnAppWindowOnKeyDown;
+        appWindow.MouseClick += OnAppWindowOnMouseClick;
+
+        CultureInfo originalCulture = Thread.CurrentThread.CurrentUICulture;
+        appWindow.Closed += (s, e) => { Thread.CurrentThread.CurrentUICulture = originalCulture; };
+
+        // Run - Start the application.
+        Application.Run (appWindow);
+        appWindow.Dispose ();
+        appWindow.KeyDown -= OnAppWindowOnKeyDown;
+        appWindow.MouseClick -= OnAppWindowOnMouseClick;
+        _winContextMenu?.Dispose ();
+
+        // Shutdown - Calling Application.Shutdown is required.
+        Application.Shutdown ();
+
+        return;
+
+        void OnAppWindowOnMouseClick (object s, MouseEventArgs e)
+        {
+            if (e.Flags == MouseFlags.Button3Clicked)
+            {
+                // ReSharper disable once AccessToDisposedClosure
+                _winContextMenu?.MakeVisible (e.ScreenPosition);
+                e.Handled = true;
+            }
+        }
+
+        void OnAppWindowOnKeyDown (object s, Key e)
+        {
+            if (e == _winContextMenuKey)
+            {
+                // ReSharper disable once AccessToDisposedClosure
+                _winContextMenu?.MakeVisible ();
+                e.Handled = true;
+            }
+        }
+    }
+
+    private void CreateWinContextMenu ()
+    {
+        if (_winContextMenu is { })
+        {
+            _winContextMenu.Dispose ();
+            _winContextMenu = null;
+        }
+
+        _winContextMenu = new (
+                               [
+                                   new MenuItemv2
+                                   {
+                                       Title = "C_ultures",
+                                       SubMenu = GetSupportedCultureMenu (),
+                                   },
+                                   new Line (),
+                                   new MenuItemv2
+                                   {
+                                       Title = "_Configuration...",
+                                       HelpText = "Show configuration",
+                                       Action = () => MessageBox.Query (
+                                                                        50,
+                                                                        10,
+                                                                        "Configuration",
+                                                                        "This would be a configuration dialog",
+                                                                        "Ok"
+                                                                       )
+                                   },
+                                   new MenuItemv2
+                                   {
+                                       Title = "M_ore options",
+                                       SubMenu = new (
+                                                      [
+                                                          new MenuItemv2
+                                                          {
+                                                              Title = "_Setup...",
+                                                              HelpText = "Perform setup",
+                                                              Action = () => MessageBox
+                                                                           .Query (
+                                                                                   50,
+                                                                                   10,
+                                                                                   "Setup",
+                                                                                   "This would be a setup dialog",
+                                                                                   "Ok"
+                                                                                  ),
+                                                              Key = Key.T.WithCtrl
+                                                          },
+                                                          new MenuItemv2
+                                                          {
+                                                              Title = "_Maintenance...",
+                                                              HelpText = "Maintenance mode",
+                                                              Action = () => MessageBox
+                                                                           .Query (
+                                                                                   50,
+                                                                                   10,
+                                                                                   "Maintenance",
+                                                                                   "This would be a maintenance dialog",
+                                                                                   "Ok"
+                                                                                  )
+                                                          }
+                                                      ])
+                                   },
+                                   new Line (),
+                                   new MenuItemv2
+                                   {
+                                       Title = "_Quit",
+                                       Action = () => Application.RequestStop ()
+                                   }
+                               ])
+        {
+            Key = _winContextMenuKey
+        };
+    }
+
+    private Menuv2 GetSupportedCultureMenu ()
+    {
+        List<MenuItemv2> supportedCultures = [];
+        int index = -1;
+
+        foreach (CultureInfo c in _cultureInfos)
+        {
+            MenuItemv2 culture = new ();
+
+            culture.CommandView = new CheckBox { CanFocus = false };
+
+            if (index == -1)
+            {
+                // Create English because GetSupportedCutures doesn't include it
+                culture.Id = "_English";
+                culture.Title = "_English";
+                culture.HelpText = "en-US";
+
+                ((CheckBox)culture.CommandView).CheckedState =
+                    Thread.CurrentThread.CurrentUICulture.Name == "en-US" ? CheckState.Checked : CheckState.UnChecked;
+                CreateAction (supportedCultures, culture);
+                supportedCultures.Add (culture);
+
+                index++;
+                culture = new ();
+                culture.CommandView = new CheckBox { CanFocus = false };
+            }
+
+            culture.Id = $"_{c.Parent.EnglishName}";
+            culture.Title = $"_{c.Parent.EnglishName}";
+            culture.HelpText = c.Name;
+
+            ((CheckBox)culture.CommandView).CheckedState =
+                Thread.CurrentThread.CurrentUICulture.Name == culture.HelpText ? CheckState.Checked : CheckState.UnChecked;
+            CreateAction (supportedCultures, culture);
+            supportedCultures.Add (culture);
+        }
+
+        Menuv2 menu = new (supportedCultures.ToArray ());
+
+        return menu;
+
+        void CreateAction (List<MenuItemv2> cultures, MenuItemv2 culture)
+        {
+            culture.Action += () =>
+                              {
+                                  Thread.CurrentThread.CurrentUICulture = new (culture.HelpText);
+
+                                  foreach (MenuItemv2 item in cultures)
+                                  {
+                                      ((CheckBox)item.CommandView).CheckedState =
+                                          Thread.CurrentThread.CurrentUICulture.Name == item.HelpText ? CheckState.Checked : CheckState.UnChecked;
+                                  }
+                              };
+        }
+    }
+
+    public override List<Key> GetDemoKeyStrokes ()
+    {
+        List<Key> keys = new ();
+
+        keys.Add (Key.F10.WithShift);
+        keys.Add (Key.Esc);
+
+        keys.Add (Key.Space.WithCtrl);
+        keys.Add (Key.CursorDown);
+        keys.Add (Key.Enter);
+
+        keys.Add (Key.F10.WithShift);
+        keys.Add (Key.Esc);
+
+        keys.Add (Key.Tab);
+
+        keys.Add (Key.Space.WithCtrl);
+        keys.Add (Key.CursorDown);
+        keys.Add (Key.CursorDown);
+        keys.Add (Key.Enter);
+
+        keys.Add (Key.F10.WithShift);
+        keys.Add (Key.Esc);
+
+        keys.Add (Key.Tab);
+
+        keys.Add (Key.Space.WithCtrl);
+        keys.Add (Key.CursorDown);
+        keys.Add (Key.CursorDown);
+        keys.Add (Key.CursorDown);
+        keys.Add (Key.Enter);
+
+        keys.Add (Key.F10.WithShift);
+        keys.Add (Key.Esc);
+
+        return keys;
+    }
+}

+ 0 - 0
UICatalog/Scenarios/CsvEditor.cs → Examples/UICatalog/Scenarios/CsvEditor.cs


+ 0 - 0
UICatalog/Scenarios/DatePickers.cs → Examples/UICatalog/Scenarios/DatePickers.cs


+ 6 - 6
UICatalog/Scenarios/Dialogs.cs → Examples/UICatalog/Scenarios/Dialogs.cs

@@ -177,7 +177,7 @@ public class Dialogs : Scenario
 
         var buttonPressedLabel = new Label
         {
-            X = Pos.Center (), Y = Pos.Bottom (frame) + 5, ColorScheme = Colors.ColorSchemes ["Error"], Text = " "
+            X = Pos.Center (), Y = Pos.Bottom (frame) + 5, SchemeName = "Error", Text = " "
         };
 
         var showDialogButton = new Button
@@ -198,7 +198,7 @@ public class Dialogs : Scenario
                                                                      );
                                        Application.Run (dlg);
                                        dlg.Dispose ();
-                                       e.Cancel = true;
+                                       e.Handled = true;
                                    };
 
         app.Add (showDialogButton);
@@ -258,7 +258,7 @@ public class Dialogs : Scenario
                 button.Accepting += (s, e) =>
                                  {
                                      clicked = buttonId;
-                                     e.Cancel = true;
+                                     e.Handled = true;
                                      Application.RequestStop ();
                                  };
                 buttons.Add (button);
@@ -313,7 +313,7 @@ public class Dialogs : Scenario
                                                {
                                                    clicked = buttonId;
                                                    Application.RequestStop ();
-                                                   e.Cancel = true;
+                                                   e.Handled = true;
                                                };
                               buttons.Add (button);
                               dialog.AddButton (button);
@@ -322,7 +322,7 @@ public class Dialogs : Scenario
                               //{
                               //    button.TabIndex = buttons [buttons.Count - 2].TabIndex + 1;
                               //}
-                              e.Cancel = true;
+                              e.Handled = true;
                           };
             dialog.Add (add);
 
@@ -340,7 +340,7 @@ public class Dialogs : Scenario
                                       button.Text += char.ConvertFromUtf32 (CODE_POINT);
                                   }
 
-                                  e.Cancel = true;
+                                  e.Handled = true;
                               };
             dialog.Add (addChar);
 

+ 5 - 5
UICatalog/Scenarios/DimAutoDemo.cs → Examples/UICatalog/Scenarios/DimAutoDemo.cs

@@ -74,7 +74,7 @@ public class DimAutoDemo : Scenario
             Y = Pos.Bottom (textEdit) + 1,
             Width = Dim.Auto (DimAutoStyle.Text, 1),
             Height = Dim.Auto (DimAutoStyle.Text, 8),
-            ColorScheme = Colors.ColorSchemes ["Error"],
+            SchemeName = "Error",
             TextDirection = TextDirection.TopBottom_LeftRight
         };
         vlabel.Id = "vlabel";
@@ -87,7 +87,7 @@ public class DimAutoDemo : Scenario
             Y = Pos.Bottom (textEdit),
             Width = Dim.Auto (DimAutoStyle.Text, 20),
             Height = Dim.Auto (DimAutoStyle.Text, 1),
-            ColorScheme = Colors.ColorSchemes ["Error"]
+            SchemeName = "Error"
         };
         hlabel.Id = "hlabel";
         dimAutoFrameView.Add (hlabel);
@@ -98,7 +98,7 @@ public class DimAutoDemo : Scenario
             Y = Pos.Bottom (hlabel) + 1,
             Width = 20,
             Height = Dim.Auto (),
-            ColorScheme = Colors.ColorSchemes ["Error"],
+            SchemeName = "Error",
             Title = "W: 20, H: Auto",
             BorderStyle = LineStyle.Rounded
         };
@@ -111,7 +111,7 @@ public class DimAutoDemo : Scenario
             Y = Pos.Bottom (hlabel) + 1,
             Width = Dim.Auto (),
             Height = 5,
-            ColorScheme = Colors.ColorSchemes ["Error"],
+            SchemeName = "Error",
             Title = "W: Auto, H: 5",
             BorderStyle = LineStyle.Rounded
         };
@@ -124,7 +124,7 @@ public class DimAutoDemo : Scenario
             Y = Pos.Bottom (hlabel) + 1,
             Width = Dim.Auto (),
             Height = Dim.Auto (),
-            ColorScheme = Colors.ColorSchemes ["Error"],
+            SchemeName = "Error",
             Title = "W: Auto, H: Auto",
             BorderStyle = LineStyle.Rounded
         };

+ 5 - 4
UICatalog/Scenarios/DynamicMenuBar.cs → Examples/UICatalog/Scenarios/DynamicMenuBar.cs

@@ -1,11 +1,12 @@
-using System;
-using System.Collections.ObjectModel;
+using System.Collections.ObjectModel;
 using System.ComponentModel;
 using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Text;
 using Terminal.Gui;
 
+#pragma warning disable CS0618 // Type or member is obsolete
+
 namespace UICatalog.Scenarios;
 
 [ScenarioMetadata ("Dynamic MenuBar", "Demonstrates how to change a MenuBar dynamically.")]
@@ -593,7 +594,7 @@ public class DynamicMenuBar : Scenario
 
             var lblMenuBar = new Label
             {
-                ColorScheme = Colors.ColorSchemes ["Dialog"],
+                SchemeName = "Dialog",
                 TextAlignment = Alignment.Center,
                 X = Pos.Right (btnPrevious) + 1,
                 Y = Pos.Top (btnPrevious),
@@ -631,7 +632,7 @@ public class DynamicMenuBar : Scenario
 
             _lstMenus = new ()
             {
-                ColorScheme = Colors.ColorSchemes ["Dialog"],
+                SchemeName = "Dialog",
                 X = Pos.Right (btnPrevious) + 1,
                 Y = Pos.Top (btnPrevious) + 2,
                 Width = lblMenuBar.Width,

+ 4 - 4
UICatalog/Scenarios/DynamicStatusBar.cs → Examples/UICatalog/Scenarios/DynamicStatusBar.cs

@@ -282,7 +282,7 @@ public class DynamicStatusBar : Scenario
 
             _lstItems = new ListView
             {
-                ColorScheme = Colors.ColorSchemes ["Dialog"],
+                SchemeName = "Dialog",
                 Y = Pos.Top (btnAddStatusBar) + 2,
                 Width = Dim.Fill () - Dim.Width (btnAdd) - 1,
                 Height = Dim.Fill (),
@@ -318,7 +318,7 @@ public class DynamicStatusBar : Scenario
 
                                   if (statusItem != null)
                                   {
-                                      Shortcut [] items = _statusBar.SubViews.Cast<Shortcut> ().ToArray ();
+                                      Shortcut [] items = _statusBar.SubViews.OfType<Shortcut> ().ToArray ();
 
                                       if (i > 0)
                                       {
@@ -341,7 +341,7 @@ public class DynamicStatusBar : Scenario
 
                                     if (statusItem != null)
                                     {
-                                        Shortcut [] items = _statusBar.SubViews.Cast<Shortcut> ().ToArray ();
+                                        Shortcut [] items = _statusBar.SubViews.OfType<Shortcut> ().ToArray ();
 
                                         if (i < items.Length - 1)
                                         {
@@ -521,7 +521,7 @@ public class DynamicStatusBar : Scenario
 
                 if (statusItem != null)
                 {
-                    foreach (Shortcut si in _statusBar.SubViews.Cast<Shortcut> ())
+                    foreach (Shortcut si in _statusBar.SubViews.OfType<Shortcut> ())
                     {
                         DataContext.Items.Add (new DynamicStatusItemList (si.Title, si));
                     }

+ 5 - 5
UICatalog/Scenarios/Editor.cs → Examples/UICatalog/Scenarios/Editor.cs

@@ -225,12 +225,12 @@ public class Editor : Scenario
                                                          "",
                                                          () =>
                                                          {
-                                                             _miForceMinimumPosToZero.Checked =
-                                                                 _forceMinimumPosToZero =
-                                                                     !_forceMinimumPosToZero;
+                                                             //_miForceMinimumPosToZero.Checked =
+                                                             //    _forceMinimumPosToZero =
+                                                             //        !_forceMinimumPosToZero;
 
-                                                             _textView.ContextMenu.ForceMinimumPosToZero =
-                                                                 _forceMinimumPosToZero;
+                                                             //_textView.ContextMenu.ForceMinimumPosToZero =
+                                                             //    _forceMinimumPosToZero;
                                                          }
                                                         )
                          {

+ 6 - 5
UICatalog/Scenarios/Editors/AdornmentEditor.cs → Examples/UICatalog/Scenarios/EditorsAndHelpers/AdornmentEditor.cs

@@ -60,9 +60,9 @@ public class AdornmentEditor : EditorBase
 
                 _adornment.Initialized += (sender, args) =>
                                           {
-                                              ColorScheme? cs = _adornment.ColorScheme;
-                                              _foregroundColorPicker.SelectedColor = cs!.Normal.Foreground.GetClosestNamedColor16 ();
-                                              _backgroundColorPicker.SelectedColor = cs.Normal.Background.GetClosestNamedColor16 ();
+                                              Scheme? cs = _adornment.GetScheme ();
+                                              _foregroundColorPicker.SelectedColor = _adornment.GetAttributeForRole (VisualRole.Normal).Foreground.GetClosestNamedColor16 ();
+                                              _backgroundColorPicker.SelectedColor = _adornment.GetAttributeForRole (VisualRole.Normal).Background.GetClosestNamedColor16 ();
                                           };
             }
 
@@ -220,10 +220,11 @@ public class AdornmentEditor : EditorBase
                        return;
                    }
 
-                   AdornmentToEdit.ColorScheme = new (AdornmentToEdit.ColorScheme)
+                   AdornmentToEdit.SetScheme (new (AdornmentToEdit.GetScheme ())
                    {
                        Normal = new (_foregroundColorPicker.SelectedColor, _backgroundColorPicker.SelectedColor)
-                   };
+                   })
+                   ;
                };
     }
 

+ 2 - 0
UICatalog/Scenarios/Editors/AdornmentsEditor.cs → Examples/UICatalog/Scenarios/EditorsAndHelpers/AdornmentsEditor.cs

@@ -18,6 +18,8 @@ public class AdornmentsEditor : EditorBase
         ExpanderButton!.Orientation = Orientation.Horizontal;
 
         Initialized += AdornmentsEditor_Initialized;
+
+        SchemeName = "Dialog";
     }
 
     public MarginEditor? MarginEditor { get; set; }

+ 195 - 0
Examples/UICatalog/Scenarios/EditorsAndHelpers/AllViewsView.cs

@@ -0,0 +1,195 @@
+using Terminal.Gui;
+
+namespace UICatalog.Scenarios;
+
+public class AllViewsView : View
+{
+    private const int MAX_VIEW_FRAME_HEIGHT = 25;
+    public AllViewsView ()
+    {
+        CanFocus = true;
+        BorderStyle = LineStyle.Heavy;
+        Arrangement = ViewArrangement.Resizable;
+        HorizontalScrollBar.AutoShow = false;
+        VerticalScrollBar.AutoShow = true;
+
+        SubViewsLaidOut += (sender, _) =>
+                           {
+                               if (sender is View sendingView)
+                               {
+                                   sendingView.SetContentSize (new Size (sendingView.Viewport.Width, sendingView.GetHeightRequiredForSubViews ()));
+                               }
+                           };
+
+        AddCommand (Command.Up, () => ScrollVertical (-1));
+        AddCommand (Command.Down, () => ScrollVertical (1));
+        AddCommand (Command.PageUp, () => ScrollVertical (-SubViews.OfType<FrameView> ().First ().Frame.Height));
+        AddCommand (Command.PageDown, () => ScrollVertical (SubViews.OfType<FrameView> ().First ().Frame.Height));
+        AddCommand (
+                    Command.Start,
+                    () =>
+                    {
+                        Viewport = Viewport with { Y = 0 };
+
+                        return true;
+                    });
+        AddCommand (
+                    Command.End,
+                    () =>
+                    {
+                        Viewport = Viewport with { Y = GetContentSize ().Height };
+
+                        return true;
+                    });
+
+        AddCommand (Command.ScrollDown, () => ScrollVertical (1));
+        AddCommand (Command.ScrollUp, () => ScrollVertical (-1));
+        AddCommand (Command.ScrollRight, () => ScrollHorizontal (1));
+        AddCommand (Command.ScrollLeft, () => ScrollHorizontal (-1));
+
+        KeyBindings.Add (Key.CursorUp, Command.Up);
+        KeyBindings.Add (Key.CursorDown, Command.Down);
+        KeyBindings.Add (Key.CursorLeft, Command.Left);
+        KeyBindings.Add (Key.CursorRight, Command.Right);
+        KeyBindings.Add (Key.PageUp, Command.PageUp);
+        KeyBindings.Add (Key.PageDown, Command.PageDown);
+        KeyBindings.Add (Key.Home, Command.Start);
+        KeyBindings.Add (Key.End, Command.End);
+        KeyBindings.Add (PopoverMenu.DefaultKey, Command.Context);
+
+        MouseBindings.Add (MouseFlags.Button1DoubleClicked, Command.Accept);
+        MouseBindings.ReplaceCommands (MouseFlags.Button3Clicked, Command.Context);
+        MouseBindings.ReplaceCommands (MouseFlags.Button1Clicked | MouseFlags.ButtonCtrl, Command.Context);
+        MouseBindings.Add (MouseFlags.WheeledDown, Command.ScrollDown);
+        MouseBindings.Add (MouseFlags.WheeledUp, Command.ScrollUp);
+        MouseBindings.Add (MouseFlags.WheeledLeft, Command.ScrollLeft);
+        MouseBindings.Add (MouseFlags.WheeledRight, Command.ScrollRight);
+    }
+
+    /// <inheritdoc />
+    public override void EndInit ()
+    {
+        base.EndInit ();
+
+        var allClasses = GetAllViewClassesCollection ();
+
+        View? previousView = null;
+
+        foreach (Type? type in allClasses)
+        {
+            View? view = CreateView (type);
+
+            if (view is { })
+            {
+                FrameView? frame = new ()
+                {
+                    CanFocus = true,
+                    Title = type.Name,
+                    Y = previousView is { } ? Pos.Bottom (previousView) : 0,
+                    Width = Dim.Fill (),
+                    Height = Dim.Auto (DimAutoStyle.Content, maximumContentDim: MAX_VIEW_FRAME_HEIGHT)
+                };
+                frame.Add (view);
+                Add (frame);
+                previousView = frame;
+            }
+        }
+    }
+
+    private static List<Type> GetAllViewClassesCollection ()
+    {
+        List<Type> types = typeof (View).Assembly.GetTypes ()
+                                        .Where (
+                                                myType => myType is { IsClass: true, IsAbstract: false, IsPublic: true }
+                                                          && myType.IsSubclassOf (typeof (View)))
+                                        .ToList ();
+
+        types.Add (typeof (View));
+
+        return types;
+    }
+
+    private View? CreateView (Type type)
+    {
+        // If we are to create a generic Type
+        if (type.IsGenericType)
+        {
+            // For each of the <T> arguments
+            List<Type> typeArguments = new ();
+
+            // use <object> or the original type if applicable
+            foreach (Type arg in type.GetGenericArguments ())
+            {
+                if (arg.IsValueType && Nullable.GetUnderlyingType (arg) == null)
+                {
+                    typeArguments.Add (arg);
+                }
+                else
+                {
+                    typeArguments.Add (typeof (object));
+                }
+            }
+
+            // And change what type we are instantiating from MyClass<T> to MyClass<object> or MyClass<T>
+            type = type.MakeGenericType (typeArguments.ToArray ());
+        }
+
+        // Ensure the type does not contain any generic parameters
+        if (type.ContainsGenericParameters)
+        {
+            Logging.Warning ($"Cannot create an instance of {type} because it contains generic parameters.");
+
+            //throw new ArgumentException ($"Cannot create an instance of {type} because it contains generic parameters.");
+            return null;
+        }
+
+        // Instantiate view
+        var view = (View)Activator.CreateInstance (type)!;
+        var demoText = "This, that, and the other thing.";
+
+        if (view is IDesignable designable)
+        {
+            designable.EnableForDesign (ref demoText);
+        }
+        else
+        {
+            view.Text = demoText;
+            view.Title = "_Test Title";
+        }
+
+        view.X = 0;
+        view.Y = 0;
+
+        view.Initialized += OnViewInitialized;
+
+        return view;
+    }
+
+    private void OnViewInitialized (object? sender, EventArgs e)
+    {
+        if (sender is not View view)
+        {
+            return;
+        }
+
+        if (view.Width == Dim.Absolute (0) || view.Width is null)
+        {
+            view.Width = Dim.Fill ();
+        }
+
+        if (view.Height == Dim.Absolute (0) || view.Height is null)
+        {
+            view.Height = MAX_VIEW_FRAME_HEIGHT - 2;
+        }
+
+        if (!view.Width.Has<DimAuto> (out _))
+        {
+            view.Width = Dim.Fill ();
+        }
+
+        if (!view.Height.Has<DimAuto> (out _))
+        {
+            view.Height = Dim.Auto (minimumContentDim: MAX_VIEW_FRAME_HEIGHT - 2, maximumContentDim: MAX_VIEW_FRAME_HEIGHT - 2);
+        }
+    }
+}

+ 2 - 2
UICatalog/Scenarios/Editors/ArrangementEditor.cs → Examples/UICatalog/Scenarios/EditorsAndHelpers/ArrangementEditor.cs

@@ -107,12 +107,12 @@ public sealed class ArrangementEditor : EditorBase
             if (ViewToEdit.Arrangement.HasFlag (ViewArrangement.Overlapped))
             {
                 ViewToEdit.ShadowStyle = ShadowStyle.Transparent;
-                ViewToEdit.ColorScheme = Colors.ColorSchemes ["Toplevel"];
+                ViewToEdit.SchemeName = "Toplevel";
             }
             else
             {
                 ViewToEdit.ShadowStyle = ShadowStyle.None;
-                ViewToEdit.ColorScheme = ViewToEdit!.SuperView!.ColorScheme;
+                ViewToEdit.SchemeName = ViewToEdit!.SuperView!.SchemeName;
             }
 
             if (ViewToEdit.Arrangement.HasFlag (ViewArrangement.Movable))

+ 1 - 1
UICatalog/Scenarios/Editors/BorderEditor.cs → Examples/UICatalog/Scenarios/EditorsAndHelpers/BorderEditor.cs

@@ -77,7 +77,7 @@ public class BorderEditor : AdornmentEditor
         void OnRbBorderStyleOnSelectedItemChanged (object? s, SelectedItemChangedArgs args)
         {
             LineStyle prevBorderStyle = AdornmentToEdit!.BorderStyle;
-            ((Border)AdornmentToEdit).LineStyle = (LineStyle)args.SelectedItem;
+            ((Border)AdornmentToEdit).LineStyle = (LineStyle)args.SelectedItem!;
 
             if (((Border)AdornmentToEdit).LineStyle == LineStyle.None)
             {

+ 4 - 4
UICatalog/Scenarios/Editors/DimEditor.cs → Examples/UICatalog/Scenarios/EditorsAndHelpers/DimEditor.cs

@@ -27,11 +27,11 @@ public class DimEditor : EditorBase
     {
         if (ViewToEdit is { })
         {
-            ViewToEdit.SubViewsLaidOut += (_, _) => { OnUpdateSettings (); };
+            ViewToEdit.SubViewsLaidOut += (_, _) => { OnUpdateLayoutSettings (); };
         }
     }
 
-    protected override void OnUpdateSettings ()
+    protected override void OnUpdateLayoutSettings ()
     {
         Enabled = ViewToEdit is not Adornment;
 
@@ -114,7 +114,7 @@ public class DimEditor : EditorBase
             {
                 // ignored
             }
-            args.Cancel = true;
+            args.Handled = true;
         };
         Add (_valueEdit);
 
@@ -130,7 +130,7 @@ public class DimEditor : EditorBase
 
     private void DimChanged ()
     {
-        if (ViewToEdit == null || UpdatingSettings)
+        if (ViewToEdit == null || UpdatingLayoutSettings)
         {
             return;
         }

+ 7 - 5
UICatalog/Scenarios/Editors/EditorBase.cs → Examples/UICatalog/Scenarios/EditorsAndHelpers/EditorBase.cs

@@ -48,6 +48,8 @@ public abstract class EditorBase : View
 
         AddCommand (Command.Accept, () => true);
 
+        SchemeName = "Dialog";
+
     }
 
     private readonly ExpanderButton? _expanderButton;
@@ -65,15 +67,15 @@ public abstract class EditorBase : View
         }
     }
 
-    public bool UpdatingSettings { get; private set; } = false;
+    public bool UpdatingLayoutSettings { get; private set; } = false;
 
     private void View_LayoutComplete (object? sender, LayoutEventArgs e)
     {
-        UpdatingSettings = true;
+        UpdatingLayoutSettings = true;
 
-        OnUpdateSettings ();
+        OnUpdateLayoutSettings ();
 
-        UpdatingSettings = false;
+        UpdatingLayoutSettings = false;
     }
 
 
@@ -108,7 +110,7 @@ public abstract class EditorBase : View
 
     protected virtual void OnViewToEditChanged () { }
 
-    protected virtual void OnUpdateSettings () { }
+    protected virtual void OnUpdateLayoutSettings () { }
 
     /// <summary>
     ///     Gets or sets whether the DimEditor should automatically select the View to edit

+ 0 - 0
UICatalog/Scenarios/Editors/EventLog.cs → Examples/UICatalog/Scenarios/EditorsAndHelpers/EventLog.cs


+ 0 - 0
UICatalog/Scenarios/Editors/ExpanderButton.cs → Examples/UICatalog/Scenarios/EditorsAndHelpers/ExpanderButton.cs


+ 0 - 0
UICatalog/Scenarios/Editors/LayoutEditor.cs → Examples/UICatalog/Scenarios/EditorsAndHelpers/LayoutEditor.cs


+ 90 - 0
Examples/UICatalog/Scenarios/EditorsAndHelpers/MarginEditor.cs

@@ -0,0 +1,90 @@
+#nullable enable
+using System;
+using Terminal.Gui;
+
+namespace UICatalog.Scenarios;
+
+public class MarginEditor : AdornmentEditor
+{
+    public MarginEditor ()
+    {
+        Title = "_Margin";
+        Initialized += MarginEditor_Initialized;
+        AdornmentChanged += MarginEditor_AdornmentChanged;
+    }
+
+    private RadioGroup? _rgShadow;
+
+    private FlagSelector? _flagSelectorTransparent;
+
+    private void MarginEditor_AdornmentChanged (object? sender, EventArgs e)
+    {
+        if (AdornmentToEdit is { })
+        {
+            _rgShadow!.SelectedItem = (int)((Margin)AdornmentToEdit).ShadowStyle;
+        }
+
+        if (AdornmentToEdit is { })
+        {
+            _flagSelectorTransparent!.Value = (uint)((Margin)AdornmentToEdit).ViewportSettings;
+        }
+    }
+
+    private void MarginEditor_Initialized (object? sender, EventArgs e)
+    {
+        _rgShadow = new RadioGroup
+        {
+            X = 0,
+            Y = Pos.Bottom (SubViews.ElementAt(SubViews.Count-1)),
+
+            SuperViewRendersLineCanvas = true,
+            Title = "_Shadow",
+            BorderStyle = LineStyle.Single,
+            RadioLabels = Enum.GetNames (typeof (ShadowStyle)),
+        };
+
+        if (AdornmentToEdit is { })
+        {
+            _rgShadow.SelectedItem = (int)((Margin)AdornmentToEdit).ShadowStyle;
+        }
+
+        _rgShadow.SelectedItemChanged += (_, args) =>
+                                        {
+                                            ((Margin)AdornmentToEdit!).ShadowStyle = (ShadowStyle)args.SelectedItem!;
+                                        };
+
+        Add (_rgShadow);
+
+        var flags = new Dictionary<uint, string> ()
+        {
+            { (uint)Terminal.Gui.ViewportSettings.Transparent, "Transparent" },
+            { (uint)Terminal.Gui.ViewportSettings.TransparentMouse, "TransparentMouse" }
+        };
+
+        _flagSelectorTransparent = new FlagSelector ()
+        {
+            X = 0,
+            Y = Pos.Bottom (_rgShadow),
+
+            SuperViewRendersLineCanvas = true,
+            Title = "_ViewportSettings",
+            BorderStyle = LineStyle.Single,
+        };
+        _flagSelectorTransparent.SetFlags(flags.AsReadOnly ());
+
+
+        Add (_flagSelectorTransparent);
+
+        if (AdornmentToEdit is { })
+        {
+            _flagSelectorTransparent.Value = (uint)((Margin)AdornmentToEdit).ViewportSettings;
+        }
+
+        _flagSelectorTransparent.ValueChanged += (_, args) =>
+                                                 {
+                                                     ((Margin)AdornmentToEdit!).ViewportSettings = (Terminal.Gui.ViewportSettings)args.CurrentValue!;
+                                                 };
+
+
+    }
+}

+ 0 - 0
UICatalog/Scenarios/Editors/PaddingEditor.cs → Examples/UICatalog/Scenarios/EditorsAndHelpers/PaddingEditor.cs


+ 3 - 3
UICatalog/Scenarios/Editors/PosEditor.cs → Examples/UICatalog/Scenarios/EditorsAndHelpers/PosEditor.cs

@@ -23,7 +23,7 @@ public class PosEditor : EditorBase
     private RadioGroup? _posRadioGroup;
     private TextField? _valueEdit;
 
-    protected override void OnUpdateSettings ()
+    protected override void OnUpdateLayoutSettings ()
     {
         Enabled = ViewToEdit is not Adornment;
 
@@ -115,7 +115,7 @@ public class PosEditor : EditorBase
                                         // ignored
                                     }
 
-                                    args.Cancel = true;
+                                    args.Handled = true;
                                 };
         Add (_valueEdit);
 
@@ -130,7 +130,7 @@ public class PosEditor : EditorBase
 
     private void PosChanged ()
     {
-        if (ViewToEdit == null || UpdatingSettings)
+        if (ViewToEdit == null || UpdatingLayoutSettings)
         {
             return;
         }

+ 47 - 0
Examples/UICatalog/Scenarios/EditorsAndHelpers/SchemeViewer.cs

@@ -0,0 +1,47 @@
+#nullable enable
+using Terminal.Gui;
+
+namespace UICatalog.Scenarios;
+
+public class SchemeViewer : FrameView
+{
+    public SchemeViewer ()
+    {
+        TabStop = TabBehavior.TabStop;
+        CanFocus = true;
+        Height = Dim.Auto ();
+        Width = Dim.Auto ();
+
+        VisualRoleViewer? prevRoleViewer = null;
+
+        foreach (VisualRole role in Enum.GetValues<VisualRole> ())
+        {
+            var roleViewer = new VisualRoleViewer
+            {
+                Role = role
+            };
+
+            if (prevRoleViewer is { })
+            {
+                roleViewer.Y = Pos.Bottom (prevRoleViewer);
+            }
+
+            base.Add (roleViewer);
+
+            prevRoleViewer = roleViewer;
+        }
+    }
+
+    /// <inheritdoc/>
+    protected override bool OnSettingSchemeName (in string? currentName, ref string? newName)
+    {
+        Title = newName ?? "null";
+
+        foreach (VisualRoleViewer v in SubViews.OfType<VisualRoleViewer> ())
+        {
+            v.SchemeName = newName;
+        }
+
+        return base.OnSettingSchemeName (in currentName, ref newName);
+    }
+}

+ 121 - 0
Examples/UICatalog/Scenarios/EditorsAndHelpers/ThemeViewer.cs

@@ -0,0 +1,121 @@
+#nullable enable
+using Terminal.Gui;
+
+namespace UICatalog.Scenarios;
+
+public class ThemeViewer : FrameView
+{
+    public ThemeViewer ()
+    {
+        BorderStyle = LineStyle.Rounded;
+        Border!.Thickness = new (0, 1, 0, 0);
+        Margin!.Thickness = new (0, 0, 1, 0);
+        TabStop = TabBehavior.TabStop;
+        CanFocus = true;
+        Height = Dim.Fill ();
+        Width = Dim.Auto ();
+        Title = $"{ThemeManager.Theme}";
+
+        VerticalScrollBar.AutoShow = true;
+        HorizontalScrollBar.AutoShow = true;
+
+        SubViewsLaidOut += (sender, _) =>
+                           {
+                               if (sender is View sendingView)
+                               {
+                                   sendingView.SetContentSize (new Size (sendingView.GetContentSize ().Width, sendingView.GetHeightRequiredForSubViews ()));
+                               }
+                           };
+
+        AddCommand (Command.Up, () => ScrollVertical (-1));
+        AddCommand (Command.Down, () => ScrollVertical (1));
+
+        AddCommand (Command.PageUp, () => ScrollVertical (-SubViews.OfType<SchemeViewer> ().First ().Frame.Height));
+        AddCommand (Command.PageDown, () => ScrollVertical (SubViews.OfType<SchemeViewer> ().First ().Frame.Height));
+
+        AddCommand (
+                    Command.Start,
+                    () =>
+                    {
+                        Viewport = Viewport with { Y = 0 };
+
+                        return true;
+                    });
+
+        AddCommand (
+                    Command.End,
+                    () =>
+                    {
+                        Viewport = Viewport with { Y = GetContentSize ().Height };
+
+                        return true;
+                    });
+
+        AddCommand (Command.ScrollDown, () => ScrollVertical (1));
+        AddCommand (Command.ScrollUp, () => ScrollVertical (-1));
+        AddCommand (Command.ScrollRight, () => ScrollHorizontal (1));
+        AddCommand (Command.ScrollLeft, () => ScrollHorizontal (-1));
+
+        KeyBindings.Add (Key.CursorUp, Command.Up);
+        KeyBindings.Add (Key.CursorDown, Command.Down);
+        KeyBindings.Add (Key.CursorLeft, Command.Left);
+        KeyBindings.Add (Key.CursorRight, Command.Right);
+        KeyBindings.Add (Key.PageUp, Command.PageUp);
+        KeyBindings.Add (Key.PageDown, Command.PageDown);
+        KeyBindings.Add (Key.Home, Command.Start);
+        KeyBindings.Add (Key.End, Command.End);
+        KeyBindings.Add (PopoverMenu.DefaultKey, Command.Context);
+
+        MouseBindings.Add (MouseFlags.Button1DoubleClicked, Command.Accept);
+        MouseBindings.ReplaceCommands (MouseFlags.Button3Clicked, Command.Context);
+        MouseBindings.ReplaceCommands (MouseFlags.Button1Clicked | MouseFlags.ButtonCtrl, Command.Context);
+        MouseBindings.Add (MouseFlags.WheeledDown, Command.ScrollDown);
+        MouseBindings.Add (MouseFlags.WheeledUp, Command.ScrollUp);
+        MouseBindings.Add (MouseFlags.WheeledLeft, Command.ScrollLeft);
+        MouseBindings.Add (MouseFlags.WheeledRight, Command.ScrollRight);
+
+        SchemeViewer? prevSchemeViewer = null;
+
+        foreach (KeyValuePair<string, Scheme?> kvp in SchemeManager.GetSchemesForCurrentTheme ())
+        {
+            var schemeViewer = new SchemeViewer
+            {
+                Id = $"schemeViewer for {kvp.Key}",
+                SchemeName = kvp.Key
+            };
+
+            if (prevSchemeViewer is { })
+            {
+                schemeViewer.Y = Pos.Bottom (prevSchemeViewer);
+            }
+
+            prevSchemeViewer = schemeViewer;
+            base.Add (schemeViewer);
+        }
+
+        ThemeManager.ThemeChanged += OnThemeManagerOnThemeChanged;
+    }
+
+    /// <inheritdoc/>
+    protected override void OnFocusedChanged (View? previousFocused, View? focused)
+    {
+        base.OnFocusedChanged (previousFocused, focused);
+
+        if (focused is { })
+        {
+            SchemeName = focused.Title;
+        }
+    }
+
+    private void OnThemeManagerOnThemeChanged (object? _, StringPropertyEventArgs args) { Title = args.NewString!; }
+
+    protected override void Dispose (bool disposing)
+    {
+        if (disposing)
+        {
+            ThemeManager.ThemeChanged -= OnThemeManagerOnThemeChanged;
+        }
+
+        base.Dispose (disposing);
+    }
+}

+ 127 - 0
Examples/UICatalog/Scenarios/EditorsAndHelpers/ViewPropertiesEditor.cs

@@ -0,0 +1,127 @@
+#nullable enable
+using Terminal.Gui;
+
+namespace UICatalog.Scenarios;
+
+public class ViewPropertiesEditor : EditorBase
+{
+    private CheckBox? _canFocusCheckBox;
+    private CheckBox? _enabledCheckBox;
+    private RadioGroup? _orientation;
+    private TextView? _text;
+
+    /// <inheritdoc/>
+    public override void EndInit ()
+    {
+        _canFocusCheckBox = new ()
+        {
+            Title = "CanFocus",
+            X = 0,
+            Y = 0,
+            CheckedState = ViewToEdit is { } ? ViewToEdit.CanFocus ? CheckState.Checked : CheckState.UnChecked : CheckState.UnChecked
+        };
+
+        _canFocusCheckBox.CheckedStateChanged += (s, args) =>
+                                                 {
+                                                     if (ViewToEdit is { })
+                                                     {
+                                                         ViewToEdit.CanFocus = _canFocusCheckBox.CheckedState == CheckState.Checked;
+                                                     }
+                                                 };
+        base.Add (_canFocusCheckBox);
+
+        _enabledCheckBox = new ()
+        {
+            Title = "Enabled",
+            X = Pos.Right (_canFocusCheckBox) + 1,
+            Y = Pos.Top (_canFocusCheckBox),
+            CheckedState = ViewToEdit is { } ? ViewToEdit.Enabled ? CheckState.Checked : CheckState.UnChecked : CheckState.UnChecked
+        };
+
+        _enabledCheckBox.CheckedStateChanged += (s, args) =>
+                                                {
+                                                    if (ViewToEdit is { })
+                                                    {
+                                                        ViewToEdit.Enabled = _enabledCheckBox.CheckedState == CheckState.Checked;
+                                                    }
+                                                };
+        base.Add (_enabledCheckBox);
+
+        Label label = new () { X = Pos.Right (_enabledCheckBox) + 1, Y = Pos.Top (_enabledCheckBox), Text = "Orientation:" };
+
+        _orientation = new ()
+        {
+            X = Pos.Right (label) + 1,
+            Y = Pos.Top (label),
+            RadioLabels = new [] { "Horizontal", "Vertical" },
+            Orientation = Orientation.Horizontal
+        };
+
+        _orientation.SelectedItemChanged += (s, selected) =>
+                                            {
+                                                if (ViewToEdit is IOrientation orientatedView)
+                                                {
+                                                    orientatedView.Orientation = (Orientation)_orientation.SelectedItem!;
+                                                }
+                                            };
+        Add (label, _orientation);
+
+        label = new () { X = 0, Y = Pos.Bottom (_orientation), Text = "Text:" };
+
+        _text = new ()
+        {
+            X = Pos.Right (label) + 1,
+            Y = Pos.Top (label),
+            Width = Dim.Fill (),
+            Height = Dim.Auto (minimumContentDim: 2),
+            Text = "This is demo text"
+        };
+
+        _text.ContentsChanged += (s, e) =>
+                                 {
+                                     if (ViewToEdit is { })
+                                     {
+                                         ViewToEdit.Text = _text.Text;
+                                     }
+                                 };
+
+        Add (label, _text);
+
+        base.EndInit ();
+    }
+
+    public string DemoText
+    {
+        get
+        {
+            if (_text is null)
+            {
+                return string.Empty;
+            }
+
+            return _text!.Text;
+        }
+        set => _text!.Text = value;
+    }
+
+    protected override void OnViewToEditChanged ()
+    {
+        Enabled = ViewToEdit is not Adornment;
+
+        if (ViewToEdit is { } and not Adornment)
+        {
+            _canFocusCheckBox!.CheckedState = ViewToEdit.CanFocus ? CheckState.Checked : CheckState.UnChecked;
+            _enabledCheckBox!.CheckedState = ViewToEdit.Enabled ? CheckState.Checked : CheckState.UnChecked;
+
+            if (ViewToEdit is IOrientation orientatedView)
+            {
+                _orientation!.SelectedItem = (int)orientatedView.Orientation;
+                _orientation.Enabled = true;
+            }
+            else
+            {
+                _orientation!.Enabled = false;
+            }
+        }
+    }
+}

+ 41 - 20
UICatalog/Scenarios/Editors/ViewportSettingsEditor.cs → Examples/UICatalog/Scenarios/EditorsAndHelpers/ViewportSettingsEditor.cs

@@ -17,19 +17,13 @@ public sealed class ViewportSettingsEditor : EditorBase
         Initialized += ViewportSettingsEditor_Initialized;
     }
 
-    protected override void OnUpdateSettings ()
+    protected override void OnViewToEditChanged ()
     {
         foreach (View subview in SubViews)
         {
             subview.Enabled = ViewToEdit is not Adornment;
         }
 
-        if (ViewToEdit is null)
-        { }
-    }
-
-    protected override void OnViewToEditChanged ()
-    {
         if (ViewToEdit is { } and not Adornment)
         {
             //ViewToEdit.VerticalScrollBar.AutoShow = true;
@@ -62,7 +56,11 @@ public sealed class ViewportSettingsEditor : EditorBase
                                                    ? CheckState.Checked
                                                    : CheckState.UnChecked;
 
-            _cbTransparent!.CheckedState = ViewToEdit.ViewportSettings.HasFlag(Terminal.Gui.ViewportSettings.Transparent)
+            _cbTransparent!.CheckedState = ViewToEdit.ViewportSettings.HasFlag (Terminal.Gui.ViewportSettings.Transparent)
+                                               ? CheckState.Checked
+                                               : CheckState.UnChecked;
+
+            _cbTransparentMouse!.CheckedState = ViewToEdit.ViewportSettings.HasFlag (Terminal.Gui.ViewportSettings.TransparentMouse)
                                                ? CheckState.Checked
                                                : CheckState.UnChecked;
 
@@ -82,6 +80,7 @@ public sealed class ViewportSettingsEditor : EditorBase
     private CheckBox? _cbClearContentOnly;
     private CheckBox? _cbClipContentOnly;
     private CheckBox? _cbTransparent;
+    private CheckBox? _cbTransparentMouse;
     private CheckBox? _cbVerticalScrollBar;
     private CheckBox? _cbAutoShowVerticalScrollBar;
     private CheckBox? _cbHorizontalScrollBar;
@@ -89,7 +88,7 @@ public sealed class ViewportSettingsEditor : EditorBase
 
     private void ViewportSettingsEditor_Initialized (object? s, EventArgs e)
     {
-        _cbAllowNegativeX = new()
+        _cbAllowNegativeX = new ()
         {
             Title = "Allow X < 0",
             CanFocus = true
@@ -97,7 +96,7 @@ public sealed class ViewportSettingsEditor : EditorBase
 
         Add (_cbAllowNegativeX);
 
-        _cbAllowNegativeY = new()
+        _cbAllowNegativeY = new ()
         {
             Title = "Allow Y < 0",
             CanFocus = true
@@ -105,7 +104,7 @@ public sealed class ViewportSettingsEditor : EditorBase
 
         Add (_cbAllowNegativeY);
 
-        _cbAllowXGreaterThanContentWidth = new()
+        _cbAllowXGreaterThanContentWidth = new ()
         {
             Title = "Allow X > Content Width",
             Y = Pos.Bottom (_cbAllowNegativeX),
@@ -141,7 +140,7 @@ public sealed class ViewportSettingsEditor : EditorBase
             }
         }
 
-        _cbAllowYGreaterThanContentHeight = new()
+        _cbAllowYGreaterThanContentHeight = new ()
         {
             Title = "Allow Y > Content Height",
             X = Pos.Right (_cbAllowXGreaterThanContentWidth) + 1,
@@ -187,7 +186,7 @@ public sealed class ViewportSettingsEditor : EditorBase
             Y = Pos.Bottom (_cbAllowYGreaterThanContentHeight)
         };
 
-        _contentSizeWidth = new()
+        _contentSizeWidth = new ()
         {
             X = Pos.Right (labelContentSize) + 1,
             Y = Pos.Top (labelContentSize),
@@ -215,7 +214,7 @@ public sealed class ViewportSettingsEditor : EditorBase
             Y = Pos.Top (labelContentSize)
         };
 
-        _contentSizeHeight = new()
+        _contentSizeHeight = new ()
         {
             X = Pos.Right (labelComma) + 1,
             Y = Pos.Top (labelContentSize),
@@ -236,7 +235,7 @@ public sealed class ViewportSettingsEditor : EditorBase
             ViewToEdit?.SetContentSize (ViewToEdit.GetContentSize () with { Height = e.NewValue });
         }
 
-        _cbClearContentOnly = new()
+        _cbClearContentOnly = new ()
         {
             Title = "ClearContentOnly",
             X = 0,
@@ -257,7 +256,7 @@ public sealed class ViewportSettingsEditor : EditorBase
             }
         }
 
-        _cbClipContentOnly = new()
+        _cbClipContentOnly = new ()
         {
             Title = "ClipContentOnly",
             X = Pos.Right (_cbClearContentOnly) + 1,
@@ -299,7 +298,28 @@ public sealed class ViewportSettingsEditor : EditorBase
             }
         }
 
-        _cbVerticalScrollBar = new()
+        _cbTransparentMouse = new ()
+        {
+            Title = "TransparentMouse",
+            X = Pos.Right (_cbTransparent) + 1,
+            Y = Pos.Bottom (labelContentSize),
+            CanFocus = true
+        };
+        _cbTransparentMouse.CheckedStateChanging += TransparentMouseToggle;
+
+        void TransparentMouseToggle (object? sender, CancelEventArgs<CheckState> e)
+        {
+            if (e.NewValue == CheckState.Checked)
+            {
+                ViewToEdit!.ViewportSettings |= Terminal.Gui.ViewportSettings.TransparentMouse;
+            }
+            else
+            {
+                ViewToEdit!.ViewportSettings &= ~Terminal.Gui.ViewportSettings.TransparentMouse;
+            }
+        }
+
+        _cbVerticalScrollBar = new ()
         {
             Title = "VerticalScrollBar",
             X = 0,
@@ -313,7 +333,7 @@ public sealed class ViewportSettingsEditor : EditorBase
             ViewToEdit!.VerticalScrollBar.Visible = e.NewValue == CheckState.Checked;
         }
 
-        _cbAutoShowVerticalScrollBar = new()
+        _cbAutoShowVerticalScrollBar = new ()
         {
             Title = "AutoShow",
             X = Pos.Right (_cbVerticalScrollBar) + 1,
@@ -327,7 +347,7 @@ public sealed class ViewportSettingsEditor : EditorBase
             ViewToEdit!.VerticalScrollBar.AutoShow = e.NewValue == CheckState.Checked;
         }
 
-        _cbHorizontalScrollBar = new()
+        _cbHorizontalScrollBar = new ()
         {
             Title = "HorizontalScrollBar",
             X = 0,
@@ -341,7 +361,7 @@ public sealed class ViewportSettingsEditor : EditorBase
             ViewToEdit!.HorizontalScrollBar.Visible = e.NewValue == CheckState.Checked;
         }
 
-        _cbAutoShowHorizontalScrollBar = new()
+        _cbAutoShowHorizontalScrollBar = new ()
         {
             Title = "AutoShow ",
             X = Pos.Right (_cbHorizontalScrollBar) + 1,
@@ -363,6 +383,7 @@ public sealed class ViewportSettingsEditor : EditorBase
              _cbClearContentOnly,
              _cbClipContentOnly,
              _cbTransparent,
+             _cbTransparentMouse,
              _cbVerticalScrollBar,
              _cbHorizontalScrollBar,
              _cbAutoShowVerticalScrollBar,

+ 39 - 0
Examples/UICatalog/Scenarios/EditorsAndHelpers/VisualRoleViewer.cs

@@ -0,0 +1,39 @@
+#nullable enable
+using Terminal.Gui;
+
+namespace UICatalog.Scenarios;
+
+public class VisualRoleViewer : View
+{
+    public VisualRoleViewer ()
+    {
+        CanFocus = false;
+        Height = Dim.Auto (DimAutoStyle.Text);
+        Width = Dim.Auto (DimAutoStyle.Text);
+    }
+
+    private VisualRole? _role;
+
+    public VisualRole? Role
+    {
+        get => _role;
+        set
+        {
+            _role = value;
+            Text = $"{Role?.ToString ()?.PadRight (10)} {SchemeName}";
+        }
+    }
+
+    /// <inheritdoc/>
+    protected override bool OnGettingAttributeForRole (in VisualRole role, ref Attribute currentAttribute)
+    {
+        if (role != Role)
+        {
+            currentAttribute = GetAttributeForRole (Role!.Value);
+
+            return true;
+        }
+
+        return base.OnGettingAttributeForRole (in role, ref currentAttribute);
+    }
+}

+ 17 - 2
UICatalog/Scenarios/FileDialogExamples.cs → Examples/UICatalog/Scenarios/FileDialogExamples.cs

@@ -16,6 +16,7 @@ public class FileDialogExamples : Scenario
     private CheckBox _cbAlwaysTableShowHeaders;
     private CheckBox _cbCaseSensitive;
     private CheckBox _cbDrivesOnlyInTree;
+    private CheckBox _cbPreserveFilenameOnDirectoryChanges;
     private CheckBox _cbFlipButtonOrder;
     private CheckBox _cbMustExist;
     private CheckBox _cbShowTreeBranchLines;
@@ -55,6 +56,9 @@ public class FileDialogExamples : Scenario
         _cbDrivesOnlyInTree = new CheckBox { CheckedState = CheckState.UnChecked, Y = y++, X = x, Text = "Only Show _Drives" };
         win.Add (_cbDrivesOnlyInTree);
 
+        _cbPreserveFilenameOnDirectoryChanges = new CheckBox { CheckedState = CheckState.UnChecked, Y = y++, X = x, Text = "Preserve Filename" };
+        win.Add (_cbPreserveFilenameOnDirectoryChanges);
+
         y = 0;
         x = 24;
 
@@ -137,7 +141,7 @@ public class FileDialogExamples : Scenario
                             }
                             finally
                             {
-                                e.Cancel = true;
+                                e.Handled = true;
                             }
                         };
         win.Add (btn);
@@ -164,7 +168,15 @@ public class FileDialogExamples : Scenario
         var fd = new FileDialog
         {
             OpenMode = Enum.Parse<OpenMode> (
-                                             _rgOpenMode.RadioLabels.Select (l => TextFormatter.RemoveHotKeySpecifier(l, 0, _rgOpenMode.HotKeySpecifier)).ToArray() [_rgOpenMode.SelectedItem]
+                                             _rgOpenMode.RadioLabels
+                                                        .Select (l => TextFormatter.FindHotKey (l, _rgOpenMode.HotKeySpecifier, out int hotPos, out Key _)
+
+                                                                          // Remove the hotkey specifier at the found position
+                                                                          ? TextFormatter.RemoveHotKeySpecifier (l, hotPos, _rgOpenMode.HotKeySpecifier)
+
+                                                                          // No hotkey found, return the label as is
+                                                                          : l)
+                                                        .ToArray () [_rgOpenMode.SelectedItem]
                                             ),
             MustExist = _cbMustExist.CheckedState == CheckState.Checked,
             AllowsMultipleSelection = _cbAllowMultipleSelection.CheckedState == CheckState.Checked
@@ -198,6 +210,9 @@ public class FileDialogExamples : Scenario
             fd.Style.TreeRootGetter = () => { return Environment.GetLogicalDrives ().ToDictionary (dirInfoFactory.New, k => k); };
         }
 
+        fd.Style.PreserveFilenameOnDirectoryChanges = _cbPreserveFilenameOnDirectoryChanges.CheckedState == CheckState.Checked;
+        
+
         if (_rgAllowedTypes.SelectedItem > 0)
         {
             fd.AllowedTypes.Add (new AllowedType ("Data File", ".csv", ".tsv"));

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio