Browse Source

Fixed FastFlags thing

Tig 1 year ago
parent
commit
f08f9c9567

+ 1 - 1
Terminal.Gui/View/Adornment/Adornment.cs

@@ -242,7 +242,7 @@ public class Adornment : View
         return base.OnMouseEnter (mouseEvent);
         return base.OnMouseEnter (mouseEvent);
     }
     }
 
 
-    /// <inheritdoc/>
+    /// <inheritdoc/>   
     protected internal override bool OnMouseLeave (MouseEvent mouseEvent)
     protected internal override bool OnMouseLeave (MouseEvent mouseEvent)
     {
     {
         // Invert Normal
         // Invert Normal

+ 1 - 5
Terminal.Gui/View/Layout/Dim.cs

@@ -150,11 +150,7 @@ public abstract class Dim
     /// <summary>Creates a percentage <see cref="Dim"/> object that is a percentage of the width or height of the SuperView.</summary>
     /// <summary>Creates a percentage <see cref="Dim"/> object that is a percentage of the width or height of the SuperView.</summary>
     /// <returns>The percent <see cref="Dim"/> object.</returns>
     /// <returns>The percent <see cref="Dim"/> object.</returns>
     /// <param name="percent">A value between 0 and 100 representing the percentage.</param>
     /// <param name="percent">A value between 0 and 100 representing the percentage.</param>
-    /// <param name="usePosition">
-    ///     If <see langword="true"/> the dimension is computed using the View's position (<see cref="View.X"/> or
-    ///     <see cref="View.Y"/>).
-    ///     If <see langword="false"/> the dimension is computed using the View's <see cref="View.ContentSize"/>.
-    /// </param>
+    /// <param name="mode"></param>
     /// <example>
     /// <example>
     ///     This initializes a <see cref="TextField"/> that will be centered horizontally, is 50% of the way down, is 30% the
     ///     This initializes a <see cref="TextField"/> that will be centered horizontally, is 50% of the way down, is 30% the
     ///     height,
     ///     height,

+ 3 - 3
Terminal.Gui/View/Layout/DimAuto.cs

@@ -60,13 +60,13 @@ public class DimAuto () : Dim
         var subviewsSize = 0;
         var subviewsSize = 0;
 
 
         int autoMin = MinimumContentDim?.GetAnchor (superviewContentSize) ?? 0;
         int autoMin = MinimumContentDim?.GetAnchor (superviewContentSize) ?? 0;
-
-        if (Style.HasFlag (DimAutoStyle.Text))
+        
+        if (Style.FastHasFlags (DimAutoStyle.Text))
         {
         {
             textSize = int.Max (autoMin, dimension == Dimension.Width ? us.TextFormatter.Size.Width : us.TextFormatter.Size.Height);
             textSize = int.Max (autoMin, dimension == Dimension.Width ? us.TextFormatter.Size.Width : us.TextFormatter.Size.Height);
         }
         }
 
 
-        if (Style.HasFlag (DimAutoStyle.Content))
+        if (Style.FastHasFlags (DimAutoStyle.Content))
         {
         {
             if (us._contentSize is { })
             if (us._contentSize is { })
             {
             {

+ 1 - 1
Terminal.Gui/View/Layout/DimAutoStyle.cs

@@ -5,8 +5,8 @@ namespace Terminal.Gui;
 /// <summary>
 /// <summary>
 ///     Specifies how <see cref="Dim.Auto"/> will compute the dimension.
 ///     Specifies how <see cref="Dim.Auto"/> will compute the dimension.
 /// </summary>
 /// </summary>
-[GenerateEnumExtensionMethods]
 [Flags]
 [Flags]
+[GenerateEnumExtensionMethods (FastHasFlags = true)]
 public enum DimAutoStyle
 public enum DimAutoStyle
 {
 {
     /// <summary>
     /// <summary>

+ 2 - 2
Terminal.Gui/View/Layout/ViewLayout.cs

@@ -1049,13 +1049,13 @@ public partial class View
         // Verify none of the subviews are using Dim objects that depend on the SuperView's dimensions.
         // Verify none of the subviews are using Dim objects that depend on the SuperView's dimensions.
         foreach (View view in Subviews)
         foreach (View view in Subviews)
         {
         {
-            if (widthAuto is { } && widthAuto.Style.HasFlag (DimAutoStyle.Content) && _contentSize is null)
+            if (widthAuto is { } && widthAuto.Style.FastHasFlags (DimAutoStyle.Content) && _contentSize is null)
             {
             {
                 ThrowInvalid (view, view.Width, nameof (view.Width));
                 ThrowInvalid (view, view.Width, nameof (view.Width));
                 ThrowInvalid (view, view.X, nameof (view.X));
                 ThrowInvalid (view, view.X, nameof (view.X));
             }
             }
 
 
-            if (heightAuto is { } && heightAuto.Style.HasFlag (DimAutoStyle.Content) && _contentSize is null)
+            if (heightAuto is { } && heightAuto.Style.FastHasFlags (DimAutoStyle.Content) && _contentSize is null)
             {
             {
                 ThrowInvalid (view, view.Height, nameof (view.Height));
                 ThrowInvalid (view, view.Height, nameof (view.Height));
                 ThrowInvalid (view, view.Y, nameof (view.Y));
                 ThrowInvalid (view, view.Y, nameof (view.Y));

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

@@ -186,17 +186,17 @@ public partial class View
         // Use _width & _height instead of Width & Height to avoid debug spew
         // Use _width & _height instead of Width & Height to avoid debug spew
         DimAuto widthAuto = _width as DimAuto;
         DimAuto widthAuto = _width as DimAuto;
         DimAuto heightAuto = _height as DimAuto;
         DimAuto heightAuto = _height as DimAuto;
-        if ((widthAuto is { } && widthAuto.Style.HasFlag (DimAutoStyle.Text))
-            || (heightAuto is { } && heightAuto.Style.HasFlag (DimAutoStyle.Text)))
+        if ((widthAuto is { } && widthAuto.Style.FastHasFlags (DimAutoStyle.Text))
+            || (heightAuto is { } && heightAuto.Style.FastHasFlags (DimAutoStyle.Text)))
         {
         {
             size = TextFormatter.GetAutoSize ();
             size = TextFormatter.GetAutoSize ();
 
 
-            if (widthAuto is null || !widthAuto.Style.HasFlag (DimAutoStyle.Text))
+            if (widthAuto is null || !widthAuto.Style.FastHasFlags (DimAutoStyle.Text))
             {
             {
                 size.Width = ContentSize.Width;
                 size.Width = ContentSize.Width;
             }
             }
 
 
-            if (heightAuto is null || !heightAuto.Style.HasFlag (DimAutoStyle.Text))
+            if (heightAuto is null || !heightAuto.Style.FastHasFlags (DimAutoStyle.Text))
             {
             {
                 size.Height = ContentSize.Height;
                 size.Height = ContentSize.Height;
             }
             }

+ 0 - 2
Terminal.Gui/Views/Dialog.cs

@@ -43,8 +43,6 @@ public class Dialog : Window
     //};
     //};
     private readonly List<Button> _buttons = new ();
     private readonly List<Button> _buttons = new ();
 
 
-    private bool _inLayout;
-
     /// <summary>
     /// <summary>
     ///     Initializes a new instance of the <see cref="Dialog"/> class using <see cref="LayoutStyle.Computed"/>
     ///     Initializes a new instance of the <see cref="Dialog"/> class using <see cref="LayoutStyle.Computed"/>
     ///     positioning with no <see cref="Button"/>s.
     ///     positioning with no <see cref="Button"/>s.

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

@@ -411,7 +411,7 @@ public class TileView : View
     ///         <see cref="Tile.MinSize"/>, location of other splitters etc.
     ///         <see cref="Tile.MinSize"/>, location of other splitters etc.
     ///     </para>
     ///     </para>
     ///     <para>
     ///     <para>
-    ///         Only absolute values (e.g. 10) and percent values (i.e. <see cref="Pos.Percent(float)"/>) are supported for
+    ///         Only absolute values (e.g. 10) and percent values (i.e. <see cref="Pos.Percent(int)"/>) are supported for
     ///         this property.
     ///         this property.
     ///     </para>
     ///     </para>
     /// </summary>
     /// </summary>