diff --git a/Terminal.Gui/Configuration/AttributeJsonConverter.cs b/Terminal.Gui/Configuration/AttributeJsonConverter.cs
index 5ef2c001e..6add9b8df 100644
--- a/Terminal.Gui/Configuration/AttributeJsonConverter.cs
+++ b/Terminal.Gui/Configuration/AttributeJsonConverter.cs
@@ -7,7 +7,7 @@ namespace Terminal.Gui {
///
/// Json converter fro the class.
///
- public class AttributeJsonConverter : JsonConverter {
+ class AttributeJsonConverter : JsonConverter {
private static AttributeJsonConverter instance;
///
@@ -23,7 +23,6 @@ namespace Terminal.Gui {
}
}
- ///
public override Attribute Read (ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType != JsonTokenType.StartObject) {
@@ -74,7 +73,6 @@ namespace Terminal.Gui {
throw new JsonException ();
}
- ///
public override void Write (Utf8JsonWriter writer, Attribute value, JsonSerializerOptions options)
{
writer.WriteStartObject ();
diff --git a/Terminal.Gui/Configuration/ColorJsonConverter.cs b/Terminal.Gui/Configuration/ColorJsonConverter.cs
index 93ae8317e..0a417ac42 100644
--- a/Terminal.Gui/Configuration/ColorJsonConverter.cs
+++ b/Terminal.Gui/Configuration/ColorJsonConverter.cs
@@ -7,7 +7,7 @@ namespace Terminal.Gui {
///
/// Json converter for the class.
///
- public class ColorJsonConverter : JsonConverter {
+ internal class ColorJsonConverter : JsonConverter {
private static ColorJsonConverter instance;
///
@@ -23,7 +23,6 @@ namespace Terminal.Gui {
}
}
- ///
public override Color Read (ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
// Check if the value is a string
@@ -52,7 +51,6 @@ namespace Terminal.Gui {
}
}
- ///
public override void Write (Utf8JsonWriter writer, Color value, JsonSerializerOptions options)
{
// Try to get the human readable color name from the map
diff --git a/Terminal.Gui/Configuration/ColorSchemeJsonConverter.cs b/Terminal.Gui/Configuration/ColorSchemeJsonConverter.cs
index 0c036bd65..6a57de14d 100644
--- a/Terminal.Gui/Configuration/ColorSchemeJsonConverter.cs
+++ b/Terminal.Gui/Configuration/ColorSchemeJsonConverter.cs
@@ -6,7 +6,7 @@ namespace Terminal.Gui {
///
/// Implements a JSON converter for .
///
- public class ColorSchemeJsonConverter : JsonConverter {
+ class ColorSchemeJsonConverter : JsonConverter {
private static ColorSchemeJsonConverter instance;
///
diff --git a/Terminal.Gui/Configuration/ConfigurationManager.cs b/Terminal.Gui/Configuration/ConfigurationManager.cs
index a0cabdf51..455697ffc 100644
--- a/Terminal.Gui/Configuration/ConfigurationManager.cs
+++ b/Terminal.Gui/Configuration/ConfigurationManager.cs
@@ -1,4 +1,6 @@
-using System;
+global using CM = Terminal.Gui.ConfigurationManager;
+
+using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
@@ -8,8 +10,6 @@ using System.Reflection;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
-using System.Threading.Tasks;
-using static Terminal.Gui.ConfigurationManager;
#nullable enable
@@ -57,14 +57,15 @@ namespace Terminal.Gui {
private static readonly string _configFilename = "config.json";
- private static readonly JsonSerializerOptions serializerOptions = new JsonSerializerOptions {
+ private static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions {
ReadCommentHandling = JsonCommentHandling.Skip,
PropertyNameCaseInsensitive = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
WriteIndented = true,
Converters = {
- // No need to set converters - the ConfigRootConverter uses property attributes apply the correct
- // Converter.
+ // We override the standard Rune converter to support specifying Glyphs in
+ // a flexible way
+ new RuneJsonConverter(),
},
};
@@ -228,6 +229,13 @@ namespace Terminal.Gui {
[SerializableConfigurationProperty (Scope = typeof (SettingsScope), OmitClassName = true), JsonPropertyName ("AppSettings")]
public static AppScope? AppSettings { get; set; }
+ ///
+ /// The set of glyphs used to draw checkboxes, lines, borders, etc...See also .
+ ///
+ [SerializableConfigurationProperty (Scope = typeof (SettingsScope), OmitClassName = true),
+ JsonPropertyName ("Glyphs")]
+ public static GlyphDefinitions Glyphs { get; set; } = new GlyphDefinitions ();
+
///
/// Initializes the internal state of ConfigurationManager. Nominally called once as part of application
/// startup to initialize global state. Also called from some Unit Tests to ensure correctness (e.g. Reset()).
@@ -249,7 +257,7 @@ namespace Terminal.Gui {
classesWithConfigProps.Add (classWithConfig.Name, classWithConfig);
}
- Debug.WriteLine ($"ConfigManager.getConfigProperties found {classesWithConfigProps.Count} clases:");
+ Debug.WriteLine ($"ConfigManager.getConfigProperties found {classesWithConfigProps.Count} classes:");
classesWithConfigProps.ToList ().ForEach (x => Debug.WriteLine ($" Class: {x.Key}"));
foreach (var p in from c in classesWithConfigProps
@@ -274,7 +282,7 @@ namespace Terminal.Gui {
_allConfigProperties = _allConfigProperties!.OrderBy (x => x.Key).ToDictionary (x => x.Key, x => x.Value, StringComparer.InvariantCultureIgnoreCase);
Debug.WriteLine ($"ConfigManager.Initialize found {_allConfigProperties.Count} properties:");
- _allConfigProperties.ToList ().ForEach (x => Debug.WriteLine ($" Property: {x.Key}"));
+ //_allConfigProperties.ToList ().ForEach (x => Debug.WriteLine ($" Property: {x.Key}"));
AppSettings = new AppScope ();
}
@@ -286,12 +294,12 @@ namespace Terminal.Gui {
internal static string ToJson ()
{
Debug.WriteLine ($"ConfigurationManager.ToJson()");
- return JsonSerializer.Serialize (Settings!, serializerOptions);
+ return JsonSerializer.Serialize (Settings!, _serializerOptions);
}
internal static Stream ToStream ()
{
- var json = JsonSerializer.Serialize (Settings!, serializerOptions);
+ var json = JsonSerializer.Serialize (Settings!, _serializerOptions);
// turn it into a stream
var stream = new MemoryStream ();
var writer = new StreamWriter (stream);
@@ -371,8 +379,9 @@ namespace Terminal.Gui {
AppSettings = new AppScope ();
// To enable some unit tests, we only load from resources if the flag is set
- if (Locations.HasFlag (ConfigLocations.DefaultOnly)) Settings.UpdateFromResource (typeof (ConfigurationManager).Assembly, $"Terminal.Gui.Resources.{_configFilename}");
-
+ if (Locations.HasFlag (ConfigLocations.DefaultOnly)) {
+ Settings.UpdateFromResource (typeof (ConfigurationManager).Assembly, $"Terminal.Gui.Resources.{_configFilename}");
+ }
Apply ();
ThemeManager.Themes? [ThemeManager.SelectedTheme]?.Apply ();
AppSettings?.Apply ();
@@ -413,7 +422,7 @@ namespace Terminal.Gui {
public static void Apply ()
{
bool settings = Settings?.Apply () ?? false;
- bool themes = ThemeManager.Themes? [ThemeManager.SelectedTheme]?.Apply () ?? false;
+ bool themes = !string.IsNullOrEmpty(ThemeManager.SelectedTheme) && (ThemeManager.Themes? [ThemeManager.SelectedTheme]?.Apply () ?? false);
bool appsettings = AppSettings?.Apply () ?? false;
if (settings || themes || appsettings) {
OnApplied ();
@@ -520,7 +529,7 @@ namespace Terminal.Gui {
{
var emptyScope = new SettingsScope ();
emptyScope.Clear ();
- return JsonSerializer.Serialize (emptyScope, serializerOptions);
+ return JsonSerializer.Serialize (emptyScope, _serializerOptions);
}
///
diff --git a/Terminal.Gui/Configuration/DictionaryJsonConverter.cs b/Terminal.Gui/Configuration/DictionaryJsonConverter.cs
index 5027e22cb..d6187fc14 100644
--- a/Terminal.Gui/Configuration/DictionaryJsonConverter.cs
+++ b/Terminal.Gui/Configuration/DictionaryJsonConverter.cs
@@ -4,7 +4,6 @@ using System.Text.Json.Serialization;
using System.Text.Json;
namespace Terminal.Gui {
-
class DictionaryJsonConverter : JsonConverter> {
public override Dictionary Read (ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
diff --git a/Terminal.Gui/Configuration/KeyJsonConverter.cs b/Terminal.Gui/Configuration/KeyJsonConverter.cs
index 216689d18..3474c16d6 100644
--- a/Terminal.Gui/Configuration/KeyJsonConverter.cs
+++ b/Terminal.Gui/Configuration/KeyJsonConverter.cs
@@ -4,11 +4,7 @@ using System.Text.Json;
using System.Text.Json.Serialization;
namespace Terminal.Gui {
- ///
- /// Json converter for the class.
- ///
- public class KeyJsonConverter : JsonConverter {
- ///
+ class KeyJsonConverter : JsonConverter {
public override Key Read (ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.StartObject) {
@@ -91,7 +87,6 @@ namespace Terminal.Gui {
throw new JsonException ($"Unexpected StartObject token when parsing Key: {reader.TokenType}.");
}
- ///
public override void Write (Utf8JsonWriter writer, Key value, JsonSerializerOptions options)
{
writer.WriteStartObject ();
diff --git a/Terminal.Gui/Configuration/RuneJsonConverter.cs b/Terminal.Gui/Configuration/RuneJsonConverter.cs
new file mode 100644
index 000000000..725b1aa20
--- /dev/null
+++ b/Terminal.Gui/Configuration/RuneJsonConverter.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Text;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+//using Rune = System.Rune;
+
+namespace Terminal.Gui {
+ ///
+ /// Json converter for . Supports
+ /// A string as one of:
+ /// - unicode char (e.g. "☑")
+ /// - U+hex format (e.g. "U+2611")
+ /// - \u format (e.g. "\\u2611")
+ /// A number
+ /// - The unicode code in decimal
+ ///
+ internal class RuneJsonConverter : JsonConverter {
+ public override System.Rune Read (ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
+ {
+ if (reader.TokenType == JsonTokenType.String) {
+ var value = reader.GetString ();
+ if (value.ToUpper ().StartsWith ("U+") || value.StartsWith ("\\u")) {
+ try {
+ uint result = uint.Parse (value [2..^0], System.Globalization.NumberStyles.HexNumber);
+ return new System.Rune (result);
+ } catch (FormatException e) {
+ throw new JsonException ($"Invalid Rune format: {value}.", e);
+ }
+ } else {
+ return new System.Rune (value [0]);
+ }
+ throw new JsonException ($"Invalid Rune format: {value}.");
+ } else if (reader.TokenType == JsonTokenType.Number) {
+ return new System.Rune (reader.GetUInt32 ());
+ }
+ throw new JsonException ($"Unexpected StartObject token when parsing Rune: {reader.TokenType}.");
+ }
+
+ public override void Write (Utf8JsonWriter writer, System.Rune value, JsonSerializerOptions options)
+ {
+ // HACK: Writes a JSON comment in addition to the glyph to ease debugging.
+ // Technically, JSON comments are not valid, but we use relaxed decoding
+ // (ReadCommentHandling = JsonCommentHandling.Skip)
+ writer.WriteCommentValue ($"(U+{value.Value:X4})");
+ writer.WriteRawValue ($"\"{value}\"");
+ }
+ }
+#pragma warning restore 1591
+}
diff --git a/Terminal.Gui/Configuration/Scope.cs b/Terminal.Gui/Configuration/Scope.cs
index c69aae46e..d950405ed 100644
--- a/Terminal.Gui/Configuration/Scope.cs
+++ b/Terminal.Gui/Configuration/Scope.cs
@@ -82,7 +82,7 @@ namespace Terminal.Gui {
/// config data to/from JSON documents.
///
///
- public class ScopeJsonConverter : JsonConverter where scopeT : Scope {
+ class ScopeJsonConverter : JsonConverter where scopeT : Scope {
// See: https://stackoverflow.com/questions/60830084/how-to-pass-an-argument-by-reference-using-reflection
internal abstract class ReadHelper {
public abstract object? Read (ref Utf8JsonReader reader, Type type, JsonSerializerOptions options);
@@ -97,7 +97,6 @@ namespace Terminal.Gui {
=> _readDelegate.Invoke (ref reader, type, options);
}
- ///
public override scopeT Read (ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType != JsonTokenType.StartObject) {
@@ -170,7 +169,6 @@ namespace Terminal.Gui {
throw new JsonException ();
}
- ///
public override void Write (Utf8JsonWriter writer, scopeT scope, JsonSerializerOptions options)
{
writer.WriteStartObject ();
diff --git a/Terminal.Gui/Configuration/SettingsScope.cs b/Terminal.Gui/Configuration/SettingsScope.cs
index cc91eb0e2..2bf7288c3 100644
--- a/Terminal.Gui/Configuration/SettingsScope.cs
+++ b/Terminal.Gui/Configuration/SettingsScope.cs
@@ -47,7 +47,7 @@ namespace Terminal.Gui {
{
// Update the existing settings with the new settings.
try {
- Update (JsonSerializer.Deserialize (stream, serializerOptions)!);
+ Update (JsonSerializer.Deserialize (stream, _serializerOptions)!);
OnUpdated ();
Debug.WriteLine ($"ConfigurationManager: Read configuration from \"{source}\"");
Sources.Add (source);
diff --git a/Terminal.Gui/Configuration/ThemeScope.cs b/Terminal.Gui/Configuration/ThemeScope.cs
index 3bab13810..04adf94a5 100644
--- a/Terminal.Gui/Configuration/ThemeScope.cs
+++ b/Terminal.Gui/Configuration/ThemeScope.cs
@@ -203,62 +203,49 @@ namespace Terminal.Gui {
}
#region IDictionary
- ///
+#pragma warning disable 1591
+
public ICollection Keys => ((IDictionary)Themes!).Keys;
- ///
public ICollection Values => ((IDictionary)Themes!).Values;
- ///
public int Count => ((ICollection>)Themes!).Count;
- ///
public bool IsReadOnly => ((ICollection>)Themes!).IsReadOnly;
- ///
public ThemeScope this [string key] { get => ((IDictionary)Themes!) [key]; set => ((IDictionary)Themes!) [key] = value; }
- ///
public void Add (string key, ThemeScope value)
{
((IDictionary)Themes!).Add (key, value);
}
- ///
public bool ContainsKey (string key)
{
return ((IDictionary)Themes!).ContainsKey (key);
}
- ///
public bool Remove (string key)
{
return ((IDictionary)Themes!).Remove (key);
}
- ///
public bool TryGetValue (string key, out ThemeScope value)
{
return ((IDictionary)Themes!).TryGetValue (key, out value!);
}
- ///
public void Add (KeyValuePair item)
{
((ICollection>)Themes!).Add (item);
}
- ///
public void Clear ()
{
((ICollection>)Themes!).Clear ();
}
- ///
public bool Contains (KeyValuePair item)
{
return ((ICollection>)Themes!).Contains (item);
}
- ///
public void CopyTo (KeyValuePair [] array, int arrayIndex)
{
((ICollection>)Themes!).CopyTo (array, arrayIndex);
}
- ///
public bool Remove (KeyValuePair item)
{
return ((ICollection>)Themes!).Remove (item);
}
- ///
public IEnumerator> GetEnumerator ()
{
return ((IEnumerable>)Themes!).GetEnumerator ();
@@ -268,6 +255,8 @@ namespace Terminal.Gui {
{
return ((IEnumerable)Themes!).GetEnumerator ();
}
+#pragma warning restore 1591
+
#endregion
}
}
diff --git a/Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs b/Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs
index 2449a45c5..597e85c01 100644
--- a/Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs
+++ b/Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs
@@ -1000,341 +1000,6 @@ namespace Terminal.Gui {
///
public abstract void CookMouse ();
- ///
- /// Horizontal line character.
- ///
- public Rune HLine = '\u2500';
-
- ///
- /// Vertical line character.
- ///
- public Rune VLine = '\u2502';
-
- ///
- /// Stipple pattern
- ///
- public Rune Stipple = '\u2591';
-
- ///
- /// Diamond character
- ///
- public Rune Diamond = '\u25ca';
-
- ///
- /// Upper left corner
- ///
- public Rune ULCorner = '\u250C';
-
- ///
- /// Lower left corner
- ///
- public Rune LLCorner = '\u2514';
-
- ///
- /// Upper right corner
- ///
- public Rune URCorner = '\u2510';
-
- ///
- /// Lower right corner
- ///
- public Rune LRCorner = '\u2518';
-
- ///
- /// Left tee
- ///
- public Rune LeftTee = '\u251c';
-
- ///
- /// Right tee
- ///
- public Rune RightTee = '\u2524';
-
- ///
- /// Top tee
- ///
- public Rune TopTee = '\u252c';
-
- ///
- /// The bottom tee.
- ///
- public Rune BottomTee = '\u2534';
-
- ///
- /// Checkmark.
- ///
- public Rune Checked = '\u221a';
-
- ///
- /// Un-checked checkmark.
- ///
- public Rune UnChecked = '\u2574';
-
- ///
- /// Null-checked checkmark.
- ///
- public Rune NullChecked = '\u2370';
-
- ///
- /// Selected mark.
- ///
- public Rune Selected = '\u25cf';
-
- ///
- /// Un-selected selected mark.
- ///
- public Rune UnSelected = '\u25cc';
-
- ///
- /// Right Arrow.
- ///
- public Rune RightArrow = '\u25ba';
-
- ///
- /// Left Arrow.
- ///
- public Rune LeftArrow = '\u25c4';
-
- ///
- /// Down Arrow.
- ///
- public Rune DownArrow = '\u25bc';
-
- ///
- /// Up Arrow.
- ///
- public Rune UpArrow = '\u25b2';
-
- ///
- /// Left indicator for default action (e.g. for ).
- ///
- public Rune LeftDefaultIndicator = '\u25e6';
-
- ///
- /// Right indicator for default action (e.g. for ).
- ///
- public Rune RightDefaultIndicator = '\u25e6';
-
- ///
- /// Left frame/bracket (e.g. '[' for ).
- ///
- public Rune LeftBracket = '[';
-
- ///
- /// Right frame/bracket (e.g. ']' for ).
- ///
- public Rune RightBracket = ']';
-
- ///
- /// Blocks Segment indicator for meter views (e.g. .
- ///
- public Rune BlocksMeterSegment = '\u258c';
-
- ///
- /// Continuous Segment indicator for meter views (e.g. .
- ///
- public Rune ContinuousMeterSegment = '\u2588';
-
- ///
- /// Horizontal double line character.
- ///
- public Rune HDbLine = '\u2550';
-
- ///
- /// Vertical double line character.
- ///
- public Rune VDbLine = '\u2551';
-
- ///
- /// Upper left double corner
- ///
- public Rune ULDbCorner = '\u2554';
-
- ///
- /// Lower left double corner
- ///
- public Rune LLDbCorner = '\u255a';
-
- ///
- /// Upper right double corner
- ///
- public Rune URDbCorner = '\u2557';
-
- ///
- /// Lower right double corner
- ///
- public Rune LRDbCorner = '\u255d';
-
- ///
- /// Upper left rounded corner
- ///
- public Rune ULRCorner = '\u256d';
-
- ///
- /// Lower left rounded corner
- ///
- public Rune LLRCorner = '\u2570';
-
- ///
- /// Upper right rounded corner
- ///
- public Rune URRCorner = '\u256e';
-
- ///
- /// Lower right rounded corner
- ///
- public Rune LRRCorner = '\u256f';
-
- ///
- /// Horizontal double dashed line character.
- ///
- public Rune HDsLine = '\u254c';
-
- ///
- /// Vertical triple dashed line character.
- ///
- public Rune VDsLine = '\u2506';
-
- ///
- /// Horizontal triple dashed line character.
- ///
- public Rune HDtLine = '\u2504';
-
- ///
- /// Horizontal quadruple dashed line character.
- ///
- public Rune HD4Line = '\u2508';
-
- ///
- /// Vertical double dashed line character.
- ///
- public Rune VD2Line = '\u254e';
-
- ///
- /// Vertical quadruple dashed line character.
- ///
- public Rune VDtLine = '\u250a';
-
- ///
- /// Horizontal heavy line character.
- ///
- public Rune HThLine = '\u2501';
-
- ///
- /// Vertical heavy line character.
- ///
- public Rune VThLine = '\u2503';
-
- ///
- /// Upper left heavy corner
- ///
- public Rune ULThCorner = '\u250f';
-
- ///
- /// Lower left heavy corner
- ///
- public Rune LLThCorner = '\u2517';
-
- ///
- /// Upper right heavy corner
- ///
- public Rune URThCorner = '\u2513';
-
- ///
- /// Lower right heavy corner
- ///
- public Rune LRThCorner = '\u251b';
-
- ///
- /// Horizontal heavy double dashed line character.
- ///
- public Rune HThDsLine = '\u254d';
-
- ///
- /// Vertical heavy triple dashed line character.
- ///
- public Rune VThDsLine = '\u2507';
-
- ///
- /// Horizontal heavy triple dashed line character.
- ///
- public Rune HThDtLine = '\u2505';
-
- ///
- /// Horizontal heavy quadruple dashed line character.
- ///
- public Rune HThD4Line = '\u2509';
-
- ///
- /// Vertical heavy double dashed line character.
- ///
- public Rune VThD2Line = '\u254f';
-
- ///
- /// Vertical heavy quadruple dashed line character.
- ///
- public Rune VThDtLine = '\u250b';
-
- ///
- /// The left half line.
- ///
- public Rune HalfLeftLine = '\u2574';
-
- ///
- /// The up half line.
- ///
- public Rune HalfTopLine = '\u2575';
-
- ///
- /// The right half line.
- ///
- public Rune HalfRightLine = '\u2576';
-
- ///
- /// The down half line.
- ///
- public Rune HalfBottomLine = '\u2577';
-
- ///
- /// The heavy left half line.
- ///
- public Rune ThHalfLeftLine = '\u2578';
-
- ///
- /// The heavy up half line.
- ///
- public Rune ThHalfTopLine = '\u2579';
-
- ///
- /// The heavy right half line.
- ///
- public Rune ThHalfRightLine = '\u257a';
-
- ///
- /// The heavy light down half line.
- ///
- public Rune ThHalfBottomLine = '\u257b';
-
- ///
- /// The light left and heavy right line.
- ///
- public Rune ThRightSideLine = '\u257c';
-
- ///
- /// The light up and heavy down line.
- ///
- public Rune ThBottomSideLine = '\u257d';
-
- ///
- /// The heavy left and light right line.
- ///
- public Rune ThLeftSideLine = '\u257e';
-
- ///
- /// The heavy up and light down line.
- ///
- public Rune ThTopSideLine = '\u257f';
-
private Attribute currentAttribute;
///
diff --git a/Terminal.Gui/Drawing/Glyphs.cs b/Terminal.Gui/Drawing/Glyphs.cs
new file mode 100644
index 000000000..6d042d216
--- /dev/null
+++ b/Terminal.Gui/Drawing/Glyphs.cs
@@ -0,0 +1,647 @@
+using static Terminal.Gui.ConfigurationManager;
+using System.Text.Json.Serialization;
+using Rune = System.Rune;
+
+namespace Terminal.Gui {
+ ///
+ /// Defines the standard set of glyphs used to draw checkboxes, lines, borders, etc...
+ ///
+ ///
+ ///
+ /// The default glyphs can be changed via the . Within a config.json file
+ /// The JSon property name is the property prefixed with "CM.Glyphs.".
+ ///
+ ///
+ /// The JSon property can be either a decimal number or a string. The string may be one of:
+ /// - A unicode char (e.g. "☑")
+ /// - A hex value in U+ format (e.g. "U+2611")
+ /// - A hex value in UTF-16 format (e.g. "\\u2611")
+ ///
+ ///
+ public class GlyphDefinitions {
+ #region ----------------- Single Glyphs -----------------
+
+ ///
+ /// Checked indicator (e.g. for and ).
+ ///
+ public Rune Checked { get; set; } = '☑';
+
+ ///
+ /// Not Checked indicator (e.g. for and ).
+ ///
+ public Rune UnChecked { get; set; } = '☐';
+
+ ///
+ /// Null Checked indicator (e.g. for and ).
+ ///
+ public Rune NullChecked { get; set; } = '☒';
+
+ ///
+ /// Selected indicator (e.g. for and ).
+ ///
+ public Rune Selected { get; set; } = '◉';
+
+ ///
+ /// Not Selected indicator (e.g. for and ).
+ ///
+ public Rune UnSelected { get; set; } = '○';
+
+ ///
+ /// Horizontal arrow.
+ ///
+ public Rune RightArrow { get; set; } = '►';
+
+ ///
+ /// Left arrow.
+ ///
+ public Rune LeftArrow { get; set; } = '◄';
+
+ ///
+ /// Down arrow.
+ ///
+ public Rune DownArrow { get; set; } = '▼';
+
+ ///
+ /// Vertical arrow.
+ ///
+ public Rune UpArrow { get; set; } = '▲';
+
+ ///
+ /// Left default indicator (e.g. for .
+ ///
+ public Rune LeftDefaultIndicator { get; set; } = '►';
+
+ ///
+ /// Horizontal default indicator (e.g. for .
+ ///
+ public Rune RightDefaultIndicator { get; set; } = '◄';
+
+ ///
+ /// Left Bracket (e.g. for . Default is (U+005B) - [.
+ ///
+ public Rune LeftBracket { get; set; } = '⟦';
+
+ ///
+ /// Horizontal Bracket (e.g. for . Default is (U+005D) - ].
+ ///
+ public Rune RightBracket { get; set; } = '⟧';
+
+ ///
+ /// Half block meter segment (e.g. for ).
+ ///
+ public Rune BlocksMeterSegment { get; set; } = '▌';
+
+ ///
+ /// Continuous block meter segment (e.g. for ).
+ ///
+ public Rune ContinuousMeterSegment { get; set; } = '█';
+
+ ///
+ /// Stipple pattern (e.g. for ). Default is Light Shade (U+2591) - ░.
+ ///
+ public Rune Stipple { get; set; } = '░';
+
+ ///
+ /// Diamond (e.g. for . Default is Lozenge (U+25CA) - ◊.
+ ///
+ public Rune Diamond { get; set; } = '◊';
+
+ ///
+ /// Close. Default is Heavy Ballot X (U+2718) - ✘.
+ ///
+ public Rune Close { get; set; } = '✘';
+
+ ///
+ /// Minimize. Default is Lower Horizontal Shadowed White Circle (U+274F) - ❏.
+ ///
+ public Rune Minimize { get; set; } = '❏';
+
+ ///
+ /// Maximize. Default is Upper Horizontal Shadowed White Circle (U+273D) - ✽.
+ ///
+ public Rune Maximize { get; set; } = '✽';
+
+ ///
+ /// Dot. Default is (U+2219) - ∙.
+ ///
+ public Rune Dot { get; set; } = '∙';
+
+ ///
+ /// Expand (e.g. for .
+ ///
+ public Rune Expand { get; set; } = '+';
+
+ ///
+ /// Expand (e.g. for .
+ ///
+ public Rune Collapse { get; set; } = '-';
+
+ ///
+ /// Apple. Because snek.
+ ///
+ public Rune Apple { get; set; } = '❦' ; // BUGBUG: "🍎"[0] should work, but doesn't
+
+ #endregion
+
+ #region ----------------- Lines -----------------
+ ///
+ /// Box Drawings Horizontal Line - Light (U+2500) - ─
+ ///
+ public Rune HLine { get; set; } = '─';
+
+ ///
+ /// Box Drawings Vertical Line - Light (U+2502) - │
+ ///
+ public Rune VLine { get; set; } = '│';
+
+ ///
+ /// Box Drawings Double Horizontal (U+2550) - ═
+ ///
+ public Rune HLineDbl { get; set; } = '═';
+
+ ///
+ /// Box Drawings Double Vertical (U+2551) - ║
+ ///
+ public Rune VLineDbl { get; set; } = '║';
+
+ ///
+ /// Box Drawings Heavy Double Dash Horizontal (U+254D) - ╍
+ ///
+ public Rune HLineHvDa2 { get; set; } = '╍';
+
+ ///
+ /// Box Drawings Heavy Triple Dash Vertical (U+2507) - ┇
+ ///
+ public Rune VLineHvDa3 { get; set; } = '┇';
+
+ ///
+ /// Box Drawings Heavy Triple Dash Horizontal (U+2505) - ┅
+ ///
+ public Rune HLineHvDa3 { get; set; } = '┅';
+
+ ///
+ /// Box Drawings Heavy Quadruple Dash Horizontal (U+2509) - ┉
+ ///
+ public Rune HLineHvDa4 { get; set; } = '┉';
+
+ ///
+ /// Box Drawings Heavy Double Dash Vertical (U+254F) - ╏
+ ///
+ public Rune VLineHvDa2 { get; set; } = '╏';
+
+ ///
+ /// Box Drawings Heavy Quadruple Dash Vertical (U+250B) - ┋
+ ///
+ public Rune VLineHvDa4 { get; set; } = '┋';
+
+ ///
+ /// Box Drawings Light Double Dash Horizontal (U+254C) - ╌
+ ///
+ public Rune HLineDa2 { get; set; } = '╌';
+
+ ///
+ /// Box Drawings Light Triple Dash Vertical (U+2506) - ┆
+ ///
+ public Rune VLineDa3 { get; set; } = '┆';
+
+ ///
+ /// Box Drawings Light Triple Dash Horizontal (U+2504) - ┄
+ ///
+ public Rune HLineDa3 { get; set; } = '┄';
+
+ ///
+ /// Box Drawings Light Quadruple Dash Horizontal (U+2508) - ┈
+ ///
+ public Rune HLineDa4 { get; set; } = '┈';
+
+ ///
+ /// Box Drawings Light Double Dash Vertical (U+254E) - ╎
+ ///
+ public Rune VLineDa2 { get; set; } = '╎';
+
+ ///
+ /// Box Drawings Light Quadruple Dash Vertical (U+250A) - ┊
+ ///
+ public Rune VLineDa4 { get; set; } = '┊';
+
+ ///
+ /// Box Drawings Heavy Horizontal (U+2501) - ━
+ ///
+ public Rune HLineHv { get; set; } = '━';
+
+ ///
+ /// Box Drawings Heavy Vertical (U+2503) - ┃
+ ///
+ public Rune VLineHv { get; set; } = '┃';
+
+ ///
+ /// Box Drawings Light Left (U+2574) - ╴
+ ///
+ public Rune HalfLeftLine { get; set; } = '╴';
+
+ ///
+ /// Box Drawings Light Vertical (U+2575) - ╵
+ ///
+ public Rune HalfTopLine { get; set; } = '╵';
+
+ ///
+ /// Box Drawings Light Horizontal (U+2576) - ╶
+ ///
+ public Rune HalfRightLine { get; set; } = '╶';
+
+ ///
+ /// Box Drawings Light Down (U+2577) - ╷
+ ///
+ public Rune HalfBottomLine { get; set; } = '╷';
+
+ ///
+ /// Box Drawings Heavy Left (U+2578) - ╸
+ ///
+ public Rune HalfLeftLineHv { get; set; } = '╸';
+
+ ///
+ /// Box Drawings Heavy Vertical (U+2579) - ╹
+ ///
+ public Rune HalfTopLineHv { get; set; } = '╹';
+
+ ///
+ /// Box Drawings Heavy Horizontal (U+257A) - ╺
+ ///
+ public Rune HalfRightLineHv { get; set; } = '╺';
+
+ ///
+ /// Box Drawings Light Vertical and Horizontal (U+257B) - ╻
+ ///
+ public Rune HalfBottomLineLt { get; set; } = '╻';
+
+ ///
+ /// Box Drawings Light Horizontal and Heavy Horizontal (U+257C) - ╼
+ ///
+ public Rune RightSideLineLtHv { get; set; } = '╼';
+
+ ///
+ /// Box Drawings Light Vertical and Heavy Horizontal (U+257D) - ╽
+ ///
+ public Rune BottomSideLineLtHv { get; set; } = '╽';
+
+ ///
+ /// Box Drawings Heavy Left and Light Horizontal (U+257E) - ╾
+ ///
+ public Rune LeftSideLineHvLt { get; set; } = '╾';
+
+ ///
+ /// Box Drawings Heavy Vertical and Light Horizontal (U+257F) - ╿
+ ///
+ public Rune TopSideLineHvLt { get; set; } = '╿';
+ #endregion
+
+ #region ----------------- Upper Left Corners -----------------
+ ///
+ /// Box Drawings Upper Left Corner - Light Vertical and Light Horizontal (U+250C) - ┌
+ ///
+ public Rune ULCorner { get; set; } = '┌';
+
+ ///
+ /// Box Drawings Upper Left Corner - Double (U+2554) - ╔
+ ///
+ public Rune ULCornerDbl { get; set; } = '╔';
+
+ ///
+ /// Box Drawings Upper Left Corner - Light Arc Down and Horizontal (U+256D) - ╭
+ ///
+ public Rune ULCornerR { get; set; } = '╭';
+
+ ///
+ /// Box Drawings Heavy Down and Horizontal (U+250F) - ┏
+ ///
+ public Rune ULCornerHv { get; set; } = '┏';
+
+ ///
+ /// Box Drawings Down Heavy and Horizontal Light (U+251E) - ┎
+ ///
+ public Rune ULCornerHvLt { get; set; } = '┎';
+
+ ///
+ /// Box Drawings Down Light and Horizontal Heavy (U+250D) - ┎
+ ///
+ public Rune ULCornerLtHv { get; set; } = '┍';
+
+ ///
+ /// Box Drawings Double Down and Single Horizontal (U+2553) - ╓
+ ///
+ public Rune ULCornerDblSingle { get; set; } = '╓';
+
+ ///
+ /// Box Drawings Single Down and Double Horizontal (U+2552) - ╒
+ ///
+ public Rune ULCornerSingleDbl { get; set; } = '╒';
+ #endregion
+
+ #region ----------------- Lower Left Corners -----------------
+ ///
+ /// Box Drawings Lower Left Corner - Light Vertical and Light Horizontal (U+2514) - └
+ ///
+ public Rune LLCorner { get; set; } = '└';
+
+ ///
+ /// Box Drawings Heavy Vertical and Horizontal (U+2517) - ┗
+ ///
+ public Rune LLCornerHv { get; set; } = '┗';
+
+ ///
+ /// Box Drawings Heavy Vertical and Horizontal Light (U+2516) - ┖
+ ///
+ public Rune LLCornerHvLt { get; set; } = '┖';
+
+ ///
+ /// Box Drawings Vertical Light and Horizontal Heavy (U+2511) - ┕
+ ///
+ public Rune LLCornerLtHv { get; set; } = '┕';
+
+ ///
+ /// Box Drawings Double Vertical and Double Left (U+255A) - ╚
+ ///
+ public Rune LLCornerDbl { get; set; } = '╚';
+
+ ///
+ /// Box Drawings Single Vertical and Double Left (U+2558) - ╘
+ ///
+ public Rune LLCornerSingleDbl { get; set; } = '╘';
+
+ ///
+ /// Box Drawings Double Down and Single Left (U+2559) - ╙
+ ///
+ public Rune LLCornerDblSingle { get; set; } = '╙';
+
+ ///
+ /// Box Drawings Upper Left Corner - Light Arc Down and Left (U+2570) - ╰
+ ///
+ public Rune LLCornerR { get; set; } = '╰';
+
+ #endregion
+
+ #region ----------------- Upper Right Corners -----------------
+ ///
+ /// Box Drawings Upper Horizontal Corner - Light Vertical and Light Horizontal (U+2510) - ┐
+ ///
+ public Rune URCorner { get; set; } = '┐';
+
+ ///
+ /// Box Drawings Upper Horizontal Corner - Double Vertical and Double Horizontal (U+2557) - ╗
+ ///
+ public Rune URCornerDbl { get; set; } = '╗';
+
+ ///
+ /// Box Drawings Upper Horizontal Corner - Light Arc Vertical and Horizontal (U+256E) - ╮
+ ///
+ public Rune URCornerR { get; set; } = '╮';
+
+ ///
+ /// Box Drawings Heavy Down and Left (U+2513) - ┓
+ ///
+ public Rune URCornerHv { get; set; } = '┓';
+
+ ///
+ /// Box Drawings Heavy Vertical and Left Down Light (U+2511) - ┑
+ ///
+ public Rune URCornerHvLt { get; set; } = '┑';
+
+ ///
+ /// Box Drawings Down Light and Horizontal Heavy (U+2514) - ┒
+ ///
+ public Rune URCornerLtHv { get; set; } = '┒';
+
+ ///
+ /// Box Drawings Double Vertical and Single Left (U+2556) - ╖
+ ///
+ public Rune URCornerDblSingle { get; set; } = '╖';
+
+ ///
+ /// Box Drawings Single Vertical and Double Left (U+2555) - ╕
+ ///
+ public Rune URCornerSingleDbl { get; set; } = '╕';
+ #endregion
+
+ #region ----------------- Lower Right Corners -----------------
+ ///
+ /// Box Drawings Lower Right Corner - Light (U+2518) - ┘
+ ///
+ public Rune LRCorner { get; set; } = '┘';
+
+ ///
+ /// Box Drawings Lower Right Corner - Double (U+255D) - ╝
+ ///
+ public Rune LRCornerDbl { get; set; } = '╝';
+
+ ///
+ /// Box Drawings Lower Right Corner - Rounded (U+256F) - ╯
+ ///
+ public Rune LRCornerR { get; set; } = '╯';
+
+ ///
+ /// Box Drawings Lower Right Corner - Heavy (U+251B) - ┛
+ ///
+ public Rune LRCornerHv { get; set; } = '┛';
+
+ ///
+ /// Box Drawings Lower Right Corner - Double Vertical and Single Horizontal (U+255C) - ╜
+ ///
+ public Rune LRCornerDblSingle { get; set; } = '╜';
+
+ ///
+ /// Box Drawings Lower Right Corner - Single Vertical and Double Horizontal (U+255B) - ╛
+ ///
+ public Rune LRCornerSingleDbl { get; set; } = '╛';
+
+ ///
+ /// Box Drawings Lower Right Corner - Light Vertical and Heavy Horizontal (U+2519) - ┙
+ ///
+ public Rune LRCornerLtHv { get; set; } = '┙';
+
+ ///
+ /// Box Drawings Lower Right Corner - Heavy Vertical and Light Horizontal (U+251A) - ┚
+ ///
+ public Rune LRCornerHvLt { get; set; } = '┚';
+ #endregion
+
+ #region ----------------- Tees -----------------
+ ///
+ /// Box Drawings Left Tee - Single Vertical and Single Horizontal (U+251C) - ├
+ ///
+ public Rune LeftTee { get; set; } = '├';
+
+ ///
+ /// Box Drawings Left Tee - Single Vertical and Double Horizontal (U+255E) - ╞
+ ///
+ public Rune LeftTeeDblH { get; set; } = '╞';
+
+ ///
+ /// Box Drawings Left Tee - Double Vertical and Single Horizontal (U+255F) - ╟
+ ///
+ public Rune LeftTeeDblV { get; set; } = '╟';
+
+ ///
+ /// Box Drawings Left Tee - Double Vertical and Double Horizontal (U+2560) - ╠
+ ///
+ public Rune LeftTeeDbl { get; set; } = '╠';
+
+ ///
+ /// Box Drawings Left Tee - Heavy Horizontal and Light Vertical (U+2523) - ┝
+ ///
+ public Rune LeftTeeHvH { get; set; } = '┝';
+
+ ///
+ /// Box Drawings Left Tee - Light Horizontal and Heavy Vertical (U+252B) - ┠
+ ///
+ public Rune LeftTeeHvV { get; set; } = '┠';
+
+ ///
+ /// Box Drawings Left Tee - Heavy Vertical and Heavy Horizontal (U+2527) - ┣
+ ///
+ public Rune LeftTeeHvDblH { get; set; } = '┣';
+
+ ///
+ /// Box Drawings Righ Tee - Single Vertical and Single Horizontal (U+2524) - ┤
+ ///
+ public Rune RightTee { get; set; } = '┤';
+
+ ///
+ /// Box Drawings Right Tee - Single Vertical and Double Horizontal (U+2561) - ╡
+ ///
+ public Rune RightTeeDblH { get; set; } = '╡';
+
+ ///
+ /// Box Drawings Right Tee - Double Vertical and Single Horizontal (U+2562) - ╢
+ ///
+ public Rune RightTeeDblV { get; set; } = '╢';
+
+ ///
+ /// Box Drawings Right Tee - Double Vertical and Double Horizontal (U+2563) - ╣
+ ///
+ public Rune RightTeeDbl { get; set; } = '╣';
+
+ ///
+ /// Box Drawings Right Tee - Heavy Horizontal and Light Vertical (U+2528) - ┥
+ ///
+ public Rune RightTeeHvH { get; set; } = '┥';
+
+ ///
+ /// Box Drawings Right Tee - Light Horizontal and Heavy Vertical (U+2530) - ┨
+ ///
+ public Rune RightTeeHvV { get; set; } = '┨';
+
+ ///
+ /// Box Drawings Right Tee - Heavy Vertical and Heavy Horizontal (U+252C) - ┫
+ ///
+ public Rune RightTeeHvDblH { get; set; } = '┫';
+
+ ///
+ /// Box Drawings Top Tee - Single Vertical and Single Horizontal (U+252C) - ┬
+ ///
+ public Rune TopTee { get; set; } = '┬';
+
+ ///
+ /// Box Drawings Top Tee - Single Vertical and Double Horizontal (U+2564) - ╤
+ ///
+ public Rune TopTeeDblH { get; set; } = '╤';
+
+ ///
+ /// Box Drawings Top Tee - Double Vertical and Single Horizontal (U+2565) - ╥
+ ///
+ public Rune TopTeeDblV { get; set; } = '╥';
+
+ ///
+ /// Box Drawings Top Tee - Double Vertical and Double Horizontal (U+2566) - ╦
+ ///
+ public Rune TopTeeDbl { get; set; } = '╦';
+
+ ///
+ /// Box Drawings Top Tee - Heavy Horizontal and Light Vertical (U+252F) - ┯
+ ///
+ public Rune TopTeeHvH { get; set; } = '┯';
+
+ ///
+ /// Box Drawings Top Tee - Light Horizontal and Heavy Vertical (U+2537) - ┰
+ ///
+ public Rune TopTeeHvV { get; set; } = '┰';
+
+ ///
+ /// Box Drawings Top Tee - Heavy Vertical and Heavy Horizontal (U+2533) - ┳
+ ///
+ public Rune TopTeeHvDblH { get; set; } = '┳';
+
+ ///
+ /// Box Drawings Bottom Tee - Single Vertical and Single Horizontal (U+2534) - ┴
+ ///
+ public Rune BottomTee { get; set; } = '┴';
+
+ ///
+ /// Box Drawings Bottom Tee - Single Vertical and Double Horizontal (U+2567) - ╧
+ ///
+ public Rune BottomTeeDblH { get; set; } = '╧';
+
+ ///
+ /// Box Drawings Bottom Tee - Double Vertical and Single Horizontal (U+2568) - ╨
+ ///
+ public Rune BottomTeeDblV { get; set; } = '╨';
+
+ ///
+ /// Box Drawings Bottom Tee - Double Vertical and Double Horizontal (U+2569) - ╩
+ ///
+ public Rune BottomTeeDbl { get; set; } = '╩';
+
+ ///
+ /// Box Drawings Bottom Tee - Heavy Horizontal and Light Vertical (U+2535) - ┷
+ ///
+ public Rune BottomTeeHvH { get; set; } = '┷';
+
+ ///
+ /// Box Drawings Bottom Tee - Light Horizontal and Heavy Vertical (U+253D) - ┸
+ ///
+ public Rune BottomTeeHvV { get; set; } = '┸';
+
+ ///
+ /// Box Drawings Bottom Tee - Heavy Vertical and Heavy Horizontal (U+2539) - ┻
+ ///
+ public Rune BottomTeeHvDblH { get; set; } = '┻';
+
+ #endregion
+
+ #region ----------------- Crosses -----------------
+ ///
+ /// Box Drawings Cross - Single Vertical and Single Horizontal (U+253C) - ┼
+ ///
+ public Rune Cross { get; set; } = '┼';
+
+ ///
+ /// Box Drawings Cross - Single Vertical and Double Horizontal (U+256A) - ╪
+ ///
+ public Rune CrossDblH { get; set; } = '╪';
+
+ ///
+ /// Box Drawings Cross - Double Vertical and Single Horizontal (U+256B) - ╫
+ ///
+ public Rune CrossDblV { get; set; } = '╫';
+
+ ///
+ /// Box Drawings Cross - Double Vertical and Double Horizontal (U+256C) - ╬
+ ///
+ public Rune CrossDbl { get; set; } = '╬';
+
+ ///
+ /// Box Drawings Cross - Heavy Horizontal and Light Vertical (U+253F) - ┿
+ ///
+ public Rune CrossHvH { get; set; } = '┿';
+
+ ///
+ /// Box Drawings Cross - Light Horizontal and Heavy Vertical (U+2541) - ╂
+ ///
+ public Rune CrossHvV { get; set; } = '╂';
+
+ ///
+ /// Box Drawings Cross - Heavy Vertical and Heavy Horizontal (U+254B) - ╋
+ ///
+ public Rune CrossHv { get; set; } = '╋';
+ #endregion
+ }
+}
diff --git a/Terminal.Gui/Drawing/LineCanvas.cs b/Terminal.Gui/Drawing/LineCanvas.cs
index 81c20650c..6aff2a319 100644
--- a/Terminal.Gui/Drawing/LineCanvas.cs
+++ b/Terminal.Gui/Drawing/LineCanvas.cs
@@ -16,7 +16,7 @@ namespace Terminal.Gui {
///
None,
///
- /// The border is drawn using thin line glyphs.
+ /// The border is drawn using thin line CM.Glyphs.
///
Single,
///
@@ -28,11 +28,11 @@ namespace Terminal.Gui {
///
Dotted,
///
- /// The border is drawn using thin double line glyphs.
+ /// The border is drawn using thin double line CM.Glyphs.
///
Double,
///
- /// The border is drawn using heavy line glyphs.
+ /// The border is drawn using heavy line CM.Glyphs.
///
Heavy,
///
@@ -67,6 +67,21 @@ namespace Terminal.Gui {
/// and rendering. Does not support diagonal lines.
///
public class LineCanvas {
+ ///
+ /// Creates a new instance.
+ ///
+ public LineCanvas()
+ {
+ ConfigurationManager.Applied += ConfigurationManager_Applied;
+ }
+
+ private void ConfigurationManager_Applied (object sender, ConfigurationManagerEventArgs e)
+ {
+ foreach (var irr in runeResolvers) {
+ irr.Value.SetGlyphs ();
+ }
+ }
+
private List _lines = new List ();
Dictionary runeResolvers = new Dictionary {
@@ -80,7 +95,7 @@ namespace Terminal.Gui {
{IntersectionRuneType.RightTee,new RightTeeIntersectionRuneResolver()},
{IntersectionRuneType.BottomTee,new BottomTeeIntersectionRuneResolver()},
- {IntersectionRuneType.Crosshair,new CrosshairIntersectionRuneResolver()},
+ {IntersectionRuneType.Cross,new CrossIntersectionRuneResolver()},
// TODO: Add other resolvers
};
@@ -272,26 +287,25 @@ namespace Terminal.Gui {
}
private abstract class IntersectionRuneResolver {
- readonly Rune round;
- readonly Rune doubleH;
- readonly Rune doubleV;
- readonly Rune doubleBoth;
- readonly Rune thickH;
- readonly Rune thickV;
- readonly Rune thickBoth;
- readonly Rune normal;
+ internal Rune _round;
+ internal Rune _doubleH;
+ internal Rune _doubleV;
+ internal Rune _doubleBoth;
+ internal Rune _thickH;
+ internal Rune _thickV;
+ internal Rune _thickBoth;
+ internal Rune _normal;
- public IntersectionRuneResolver (Rune round, Rune doubleH, Rune doubleV, Rune doubleBoth, Rune thickH, Rune thickV, Rune thickBoth, Rune normal)
+ public IntersectionRuneResolver()
{
- this.round = round;
- this.doubleH = doubleH;
- this.doubleV = doubleV;
- this.doubleBoth = doubleBoth;
- this.thickH = thickH;
- this.thickV = thickV;
- this.thickBoth = thickBoth;
- this.normal = normal;
+ SetGlyphs ();
}
+
+ ///
+ /// Sets the glyphs used. Call this method after construction and any time
+ /// ConfigurationManager has updated the settings.
+ ///
+ public abstract void SetGlyphs ();
public Rune? GetRuneForIntersects (ConsoleDriver driver, IntersectionDefinition [] intersects)
{
@@ -309,87 +323,140 @@ namespace Terminal.Gui {
l.Line.Style == LineStyle.Heavy || l.Line.Style == LineStyle.HeavyDashed || l.Line.Style == LineStyle.HeavyDotted));
if (doubleHorizontal) {
- return doubleVertical ? doubleBoth : doubleH;
+ return doubleVertical ? _doubleBoth : _doubleH;
}
if (doubleVertical) {
- return doubleV;
+ return _doubleV;
}
if (thickHorizontal) {
- return thickVertical ? thickBoth : thickH;
+ return thickVertical ? _thickBoth : _thickH;
}
if (thickVertical) {
- return thickV;
+ return _thickV;
}
- return useRounded ? round : normal;
+ return useRounded ? _round : _normal;
}
}
private class ULIntersectionRuneResolver : IntersectionRuneResolver {
- public ULIntersectionRuneResolver () :
- base ('╭', '╒', '╓', '╔', '┍', '┎', '┏', '┌')
+ public override void SetGlyphs ()
{
-
+ _round = CM.Glyphs.ULCornerR;
+ _doubleH = CM.Glyphs.ULCornerSingleDbl;
+ _doubleV = CM.Glyphs.ULCornerDblSingle;
+ _doubleBoth = CM.Glyphs.ULCornerDbl;
+ _thickH = CM.Glyphs.ULCornerLtHv;
+ _thickV = CM.Glyphs.ULCornerHvLt;
+ _thickBoth = CM.Glyphs.ULCornerHv;
+ _normal = CM.Glyphs.ULCorner;
}
}
private class URIntersectionRuneResolver : IntersectionRuneResolver {
-
- public URIntersectionRuneResolver () :
- base ('╮', '╕', '╖', '╗', '┑', '┒', '┓', '┐')
+ public override void SetGlyphs ()
{
-
+ _round = CM.Glyphs.URCornerR;
+ _doubleH = CM.Glyphs.URCornerSingleDbl;
+ _doubleV = CM.Glyphs.URCornerDblSingle;
+ _doubleBoth = CM.Glyphs.URCornerDbl;
+ _thickH = CM.Glyphs.URCornerHvLt;
+ _thickV = CM.Glyphs.URCornerLtHv;
+ _thickBoth = CM.Glyphs.URCornerHv;
+ _normal = CM.Glyphs.URCorner;
}
}
private class LLIntersectionRuneResolver : IntersectionRuneResolver {
-
- public LLIntersectionRuneResolver () :
- base ('╰', '╘', '╙', '╚', '┕', '┖', '┗', '└')
+ public override void SetGlyphs ()
{
-
+ _round = CM.Glyphs.LLCornerR;
+ _doubleH = CM.Glyphs.LLCornerSingleDbl;
+ _doubleV = CM.Glyphs.LLCornerDblSingle;
+ _doubleBoth = CM.Glyphs.LLCornerDbl;
+ _thickH = CM.Glyphs.LLCornerLtHv;
+ _thickV = CM.Glyphs.LLCornerHvLt;
+ _thickBoth = CM.Glyphs.LLCornerHv;
+ _normal = CM.Glyphs.LLCorner;
}
+
}
private class LRIntersectionRuneResolver : IntersectionRuneResolver {
- public LRIntersectionRuneResolver () :
- base ('╯', '╛', '╜', '╝', '┙', '┚', '┛', '┘')
+ public override void SetGlyphs ()
{
-
+ _round = CM.Glyphs.LRCornerR;
+ _doubleH = CM.Glyphs.LRCornerSingleDbl;
+ _doubleV = CM.Glyphs.LRCornerDblSingle;
+ _doubleBoth = CM.Glyphs.LRCornerDbl;
+ _thickH = CM.Glyphs.LRCornerLtHv;
+ _thickV = CM.Glyphs.LRCornerHvLt;
+ _thickBoth = CM.Glyphs.LRCornerHv;
+ _normal = CM.Glyphs.LRCorner;
}
}
private class TopTeeIntersectionRuneResolver : IntersectionRuneResolver {
- public TopTeeIntersectionRuneResolver () :
- base ('┬', '╤', '╥', '╦', '┯', '┰', '┳', '┬')
+ public override void SetGlyphs ()
{
-
+ _round = CM.Glyphs.TopTee;
+ _doubleH = CM.Glyphs.TopTeeDblH;
+ _doubleV = CM.Glyphs.TopTeeDblV;
+ _doubleBoth = CM.Glyphs.TopTeeDbl;
+ _thickH = CM.Glyphs.TopTeeHvH;
+ _thickV = CM.Glyphs.TopTeeHvV;
+ _thickBoth = CM.Glyphs.TopTeeHvDblH;
+ _normal = CM.Glyphs.TopTee;
}
}
private class LeftTeeIntersectionRuneResolver : IntersectionRuneResolver {
- public LeftTeeIntersectionRuneResolver () :
- base ('├', '╞', '╟', '╠', '┝', '┠', '┣', '├')
+ public override void SetGlyphs ()
{
-
+ _round = CM.Glyphs.LeftTee;
+ _doubleH = CM.Glyphs.LeftTeeDblH;
+ _doubleV = CM.Glyphs.LeftTeeDblV;
+ _doubleBoth = CM.Glyphs.LeftTeeDbl;
+ _thickH = CM.Glyphs.LeftTeeHvH;
+ _thickV = CM.Glyphs.LeftTeeHvV;
+ _thickBoth = CM.Glyphs.LeftTeeHvDblH;
+ _normal = CM.Glyphs.LeftTee;
}
}
private class RightTeeIntersectionRuneResolver : IntersectionRuneResolver {
- public RightTeeIntersectionRuneResolver () :
- base ('┤', '╡', '╢', '╣', '┥', '┨', '┫', '┤')
+ public override void SetGlyphs ()
{
-
+ _round = CM.Glyphs.RightTee;
+ _doubleH = CM.Glyphs.RightTeeDblH;
+ _doubleV = CM.Glyphs.RightTeeDblV;
+ _doubleBoth = CM.Glyphs.RightTeeDbl;
+ _thickH = CM.Glyphs.RightTeeHvH;
+ _thickV = CM.Glyphs.RightTeeHvV;
+ _thickBoth = CM.Glyphs.RightTeeHvDblH;
+ _normal = CM.Glyphs.RightTee;
}
}
private class BottomTeeIntersectionRuneResolver : IntersectionRuneResolver {
- public BottomTeeIntersectionRuneResolver () :
- base ('┴', '╧', '╨', '╩', '┷', '┸', '┻', '┴')
+ public override void SetGlyphs ()
{
-
+ _round = CM.Glyphs.BottomTee;
+ _doubleH = CM.Glyphs.BottomTeeDblH;
+ _doubleV = CM.Glyphs.BottomTeeDblV;
+ _doubleBoth = CM.Glyphs.BottomTeeDbl;
+ _thickH = CM.Glyphs.BottomTeeHvH;
+ _thickV = CM.Glyphs.BottomTeeHvV;
+ _thickBoth = CM.Glyphs.BottomTeeHvDblH;
+ _normal = CM.Glyphs.BottomTee;
}
}
- private class CrosshairIntersectionRuneResolver : IntersectionRuneResolver {
- public CrosshairIntersectionRuneResolver () :
- base ('┼', '╪', '╫', '╬', '┿', '╂', '╋', '┼')
+ private class CrossIntersectionRuneResolver : IntersectionRuneResolver {
+ public override void SetGlyphs ()
{
-
+ _round = CM.Glyphs.Cross;
+ _doubleH = CM.Glyphs.CrossDblH;
+ _doubleV = CM.Glyphs.CrossDblV;
+ _doubleBoth = CM.Glyphs.CrossDbl;
+ _thickH = CM.Glyphs.CrossHvH;
+ _thickV = CM.Glyphs.CrossHvV;
+ _thickBoth = CM.Glyphs.CrossHv;
+ _normal = CM.Glyphs.Cross;
}
}
@@ -421,29 +488,29 @@ namespace Terminal.Gui {
case IntersectionRuneType.None:
return null;
case IntersectionRuneType.Dot:
- return (Rune)'.';
+ return (Rune)CM.Glyphs.Dot;
case IntersectionRuneType.HLine:
if (useDouble) {
- return driver.HDbLine;
+ return CM.Glyphs.HLineDbl;
}
if (useDashed) {
- return driver.HDsLine;
+ return CM.Glyphs.HLineDa2;
}
if (useDotted) {
- return driver.HDtLine;
+ return CM.Glyphs.HLineDa3;
}
- return useThick ? driver.HThLine : (useThickDashed ? driver.HThDsLine : (useThickDotted ? driver.HThDtLine : driver.HLine));
+ return useThick ? CM.Glyphs.HLineHv : (useThickDashed ? CM.Glyphs.HLineHvDa2 : (useThickDotted ? CM.Glyphs.HLineHvDa3 : CM.Glyphs.HLine));
case IntersectionRuneType.VLine:
if (useDouble) {
- return driver.VDbLine;
+ return CM.Glyphs.VLineDbl;
}
if (useDashed) {
- return driver.VDsLine;
+ return CM.Glyphs.VLineDa3;
}
if (useDotted) {
- return driver.VDtLine;
+ return CM.Glyphs.VLineDa3;
}
- return useThick ? driver.VThLine : (useThickDashed ? driver.VThDsLine : (useThickDotted ? driver.VThDtLine : driver.VLine));
+ return useThick ? CM.Glyphs.VLineHv : (useThickDashed ? CM.Glyphs.VLineHvDa3 : (useThickDotted ? CM.Glyphs.VLineHvDa4 : CM.Glyphs.VLine));
default: throw new Exception ("Could not find resolver or switch case for " + nameof (runeType) + ":" + runeType);
}
@@ -464,8 +531,7 @@ namespace Terminal.Gui {
///
/// Represents a single row/column within the . Includes the glyph and the foreground/background colors.
///
- public class Cell
- {
+ public class Cell {
///
/// The glyph to draw.
///
@@ -494,12 +560,12 @@ namespace Terminal.Gui {
{
var set = new HashSet (intersects.Select (i => i.Type));
- #region Crosshair Conditions
+ #region Cross Conditions
if (Has (set,
IntersectionType.PassOverHorizontal,
IntersectionType.PassOverVertical
)) {
- return IntersectionRuneType.Crosshair;
+ return IntersectionRuneType.Cross;
}
if (Has (set,
@@ -507,7 +573,7 @@ namespace Terminal.Gui {
IntersectionType.StartLeft,
IntersectionType.StartRight
)) {
- return IntersectionRuneType.Crosshair;
+ return IntersectionRuneType.Cross;
}
if (Has (set,
@@ -515,7 +581,7 @@ namespace Terminal.Gui {
IntersectionType.StartUp,
IntersectionType.StartDown
)) {
- return IntersectionRuneType.Crosshair;
+ return IntersectionRuneType.Cross;
}
if (Has (set,
@@ -523,7 +589,7 @@ namespace Terminal.Gui {
IntersectionType.StartRight,
IntersectionType.StartUp,
IntersectionType.StartDown)) {
- return IntersectionRuneType.Crosshair;
+ return IntersectionRuneType.Cross;
}
#endregion
@@ -694,7 +760,7 @@ namespace Terminal.Gui {
BottomTee,
RightTee,
LeftTee,
- Crosshair,
+ Cross,
HLine,
VLine,
}
diff --git a/Terminal.Gui/Drawing/Thickness.cs b/Terminal.Gui/Drawing/Thickness.cs
index fdb16200d..176db55c8 100644
--- a/Terminal.Gui/Drawing/Thickness.cs
+++ b/Terminal.Gui/Drawing/Thickness.cs
@@ -82,7 +82,7 @@ namespace Terminal.Gui {
}
///
- /// Gets the total width of the left and right sides of the rectangle. Sets the height of the left and right sides of the rectangle to half the specified value.
+ /// Gets the total height of the top and bottom sides of the rectangle. Sets the height of the top and bottom sides of the rectangle to half the specified value.
///
public int Vertical {
get {
@@ -94,7 +94,7 @@ namespace Terminal.Gui {
}
///
- /// Gets the total width of the top and bottom sides of the rectangle. Sets the width of the top and bottom sides of the rectangle to half the specified value.
+ /// Gets the total width of the left and right sides of the rectangle. Sets the width of the left and rigth sides of the rectangle to half the specified value.
///
public int Horizontal {
get {
@@ -224,7 +224,9 @@ namespace Terminal.Gui {
///
public static Thickness Empty => new Thickness (0);
- ///
+ /// Determines whether the specified object is equal to the current object.
+ /// The object to compare with the current object.
+ /// true if the specified object is equal to the current object; otherwise, false.
public override bool Equals (object obj)
{
//Check for null and compare run-time types.
@@ -243,7 +245,11 @@ namespace Terminal.Gui {
}
// IEquitable
- ///
+ ///
+ /// Indicates whether the current object is equal to another object of the same type.
+ ///
+ ///
+ /// true if the current object is equal to the other parameter; otherwise, false.
public bool Equals (Thickness other)
{
return other is not null &&
diff --git a/Terminal.Gui/FileServices/AllowedType.cs b/Terminal.Gui/FileServices/AllowedType.cs
index bcf44490c..36b1823a0 100644
--- a/Terminal.Gui/FileServices/AllowedType.cs
+++ b/Terminal.Gui/FileServices/AllowedType.cs
@@ -33,7 +33,10 @@ namespace Terminal.Gui {
return true;
}
- ///
+ ///
+ /// Returns a string representation of this .
+ ///
+ ///
public override string ToString ()
{
return Strings.fdAnyFiles + "(*.*)";
diff --git a/Terminal.Gui/FileServices/FileDialogRootTreeNode.cs b/Terminal.Gui/FileServices/FileDialogRootTreeNode.cs
index 0355ae4ed..e8bf1b32a 100644
--- a/Terminal.Gui/FileServices/FileDialogRootTreeNode.cs
+++ b/Terminal.Gui/FileServices/FileDialogRootTreeNode.cs
@@ -39,7 +39,10 @@ namespace Terminal.Gui {
///
public DirectoryInfo Path { get; }
- ///
+ ///
+ /// Returns a string representation of this instance ().
+ ///
+ ///
public override string ToString ()
{
return this.DisplayName;
diff --git a/Terminal.Gui/Input/KeystrokeNavigatorEventArgs.cs b/Terminal.Gui/Input/KeystrokeNavigatorEventArgs.cs
index 454f5a1e2..01ecd4b47 100644
--- a/Terminal.Gui/Input/KeystrokeNavigatorEventArgs.cs
+++ b/Terminal.Gui/Input/KeystrokeNavigatorEventArgs.cs
@@ -2,7 +2,7 @@
namespace Terminal.Gui {
///
- /// Event arguments for the event.
+ /// Event arguments for the event.
///
public class KeystrokeNavigatorEventArgs : EventArgs {
///
diff --git a/Terminal.Gui/Resources/config.json b/Terminal.Gui/Resources/config.json
index 63238ae1c..af1932937 100644
--- a/Terminal.Gui/Resources/config.json
+++ b/Terminal.Gui/Resources/config.json
@@ -1,14 +1,14 @@
{
- // This document specifies the "source of truth" for default values for all Terminal.GUi settings managed by
+ // Specifies the "source of truth" for default values for all Terminal.Gui settings managed by
// ConfigurationManager. It is automatically loaded, and applied, each time Application.Init
// is run (via the ConfiguraitonManager.Reset method).
//
// In otherwords, initial values set in the the codebase are always overwritten by the contents of this
- // file.
+ // resource embedded in the Terminal.Gui.dll assembly.
//
- // The Unit Test method "TestConfigurationManagerSaveDefaults" can be used to re-create the base of this file, but
+ // The Unit Test method "ConfigurationManagerTests.SaveDefaults" can be used to re-create the base of this file, but
// note that not all values here will be recreated (e.g. the Light and Dark themes and any property initialized
- // null.
+ // null).
//
"$schema": "https://gui-cs.github.io/Terminal.Gui/schemas/tui-config-schema.json",
"Application.AlternateBackwardKey": {
diff --git a/Terminal.Gui/Terminal.Gui.csproj b/Terminal.Gui/Terminal.Gui.csproj
index e9f2903d8..d70fbb6b3 100644
--- a/Terminal.Gui/Terminal.Gui.csproj
+++ b/Terminal.Gui/Terminal.Gui.csproj
@@ -63,7 +63,7 @@
net7.0
- 9.0
+ 10.0
Terminal.Gui
Terminal.Gui
bin\Release\Terminal.Gui.xml
diff --git a/Terminal.Gui/Views/Button.cs b/Terminal.Gui/Views/Button.cs
index 6a62ed15d..68d92275d 100644
--- a/Terminal.Gui/Views/Button.cs
+++ b/Terminal.Gui/Views/Button.cs
@@ -107,10 +107,10 @@ namespace Terminal.Gui {
HotKeySpecifier = new Rune ('_');
- _leftBracket = new Rune (Driver != null ? Driver.LeftBracket : '[');
- _rightBracket = new Rune (Driver != null ? Driver.RightBracket : ']');
- _leftDefault = new Rune (Driver != null ? Driver.LeftDefaultIndicator : '<');
- _rightDefault = new Rune (Driver != null ? Driver.RightDefaultIndicator : '>');
+ _leftBracket = CM.Glyphs.LeftBracket;
+ _rightBracket = CM.Glyphs.RightBracket;
+ _leftDefault = CM.Glyphs.LeftDefaultIndicator;
+ _rightDefault = CM.Glyphs.RightDefaultIndicator;
CanFocus = true;
AutoSize = true;
@@ -166,35 +166,29 @@ namespace Terminal.Gui {
///
///
///
- public bool NoDecorations {get;set;}
+ public bool NoDecorations { get; set; }
///
///
///
- public bool NoPadding {get;set;}
+ public bool NoPadding { get; set; }
///
protected override void UpdateTextFormatterText ()
{
- if(NoDecorations)
- {
+ if (NoDecorations) {
TextFormatter.Text = Text;
- }
- else
+ } else
if (IsDefault)
TextFormatter.Text = ustring.Make (_leftBracket) + ustring.Make (_leftDefault) + " " + Text + " " + ustring.Make (_rightDefault) + ustring.Make (_rightBracket);
- else
- {
- if(NoPadding)
- {
+ else {
+ if (NoPadding) {
TextFormatter.Text = ustring.Make (_leftBracket) + Text + ustring.Make (_rightBracket);
- }
- else
- {
+ } else {
TextFormatter.Text = ustring.Make (_leftBracket) + " " + Text + " " + ustring.Make (_rightBracket);
}
}
-
+
}
///
diff --git a/Terminal.Gui/Views/CheckBox.cs b/Terminal.Gui/Views/CheckBox.cs
index 1e7d22576..5195c0221 100644
--- a/Terminal.Gui/Views/CheckBox.cs
+++ b/Terminal.Gui/Views/CheckBox.cs
@@ -83,11 +83,11 @@ namespace Terminal.Gui {
///
void SetInitialProperties (ustring s, bool is_checked)
{
- charNullChecked = new Rune (Driver != null ? Driver.NullChecked : '?');
- charChecked = new Rune (Driver != null ? Driver.Checked : '√');
- charUnChecked = new Rune (Driver != null ? Driver.UnChecked : '╴');
+ charNullChecked = CM.Glyphs.NullChecked;
+ charChecked = CM.Glyphs.Checked;
+ charUnChecked = CM.Glyphs.UnChecked;
Checked = is_checked;
- HotKeySpecifier = new Rune ('_');
+ HotKeySpecifier = '_';
CanFocus = true;
AutoSize = true;
Text = s;
diff --git a/Terminal.Gui/Views/ColorPicker.cs b/Terminal.Gui/Views/ColorPicker.cs
index 1ae910d6c..4aaeddf86 100644
--- a/Terminal.Gui/Views/ColorPicker.cs
+++ b/Terminal.Gui/Views/ColorPicker.cs
@@ -280,5 +280,13 @@ namespace Terminal.Gui {
return true;
}
+
+ ///
+ public override bool OnEnter (View view)
+ {
+ Application.Driver.SetCursorVisibility (CursorVisibility.Invisible);
+
+ return base.OnEnter (view);
+ }
}
}
diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs
index fe14badd6..e63ebdbaf 100644
--- a/Terminal.Gui/Views/ComboBox.cs
+++ b/Terminal.Gui/Views/ComboBox.cs
@@ -131,7 +131,7 @@ namespace Terminal.Gui {
Driver.SetAttribute (current);
}
if (AllowsMarking) {
- Driver.AddRune (Source.IsMarked (item) ? (AllowsMultipleSelection ? Driver.Checked : Driver.Selected) : (AllowsMultipleSelection ? Driver.UnChecked : Driver.UnSelected));
+ Driver.AddRune (Source.IsMarked (item) ? (AllowsMultipleSelection ? CM.Glyphs.Checked : CM.Glyphs.Selected) : (AllowsMultipleSelection ? CM.Glyphs.UnChecked : CM.Glyphs.UnSelected));
Driver.AddRune (' ');
}
Source.Render (this, Driver, isSelected, item, col, row, f.Width - col, start);
@@ -544,7 +544,7 @@ namespace Terminal.Gui {
Driver.SetAttribute (ColorScheme.Focus);
Move (Bounds.Right - 1, 0);
- Driver.AddRune (Driver.DownArrow);
+ Driver.AddRune (CM.Glyphs.DownArrow);
}
///
diff --git a/Terminal.Gui/Views/Dialog.cs b/Terminal.Gui/Views/Dialog.cs
index 2522fc9cc..801419ea8 100644
--- a/Terminal.Gui/Views/Dialog.cs
+++ b/Terminal.Gui/Views/Dialog.cs
@@ -106,7 +106,9 @@ namespace Terminal.Gui {
buttons.Add (button);
Add (button);
SetNeedsDisplay ();
- LayoutSubviews ();
+ if (IsInitialized) {
+ LayoutSubviews ();
+ }
}
// Get the width of all buttons, not including any Margin.
diff --git a/Terminal.Gui/Views/FileDialog.cs b/Terminal.Gui/Views/FileDialog.cs
index 7f42ec418..cb980e3fa 100644
--- a/Terminal.Gui/Views/FileDialog.cs
+++ b/Terminal.Gui/Views/FileDialog.cs
@@ -395,12 +395,12 @@ namespace Terminal.Gui {
private string GetForwardButtonText ()
{
- return "-" + Driver.RightArrow;
+ return "-" + CM.Glyphs.RightArrow;
}
private string GetBackButtonText ()
{
- return Driver.LeftArrow + "-";
+ return CM.Glyphs.LeftArrow + "-";
}
private string GetUpButtonText ()
@@ -411,8 +411,8 @@ namespace Terminal.Gui {
private string GetToggleSplitterText (bool isExpanded)
{
return isExpanded ?
- new string ((char)Driver.LeftArrow, 2) :
- new string ((char)Driver.RightArrow, 2);
+ new string ((char)CM.Glyphs.LeftArrow, 2) :
+ new string ((char)CM.Glyphs.RightArrow, 2);
}
private void Delete ()
@@ -672,7 +672,7 @@ namespace Terminal.Gui {
allowedTypeMenuBar.DrawContentComplete += (s, e) => {
allowedTypeMenuBar.Move (e.Rect.Width - 1, 0);
- Driver.AddRune (Driver.DownArrow);
+ Driver.AddRune (CM.Glyphs.DownArrow);
};
diff --git a/Terminal.Gui/Views/GraphView/Axis.cs b/Terminal.Gui/Views/GraphView/Axis.cs
index 516cbee97..e1f197710 100644
--- a/Terminal.Gui/Views/GraphView/Axis.cs
+++ b/Terminal.Gui/Views/GraphView/Axis.cs
@@ -167,7 +167,7 @@ namespace Terminal.Gui {
protected override void DrawAxisLine (GraphView graph, int x, int y)
{
graph.Move (x, y);
- Application.Driver.AddRune (Application.Driver.HLine);
+ Application.Driver.AddRune (CM.Glyphs.HLine);
}
///
@@ -217,7 +217,7 @@ namespace Terminal.Gui {
graph.Move (screenPosition, y);
// draw the tick on the axis
- driver.AddRune (driver.TopTee);
+ Application.Driver.AddRune (CM.Glyphs.TopTee);
// and the label text
if (!string.IsNullOrWhiteSpace (text)) {
@@ -352,7 +352,7 @@ namespace Terminal.Gui {
protected override void DrawAxisLine (GraphView graph, int x, int y)
{
graph.Move (x, y);
- Application.Driver.AddRune (Application.Driver.VLine);
+ Application.Driver.AddRune (CM.Glyphs.VLine);
}
private int GetAxisYEnd (GraphView graph)
@@ -470,7 +470,7 @@ namespace Terminal.Gui {
graph.Move (x, screenPosition);
// draw the tick on the axis
- Application.Driver.AddRune (Application.Driver.RightTee);
+ Application.Driver.AddRune (CM.Glyphs.RightTee);
// and the label text
if (!string.IsNullOrWhiteSpace (text)) {
diff --git a/Terminal.Gui/Views/GraphView/Series.cs b/Terminal.Gui/Views/GraphView/Series.cs
index 19215d1a4..3715dd2fa 100644
--- a/Terminal.Gui/Views/GraphView/Series.cs
+++ b/Terminal.Gui/Views/GraphView/Series.cs
@@ -32,9 +32,9 @@ namespace Terminal.Gui {
///
/// The color and character that will be rendered in the console
/// when there are point(s) in the corresponding graph space.
- /// Defaults to uncolored 'x'
+ /// Defaults to uncolored 'dot'
///
- public GraphCellToRender Fill { get; set; } = new GraphCellToRender ('x');
+ public GraphCellToRender Fill { get; set; } = new GraphCellToRender (CM.Glyphs.Dot);
///
/// Draws all points directly onto the graph
diff --git a/Terminal.Gui/Views/LineView.cs b/Terminal.Gui/Views/LineView.cs
index cfe22e529..8dcb834a2 100644
--- a/Terminal.Gui/Views/LineView.cs
+++ b/Terminal.Gui/Views/LineView.cs
@@ -49,13 +49,13 @@ namespace Terminal.Gui {
case Orientation.Horizontal:
Height = 1;
Width = Dim.Fill ();
- LineRune = Driver.HLine;
+ LineRune = CM.Glyphs.HLine;
break;
case Orientation.Vertical:
Height = Dim.Fill ();
Width = 1;
- LineRune = Driver.VLine;
+ LineRune = CM.Glyphs.VLine;
break;
default:
throw new ArgumentException ($"Unknown Orientation {orientation}");
@@ -73,7 +73,7 @@ namespace Terminal.Gui {
Move (0, 0);
Driver.SetAttribute (GetNormalColor ());
- var hLineWidth = Math.Max (1, Rune.ColumnWidth (Driver.HLine));
+ var hLineWidth = Math.Max (1, Rune.ColumnWidth (CM.Glyphs.HLine));
var dEnd = Orientation == Orientation.Horizontal ?
Bounds.Width :
diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs
index 5e7fc76c2..da2627b28 100644
--- a/Terminal.Gui/Views/ListView.cs
+++ b/Terminal.Gui/Views/ListView.cs
@@ -385,8 +385,8 @@ namespace Terminal.Gui {
Driver.SetAttribute (current);
}
if (allowsMarking) {
- Driver.AddRune (source.IsMarked (item) ? (AllowsMultipleSelection ? Driver.Checked : Driver.Selected) :
- (AllowsMultipleSelection ? Driver.UnChecked : Driver.UnSelected));
+ Driver.AddRune (source.IsMarked (item) ? (AllowsMultipleSelection ? CM.Glyphs.Checked : CM.Glyphs.Selected) :
+ (AllowsMultipleSelection ? CM.Glyphs.UnChecked : CM.Glyphs.UnSelected));
Driver.AddRune (' ');
}
Source.Render (this, Driver, isSelected, item, col, row, f.Width - col, start);
diff --git a/Terminal.Gui/Views/Menu.cs b/Terminal.Gui/Views/Menu.cs
index b0cc4101d..02bb86475 100644
--- a/Terminal.Gui/Views/Menu.cs
+++ b/Terminal.Gui/Views/Menu.cs
@@ -591,7 +591,7 @@ namespace Terminal.Gui {
: i == current ? ColorScheme.Focus : GetNormalColor ());
if (item == null && BorderStyle != LineStyle.None) {
Move (-1, i);
- Driver.AddRune (Driver.LeftTee);
+ Driver.AddRune (CM.Glyphs.LeftTee);
} else if (Frame.X < Driver.Cols) {
Move (0, i);
}
@@ -605,12 +605,12 @@ namespace Terminal.Gui {
break;
}
if (item == null)
- Driver.AddRune (Driver.HLine);
+ Driver.AddRune (CM.Glyphs.HLine);
else if (i == 0 && p == 0 && host.UseSubMenusSingleFrame && item.Parent.Parent != null)
- Driver.AddRune (Driver.LeftArrow);
+ Driver.AddRune (CM.Glyphs.LeftArrow);
// This `- 3` is left border + right border + one row in from right
else if (p == Frame.Width - 3 && barItems.SubMenu (barItems.Children [i]) != null)
- Driver.AddRune (Driver.RightArrow);
+ Driver.AddRune (CM.Glyphs.RightArrow);
else
Driver.AddRune (' ');
}
@@ -618,19 +618,19 @@ namespace Terminal.Gui {
if (item == null) {
if (BorderStyle != LineStyle.None && SuperView?.Frame.Right - Frame.X > Frame.Width) {
Move (Frame.Width - 2, i);
- Driver.AddRune (Driver.RightTee);
+ Driver.AddRune (CM.Glyphs.RightTee);
}
continue;
}
ustring textToDraw;
- var nullCheckedChar = Driver.NullChecked;
- var checkChar = Driver.Selected;
- var uncheckedChar = Driver.UnSelected;
+ var nullCheckedChar = CM.Glyphs.NullChecked;
+ var checkChar = CM.Glyphs.Selected;
+ var uncheckedChar = CM.Glyphs.UnSelected;
if (item.CheckType.HasFlag (MenuItemCheckStyle.Checked)) {
- checkChar = Driver.Checked;
- uncheckedChar = Driver.UnChecked;
+ checkChar = CM.Glyphs.Checked;
+ uncheckedChar = CM.Glyphs.UnChecked;
}
// Support Checked even though CheckType wasn't set
diff --git a/Terminal.Gui/Views/ProgressBar.cs b/Terminal.Gui/Views/ProgressBar.cs
index cc386da77..78cd28d92 100644
--- a/Terminal.Gui/Views/ProgressBar.cs
+++ b/Terminal.Gui/Views/ProgressBar.cs
@@ -124,16 +124,16 @@ namespace Terminal.Gui {
progressBarStyle = value;
switch (value) {
case ProgressBarStyle.Blocks:
- SegmentCharacter = Driver.BlocksMeterSegment;
+ SegmentCharacter = CM.Glyphs.BlocksMeterSegment;
break;
case ProgressBarStyle.Continuous:
- SegmentCharacter = Driver.ContinuousMeterSegment;
+ SegmentCharacter = CM.Glyphs.ContinuousMeterSegment;
break;
case ProgressBarStyle.MarqueeBlocks:
- SegmentCharacter = Driver.BlocksMeterSegment;
+ SegmentCharacter = CM.Glyphs.BlocksMeterSegment;
break;
case ProgressBarStyle.MarqueeContinuous:
- SegmentCharacter = Driver.ContinuousMeterSegment;
+ SegmentCharacter = CM.Glyphs.ContinuousMeterSegment;
break;
}
SetNeedsDisplay ();
@@ -170,7 +170,7 @@ namespace Terminal.Gui {
}
}
- private Rune segmentCharacter = Driver.BlocksMeterSegment;
+ private Rune segmentCharacter = CM.Glyphs.BlocksMeterSegment;
///
/// Segment indicator for meter views.
diff --git a/Terminal.Gui/Views/RadioGroup.cs b/Terminal.Gui/Views/RadioGroup.cs
index c92511ece..62888880c 100644
--- a/Terminal.Gui/Views/RadioGroup.cs
+++ b/Terminal.Gui/Views/RadioGroup.cs
@@ -206,7 +206,7 @@ namespace Terminal.Gui {
}
var rl = radioLabels [i];
Driver.SetAttribute (GetNormalColor ());
- Driver.AddStr (ustring.Make (new Rune [] { i == selected ? Driver.Selected : Driver.UnSelected, ' ' }));
+ Driver.AddStr (ustring.Make (new Rune [] { i == selected ? CM.Glyphs.Selected : CM.Glyphs.UnSelected, ' ' }));
TextFormatter.FindHotKey (rl, HotKeySpecifier, true, out int hotPos, out Key hotKey);
if (hotPos != -1 && (hotKey != Key.Null || hotKey != Key.Unknown)) {
var rlRunes = rl.ToRunes ();
diff --git a/Terminal.Gui/Views/ScrollBarView.cs b/Terminal.Gui/Views/ScrollBarView.cs
index 13b741c17..988f7f74d 100644
--- a/Terminal.Gui/Views/ScrollBarView.cs
+++ b/Terminal.Gui/Views/ScrollBarView.cs
@@ -538,17 +538,17 @@ namespace Terminal.Gui {
Move (col, 0);
if (Bounds.Height == 1) {
- Driver.AddRune (Driver.Diamond);
+ Driver.AddRune (CM.Glyphs.Diamond);
} else {
- Driver.AddRune (Driver.UpArrow);
+ Driver.AddRune (CM.Glyphs.UpArrow);
}
if (Bounds.Height == 3) {
Move (col, 1);
- Driver.AddRune (Driver.Diamond);
+ Driver.AddRune (CM.Glyphs.Diamond);
}
if (Bounds.Height > 1) {
Move (col, Bounds.Height - 1);
- Driver.AddRune (Driver.DownArrow);
+ Driver.AddRune (CM.Glyphs.DownArrow);
}
} else {
bh -= 2;
@@ -559,7 +559,7 @@ namespace Terminal.Gui {
}
Move (col, 0);
- Driver.AddRune (Driver.UpArrow);
+ Driver.AddRune (CM.Glyphs.UpArrow);
bool hasTopTee = false;
bool hasDiamond = false;
@@ -567,22 +567,22 @@ namespace Terminal.Gui {
for (int y = 0; y < bh; y++) {
Move (col, y + 1);
if ((y < by1 || y > by2) && ((position > 0 && !hasTopTee) || (hasTopTee && hasBottomTee))) {
- special = Driver.Stipple;
+ special = CM.Glyphs.Stipple;
} else {
if (y != by2 && y > 1 && by2 - by1 == 0 && by1 < bh - 1 && hasTopTee && !hasDiamond) {
hasDiamond = true;
- special = Driver.Diamond;
+ special = CM.Glyphs.Diamond;
} else {
if (y == by1 && !hasTopTee) {
hasTopTee = true;
posTopTee = y;
- special = Driver.TopTee;
+ special = CM.Glyphs.TopTee;
} else if ((position == 0 && y == bh - 1 || y >= by2 || by2 == 0) && !hasBottomTee) {
hasBottomTee = true;
posBottomTee = y;
- special = Driver.BottomTee;
+ special = CM.Glyphs.BottomTee;
} else {
- special = Driver.VLine;
+ special = CM.Glyphs.VLine;
}
}
}
@@ -590,10 +590,10 @@ namespace Terminal.Gui {
}
if (!hasTopTee) {
Move (col, Bounds.Height - 2);
- Driver.AddRune (Driver.TopTee);
+ Driver.AddRune (CM.Glyphs.TopTee);
}
Move (col, Bounds.Height - 1);
- Driver.AddRune (Driver.DownArrow);
+ Driver.AddRune (CM.Glyphs.DownArrow);
}
} else {
if (Bounds.Bottom < Bounds.Height - 1) {
@@ -609,8 +609,8 @@ namespace Terminal.Gui {
var bx2 = (position + bw) * bw / Size;
Move (0, row);
- Driver.AddRune (Driver.LeftArrow);
- Driver.AddRune (Driver.RightArrow);
+ Driver.AddRune (CM.Glyphs.LeftArrow);
+ Driver.AddRune (CM.Glyphs.RightArrow);
} else {
bw -= 2;
var bx1 = KeepContentAlwaysInViewport ? position * bw / Size : position * bw / (Size + bw);
@@ -620,29 +620,29 @@ namespace Terminal.Gui {
}
Move (0, row);
- Driver.AddRune (Driver.LeftArrow);
+ Driver.AddRune (CM.Glyphs.LeftArrow);
bool hasLeftTee = false;
bool hasDiamond = false;
bool hasRightTee = false;
for (int x = 0; x < bw; x++) {
if ((x < bx1 || x >= bx2 + 1) && ((position > 0 && !hasLeftTee) || (hasLeftTee && hasRightTee))) {
- special = Driver.Stipple;
+ special = CM.Glyphs.Stipple;
} else {
if (x != bx2 && x > 1 && bx2 - bx1 == 0 && bx1 < bw - 1 && hasLeftTee && !hasDiamond) {
hasDiamond = true;
- special = Driver.Diamond;
+ special = CM.Glyphs.Diamond;
} else {
if (x == bx1 && !hasLeftTee) {
hasLeftTee = true;
posLeftTee = x;
- special = Driver.LeftTee;
+ special = CM.Glyphs.LeftTee;
} else if ((position == 0 && x == bw - 1 || x >= bx2 || bx2 == 0) && !hasRightTee) {
hasRightTee = true;
posRightTee = x;
- special = Driver.RightTee;
+ special = CM.Glyphs.RightTee;
} else {
- special = Driver.HLine;
+ special = CM.Glyphs.HLine;
}
}
}
@@ -650,10 +650,10 @@ namespace Terminal.Gui {
}
if (!hasLeftTee) {
Move (Bounds.Width - 2, row);
- Driver.AddRune (Driver.LeftTee);
+ Driver.AddRune (CM.Glyphs.LeftTee);
}
- Driver.AddRune (Driver.RightArrow);
+ Driver.AddRune (CM.Glyphs.RightArrow);
}
}
diff --git a/Terminal.Gui/Views/StatusBar.cs b/Terminal.Gui/Views/StatusBar.cs
index 7ea3766df..9cf90e274 100644
--- a/Terminal.Gui/Views/StatusBar.cs
+++ b/Terminal.Gui/Views/StatusBar.cs
@@ -138,7 +138,7 @@ namespace Terminal.Gui {
}
if (i + 1 < Items.Length) {
Driver.AddRune (' ');
- Driver.AddRune (Driver.VLine);
+ Driver.AddRune (CM.Glyphs.VLine);
Driver.AddRune (' ');
}
}
diff --git a/Terminal.Gui/Views/TabView.cs b/Terminal.Gui/Views/TabView.cs
index c74e7ddac..7bb2bf335 100644
--- a/Terminal.Gui/Views/TabView.cs
+++ b/Terminal.Gui/Views/TabView.cs
@@ -507,7 +507,7 @@ namespace Terminal.Gui {
}
Move (selected.X - 1, y);
- Driver.AddRune (host.Style.TabsOnBottom ? Driver.LLCorner : Driver.ULCorner);
+ Driver.AddRune (host.Style.TabsOnBottom ? CM.Glyphs.LLCorner : CM.Glyphs.ULCorner);
for (int i = 0; i < selected.Width; i++) {
@@ -516,11 +516,11 @@ namespace Terminal.Gui {
return;
}
- Driver.AddRune (Driver.HLine);
+ Driver.AddRune (CM.Glyphs.HLine);
}
// Add the end of the selected tab
- Driver.AddRune (host.Style.TabsOnBottom ? Driver.LRCorner : Driver.URCorner);
+ Driver.AddRune (host.Style.TabsOnBottom ? CM.Glyphs.LRCorner : CM.Glyphs.URCorner);
}
@@ -549,7 +549,7 @@ namespace Terminal.Gui {
if (toRender.IsSelected) {
Move (toRender.X - 1, y);
- Driver.AddRune (Driver.VLine);
+ Driver.AddRune (CM.Glyphs.VLine);
}
Move (toRender.X, y);
@@ -573,7 +573,7 @@ namespace Terminal.Gui {
Driver.SetAttribute (GetNormalColor ());
if (toRender.IsSelected) {
- Driver.AddRune (Driver.VLine);
+ Driver.AddRune (CM.Glyphs.VLine);
}
}
}
@@ -593,7 +593,7 @@ namespace Terminal.Gui {
if (!host.Style.ShowBorder) {
for (int x = 0; x < width; x++) {
- Driver.AddRune (Driver.HLine);
+ Driver.AddRune (CM.Glyphs.HLine);
}
}
@@ -605,14 +605,14 @@ namespace Terminal.Gui {
Move (selected.X - 1, y);
- Driver.AddRune (selected.X == 1 ? Driver.VLine :
- (host.Style.TabsOnBottom ? Driver.URCorner : Driver.LRCorner));
+ Driver.AddRune (selected.X == 1 ? CM.Glyphs.VLine :
+ (host.Style.TabsOnBottom ? CM.Glyphs.URCorner : CM.Glyphs.LRCorner));
Driver.AddStr (new string (' ', selected.Width));
Driver.AddRune (selected.X + selected.Width == width - 1 ?
- Driver.VLine :
- (host.Style.TabsOnBottom ? Driver.ULCorner : Driver.LLCorner));
+ CM.Glyphs.VLine :
+ (host.Style.TabsOnBottom ? CM.Glyphs.ULCorner : CM.Glyphs.LLCorner));
// draw scroll indicators
@@ -621,7 +621,7 @@ namespace Terminal.Gui {
Move (0, y);
// indicate that
- Driver.AddRune (Driver.LeftArrow);
+ Driver.AddRune (CM.Glyphs.LeftArrow);
}
// if there are more tabs to the right not visible
@@ -629,7 +629,7 @@ namespace Terminal.Gui {
Move (width - 1, y);
// indicate that
- Driver.AddRune (Driver.RightArrow);
+ Driver.AddRune (CM.Glyphs.RightArrow);
}
}
diff --git a/Terminal.Gui/Views/TableView/TableView.cs b/Terminal.Gui/Views/TableView/TableView.cs
index 03b7db565..66f812f4f 100644
--- a/Terminal.Gui/Views/TableView/TableView.cs
+++ b/Terminal.Gui/Views/TableView/TableView.cs
@@ -358,23 +358,23 @@ namespace Terminal.Gui {
for (int c = 0; c < availableWidth; c++) {
- var rune = Driver.HLine;
+ var rune = CM.Glyphs.HLine;
if (Style.ShowVerticalHeaderLines) {
if (c == 0) {
- rune = Driver.ULCorner;
+ rune = CM.Glyphs.ULCorner;
}
// if the next column is the start of a header
else if (columnsToRender.Any (r => r.X == c + 1)) {
- rune = Driver.TopTee;
+ rune = CM.Glyphs.TopTee;
} else if (c == availableWidth - 1) {
- rune = Driver.URCorner;
+ rune = CM.Glyphs.URCorner;
}
// if the next console column is the lastcolumns end
else if (Style.ExpandLastColumn == false &&
columnsToRender.Any (r => r.IsVeryLast && r.X + r.Width - 1 == c)) {
- rune = Driver.TopTee;
+ rune = CM.Glyphs.TopTee;
}
}
@@ -391,7 +391,7 @@ namespace Terminal.Gui {
//render start of line
if (style.ShowVerticalHeaderLines)
- AddRune (0, row, Driver.VLine);
+ AddRune (0, row, CM.Glyphs.VLine);
for (int i = 0; i < columnsToRender.Length; i++) {
@@ -413,7 +413,7 @@ namespace Terminal.Gui {
//render end of line
if (style.ShowVerticalHeaderLines)
- AddRune (Bounds.Width - 1, row, Driver.VLine);
+ AddRune (Bounds.Width - 1, row, CM.Glyphs.VLine);
}
private void RenderHeaderUnderline (int row, int availableWidth, ColumnToRender [] columnsToRender)
@@ -456,18 +456,18 @@ namespace Terminal.Gui {
// Start by assuming we just draw a straight line the
// whole way but update to instead draw a header indicator
// or scroll arrow etc
- var rune = Driver.HLine;
+ var rune = CM.Glyphs.HLine;
if (Style.ShowVerticalHeaderLines) {
if (c == 0) {
// for first character render line
- rune = Style.ShowVerticalCellLines ? Driver.LeftTee : Driver.LLCorner;
+ rune = Style.ShowVerticalCellLines ? CM.Glyphs.LeftTee : CM.Glyphs.LLCorner;
// unless we have horizontally scrolled along
// in which case render an arrow, to indicate user
// can scroll left
if (Style.ShowHorizontalScrollIndicators && moreColumnsToLeft) {
- rune = Driver.LeftArrow;
+ rune = CM.Glyphs.LeftArrow;
scrollLeftPoint = new Point (c, row);
}
@@ -476,17 +476,17 @@ namespace Terminal.Gui {
else if (columnsToRender.Any (r => r.X == c + 1)) {
/*TODO: is ┼ symbol in Driver?*/
- rune = Style.ShowVerticalCellLines ? '┼' : Driver.BottomTee;
+ rune = Style.ShowVerticalCellLines ? CM.Glyphs.Cross : CM.Glyphs.BottomTee;
} else if (c == availableWidth - 1) {
// for the last character in the table
- rune = Style.ShowVerticalCellLines ? Driver.RightTee : Driver.LRCorner;
+ rune = Style.ShowVerticalCellLines ? CM.Glyphs.RightTee : CM.Glyphs.LRCorner;
// unless there is more of the table we could horizontally
// scroll along to see. In which case render an arrow,
// to indicate user can scroll right
if (Style.ShowHorizontalScrollIndicators && moreColumnsToRight) {
- rune = Driver.RightArrow;
+ rune = CM.Glyphs.RightArrow;
scrollRightPoint = new Point (c, row);
}
@@ -494,7 +494,7 @@ namespace Terminal.Gui {
// if the next console column is the lastcolumns end
else if (Style.ExpandLastColumn == false &&
columnsToRender.Any (r => r.IsVeryLast && r.X + r.Width - 1 == c)) {
- rune = Style.ShowVerticalCellLines ? '┼' : Driver.BottomTee;
+ rune = Style.ShowVerticalCellLines ? CM.Glyphs.Cross : CM.Glyphs.BottomTee;
}
}
@@ -512,24 +512,24 @@ namespace Terminal.Gui {
// Start by assuming we just draw a straight line the
// whole way but update to instead draw BottomTee / Corner etc
- var rune = Driver.HLine;
+ var rune = CM.Glyphs.HLine;
if (Style.ShowVerticalCellLines) {
if (c == 0) {
// for first character render line
- rune = Driver.LLCorner;
+ rune = CM.Glyphs.LLCorner;
} else if (columnsToRender.Any (r => r.X == c + 1)) {
// if the next column is the start of a header
- rune = Driver.BottomTee;
+ rune = CM.Glyphs.BottomTee;
} else if (c == availableWidth - 1) {
// for the last character in the table
- rune = Driver.LRCorner;
+ rune = CM.Glyphs.LRCorner;
} else if (Style.ExpandLastColumn == false &&
columnsToRender.Any (r => r.IsVeryLast && r.X + r.Width - 1 == c)) {
// if the next console column is the lastcolumns end
- rune = Driver.BottomTee;
+ rune = CM.Glyphs.BottomTee;
}
}
@@ -639,8 +639,8 @@ namespace Terminal.Gui {
Driver.SetAttribute (rowScheme.Normal);
//render start and end of line
- AddRune (0, row, Driver.VLine);
- AddRune (Bounds.Width - 1, row, Driver.VLine);
+ AddRune (0, row, CM.Glyphs.VLine);
+ AddRune (Bounds.Width - 1, row, CM.Glyphs.VLine);
}
}
@@ -685,7 +685,7 @@ namespace Terminal.Gui {
var renderLines = isHeader ? style.ShowVerticalHeaderLines : style.ShowVerticalCellLines;
- Rune symbol = renderLines ? Driver.VLine : SeparatorSymbol;
+ Rune symbol = renderLines ? CM.Glyphs.VLine : SeparatorSymbol;
AddRune (col, row, symbol);
}
@@ -1337,7 +1337,7 @@ namespace Terminal.Gui {
/// This always calls
public void Update ()
{
- if (TableIsNullOrInvisible ()) {
+ if (!IsInitialized || TableIsNullOrInvisible ()) {
SetNeedsDisplay ();
return;
}
diff --git a/Terminal.Gui/Views/TextField.cs b/Terminal.Gui/Views/TextField.cs
index f4c8e3b6a..875f33872 100644
--- a/Terminal.Gui/Views/TextField.cs
+++ b/Terminal.Gui/Views/TextField.cs
@@ -469,7 +469,7 @@ namespace Terminal.Gui {
Driver.SetAttribute (idx >= start && length > 0 && idx < start + length ? selColor : ColorScheme.Focus);
}
if (col + cols <= width) {
- Driver.AddRune ((Rune)(Secret ? '*' : rune));
+ Driver.AddRune ((Rune)(Secret ? CM.Glyphs.Dot : rune));
}
if (!TextModel.SetCol (ref col, width, cols)) {
break;
diff --git a/Terminal.Gui/Views/TextView.cs b/Terminal.Gui/Views/TextView.cs
index 10cf213ef..413b829e9 100644
--- a/Terminal.Gui/Views/TextView.cs
+++ b/Terminal.Gui/Views/TextView.cs
@@ -1995,7 +1995,14 @@ namespace Terminal.Gui {
/// Indicates whatever the text was changed or not.
/// if the text was changed otherwise.
///
- public bool IsDirty => _historyText.IsDirty (Text);
+ public bool IsDirty {
+ get {
+ return _historyText.IsDirty (Text);
+ }
+ set {
+ _historyText.Clear (Text);
+ }
+ }
///
/// Indicates whatever the text has history changes or not.
diff --git a/Terminal.Gui/Views/TileView.cs b/Terminal.Gui/Views/TileView.cs
index 912a02f6d..c305fd799 100644
--- a/Terminal.Gui/Views/TileView.cs
+++ b/Terminal.Gui/Views/TileView.cs
@@ -200,7 +200,9 @@ namespace Terminal.Gui {
tile.TitleChanged += (s, e) => SetNeedsDisplay ();
}
- LayoutSubviews ();
+ if (IsInitialized) {
+ LayoutSubviews ();
+ }
}
///
@@ -233,7 +235,9 @@ namespace Terminal.Gui {
}
}
SetNeedsDisplay ();
- LayoutSubviews ();
+ if (IsInitialized) {
+ LayoutSubviews ();
+ }
return toReturn;
}
@@ -326,12 +330,18 @@ namespace Terminal.Gui {
get { return orientation; }
set {
orientation = value;
- LayoutSubviews ();
+ if (IsInitialized) {
+ LayoutSubviews ();
+ }
}
}
///
public override void LayoutSubviews ()
{
+ if (!IsInitialized) {
+ return;
+ }
+
var contentArea = Bounds;
if (HasBorder ()) {
@@ -719,7 +729,7 @@ namespace Terminal.Gui {
line.Height = orientation == Orientation.Vertical
? Dim.Fill () : 1;
line.LineRune = orientation == Orientation.Vertical ?
- Driver.VLine : Driver.HLine;
+ CM.Glyphs.VLine : CM.Glyphs.HLine;
if (orientation == Orientation.Vertical) {
line.X = splitterDistances [i];
@@ -928,7 +938,7 @@ namespace Terminal.Gui {
var location = moveRuneRenderLocation ??
new Point (Bounds.Width / 2, Bounds.Height / 2);
- AddRune (location.X, location.Y, Driver.Diamond);
+ AddRune (location.X, location.Y, CM.Glyphs.Diamond);
}
}
diff --git a/Terminal.Gui/Views/TreeView/Branch.cs b/Terminal.Gui/Views/TreeView/Branch.cs
index 56c2c5df6..27964067a 100644
--- a/Terminal.Gui/Views/TreeView/Branch.cs
+++ b/Terminal.Gui/Views/TreeView/Branch.cs
@@ -210,16 +210,16 @@ namespace Terminal.Gui {
if (cur.IsLast ()) {
yield return new Rune (' ');
} else {
- yield return driver.VLine;
+ yield return CM.Glyphs.VLine;
}
yield return new Rune (' ');
}
if (IsLast ()) {
- yield return driver.LLCorner;
+ yield return CM.Glyphs.LLCorner;
} else {
- yield return driver.LeftTee;
+ yield return CM.Glyphs.LeftTee;
}
}
@@ -246,7 +246,7 @@ namespace Terminal.Gui {
///
public Rune GetExpandableSymbol (ConsoleDriver driver)
{
- var leafSymbol = tree.Style.ShowBranchLines ? driver.HLine : ' ';
+ var leafSymbol = tree.Style.ShowBranchLines ? CM.Glyphs.HLine : ' ';
if (IsExpanded) {
return tree.Style.CollapseableSymbol ?? leafSymbol;
diff --git a/Terminal.Gui/Views/TreeView/TreeStyle.cs b/Terminal.Gui/Views/TreeView/TreeStyle.cs
index 12a636b26..a0c2061be 100644
--- a/Terminal.Gui/Views/TreeView/TreeStyle.cs
+++ b/Terminal.Gui/Views/TreeView/TreeStyle.cs
@@ -17,13 +17,13 @@ namespace Terminal.Gui {
/// Symbol to use for branch nodes that can be expanded to indicate this to the user.
/// Defaults to '+'. Set to null to hide.
///
- public Rune? ExpandableSymbol { get; set; } = '+';
+ public Rune? ExpandableSymbol { get; set; } = CM.Glyphs.Expand;
///
/// Symbol to use for branch nodes that can be collapsed (are currently expanded).
/// Defaults to '-'. Set to null to hide.
///
- public Rune? CollapseableSymbol { get; set; } = '-';
+ public Rune? CollapseableSymbol { get; set; } = CM.Glyphs.Collapse;
///
/// Set to to highlight expand/collapse symbols in hot key color.
diff --git a/UICatalog/Scenario.cs b/UICatalog/Scenario.cs
index 3b3c40b66..f82a76d9c 100644
--- a/UICatalog/Scenario.cs
+++ b/UICatalog/Scenario.cs
@@ -14,7 +14,7 @@ namespace UICatalog {
/// - Annotate the derived class with a attribute specifying the scenario's name and description.
/// - Add one or more attributes to the class specifying which categories the scenario belongs to. If you don't specify a category the scenario will show up in "_All".
/// - Implement the override which will be called when a user selects the scenario to run.
- /// - Optionally, implement the and/or overrides to provide a custom implementation.
+ /// - Optionally, implement the and/or overrides to provide a custom implementation.
///
///
///
diff --git a/UICatalog/Scenarios/AllViewsTester.cs b/UICatalog/Scenarios/AllViewsTester.cs
index 0239a7104..ad5128c08 100644
--- a/UICatalog/Scenarios/AllViewsTester.cs
+++ b/UICatalog/Scenarios/AllViewsTester.cs
@@ -244,8 +244,6 @@ namespace UICatalog.Scenarios {
Application.Top.Add (_leftPane, _settingsPane, _hostPane);
- Application.Top.LayoutSubviews ();
-
_curView = CreateClass (_viewClasses.First ().Value);
}
@@ -417,8 +415,6 @@ namespace UICatalog.Scenarios {
// Add
_hostPane.Add (view);
- //DimPosChanged ();
- _hostPane.LayoutSubviews ();
_hostPane.Clear ();
_hostPane.SetNeedsDisplay ();
UpdateSettings (view);
diff --git a/UICatalog/Scenarios/ConfigurationEditor.cs b/UICatalog/Scenarios/ConfigurationEditor.cs
index d04668b06..0ae5ef8c2 100644
--- a/UICatalog/Scenarios/ConfigurationEditor.cs
+++ b/UICatalog/Scenarios/ConfigurationEditor.cs
@@ -61,7 +61,7 @@ namespace UICatalog.Scenarios {
Application.Top.Add (statusBar);
- Open ();
+ Application.Top.Loaded += (s, a) => Open ();
ConfigurationEditor._editorColorSchemeChanged += () => {
foreach (var t in _tileView.Tiles) {
@@ -80,7 +80,7 @@ namespace UICatalog.Scenarios {
internal ConfigTextView ()
{
- ContentsChanged += (s,obj) => {
+ ContentsChanged += (s, obj) => {
if (IsDirty) {
if (!Tile.Title.EndsWith ('*')) {
Tile.Title += '*';
@@ -132,7 +132,7 @@ namespace UICatalog.Scenarios {
writer.Write (Text.ToString ());
writer.Close ();
Tile.Title = Tile.Title.TrimEnd ('*');
- //IsDirty = false;
+ IsDirty = false;
}
}
@@ -163,26 +163,13 @@ namespace UICatalog.Scenarios {
textView.Read ();
- textView.Enter += (s,e) => {
+ textView.Enter += (s, e) => {
_lenStatusItem.Title = $"Len:{textView.Text.Length}";
};
- //var mi = new MenuItem () {
- // Title = tile.Title,
- // CheckType = MenuItemCheckStyle.Checked,
- // Checked = true,
- //};
- //mi.Action += () => {
- // mi.Checked =! mi.Checked;
- // _tileView.SetNeedsDisplay ();
- //};
-
- //subMenu.Children = subMenu.Children.Append (mi).ToArray ();
}
- //var menu = new MenuBar (new MenuBarItem [] { subMenu });
- //Application.Top.Add (menu);
-
+ Application.Top.LayoutSubviews ();
}
private void Reload ()
diff --git a/UICatalog/Scenarios/GraphViewExample.cs b/UICatalog/Scenarios/GraphViewExample.cs
index 13f2ec82d..1341720f5 100644
--- a/UICatalog/Scenarios/GraphViewExample.cs
+++ b/UICatalog/Scenarios/GraphViewExample.cs
@@ -105,7 +105,7 @@ namespace UICatalog.Scenarios {
var series = new MultiBarSeries (3, 1, 0.25f, new [] { magenta, cyan, red });
- var stiple = Application.Driver.Stipple;
+ var stiple = CM.Glyphs.Stipple;
series.AddBars ("'96", stiple, 5900, 9000, 14000);
series.AddBars ("'97", stiple, 6100, 9200, 14800);
@@ -428,7 +428,7 @@ namespace UICatalog.Scenarios {
graphView.AxisY.ShowLabelsEvery = 0;
graphView.AxisY.Minimum = 0;
- var stiple = new GraphCellToRender (Application.Driver.Stipple);
+ var stiple = new GraphCellToRender (CM.Glyphs.Stipple);
// Bars in 2 directions
diff --git a/UICatalog/Scenarios/LineDrawing.cs b/UICatalog/Scenarios/LineDrawing.cs
index 3101a3bc4..9ae3da08f 100644
--- a/UICatalog/Scenarios/LineDrawing.cs
+++ b/UICatalog/Scenarios/LineDrawing.cs
@@ -1,7 +1,10 @@
-using System;
+using NStack;
+using System;
using System.Collections.Generic;
+using System.Linq;
using System.Reflection.Metadata.Ecma335;
using Terminal.Gui;
+using Attribute = Terminal.Gui.Attribute;
namespace UICatalog.Scenarios {
@@ -12,214 +15,127 @@ namespace UICatalog.Scenarios {
public override void Setup ()
{
- var toolsWidth = 12;
-
var canvas = new DrawingArea {
- Width = Dim.Fill (toolsWidth + 1),
- Height = Dim.Fill (),
- BorderStyle = LineStyle.Single
+ X = 0,
+ Y = 0,
+ Width = Dim.Fill (),
+ Height = Dim.Fill ()
};
- var tools = new ToolsView (toolsWidth) {
- Y = 1,
- X = Pos.AnchorEnd (toolsWidth + 1),
- Height = Dim.Fill (),
- Width = Dim.Fill ()
+ var tools = new ToolsView () {
+ Title = "Tools",
+ X = Pos.Right(canvas) - 20,
+ Y = 2
};
tools.ColorChanged += (c) => canvas.SetColor (c);
tools.SetStyle += (b) => canvas.LineStyle = b;
+ tools.AddLayer += () => canvas.AddLayer ();
Win.Add (canvas);
Win.Add (tools);
- Win.Add (new Label (" -Tools-") { X = Pos.AnchorEnd (toolsWidth + 1) });
}
- class ToolsView : View {
-
- LineCanvas grid;
+ class ToolsView : Window {
public event Action ColorChanged;
public event Action SetStyle;
+ public event Action AddLayer;
- Dictionary swatches = new Dictionary {
- { new Point(1,1),Color.Red},
- { new Point(3,1),Color.Green},
- { new Point(5,1),Color.BrightBlue},
- { new Point(7,1),Color.Black},
- { new Point(9,1),Color.DarkGray},
- { new Point(11,1),Color.White},
- };
+ private RadioGroup _stylePicker;
+ private ColorPicker _colorPicker;
+ private Button _addLayerBtn;
- public ToolsView (int width)
+ public ToolsView ()
{
- grid = new LineCanvas ();
-
- grid.AddLine (new Point (0, 0), 7, Orientation.Vertical, LineStyle.Single);
- grid.AddLine (new Point (0, 0), width + 1, Orientation.Horizontal, LineStyle.Single);
- grid.AddLine (new Point (width, 0), 7, Orientation.Vertical, LineStyle.Single);
- grid.AddLine (new Point (0, 6), width + 1, Orientation.Horizontal, LineStyle.Single);
-
- grid.AddLine (new Point (2, 0), 7, Orientation.Vertical, LineStyle.Single);
- grid.AddLine (new Point (4, 0), 7, Orientation.Vertical, LineStyle.Single);
- grid.AddLine (new Point (6, 0), 7, Orientation.Vertical, LineStyle.Single);
- grid.AddLine (new Point (8, 0), 7, Orientation.Vertical, LineStyle.Single);
- grid.AddLine (new Point (10, 0), 7, Orientation.Vertical, LineStyle.Single);
-
- grid.AddLine (new Point (0, 2), width + 1, Orientation.Horizontal, LineStyle.Single);
- grid.AddLine (new Point (0, 4), width + 1, Orientation.Horizontal, LineStyle.Single);
+ BorderStyle = LineStyle.Dotted;
+ Border.Thickness = new Thickness (1, 2, 1, 1);
+ Initialized += ToolsView_Initialized;
}
- public override void OnDrawContent (Rect contentArea)
+ private void ToolsView_Initialized (object sender, EventArgs e)
{
- base.OnDrawContent (contentArea);
-
- Driver.SetAttribute (new Terminal.Gui.Attribute (Color.DarkGray, ColorScheme.Normal.Background));
-
-
- foreach (var p in grid.GetMap (Bounds)) {
- this.AddRune (p.Key.X, p.Key.Y, p.Value);
- }
-
- foreach (var swatch in swatches) {
- Driver.SetAttribute (new Terminal.Gui.Attribute (swatch.Value, ColorScheme.Normal.Background));
- AddRune (swatch.Key.X, swatch.Key.Y, '█');
- }
-
- Driver.SetAttribute (new Terminal.Gui.Attribute (ColorScheme.Normal.Foreground, ColorScheme.Normal.Background));
- AddRune (1, 3, Application.Driver.HLine);
- AddRune (3, 3, Application.Driver.HDsLine);
- AddRune (5, 3, Application.Driver.HDtLine);
- AddRune (7, 3, Application.Driver.ULRCorner);
- AddRune (9, 3, Application.Driver.HDsLine);
- AddRune (11, 3, Application.Driver.HDtLine);
- AddRune (1, 5, Application.Driver.HThLine);
- AddRune (3, 5, Application.Driver.HThDsLine);
- AddRune (5, 5, Application.Driver.HThDtLine);
- AddRune (7, 5, Application.Driver.HDbLine);
+ LayoutSubviews ();
+ Width = Math.Max (_colorPicker.Frame.Width, _stylePicker.Frame.Width) + GetFramesThickness().Horizontal;
+ Height = _colorPicker.Frame.Height + _stylePicker.Frame.Height + _addLayerBtn.Frame.Height + GetFramesThickness ().Vertical;
+ SuperView.LayoutSubviews ();
}
- public override bool OnMouseEvent (MouseEvent mouseEvent)
+ public override void BeginInit ()
{
- if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Clicked)) {
- foreach (var swatch in swatches) {
- if (mouseEvent.X == swatch.Key.X && mouseEvent.Y == swatch.Key.Y) {
+ base.BeginInit ();
- ColorChanged?.Invoke (swatch.Value);
- return true;
- }
- }
+ _colorPicker = new ColorPicker () {
+ X = 0,
+ Y = 0,
+ BoxHeight = 1,
+ BoxWidth = 2
+ };
- if (mouseEvent.X == 1 && mouseEvent.Y == 3) {
+ _colorPicker.ColorChanged += (s, a) => ColorChanged?.Invoke (a.Color);
- SetStyle?.Invoke (LineStyle.Single);
- return true;
- }
- if (mouseEvent.X == 3 && mouseEvent.Y == 3) {
+ _stylePicker = new RadioGroup (Enum.GetNames (typeof (LineStyle)).Select (s => ustring.Make (s)).ToArray ()) {
+ X = 0,
+ Y = Pos.Bottom (_colorPicker)
+ };
- SetStyle?.Invoke (LineStyle.Dashed);
- return true;
- }
- if (mouseEvent.X == 5 && mouseEvent.Y == 3) {
+ _stylePicker.SelectedItemChanged += (s, a) => {
+ SetStyle?.Invoke ((LineStyle)a.SelectedItem);
+ };
- SetStyle?.Invoke (LineStyle.Dotted);
- return true;
- }
- if (mouseEvent.X == 7 && mouseEvent.Y == 3) {
+ _addLayerBtn = new Button () {
+ Text = "New Layer",
+ X = Pos.Center (),
+ Y = Pos.Bottom (_stylePicker),
+ };
- SetStyle?.Invoke (LineStyle.Rounded);
- return true;
- }
- if (mouseEvent.X == 9 && mouseEvent.Y == 3) {
-
- SetStyle?.Invoke (LineStyle.RoundedDashed);
- return true;
- }
- if (mouseEvent.X == 11 && mouseEvent.Y == 3) {
-
- SetStyle?.Invoke (LineStyle.RoundedDotted);
- return true;
- }
- if (mouseEvent.X == 1 && mouseEvent.Y == 5) {
-
- SetStyle?.Invoke (LineStyle.Heavy);
- return true;
- }
- if (mouseEvent.X == 3 && mouseEvent.Y == 5) {
-
- SetStyle?.Invoke (LineStyle.HeavyDashed);
- return true;
- }
- if (mouseEvent.X == 5 && mouseEvent.Y == 5) {
-
- SetStyle?.Invoke (LineStyle.HeavyDotted);
- return true;
- }
- if (mouseEvent.X == 7 && mouseEvent.Y == 5) {
-
- SetStyle?.Invoke (LineStyle.Double);
- return true;
- }
- }
-
- return base.OnMouseEvent (mouseEvent);
+ _addLayerBtn.Clicked += (s, a) => AddLayer?.Invoke ();
+ Add (_colorPicker, _stylePicker, _addLayerBtn);
}
}
class DrawingArea : View {
- ///
- /// Index into by color.
- ///
- Dictionary colorLayers = new Dictionary ();
- List canvases = new List ();
- int currentColor;
+ List _layers = new List ();
+ LineCanvas _currentLayer;
+ Color _currentColor = Color.White;
+ Point? _currentLineStart = null;
- Point? currentLineStart = null;
public LineStyle LineStyle { get; set; }
public DrawingArea ()
{
- AddCanvas (Color.White);
+ AddLayer ();
}
- private void AddCanvas (Color c)
+ internal void AddLayer ()
{
- if (colorLayers.ContainsKey (c)) {
- return;
- }
-
- canvases.Add (new LineCanvas ());
- colorLayers.Add (c, canvases.Count - 1);
- currentColor = canvases.Count - 1;
+ _currentLayer = new LineCanvas ();
+ _layers.Add (_currentLayer);
}
public override void OnDrawContent (Rect contentArea)
{
base.OnDrawContent (contentArea);
- foreach (var kvp in colorLayers) {
-
- Driver.SetAttribute (new Terminal.Gui.Attribute (kvp.Key, ColorScheme.Normal.Background));
-
- var canvas = canvases [kvp.Value];
-
- foreach (var p in canvas.GetMap (Bounds)) {
- this.AddRune (p.Key.X, p.Key.Y, p.Value);
+ foreach (var canvas in _layers) {
+
+ foreach (var c in canvas.GetCellMap ()) {
+ Driver.SetAttribute (c.Value.Attribute?.Value ?? ColorScheme.Normal);
+ this.AddRune (c.Key.X, c.Key.Y, c.Value.Rune.Value);
}
}
}
public override bool OnMouseEvent (MouseEvent mouseEvent)
{
-
if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Pressed)) {
- if (currentLineStart == null) {
- currentLineStart = new Point (mouseEvent.X - 1, mouseEvent.Y - 1);
+ if (_currentLineStart == null) {
+ _currentLineStart = new Point (mouseEvent.X - GetBoundsOffset().X, mouseEvent.Y - GetBoundsOffset ().X);
}
} else {
- if (currentLineStart != null) {
+ if (_currentLineStart != null) {
- var start = currentLineStart.Value;
- var end = new Point (mouseEvent.X - 1, mouseEvent.Y - 1);
+ var start = _currentLineStart.Value;
+ var end = new Point (mouseEvent.X - GetBoundsOffset ().X, mouseEvent.Y - GetBoundsOffset ().X);
var orientation = Orientation.Vertical;
var length = end.Y - start.Y;
@@ -235,14 +151,14 @@ namespace UICatalog.Scenarios {
length--;
}
-
- canvases [currentColor].AddLine (
+ _currentLayer.AddLine (
start,
length,
orientation,
- LineStyle);
+ LineStyle,
+ new Attribute (_currentColor, GetNormalColor().Background));
- currentLineStart = null;
+ _currentLineStart = null;
SetNeedsDisplay ();
}
}
@@ -252,10 +168,8 @@ namespace UICatalog.Scenarios {
internal void SetColor (Color c)
{
- AddCanvas (c);
- currentColor = colorLayers [c];
+ _currentColor = c;
}
-
}
}
}
diff --git a/UICatalog/Scenarios/LineViewExample.cs b/UICatalog/Scenarios/LineViewExample.cs
index cf1dab920..de29d0125 100644
--- a/UICatalog/Scenarios/LineViewExample.cs
+++ b/UICatalog/Scenarios/LineViewExample.cs
@@ -61,7 +61,7 @@ namespace UICatalog.Scenarios {
var arrowLine = new LineView () {
Y = 7,
Width = 10,
- StartingAnchor = Application.Driver.LeftTee,
+ StartingAnchor = CM.Glyphs.LeftTee,
EndingAnchor = '>'
};
@@ -81,7 +81,7 @@ namespace UICatalog.Scenarios {
// creates a horizontal line
var verticalArrow = new LineView (Orientation.Vertical) {
X = 27,
- StartingAnchor = Application.Driver.TopTee,
+ StartingAnchor = CM.Glyphs.TopTee,
EndingAnchor = 'V'
};
diff --git a/UICatalog/Scenarios/Snake.cs b/UICatalog/Scenarios/Snake.cs
index b6a5ae2eb..609c138f9 100644
--- a/UICatalog/Scenarios/Snake.cs
+++ b/UICatalog/Scenarios/Snake.cs
@@ -115,7 +115,7 @@ namespace UICatalog.Scenarios {
}
Driver.SetAttribute (red);
- AddRune (State.Apple.X, State.Apple.Y, 'A');
+ AddRune (State.Apple.X, State.Apple.Y, CM.Glyphs.Apple);
Driver.SetAttribute (white);
}
public override bool OnKeyDown (KeyEvent keyEvent)
diff --git a/UICatalog/Scenarios/TableEditor.cs b/UICatalog/Scenarios/TableEditor.cs
index bc57cc73c..fde6005fe 100644
--- a/UICatalog/Scenarios/TableEditor.cs
+++ b/UICatalog/Scenarios/TableEditor.cs
@@ -192,7 +192,7 @@ namespace UICatalog.Scenarios {
// add a new one if this the one that is being sorted
if (col.Ordinal == clickedCol) {
- col.ColumnName += isAsc ? '▲' : '▼';
+ col.ColumnName += isAsc ? CM.Glyphs.UpArrow : CM.Glyphs.DownArrow;
}
}
@@ -201,11 +201,11 @@ namespace UICatalog.Scenarios {
private string TrimArrows (string columnName)
{
- return columnName.TrimEnd ('▼', '▲');
+ return columnName.TrimEnd ((char)CM.Glyphs.UpArrow, (char)CM.Glyphs.DownArrow);
}
private string StripArrows (string columnName)
{
- return columnName.Replace ("▼", "").Replace ("▲", "");
+ return columnName.Replace ($"{CM.Glyphs.DownArrow}", "").Replace ($"{CM.Glyphs.UpArrow}", "");
}
private string GetProposedNewSortOrder (int clickedCol, out bool isAsc)
{
diff --git a/UICatalog/UICatalog.cs b/UICatalog/UICatalog.cs
index 9ef655d5e..9ffa9454d 100644
--- a/UICatalog/UICatalog.cs
+++ b/UICatalog/UICatalog.cs
@@ -1,3 +1,5 @@
+global using CM = Terminal.Gui.ConfigurationManager;
+
using NStack;
using System;
using System.Collections.Generic;
@@ -116,8 +118,8 @@ namespace UICatalog {
Scenario scenario;
while ((scenario = RunUICatalogTopLevel ()) != null) {
VerifyObjectsWereDisposed ();
- ConfigurationManager.Themes!.Theme = _cachedTheme!;
- ConfigurationManager.Apply ();
+ CM.Themes!.Theme = _cachedTheme!;
+ CM.Apply ();
scenario.Theme = _cachedTheme;
scenario.TopLevelColorScheme = _topLevelColorScheme;
scenario.Init ();
@@ -188,8 +190,8 @@ namespace UICatalog {
// TOOD: THis is a hack. Figure out how to ensure that the file is fully written before reading it.
Thread.Sleep (500);
- ConfigurationManager.Load ();
- ConfigurationManager.Apply ();
+ CM.Load ();
+ CM.Apply ();
}
///
@@ -207,10 +209,10 @@ namespace UICatalog {
Application.Init ();
if (_cachedTheme is null) {
- _cachedTheme = ConfigurationManager.Themes?.Theme;
+ _cachedTheme = CM.Themes?.Theme;
} else {
- ConfigurationManager.Themes!.Theme = _cachedTheme;
- ConfigurationManager.Apply ();
+ CM.Themes!.Theme = _cachedTheme;
+ CM.Apply ();
}
//Application.EnableConsoleScrolling = _enableConsoleScrolling;
@@ -415,11 +417,9 @@ namespace UICatalog {
// Restore previous selections
CategoryList.SelectedItem = _cachedCategoryIndex;
- CategoryList.EnsureSelectedItemVisible ();
ScenarioList.SelectedRow = _cachedScenarioIndex;
- ScenarioList.EnsureSelectedCellIsVisible ();
- ConfigurationManager.Applied += ConfigAppliedHandler;
+ CM.Applied += ConfigAppliedHandler;
}
void LoadedHandler (object? sender, EventArgs? args)
@@ -451,11 +451,13 @@ namespace UICatalog {
};
Loaded -= LoadedHandler;
+ CategoryList.EnsureSelectedItemVisible ();
+ ScenarioList.EnsureSelectedCellIsVisible ();
}
private void UnloadedHandler (object? sender, EventArgs? args)
{
- ConfigurationManager.Applied -= ConfigAppliedHandler;
+ CM.Applied -= ConfigAppliedHandler;
Unloaded -= UnloadedHandler;
}
@@ -680,16 +682,16 @@ namespace UICatalog {
public MenuItem []? CreateThemeMenuItems ()
{
List