Skip to content

Commit

Permalink
Fixes #3839, #3922 - CM Glyphs not working (#3923)
Browse files Browse the repository at this point in the history
* fixed

* Moved Glyphs to ThemeScope

* Removed test code
  • Loading branch information
tig authored Feb 26, 2025
1 parent 7ba6d63 commit f3697a9
Show file tree
Hide file tree
Showing 36 changed files with 984 additions and 902 deletions.
9 changes: 1 addition & 8 deletions Terminal.Gui/Configuration/ConfigurationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,6 @@ public static class ConfigurationManager
[JsonPropertyName ("AppSettings")]
public static AppScope? AppSettings { get; set; }

/// <summary>
/// The set of glyphs used to draw checkboxes, lines, borders, etc...See also
/// <seealso cref="Terminal.Gui.GlyphDefinitions"/>.
/// </summary>
[SerializableConfigurationProperty (Scope = typeof (SettingsScope), OmitClassName = true)]
[JsonPropertyName ("Glyphs")]
public static GlyphDefinitions Glyphs { get; set; } = new ();

/// <summary>
/// Gets and sets the locations where <see cref="ConfigurationManager"/> will look for config files. The value is
/// <see cref="ConfigLocations.All"/>.
Expand Down Expand Up @@ -301,6 +293,7 @@ public static void Load (bool reset = false)
public static void OnApplied ()
{
Debug.WriteLine ("ConfigurationManager.OnApplied()");

Applied?.Invoke (null, new ());

// TODO: Refactor ConfigurationManager to not use an event handler for this.
Expand Down
1 change: 1 addition & 0 deletions Terminal.Gui/Configuration/Scope.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#nullable enable
using System.Diagnostics;
using System.Reflection;

namespace Terminal.Gui;
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/Configuration/SourceGenerationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Terminal.Gui;
[JsonSerializable (typeof (AppScope))]
[JsonSerializable (typeof (SettingsScope))]
[JsonSerializable (typeof (Key))]
[JsonSerializable (typeof (GlyphDefinitions))]
[JsonSerializable (typeof (Glyphs))]
[JsonSerializable (typeof (Alignment))]
[JsonSerializable (typeof (AlignmentModes))]
[JsonSerializable (typeof (LineStyle))]
Expand Down
332 changes: 185 additions & 147 deletions Terminal.Gui/Drawing/Glyphs.cs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Terminal.Gui/Drawing/LineCanvas/LineStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public enum LineStyle
/// <summary>No border is drawn.</summary>
None,

/// <summary>The border is drawn using thin line CM.Glyphs.</summary>
/// <summary>The border is drawn using thin line Glyphs.</summary>
Single,

/// <summary>The border is drawn using thin line glyphs with dashed (double and triple) straight lines.</summary>
Expand All @@ -19,10 +19,10 @@ public enum LineStyle
/// <summary>The border is drawn using thin line glyphs with short dashed (triple and quadruple) straight lines.</summary>
Dotted,

/// <summary>The border is drawn using thin double line CM.Glyphs.</summary>
/// <summary>The border is drawn using thin double line Glyphs.</summary>
Double,

/// <summary>The border is drawn using heavy line CM.Glyphs.</summary>
/// <summary>The border is drawn using heavy line Glyphs.</summary>
Heavy,

/// <summary>The border is drawn using heavy line glyphs with dashed (double and triple) straight lines.</summary>
Expand Down
287 changes: 142 additions & 145 deletions Terminal.Gui/Resources/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,150 +38,6 @@
"FileDialogStyle.DefaultUseColors": false,
"FileDialogStyle.DefaultUseUnicodeCharacters": false,

// --------------- Glyphs ---------------
"Glyphs": {
"File": "",
"Folder": "",
"HorizontalEllipsis": "",
"VerticalFourDots": "",
"CheckStateChecked": "",
"CheckStateUnChecked": "",
"CheckStateNone": "",
"Selected": "",
"UnSelected": "",
"RightArrow": "",
"LeftArrow": "",
"DownArrow": "",
"UpArrow": "",
"LeftDefaultIndicator": "",
"RightDefaultIndicator": "",
"LeftBracket": "",
"RightBracket": "",
"BlocksMeterSegment": "",
"ContinuousMeterSegment": "",
"Stipple": "",
"Diamond": "",
"Close": "",
"Minimize": "",
"Maximize": "",
"Dot": "",
"BlackCircle": "",
"Expand": "+",
"Collapse": "-",
"IdenticalTo": "",
"Move": "",
"SizeHorizontal": "",
"SizeVertical": "",
"SizeTopLeft": "",
"SizeTopRight": "",
"SizeBottomRight": "",
"SizeBottomLeft": "",
"Apple": "\uD83C\uDF4E",
"AppleBMP": "",
"HLine": "",
"VLine": "",
"HLineDbl": "",
"VLineDbl": "",
"HLineHvDa2": "",
"VLineHvDa3": "",
"HLineHvDa3": "",
"HLineHvDa4": "",
"VLineHvDa2": "",
"VLineHvDa4": "",
"HLineDa2": "",
"VLineDa3": "",
"HLineDa3": "",
"HLineDa4": "",
"VLineDa2": "",
"VLineDa4": "",
"HLineHv": "",
"VLineHv": "",
"HalfLeftLine": "",
"HalfTopLine": "",
"HalfRightLine": "",
"HalfBottomLine": "",
"HalfLeftLineHv": "",
"HalfTopLineHv": "",
"HalfRightLineHv": "",
"HalfBottomLineLt": "",
"RightSideLineLtHv": "",
"BottomSideLineLtHv": "",
"LeftSideLineHvLt": "",
"TopSideLineHvLt": "",
"ULCorner": "",
"ULCornerDbl": "",
"ULCornerR": "",
"ULCornerHv": "",
"ULCornerHvLt": "",
"ULCornerLtHv": "",
"ULCornerDblSingle": "",
"ULCornerSingleDbl": "",
"LLCorner": "",
"LLCornerHv": "",
"LLCornerHvLt": "",
"LLCornerLtHv": "",
"LLCornerDbl": "",
"LLCornerSingleDbl": "",
"LLCornerDblSingle": "",
"LLCornerR": "",
"URCorner": "",
"URCornerDbl": "",
"URCornerR": "",
"URCornerHv": "",
"URCornerHvLt": "",
"URCornerLtHv": "",
"URCornerDblSingle": "",
"URCornerSingleDbl": "",
"LRCorner": "",
"LRCornerDbl": "",
"LRCornerR": "",
"LRCornerHv": "",
"LRCornerDblSingle": "",
"LRCornerSingleDbl": "",
"LRCornerLtHv": "",
"LRCornerHvLt": "",
"LeftTee": "",
"LeftTeeDblH": "",
"LeftTeeDblV": "",
"LeftTeeDbl": "",
"LeftTeeHvH": "",
"LeftTeeHvV": "",
"LeftTeeHvDblH": "",
"RightTee": "",
"RightTeeDblH": "",
"RightTeeDblV": "",
"RightTeeDbl": "",
"RightTeeHvH": "",
"RightTeeHvV": "",
"RightTeeHvDblH": "",
"TopTee": "",
"TopTeeDblH": "",
"TopTeeDblV": "",
"TopTeeDbl": "",
"TopTeeHvH": "",
"TopTeeHvV": "",
"TopTeeHvDblH": "",
"BottomTee": "",
"BottomTeeDblH": "",
"BottomTeeDblV": "",
"BottomTeeDbl": "",
"BottomTeeHvH": "",
"BottomTeeHvV": "",
"BottomTeeHvDblH": "",
"Cross": "",
"CrossDblH": "",
"CrossDblV": "",
"CrossDbl": "",
"CrossHvH": "",
"CrossHvV": "",
"CrossHv": "",
"ShadowVerticalStart": "",
"ShadowVertical": "",
"ShadowHorizontalStart": "",
"ShadowHorizontal": "",
"ShadowHorizontalEnd": ""
},

// --------------- Themes -----------------
"Theme": "Default",
"Themes": [
Expand Down Expand Up @@ -317,7 +173,148 @@
}
}
}
]
],
"Glyphs.Apple": "\uD83C\uDF4E",
"Glyphs.AppleBMP": "",
"Glyphs.BlackCircle": "",
"Glyphs.BlocksMeterSegment": "",
"Glyphs.BottomSideLineLtHv": "",
"Glyphs.BottomTee": "",
"Glyphs.BottomTeeDbl": "",
"Glyphs.BottomTeeDblH": "",
"Glyphs.BottomTeeDblV": "",
"Glyphs.BottomTeeHvDblH": "",
"Glyphs.BottomTeeHvH": "",
"Glyphs.BottomTeeHvV": "",
"Glyphs.CheckStateChecked": "",
"Glyphs.CheckStateNone": "",
"Glyphs.CheckStateUnChecked": "",
"Glyphs.Close": "",
"Glyphs.Collapse": "-",
"Glyphs.ContinuousMeterSegment": "",
"Glyphs.Cross": "",
"Glyphs.CrossDbl": "",
"Glyphs.CrossDblH": "",
"Glyphs.CrossDblV": "",
"Glyphs.CrossHv": "",
"Glyphs.CrossHvH": "",
"Glyphs.CrossHvV": "",
"Glyphs.Diamond": "",
"Glyphs.Dot": "",
"Glyphs.DottedSquare": "",
"Glyphs.DownArrow": "",
"Glyphs.Expand": "+",
"Glyphs.File": "",
"Glyphs.Folder": "",
"Glyphs.HalfBottomLine": "",
"Glyphs.HalfBottomLineLt": "",
"Glyphs.HalfLeftLine": "",
"Glyphs.HalfLeftLineHv": "",
"Glyphs.HalfRightLine": "",
"Glyphs.HalfRightLineHv": "",
"Glyphs.HalfTopLine": "",
"Glyphs.HalfTopLineHv": "",
"Glyphs.HLine": "",
"Glyphs.HLineDa2": "",
"Glyphs.HLineDa3": "",
"Glyphs.HLineDa4": "",
"Glyphs.HLineDbl": "",
"Glyphs.HLineHv": "",
"Glyphs.HLineHvDa2": "",
"Glyphs.HLineHvDa3": "",
"Glyphs.HLineHvDa4": "",
"Glyphs.HorizontalEllipsis": "",
"Glyphs.IdenticalTo": "",
"Glyphs.LeftArrow": "",
"Glyphs.LeftBracket": "",
"Glyphs.LeftDefaultIndicator": "",
"Glyphs.LeftSideLineHvLt": "",
"Glyphs.LeftTee": "",
"Glyphs.LeftTeeDbl": "",
"Glyphs.LeftTeeDblH": "",
"Glyphs.LeftTeeDblV": "",
"Glyphs.LeftTeeHvDblH": "",
"Glyphs.LeftTeeHvH": "",
"Glyphs.LeftTeeHvV": "",
"Glyphs.LLCorner": "",
"Glyphs.LLCornerDbl": "",
"Glyphs.LLCornerDblSingle": "",
"Glyphs.LLCornerHv": "",
"Glyphs.LLCornerHvLt": "",
"Glyphs.LLCornerLtHv": "",
"Glyphs.LLCornerR": "",
"Glyphs.LLCornerSingleDbl": "",
"Glyphs.LRCorner": "",
"Glyphs.LRCornerDbl": "",
"Glyphs.LRCornerDblSingle": "",
"Glyphs.LRCornerHv": "",
"Glyphs.LRCornerHvLt": "",
"Glyphs.LRCornerLtHv": "",
"Glyphs.LRCornerR": "",
"Glyphs.LRCornerSingleDbl": "",
"Glyphs.Maximize": "",
"Glyphs.Minimize": "",
"Glyphs.Move": "",
"Glyphs.RightArrow": "",
"Glyphs.RightBracket": "",
"Glyphs.RightDefaultIndicator": "",
"Glyphs.RightSideLineLtHv": "",
"Glyphs.RightTee": "",
"Glyphs.RightTeeDbl": "",
"Glyphs.RightTeeDblH": "",
"Glyphs.RightTeeDblV": "",
"Glyphs.RightTeeHvDblH": "",
"Glyphs.RightTeeHvH": "",
"Glyphs.RightTeeHvV": "",
"Glyphs.Selected": "",
"Glyphs.ShadowHorizontal": "",
"Glyphs.ShadowHorizontalEnd": "",
"Glyphs.ShadowHorizontalStart": "",
"Glyphs.ShadowVertical": "",
"Glyphs.ShadowVerticalStart": "",
"Glyphs.SizeBottomLeft": "",
"Glyphs.SizeBottomRight": "",
"Glyphs.SizeHorizontal": "",
"Glyphs.SizeTopLeft": "",
"Glyphs.SizeTopRight": "",
"Glyphs.SizeVertical": "",
"Glyphs.Stipple": "",
"Glyphs.TopSideLineHvLt": "",
"Glyphs.TopTee": "",
"Glyphs.TopTeeDbl": "",
"Glyphs.TopTeeDblH": "",
"Glyphs.TopTeeDblV": "",
"Glyphs.TopTeeHvDblH": "",
"Glyphs.TopTeeHvH": "",
"Glyphs.TopTeeHvV": "",
"Glyphs.ULCorner": "",
"Glyphs.ULCornerDbl": "",
"Glyphs.ULCornerDblSingle": "",
"Glyphs.ULCornerHv": "",
"Glyphs.ULCornerHvLt": "",
"Glyphs.ULCornerLtHv": "",
"Glyphs.ULCornerR": "",
"Glyphs.ULCornerSingleDbl": "",
"Glyphs.UnSelected": "",
"Glyphs.UpArrow": "",
"Glyphs.URCorner": "",
"Glyphs.URCornerDbl": "",
"Glyphs.URCornerDblSingle": "",
"Glyphs.URCornerHv": "",
"Glyphs.URCornerHvLt": "",
"Glyphs.URCornerLtHv": "",
"Glyphs.URCornerR": "",
"Glyphs.URCornerSingleDbl": "",
"Glyphs.VerticalFourDots": "",
"Glyphs.VLine": "",
"Glyphs.VLineDa2": "",
"Glyphs.VLineDa3": "",
"Glyphs.VLineDa4": "",
"Glyphs.VLineDbl": "",
"Glyphs.VLineHv": "",
"Glyphs.VLineHvDa2": "",
"Glyphs.VLineHvDa3": "",
"Glyphs.VLineHvDa4": ""
}
},
{
Expand Down
6 changes: 3 additions & 3 deletions Terminal.Gui/Views/CheckBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ public bool AllowCheckStateNone
/// <para>
/// If <see cref="AllowCheckStateNone"/> is <see langword="true"/> and <see cref="CheckState.None"/>, the
/// <see cref="CheckBox"/>
/// will display the <c>ConfigurationManager.Glyphs.CheckStateNone</c> character (☒).
/// will display the <c>Glyphs.CheckStateNone</c> character (☒).
/// </para>
/// <para>
/// If <see cref="CheckState.UnChecked"/>, the <see cref="CheckBox"/>
/// will display the <c>ConfigurationManager.Glyphs.CheckStateUnChecked</c> character (☐).
/// will display the <c>Glyphs.CheckStateUnChecked</c> character (☐).
/// </para>
/// <para>
/// If <see cref="CheckState.Checked"/>, the <see cref="CheckBox"/>
/// will display the <c>ConfigurationManager.Glyphs.CheckStateChecked</c> character (☑).
/// will display the <c>Glyphs.CheckStateChecked</c> character (☑).
/// </para>
/// </remarks>
public CheckState CheckedState
Expand Down
2 changes: 1 addition & 1 deletion UICatalog/Scenarios/CharacterMap/CharacterMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ private EnumerableTableSource<UnicodeRange> CreateCategoryTable (int sortByColum
var startSort = string.Empty;
var endSort = string.Empty;

string sortIndicator = descending ? CM.Glyphs.DownArrow.ToString () : CM.Glyphs.UpArrow.ToString ();
string sortIndicator = descending ? Glyphs.DownArrow.ToString () : Glyphs.UpArrow.ToString ();

switch (sortByColumn)
{
Expand Down
2 changes: 1 addition & 1 deletion UICatalog/Scenarios/Clipping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override void Main ()

app.DrawingContent += (s, e) =>
{
app!.FillRect (app!.Viewport, CM.Glyphs.Dot);
app!.FillRect (app!.Viewport, Glyphs.Dot);
e.Cancel = true;
};

Expand Down
Loading

0 comments on commit f3697a9

Please sign in to comment.