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>
This commit is contained in:
Tig
2025-05-29 13:55:54 -06:00
committed by GitHub
parent 9c54ee41e5
commit 7422385457
386 changed files with 23600 additions and 13662 deletions

View File

@@ -13,7 +13,7 @@ public class TextAlignmentAndDirection : Scenario
internal class AlignmentAndDirectionView : View
{
public AlignmentAndDirectionView()
public AlignmentAndDirectionView ()
{
ViewportSettings = Terminal.Gui.ViewportSettings.Transparent;
BorderStyle = LineStyle.Dotted;
@@ -31,8 +31,8 @@ public class TextAlignmentAndDirection : Scenario
var txt = $"Hello World{Environment.NewLine}HELLO WORLD{Environment.NewLine}世界 您好";
var color1 = new ColorScheme { Normal = new (Color.Black, Color.Gray) };
var color2 = new ColorScheme { Normal = new (Color.Black, Color.DarkGray) };
SchemeManager.AddScheme ("TextAlignmentAndDirection1", new Scheme { Normal = new (Color.Black, Color.Gray) });
SchemeManager.AddScheme ("TextAlignmentAndDirection2", new Scheme { Normal = new (Color.Black, Color.DarkGray) });
List<View> singleLineLabels = new (); // single line
List<View> multiLineLabels = new (); // multi line
@@ -46,7 +46,7 @@ public class TextAlignmentAndDirection : Scenario
Width = 6,
Height = 1,
TextAlignment = Alignment.End,
ColorScheme = Colors.ColorSchemes ["Dialog"],
SchemeName = "Dialog",
Text = "Start",
};
@@ -57,7 +57,7 @@ public class TextAlignmentAndDirection : Scenario
Width = 6,
Height = 1,
TextAlignment = Alignment.End,
ColorScheme = Colors.ColorSchemes ["Dialog"],
SchemeName = "Dialog",
Text = "Center"
};
@@ -68,7 +68,7 @@ public class TextAlignmentAndDirection : Scenario
Width = 6,
Height = 1,
TextAlignment = Alignment.End,
ColorScheme = Colors.ColorSchemes ["Dialog"],
SchemeName = "Dialog",
Text = "End"
};
@@ -79,7 +79,7 @@ public class TextAlignmentAndDirection : Scenario
Width = 6,
Height = 1,
TextAlignment = Alignment.End,
ColorScheme = Colors.ColorSchemes ["Dialog"],
SchemeName = "Dialog",
Text = "Fill"
};
@@ -89,7 +89,7 @@ public class TextAlignmentAndDirection : Scenario
Y = Pos.Y (labelHL),
Width = Dim.Fill (9),
Height = 1,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
TextAlignment = Alignment.Start,
Text = txt,
ViewportSettings = Terminal.Gui.ViewportSettings.Transparent
@@ -101,7 +101,7 @@ public class TextAlignmentAndDirection : Scenario
Y = Pos.Y (labelHC),
Width = Dim.Fill (9),
Height = 1,
ColorScheme = color2,
SchemeName = "TextAlignmentAndDirection2",
TextAlignment = Alignment.Center,
Text = txt,
ViewportSettings = Terminal.Gui.ViewportSettings.Transparent
@@ -113,7 +113,7 @@ public class TextAlignmentAndDirection : Scenario
Y = Pos.Y (labelHR),
Width = Dim.Fill (9),
Height = 1,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
TextAlignment = Alignment.End,
Text = txt,
ViewportSettings = Terminal.Gui.ViewportSettings.Transparent
@@ -125,7 +125,7 @@ public class TextAlignmentAndDirection : Scenario
Y = Pos.Y (labelHJ),
Width = Dim.Fill (9),
Height = 1,
ColorScheme = color2,
SchemeName = "TextAlignmentAndDirection2",
TextAlignment = Alignment.Fill,
Text = txt,
ViewportSettings = Terminal.Gui.ViewportSettings.Transparent
@@ -153,7 +153,7 @@ public class TextAlignmentAndDirection : Scenario
Y = 0,
Width = 2,
Height = 6,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
TextDirection = TextDirection.TopBottom_LeftRight,
VerticalTextAlignment = Alignment.End,
Text = "Start"
@@ -166,7 +166,7 @@ public class TextAlignmentAndDirection : Scenario
Y = 0,
Width = 2,
Height = 6,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
TextDirection = TextDirection.TopBottom_LeftRight,
VerticalTextAlignment = Alignment.End,
Text = "Center"
@@ -179,7 +179,7 @@ public class TextAlignmentAndDirection : Scenario
Y = 0,
Width = 2,
Height = 6,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
TextDirection = TextDirection.TopBottom_LeftRight,
VerticalTextAlignment = Alignment.End,
Text = "End"
@@ -192,7 +192,7 @@ public class TextAlignmentAndDirection : Scenario
Y = 0,
Width = 2,
Height = 6,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
TextDirection = TextDirection.TopBottom_LeftRight,
VerticalTextAlignment = Alignment.End,
Text = "Fill"
@@ -205,7 +205,7 @@ public class TextAlignmentAndDirection : Scenario
Y = Pos.Bottom (labelVT) + 1,
Width = 2,
Height = Dim.Fill (),
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
TextDirection = TextDirection.TopBottom_LeftRight,
VerticalTextAlignment = Alignment.Start,
Text = txt,
@@ -219,7 +219,7 @@ public class TextAlignmentAndDirection : Scenario
Y = Pos.Bottom (labelVM) + 1,
Width = 2,
Height = Dim.Fill (),
ColorScheme = color2,
SchemeName = "TextAlignmentAndDirection2",
TextDirection = TextDirection.TopBottom_LeftRight,
VerticalTextAlignment = Alignment.Center,
Text = txt,
@@ -233,7 +233,7 @@ public class TextAlignmentAndDirection : Scenario
Y = Pos.Bottom (labelVB) + 1,
Width = 2,
Height = Dim.Fill (),
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
TextDirection = TextDirection.TopBottom_LeftRight,
VerticalTextAlignment = Alignment.End,
Text = txt,
@@ -247,7 +247,7 @@ public class TextAlignmentAndDirection : Scenario
Y = Pos.Bottom (labelVJ) + 1,
Width = 2,
Height = Dim.Fill (),
ColorScheme = color2,
SchemeName = "TextAlignmentAndDirection2",
TextDirection = TextDirection.TopBottom_LeftRight,
VerticalTextAlignment = Alignment.Fill,
Text = txt,
@@ -278,7 +278,7 @@ public class TextAlignmentAndDirection : Scenario
Width = Dim.Fill (31),
Height = Dim.Fill (4)
//ColorScheme = color2
//SchemeName = "TextAlignmentAndDirection2"
};
var txtLabelTL = new AlignmentAndDirectionView
@@ -289,7 +289,7 @@ public class TextAlignmentAndDirection : Scenario
Height = Dim.Percent (100 / 3),
TextAlignment = Alignment.Start,
VerticalTextAlignment = Alignment.Start,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
};
txtLabelTL.TextFormatter.MultiLine = true;
@@ -302,7 +302,7 @@ public class TextAlignmentAndDirection : Scenario
Height = Dim.Percent (100 / 3),
TextAlignment = Alignment.Center,
VerticalTextAlignment = Alignment.Start,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
};
txtLabelTC.TextFormatter.MultiLine = true;
@@ -315,7 +315,7 @@ public class TextAlignmentAndDirection : Scenario
Height = Dim.Percent (100 / 3),
TextAlignment = Alignment.End,
VerticalTextAlignment = Alignment.Start,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
};
txtLabelTR.TextFormatter.MultiLine = true;
@@ -328,7 +328,7 @@ public class TextAlignmentAndDirection : Scenario
Height = Dim.Percent (100 / 3),
TextAlignment = Alignment.Start,
VerticalTextAlignment = Alignment.Center,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
};
txtLabelML.TextFormatter.MultiLine = true;
@@ -341,7 +341,7 @@ public class TextAlignmentAndDirection : Scenario
Height = Dim.Percent (100 / 3),
TextAlignment = Alignment.Center,
VerticalTextAlignment = Alignment.Center,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
};
txtLabelMC.TextFormatter.MultiLine = true;
@@ -354,7 +354,7 @@ public class TextAlignmentAndDirection : Scenario
Height = Dim.Percent (100 / 3),
TextAlignment = Alignment.End,
VerticalTextAlignment = Alignment.Center,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
};
txtLabelMR.TextFormatter.MultiLine = true;
@@ -367,7 +367,7 @@ public class TextAlignmentAndDirection : Scenario
Height = Dim.Percent (100, DimPercentMode.Position),
TextAlignment = Alignment.Start,
VerticalTextAlignment = Alignment.End,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
};
txtLabelBL.TextFormatter.MultiLine = true;
@@ -380,7 +380,7 @@ public class TextAlignmentAndDirection : Scenario
Height = Dim.Percent (100, DimPercentMode.Position),
TextAlignment = Alignment.Center,
VerticalTextAlignment = Alignment.End,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
};
txtLabelBC.TextFormatter.MultiLine = true;
@@ -388,12 +388,12 @@ public class TextAlignmentAndDirection : Scenario
var txtLabelBR = new AlignmentAndDirectionView
{
X = Pos.X (txtLabelMR),
Y = Pos.Bottom(txtLabelMR),
Y = Pos.Bottom (txtLabelMR),
Width = Dim.Percent (100, DimPercentMode.Position),
Height = Dim.Percent (100, DimPercentMode.Position),
TextAlignment = Alignment.End,
VerticalTextAlignment = Alignment.End,
ColorScheme = color1,
SchemeName = "TextAlignmentAndDirection1",
Text = txt,
};
txtLabelBR.TextFormatter.MultiLine = true;
@@ -578,6 +578,12 @@ public class TextAlignmentAndDirection : Scenario
app.Dispose ();
Application.Shutdown ();
// Be a good citizen and remove the schemes we added
SchemeManager.RemoveScheme ("TextAlignmentAndDirection1");
SchemeManager.RemoveScheme ("TextAlignmentAndDirection2");
return;
void ToggleJustify (bool oldValue, bool wasJustOptions = false)
{
if (oldValue)