Tig преди 1 година
родител
ревизия
7733a69e8a
променени са 4 файла, в които са добавени 3 реда и са изтрити 25 реда
  1. 0 1
      Terminal.Gui/Text/TextFormatter.cs
  2. 3 18
      Terminal.Gui/View/Layout/DimAuto.cs
  3. 0 1
      Terminal.Gui/View/Layout/ViewLayout.cs
  4. 0 5
      Terminal.Gui/Views/Bar.cs

+ 0 - 1
Terminal.Gui/Text/TextFormatter.cs

@@ -516,7 +516,6 @@ public class TextFormatter
             return System.Drawing.Size.Empty;
         }
 
-        // HACK: This is a total hack to work around the fact that TextFormatter.Format does not match TextFormatter.Draw.
         int? prevWidth = _width;
         int? prevHeight = _height;
 

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

@@ -356,6 +356,7 @@ public class DimAuto : Dim
                     View v = anchoredSubViews [i];
 
                     // Need to set the relative layout for PosAnchorEnd subviews to calculate the size
+                    // TODO: Figure out a way to not have Calculate change the state of subviews (calling SRL).
                     if (dimension == Dimension.Width)
                     {
                         v.SetRelativeLayout (new (maxCalculatedSize, screenX4));
@@ -393,6 +394,7 @@ public class DimAuto : Dim
                     View v = posViewSubViews [i];
 
                     // BUGBUG: The order may not be correct. May need to call TopologicalSort?
+                    // TODO: Figure out a way to not have Calculate change the state of subviews (calling SRL).
                     if (dimension == Dimension.Width)
                     {
                         v.SetRelativeLayout (new (maxCalculatedSize, 0));
@@ -433,6 +435,7 @@ public class DimAuto : Dim
                     View v = dimViewSubViews [i];
 
                     // BUGBUG: The order may not be correct. May need to call TopologicalSort?
+                    // TODO: Figure out a way to not have Calculate change the state of subviews (calling SRL).
                     if (dimension == Dimension.Width)
                     {
                         v.SetRelativeLayout (new (maxCalculatedSize, 0));
@@ -464,24 +467,6 @@ public class DimAuto : Dim
         // And, if max: is set, it wins if smaller
         max = int.Min (max, autoMax);
 
-        // ************** We now definitively know `us.ContentSize` ***************
-
-        int oppositeScreen = dimension == Dimension.Width ? Application.Screen.Height * 4 : Application.Screen.Width * 4;
-
-        // TODO: Double-check that we really do need to SetRelativeLayout on these views!
-        foreach (View v in viewsNeedingLayout)
-        {
-            if (dimension == Dimension.Width)
-            {
-                v.SetRelativeLayout (new (max, oppositeScreen));
-            }
-            else
-            {
-                v.SetRelativeLayout (new (oppositeScreen, max));
-            }
-        }
-
-        // Factor in adornments
         Thickness thickness = us.GetAdornmentsThickness ();
 
         int adornmentThickness = dimension switch

+ 0 - 1
Terminal.Gui/View/Layout/ViewLayout.cs

@@ -282,7 +282,6 @@ public partial class View
             _width = _frame.Width;
             _height = _frame.Height;
 
-            // TODO: Figure out if the below can be optimized.
             if (IsInitialized)
             {
                 OnResizeNeeded ();

+ 0 - 5
Terminal.Gui/Views/Bar.cs

@@ -153,9 +153,6 @@ public class Bar : View
                     barItem.ColorScheme = ColorScheme;
                     barItem.X = Pos.Align (Alignment.Start, AlignmentModes);
                     barItem.Y = 0; //Pos.Center ();
-
-                    // HACK: This should not be needed
-                    barItem.SetRelativeLayout (GetContentSize ());
                 }
 
                 break;
@@ -190,8 +187,6 @@ public class Bar : View
                     if (barItem is Shortcut scBarItem)
                     {
                         scBarItem.MinimumKeyTextSize = minKeyWidth;
-                        // HACK: This should not be needed
-                        scBarItem.SetRelativeLayout (GetContentSize ());
                         maxBarItemWidth = Math.Max (maxBarItemWidth, scBarItem.Frame.Width);
                     }