浏览代码

Fix merge errors.

BDisp 1 年之前
父节点
当前提交
4e57840dce
共有 2 个文件被更改,包括 14 次插入14 次删除
  1. 11 11
      Terminal.Gui/Views/Scroll.cs
  2. 3 3
      UICatalog/Scenarios/ScrollDemo.cs

+ 11 - 11
Terminal.Gui/Views/Scroll.cs

@@ -60,7 +60,7 @@ public class Scroll : View
         get => _position;
         get => _position;
         set
         set
         {
         {
-            int barSize = Orientation == Orientation.Vertical ? ContentSize.Height : ContentSize.Width;
+            int barSize = Orientation == Orientation.Vertical ? GetContentSize ().Height : GetContentSize ().Width;
 
 
             if (value < 0 || (value > 0 && value + barSize > Size))
             if (value < 0 || (value > 0 && value + barSize > Size))
             {
             {
@@ -128,12 +128,12 @@ public class Scroll : View
 
 
     private int GetPositionFromSliderLocation (int location)
     private int GetPositionFromSliderLocation (int location)
     {
     {
-        if (ContentSize.Height == 0 || ContentSize.Width == 0)
+        if (GetContentSize ().Height == 0 || GetContentSize ().Width == 0)
         {
         {
             return 0;
             return 0;
         }
         }
 
 
-        int scrollSize = Orientation == Orientation.Vertical ? ContentSize.Height : ContentSize.Width;
+        int scrollSize = Orientation == Orientation.Vertical ? GetContentSize ().Height : GetContentSize ().Width;
 
 
         // Ensure the Position is valid if the slider is at end
         // Ensure the Position is valid if the slider is at end
         // We use Frame here instead of ContentSize because even if the slider has a margin or border, Frame indicates the actual size
         // We use Frame here instead of ContentSize because even if the slider has a margin or border, Frame indicates the actual size
@@ -149,12 +149,12 @@ public class Scroll : View
     // QUESTION: This method is only called from one place. Should it be inlined? Or, should it be made internal and unit tests be provided?
     // QUESTION: This method is only called from one place. Should it be inlined? Or, should it be made internal and unit tests be provided?
     private (int Location, int Dimension) GetSliderLocationDimensionFromPosition ()
     private (int Location, int Dimension) GetSliderLocationDimensionFromPosition ()
     {
     {
-        if (ContentSize.Height == 0 || ContentSize.Width == 0)
+        if (GetContentSize ().Height == 0 || GetContentSize ().Width == 0)
         {
         {
             return new (0, 0);
             return new (0, 0);
         }
         }
 
 
-        int scrollSize = Orientation == Orientation.Vertical ? ContentSize.Height : ContentSize.Width;
+        int scrollSize = Orientation == Orientation.Vertical ? GetContentSize ().Height : GetContentSize ().Width;
         int location;
         int location;
         int dimension;
         int dimension;
 
 
@@ -228,7 +228,7 @@ public class Scroll : View
     {
     {
         MouseEvent me = e.MouseEvent;
         MouseEvent me = e.MouseEvent;
         int location = Orientation == Orientation.Vertical ? me.Position.Y : me.Position.X;
         int location = Orientation == Orientation.Vertical ? me.Position.Y : me.Position.X;
-        int barSize = Orientation == Orientation.Vertical ? ContentSize.Height : ContentSize.Width;
+        int barSize = Orientation == Orientation.Vertical ? GetContentSize ().Height : GetContentSize ().Width;
 
 
         (int topLeft, int bottomRight) sliderPos = _orientation == Orientation.Vertical
         (int topLeft, int bottomRight) sliderPos = _orientation == Orientation.Vertical
                                                        ? new (_slider.Frame.Y, _slider.Frame.Bottom - 1)
                                                        ? new (_slider.Frame.Y, _slider.Frame.Bottom - 1)
@@ -292,13 +292,13 @@ public class Scroll : View
         Text = string.Concat (
         Text = string.Concat (
                               Enumerable.Repeat (
                               Enumerable.Repeat (
                                                  Glyphs.Stipple.ToString (),
                                                  Glyphs.Stipple.ToString (),
-                                                 ContentSize.Width * ContentSize.Height));
+                                                 GetContentSize ().Width * GetContentSize ().Height));
         _slider.TextDirection = Orientation == Orientation.Vertical ? TextDirection.TopBottom_LeftRight : TextDirection.LeftRight_TopBottom;
         _slider.TextDirection = Orientation == Orientation.Vertical ? TextDirection.TopBottom_LeftRight : TextDirection.LeftRight_TopBottom;
 
 
         _slider.Text = string.Concat (
         _slider.Text = string.Concat (
                                       Enumerable.Repeat (
                                       Enumerable.Repeat (
                                                          Glyphs.ContinuousMeterSegment.ToString (),
                                                          Glyphs.ContinuousMeterSegment.ToString (),
-                                                         _slider.ContentSize.Width * _slider.ContentSize.Height));
+                                                         _slider.GetContentSize ().Width * _slider.GetContentSize ().Height));
     }
     }
 
 
     private void AdjustSlider ()
     private void AdjustSlider ()
@@ -314,8 +314,8 @@ public class Scroll : View
 
 
         _slider.SetContentSize (
         _slider.SetContentSize (
                                 new (
                                 new (
-                                     Orientation == Orientation.Vertical ? ContentSize.Width : slider.Dimension,
-                                     Orientation == Orientation.Vertical ? slider.Dimension : ContentSize.Height
+                                     Orientation == Orientation.Vertical ? GetContentSize ().Width : slider.Dimension,
+                                     Orientation == Orientation.Vertical ? slider.Dimension : GetContentSize ().Height
                                     ));
                                     ));
         SetSliderText ();
         SetSliderText ();
     }
     }
@@ -327,7 +327,7 @@ public class Scroll : View
     {
     {
         MouseEvent me = e.MouseEvent;
         MouseEvent me = e.MouseEvent;
         int location = Orientation == Orientation.Vertical ? me.Position.Y : me.Position.X;
         int location = Orientation == Orientation.Vertical ? me.Position.Y : me.Position.X;
-        int barSize = Orientation == Orientation.Vertical ? ContentSize.Height : ContentSize.Width;
+        int barSize = Orientation == Orientation.Vertical ? GetContentSize ().Height : GetContentSize ().Width;
         int offset = _lastLocation > -1 ? location - _lastLocation : 0;
         int offset = _lastLocation > -1 ? location - _lastLocation : 0;
 
 
         if (me.Flags == MouseFlags.Button1Pressed)
         if (me.Flags == MouseFlags.Button1Pressed)

+ 3 - 3
UICatalog/Scenarios/ScrollDemo.cs

@@ -20,7 +20,7 @@ public class ScrollDemo : Scenario
             Title = $"{Application.QuitKey} to Quit - Scenario: {GetName ()}"
             Title = $"{Application.QuitKey} to Quit - Scenario: {GetName ()}"
         };
         };
 
 
-        var editor = new Adornments.AdornmentsEditor ();
+        var editor = new AdornmentsEditor ();
         app.Add (editor);
         app.Add (editor);
 
 
         var view = new FrameView
         var view = new FrameView
@@ -232,12 +232,12 @@ public class ScrollDemo : Scenario
                                  {
                                  {
                                      lblScrollFrame.Text = $"Scroll Frame: {scroll.Frame.ToString ()}";
                                      lblScrollFrame.Text = $"Scroll Frame: {scroll.Frame.ToString ()}";
                                      lblScrollViewport.Text = $"Scroll Viewport: {scroll.Viewport.ToString ()}";
                                      lblScrollViewport.Text = $"Scroll Viewport: {scroll.Viewport.ToString ()}";
-                                     lblScrollContentSize.Text = $"Scroll ContentSize: {scroll.ContentSize.ToString ()}";
+                                     lblScrollContentSize.Text = $"Scroll ContentSize: {scroll.GetContentSize ().ToString ()}";
                                  };
                                  };
 
 
         editor.Initialized += (s, e) =>
         editor.Initialized += (s, e) =>
                               {
                               {
-                                  scroll.Size = int.Max (app.ContentSize.Height * 2, app.ContentSize.Width * 2);
+                                  scroll.Size = int.Max (app.GetContentSize ().Height * 2, app.GetContentSize ().Width * 2);
                                   editor.ViewToEdit = scroll;
                                   editor.ViewToEdit = scroll;
                               };
                               };