浏览代码

More prototyping 2

Tig 9 月之前
父节点
当前提交
f5ddf6b584

+ 1 - 1
Terminal.Gui/Application/Application.Run.cs

@@ -514,7 +514,7 @@ public static partial class Application // Run (Begin, Run, End, Stop)
         {
         {
             if (clear)
             if (clear)
             {
             {
-                tl.SetNeedsDisplay();
+                tl.SetNeedsDisplay(Screen);
             }
             }
             tl.Draw ();
             tl.Draw ();
         }
         }

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

@@ -220,7 +220,7 @@ public partial class View // Drawing APIs
 
 
         if (IsLayoutNeeded ())
         if (IsLayoutNeeded ())
         {
         {
-            Debug.WriteLine ($"Layout should be de-coupled from drawing: {this}");
+            //Debug.WriteLine ($"Layout should be de-coupled from drawing: {this}");
         }
         }
 
 
         //// TODO: This ensures overlapped views are drawn correctly. However, this is inefficient.
         //// TODO: This ensures overlapped views are drawn correctly. However, this is inefficient.
@@ -573,7 +573,7 @@ public partial class View // Drawing APIs
             {
             {
                 if (view.IsLayoutNeeded ())
                 if (view.IsLayoutNeeded ())
                 {
                 {
-                    Debug.WriteLine ($"Layout should be de-coupled from drawing: {view}");
+                    //Debug.WriteLine ($"Layout should be de-coupled from drawing: {view}");
                     //view.LayoutSubviews ();
                     //view.LayoutSubviews ();
                 }
                 }
 
 

+ 0 - 8
Terminal.Gui/View/View.Hierarchy.cs

@@ -85,15 +85,7 @@ public partial class View // SuperView/SubView hierarchy management (SuperView,
             view.EndInit ();
             view.EndInit ();
         }
         }
 
 
-
         SetLayoutNeeded();
         SetLayoutNeeded();
-        //CheckDimAuto ();
-       // view.SetRelativeLayout(Application.Screen.Size);
-
-        //if (view.Visible)
-        //{
-        //    SetNeedsDisplay();
-        //};
 
 
         return view;
         return view;
     }
     }

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

@@ -657,7 +657,7 @@ public partial class View // Layout APIs
                 SetTitleTextFormatterSize ();
                 SetTitleTextFormatterSize ();
             }
             }
 
 
-            SetNeedsDisplay ();
+            //SetNeedsDisplay ();
             SuperView?.SetNeedsDisplay ();
             SuperView?.SetNeedsDisplay ();
         }
         }
 
 
@@ -821,6 +821,10 @@ public partial class View // Layout APIs
             if (!current.IsLayoutNeeded ())
             if (!current.IsLayoutNeeded ())
             {
             {
                 current._layoutNeeded = true;
                 current._layoutNeeded = true;
+                current.Margin?.SetLayoutNeeded ();
+                current.Border?.SetLayoutNeeded ();
+                current.Padding?.SetLayoutNeeded ();
+
                 foreach (View subview in current.Subviews)
                 foreach (View subview in current.Subviews)
                 {
                 {
                     stack.Push (subview);
                     stack.Push (subview);

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

@@ -229,6 +229,7 @@ public partial class View : Responder, ISupportInitializeNotification
         // These calls were moved from BeginInit as they access Viewport which is indeterminate until EndInit is called.
         // These calls were moved from BeginInit as they access Viewport which is indeterminate until EndInit is called.
         UpdateTextDirection (TextDirection);
         UpdateTextDirection (TextDirection);
         UpdateTextFormatterText ();
         UpdateTextFormatterText ();
+
         SetLayoutNeeded ();
         SetLayoutNeeded ();
 
 
         if (_subviews is { })
         if (_subviews is { })
@@ -242,6 +243,9 @@ public partial class View : Responder, ISupportInitializeNotification
             }
             }
         }
         }
 
 
+        // TOOD: Figure out how to move this out of here and just depend on IsLayoutNeeded in Mainloop
+        LayoutSubviews();
+
         Initialized?.Invoke (this, EventArgs.Empty);
         Initialized?.Invoke (this, EventArgs.Empty);
     }
     }
 
 

+ 1 - 2
Terminal.Gui/Views/Bar.cs

@@ -82,7 +82,6 @@ public class Bar : View, IOrientation, IDesignable
     {
     {
         base.EndInit ();
         base.EndInit ();
         ColorScheme = Colors.ColorSchemes ["Menu"];
         ColorScheme = Colors.ColorSchemes ["Menu"];
-        LayoutBarItems (GetContentSize ());
     }
     }
 
 
     /// <inheritdoc/>
     /// <inheritdoc/>
@@ -121,7 +120,7 @@ public class Bar : View, IOrientation, IDesignable
     /// <param name="newOrientation"></param>
     /// <param name="newOrientation"></param>
     public void OnOrientationChanged (Orientation newOrientation)
     public void OnOrientationChanged (Orientation newOrientation)
     {
     {
-        SetLayoutNeeded ();
+        LayoutBarItems (SuperView?.GetContentSize() ?? Application.Screen.Size);
     }
     }
     #endregion
     #endregion
 
 

+ 2 - 3
UICatalog/Scenarios/AllViewsTester.cs

@@ -384,7 +384,6 @@ public class AllViewsTester : Scenario
 
 
         _curView = view;
         _curView = view;
         _hostPane.Add (_curView);
         _hostPane.Add (_curView);
-       // Application.Refresh();
     }
     }
 
 
     private void DisposeCurrentView ()
     private void DisposeCurrentView ()
@@ -558,12 +557,12 @@ public class AllViewsTester : Scenario
             return;
             return;
         }
         }
 
 
-        if (!view.Width!.Has<DimAuto> (out _) || (view.Width is null || view.Frame.Width == 0))
+        if (!view.Width!.Has<DimAuto> (out _) || (view.Width is null))
         {
         {
             view.Width = Dim.Fill ();
             view.Width = Dim.Fill ();
         }
         }
 
 
-        if (!view.Height!.Has<DimAuto> (out _) || (view.Height is null || view.Frame.Height == 0))
+        if (!view.Height!.Has<DimAuto> (out _) || (view.Height is null))
         {
         {
             view.Height = Dim.Fill ();
             view.Height = Dim.Fill ();
         }
         }