Browse Source

Fix merge errors.

BDisp 1 year ago
parent
commit
4e57840dce
2 changed files with 14 additions and 14 deletions
  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;
         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))
             {
@@ -128,12 +128,12 @@ public class Scroll : View
 
     private int GetPositionFromSliderLocation (int location)
     {
-        if (ContentSize.Height == 0 || ContentSize.Width == 0)
+        if (GetContentSize ().Height == 0 || GetContentSize ().Width == 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
         // 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?
     private (int Location, int Dimension) GetSliderLocationDimensionFromPosition ()
     {
-        if (ContentSize.Height == 0 || ContentSize.Width == 0)
+        if (GetContentSize ().Height == 0 || GetContentSize ().Width == 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 dimension;
 
@@ -228,7 +228,7 @@ public class Scroll : View
     {
         MouseEvent me = e.MouseEvent;
         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
                                                        ? new (_slider.Frame.Y, _slider.Frame.Bottom - 1)
@@ -292,13 +292,13 @@ public class Scroll : View
         Text = string.Concat (
                               Enumerable.Repeat (
                                                  Glyphs.Stipple.ToString (),
-                                                 ContentSize.Width * ContentSize.Height));
+                                                 GetContentSize ().Width * GetContentSize ().Height));
         _slider.TextDirection = Orientation == Orientation.Vertical ? TextDirection.TopBottom_LeftRight : TextDirection.LeftRight_TopBottom;
 
         _slider.Text = string.Concat (
                                       Enumerable.Repeat (
                                                          Glyphs.ContinuousMeterSegment.ToString (),
-                                                         _slider.ContentSize.Width * _slider.ContentSize.Height));
+                                                         _slider.GetContentSize ().Width * _slider.GetContentSize ().Height));
     }
 
     private void AdjustSlider ()
@@ -314,8 +314,8 @@ public class Scroll : View
 
         _slider.SetContentSize (
                                 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 ();
     }
@@ -327,7 +327,7 @@ public class Scroll : View
     {
         MouseEvent me = e.MouseEvent;
         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;
 
         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 ()}"
         };
 
-        var editor = new Adornments.AdornmentsEditor ();
+        var editor = new AdornmentsEditor ();
         app.Add (editor);
 
         var view = new FrameView
@@ -232,12 +232,12 @@ public class ScrollDemo : Scenario
                                  {
                                      lblScrollFrame.Text = $"Scroll Frame: {scroll.Frame.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) =>
                               {
-                                  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;
                               };