瀏覽代碼

WIP -> Getting rid of old TextAlignment enums

Tig 1 年之前
父節點
當前提交
c84dade64d
共有 47 個文件被更改,包括 454 次插入494 次删除
  1. 2 2
      Terminal.Gui/Drawing/Thickness.cs
  2. 0 20
      Terminal.Gui/Text/TextAlignment.cs
  3. 32 32
      Terminal.Gui/Text/TextFormatter.cs
  4. 0 20
      Terminal.Gui/Text/VerticalTextAlignment.cs
  5. 3 3
      Terminal.Gui/View/ViewText.cs
  6. 2 2
      Terminal.Gui/Views/Button.cs
  7. 5 5
      Terminal.Gui/Views/CheckBox.cs
  8. 1 1
      Terminal.Gui/Views/ListView.cs
  9. 1 1
      Terminal.Gui/Views/Menu/Menu.cs
  10. 1 1
      Terminal.Gui/Views/MessageBox.cs
  11. 1 1
      Terminal.Gui/Views/ProgressBar.cs
  12. 8 8
      Terminal.Gui/Views/Slider.cs
  13. 3 3
      Terminal.Gui/Views/TableView/ColumnStyle.cs
  14. 5 5
      Terminal.Gui/Views/TableView/TableView.cs
  15. 8 8
      Terminal.Gui/Views/TextValidateField.cs
  16. 1 1
      Terminal.Gui/Views/TextView.cs
  17. 2 2
      UICatalog/Scenarios/BasicColors.cs
  18. 25 25
      UICatalog/Scenarios/Buttons.cs
  19. 1 1
      UICatalog/Scenarios/CharacterMap.cs
  20. 2 2
      UICatalog/Scenarios/CollectionNavigatorTester.cs
  21. 2 2
      UICatalog/Scenarios/ColorPicker.cs
  22. 10 10
      UICatalog/Scenarios/ComputedLayout.cs
  23. 11 11
      UICatalog/Scenarios/CsvEditor.cs
  24. 7 7
      UICatalog/Scenarios/Dialogs.cs
  25. 2 2
      UICatalog/Scenarios/DynamicMenuBar.cs
  26. 9 9
      UICatalog/Scenarios/Editor.cs
  27. 1 1
      UICatalog/Scenarios/ListColumns.cs
  28. 9 9
      UICatalog/Scenarios/MessageBoxes.cs
  29. 2 2
      UICatalog/Scenarios/Mouse.cs
  30. 7 7
      UICatalog/Scenarios/TableEditor.cs
  31. 1 1
      UICatalog/Scenarios/Text.cs
  32. 9 9
      UICatalog/Scenarios/TextAlignments.cs
  33. 50 50
      UICatalog/Scenarios/TextAlignmentsAndDirection.cs
  34. 7 7
      UICatalog/Scenarios/TextFormatterDemo.cs
  35. 6 6
      UICatalog/Scenarios/TimeAndDate.cs
  36. 1 1
      UICatalog/Scenarios/Unicode.cs
  37. 5 5
      UICatalog/Scenarios/ViewExperiments.cs
  38. 4 4
      UICatalog/Scenarios/Wizards.cs
  39. 158 158
      UnitTests/Text/TextFormatterTests.cs
  40. 2 2
      UnitTests/View/DrawTests.cs
  41. 6 6
      UnitTests/View/Layout/Dim.AutoTests.cs
  42. 6 6
      UnitTests/View/Text/AutoSizeTrueTests.cs
  43. 4 4
      UnitTests/Views/ButtonTests.cs
  44. 9 9
      UnitTests/Views/CheckBoxTests.cs
  45. 1 1
      UnitTests/Views/LabelTests.cs
  46. 20 20
      UnitTests/Views/TextValidateFieldTests.cs
  47. 2 2
      UnitTests/Views/ToplevelTests.cs

+ 2 - 2
Terminal.Gui/Drawing/Thickness.cs

@@ -232,8 +232,8 @@ public class Thickness : IEquatable<Thickness>
             var tf = new TextFormatter
             {
                 Text = label is null ? string.Empty : $"{label} {this}",
-                Alignment = TextAlignment.Centered,
-                VerticalAlignment = VerticalTextAlignment.Bottom,
+                Alignment = Justification.Centered,
+                VerticalAlignment = Justification.Bottom,
                 AutoSize = true
             };
             tf.Draw (rect, Application.Driver.CurrentAttribute, Application.Driver.CurrentAttribute, rect);

+ 0 - 20
Terminal.Gui/Text/TextAlignment.cs

@@ -1,20 +0,0 @@
-namespace Terminal.Gui;
-
-/// <summary>Text alignment enumeration, controls how text is displayed.</summary>
-public enum TextAlignment
-{
-    /// <summary>The text will be left-aligned.</summary>
-    Left,
-
-    /// <summary>The text will be right-aligned.</summary>
-    Right,
-
-    /// <summary>The text will be centered horizontally.</summary>
-    Centered,
-
-    /// <summary>
-    ///     The text will be justified (spaces will be added to existing spaces such that the text fills the container
-    ///     horizontally).
-    /// </summary>
-    Justified
-}

+ 32 - 32
Terminal.Gui/Text/TextFormatter.cs

@@ -15,14 +15,14 @@ public class TextFormatter
     private Size _size;
     private int _tabWidth = 4;
     private string _text;
-    private TextAlignment _textAlignment;
+    private Justification _textAlignment;
     private TextDirection _textDirection;
-    private VerticalTextAlignment _textVerticalAlignment;
+    private Justification _textVerticalAlignment;
     private bool _wordWrap = true;
 
     /// <summary>Controls the horizontal text-alignment property.</summary>
     /// <value>The text alignment.</value>
-    public TextAlignment Alignment
+    public Justification Alignment
     {
         get => _textAlignment;
         set => _textAlignment = EnableNeedsFormat (value);
@@ -32,8 +32,8 @@ public class TextFormatter
     /// <remarks>
     ///     <para>Used when <see cref="View"/> is using <see cref="Dim.Auto"/> to resize the view's <see cref="View.Viewport"/> to fit <see cref="Size"/>.</para>
     ///     <para>
-    ///         AutoSize is ignored if <see cref="TextAlignment.Justified"/> and
-    ///         <see cref="VerticalTextAlignment.Justified"/> are used.
+    ///         AutoSize is ignored if <see cref="Justification.Justified"/> and
+    ///         <see cref="Justification.Justified"/> are used.
     ///     </para>
     /// </remarks>
     public bool AutoSize
@@ -225,7 +225,7 @@ public class TextFormatter
 
     /// <summary>Controls the vertical text-alignment property.</summary>
     /// <value>The text vertical alignment.</value>
-    public VerticalTextAlignment VerticalAlignment
+    public Justification VerticalAlignment
     {
         get => _textVerticalAlignment;
         set => _textVerticalAlignment = EnableNeedsFormat (value);
@@ -321,7 +321,7 @@ public class TextFormatter
             int x, y;
 
             // Horizontal Alignment
-            if (Alignment is TextAlignment.Right)
+            if (Alignment is Justification.Right)
             {
                 if (isVertical)
                 {
@@ -336,7 +336,7 @@ public class TextFormatter
                     CursorPosition = screen.Width - runesWidth + (_hotKeyPos > -1 ? _hotKeyPos : 0);
                 }
             }
-            else if (Alignment is TextAlignment.Left)
+            else if (Alignment is Justification.Left)
             {
                 if (isVertical)
                 {
@@ -352,7 +352,7 @@ public class TextFormatter
 
                 CursorPosition = _hotKeyPos > -1 ? _hotKeyPos : 0;
             }
-            else if (Alignment is TextAlignment.Justified)
+            else if (Alignment is Justification.Justified)
             {
                 if (isVertical)
                 {
@@ -375,7 +375,7 @@ public class TextFormatter
 
                 CursorPosition = _hotKeyPos > -1 ? _hotKeyPos : 0;
             }
-            else if (Alignment is TextAlignment.Centered)
+            else if (Alignment is Justification.Centered)
             {
                 if (isVertical)
                 {
@@ -399,7 +399,7 @@ public class TextFormatter
             }
 
             // Vertical Alignment
-            if (VerticalAlignment is VerticalTextAlignment.Bottom)
+            if (VerticalAlignment is Justification.Bottom)
             {
                 if (isVertical)
                 {
@@ -410,7 +410,7 @@ public class TextFormatter
                     y = screen.Bottom - linesFormatted.Count + line;
                 }
             }
-            else if (VerticalAlignment is VerticalTextAlignment.Top)
+            else if (VerticalAlignment is Justification.Top)
             {
                 if (isVertical)
                 {
@@ -421,7 +421,7 @@ public class TextFormatter
                     y = screen.Top + line;
                 }
             }
-            else if (VerticalAlignment is VerticalTextAlignment.Justified)
+            else if (VerticalAlignment is Justification.Justified)
             {
                 if (isVertical)
                 {
@@ -435,7 +435,7 @@ public class TextFormatter
                         line < linesFormatted.Count - 1 ? screen.Height - interval <= 1 ? screen.Top + 1 : screen.Top + line * interval : screen.Bottom - 1;
                 }
             }
-            else if (VerticalAlignment is VerticalTextAlignment.Middle)
+            else if (VerticalAlignment is Justification.Centered)
             {
                 if (isVertical)
                 {
@@ -471,8 +471,8 @@ public class TextFormatter
                 {
                     if (idx < 0
                         || (isVertical
-                                ? VerticalAlignment != VerticalTextAlignment.Bottom && current < 0
-                                : Alignment != TextAlignment.Right && x + current + colOffset < 0))
+                                ? VerticalAlignment != Justification.Bottom && current < 0
+                                : Alignment != Justification.Right && x + current + colOffset < 0))
                     {
                         current++;
 
@@ -561,7 +561,7 @@ public class TextFormatter
 
                 if (HotKeyPos > -1 && idx == HotKeyPos)
                 {
-                    if ((isVertical && VerticalAlignment == VerticalTextAlignment.Justified) || (!isVertical && Alignment == TextAlignment.Justified))
+                    if ((isVertical && VerticalAlignment == Justification.Justified) || (!isVertical && Alignment == Justification.Justified))
                     {
                         CursorPosition = idx - start;
                     }
@@ -699,7 +699,7 @@ public class TextFormatter
                 _lines = Format (
                                  text,
                                  Size.Height,
-                                 VerticalAlignment == VerticalTextAlignment.Justified,
+                                 VerticalAlignment == Justification.Justified,
                                  Size.Width > colsWidth && WordWrap,
                                  PreserveTrailingSpaces,
                                  TabWidth,
@@ -723,7 +723,7 @@ public class TextFormatter
                 _lines = Format (
                                  text,
                                  Size.Width,
-                                 Alignment == TextAlignment.Justified,
+                                 Alignment == Justification.Justified,
                                  Size.Height > 1 && WordWrap,
                                  PreserveTrailingSpaces,
                                  TabWidth,
@@ -1031,7 +1031,7 @@ public class TextFormatter
         List<Rune> runes = StripCRLF (text).ToRuneList ();
 
         int start = Math.Max (
-                              !runes.Contains ((Rune)' ') && textFormatter is { VerticalAlignment: VerticalTextAlignment.Bottom } && IsVerticalDirection (textDirection)
+                              !runes.Contains ((Rune)' ') && textFormatter is { VerticalAlignment: Justification.Bottom } && IsVerticalDirection (textDirection)
                                   ? runes.Count - width
                                   : 0,
                               0);
@@ -1257,13 +1257,13 @@ public class TextFormatter
     public static string ClipAndJustify (
         string text,
         int width,
-        TextAlignment talign,
+        Justification talign,
         TextDirection textDirection = TextDirection.LeftRight_TopBottom,
         int tabWidth = 0,
         TextFormatter textFormatter = null
     )
     {
-        return ClipAndJustify (text, width, talign == TextAlignment.Justified, textDirection, tabWidth, textFormatter);
+        return ClipAndJustify (text, width, talign == Justification.Justified, textDirection, tabWidth, textFormatter);
     }
 
     /// <summary>Justifies text within a specified width.</summary>
@@ -1304,12 +1304,12 @@ public class TextFormatter
         {
             if (IsHorizontalDirection (textDirection))
             {
-                if (textFormatter is { Alignment: TextAlignment.Right })
+                if (textFormatter is { Alignment: Justification.Right })
                 {
                     return GetRangeThatFits (runes, runes.Count - width, text, width, tabWidth, textDirection);
                 }
 
-                if (textFormatter is { Alignment: TextAlignment.Centered })
+                if (textFormatter is { Alignment: Justification.Centered })
                 {
                     return GetRangeThatFits (runes, Math.Max ((runes.Count - width) / 2, 0), text, width, tabWidth, textDirection);
                 }
@@ -1319,12 +1319,12 @@ public class TextFormatter
 
             if (IsVerticalDirection (textDirection))
             {
-                if (textFormatter is { VerticalAlignment: VerticalTextAlignment.Bottom })
+                if (textFormatter is { VerticalAlignment: Justification.Bottom })
                 {
                     return GetRangeThatFits (runes, runes.Count - width, text, width, tabWidth, textDirection);
                 }
 
-                if (textFormatter is { VerticalAlignment: VerticalTextAlignment.Middle })
+                if (textFormatter is { VerticalAlignment: Justification.Centered })
                 {
                     return GetRangeThatFits (runes, Math.Max ((runes.Count - width) / 2, 0), text, width, tabWidth, textDirection);
                 }
@@ -1342,14 +1342,14 @@ public class TextFormatter
 
         if (IsHorizontalDirection (textDirection))
         {
-            if (textFormatter is { Alignment: TextAlignment.Right })
+            if (textFormatter is { Alignment: Justification.Right })
             {
                 if (GetRuneWidth (text, tabWidth, textDirection) > width)
                 {
                     return GetRangeThatFits (runes, runes.Count - width, text, width, tabWidth, textDirection);
                 }
             }
-            else if (textFormatter is { Alignment: TextAlignment.Centered })
+            else if (textFormatter is { Alignment: Justification.Centered })
             {
                 return GetRangeThatFits (runes, Math.Max ((runes.Count - width) / 2, 0), text, width, tabWidth, textDirection);
             }
@@ -1361,14 +1361,14 @@ public class TextFormatter
 
         if (IsVerticalDirection (textDirection))
         {
-            if (textFormatter is { VerticalAlignment: VerticalTextAlignment.Bottom })
+            if (textFormatter is { VerticalAlignment: Justification.Bottom })
             {
                 if (runes.Count - zeroLength > width)
                 {
                     return GetRangeThatFits (runes, runes.Count - width, text, width, tabWidth, textDirection);
                 }
             }
-            else if (textFormatter is { VerticalAlignment: VerticalTextAlignment.Middle })
+            else if (textFormatter is { VerticalAlignment: Justification.Centered })
             {
                 return GetRangeThatFits (runes, Math.Max ((runes.Count - width) / 2, 0), text, width, tabWidth, textDirection);
             }
@@ -1498,7 +1498,7 @@ public class TextFormatter
     public static List<string> Format (
         string text,
         int width,
-        TextAlignment talign,
+        Justification talign,
         bool wordWrap,
         bool preserveTrailingSpaces = false,
         int tabWidth = 0,
@@ -1510,7 +1510,7 @@ public class TextFormatter
         return Format (
                        text,
                        width,
-                       talign == TextAlignment.Justified,
+                       talign == Justification.Justified,
                        wordWrap,
                        preserveTrailingSpaces,
                        tabWidth,

+ 0 - 20
Terminal.Gui/Text/VerticalTextAlignment.cs

@@ -1,20 +0,0 @@
-namespace Terminal.Gui;
-
-/// <summary>Vertical text alignment enumeration, controls how text is displayed.</summary>
-public enum VerticalTextAlignment
-{
-    /// <summary>The text will be top-aligned.</summary>
-    Top,
-
-    /// <summary>The text will be bottom-aligned.</summary>
-    Bottom,
-
-    /// <summary>The text will centered vertically.</summary>
-    Middle,
-
-    /// <summary>
-    ///     The text will be justified (spaces will be added to existing spaces such that the text fills the container
-    ///     vertically).
-    /// </summary>
-    Justified
-}

+ 3 - 3
Terminal.Gui/View/ViewText.cs

@@ -34,7 +34,7 @@ public partial class View
     ///     </para>
     ///     <para>
     ///         The text will be drawn starting at the view origin (0, 0) and will be formatted according
-    ///         to <see cref="TextAlignment"/> and <see cref="TextDirection"/>.
+    ///         to <see cref="Justification"/> and <see cref="TextDirection"/>.
     ///     </para>
     ///     <para>
     ///         The text will word-wrap to additional lines if it does not fit horizontally. If <see cref="ContentSize"/>'s height
@@ -87,7 +87,7 @@ public partial class View
     ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="Dim.DimAutoStyle.Text"/>, the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The text alignment.</value>
-    public virtual TextAlignment TextAlignment
+    public virtual Justification Justification
     {
         get => TextFormatter.Alignment;
         set
@@ -130,7 +130,7 @@ public partial class View
     ///     <para> <see cref="View.Width"/> or <see cref="View.Height"/> are using <see cref="Dim.DimAutoStyle.Text"/>, the <see cref="ContentSize"/> will be adjusted to fit the text.</para>
     /// </remarks>
     /// <value>The text alignment.</value>
-    public virtual VerticalTextAlignment VerticalTextAlignment
+    public virtual Justification VerticalJustification
     {
         get => TextFormatter.VerticalAlignment;
         set

+ 2 - 2
Terminal.Gui/Views/Button.cs

@@ -37,8 +37,8 @@ public class Button : View
     /// <remarks>The width of the <see cref="Button"/> is computed based on the text length. The height will always be 1.</remarks>
     public Button ()
     {
-        TextAlignment = TextAlignment.Centered;
-        VerticalTextAlignment = VerticalTextAlignment.Middle;
+        Justification = Justification.Centered;
+        VerticalJustification = Justification.Centered;
 
         _leftBracket = Glyphs.LeftBracket;
         _rightBracket = Glyphs.RightBracket;

+ 5 - 5
Terminal.Gui/Views/CheckBox.cs

@@ -153,15 +153,15 @@ public class CheckBox : View
     /// <inheritdoc/>
     protected override void UpdateTextFormatterText ()
     {
-        switch (TextAlignment)
+        switch (Justification)
         {
-            case TextAlignment.Left:
-            case TextAlignment.Centered:
-            case TextAlignment.Justified:
+            case Justification.Left:
+            case Justification.Centered:
+            case Justification.Justified:
                 TextFormatter.Text = $"{GetCheckedState ()} {GetFormatterText ()}";
 
                 break;
-            case TextAlignment.Right:
+            case Justification.Right:
                 TextFormatter.Text = $"{GetFormatterText ()} {GetCheckedState ()}";
 
                 break;

+ 1 - 1
Terminal.Gui/Views/ListView.cs

@@ -1002,7 +1002,7 @@ public class ListWrapper : IListDataSource
     private void RenderUstr (ConsoleDriver driver, string ustr, int col, int line, int width, int start = 0)
     {
         string str = start > ustr.GetColumns () ? string.Empty : ustr.Substring (Math.Min (start, ustr.ToRunes ().Length - 1));
-        string u = TextFormatter.ClipAndJustify (str, width, TextAlignment.Left);
+        string u = TextFormatter.ClipAndJustify (str, width, Justification.Left);
         driver.AddStr (u);
         width -= u.GetColumns ();
 

+ 1 - 1
Terminal.Gui/Views/Menu/Menu.cs

@@ -891,7 +891,7 @@ internal sealed class Menu : View
                     var tf = new TextFormatter
                     {
                         AutoSize = true,
-                        Alignment = TextAlignment.Centered, HotKeySpecifier = MenuBar.HotKeySpecifier, Text = textToDraw
+                        Alignment = Justification.Centered, HotKeySpecifier = MenuBar.HotKeySpecifier, Text = textToDraw
                     };
 
                     // The -3 is left/right border + one space (not sure what for)

+ 1 - 1
Terminal.Gui/Views/MessageBox.cs

@@ -374,7 +374,7 @@ public static class MessageBox
         var messageLabel = new Label
         {
             Text = message,
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             X = Pos.Center (),
             Y = 0
         };

+ 1 - 1
Terminal.Gui/Views/ProgressBar.cs

@@ -181,7 +181,7 @@ public class ProgressBar : View
 
         if (ProgressBarFormat != ProgressBarFormat.Simple && !_isActivity)
         {
-            var tf = new TextFormatter { Alignment = TextAlignment.Centered, Text = Text };
+            var tf = new TextFormatter { Alignment = Justification.Centered, Text = Text };
             var attr = new Attribute (ColorScheme.HotNormal.Foreground, ColorScheme.HotNormal.Background);
 
             if (_fraction > .5)

+ 8 - 8
Terminal.Gui/Views/Slider.cs

@@ -930,7 +930,7 @@ public class Slider<T> : View
         }
     }
 
-    private string AlignText (string text, int width, TextAlignment textAlignment)
+    private string AlignText (string text, int width, Justification Justification)
     {
         if (text is null)
         {
@@ -947,20 +947,20 @@ public class Slider<T> : View
         string s2 = new (' ', w % 2);
 
         // Note: The formatter doesn't handle all of this ???
-        switch (textAlignment)
+        switch (Justification)
         {
-            case TextAlignment.Justified:
+            case Justification.Justified:
                 return TextFormatter.Justify (text, width);
-            case TextAlignment.Left:
+            case Justification.Left:
                 return text + s1 + s1 + s2;
-            case TextAlignment.Centered:
+            case Justification.Centered:
                 if (text.Length % 2 != 0)
                 {
                     return s1 + text + s1 + s2;
                 }
 
                 return s1 + s2 + text + s1;
-            case TextAlignment.Right:
+            case Justification.Right:
                 return s1 + s1 + s2 + text;
             default:
                 return text;
@@ -1293,7 +1293,7 @@ public class Slider<T> : View
                     switch (_config._legendsOrientation)
                     {
                         case Orientation.Horizontal:
-                            text = AlignText (text, _config._innerSpacing + 1, TextAlignment.Centered);
+                            text = AlignText (text, _config._innerSpacing + 1, Justification.Centered);
 
                             break;
                         case Orientation.Vertical:
@@ -1311,7 +1311,7 @@ public class Slider<T> : View
 
                             break;
                         case Orientation.Vertical:
-                            text = AlignText (text, _config._innerSpacing + 1, TextAlignment.Centered);
+                            text = AlignText (text, _config._innerSpacing + 1, Justification.Centered);
 
                             break;
                     }

+ 3 - 3
Terminal.Gui/Views/TableView/ColumnStyle.cs

@@ -11,7 +11,7 @@ public class ColumnStyle
     ///     Defines a delegate for returning custom alignment per cell based on cell values.  When specified this will
     ///     override <see cref="Alignment"/>
     /// </summary>
-    public Func<object, TextAlignment> AlignmentGetter;
+    public Func<object, Justification> AlignmentGetter;
 
     /// <summary>
     ///     Defines a delegate for returning a custom color scheme per cell based on cell values. Return null for the
@@ -32,7 +32,7 @@ public class ColumnStyle
     ///     Defines the default alignment for all values rendered in this column.  For custom alignment based on cell
     ///     contents use <see cref="AlignmentGetter"/>.
     /// </summary>
-    public TextAlignment Alignment { get; set; }
+    public Justification Alignment { get; set; }
 
     /// <summary>Defines the format for values e.g. "yyyy-MM-dd" for dates</summary>
     public string Format { get; set; }
@@ -74,7 +74,7 @@ public class ColumnStyle
     /// </summary>
     /// <param name="cellValue"></param>
     /// <returns></returns>
-    public TextAlignment GetAlignment (object cellValue)
+    public Justification GetAlignment (object cellValue)
     {
         if (AlignmentGetter is { })
         {

+ 5 - 5
Terminal.Gui/Views/TableView/TableView.cs

@@ -2085,16 +2085,16 @@ public class TableView : View
                         - (representation.EnumerateRunes ().Sum (c => c.GetColumns ())
                            + 1 /*leave 1 space for cell boundary*/);
 
-            switch (colStyle?.GetAlignment (originalCellValue) ?? TextAlignment.Left)
+            switch (colStyle?.GetAlignment (originalCellValue) ?? Justification.Left)
             {
-                case TextAlignment.Left:
+                case Justification.Left:
                     return representation + new string (' ', toPad);
-                case TextAlignment.Right:
+                case Justification.Right:
                     return new string (' ', toPad) + representation;
 
                 // TODO: With single line cells, centered and justified are the same right?
-                case TextAlignment.Centered:
-                case TextAlignment.Justified:
+                case Justification.Centered:
+                case Justification.Justified:
                     return
                         new string (' ', (int)Math.Floor (toPad / 2.0))
                         + // round down

+ 8 - 8
Terminal.Gui/Views/TextValidateField.cs

@@ -539,7 +539,7 @@ namespace Terminal.Gui
             {
                 int c = _provider.Cursor (mouseEvent.X - GetMargins (Viewport.Width).left);
 
-                if (_provider.Fixed == false && TextAlignment == TextAlignment.Right && Text.Length > 0)
+                if (_provider.Fixed == false && Justification == Justification.Right && Text.Length > 0)
                 {
                     c++;
                 }
@@ -633,7 +633,7 @@ namespace Terminal.Gui
             // When it's right-aligned and it's a normal input, the cursor behaves differently.
             int curPos;
 
-            if (_provider?.Fixed == false && TextAlignment == TextAlignment.Right)
+            if (_provider?.Fixed == false && Justification == Justification.Right)
             {
                 curPos = _cursorPosition + left - 1;
             }
@@ -650,7 +650,7 @@ namespace Terminal.Gui
         /// <returns></returns>
         private bool BackspaceKeyHandler ()
         {
-            if (_provider.Fixed == false && TextAlignment == TextAlignment.Right && _cursorPosition <= 1)
+            if (_provider.Fixed == false && Justification == Justification.Right && _cursorPosition <= 1)
             {
                 return false;
             }
@@ -688,7 +688,7 @@ namespace Terminal.Gui
         /// <returns></returns>
         private bool DeleteKeyHandler ()
         {
-            if (_provider.Fixed == false && TextAlignment == TextAlignment.Right)
+            if (_provider.Fixed == false && Justification == Justification.Right)
             {
                 _cursorPosition = _provider.CursorLeft (_cursorPosition);
             }
@@ -717,13 +717,13 @@ namespace Terminal.Gui
             int count = Text.Length;
             int total = width - count;
 
-            switch (TextAlignment)
+            switch (Justification)
             {
-                case TextAlignment.Left:
+                case Justification.Left:
                     return (0, total);
-                case TextAlignment.Centered:
+                case Justification.Centered:
                     return (total / 2, total / 2 + total % 2);
-                case TextAlignment.Right:
+                case Justification.Right:
                     return (total, 0);
                 default:
                     return (0, total);

+ 1 - 1
Terminal.Gui/Views/TextView.cs

@@ -1776,7 +1776,7 @@ internal class WordWrapManager
                                                             TextFormatter.Format (
                                                                                   TextModel.ToString (line),
                                                                                   width,
-                                                                                  TextAlignment.Left,
+                                                                                  Justification.Left,
                                                                                   true,
                                                                                   preserveTrailingSpaces,
                                                                                   tabWidth

+ 2 - 2
UICatalog/Scenarios/BasicColors.cs

@@ -32,7 +32,7 @@ public class BasicColors : Scenario
                 Y = 0,
                 Width = 1,
                 Height = 13,
-                VerticalTextAlignment = VerticalTextAlignment.Bottom,
+                VerticalJustification = Justification.Bottom,
                 ColorScheme = new ColorScheme { Normal = attr },
                 Text = bg.ToString (),
                 TextDirection = TextDirection.TopBottom_LeftRight
@@ -45,7 +45,7 @@ public class BasicColors : Scenario
                 Y = y,
                 Width = 13,
                 Height = 1,
-                TextAlignment = TextAlignment.Right,
+                Justification = Justification.Right,
                 ColorScheme = new ColorScheme { Normal = attr },
                 Text = bg.ToString ()
             };

+ 25 - 25
UICatalog/Scenarios/Buttons.cs

@@ -287,39 +287,39 @@ public class Buttons : Scenario
                                               switch (args.SelectedItem)
                                               {
                                                   case 0:
-                                                      moveBtn.TextAlignment = TextAlignment.Left;
-                                                      sizeBtn.TextAlignment = TextAlignment.Left;
-                                                      moveBtnA.TextAlignment = TextAlignment.Left;
-                                                      sizeBtnA.TextAlignment = TextAlignment.Left;
-                                                      moveHotKeyBtn.TextAlignment = TextAlignment.Left;
-                                                      moveUnicodeHotKeyBtn.TextAlignment = TextAlignment.Left;
+                                                      moveBtn.Justification = Justification.Left;
+                                                      sizeBtn.Justification = Justification.Left;
+                                                      moveBtnA.Justification = Justification.Left;
+                                                      sizeBtnA.Justification = Justification.Left;
+                                                      moveHotKeyBtn.Justification = Justification.Left;
+                                                      moveUnicodeHotKeyBtn.Justification = Justification.Left;
 
                                                       break;
                                                   case 1:
-                                                      moveBtn.TextAlignment = TextAlignment.Right;
-                                                      sizeBtn.TextAlignment = TextAlignment.Right;
-                                                      moveBtnA.TextAlignment = TextAlignment.Right;
-                                                      sizeBtnA.TextAlignment = TextAlignment.Right;
-                                                      moveHotKeyBtn.TextAlignment = TextAlignment.Right;
-                                                      moveUnicodeHotKeyBtn.TextAlignment = TextAlignment.Right;
+                                                      moveBtn.Justification = Justification.Right;
+                                                      sizeBtn.Justification = Justification.Right;
+                                                      moveBtnA.Justification = Justification.Right;
+                                                      sizeBtnA.Justification = Justification.Right;
+                                                      moveHotKeyBtn.Justification = Justification.Right;
+                                                      moveUnicodeHotKeyBtn.Justification = Justification.Right;
 
                                                       break;
                                                   case 2:
-                                                      moveBtn.TextAlignment = TextAlignment.Centered;
-                                                      sizeBtn.TextAlignment = TextAlignment.Centered;
-                                                      moveBtnA.TextAlignment = TextAlignment.Centered;
-                                                      sizeBtnA.TextAlignment = TextAlignment.Centered;
-                                                      moveHotKeyBtn.TextAlignment = TextAlignment.Centered;
-                                                      moveUnicodeHotKeyBtn.TextAlignment = TextAlignment.Centered;
+                                                      moveBtn.Justification = Justification.Centered;
+                                                      sizeBtn.Justification = Justification.Centered;
+                                                      moveBtnA.Justification = Justification.Centered;
+                                                      sizeBtnA.Justification = Justification.Centered;
+                                                      moveHotKeyBtn.Justification = Justification.Centered;
+                                                      moveUnicodeHotKeyBtn.Justification = Justification.Centered;
 
                                                       break;
                                                   case 3:
-                                                      moveBtn.TextAlignment = TextAlignment.Justified;
-                                                      sizeBtn.TextAlignment = TextAlignment.Justified;
-                                                      moveBtnA.TextAlignment = TextAlignment.Justified;
-                                                      sizeBtnA.TextAlignment = TextAlignment.Justified;
-                                                      moveHotKeyBtn.TextAlignment = TextAlignment.Justified;
-                                                      moveUnicodeHotKeyBtn.TextAlignment = TextAlignment.Justified;
+                                                      moveBtn.Justification = Justification.Justified;
+                                                      sizeBtn.Justification = Justification.Justified;
+                                                      moveBtnA.Justification = Justification.Justified;
+                                                      sizeBtnA.Justification = Justification.Justified;
+                                                      moveHotKeyBtn.Justification = Justification.Justified;
+                                                      moveUnicodeHotKeyBtn.Justification = Justification.Justified;
 
                                                       break;
                                               }
@@ -439,7 +439,7 @@ public class Buttons : Scenario
                 Y = Pos.Top (_down),
                 Width = Dim.Function (() => Digits),
                 Height = 1,
-                TextAlignment = TextAlignment.Centered,
+                Justification = Justification.Centered,
                 CanFocus = true
             };
 

+ 1 - 1
UICatalog/Scenarios/CharacterMap.cs

@@ -958,7 +958,7 @@ internal class CharMap : View
             Y = 1,
             Width = Dim.Fill (),
             Height = Dim.Fill (1),
-            TextAlignment = TextAlignment.Centered
+            Justification = Justification.Centered
         };
         var spinner = new SpinnerView { X = Pos.Center (), Y = Pos.Center (), Style = new Aesthetic () };
         spinner.AutoSpin = true;

+ 2 - 2
UICatalog/Scenarios/CollectionNavigatorTester.cs

@@ -142,7 +142,7 @@ public class CollectionNavigatorTester : Scenario
         var label = new Label
         {
             Text = "ListView",
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             X = 0,
             Y = 1, // for menu
             Width = Dim.Percent (50),
@@ -171,7 +171,7 @@ public class CollectionNavigatorTester : Scenario
         var label = new Label
         {
             Text = "TreeView",
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             X = Pos.Right (_listView) + 2,
             Y = 1, // for menu
             Width = Dim.Percent (50),

+ 2 - 2
UICatalog/Scenarios/ColorPicker.cs

@@ -69,8 +69,8 @@ public class ColorPickers : Scenario
         {
             Title = "Color Sample",
             Text = "Lorem Ipsum",
-            TextAlignment = TextAlignment.Centered,
-            VerticalTextAlignment = VerticalTextAlignment.Middle,
+            Justification = Justification.Centered,
+            VerticalJustification = Justification.Centered,
             BorderStyle = LineStyle.Heavy,
             X = Pos.Center (),
             Y = Pos.Center (),

+ 10 - 10
UICatalog/Scenarios/ComputedLayout.cs

@@ -91,7 +91,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           TextAlignment = TextAlignment.Left,
+                           Justification = Justification.Left,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -103,7 +103,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           TextAlignment = TextAlignment.Right,
+                           Justification = Justification.Right,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -115,7 +115,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           TextAlignment = TextAlignment.Centered,
+                           Justification = Justification.Centered,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -127,7 +127,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           TextAlignment = TextAlignment.Justified,
+                           Justification = Justification.Justified,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -153,7 +153,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           TextAlignment = TextAlignment.Left,
+                           Justification = Justification.Left,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -165,7 +165,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           TextAlignment = TextAlignment.Right,
+                           Justification = Justification.Right,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -177,7 +177,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           TextAlignment = TextAlignment.Centered,
+                           Justification = Justification.Centered,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -189,7 +189,7 @@ public class ComputedLayout : Scenario
         labelList.Add (
                        new Label
                        {
-                           TextAlignment = TextAlignment.Justified,
+                           Justification = Justification.Justified,
                            Width = Dim.Fill (),
                            X = 0,
                            Y = Pos.Bottom (labelList.LastOrDefault ()),
@@ -324,7 +324,7 @@ public class ComputedLayout : Scenario
         var anchorEndLabel1 = new Label
         {
             Text = "This Label should be the 3rd to last line (AnchorEnd (3)).",
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             ColorScheme = Colors.ColorSchemes ["Menu"],
             Width = Dim.Fill (5),
             X = 5,
@@ -338,7 +338,7 @@ public class ComputedLayout : Scenario
         {
             Text =
                 "This TextField should be the 4th to last line (AnchorEnd (3) - 1).",
-            TextAlignment = TextAlignment.Left,
+            Justification = Justification.Left,
             ColorScheme = Colors.ColorSchemes ["Menu"],
             Width = Dim.Fill (5),
             X = 5,

+ 11 - 11
UICatalog/Scenarios/CsvEditor.cs

@@ -78,17 +78,17 @@ public class CsvEditor : Scenario
                                      _miLeft = new MenuItem (
                                                              "_Align Left",
                                                              "",
-                                                             () => Align (TextAlignment.Left)
+                                                             () => Align (Justification.Left)
                                                             ),
                                      _miRight = new MenuItem (
                                                               "_Align Right",
                                                               "",
-                                                              () => Align (TextAlignment.Right)
+                                                              () => Align (Justification.Right)
                                                              ),
                                      _miCentered = new MenuItem (
                                                                  "_Align Centered",
                                                                  "",
-                                                                 () => Align (TextAlignment.Centered)
+                                                                 () => Align (Justification.Centered)
                                                                 ),
 
                                      // Format requires hard typed data table, when we read a CSV everything is untyped (string) so this only works for new columns in this demo
@@ -133,7 +133,7 @@ public class CsvEditor : Scenario
             Y = Pos.Bottom (_tableView),
             Text = "0,0",
             Width = Dim.Fill (),
-            TextAlignment = TextAlignment.Right
+            Justification = Justification.Right
         };
         _selectedCellLabel.TextChanged += SelectedCellLabel_TextChanged;
 
@@ -218,7 +218,7 @@ public class CsvEditor : Scenario
         _tableView.Update ();
     }
 
-    private void Align (TextAlignment newAlignment)
+    private void Align (Justification newAlignment)
     {
         if (NoTableLoaded ())
         {
@@ -228,9 +228,9 @@ public class CsvEditor : Scenario
         ColumnStyle style = _tableView.Style.GetOrCreateColumnStyle (_tableView.SelectedColumn);
         style.Alignment = newAlignment;
 
-        _miLeft.Checked = style.Alignment == TextAlignment.Left;
-        _miRight.Checked = style.Alignment == TextAlignment.Right;
-        _miCentered.Checked = style.Alignment == TextAlignment.Centered;
+        _miLeft.Checked = style.Alignment == Justification.Left;
+        _miRight.Checked = style.Alignment == Justification.Right;
+        _miCentered.Checked = style.Alignment == Justification.Centered;
 
         _tableView.Update ();
     }
@@ -437,9 +437,9 @@ public class CsvEditor : Scenario
 
         ColumnStyle style = _tableView.Style.GetColumnStyleIfAny (_tableView.SelectedColumn);
 
-        _miLeft.Checked = style?.Alignment == TextAlignment.Left;
-        _miRight.Checked = style?.Alignment == TextAlignment.Right;
-        _miCentered.Checked = style?.Alignment == TextAlignment.Centered;
+        _miLeft.Checked = style?.Alignment == Justification.Left;
+        _miRight.Checked = style?.Alignment == Justification.Right;
+        _miCentered.Checked = style?.Alignment == Justification.Centered;
     }
 
     private void Open ()

+ 7 - 7
UICatalog/Scenarios/Dialogs.cs

@@ -18,7 +18,7 @@ public class Dialogs : Scenario
         var numButtonsLabel = new Label
         {
             X = 0,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = "_Number of Buttons:"
         };
 
@@ -28,7 +28,7 @@ public class Dialogs : Scenario
             Y = 0,
             Width = Dim.Width (numButtonsLabel),
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = "_Width:"
         };
         frame.Add (label);
@@ -49,7 +49,7 @@ public class Dialogs : Scenario
             Y = Pos.Bottom (label),
             Width = Dim.Width (numButtonsLabel),
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = "_Height:"
         };
         frame.Add (label);
@@ -83,7 +83,7 @@ public class Dialogs : Scenario
             Y = Pos.Bottom (label),
             Width = Dim.Width (numButtonsLabel),
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = "_Title:"
         };
         frame.Add (label);
@@ -115,7 +115,7 @@ public class Dialogs : Scenario
         {
             X = Pos.Right (numButtonsLabel) + 1,
             Y = Pos.Bottom (numButtonsLabel),
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = $"_Add {char.ConvertFromUtf32 (CODE_POINT)} to button text to stress wide char support",
             Checked = false
         };
@@ -127,7 +127,7 @@ public class Dialogs : Scenario
             Y = Pos.Bottom (glyphsNotWords),
             Width = Dim.Width (numButtonsLabel),
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = "Button St_yle:"
         };
         frame.Add (label);
@@ -175,7 +175,7 @@ public class Dialogs : Scenario
 
         label = new()
         {
-            X = Pos.Center (), Y = Pos.Bottom (frame) + 4, TextAlignment = TextAlignment.Right, Text = "Button Pressed:"
+            X = Pos.Center (), Y = Pos.Bottom (frame) + 4, Justification = Justification.Right, Text = "Button Pressed:"
         };
         Win.Add (label);
 

+ 2 - 2
UICatalog/Scenarios/DynamicMenuBar.cs

@@ -623,7 +623,7 @@ public class DynamicMenuBar : Scenario
             var _lblMenuBar = new Label
             {
                 ColorScheme = Colors.ColorSchemes ["Dialog"],
-                TextAlignment = TextAlignment.Centered,
+                Justification = Justification.Centered,
                 X = Pos.Right (_btnPrevious) + 1,
                 Y = Pos.Top (_btnPrevious),
 
@@ -636,7 +636,7 @@ public class DynamicMenuBar : Scenario
 
             var _lblParent = new Label
             {
-                TextAlignment = TextAlignment.Centered,
+                Justification = Justification.Centered,
                 X = Pos.Right (_btnPrevious) + 1,
                 Y = Pos.Top (_btnPrevious) + 1,
 

+ 9 - 9
UICatalog/Scenarios/Editor.cs

@@ -882,7 +882,7 @@ public class Editor : Scenario
         {
             Y = 1,
             Width = lblWidth,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
 
             Text = "Find:"
         };
@@ -903,7 +903,7 @@ public class Editor : Scenario
             Y = Pos.Top (label),
             Width = 20,
             Enabled = !string.IsNullOrEmpty (txtToFind.Text),
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             IsDefault = true,
 
             Text = "Find _Next"
@@ -917,7 +917,7 @@ public class Editor : Scenario
             Y = Pos.Top (btnFindNext) + 1,
             Width = 20,
             Enabled = !string.IsNullOrEmpty (txtToFind.Text),
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
 
             Text = "Find _Previous"
         };
@@ -937,7 +937,7 @@ public class Editor : Scenario
             X = Pos.Right (txtToFind) + 1,
             Y = Pos.Top (btnFindPrevious) + 2,
             Width = 20,
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
 
             Text = "Cancel"
         };
@@ -1134,7 +1134,7 @@ public class Editor : Scenario
         {
             Y = 1,
             Width = lblWidth,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
 
             Text = "Find:"
         };
@@ -1155,7 +1155,7 @@ public class Editor : Scenario
             Y = Pos.Top (label),
             Width = 20,
             Enabled = !string.IsNullOrEmpty (txtToFind.Text),
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             IsDefault = true,
 
             Text = "Replace _Next"
@@ -1181,7 +1181,7 @@ public class Editor : Scenario
             Y = Pos.Top (btnFindNext) + 1,
             Width = 20,
             Enabled = !string.IsNullOrEmpty (txtToFind.Text),
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
 
             Text = "Replace _Previous"
         };
@@ -1194,7 +1194,7 @@ public class Editor : Scenario
             Y = Pos.Top (btnFindPrevious) + 1,
             Width = 20,
             Enabled = !string.IsNullOrEmpty (txtToFind.Text),
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
 
             Text = "Replace _All"
         };
@@ -1215,7 +1215,7 @@ public class Editor : Scenario
             X = Pos.Right (txtToFind) + 1,
             Y = Pos.Top (btnReplaceAll) + 1,
             Width = 20,
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
 
             Text = "Cancel"
         };

+ 1 - 1
UICatalog/Scenarios/ListColumns.cs

@@ -247,7 +247,7 @@ public class ListColumns : Scenario
             Text = "0,0",
 
             Width = Dim.Fill (),
-            TextAlignment = TextAlignment.Right
+            Justification = Justification.Right
         };
 
         Win.Add (selectedCellLabel);

+ 9 - 9
UICatalog/Scenarios/MessageBoxes.cs

@@ -14,7 +14,7 @@ public class MessageBoxes : Scenario
         var frame = new FrameView { X = Pos.Center (), Y = 1, Width = Dim.Percent (75), Title = "MessageBox Options" };
         Win.Add (frame);
 
-        var label = new Label { X = 0, Y = 0, TextAlignment = TextAlignment.Right, Text = "Width:" };
+        var label = new Label { X = 0, Y = 0, Justification = Justification.Right, Text = "Width:" };
         frame.Add (label);
 
         var widthEdit = new TextField
@@ -34,7 +34,7 @@ public class MessageBoxes : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = "Height:"
         };
         frame.Add (label);
@@ -69,7 +69,7 @@ public class MessageBoxes : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = "Title:"
         };
         frame.Add (label);
@@ -91,7 +91,7 @@ public class MessageBoxes : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = "Message:"
         };
         frame.Add (label);
@@ -113,7 +113,7 @@ public class MessageBoxes : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = "Num Buttons:"
         };
         frame.Add (label);
@@ -135,7 +135,7 @@ public class MessageBoxes : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = "Default Button:"
         };
         frame.Add (label);
@@ -157,7 +157,7 @@ public class MessageBoxes : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = "Style:"
         };
         frame.Add (label);
@@ -195,7 +195,7 @@ public class MessageBoxes : Scenario
 
         label = new()
         {
-            X = Pos.Center (), Y = Pos.Bottom (frame) + 2, TextAlignment = TextAlignment.Right, Text = "Button Pressed:"
+            X = Pos.Center (), Y = Pos.Bottom (frame) + 2, Justification = Justification.Right, Text = "Button Pressed:"
         };
         Win.Add (label);
 
@@ -204,7 +204,7 @@ public class MessageBoxes : Scenario
             X = Pos.Center (),
             Y = Pos.Bottom (label) + 1,
             ColorScheme = Colors.ColorSchemes ["Error"],
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Text = " "
         };
 

+ 2 - 2
UICatalog/Scenarios/Mouse.cs

@@ -98,8 +98,8 @@ public class Mouse : Scenario
             Width = 20,
             Height = 3,
             Text = "Enter/Leave Demo",
-            TextAlignment = TextAlignment.Centered,
-            VerticalTextAlignment = VerticalTextAlignment.Middle,
+            Justification = Justification.Centered,
+            VerticalJustification = Justification.Centered,
             ColorScheme = Colors.ColorSchemes ["Dialog"]
         };
         win.Add (demo);

+ 7 - 7
UICatalog/Scenarios/TableEditor.cs

@@ -707,7 +707,7 @@ public class TableEditor : Scenario
             Text = "0,0",
 
             Width = Dim.Fill (),
-            TextAlignment = TextAlignment.Right
+            Justification = Justification.Right
         };
 
         Win.Add (selectedCellLabel);
@@ -1107,12 +1107,12 @@ public class TableEditor : Scenario
     {
         _tableView.Style.ColumnStyles.Clear ();
 
-        var alignMid = new ColumnStyle { Alignment = TextAlignment.Centered };
-        var alignRight = new ColumnStyle { Alignment = TextAlignment.Right };
+        var alignMid = new ColumnStyle { Alignment = Justification.Centered };
+        var alignRight = new ColumnStyle { Alignment = Justification.Right };
 
         var dateFormatStyle = new ColumnStyle
         {
-            Alignment = TextAlignment.Right,
+            Alignment = Justification.Right,
             RepresentationGetter = v =>
                                        v is DateTime d ? d.ToString ("yyyy-MM-dd") : v.ToString ()
         };
@@ -1126,15 +1126,15 @@ public class TableEditor : Scenario
 
                                        // align negative values right
                                        d < 0
-                                           ? TextAlignment.Right
+                                           ? Justification.Right
                                            :
 
                                            // align positive values left
-                                           TextAlignment.Left
+                                           Justification.Left
                                        :
 
                                        // not a double
-                                       TextAlignment.Left,
+                                       Justification.Left,
             ColorGetter = a => a.CellValue is double d
                                    ?
 

+ 1 - 1
UICatalog/Scenarios/Text.cs

@@ -290,7 +290,7 @@ public class Text : Scenario
             X = Pos.Right (regexProvider) + 1,
             Y = Pos.Y (regexProvider),
             Width = 30,
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Provider = provider2
         };
         Win.Add (regexProviderField);

+ 9 - 9
UICatalog/Scenarios/TextAlignments.cs

@@ -18,17 +18,17 @@ public class TextAlignments : Scenario
         var txt = "Hello world, how are you today? Pretty neat!";
         var unicodeSampleText = "A Unicode sentence (пÑРвеÑ) has words.";
 
-        List<TextAlignment> alignments = Enum.GetValues (typeof (TextAlignment)).Cast<TextAlignment> ().ToList ();
+        List<Justification> alignments = Enum.GetValues (typeof (Justification)).Cast<Justification> ().ToList ();
         Label [] singleLines = new Label [alignments.Count];
         Label [] multipleLines = new Label [alignments.Count];
 
         var multiLineHeight = 5;
 
-        foreach (TextAlignment alignment in alignments)
+        foreach (Justification alignment in alignments)
         {
             singleLines [(int)alignment] = new()
             {
-                TextAlignment = alignment,
+                Justification = alignment,
                 X = 1,
 
                 Width = Dim.Fill (1),
@@ -39,7 +39,7 @@ public class TextAlignments : Scenario
 
             multipleLines [(int)alignment] = new()
             {
-                TextAlignment = alignment,
+                Justification = alignment,
                 X = 1,
 
                 Width = Dim.Fill (1),
@@ -65,7 +65,7 @@ public class TextAlignments : Scenario
 
         edit.TextChanged += (s, e) =>
                             {
-                                foreach (TextAlignment alignment in alignments)
+                                foreach (Justification alignment in alignments)
                                 {
                                     singleLines [(int)alignment].Text = edit.Text;
                                     multipleLines [(int)alignment].Text = edit.Text;
@@ -81,7 +81,7 @@ public class TextAlignments : Scenario
 
         update.Accept += (s, e) =>
                          {
-                             foreach (TextAlignment alignment in alignments)
+                             foreach (Justification alignment in alignments)
                              {
                                  singleLines [(int)alignment].Text = edit.Text;
                                  multipleLines [(int)alignment].Text = edit.Text;
@@ -102,7 +102,7 @@ public class TextAlignments : Scenario
         };
         Win.Add (label);
 
-        foreach (TextAlignment alignment in alignments)
+        foreach (Justification alignment in alignments)
         {
             label = new() { Y = Pos.Bottom (label), Text = $"{alignment}:" };
             Win.Add (label);
@@ -115,7 +115,7 @@ public class TextAlignments : Scenario
         label = new() { Y = Pos.Bottom (label), Text = "Demonstrating multi-line and word wrap:" };
         Win.Add (label);
 
-        foreach (TextAlignment alignment in alignments)
+        foreach (Justification alignment in alignments)
         {
             label = new() { Y = Pos.Bottom (label), Text = $"{alignment}:" };
             Win.Add (label);
@@ -126,7 +126,7 @@ public class TextAlignments : Scenario
 
         enableHotKeyCheckBox.Toggled += (s, e) =>
                                         {
-                                            foreach (TextAlignment alignment in alignments)
+                                            foreach (Justification alignment in alignments)
                                             {
                                                 singleLines [(int)alignment].HotKeySpecifier =
                                                     e.OldValue == true ? (Rune)0xffff : (Rune)'_';

+ 50 - 50
UICatalog/Scenarios/TextAlignmentsAndDirection.cs

@@ -35,7 +35,7 @@ public class TextAlignmentsAndDirections : Scenario
             Y = 1,
             Width = 9,
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             ColorScheme = Colors.ColorSchemes ["Dialog"],
             Text = "Left"
         };
@@ -46,7 +46,7 @@ public class TextAlignmentsAndDirections : Scenario
             Y = 2,
             Width = 9,
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             ColorScheme = Colors.ColorSchemes ["Dialog"],
             Text = "Centered"
         };
@@ -57,7 +57,7 @@ public class TextAlignmentsAndDirections : Scenario
             Y = 3,
             Width = 9,
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             ColorScheme = Colors.ColorSchemes ["Dialog"],
             Text = "Right"
         };
@@ -68,7 +68,7 @@ public class TextAlignmentsAndDirections : Scenario
             Y = 4,
             Width = 9,
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             ColorScheme = Colors.ColorSchemes ["Dialog"],
             Text = "Justified"
         };
@@ -80,7 +80,7 @@ public class TextAlignmentsAndDirections : Scenario
             Width = Dim.Fill (1) - 9,
             Height = 1,
             ColorScheme = color1,
-            TextAlignment = TextAlignment.Left,
+            Justification = Justification.Left,
             Text = txt
         };
 
@@ -91,7 +91,7 @@ public class TextAlignmentsAndDirections : Scenario
             Width = Dim.Fill (1) - 9,
             Height = 1,
             ColorScheme = color2,
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Text = txt
         };
 
@@ -102,7 +102,7 @@ public class TextAlignmentsAndDirections : Scenario
             Width = Dim.Fill (1) - 9,
             Height = 1,
             ColorScheme = color1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = txt
         };
 
@@ -113,7 +113,7 @@ public class TextAlignmentsAndDirections : Scenario
             Width = Dim.Fill (1) - 9,
             Height = 1,
             ColorScheme = color2,
-            TextAlignment = TextAlignment.Justified,
+            Justification = Justification.Justified,
             Text = txt
         };
 
@@ -141,7 +141,7 @@ public class TextAlignmentsAndDirections : Scenario
             Height = 9,
             ColorScheme = color1,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalTextAlignment = VerticalTextAlignment.Bottom,
+            VerticalJustification = Justification.Bottom,
             Text = "Top"
         };
         labelVT.TextFormatter.WordWrap = false;
@@ -154,8 +154,8 @@ public class TextAlignmentsAndDirections : Scenario
             Height = 9,
             ColorScheme = color1,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalTextAlignment = VerticalTextAlignment.Bottom,
-            Text = "Middle"
+            VerticalJustification = Justification.Bottom,
+            Text = "Centered"
         };
         labelVM.TextFormatter.WordWrap = false;
 
@@ -167,7 +167,7 @@ public class TextAlignmentsAndDirections : Scenario
             Height = 9,
             ColorScheme = color1,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalTextAlignment = VerticalTextAlignment.Bottom,
+            VerticalJustification = Justification.Bottom,
             Text = "Bottom"
         };
         labelVB.TextFormatter.WordWrap = false;
@@ -180,7 +180,7 @@ public class TextAlignmentsAndDirections : Scenario
             Height = 9,
             ColorScheme = color1,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalTextAlignment = VerticalTextAlignment.Bottom,
+            VerticalJustification = Justification.Bottom,
             Text = "Justified"
         };
         labelVJ.TextFormatter.WordWrap = false;
@@ -193,7 +193,7 @@ public class TextAlignmentsAndDirections : Scenario
             Height = Dim.Fill (1),
             ColorScheme = color1,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalTextAlignment = VerticalTextAlignment.Top,
+            VerticalJustification = Justification.Top,
             Text = txt
         };
         txtLabelVT.TextFormatter.WordWrap = false;
@@ -206,7 +206,7 @@ public class TextAlignmentsAndDirections : Scenario
             Height = Dim.Fill (1),
             ColorScheme = color2,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalTextAlignment = VerticalTextAlignment.Middle,
+            VerticalJustification = Justification.Centered,
             Text = txt
         };
         txtLabelVM.TextFormatter.WordWrap = false;
@@ -219,7 +219,7 @@ public class TextAlignmentsAndDirections : Scenario
             Height = Dim.Fill (1),
             ColorScheme = color1,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalTextAlignment = VerticalTextAlignment.Bottom,
+            VerticalJustification = Justification.Bottom,
             Text = txt
         };
         txtLabelVB.TextFormatter.WordWrap = false;
@@ -232,7 +232,7 @@ public class TextAlignmentsAndDirections : Scenario
             Height = Dim.Fill (1),
             ColorScheme = color2,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalTextAlignment = VerticalTextAlignment.Justified,
+            VerticalJustification = Justification.Justified,
             Text = txt
         };
         txtLabelVJ.TextFormatter.WordWrap = false;
@@ -268,8 +268,8 @@ public class TextAlignmentsAndDirections : Scenario
             Y = 1,
             Width = Dim.Percent (100f / 3f),
             Height = Dim.Percent (100f / 3f),
-            TextAlignment = TextAlignment.Left,
-            VerticalTextAlignment = VerticalTextAlignment.Top,
+            Justification = Justification.Left,
+            VerticalJustification = Justification.Top,
             ColorScheme = color1,
             Text = txt
         };
@@ -281,8 +281,8 @@ public class TextAlignmentsAndDirections : Scenario
             Y = 1,
             Width = Dim.Percent (100f / 3f),
             Height = Dim.Percent (100f / 3f),
-            TextAlignment = TextAlignment.Centered,
-            VerticalTextAlignment = VerticalTextAlignment.Top,
+            Justification = Justification.Centered,
+            VerticalJustification = Justification.Top,
             ColorScheme = color1,
             Text = txt
         };
@@ -294,8 +294,8 @@ public class TextAlignmentsAndDirections : Scenario
             Y = 1,
             Width = Dim.Percent (100f, true),
             Height = Dim.Percent (100f / 3f),
-            TextAlignment = TextAlignment.Right,
-            VerticalTextAlignment = VerticalTextAlignment.Top,
+            Justification = Justification.Right,
+            VerticalJustification = Justification.Top,
             ColorScheme = color1,
             Text = txt
         };
@@ -307,8 +307,8 @@ public class TextAlignmentsAndDirections : Scenario
             Y = Pos.Bottom (txtLabelTL) + 1,
             Width = Dim.Width (txtLabelTL),
             Height = Dim.Percent (100f / 3f),
-            TextAlignment = TextAlignment.Left,
-            VerticalTextAlignment = VerticalTextAlignment.Middle,
+            Justification = Justification.Left,
+            VerticalJustification = Justification.Centered,
             ColorScheme = color1,
             Text = txt
         };
@@ -320,8 +320,8 @@ public class TextAlignmentsAndDirections : Scenario
             Y = Pos.Bottom (txtLabelTC) + 1,
             Width = Dim.Width (txtLabelTC),
             Height = Dim.Percent (100f / 3f),
-            TextAlignment = TextAlignment.Centered,
-            VerticalTextAlignment = VerticalTextAlignment.Middle,
+            Justification = Justification.Centered,
+            VerticalJustification = Justification.Centered,
             ColorScheme = color1,
             Text = txt
         };
@@ -333,8 +333,8 @@ public class TextAlignmentsAndDirections : Scenario
             Y = Pos.Bottom (txtLabelTR) + 1,
             Width = Dim.Percent (100f, true),
             Height = Dim.Percent (100f / 3f),
-            TextAlignment = TextAlignment.Right,
-            VerticalTextAlignment = VerticalTextAlignment.Middle,
+            Justification = Justification.Right,
+            VerticalJustification = Justification.Centered,
             ColorScheme = color1,
             Text = txt
         };
@@ -346,8 +346,8 @@ public class TextAlignmentsAndDirections : Scenario
             Y = Pos.Bottom (txtLabelML) + 1,
             Width = Dim.Width (txtLabelML),
             Height = Dim.Percent (100f, true),
-            TextAlignment = TextAlignment.Left,
-            VerticalTextAlignment = VerticalTextAlignment.Bottom,
+            Justification = Justification.Left,
+            VerticalJustification = Justification.Bottom,
             ColorScheme = color1,
             Text = txt
         };
@@ -359,8 +359,8 @@ public class TextAlignmentsAndDirections : Scenario
             Y = Pos.Bottom (txtLabelMC) + 1,
             Width = Dim.Width (txtLabelMC),
             Height = Dim.Percent (100f, true),
-            TextAlignment = TextAlignment.Centered,
-            VerticalTextAlignment = VerticalTextAlignment.Bottom,
+            Justification = Justification.Centered,
+            VerticalJustification = Justification.Bottom,
             ColorScheme = color1,
             Text = txt
         };
@@ -372,8 +372,8 @@ public class TextAlignmentsAndDirections : Scenario
             Y = Pos.Bottom (txtLabelMR) + 1,
             Width = Dim.Percent (100f, true),
             Height = Dim.Percent (100f, true),
-            TextAlignment = TextAlignment.Right,
-            VerticalTextAlignment = VerticalTextAlignment.Bottom,
+            Justification = Justification.Right,
+            VerticalJustification = Justification.Bottom,
             ColorScheme = color1,
             Text = txt
         };
@@ -392,7 +392,7 @@ public class TextAlignmentsAndDirections : Scenario
         // Save Alignments in Data
         foreach (Label t in mtxts)
         {
-            t.Data = new { h = t.TextAlignment, v = t.VerticalTextAlignment };
+            t.Data = new { h = t.Justification, v = t.VerticalJustification };
         }
 
         container.Add (txtLabelTL);
@@ -593,8 +593,8 @@ public class TextAlignmentsAndDirections : Scenario
 
                 foreach (Label t in mtxts)
                 {
-                    t.TextAlignment = (TextAlignment)((dynamic)t.Data).h;
-                    t.VerticalTextAlignment = (VerticalTextAlignment)((dynamic)t.Data).v;
+                    t.Justification = (Justification)((dynamic)t.Data).h;
+                    t.VerticalJustification = (Justification)((dynamic)t.Data).v;
                 }
             }
             else
@@ -611,16 +611,16 @@ public class TextAlignmentsAndDirections : Scenario
                         switch (justifyOptions.SelectedItem)
                         {
                             case 0:
-                                t.VerticalTextAlignment = VerticalTextAlignment.Justified;
-                                t.TextAlignment = ((dynamic)t.Data).h;
+                                t.VerticalJustification = Justification.Justified;
+                                t.Justification = ((dynamic)t.Data).h;
                                 break;
                             case 1:
-                                t.VerticalTextAlignment = (VerticalTextAlignment)((dynamic)t.Data).v;
-                                t.TextAlignment = TextAlignment.Justified;
+                                t.VerticalJustification = (Justification)((dynamic)t.Data).v;
+                                t.Justification = Justification.Justified;
                                 break;
                             case 2:
-                                t.VerticalTextAlignment = VerticalTextAlignment.Justified;
-                                t.TextAlignment = TextAlignment.Justified;
+                                t.VerticalJustification = Justification.Justified;
+                                t.Justification = Justification.Justified;
                                 break;
                         }
                     }
@@ -629,16 +629,16 @@ public class TextAlignmentsAndDirections : Scenario
                         switch (justifyOptions.SelectedItem)
                         {
                             case 0:
-                                t.TextAlignment = TextAlignment.Justified;
-                                t.VerticalTextAlignment = ((dynamic)t.Data).v;
+                                t.Justification = Justification.Justified;
+                                t.VerticalJustification = ((dynamic)t.Data).v;
                                 break;
                             case 1:
-                                t.TextAlignment = (TextAlignment)((dynamic)t.Data).h;
-                                t.VerticalTextAlignment = VerticalTextAlignment.Justified;
+                                t.Justification = (Justification)((dynamic)t.Data).h;
+                                t.VerticalJustification = Justification.Justified;
                                 break;
                             case 2:
-                                t.TextAlignment = TextAlignment.Justified;
-                                t.VerticalTextAlignment = VerticalTextAlignment.Justified;
+                                t.Justification = Justification.Justified;
+                                t.VerticalJustification = Justification.Justified;
                                 break;
                         }
                     }

+ 7 - 7
UICatalog/Scenarios/TextFormatterDemo.cs

@@ -63,17 +63,17 @@ public class TextFormatterDemo : Scenario
 
         app.Add (unicodeCheckBox);
 
-        List<TextAlignment> alignments = Enum.GetValues (typeof (TextAlignment)).Cast<TextAlignment> ().ToList ();
+        List<Justification> alignments = Enum.GetValues (typeof (Justification)).Cast<Justification> ().ToList ();
         Label [] singleLines = new Label [alignments.Count];
         Label [] multipleLines = new Label [alignments.Count];
 
         var multiLineHeight = 5;
 
-        foreach (TextAlignment alignment in alignments)
+        foreach (Justification alignment in alignments)
         {
             singleLines [(int)alignment] = new()
             {
-                TextAlignment = alignment,
+                Justification = alignment,
                 X = 0,
 
                 Width = Dim.Fill (),
@@ -84,7 +84,7 @@ public class TextFormatterDemo : Scenario
 
             multipleLines [(int)alignment] = new()
             {
-                TextAlignment = alignment,
+                Justification = alignment,
                 X = 0,
 
                 Width = Dim.Fill (),
@@ -100,7 +100,7 @@ public class TextFormatterDemo : Scenario
         };
         app.Add (label);
 
-        foreach (TextAlignment alignment in alignments)
+        foreach (Justification alignment in alignments)
         {
             label = new() { Y = Pos.Bottom (label), Text = $"{alignment}:" };
             app.Add (label);
@@ -112,7 +112,7 @@ public class TextFormatterDemo : Scenario
         label = new() { Y = Pos.Bottom (label), Text = "Demonstrating multi-line and word wrap:" };
         app.Add (label);
 
-        foreach (TextAlignment alignment in alignments)
+        foreach (Justification alignment in alignments)
         {
             label = new() { Y = Pos.Bottom (label), Text = $"{alignment}:" };
             app.Add (label);
@@ -123,7 +123,7 @@ public class TextFormatterDemo : Scenario
 
         unicodeCheckBox.Toggled += (s, e) =>
                                    {
-                                       foreach (TextAlignment alignment in alignments)
+                                       foreach (Justification alignment in alignments)
                                        {
                                            singleLines [(int)alignment].Text = e.OldValue == true ? text : unicode;
                                            multipleLines [(int)alignment].Text = e.OldValue == true ? text : unicode;

+ 6 - 6
UICatalog/Scenarios/TimeAndDate.cs

@@ -57,7 +57,7 @@ public class TimeAndDate : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (longDate) + 1,
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
 
             Width = Dim.Fill (),
             Text = "Old Time: "
@@ -68,7 +68,7 @@ public class TimeAndDate : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (_lblOldTime) + 1,
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
 
             Width = Dim.Fill (),
             Text = "New Time: "
@@ -79,7 +79,7 @@ public class TimeAndDate : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (_lblNewTime) + 1,
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
 
             Width = Dim.Fill (),
             Text = "Time Format: "
@@ -90,7 +90,7 @@ public class TimeAndDate : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (_lblTimeFmt) + 2,
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
 
             Width = Dim.Fill (),
             Text = "Old Date: "
@@ -101,7 +101,7 @@ public class TimeAndDate : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (_lblOldDate) + 1,
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
 
             Width = Dim.Fill (),
             Text = "New Date: "
@@ -112,7 +112,7 @@ public class TimeAndDate : Scenario
         {
             X = Pos.Center (),
             Y = Pos.Bottom (_lblNewDate) + 1,
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
 
             Width = Dim.Fill (),
             Text = "Date Format: "

+ 1 - 1
UICatalog/Scenarios/Unicode.cs

@@ -132,7 +132,7 @@ public class UnicodeInMenu : Scenario
 
             Width = Dim.Percent (50),
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = $"Align Right - {gitString}"
         };
         Win.Add (checkBox, checkBoxRight);

+ 5 - 5
UICatalog/Scenarios/ViewExperiments.cs

@@ -60,7 +60,7 @@ public class ViewExperiments : Scenario
             Width = 17,
             Title = "Window 1",
             Text = "Window #2",
-            TextAlignment = TextAlignment.Centered
+            Justification = Justification.Centered
         };
 
         window1.Margin.Thickness = new (0);
@@ -84,7 +84,7 @@ public class ViewExperiments : Scenario
             Width = 37,
             Title = "Window2",
             Text = "Window #2 (Right(window1)+1",
-            TextAlignment = TextAlignment.Centered
+            Justification = Justification.Centered
         };
 
         //view3.InitializeFrames ();
@@ -109,7 +109,7 @@ public class ViewExperiments : Scenario
             Width = 37,
             Title = "View4",
             Text = "View #4 (Right(window2)+1",
-            TextAlignment = TextAlignment.Centered
+            Justification = Justification.Centered
         };
 
         //view4.InitializeFrames ();
@@ -134,7 +134,7 @@ public class ViewExperiments : Scenario
             Width = Dim.Fill (),
             Title = "View5",
             Text = "View #5 (Right(view4)+1 Fill",
-            TextAlignment = TextAlignment.Centered
+            Justification = Justification.Centered
         };
 
         //view5.InitializeFrames ();
@@ -181,7 +181,7 @@ public class ViewExperiments : Scenario
             X = Pos.Center (),
             Y = Pos.Percent (50),
             Width = 30,
-            TextAlignment = TextAlignment.Centered
+            Justification = Justification.Centered
         };
         label50.Border.Thickness = new (1, 3, 1, 1);
         label50.Height = 5;

+ 4 - 4
UICatalog/Scenarios/Wizards.cs

@@ -21,7 +21,7 @@ public class Wizards : Scenario
         };
         Win.Add (frame);
 
-        var label = new Label { X = 0, Y = 0, TextAlignment = TextAlignment.Right, Text = "Width:" };
+        var label = new Label { X = 0, Y = 0, Justification = Justification.Right, Text = "Width:" };
         frame.Add (label);
 
         var widthEdit = new TextField
@@ -41,7 +41,7 @@ public class Wizards : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = "Height:"
         };
         frame.Add (label);
@@ -63,7 +63,7 @@ public class Wizards : Scenario
 
             Width = Dim.Width (label),
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Text = "Title:"
         };
         frame.Add (label);
@@ -88,7 +88,7 @@ public class Wizards : Scenario
 
         label = new()
         {
-            X = Pos.Center (), Y = Pos.AnchorEnd (1), TextAlignment = TextAlignment.Right, Text = "Action:"
+            X = Pos.Center (), Y = Pos.AnchorEnd (1), Justification = Justification.Right, Text = "Action:"
         };
         Win.Add (label);
 

文件差異過大導致無法顯示
+ 158 - 158
UnitTests/Text/TextFormatterTests.cs


+ 2 - 2
UnitTests/View/DrawTests.cs

@@ -339,7 +339,7 @@ public class DrawTests (ITestOutputHelper _output)
             Text = "Test",
             Width = 6,
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             ColorScheme = Colors.ColorSchemes ["Base"]
         };
 
@@ -350,7 +350,7 @@ public class DrawTests (ITestOutputHelper _output)
             Y = 1,
             Width = 1,
             Height = 6,
-            VerticalTextAlignment = VerticalTextAlignment.Bottom,
+            VerticalJustification = Justification.Bottom,
             ColorScheme = Colors.ColorSchemes ["Base"]
         };
         Toplevel top = new ();

+ 6 - 6
UnitTests/View/Layout/Dim.AutoTests.cs

@@ -681,11 +681,11 @@ public class DimAutoTests (ITestOutputHelper output)
         Assert.False (view.TextFormatter.AutoSize);
         Assert.Equal (Size.Empty, view.Frame.Size);
 
-        view.TextFormatter.Alignment = TextAlignment.Justified;
+        view.TextFormatter.Alignment = Justification.Justified;
         Assert.False (view.TextFormatter.AutoSize);
         Assert.Equal (Size.Empty, view.Frame.Size);
 
-        view.TextFormatter.VerticalAlignment = VerticalTextAlignment.Middle;
+        view.TextFormatter.VerticalAlignment = Justification.Centered;
         Assert.False (view.TextFormatter.AutoSize);
         Assert.Equal (Size.Empty, view.Frame.Size);
 
@@ -709,11 +709,11 @@ public class DimAutoTests (ITestOutputHelper output)
         Assert.False (view.TextFormatter.AutoSize);
         Assert.Equal (Size.Empty, view.Frame.Size);
 
-        view.TextAlignment = TextAlignment.Justified;
+        view.Justification = Justification.Justified;
         Assert.False (view.TextFormatter.AutoSize);
         Assert.Equal (Size.Empty, view.Frame.Size);
 
-        view.VerticalTextAlignment = VerticalTextAlignment.Middle;
+        view.VerticalJustification = Justification.Centered;
         Assert.False (view.TextFormatter.AutoSize);
         Assert.Equal (Size.Empty, view.Frame.Size);
 
@@ -738,7 +738,7 @@ public class DimAutoTests (ITestOutputHelper output)
         Assert.True (view.TextFormatter.AutoSize);
         Assert.NotEqual (Size.Empty, view.Frame.Size);
 
-        view.TextAlignment = TextAlignment.Justified;
+        view.Justification = Justification.Justified;
         Assert.True (view.TextFormatter.AutoSize);
         Assert.NotEqual (Size.Empty, view.Frame.Size);
 
@@ -747,7 +747,7 @@ public class DimAutoTests (ITestOutputHelper output)
             Text = "_1234",
             Width = Dim.Auto ()
         };
-        view.VerticalTextAlignment = VerticalTextAlignment.Middle;
+        view.VerticalJustification = Justification.Centered;
         Assert.True (view.TextFormatter.AutoSize);
         Assert.NotEqual (Size.Empty, view.Frame.Size);
 

+ 6 - 6
UnitTests/View/Text/AutoSizeTrueTests.cs

@@ -1811,7 +1811,7 @@ Y
             Y = 1,
             Width = width,
             Height = 1,
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
         };
 
         if (autoSize)
@@ -1826,7 +1826,7 @@ Y
             Y = 2,
             Width = width,
             Height = 1,
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
         };
         if (autoSize)
         {
@@ -1840,7 +1840,7 @@ Y
             Y = 3,
             Width = width,
             Height = 1,
-            TextAlignment = TextAlignment.Justified,
+            Justification = Justification.Justified,
         };
         if (autoSize)
         {
@@ -1937,7 +1937,7 @@ Y
             Width = 1,
             Height = height,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalTextAlignment = VerticalTextAlignment.Middle
+            Justification = Justification.Centered
         };
         if (autoSize)
         {
@@ -1952,7 +1952,7 @@ Y
             Width = 1,
             Height = height,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalTextAlignment = VerticalTextAlignment.Bottom
+            VerticalJustification = Justification.Bottom
         };
         if (autoSize)
         {
@@ -1967,7 +1967,7 @@ Y
             Width = 1,
             Height = height,
             TextDirection = TextDirection.TopBottom_LeftRight,
-            VerticalTextAlignment = VerticalTextAlignment.Justified
+            VerticalJustification = Justification.Justified
         };
         if (autoSize)
         {

+ 4 - 4
UnitTests/Views/ButtonTests.cs

@@ -155,14 +155,14 @@ public class ButtonTests (ITestOutputHelper output)
 
         Assert.Equal ($"{CM.Glyphs.LeftBracket}  {CM.Glyphs.RightBracket}", btn.TextFormatter.Text);
         Assert.False (btn.IsDefault);
-        Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
+        Assert.Equal (Justification.Centered, btn.Justification);
         Assert.Equal ('_', btn.HotKeySpecifier.Value);
         Assert.True (btn.CanFocus);
         Assert.Equal (new (0, 0, 4, 1), btn.Viewport);
         Assert.Equal (new (0, 0, 4, 1), btn.Frame);
         Assert.Equal ($"{CM.Glyphs.LeftBracket}  {CM.Glyphs.RightBracket}", btn.TextFormatter.Text);
         Assert.False (btn.IsDefault);
-        Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
+        Assert.Equal (Justification.Centered, btn.Justification);
         Assert.Equal ('_', btn.HotKeySpecifier.Value);
         Assert.True (btn.CanFocus);
         Assert.Equal (new (0, 0, 4, 1), btn.Viewport);
@@ -195,7 +195,7 @@ public class ButtonTests (ITestOutputHelper output)
                       btn.TextFormatter.Format ()
                      );
         Assert.True (btn.IsDefault);
-        Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
+        Assert.Equal (Justification.Centered, btn.Justification);
         Assert.True (btn.CanFocus);
 
         btn.SetRelativeLayout (new (100, 100));
@@ -222,7 +222,7 @@ public class ButtonTests (ITestOutputHelper output)
                       btn.TextFormatter.Format ()
                      );
         Assert.True (btn.IsDefault);
-        Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
+        Assert.Equal (Justification.Centered, btn.Justification);
         Assert.Equal ('_', btn.HotKeySpecifier.Value);
         Assert.True (btn.CanFocus);
 

+ 9 - 9
UnitTests/Views/CheckBoxTests.cs

@@ -251,7 +251,7 @@ public class CheckBoxTests
             X = 1,
             Y = Pos.Center (),
             Text = "Check this out 你",
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 25
         };
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill (), Title = "Test Demo 你" };
@@ -262,7 +262,7 @@ public class CheckBoxTests
         Application.Begin (top);
         ((FakeDriver)Application.Driver).SetBufferSize (30, 5);
 
-        Assert.Equal (TextAlignment.Centered, checkBox.TextAlignment);
+        Assert.Equal (Justification.Centered, checkBox.Justification);
         Assert.Equal (new (1, 1, 25, 1), checkBox.Frame);
         Assert.Equal (_size25x1, checkBox.TextFormatter.Size);
 
@@ -301,7 +301,7 @@ public class CheckBoxTests
             X = 1,
             Y = Pos.Center (),
             Text = "Check first out 你",
-            TextAlignment = TextAlignment.Justified,
+            Justification = Justification.Justified,
             Width = 25
         };
 
@@ -310,7 +310,7 @@ public class CheckBoxTests
             X = 1,
             Y = Pos.Bottom (checkBox1),
             Text = "Check second out 你",
-            TextAlignment = TextAlignment.Justified,
+            Justification = Justification.Justified,
             Width = 25
         };
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill (), Title = "Test Demo 你" };
@@ -321,9 +321,9 @@ public class CheckBoxTests
         Application.Begin (top);
         ((FakeDriver)Application.Driver).SetBufferSize (30, 6);
 
-        Assert.Equal (TextAlignment.Justified, checkBox1.TextAlignment);
+        Assert.Equal (Justification.Justified, checkBox1.Justification);
         Assert.Equal (new (1, 1, 25, 1), checkBox1.Frame);
-        Assert.Equal (TextAlignment.Justified, checkBox2.TextAlignment);
+        Assert.Equal (Justification.Justified, checkBox2.Justification);
         Assert.Equal (new (1, 2, 25, 1), checkBox2.Frame);
  
         var expected = @$"
@@ -378,7 +378,7 @@ public class CheckBoxTests
         Application.Begin (top);
         ((FakeDriver)Application.Driver).SetBufferSize (30, 5);
 
-        Assert.Equal (TextAlignment.Left, checkBox.TextAlignment);
+        Assert.Equal (Justification.Left, checkBox.Justification);
         Assert.Equal (new (1, 1, 25, 1), checkBox.Frame);
         Assert.Equal (_size25x1, checkBox.TextFormatter.Size);
 
@@ -417,7 +417,7 @@ public class CheckBoxTests
             X = 1,
             Y = Pos.Center (),
             Text = "Check this out 你",
-            TextAlignment = TextAlignment.Right,
+            Justification = Justification.Right,
             Width = 25
         };
         var win = new Window { Width = Dim.Fill (), Height = Dim.Fill (), Title = "Test Demo 你" };
@@ -428,7 +428,7 @@ public class CheckBoxTests
         Application.Begin (top);
         ((FakeDriver)Application.Driver).SetBufferSize (30, 5);
 
-        Assert.Equal (TextAlignment.Right, checkBox.TextAlignment);
+        Assert.Equal (Justification.Right, checkBox.Justification);
         Assert.Equal (new (1, 1, 25, 1), checkBox.Frame);
         Assert.Equal (_size25x1, checkBox.TextFormatter.Size);
 

+ 1 - 1
UnitTests/Views/LabelTests.cs

@@ -206,7 +206,7 @@ public class LabelTests
     {
         var label = new Label ();
         Assert.Equal (string.Empty, label.Text);
-        Assert.Equal (TextAlignment.Left, label.TextAlignment);
+        Assert.Equal (Justification.Left, label.Justification);
         Assert.False (label.CanFocus);
         Assert.Equal (new Rectangle (0, 0, 0, 0), label.Frame);
         Assert.Equal (KeyCode.Null, label.HotKey);

+ 20 - 20
UnitTests/Views/TextValidateFieldTests.cs

@@ -10,7 +10,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
 
             //                                             ****
@@ -44,7 +44,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Left,
+            Justification = Justification.Left,
             Width = 30,
 
             //                                             ****
@@ -81,7 +81,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
 
             //                                             ****
@@ -115,7 +115,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
 
             //                                             *
@@ -137,7 +137,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
 
             //                                             *
@@ -161,7 +161,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
 
             //                                             ****
@@ -179,7 +179,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
 
             //                                             ****
@@ -196,7 +196,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
 
             //                                             ****
@@ -214,7 +214,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
 
             //                                             *
@@ -233,7 +233,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
 
             //                                             *
@@ -253,7 +253,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
 
             //                                             ** **
@@ -283,7 +283,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
 
             //                                             *
@@ -308,7 +308,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Left,
+            Justification = Justification.Left,
             Width = 30,
 
             //                                             ****
@@ -338,7 +338,7 @@ public class TextValidateField_NET_Provider_Tests
 
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Left, Width = 30, Provider = new NetMaskedTextProvider ("--(0000)--")
+            Justification = Justification.Left, Width = 30, Provider = new NetMaskedTextProvider ("--(0000)--")
         };
 
         field.Provider.TextChanged += (sender, e) => wasTextChanged = true;
@@ -356,7 +356,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
 
             //                                             *
@@ -381,7 +381,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Left,
+            Justification = Justification.Left,
             Width = 30,
 
             //                                             ****
@@ -400,7 +400,7 @@ public class TextValidateField_NET_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
 
             //                                             ****
@@ -540,7 +540,7 @@ public class TextValidateField_Regex_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
             Provider = new TextRegexProvider ("^[0-9][0-9][0-9]$") { ValidateOnInput = false }
         };
@@ -596,7 +596,7 @@ public class TextValidateField_Regex_Provider_Tests
 
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
             Provider = new TextRegexProvider ("^[0-9][0-9][0-9]$") { ValidateOnInput = false }
         };
@@ -616,7 +616,7 @@ public class TextValidateField_Regex_Provider_Tests
     {
         var field = new TextValidateField
         {
-            TextAlignment = TextAlignment.Centered,
+            Justification = Justification.Centered,
             Width = 20,
             Provider = new TextRegexProvider ("^[0-9][0-9][0-9]$") { ValidateOnInput = false }
         };

+ 2 - 2
UnitTests/Views/ToplevelTests.cs

@@ -1482,8 +1482,8 @@ public class ToplevelTests
                         Y = Pos.Center (),
                         Width = Dim.Fill (),
                         Height = Dim.Fill (),
-                        TextAlignment = TextAlignment.Centered,
-                        VerticalTextAlignment = VerticalTextAlignment.Middle,
+                        Justification = Justification.Centered,
+                        VerticalJustification = Justification.Centered,
                         Text = "Test"
                     }
                    );

部分文件因文件數量過多而無法顯示