Selaa lähdekoodia

Reamed Bounds -> Viewport - more rename

Tig 1 vuosi sitten
vanhempi
commit
0900333e12

+ 5 - 5
Terminal.Gui/Application.cs

@@ -1422,7 +1422,7 @@ public static partial class Application
 
             if (MouseGrabView.Viewport.Contains (viewRelativeMouseEvent.X, viewRelativeMouseEvent.Y) is false)
             {
-                // The mouse has moved outside the bounds of the view that
+                // The mouse has moved outside the Viewport of the view that
                 // grabbed the mouse, so we tell the view that last got 
                 // OnMouseEnter the mouse is leaving
                 // BUGBUG: That sentence makes no sense. Either I'm missing something or this logic is flawed.
@@ -1476,14 +1476,14 @@ public static partial class Application
                 View = view
             };
         }
-        else if (view.BoundsToScreen (view.Viewport).Contains (a.MouseEvent.X, a.MouseEvent.Y))
+        else if (view.ViewportToScreen (view.Viewport).Contains (a.MouseEvent.X, a.MouseEvent.Y))
         {
-            Point boundsPoint = view.ScreenToBounds (a.MouseEvent.X, a.MouseEvent.Y);
+            Point viewportLocation = view.ScreenToViewport (a.MouseEvent.X, a.MouseEvent.Y);
 
             me = new MouseEvent
             {
-                X = boundsPoint.X,
-                Y = boundsPoint.Y,
+                X = viewportLocation.X,
+                Y = viewportLocation.Y,
                 Flags = a.MouseEvent.Flags,
                 ScreenPosition = new (a.MouseEvent.X, a.MouseEvent.Y),
                 View = view

+ 9 - 9
Terminal.Gui/Drawing/LineCanvas.cs

@@ -48,7 +48,7 @@ public class LineCanvas : IDisposable
         // TODO: Add other resolvers
     };
 
-    private Rectangle _cachedBounds;
+    private Rectangle _cachedViewport;
 
     /// <summary>Creates a new instance.</summary>
     public LineCanvas ()
@@ -71,11 +71,11 @@ public class LineCanvas : IDisposable
     {
         get
         {
-            if (_cachedBounds.IsEmpty)
+            if (_cachedViewport.IsEmpty)
             {
                 if (_lines.Count == 0)
                 {
-                    return _cachedBounds;
+                    return _cachedViewport;
                 }
 
                 Rectangle bounds = _lines [0].Viewport;
@@ -94,10 +94,10 @@ public class LineCanvas : IDisposable
                     };
                 }
 
-                _cachedBounds = bounds;
+                _cachedViewport = bounds;
             }
 
-            return _cachedBounds;
+            return _cachedViewport;
         }
     }
 
@@ -134,7 +134,7 @@ public class LineCanvas : IDisposable
         Attribute? attribute = default
     )
     {
-        _cachedBounds = Rectangle.Empty;
+        _cachedViewport = Rectangle.Empty;
         _lines.Add (new StraightLine (start, length, orientation, style, attribute));
     }
 
@@ -142,14 +142,14 @@ public class LineCanvas : IDisposable
     /// <param name="line"></param>
     public void AddLine (StraightLine line)
     {
-        _cachedBounds = Rectangle.Empty;
+        _cachedViewport = Rectangle.Empty;
         _lines.Add (line);
     }
 
     /// <summary>Clears all lines from the LineCanvas.</summary>
     public void Clear ()
     {
-        _cachedBounds = Rectangle.Empty;
+        _cachedViewport = Rectangle.Empty;
         _lines.Clear ();
     }
 
@@ -157,7 +157,7 @@ public class LineCanvas : IDisposable
     ///     Clears any cached states from the canvas Call this method if you make changes to lines that have already been
     ///     added.
     /// </summary>
-    public void ClearCache () { _cachedBounds = Rectangle.Empty; }
+    public void ClearCache () { _cachedViewport = Rectangle.Empty; }
 
     /// <summary>
     ///     Evaluates the lines that have been added to the canvas and returns a map containing the glyphs and their

+ 41 - 41
Terminal.Gui/Text/TextFormatter.cs

@@ -73,8 +73,8 @@ public class TextFormatter
     }
 
     /// <summary>
-    ///     Determines if the bounds width will be used or only the text width will be used,
-    ///     If <see langword="true"/> all the bounds area will be filled with whitespaces and the same background color
+    ///     Determines if the viewport width will be used or only the text width will be used,
+    ///     If <see langword="true"/> all the viewport area will be filled with whitespaces and the same background color
     ///     showing a perfect rectangle.
     /// </summary>
     public bool FillRemaining { get; set; }
@@ -202,17 +202,17 @@ public class TextFormatter
     ///     Causes the text to be formatted (references <see cref="GetLines"/>). Sets <see cref="NeedsFormat"/> to
     ///     <c>false</c>.
     /// </remarks>
-    /// <param name="bounds">Specifies the screen-relative location and maximum size for drawing the text.</param>
+    /// <param name="viewport">Specifies the screen-relative location and maximum size for drawing the text.</param>
     /// <param name="normalColor">The color to use for all text except the hotkey</param>
     /// <param name="hotColor">The color to use to draw the hotkey</param>
-    /// <param name="containerBounds">Specifies the screen-relative location and maximum container size.</param>
+    /// <param name="maximum">Specifies the screen-relative location and maximum container size.</param>
     /// <param name="driver">The console driver currently used by the application.</param>
     /// <exception cref="ArgumentOutOfRangeException"></exception>
     public void Draw (
-        Rectangle bounds,
+        Rectangle viewport,
         Attribute normalColor,
         Attribute hotColor,
-        Rectangle containerBounds = default,
+        Rectangle maximum = default,
         ConsoleDriver driver = null
     )
     {
@@ -240,24 +240,24 @@ public class TextFormatter
         }
 
         bool isVertical = IsVerticalDirection (Direction);
-        Rectangle maxBounds = bounds;
+        Rectangle maxBounds = viewport;
 
         if (driver is { })
         {
             // INTENT: What, exactly, is the intent of this?
-            maxBounds = containerBounds == default (Rectangle)
-                            ? bounds
+            maxBounds = maximum == default (Rectangle)
+                            ? viewport
                             : new (
-                                   Math.Max (containerBounds.X, bounds.X),
-                                   Math.Max (containerBounds.Y, bounds.Y),
+                                   Math.Max (maximum.X, viewport.X),
+                                   Math.Max (maximum.Y, viewport.Y),
                                    Math.Max (
-                                             Math.Min (containerBounds.Width, containerBounds.Right - bounds.Left),
+                                             Math.Min (maximum.Width, maximum.Right - viewport.Left),
                                              0
                                             ),
                                    Math.Max (
                                              Math.Min (
-                                                       containerBounds.Height,
-                                                       containerBounds.Bottom - bounds.Top
+                                                       maximum.Height,
+                                                       maximum.Bottom - viewport.Top
                                                       ),
                                              0
                                             )
@@ -269,11 +269,11 @@ public class TextFormatter
             return;
         }
 
-        int lineOffset = !isVertical && bounds.Y < 0 ? Math.Abs (bounds.Y) : 0;
+        int lineOffset = !isVertical && viewport.Y < 0 ? Math.Abs (viewport.Y) : 0;
 
         for (int line = lineOffset; line < linesFormatted.Count; line++)
         {
-            if ((isVertical && line > bounds.Width) || (!isVertical && line > bounds.Height))
+            if ((isVertical && line > viewport.Width) || (!isVertical && line > viewport.Height))
             {
                 continue;
             }
@@ -305,14 +305,14 @@ public class TextFormatter
                 if (isVertical)
                 {
                     int runesWidth = GetWidestLineLength (linesFormatted, line, TabWidth);
-                    x = bounds.Right - runesWidth;
-                    CursorPosition = bounds.Width - runesWidth + (_hotKeyPos > -1 ? _hotKeyPos : 0);
+                    x = viewport.Right - runesWidth;
+                    CursorPosition = viewport.Width - runesWidth + (_hotKeyPos > -1 ? _hotKeyPos : 0);
                 }
                 else
                 {
                     int runesWidth = StringExtensions.ToString (runes).GetColumns ();
-                    x = bounds.Right - runesWidth;
-                    CursorPosition = bounds.Width - runesWidth + (_hotKeyPos > -1 ? _hotKeyPos : 0);
+                    x = viewport.Right - runesWidth;
+                    CursorPosition = viewport.Width - runesWidth + (_hotKeyPos > -1 ? _hotKeyPos : 0);
                 }
             }
             else if (Alignment is TextAlignment.Left or TextAlignment.Justified)
@@ -322,11 +322,11 @@ public class TextFormatter
                     int runesWidth = line > 0
                                          ? GetWidestLineLength (linesFormatted, 0, line, TabWidth)
                                          : 0;
-                    x = bounds.Left + runesWidth;
+                    x = viewport.Left + runesWidth;
                 }
                 else
                 {
-                    x = bounds.Left;
+                    x = viewport.Left;
                 }
 
                 CursorPosition = _hotKeyPos > -1 ? _hotKeyPos : 0;
@@ -336,16 +336,16 @@ public class TextFormatter
                 if (isVertical)
                 {
                     int runesWidth = GetWidestLineLength (linesFormatted, line, TabWidth);
-                    x = bounds.Left + line + (bounds.Width - runesWidth) / 2;
+                    x = viewport.Left + line + (viewport.Width - runesWidth) / 2;
 
-                    CursorPosition = (bounds.Width - runesWidth) / 2 + (_hotKeyPos > -1 ? _hotKeyPos : 0);
+                    CursorPosition = (viewport.Width - runesWidth) / 2 + (_hotKeyPos > -1 ? _hotKeyPos : 0);
                 }
                 else
                 {
                     int runesWidth = StringExtensions.ToString (runes).GetColumns ();
-                    x = bounds.Left + (bounds.Width - runesWidth) / 2;
+                    x = viewport.Left + (viewport.Width - runesWidth) / 2;
 
-                    CursorPosition = (bounds.Width - runesWidth) / 2 + (_hotKeyPos > -1 ? _hotKeyPos : 0);
+                    CursorPosition = (viewport.Width - runesWidth) / 2 + (_hotKeyPos > -1 ? _hotKeyPos : 0);
                 }
             }
             else
@@ -358,35 +358,35 @@ public class TextFormatter
             {
                 if (isVertical)
                 {
-                    y = bounds.Bottom - runes.Length;
+                    y = viewport.Bottom - runes.Length;
                 }
                 else
                 {
-                    y = bounds.Bottom - linesFormatted.Count + line;
+                    y = viewport.Bottom - linesFormatted.Count + line;
                 }
             }
             else if (VerticalAlignment is VerticalTextAlignment.Top or VerticalTextAlignment.Justified)
             {
                 if (isVertical)
                 {
-                    y = bounds.Top;
+                    y = viewport.Top;
                 }
                 else
                 {
-                    y = bounds.Top + line;
+                    y = viewport.Top + line;
                 }
             }
             else if (VerticalAlignment == VerticalTextAlignment.Middle)
             {
                 if (isVertical)
                 {
-                    int s = (bounds.Height - runes.Length) / 2;
-                    y = bounds.Top + s;
+                    int s = (viewport.Height - runes.Length) / 2;
+                    y = viewport.Top + s;
                 }
                 else
                 {
-                    int s = (bounds.Height - linesFormatted.Count) / 2;
-                    y = bounds.Top + line + s;
+                    int s = (viewport.Height - linesFormatted.Count) / 2;
+                    y = viewport.Top + line + s;
                 }
             }
             else
@@ -394,9 +394,9 @@ public class TextFormatter
                 throw new ArgumentOutOfRangeException ($"{nameof (VerticalAlignment)}");
             }
 
-            int colOffset = bounds.X < 0 ? Math.Abs (bounds.X) : 0;
-            int start = isVertical ? bounds.Top : bounds.Left;
-            int size = isVertical ? bounds.Height : bounds.Width;
+            int colOffset = viewport.X < 0 ? Math.Abs (viewport.X) : 0;
+            int start = isVertical ? viewport.Top : viewport.Left;
+            int size = isVertical ? viewport.Height : viewport.Width;
             int current = start + colOffset;
             List<Point?> lastZeroWidthPos = null;
             Rune rune = default;
@@ -422,15 +422,15 @@ public class TextFormatter
                         break;
                     }
 
-                    if ((!isVertical && current - start > maxBounds.Left + maxBounds.Width - bounds.X + colOffset)
-                        || (isVertical && idx > maxBounds.Top + maxBounds.Height - bounds.Y))
+                    if ((!isVertical && current - start > maxBounds.Left + maxBounds.Width - viewport.X + colOffset)
+                        || (isVertical && idx > maxBounds.Top + maxBounds.Height - viewport.Y))
                     {
                         break;
                     }
                 }
 
-                //if ((!isVertical && idx > maxBounds.Left + maxBounds.Width - bounds.X + colOffset)
-                //	|| (isVertical && idx > maxBounds.Top + maxBounds.Height - bounds.Y))
+                //if ((!isVertical && idx > maxBounds.Left + maxBounds.Width - viewport.X + colOffset)
+                //	|| (isVertical && idx > maxBounds.Top + maxBounds.Height - viewport.Y))
 
                 //	break;
 

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

@@ -146,7 +146,7 @@ public class Adornment : View
             return;
         }
 
-        Rectangle screenBounds = BoundsToScreen (contentArea);
+        Rectangle screenBounds = ViewportToScreen (contentArea);
         Attribute normalAttr = GetNormalColor ();
         Driver.SetAttribute (normalAttr);
 
@@ -297,7 +297,7 @@ public class Adornment : View
 
                 _dragPosition = new Point (mouseEvent.X, mouseEvent.Y);
 
-                Point parentLoc = Parent.SuperView?.ScreenToBounds (mouseEvent.ScreenPosition.X, mouseEvent.ScreenPosition.Y) ?? mouseEvent.ScreenPosition;
+                Point parentLoc = Parent.SuperView?.ScreenToViewport (mouseEvent.ScreenPosition.X, mouseEvent.ScreenPosition.Y) ?? mouseEvent.ScreenPosition;
 
                 GetLocationEnsuringFullVisibility (
                                      Parent,

+ 1 - 1
Terminal.Gui/View/Adornment/Border.cs

@@ -194,7 +194,7 @@ public class Border : Adornment
         }
 
         //Driver.SetAttribute (Colors.ColorSchemes ["Error"].Normal);
-        Rectangle screenBounds = BoundsToScreen (contentArea);
+        Rectangle screenBounds = ViewportToScreen (contentArea);
 
         //OnDrawSubviews (bounds); 
 

+ 25 - 28
Terminal.Gui/View/Layout/ViewLayout.cs

@@ -101,10 +101,10 @@ public partial class View
                 return ret;
             }
 
-            Point boundsOffset = super.GetBoundsOffset ();
-            boundsOffset.Offset(super.Frame.X, super.Frame.Y);
-            ret.X += boundsOffset.X;
-            ret.Y += boundsOffset.Y;
+            Point viewportOffset = super.GetViewportOffset ();
+            viewportOffset.Offset(super.Frame.X, super.Frame.Y);
+            ret.X += viewportOffset.X;
+            ret.Y += viewportOffset.Y;
             super = super.SuperView;
         }
 
@@ -120,7 +120,7 @@ public partial class View
     /// <param name="y">Screen-relative row.</param>
     public virtual Point ScreenToFrame (int x, int y)
     {
-        Point superViewBoundsOffset = SuperView?.GetBoundsOffset () ?? Point.Empty;
+        Point superViewBoundsOffset = SuperView?.GetViewportOffset () ?? Point.Empty;
         if (SuperView is null)
         {
             superViewBoundsOffset.Offset (x - Frame.X, y - Frame.Y);
@@ -287,10 +287,12 @@ public partial class View
     #region Viewport
 
     /// <summary>
-    ///     The bounds represent the View-relative rectangle used for this view; the area inside the view where
-    ///     subviews and content are presented.
+    ///     The viewport represents the location and size of the View's content that can be seen by the end-user at a given time.
+    ///     The location is specified in coordinates relative to the top-left corner of the area of the View within the
+    ///     <see cref="Margin"/>, <see cref="Border"/> and <see cref="Padding"/> and is normally <c>0, 0</c>. Non-zero
+    ///     values for the location indicate the visible area is offset into the View's virtual <see cref="ContentSize"/>.
     /// </summary>
-    /// <value>The rectangle describing the location and size of the area where the views' subviews and content are drawn.</value>
+    /// <value>The rectangle describing the location and size of the area where the views' subviews and content are visible.</value>
     /// <remarks>
     ///     <para>
     ///         If <see cref="LayoutStyle"/> is <see cref="LayoutStyle.Computed"/> the value of Viewport is indeterminate until
@@ -298,18 +300,13 @@ public partial class View
     ///         called.
     ///     </para>
     ///     <para>
-    ///         Updates to the Viewport updates <see cref="Frame"/>, and has the same effect as updating the
+    ///         Updates to the Viewport size updates <see cref="Frame"/>, and has the same effect as updating the
     ///         <see cref="Frame"/>.
     ///     </para>
     ///     <para>
-    ///         Altering the Viewport will eventually (when the view is next laid out) cause the
+    ///         Altering the Viewport size will eventually (when the view is next laid out) cause the
     ///         <see cref="LayoutSubview(View, Rectangle)"/> and <see cref="OnDrawContent(Rectangle)"/> methods to be called.
     ///     </para>
-    ///     <para>
-    ///         Because <see cref="Viewport"/> coordinates are relative to the upper-left corner of the <see cref="View"/>, the
-    ///         coordinates of the upper-left corner of the rectangle returned by this property are (0,0). Use this property to
-    ///         obtain the size of the area of the view for tasks such as drawing the view's contents.
-    ///     </para>
     /// </remarks>
     public virtual Rectangle Viewport
     {
@@ -363,25 +360,25 @@ public partial class View
     }
 
     /// <summary>Converts a <see cref="Viewport"/>-relative rectangle to a screen-relative rectangle.</summary>
-    public Rectangle BoundsToScreen (in Rectangle bounds)
+    public Rectangle ViewportToScreen (in Rectangle bounds)
     {
         // Translate bounds to Frame (our SuperView's Viewport-relative coordinates)
         Rectangle screen = FrameToScreen ();
-        Point boundsOffset = GetBoundsOffset ();
-        screen.Offset (boundsOffset.X + bounds.X, boundsOffset.Y + bounds.Y);
+        Point viewportOffset = GetViewportOffset ();
+        screen.Offset (viewportOffset.X + bounds.X, viewportOffset.Y + bounds.Y);
 
         return new (screen.Location, bounds.Size);
     }
 
-    /// <summary>Converts a screen-relative coordinate to a bounds-relative coordinate.</summary>
+    /// <summary>Converts a screen-relative coordinate to a Viewport-relative coordinate.</summary>
     /// <returns>The coordinate relative to this view's <see cref="Viewport"/>.</returns>
     /// <param name="x">Screen-relative column.</param>
     /// <param name="y">Screen-relative row.</param>
-    public Point ScreenToBounds (int x, int y)
+    public Point ScreenToViewport (int x, int y)
     {
-        Point boundsOffset = GetBoundsOffset ();
+        Point viewportOffset = GetViewportOffset ();
         Point screen = ScreenToFrame (x, y);
-        screen.Offset (-boundsOffset.X, -boundsOffset.Y);
+        screen.Offset (-viewportOffset.X, -viewportOffset.Y);
 
         return screen;
     }
@@ -390,7 +387,7 @@ public partial class View
     ///     Helper to get the X and Y offset of the Viewport from the Frame. This is the sum of the Left and Top properties
     ///     of <see cref="Margin"/>, <see cref="Border"/> and <see cref="Padding"/>.
     /// </summary>
-    public Point GetBoundsOffset () { return Padding is null ? Point.Empty : Padding.Thickness.GetInside (Padding.Frame).Location; }
+    public Point GetViewportOffset () { return Padding is null ? Point.Empty : Padding.Thickness.GetInside (Padding.Frame).Location; }
 
     #endregion Viewport
 
@@ -698,18 +695,18 @@ public partial class View
             found = start.Padding;
         }
 
-        Point boundsOffset = start.GetBoundsOffset ();
+        Point viewportOffset = start.GetViewportOffset ();
 
         if (found is { })
         {
             start = found;
-            boundsOffset = found.Parent.Frame.Location;
+            viewportOffset = found.Parent.Frame.Location;
         }
 
         if (start.InternalSubviews is { Count: > 0 })
         {
-            int startOffsetX = x - (start.Frame.X + boundsOffset.X);
-            int startOffsetY = y - (start.Frame.Y + boundsOffset.Y);
+            int startOffsetX = x - (start.Frame.X + viewportOffset.X);
+            int startOffsetY = y - (start.Frame.Y + viewportOffset.Y);
 
             for (int i = start.InternalSubviews.Count - 1; i >= 0; i--)
             {
@@ -925,7 +922,7 @@ public partial class View
 
         foreach (View v in ordered)
         {
-            LayoutSubview (v, new (GetBoundsOffset (), Viewport.Size));
+            LayoutSubview (v, new (GetViewportOffset (), Viewport.Size));
         }
 
         // If the 'to' is rooted to 'from' and the layoutstyle is Computed it's a special-case.

+ 11 - 29
Terminal.Gui/View/ViewDrawing.cs

@@ -98,7 +98,7 @@ public partial class View
 
         // Clamp the region to the bounds of the view
         contentArea = Rectangle.Intersect (contentArea, Viewport);
-        Driver.FillRect (BoundsToScreen (contentArea));
+        Driver.FillRect (ViewportToScreen (contentArea));
         Driver.SetAttribute (prev);
     }
 
@@ -113,7 +113,7 @@ public partial class View
     ///         <see cref="Rectangle.Empty"/>.
     ///     </para>
     /// </remarks>
-    public Rectangle ClipToBounds ()
+    public Rectangle ClipToViewport ()
     {
         if (Driver is null)
         {
@@ -121,7 +121,7 @@ public partial class View
         }
 
         Rectangle previous = Driver.Clip;
-        Driver.Clip = Rectangle.Intersect (previous, BoundsToScreen (Viewport));
+        Driver.Clip = Rectangle.Intersect (previous, ViewportToScreen (Viewport));
 
         return previous;
     }
@@ -153,7 +153,7 @@ public partial class View
 
         OnDrawAdornments ();
 
-        Rectangle prevClip = ClipToBounds ();
+        Rectangle prevClip = ClipToViewport ();
 
         if (ColorScheme is { })
         {
@@ -326,7 +326,7 @@ public partial class View
             return;
         }
 
-        Rectangle screen = BoundsToScreen (new (col, row, 0, 0));
+        Rectangle screen = ViewportToScreen (new (col, row, 0, 0));
         Driver?.Move (screen.X, screen.Y);
     }
 
@@ -354,18 +354,18 @@ public partial class View
     }
 
     /// <summary>Enables overrides to draw infinitely scrolled content and/or a background behind added controls.</summary>
-    /// <param name="contentArea">
+    /// <param name="viewport">
     ///     The view-relative rectangle describing the currently visible viewport into the
     ///     <see cref="View"/>
     /// </param>
     /// <remarks>This method will be called before any subviews added with <see cref="Add(View)"/> have been drawn.</remarks>
-    public virtual void OnDrawContent (Rectangle contentArea)
+    public virtual void OnDrawContent (Rectangle viewport)
     {
         if (NeedsDisplay)
         {
             if (SuperView is { })
             {
-                Clear (contentArea);
+                Clear (viewport);
             }
 
             if (!string.IsNullOrEmpty (TextFormatter.Text))
@@ -378,7 +378,7 @@ public partial class View
 
             // This should NOT clear 
             TextFormatter?.Draw (
-                                 BoundsToScreen (contentArea),
+                                 ViewportToScreen (viewport),
                                  HasFocus ? GetFocusColor () : GetNormalColor (),
                                  HasFocus ? ColorScheme.HotFocus : GetHotNormalColor (),
                                  Rectangle.Empty
@@ -418,7 +418,7 @@ public partial class View
     ///     Enables overrides after completed drawing infinitely scrolled content and/or a background behind removed
     ///     controls.
     /// </summary>
-    /// <param name="contentArea">
+    /// <param name="viewport">
     ///     The view-relative rectangle describing the currently visible viewport into the
     ///     <see cref="View"/>
     /// </param>
@@ -426,7 +426,7 @@ public partial class View
     ///     This method will be called after any subviews removed with <see cref="Remove(View)"/> have been completed
     ///     drawing.
     /// </remarks>
-    public virtual void OnDrawContentComplete (Rectangle contentArea) { DrawContentComplete?.Invoke (this, new (contentArea)); }
+    public virtual void OnDrawContentComplete (Rectangle viewport) { DrawContentComplete?.Invoke (this, new (viewport)); }
 
     // TODO: Make this cancelable
     /// <summary>
@@ -558,22 +558,4 @@ public partial class View
         _needsDisplayRect = Rectangle.Empty;
         SubViewNeedsDisplay = false;
     }
-
-    // INTENT: Isn't this just intersection? It isn't used anyway.
-    // Clips a rectangle in screen coordinates to the dimensions currently available on the screen
-    internal Rectangle ScreenClip (Rectangle regionScreen)
-    {
-        int x = regionScreen.X < 0 ? 0 : regionScreen.X;
-        int y = regionScreen.Y < 0 ? 0 : regionScreen.Y;
-
-        int w = regionScreen.X + regionScreen.Width >= Driver.Cols
-                    ? Driver.Cols - regionScreen.X
-                    : regionScreen.Width;
-
-        int h = regionScreen.Y + regionScreen.Height >= Driver.Rows
-                    ? Driver.Rows - regionScreen.Y
-                    : regionScreen.Height;
-
-        return new (x, y, w, h);
-    }
 }

+ 1 - 1
Terminal.Gui/Views/ComboBox.cs

@@ -494,7 +494,7 @@ public class ComboBox : View
         _listview.Clear (_listview.IsInitialized ? _listview.Viewport : Rectangle.Empty);
         _listview.TabStop = false;
         SuperView?.SendSubviewToBack (this);
-        Rectangle rect = _listview.BoundsToScreen (_listview.IsInitialized ? _listview.Viewport : Rectangle.Empty);
+        Rectangle rect = _listview.ViewportToScreen (_listview.IsInitialized ? _listview.Viewport : Rectangle.Empty);
         SuperView?.SetNeedsDisplay (rect);
         OnCollapsed ();
     }

+ 1 - 1
Terminal.Gui/Views/Line.cs

@@ -26,7 +26,7 @@ public class Line : View
             lc = adornment.Parent.LineCanvas;
         }
         lc.AddLine (
-                    BoundsToScreen (contentArea).Location,
+                    ViewportToScreen (contentArea).Location,
                     Orientation == Orientation.Horizontal ? Frame.Width : Frame.Height,
                     Orientation,
                     BorderStyle

+ 2 - 2
Terminal.Gui/Views/Menu/ContextMenu.cs

@@ -147,7 +147,7 @@ public sealed class ContextMenu : IDisposable
 
         if (Host is { })
         {
-            Point pos = Host.BoundsToScreen (frame).Location;
+            Point pos = Host.ViewportToScreen (frame).Location;
             pos.Y += Host.Frame.Height - 1;
 
             if (position != pos)
@@ -184,7 +184,7 @@ public sealed class ContextMenu : IDisposable
                 }
                 else
                 {
-                    Point pos = Host.BoundsToScreen (frame).Location;
+                    Point pos = Host.ViewportToScreen (frame).Location;
                     position.Y = pos.Y - rect.Height - 1;
                 }
             }

+ 7 - 7
Terminal.Gui/Views/Menu/Menu.cs

@@ -724,7 +724,7 @@ internal sealed class Menu : View
             throw new InvalidOperationException ("This shouldn't running on a invisible menu!");
         }
 
-        Point boundsPoint = ScreenToBounds (a.MouseEvent.X, a.MouseEvent.Y);
+        Point boundsPoint = ScreenToViewport (a.MouseEvent.X, a.MouseEvent.Y);
         var me = new MouseEvent
         {
             X = boundsPoint.X,
@@ -776,7 +776,7 @@ internal sealed class Menu : View
                 continue;
             }
 
-            if (BoundsToScreen (Viewport).Y + i >= Driver.Rows)
+            if (ViewportToScreen (Viewport).Y + i >= Driver.Rows)
             {
                 break;
             }
@@ -808,7 +808,7 @@ internal sealed class Menu : View
                     continue;
                 }
 
-                if (BoundsToScreen (Viewport).X + p >= Driver.Cols)
+                if (ViewportToScreen (Viewport).X + p >= Driver.Cols)
                 {
                     break;
                 }
@@ -873,7 +873,7 @@ internal sealed class Menu : View
                 textToDraw = item.Title;
             }
 
-            Rectangle screen = BoundsToScreen (new (new (0 , i), Size.Empty));
+            Rectangle screen = ViewportToScreen (new (new (0 , i), Size.Empty));
             if (screen.X < Driver.Cols)
             {
                 Driver.Move (screen.X + 1, screen.Y);
@@ -891,10 +891,10 @@ internal sealed class Menu : View
 
                     // The -3 is left/right border + one space (not sure what for)
                     tf.Draw (
-                             BoundsToScreen (new (1, i, Frame.Width - 3, 1)),
+                             ViewportToScreen (new (1, i, Frame.Width - 3, 1)),
                              i == _currentChild ? ColorScheme.Focus : GetNormalColor (),
                              i == _currentChild ? ColorScheme.HotFocus : ColorScheme.HotNormal,
-                             SuperView?.BoundsToScreen (SuperView.Viewport) ?? Rectangle.Empty
+                             SuperView?.ViewportToScreen (SuperView.Viewport) ?? Rectangle.Empty
                             );
                 }
                 else
@@ -911,7 +911,7 @@ internal sealed class Menu : View
                             ? item.Help.GetColumns ()
                             : item.Help.GetColumns () + item.ShortcutTag.GetColumns () + 2;
                 int col = Frame.Width - l - 3;
-                screen = BoundsToScreen (new (new (col, i), Size.Empty));
+                screen = ViewportToScreen (new (new (col, i), Size.Empty));
 
                 if (screen.X < Driver.Cols)
                 {

+ 7 - 7
Terminal.Gui/Views/Menu/MenuBar.cs

@@ -827,11 +827,11 @@ public class MenuBar : View
 
         Rectangle superViewFrame = SuperView is null ? Driver.Viewport : SuperView.Frame;
         View sv = SuperView is null ? Application.Current : SuperView;
-        Point boundsOffset = sv.GetBoundsOffset ();
+        Point viewportOffset = sv.GetViewportOffset ();
 
         return new (
-                    superViewFrame.X - sv.Frame.X - boundsOffset.X,
-                    superViewFrame.Y - sv.Frame.Y - boundsOffset.Y
+                    superViewFrame.X - sv.Frame.X - viewportOffset.X,
+                    superViewFrame.Y - sv.Frame.Y - viewportOffset.Y
                    );
     }
 
@@ -844,9 +844,9 @@ public class MenuBar : View
     {
         Rectangle screen = Driver.Viewport;
         Rectangle currentFrame = Application.Current.Frame;
-        Point boundsOffset = Application.Top.GetBoundsOffset ();
+        Point viewportOffset = Application.Top.GetViewportOffset ();
 
-        return new (screen.X - currentFrame.X - boundsOffset.X, screen.Y - currentFrame.Y - boundsOffset.Y);
+        return new (screen.X - currentFrame.X - viewportOffset.X, screen.Y - currentFrame.Y - viewportOffset.Y);
     }
 
     internal void NextMenu (bool isSubMenu = false, bool ignoreUseSubMenusSingleFrame = false)
@@ -1320,7 +1320,7 @@ public class MenuBar : View
 
         if (mi.IsTopLevel)
         {
-            Rectangle screen = BoundsToScreen (new (new (0, i), Size.Empty));
+            Rectangle screen = ViewportToScreen (new (new (0, i), Size.Empty));
             var menu = new Menu { Host = this, X = screen.X, Y = screen.Y, BarItems = mi };
             menu.Run (mi.Action);
             menu.Dispose ();
@@ -1684,7 +1684,7 @@ public class MenuBar : View
                     {
                         if (Menus [i].IsTopLevel)
                         {
-                            Rectangle screen = BoundsToScreen (new (new (0, i), Size.Empty));
+                            Rectangle screen = ViewportToScreen (new (new (0, i), Size.Empty));
                             var menu = new Menu { Host = this, X = screen.X, Y = screen.Y, BarItems = Menus [i] };
                             menu.Run (Menus [i].Action);
                             menu.Dispose ();

+ 2 - 2
Terminal.Gui/Views/ProgressBar.cs

@@ -190,10 +190,10 @@ public class ProgressBar : View
             }
 
             tf?.Draw (
-                      BoundsToScreen (Viewport),
+                      ViewportToScreen (Viewport),
                       attr,
                       ColorScheme.Normal,
-                      SuperView?.BoundsToScreen (SuperView.Viewport) ?? default (Rectangle)
+                      SuperView?.ViewportToScreen (SuperView.Viewport) ?? default (Rectangle)
                      );
         }
     }

+ 1 - 1
Terminal.Gui/Views/ScrollView.cs

@@ -339,7 +339,7 @@ public class ScrollView : View
     {
         SetViewsNeedsDisplay ();
 
-        Rectangle savedClip = ClipToBounds ();
+        Rectangle savedClip = ClipToViewport ();
 
         // TODO: It's bad practice for views to always clear a view. It negates clipping.
         Clear (contentArea);

+ 4 - 4
Terminal.Gui/Views/TabView.cs

@@ -317,7 +317,7 @@ public class TabView : View
 
         if (Tabs.Any ())
         {
-            Rectangle savedClip = ClipToBounds ();
+            Rectangle savedClip = ClipToViewport ();
             _tabsBar.OnDrawContent (contentArea);
             _contentView.SetNeedsDisplay ();
             _contentView.Draw ();
@@ -683,7 +683,7 @@ public class TabView : View
             for (var i = 0; i < tabLocations.Length; i++)
             {
                 View tab = tabLocations [i].Tab;
-                Rectangle vts = tab.BoundsToScreen (tab.Viewport);
+                Rectangle vts = tab.ViewportToScreen (tab.Viewport);
                 var lc = new LineCanvas ();
                 int selectedOffset = _host.Style.ShowTopLine && tabLocations [i].IsSelected ? 0 : 1;
 
@@ -1115,7 +1115,7 @@ public class TabView : View
 
                     int lastSelectedTab = !_host.Style.ShowTopLine && i == selectedTab ? 1 :
                                           _host.Style.TabsOnBottom ? 1 : 0;
-                    Rectangle tabsBarVts = BoundsToScreen (Viewport);
+                    Rectangle tabsBarVts = ViewportToScreen (Viewport);
                     int lineLength = tabsBarVts.Right - vts.Right;
 
                     // Right horizontal line
@@ -1314,7 +1314,7 @@ public class TabView : View
                 }
 
                 tab.TextFormatter.Draw (
-                                        tab.BoundsToScreen (tab.Viewport),
+                                        tab.ViewportToScreen (tab.Viewport),
                                         prevAttr,
                                         ColorScheme.HotNormal
                                        );

+ 2 - 2
Terminal.Gui/Views/TextField.cs

@@ -1196,8 +1196,8 @@ public class TextField : View
 
         int pos = _cursorPosition - ScrollOffset + Math.Min (Frame.X, 0);
         int offB = OffSetBackground ();
-        Rectangle containerFrame = SuperView?.BoundsToScreen (SuperView.Viewport) ?? default (Rectangle);
-        Rectangle thisFrame = BoundsToScreen (Viewport);
+        Rectangle containerFrame = SuperView?.ViewportToScreen (SuperView.Viewport) ?? default (Rectangle);
+        Rectangle thisFrame = ViewportToScreen (Viewport);
 
         if (pos > -1
             && col >= pos

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

@@ -217,7 +217,7 @@ public class TileView : View
             {
                 bool isRoot = _splitterLines.Contains (line);
 
-                Rectangle screen = line.BoundsToScreen (Rectangle.Empty);
+                Rectangle screen = line.ViewportToScreen (Rectangle.Empty);
                 Point origin = ScreenToFrame (screen.X, screen.Y);
                 int length = line.Orientation == Orientation.Horizontal ? line.Frame.Width : line.Frame.Height;
 
@@ -837,7 +837,7 @@ public class TileView : View
         /// </summary>
         public Point GetLocalCoordinateForTitle (TileView intoCoordinateSpace)
         {
-            Rectangle screen = Tile.ContentView.BoundsToScreen (Rectangle.Empty);
+            Rectangle screen = Tile.ContentView.ViewportToScreen (Rectangle.Empty);
             return intoCoordinateSpace.ScreenToFrame (screen.X, screen.Y - 1);
         }
 

+ 1 - 1
UICatalog/Scenarios/CharacterMap.cs

@@ -564,7 +564,7 @@ internal class CharMap : ScrollView
                                       )
                                  );
 
-        Rectangle oldClip = ClipToBounds ();
+        Rectangle oldClip = ClipToViewport ();
 
         if (ShowHorizontalScrollIndicator)
         {

+ 1 - 1
UICatalog/Scenarios/Notepad.cs

@@ -350,7 +350,7 @@ public class Notepad : Scenario
                                     );
         }
 
-        Rectangle screen = ((View)sender).BoundsToScreen (new (e.MouseEvent.X, e.MouseEvent.Y, 0, 0));
+        Rectangle screen = ((View)sender).ViewportToScreen (new (e.MouseEvent.X, e.MouseEvent.Y, 0, 0));
 
         var contextMenu = new ContextMenu { Position = screen.Location, MenuItems = items };
 

+ 2 - 2
UICatalog/Scenarios/ViewExperiments.cs

@@ -223,8 +223,8 @@ public class ViewExperiments : Scenario
                                            view.Frame
                                        } .Viewport: {
                                            view.Viewport
-                                       } .BoundsOffset: {
-                                           view.GetBoundsOffset ()
+                                       } .viewportOffset: {
+                                           view.GetViewportOffset ()
                                        }\n .Padding.Frame: {
                                            view.Padding.Frame
                                        } .Padding.Viewport: {

+ 1 - 1
UnitTests/View/Adornment/AdornmentTests.cs

@@ -105,7 +105,7 @@ public class AdornmentTests (ITestOutputHelper output)
         Assert.Equal (new Rectangle (0, 0, 10, 10), parent.Margin.Viewport);
 
         Assert.Null (parent.Margin.SuperView);
-        Rectangle boundsAsScreen = parent.Margin.BoundsToScreen (new Rectangle (1, 2, 5, 5));
+        Rectangle boundsAsScreen = parent.Margin.ViewportToScreen (new Rectangle (1, 2, 5, 5));
         Assert.Equal (new Rectangle (2, 4, 5, 5), boundsAsScreen);
     }
 

+ 19 - 19
UnitTests/View/Adornment/ToScreenTests.cs

@@ -3,7 +3,7 @@
 namespace Terminal.Gui.ViewTests;
 
 /// <summary>
-/// Test the <see cref="Adornment.FrameToScreen"/> and <see cref="Adornment.BoundsToScreen"/> methods.
+/// Test the <see cref="Adornment.FrameToScreen"/> and <see cref="View.ViewportToScreen"/> methods.
 /// DOES NOT TEST View.xxxToScreen methods. Those are in ./View/Layout/ToScreenTests.cs
 /// </summary>
 /// <param name="output"></param>
@@ -251,9 +251,9 @@ public class AdornmentToScreenTests (ITestOutputHelper output)
         view.Frame = frame;
 
         // Act
-        var marginScreen = view.Margin.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var borderScreen = view.Border.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var paddingScreen = view.Padding.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var marginScreen = view.Margin.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var borderScreen = view.Border.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var paddingScreen = view.Padding.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, marginScreen.X);
@@ -292,9 +292,9 @@ public class AdornmentToScreenTests (ITestOutputHelper output)
         Assert.Equal(4, view.Viewport.Width);
 
         // Act
-        var marginScreen = view.Margin.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var borderScreen = view.Border.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var paddingScreen = view.Padding.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var marginScreen = view.Margin.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var borderScreen = view.Border.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var paddingScreen = view.Padding.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, marginScreen.X);
@@ -338,9 +338,9 @@ public class AdornmentToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var marginScreen = view.Margin.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var borderScreen = view.Border.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var paddingScreen = view.Padding.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var marginScreen = view.Margin.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var borderScreen = view.Border.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var paddingScreen = view.Padding.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, marginScreen.X);
@@ -385,9 +385,9 @@ public class AdornmentToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var marginScreen = view.Margin.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var borderScreen = view.Border.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var paddingScreen = view.Padding.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var marginScreen = view.Margin.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var borderScreen = view.Border.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var paddingScreen = view.Padding.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, marginScreen.X);
@@ -441,9 +441,9 @@ public class AdornmentToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var marginScreen = view.Margin.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var borderScreen = view.Border.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var paddingScreen = view.Padding.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var marginScreen = view.Margin.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var borderScreen = view.Border.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var paddingScreen = view.Padding.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, marginScreen.X);
@@ -502,9 +502,9 @@ public class AdornmentToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var marginScreen = view.Margin.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var borderScreen = view.Border.BoundsToScreen (new (boundsX, 0, 0, 0));
-        var paddingScreen = view.Padding.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var marginScreen = view.Margin.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var borderScreen = view.Border.ViewportToScreen (new (boundsX, 0, 0, 0));
+        var paddingScreen = view.Padding.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, marginScreen.X);

+ 3 - 3
UnitTests/View/Layout/ScreenToTests.cs

@@ -32,7 +32,7 @@ public class ScreenToTests
             BorderStyle = LineStyle.Single
         };
 
-        Point actual = view.ScreenToBounds (x, y);
+        Point actual = view.ScreenToViewport (x, y);
         Assert.Equal (expectedX, actual.X);
         Assert.Equal (expectedY, actual.Y);
     }
@@ -54,7 +54,7 @@ public class ScreenToTests
     {
         var view = new View { X = viewX, Y = viewY, Width = 10, Height = 10 };
 
-        Point actual = view.ScreenToBounds (x, y);
+        Point actual = view.ScreenToViewport (x, y);
         Assert.Equal (expectedX, actual.X);
         Assert.Equal (expectedY, actual.Y);
     }
@@ -103,7 +103,7 @@ public class ScreenToTests
         var view = new View { X = viewX, Y = viewY, Width = 5, Height = 5 };
         super.Add (view);
 
-        Point actual = view.ScreenToBounds (x, y);
+        Point actual = view.ScreenToViewport (x, y);
         Assert.Equal (expectedX, actual.X);
         Assert.Equal (expectedY, actual.Y);
     }

+ 7 - 7
UnitTests/View/Layout/ToScreenTests.cs

@@ -3,7 +3,7 @@
 namespace Terminal.Gui.ViewTests;
 
 /// <summary>
-/// Test the <see cref="View.FrameToScreen"/> and <see cref="View.BoundsToScreen"/> methods.
+/// Test the <see cref="View.FrameToScreen"/> and <see cref="View.ViewportToScreen"/> methods.
 /// DOES NOT TEST Adornment.xxxToScreen methods. Those are in ./Adornment/ToScreenTests.cs
 /// </summary>
 /// <param name="output"></param>
@@ -222,7 +222,7 @@ public class ToScreenTests (ITestOutputHelper output)
         view.Frame = frame;
 
         // Act
-        var screen = view.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var screen = view.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, screen.X);
@@ -254,7 +254,7 @@ public class ToScreenTests (ITestOutputHelper output)
         view.Frame = frame;
 
         // Act
-        var screen = view.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var screen = view.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, screen.X);
@@ -296,7 +296,7 @@ public class ToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var screen = view.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var screen = view.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, screen.X);
@@ -339,7 +339,7 @@ public class ToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var screen = view.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var screen = view.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, screen.X);
@@ -391,7 +391,7 @@ public class ToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var screen = view.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var screen = view.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, screen.X);
@@ -445,7 +445,7 @@ public class ToScreenTests (ITestOutputHelper output)
         superView.LayoutSubviews ();
 
         // Act
-        var screen = view.BoundsToScreen (new (boundsX, 0, 0, 0));
+        var screen = view.ViewportToScreen (new (boundsX, 0, 0, 0));
 
         // Assert
         Assert.Equal (expectedX, screen.X);

+ 34 - 34
UnitTests/View/NavigationTests.cs

@@ -841,19 +841,19 @@ public class NavigationTests
 
         // top
         Assert.Equal (Point.Empty, top.ScreenToFrame (0, 0));
-        Rectangle screen = top.Margin.BoundsToScreen (new (0, 0, 0, 0));
+        Rectangle screen = top.Margin.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
-        screen = top.Border.BoundsToScreen (new (0, 0, 0, 0));
+        screen = top.Border.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
-        screen = top.Padding.BoundsToScreen (new (0, 0, 0, 0));
+        screen = top.Padding.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = top.BoundsToScreen (new (0, 0, 0, 0));
+        screen = top.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = top.BoundsToScreen (new (-1, -1, 0, 0));
+        screen = top.ViewportToScreen (new (-1, -1, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
         var found = View.FindDeepestView (top, 0, 0);
@@ -862,7 +862,7 @@ public class NavigationTests
         Assert.Equal (0, found.Frame.X);
         Assert.Equal (0, found.Frame.Y);
         Assert.Equal (new Point (3, 2), top.ScreenToFrame (3, 2));
-        screen = top.BoundsToScreen (new (3, 2, 0, 0));
+        screen = top.ViewportToScreen (new (3, 2, 0, 0));
         Assert.Equal (4, screen.X);
         Assert.Equal (3, screen.Y);
         found = View.FindDeepestView (top, screen.X, screen.Y);
@@ -874,14 +874,14 @@ public class NavigationTests
         //Assert.Equal (3, found.FrameToScreen ().X);
         //Assert.Equal (2, found.FrameToScreen ().Y);
         Assert.Equal (new Point (13, 2), top.ScreenToFrame (13, 2));
-        screen = top.BoundsToScreen (new (12, 2, 0, 0));
+        screen = top.ViewportToScreen (new (12, 2, 0, 0));
         Assert.Equal (13, screen.X);
         Assert.Equal (3, screen.Y);
         found = View.FindDeepestView (top, screen.X, screen.Y);
         Assert.Equal (view, found);
         //Assert.Equal (9, found.FrameToScreen ().X);
         //Assert.Equal (0, found.FrameToScreen ().Y);
-        screen = top.BoundsToScreen (new (13, 2, 0, 0));
+        screen = top.ViewportToScreen (new (13, 2, 0, 0));
         Assert.Equal (14, screen.X);
         Assert.Equal (3, screen.Y);
         found = View.FindDeepestView (top, 13, 2);
@@ -889,7 +889,7 @@ public class NavigationTests
         //Assert.Equal (13, found.FrameToScreen ().X);
         //Assert.Equal (2, found.FrameToScreen ().Y);
         Assert.Equal (new Point (14, 3), top.ScreenToFrame (14, 3));
-        screen = top.BoundsToScreen (new (14, 3, 0, 0));
+        screen = top.ViewportToScreen (new (14, 3, 0, 0));
         Assert.Equal (15, screen.X);
         Assert.Equal (4, screen.Y);
         found = View.FindDeepestView (top, 14, 3);
@@ -899,40 +899,40 @@ public class NavigationTests
 
         // view
         Assert.Equal (new Point (-4, -3), view.ScreenToFrame (0, 0));
-        screen = view.Margin.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = view.Margin.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.Border.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = view.Border.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.Padding.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = view.Padding.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = view.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.BoundsToScreen (new (-4, -3, 0, 0));
+        screen = view.ViewportToScreen (new (-4, -3, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
         found = View.FindDeepestView (top, 0, 0);
         Assert.Equal (top.Border, found);
 
         Assert.Equal (new Point (-1, -1), view.ScreenToFrame (3, 2));
-        screen = view.BoundsToScreen (new (0, 0, 0, 0));
+        screen = view.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (4, screen.X);
         Assert.Equal (3, screen.Y);
         found = View.FindDeepestView (top, 4, 3);
         Assert.Equal (view, found);
         
         Assert.Equal (new Point (9, -1), view.ScreenToFrame (13, 2));
-        screen = view.BoundsToScreen (new (10, 0, 0, 0));
+        screen = view.ViewportToScreen (new (10, 0, 0, 0));
         Assert.Equal (14, screen.X);
         Assert.Equal (3, screen.Y);
         found = View.FindDeepestView (top, 14, 3);
         Assert.Equal (top, found);
         
         Assert.Equal (new Point (10, 0), view.ScreenToFrame (14, 3));
-        screen = view.BoundsToScreen (new (11, 1, 0, 0));
+        screen = view.ViewportToScreen (new (11, 1, 0, 0));
         Assert.Equal (15, screen.X);
         Assert.Equal (4, screen.Y);
         found = View.FindDeepestView (top, 15, 4);
@@ -995,80 +995,80 @@ public class NavigationTests
 
         // top
         Assert.Equal (new Point (-3, -2), top.ScreenToFrame (0, 0));
-        Rectangle screen = top.Margin.BoundsToScreen (new (-3, -2, 0, 0));
+        Rectangle screen = top.Margin.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
-        screen = top.Border.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = top.Border.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
-        screen = top.Padding.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = top.Padding.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = top.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = top.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = top.BoundsToScreen (new (-4, -3, 0, 0));
+        screen = top.ViewportToScreen (new (-4, -3, 0, 0));
         Assert.Equal (0, screen.X);
         Assert.Equal (0, screen.Y);
         var found = View.FindDeepestView (top, -4, -3);
         Assert.Null (found);
         Assert.Equal (Point.Empty, top.ScreenToFrame (3, 2));
-        screen = top.BoundsToScreen (new (0, 0, 0, 0));
+        screen = top.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (4, screen.X);
         Assert.Equal (3, screen.Y);
         Assert.Equal (top.Border, View.FindDeepestView (top, 3, 2));
         //Assert.Equal (0, found.FrameToScreen ().X);
         //Assert.Equal (0, found.FrameToScreen ().Y);
         Assert.Equal (new Point (10, 0), top.ScreenToFrame (13, 2));
-        screen = top.BoundsToScreen (new (10, 0, 0, 0));
+        screen = top.ViewportToScreen (new (10, 0, 0, 0));
         Assert.Equal (14, screen.X);
         Assert.Equal (3, screen.Y);
         Assert.Equal (top.Border, View.FindDeepestView (top, 13, 2));
         //Assert.Equal (10, found.FrameToScreen ().X);
         //Assert.Equal (0, found.FrameToScreen ().Y);
         Assert.Equal (new Point (11, 1), top.ScreenToFrame (14, 3));
-        screen = top.BoundsToScreen (new (11, 1, 0, 0));
+        screen = top.ViewportToScreen (new (11, 1, 0, 0));
         Assert.Equal (15, screen.X);
         Assert.Equal (4, screen.Y);
         Assert.Equal (top, View.FindDeepestView (top, 14, 3));
         
         // view
         Assert.Equal (new Point (-7, -5), view.ScreenToFrame (0, 0));
-        screen = view.Margin.BoundsToScreen (new (-6, -4, 0, 0));
+        screen = view.Margin.ViewportToScreen (new (-6, -4, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.Border.BoundsToScreen (new (-6, -4, 0, 0));
+        screen = view.Border.ViewportToScreen (new (-6, -4, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.Padding.BoundsToScreen (new (-6, -4, 0, 0));
+        screen = view.Padding.ViewportToScreen (new (-6, -4, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
-        screen = view.BoundsToScreen (new (-6, -4, 0, 0));
+        screen = view.ViewportToScreen (new (-6, -4, 0, 0));
         Assert.Equal (1, screen.X);
         Assert.Equal (1, screen.Y);
         Assert.Null (View.FindDeepestView (top, 1, 1));
         Assert.Equal (new Point (-4, -3), view.ScreenToFrame (3, 2));
-        screen = view.BoundsToScreen (new (-3, -2, 0, 0));
+        screen = view.ViewportToScreen (new (-3, -2, 0, 0));
         Assert.Equal (4, screen.X);
         Assert.Equal (3, screen.Y);
         Assert.Equal (top, View.FindDeepestView (top, 4, 3));
         Assert.Equal (new Point (-1, -1), view.ScreenToFrame (6, 4));
-        screen = view.BoundsToScreen (new (0, 0, 0, 0));
+        screen = view.ViewportToScreen (new (0, 0, 0, 0));
         Assert.Equal (7, screen.X);
         Assert.Equal (5, screen.Y);
         Assert.Equal (view, View.FindDeepestView (top, 7, 5));
         Assert.Equal (new Point (6, -1), view.ScreenToFrame (13, 4));
-        screen = view.BoundsToScreen (new (7, 0, 0, 0));
+        screen = view.ViewportToScreen (new (7, 0, 0, 0));
         Assert.Equal (14, screen.X);
         Assert.Equal (5, screen.Y);
         Assert.Equal (view, View.FindDeepestView (top, 14, 5));
         Assert.Equal (new Point (7, -2), view.ScreenToFrame (14, 3));
-        screen = view.BoundsToScreen (new (8, -1, 0, 0));
+        screen = view.ViewportToScreen (new (8, -1, 0, 0));
         Assert.Equal (15, screen.X);
         Assert.Equal (4, screen.Y);
         Assert.Equal (top, View.FindDeepestView (top, 15, 4));
         Assert.Equal (new Point (16, -2), view.ScreenToFrame (23, 3));
-        screen = view.BoundsToScreen (new (17, -1, 0, 0));
+        screen = view.ViewportToScreen (new (17, -1, 0, 0));
         Assert.Equal (24, screen.X);
         Assert.Equal (4, screen.Y);
         Assert.Null (View.FindDeepestView (top, 24, 4));

+ 1 - 1
UnitTests/Views/ToplevelTests.cs

@@ -1805,7 +1805,7 @@ public class ToplevelTests
 
         btnPopup.Accept += (s, e) =>
                             {
-                                Rectangle viewToScreen = btnPopup.BoundsToScreen (top.Frame);
+                                Rectangle viewToScreen = btnPopup.ViewportToScreen (top.Frame);
 
                                 var viewAddedToTop = new View
                                 {