Browse Source

Reverted temp changes to Scenario

Tig 1 year ago
parent
commit
5d7fe4cd8f
2 changed files with 64 additions and 64 deletions
  1. 2 0
      Terminal.Gui/Views/TileView.cs
  2. 62 64
      UICatalog/Scenarios/VirtualContentScrolling.cs

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

@@ -183,6 +183,8 @@ public class TileView : View
     {
         Driver.SetAttribute (ColorScheme.Normal);
 
+        ClearVisibleContent();
+
         base.OnDrawContent (viewport);
 
         var lc = new LineCanvas ();

+ 62 - 64
UICatalog/Scenarios/VirtualContentScrolling.cs

@@ -19,7 +19,7 @@ public class VirtualScrolling : Scenario
             Text = "Virtual Demo View Text. This is long text.\nThe second line.\n3\n4\n5th line\nLine 6. This is a longer line. fklasjf laspi fiolasjf liasdj flpasfjklas.";
             CanFocus = true;
             Arrangement = ViewArrangement.Movable;
-            ColorScheme = Colors.ColorSchemes ["Error"];
+            ColorScheme = Colors.ColorSchemes ["Toplevel"];
             BorderStyle = LineStyle.None;
 
             // TODO: Add a way to set the scroll settings in the Scenario
@@ -102,66 +102,66 @@ public class VirtualScrolling : Scenario
 
         var view = new VirtualDemoView { Title = "Virtual Scrolling" };
 
-       // var tf1 = new TextField { X = 20, Y = 7, Width = 10, Text = "TextField" };
-        //var color = new ColorPicker { Title = "BG", BoxHeight = 1, BoxWidth = 1, X = Pos.AnchorEnd (11) };
-        //color.BorderStyle = LineStyle.RoundedDotted;
-
-        //color.ColorChanged += (s, e) =>
-        //                      {
-        //                          color.SuperView.ColorScheme = new (color.SuperView.ColorScheme)
-        //                          {
-        //                              Normal = new (
-        //                                            color.SuperView.ColorScheme.Normal.Foreground,
-        //                                            e.Color
-        //                                           )
-        //                          };
-        //                      };
-
-        //var button = new Button { X = Pos.Center (), Y = Pos.Center (), Text = "Centered Button" };
-
-        //button.Accept += (s, e) =>
-        //                     MessageBox.Query (20, 7, "Hi", $"Am I a {view.GetType ().Name}?", "Yes", "No");
-
-        //var label = new TextView
-        //{
-        //    X = Pos.Center (),
-        //    Y = 10,
-        //    Title = "Title",
-        //    Text = "I have a 3 row top border.\nMy border inherits from the SuperView.",
-        //    AllowsTab = false,
-        //    Width = 42,
-        //    Height = 6 // TODO: Use Dim.Auto
-        //};
-        //label.Border.Thickness = new (1, 3, 1, 1);
-
-        //var btnButtonInWindow = new Button { X = Pos.AnchorEnd (10), Y = Pos.AnchorEnd (1), Text = "Button" };
-
-        //var tv = new Label
-        //{
-        //    AutoSize = false,
-        //    Y = Pos.AnchorEnd (3),
-        //    Width = 25,
-        //    Height = Dim.Fill (),
-        //    Text = "Label\nY=AnchorEnd(3),Height=Dim.Fill()"
-        //};
-
-        //view.Margin.Data = "Margin";
-        //view.Margin.Thickness = new (0);
-
-        //view.Border.Data = "Border";
-        //view.Border.Thickness = new (3);
-
-        //view.Padding.Data = "Padding";
-        //view.Padding.Thickness = new (3);
-
-        //view.Add (tf1, color, button, label, btnButtonInWindow, tv);
-        //var label = new Label
-        //{
-        //    X = 0,
-        //    Y = 10,
-        //    Text = "This is a virtual scrolling demo. Use the arrow keys to scroll the content."
-        //};
-        //view.Add (label);
+        var tf1 = new TextField { X = 20, Y = 7, Width = 10, Text = "TextField" };
+        var color = new ColorPicker { Title = "BG", BoxHeight = 1, BoxWidth = 1, X = Pos.AnchorEnd (11) };
+        color.BorderStyle = LineStyle.RoundedDotted;
+
+        color.ColorChanged += (s, e) =>
+                              {
+                                  color.SuperView.ColorScheme = new (color.SuperView.ColorScheme)
+                                  {
+                                      Normal = new (
+                                                    color.SuperView.ColorScheme.Normal.Foreground,
+                                                    e.Color
+                                                   )
+                                  };
+                              };
+
+        var button = new Button { X = Pos.Center (), Y = Pos.Center (), Text = "Centered Button" };
+
+        button.Accept += (s, e) =>
+                             MessageBox.Query (20, 7, "Hi", $"Am I a {view.GetType ().Name}?", "Yes", "No");
+
+        var label = new TextView
+        {
+            X = Pos.Center (),
+            Y = 10,
+            Title = "Title",
+            Text = "I have a 3 row top border.\nMy border inherits from the SuperView.",
+            AllowsTab = false,
+            Width = 42,
+            Height = 6 // TODO: Use Dim.Auto
+        };
+        label.Border.Thickness = new (1, 3, 1, 1);
+
+        var btnButtonInWindow = new Button { X = Pos.AnchorEnd (10), Y = Pos.AnchorEnd (1), Text = "Button" };
+
+        var tv = new Label
+        {
+            AutoSize = false,
+            Y = Pos.AnchorEnd (3),
+            Width = 25,
+            Height = Dim.Fill (),
+            Text = "Label\nY=AnchorEnd(3),Height=Dim.Fill()"
+        };
+
+        view.Margin.Data = "Margin";
+        view.Margin.Thickness = new (0);
+
+        view.Border.Data = "Border";
+        view.Border.Thickness = new (3);
+
+        view.Padding.Data = "Padding";
+        view.Padding.Thickness = new (3);
+
+        view.Add (tf1, color, button, label, btnButtonInWindow, tv);
+        var label2 = new Label
+        {
+            X = 0,
+            Y = 10,
+            Text = "This is a virtual scrolling demo. Use the arrow keys and/or mouse wheel to scroll the content."
+        };
+        view.Add (label2);
 
         var editor = new Adornments.AdornmentsEditor
         {
@@ -177,9 +177,7 @@ public class VirtualScrolling : Scenario
 
         //button.SetFocus ();
 
-        view.Width = Dim.Fill ();
-        view.Height = Dim.Fill ();
-        Application.Run (view);
+        Application.Run (editor);
         editor.Dispose ();
         Application.Shutdown ();
     }