Skip to content

Commit 7422385

Browse files
tigCopilot
andauthored
Fixes #4057 - MASSIVE! Fully implements ColorScheme->Scheme + VisualRole + Colors.->SchemeManager. (#4062)
* touching publish.yml * ColorScheme->Scheme * ColorScheme->Scheme 2 * Prototype of GetAttributeForRole * Badly broke CM * Further Badly broke CM * Refactored CM big-time. View still broken * All unit test pass again. Tons added. CM is still WIP, but Schemes is not mostly refactored and working. * Actually: All unit test pass again. Tons added. CM is still WIP, but Schemes is not mostly refactored and working. * Bug fixes. DeepMemberWiseClone cleanup * Further cleanup of Scope<T>, ConfigProperty, etc. * Made ConfigManager thread safe. * WIP: Broken * WIP: new deep clone impl * WIP: new deep clone impl is done. Now fixing CM * WIP: - config.md - Working on AOT clean up - Core CM is broken; but known. * WIP * Merged. Removed CM from Application.Init * WIP * More WIP; Less broke * All CM unit tests pass... Not sure if it actually works though * All unit tests pass... Themes are broken though in UI Cat * CM Ready for review? * Fixed failures due to TextStyles PR * Working on Scheme/Attribute * Working on Scheme/Attribute 2 * Working on Scheme/Attribute 3 * Working on Scheme/Attribute 4 * Working on Scheme/Attribute 5 * Working on Scheme/Attribute 6 * Added test to show how awful memory usage is * Improved schema. Updated config.json * Nade Scope<T> concurrentdictionary and added test to prove * Made Themes ConcrurrentDictionary. Added bunches of tests * Code cleanup * Code cleanup 2 * Code cleanup 3 * Tweaking Scheme * ClearJsonErrors * ClearJsonErrors2 * Updated Attribute API * It all (mostly) works! * Skip odd unit test * Messed with Themes * Theme tweaks * Code reorg. New .md stuff * Fixed Enabled. Added mock driver * Fixed a bunch of View.Enabled related issues * Scheme -> Get/SetScheme() * Cleanup * Cleanup2 * Broke something * Fixed everything * Made CM.Enable better * Text Style Scenario * Added comments * Fixed UI Catalog Theme Changing * Fixed more dynamic CM update stuff * Warning cleanup * New Default Theme * fixed unit test * Refactoring Scheme and Attribute to fix inheritance * more unit tests * ConfigProperty is not updating schemes correctly * All unit tests pass. Code cleanup * All unit tests pass. Code cleanup2 * Fixed unit tests * Upgraded TextField and TextView * Fixed TextView !Enabled bug * More updates to TextView. More unit tests for SchemeManager * Upgraded CharMap * API docs * Fixe HexView API * upgrade HexView * Fixed shortcut KeyView * Fixed more bugs. Added new themes * updated themes * upgraded Border * Fixed themes memory usage...mostly * Fixed themes memory usage...mostly2 * Fixed themes memory usage...2 * Fixed themes memory usage...3 * Added new colors * Fixed GetHardCodedConfig bug * Added Themes Scenario - WIP * Added Themes Scenario * Tweaked Themes Scenario * Code cleanup * Fixed json schmea * updated deepdives * updated deepdives * Tweaked Themes Scenario * Made Schemes a concurrent dict * Test cleanup * Thread safe ConfigProperty tests * trying to make things more thread safe * more trying to make things more thread safe * Fixing bugs in shadowview * Fixing bugs in shadowview 2 * Refactored GetViewsUnderMouse to GetViewsUnderLocation etc... * Fixed dupe unit tests? * Added better description of layout and coordiantes to deep dive * Added better description of layout and coordiantes to deep dive * Modified tests that call v2.AddTimeout; they were returning true which means restart the timer! This was causing mac/linux unit test failures. I think * Fixed auto scheme. Broke TextView/TextField selection * Realized Attribute.IsExplicitlySet is stupid; just use nullable * Fixed Attribute. Simplified. MOre theme testing * Updated themes again * GetViewsUnderMouse to GetViewsUnderLocation broke TransparentMouse. * Fixing mouseunder bugs * rewriting... * All working again. Shadows are now slick as snot. GetViewsUnderLocation is rewritten to actually work and be readable. Tons more low-level unit tests. Margin is now actually ViewportSettings.Transparent. * Code cleanup * Code cleanup * Code cleanup of color apis * Fixed Hover/Highlight * Update Examples/UICatalog/Scenarios/AllViewsTester.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update Examples/UICatalog/Scenarios/CharacterMap/CharacterMap.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update Examples/UICatalog/Scenarios/Clipping.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fixed race condition? * reverted * Simplified Attribute API by removing events from SetAttributeForRole * Removed recursion from GetViewsAtLocation * Removed unneeded code * Code clean up. Fixed Scheme bug. * reverted temporary disable * Adjusted scheme algo * Upgraded TextValidateField * Fixed TextValidate bugs * Tweaks * Frameview rounded border by default * API doc cleanup * Readme fix * Addressed tznind feeback * Fixed more unit test issues by protecting Application statics from being set if Application.Initialized is not true * Fixed more unit test issues by protecting Application statics from being set if Application.Initialized is not true 2 * cleanup --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9c54ee4 commit 7422385

File tree

386 files changed

+23424
-13486
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

386 files changed

+23424
-13486
lines changed

Examples/CommunityToolkitExample/LoginView.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void Receive (Message<LoginActions> message)
4747
{
4848
loginProgressLabel.Text = ViewModel.LoginProgressMessage;
4949
validationLabel.Text = ViewModel.ValidationMessage;
50-
validationLabel.ColorScheme = ViewModel.ValidationColorScheme;
50+
validationLabel.SetScheme (ViewModel.ValidationScheme);
5151
break;
5252
}
5353
case LoginActions.LoginProgress:
@@ -58,11 +58,11 @@ public void Receive (Message<LoginActions> message)
5858
case LoginActions.Validation:
5959
{
6060
validationLabel.Text = ViewModel.ValidationMessage;
61-
validationLabel.ColorScheme = ViewModel.ValidationColorScheme;
61+
validationLabel.SetScheme (ViewModel.ValidationScheme);
6262
break;
6363
}
6464
}
65-
SetText();
65+
SetText ();
6666
// BUGBUG: This should not be needed:
6767
Application.LayoutAndDraw ();
6868
}

Examples/CommunityToolkitExample/LoginViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ internal partial class LoginViewModel : ObservableObject
2929
private string _usernameLengthMessage;
3030

3131
[ObservableProperty]
32-
private ColorScheme? _validationColorScheme;
32+
private Scheme? _validationScheme;
3333

3434
[ObservableProperty]
3535
private string _validationMessage;
@@ -107,14 +107,14 @@ private void SendMessage (LoginActions loginAction, string message = "")
107107
case LoginActions.Clear:
108108
LoginProgressMessage = message;
109109
ValidationMessage = INVALID_LOGIN_MESSAGE;
110-
ValidationColorScheme = Colors.ColorSchemes ["Error"];
110+
ValidationScheme = SchemeManager.GetScheme ("Error");
111111
break;
112112
case LoginActions.LoginProgress:
113113
LoginProgressMessage = message;
114114
break;
115115
case LoginActions.Validation:
116116
ValidationMessage = CanLogin ? VALID_LOGIN_MESSAGE : INVALID_LOGIN_MESSAGE;
117-
ValidationColorScheme = CanLogin ? Colors.ColorSchemes ["Base"] : Colors.ColorSchemes ["Error"];
117+
ValidationScheme = CanLogin ? SchemeManager.GetScheme ("Base") : SchemeManager.GetScheme("Error");
118118
break;
119119
}
120120
WeakReferenceMessenger.Default.Send (new Message<LoginActions> { Value = loginAction });

Examples/CommunityToolkitExample/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ public static class Program
99

1010
private static void Main (string [] args)
1111
{
12+
ConfigurationManager.Enable (ConfigLocations.All);
1213
Services = ConfigureServices ();
1314
Application.Init ();
1415
Application.Run (Services.GetRequiredService<LoginView> ());
15-
Application.Top?.Dispose();
16+
Application.Top?.Dispose ();
1617
Application.Shutdown ();
1718
}
1819

Examples/CommunityToolkitExample/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private void SendMessage (LoginAction loginAction, string message = "")
115115
break;
116116
case LoginAction.Validation:
117117
ValidationMessage = CanLogin ? VALID_LOGIN_MESSAGE : INVALID_LOGIN_MESSAGE;
118-
ValidationColorScheme = CanLogin ? Colors.ColorSchemes ["Base"] : Colors.ColorSchemes ["Error"];
118+
ValidationScheme = CanLogin ? Colors.Schemes ["Base"] : Colors.Schemes ["Error"];
119119
break;
120120
}
121121
WeakReferenceMessenger.Default.Send (new Message<LoginAction> { Value = loginAction });
@@ -144,7 +144,7 @@ public void Receive (Message<LoginAction> message)
144144
case LoginAction.Validation:
145145
{
146146
validationLabel.Text = ViewModel.ValidationMessage;
147-
validationLabel.ColorScheme = ViewModel.ValidationColorScheme;
147+
validationLabel.Scheme = ViewModel.ValidationScheme;
148148
break;
149149
}
150150
}

Examples/Example/Example.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
// A simple Terminal.Gui example in C# - using C# 9.0 Top-level statements
55

6-
using System;
76
using Terminal.Gui;
87

98
// Override the default configuration for the application to use the Light theme
109
ConfigurationManager.RuntimeConfig = """{ "Theme": "Light" }""";
10+
ConfigurationManager.Enable(ConfigLocations.All);
1111

1212
Application.Run<ExampleWindow> ().Dispose ();
1313

@@ -21,7 +21,7 @@
2121
// Defines a top-level window with border and title
2222
public class ExampleWindow : Window
2323
{
24-
public static string UserName;
24+
public static string UserName { get; set; }
2525

2626
public ExampleWindow ()
2727
{

Examples/NativeAot/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public static class Program
1313
[RequiresDynamicCode ("Calls Terminal.Gui.Application.Init(IConsoleDriver, String)")]
1414
private static void Main (string [] args)
1515
{
16+
ConfigurationManager.Enable(ConfigLocations.All);
1617
Application.Init ();
1718

1819
#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

Examples/ReactiveExample/LoginView.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ public LoginView (LoginViewModel viewModel)
9696

9797
ViewModel
9898
.WhenAnyValue (x => x.IsValid)
99-
.Select (valid => valid ? Colors.ColorSchemes ["Base"] : Colors.ColorSchemes ["Error"])
100-
.BindTo (validation, x => x.ColorScheme)
99+
.Select (valid => valid ? SchemeManager.GetScheme ("Base") : SchemeManager.GetScheme ("Error"))
100+
.BindTo (validation, x => x.GetScheme ())
101101
.DisposeWith (_disposable);
102102
})
103103
.AddControlAfter<Button> ((previous, login) =>

Examples/ReactiveExample/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public static class Program
88
{
99
private static void Main (string [] args)
1010
{
11+
ConfigurationManager.Enable (ConfigLocations.All);
1112
Application.Init ();
1213
RxApp.MainThreadScheduler = TerminalScheduler.Default;
1314
RxApp.TaskpoolScheduler = TaskPoolScheduler.Default;

Examples/SelfContained/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public static class Program
1212
[RequiresUnreferencedCode ("Calls Terminal.Gui.Application.Run<T>(Func<Exception, Boolean>, IConsoleDriver)")]
1313
private static void Main (string [] args)
1414
{
15+
ConfigurationManager.Enable (ConfigLocations.All);
1516
Application.Init ();
1617

1718
#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

Examples/UICatalog/Properties/launchSettings.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"profiles": {
33
"UICatalog": {
4-
"commandName": "Project"
4+
"commandName": "Project",
5+
"commandLineArgs": "--debug-log-level Debug"
56
},
67
"UICatalog --driver NetDriver": {
78
"commandName": "Project",
@@ -60,9 +61,17 @@
6061
"commandName": "Project",
6162
"commandLineArgs": "\"All Views Tester\" -b -t 5000"
6263
},
63-
"Charmap": {
64+
"UICatalog --disable-cm": {
65+
"commandName": "Project",
66+
"commandLineArgs": "--disable-cm\r\n"
67+
},
68+
"UICatalog --disable-cm --driver v2win": {
69+
"commandName": "Project",
70+
"commandLineArgs": "--disable-cm --driver v2win"
71+
},
72+
"Themes": {
6473
"commandName": "Project",
65-
"commandLineArgs": "Bars -b"
74+
"commandLineArgs": "Themes"
6675
}
6776
}
6877
}

0 commit comments

Comments
 (0)