diff --git a/Terminal.Gui/Application.cs b/Terminal.Gui/Application.cs index 94cfb8154..e84ae835c 100644 --- a/Terminal.Gui/Application.cs +++ b/Terminal.Gui/Application.cs @@ -296,7 +296,7 @@ public static partial class Application Current = Top; // Ensure Top's layout is up to date. - Current.SetRelativeLayout (Driver.Bounds); + Current.SetRelativeLayout (Driver.Viewport); SupportedCultures = GetSupportedCultures (); _mainThreadId = Thread.CurrentThread.ManagedThreadId; @@ -487,7 +487,7 @@ public static partial class Application } //if (Toplevel.LayoutStyle == LayoutStyle.Computed) { - Toplevel.SetRelativeLayout (Driver.Bounds); + Toplevel.SetRelativeLayout (Driver.Viewport); //} @@ -1408,7 +1408,7 @@ public static partial class Application if (MouseGrabView is { }) { // If the mouse is grabbed, send the event to the view that grabbed it. - // The coordinates are relative to the Bounds of the view that grabbed the mouse. + // The coordinates are relative to the Viewport of the view that grabbed the mouse. Point frameLoc = MouseGrabView.ScreenToFrame (a.MouseEvent.X, a.MouseEvent.Y); var viewRelativeMouseEvent = new MouseEvent diff --git a/Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs b/Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs index 2a80f3473..42db87187 100644 --- a/Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs +++ b/Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs @@ -19,7 +19,7 @@ public abstract class ConsoleDriver internal bool [] _dirtyLines; /// Gets the dimensions of the terminal. - public Rectangle Bounds => new (0, 0, Cols, Rows); + public Rectangle Viewport => new (0, 0, Cols, Rows); /// /// Gets or sets the clip rectangle that and are subject diff --git a/Terminal.Gui/Drawing/LineCanvas.cs b/Terminal.Gui/Drawing/LineCanvas.cs index 6fe985852..fb9167ec5 100644 --- a/Terminal.Gui/Drawing/LineCanvas.cs +++ b/Terminal.Gui/Drawing/LineCanvas.cs @@ -67,7 +67,7 @@ public class LineCanvas : IDisposable /// Gets the rectangle that describes the bounds of the canvas. Location is the coordinates of the line that is /// furthest left/top and Size is defined by the line that extends the furthest right/bottom. /// - public Rectangle Bounds + public Rectangle Viewport { get { @@ -78,11 +78,11 @@ public class LineCanvas : IDisposable return _cachedBounds; } - Rectangle bounds = _lines [0].Bounds; + Rectangle bounds = _lines [0].Viewport; for (var i = 1; i < _lines.Count; i++) { - bounds = Rectangle.Union (bounds, _lines [i].Bounds); + bounds = Rectangle.Union (bounds, _lines [i].Viewport); } if (bounds is {Width: 0} or {Height: 0}) @@ -170,9 +170,9 @@ public class LineCanvas : IDisposable Dictionary map = new (); // walk through each pixel of the bitmap - for (int y = Bounds.Y; y < Bounds.Y + Bounds.Height; y++) + for (int y = Viewport.Y; y < Viewport.Y + Viewport.Height; y++) { - for (int x = Bounds.X; x < Bounds.X + Bounds.Width; x++) + for (int x = Viewport.X; x < Viewport.X + Viewport.Width; x++) { IntersectionDefinition? [] intersects = _lines .Select (l => l.Intersects (x, y)) @@ -232,7 +232,7 @@ public class LineCanvas : IDisposable /// intersection symbols. /// /// A map of all the points within the canvas. - public Dictionary GetMap () { return GetMap (Bounds); } + public Dictionary GetMap () { return GetMap (Viewport); } /// Merges one line canvas into this one. /// @@ -260,13 +260,13 @@ public class LineCanvas : IDisposable /// /// Returns the contents of the line canvas rendered to a string. The string will include all columns and rows, - /// even if has negative coordinates. For example, if the canvas contains a single line that + /// even if has negative coordinates. For example, if the canvas contains a single line that /// starts at (-1,-1) with a length of 2, the rendered string will have a length of 2. /// /// The canvas rendered to a string. public override string ToString () { - if (Bounds.IsEmpty) + if (Viewport.IsEmpty) { return string.Empty; } @@ -275,13 +275,13 @@ public class LineCanvas : IDisposable Dictionary runeMap = GetMap (); // Create the rune canvas - Rune [,] canvas = new Rune [Bounds.Height, Bounds.Width]; + Rune [,] canvas = new Rune [Viewport.Height, Viewport.Width]; // Copy the rune map to the canvas, adjusting for any negative coordinates foreach (KeyValuePair kvp in runeMap) { - int x = kvp.Key.X - Bounds.X; - int y = kvp.Key.Y - Bounds.Y; + int x = kvp.Key.X - Viewport.X; + int y = kvp.Key.Y - Viewport.Y; canvas [y, x] = kvp.Value; } diff --git a/Terminal.Gui/Drawing/StraightLine.cs b/Terminal.Gui/Drawing/StraightLine.cs index 1dd7b803c..9a2785f0f 100644 --- a/Terminal.Gui/Drawing/StraightLine.cs +++ b/Terminal.Gui/Drawing/StraightLine.cs @@ -45,8 +45,8 @@ public class StraightLine /// Gets the rectangle that describes the bounds of the canvas. Location is the coordinates of the line that is /// furthest left/top and Size is defined by the line that extends the furthest right/bottom. /// - // PERF: Probably better to store the rectangle rather than make a new one on every single access to Bounds. - internal Rectangle Bounds + // PERF: Probably better to store the rectangle rather than make a new one on every single access to Viewport. + internal Rectangle Viewport { get { diff --git a/Terminal.Gui/View/Adornment/Adornment.cs b/Terminal.Gui/View/Adornment/Adornment.cs index 74348cfee..785f72782 100644 --- a/Terminal.Gui/View/Adornment/Adornment.cs +++ b/Terminal.Gui/View/Adornment/Adornment.cs @@ -112,7 +112,7 @@ public class Adornment : View public override Rectangle Viewport { get => Frame with { Location = Point.Empty }; - set => throw new InvalidOperationException ("It makes no sense to set Bounds of a Thickness."); + set => throw new InvalidOperationException ("It makes no sense to set Viewport of a Thickness."); } /// diff --git a/Terminal.Gui/View/Layout/ViewLayout.cs b/Terminal.Gui/View/Layout/ViewLayout.cs index 18ab7c563..057dcf56c 100644 --- a/Terminal.Gui/View/Layout/ViewLayout.cs +++ b/Terminal.Gui/View/Layout/ViewLayout.cs @@ -284,7 +284,7 @@ public partial class View #endregion Frame - #region Bounds + #region Viewport /// /// The bounds represent the View-relative rectangle used for this view; the area inside the view where @@ -293,16 +293,16 @@ public partial class View /// The rectangle describing the location and size of the area where the views' subviews and content are drawn. /// /// - /// If is the value of Bounds is indeterminate until + /// If is the value of Viewport is indeterminate until /// the view has been initialized ( is true) and has been /// called. /// /// - /// Updates to the Bounds updates , and has the same effect as updating the + /// Updates to the Viewport updates , and has the same effect as updating the /// . /// /// - /// Altering the Bounds will eventually (when the view is next laid out) cause the + /// Altering the Viewport will eventually (when the view is next laid out) cause the /// and methods to be called. /// /// @@ -319,7 +319,7 @@ public partial class View if (LayoutStyle == LayoutStyle.Computed && !IsInitialized) { Debug.WriteLine ( - $"WARNING: Bounds is being accessed before the View has been initialized. This is likely a bug in {this}" + $"WARNING: Viewport is being accessed before the View has been initialized. This is likely a bug in {this}" ); } #endif // DEBUG @@ -341,13 +341,13 @@ public partial class View } set { - // TODO: Should we enforce Bounds.X/Y == 0? The code currently ignores value.X/Y which is + // TODO: Should we enforce Viewport.X/Y == 0? The code currently ignores value.X/Y which is // TODO: correct behavior, but is silent. Perhaps an exception? #if DEBUG if (value.Location != Point.Empty) { Debug.WriteLine ( - $"WARNING: Bounds.Location must always be 0,0. Location ({value.Location}) is ignored. {this}" + $"WARNING: Viewport.Location must always be 0,0. Location ({value.Location}) is ignored. {this}" ); } #endif // DEBUG @@ -365,7 +365,7 @@ public partial class View /// Converts a -relative rectangle to a screen-relative rectangle. public Rectangle BoundsToScreen (in Rectangle bounds) { - // Translate bounds to Frame (our SuperView's Bounds-relative coordinates) + // 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); @@ -387,12 +387,12 @@ public partial class View } /// - /// Helper to get the X and Y offset of the Bounds from the Frame. This is the sum of the Left and Top properties + /// 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 , and . /// public Point GetBoundsOffset () { return Padding is null ? Point.Empty : Padding.Thickness.GetInside (Padding.Frame).Location; } - #endregion Bounds + #endregion Viewport #region AutoSize @@ -573,7 +573,7 @@ public partial class View /// Resizes the View to fit the specified size. Factors in the HotKey. /// ResizeBoundsToFit can only be called when AutoSize is true (or being set to true). /// - /// whether the Bounds was changed or not + /// whether the Viewport was changed or not private bool ResizeBoundsToFit (Size size) { //if (AutoSize == false) { @@ -728,7 +728,7 @@ public partial class View #nullable restore /// - /// Gets a new location of the that is within the Bounds of the 's + /// Gets a new location of the that is within the Viewport of the 's /// (e.g. for dragging a Window). The `out` parameters are the new X and Y coordinates. /// /// @@ -765,7 +765,7 @@ public partial class View } else { - // Use the SuperView's Bounds, not Frame + // Use the SuperView's Viewport, not Frame maxDimension = viewToMove.SuperView.Viewport.Width; superView = viewToMove.SuperView; } @@ -972,11 +972,11 @@ public partial class View { // TODO: Identify a real-world use-case where this API should be virtual. // TODO: Until then leave it `internal` and non-virtual - // First try SuperView.Bounds, then Application.Top, then Driver.Bounds. + // First try SuperView.Viewport, then Application.Top, then Driver.Viewport. // Finally, if none of those are valid, use int.MaxValue (for Unit tests). Rectangle relativeBounds = SuperView is { IsInitialized: true } ? SuperView.Viewport : Application.Top is { } && Application.Top.IsInitialized ? Application.Top.Viewport : - Application.Driver?.Bounds ?? new Rectangle (0, 0, int.MaxValue, int.MaxValue); + Application.Driver?.Viewport ?? new Rectangle (0, 0, int.MaxValue, int.MaxValue); SetRelativeLayout (relativeBounds); // TODO: Determine what, if any of the below is actually needed here. @@ -1018,12 +1018,12 @@ public partial class View /// /// Applies the view's position (, ) and dimension (, and - /// ) to , given a rectangle describing the SuperView's Bounds (nominally the - /// same as this.SuperView.Bounds). + /// ) to , given a rectangle describing the SuperView's Viewport (nominally the + /// same as this.SuperView.Viewport). /// /// - /// The rectangle describing the SuperView's Bounds (nominally the same as - /// this.SuperView.Bounds). + /// The rectangle describing the SuperView's Viewport (nominally the same as + /// this.SuperView.Viewport). /// internal void SetRelativeLayout (Rectangle superviewBounds) { @@ -1047,7 +1047,7 @@ public partial class View // TODO: View.AutoSize stuff is removed. // Returns the new dimension (width or height) and location (x or y) for the View given - // the superview's Bounds + // the superview's Viewport // the current Pos (View.X or View.Y) // the current Dim (View.Width or View.Height) // This method is called recursively if pos is Pos.PosCombine diff --git a/Terminal.Gui/View/View.cs b/Terminal.Gui/View/View.cs index 84b30e3bd..a66fb19fc 100644 --- a/Terminal.Gui/View/View.cs +++ b/Terminal.Gui/View/View.cs @@ -234,7 +234,7 @@ public partial class View : Responder, ISupportInitializeNotification // TODO: Move these into ViewText.cs as EndInit_Text() to consolodate. // TODO: Verify UpdateTextDirection really needs to be called here. - // These calls were moved from BeginInit as they access Bounds 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); UpdateTextFormatterText (); OnResizeNeeded (); diff --git a/Terminal.Gui/View/ViewDrawing.cs b/Terminal.Gui/View/ViewDrawing.cs index 0107ca1ad..284db73c6 100644 --- a/Terminal.Gui/View/ViewDrawing.cs +++ b/Terminal.Gui/View/ViewDrawing.cs @@ -86,7 +86,7 @@ public partial class View /// Clears the specified -relative rectangle with the normal background. /// - /// The Bounds-relative rectangle to clear. + /// The Viewport-relative rectangle to clear. public void Clear (Rectangle contentArea) { if (Driver is null) @@ -141,7 +141,7 @@ public partial class View /// /// /// Overrides of must ensure they do not set Driver.Clip to a clip - /// region larger than the property, as this will cause the driver to clip the entire region. + /// region larger than the property, as this will cause the driver to clip the entire region. /// /// public void Draw () @@ -443,7 +443,7 @@ public partial class View } // If we have a SuperView, it'll render our frames. - if (!SuperViewRendersLineCanvas && LineCanvas.Bounds != Rectangle.Empty) + if (!SuperViewRendersLineCanvas && LineCanvas.Viewport != Rectangle.Empty) { foreach (KeyValuePair p in LineCanvas.GetCellMap ()) { @@ -501,7 +501,7 @@ public partial class View /// If the view has not been initialized ( is ), the area to be /// redrawn will be the . /// - /// The Bounds-relative region that needs to be redrawn. + /// The Viewport-relative region that needs to be redrawn. public virtual void SetNeedsDisplay (Rectangle region) { if (!IsInitialized) diff --git a/Terminal.Gui/View/ViewText.cs b/Terminal.Gui/View/ViewText.cs index 911f72938..7292afef5 100644 --- a/Terminal.Gui/View/ViewText.cs +++ b/Terminal.Gui/View/ViewText.cs @@ -304,12 +304,12 @@ public partial class View throw new InvalidOperationException ("SetFrameToFitText can only be called when AutoSize is true"); } - // BUGBUG: This API is broken - should not assume Frame.Height == Bounds.Height + // BUGBUG: This API is broken - should not assume Frame.Height == Viewport.Height // // Gets the minimum dimensions required to fit the View's , factoring in . // // The minimum dimensions required. - // if the dimensions fit within the View's , otherwise. + // if the dimensions fit within the View's , otherwise. // // Always returns if is or // if (Horizontal) or (Vertical) are not not set or zero. @@ -336,7 +336,7 @@ public partial class View case true: int colWidth = TextFormatter.GetWidestLineLength (new List { TextFormatter.Text }, 0, 1); - // TODO: v2 - This uses frame.Width; it should only use Bounds + // TODO: v2 - This uses frame.Width; it should only use Viewport if (_frame.Width < colWidth && (Width is null || (Viewport.Width >= 0 && Width is Dim.DimAbsolute && Width.Anchor (0) >= 0 && Width.Anchor (0) < colWidth))) { diff --git a/Terminal.Gui/Views/FileDialog.cs b/Terminal.Gui/Views/FileDialog.cs index 118e4437d..88686ca27 100644 --- a/Terminal.Gui/Views/FileDialog.cs +++ b/Terminal.Gui/Views/FileDialog.cs @@ -778,7 +778,7 @@ public class FileDialog : Dialog - _btnCancel.Viewport.Width - 1 - // TODO: Fiddle factor, seems the Bounds are wrong for someone + // TODO: Fiddle factor, seems the Viewport are wrong for someone - 2; } diff --git a/Terminal.Gui/Views/GraphView/Annotations.cs b/Terminal.Gui/Views/GraphView/Annotations.cs index 25d2d0203..30247d4a6 100644 --- a/Terminal.Gui/Views/GraphView/Annotations.cs +++ b/Terminal.Gui/Views/GraphView/Annotations.cs @@ -62,7 +62,7 @@ public class TextAnnotation : IAnnotation /// /// Draws the at the given coordinates with truncation to avoid spilling over - /// of the + /// of the /// /// /// Screen x position to start drawing string diff --git a/Terminal.Gui/Views/HexView.cs b/Terminal.Gui/Views/HexView.cs index 5f994a4ce..c66a040ca 100644 --- a/Terminal.Gui/Views/HexView.cs +++ b/Terminal.Gui/Views/HexView.cs @@ -264,7 +264,7 @@ public class HexView : View /// protected internal override bool OnMouseEvent (MouseEvent me) { - // BUGBUG: Test this with a border! Assumes Frame == Bounds! + // BUGBUG: Test this with a border! Assumes Frame == Viewport! if (!me.Flags.HasFlag (MouseFlags.Button1Clicked) && !me.Flags.HasFlag (MouseFlags.Button1DoubleClicked) @@ -358,7 +358,7 @@ public class HexView : View Driver.SetAttribute (current); Move (0, 0); - // BUGBUG: Bounds!!!! + // BUGBUG: Viewport!!!! Rectangle frame = Frame; int nblocks = bytesPerLine / bsize; @@ -619,7 +619,7 @@ public class HexView : View private bool MoveDown (int bytes) { - // BUGBUG: Bounds! + // BUGBUG: Viewport! RedisplayLine (position); if (position + bytes < source.Length) @@ -657,7 +657,7 @@ public class HexView : View { position = source.Length; - // BUGBUG: Bounds! + // BUGBUG: Viewport! if (position >= DisplayStart + bytesPerLine * Frame.Height) { SetDisplayStart (position); @@ -744,7 +744,7 @@ public class HexView : View position++; } - // BUGBUG: Bounds! + // BUGBUG: Viewport! if (position >= DisplayStart + bytesPerLine * Frame.Height) { SetDisplayStart (DisplayStart + bytesPerLine); @@ -793,7 +793,7 @@ public class HexView : View var delta = (int)(pos - DisplayStart); int line = delta / bytesPerLine; - // BUGBUG: Bounds! + // BUGBUG: Viewport! SetNeedsDisplay (new (0, line, Frame.Width, 1)); } diff --git a/Terminal.Gui/Views/Menu/ContextMenu.cs b/Terminal.Gui/Views/Menu/ContextMenu.cs index f9ee4625f..4fa133164 100644 --- a/Terminal.Gui/Views/Menu/ContextMenu.cs +++ b/Terminal.Gui/Views/Menu/ContextMenu.cs @@ -142,7 +142,7 @@ public sealed class ContextMenu : IDisposable _container = Application.Current; _container.Closing += Container_Closing; - Rectangle frame = Application.Driver.Bounds; + Rectangle frame = Application.Driver.Viewport; Point position = Position; if (Host is { }) diff --git a/Terminal.Gui/Views/Menu/MenuBar.cs b/Terminal.Gui/Views/Menu/MenuBar.cs index ca18c4426..1abe33e82 100644 --- a/Terminal.Gui/Views/Menu/MenuBar.cs +++ b/Terminal.Gui/Views/Menu/MenuBar.cs @@ -825,7 +825,7 @@ public class MenuBar : View return Point.Empty; } - Rectangle superViewFrame = SuperView is null ? Driver.Bounds : SuperView.Frame; + Rectangle superViewFrame = SuperView is null ? Driver.Viewport : SuperView.Frame; View sv = SuperView is null ? Application.Current : SuperView; Point boundsOffset = sv.GetBoundsOffset (); @@ -842,7 +842,7 @@ public class MenuBar : View /// The location offset. internal Point GetScreenOffsetFromCurrent () { - Rectangle screen = Driver.Bounds; + Rectangle screen = Driver.Viewport; Rectangle currentFrame = Application.Current.Frame; Point boundsOffset = Application.Top.GetBoundsOffset (); diff --git a/Terminal.Gui/Views/ProgressBar.cs b/Terminal.Gui/Views/ProgressBar.cs index 860987299..65bbb616a 100644 --- a/Terminal.Gui/Views/ProgressBar.cs +++ b/Terminal.Gui/Views/ProgressBar.cs @@ -291,7 +291,7 @@ public class ProgressBar : View private void SetInitialProperties () { - Height = 1; // This will be updated when Bounds is updated in ProgressBar_LayoutStarted + Height = 1; // This will be updated when Viewport is updated in ProgressBar_LayoutStarted CanFocus = false; _fraction = 0; LayoutStarted += ProgressBar_LayoutStarted; diff --git a/Terminal.Gui/Views/Slider.cs b/Terminal.Gui/Views/Slider.cs index 08a481554..b0ebaa30e 100644 --- a/Terminal.Gui/Views/Slider.cs +++ b/Terminal.Gui/Views/Slider.cs @@ -374,7 +374,7 @@ public class Slider : View } /// - /// If the slider will be sized to fit the available space (the Bounds of the the + /// If the slider will be sized to fit the available space (the Viewport of the the /// SuperView). /// /// @@ -663,10 +663,10 @@ public class Slider : View if (AutoSize) { - // Max size is SuperView's Bounds. Min Size is size that will fit. + // Max size is SuperView's Viewport. Min Size is size that will fit. if (SuperView is { }) { - // Calculate the size of the slider based on the size of the SuperView's Bounds. + // Calculate the size of the slider based on the size of the SuperView's Viewport. if (_config._sliderOrientation == Orientation.Horizontal) { size = int.Min (SuperView.Viewport.Width, CalcBestLength ()); @@ -686,7 +686,7 @@ public class Slider : View } else { - // Fit Slider to the Bounds + // Fit Slider to the Viewport if (_config._sliderOrientation == Orientation.Horizontal) { size = Viewport.Width; diff --git a/Terminal.Gui/Views/TextField.cs b/Terminal.Gui/Views/TextField.cs index 1d9d0fd2c..e3e0f56f1 100644 --- a/Terminal.Gui/Views/TextField.cs +++ b/Terminal.Gui/Views/TextField.cs @@ -1746,7 +1746,7 @@ public class TextField : View } } - // BUGBUG: This assumes Frame == Bounds. It's also not clear what the intention is. For now, changed to always return 0. + // BUGBUG: This assumes Frame == Viewport. It's also not clear what the intention is. For now, changed to always return 0. private int OffSetBackground () { var offB = 0; diff --git a/Terminal.Gui/Views/Toplevel.cs b/Terminal.Gui/Views/Toplevel.cs index 60f264984..2201e43c5 100644 --- a/Terminal.Gui/Views/Toplevel.cs +++ b/Terminal.Gui/Views/Toplevel.cs @@ -297,7 +297,7 @@ public partial class Toplevel : View // This is causing the menus drawn incorrectly if UseSubMenusSingleFrame is true //if (this.MenuBar is { } && this.MenuBar.IsMenuOpen && this.MenuBar.openMenu is { }) { // // TODO: Hack until we can get compositing working right. - // this.MenuBar.openMenu.Redraw (this.MenuBar.openMenu.Bounds); + // this.MenuBar.openMenu.Redraw (this.MenuBar.openMenu.Viewport); //} } } diff --git a/UICatalog/Scenarios/Buttons.cs b/UICatalog/Scenarios/Buttons.cs index 90797c851..afe6aac3a 100644 --- a/UICatalog/Scenarios/Buttons.cs +++ b/UICatalog/Scenarios/Buttons.cs @@ -48,7 +48,7 @@ public class Buttons : Scenario View prev = colorButtonsLabel; - //With this method there is no need to call Application.TopReady += () => Application.TopRedraw (Top.Bounds); + //With this method there is no need to call Application.TopReady += () => Application.TopRedraw (Top.Viewport); Pos x = Pos.Right (colorButtonsLabel) + 2; foreach (KeyValuePair colorScheme in Colors.ColorSchemes) diff --git a/UICatalog/Scenarios/CharacterMap.cs b/UICatalog/Scenarios/CharacterMap.cs index fa90d8539..424de7882 100644 --- a/UICatalog/Scenarios/CharacterMap.cs +++ b/UICatalog/Scenarios/CharacterMap.cs @@ -529,21 +529,21 @@ internal class CharMap : ScrollView //if (ShowHorizontalScrollIndicator && ContentSize.Height < (int)(MaxCodePoint / 16 + 2)) { // //ContentSize = new (CharMap.RowWidth, (int)(MaxCodePoint / 16 + 2)); // //ContentSize = new (CharMap.RowWidth, (int)(MaxCodePoint / 16) * _rowHeight + 2); - // var width = (Bounds.Width / COLUMN_WIDTH * COLUMN_WIDTH) - (ShowVerticalScrollIndicator ? RowLabelWidth + 1 : RowLabelWidth); + // var width = (Viewport.Width / COLUMN_WIDTH * COLUMN_WIDTH) - (ShowVerticalScrollIndicator ? RowLabelWidth + 1 : RowLabelWidth); // if (Cursor.X + ContentOffset.X >= width) { // // Snap to the selected glyph. // ContentOffset = new ( // Math.Min (Cursor.X, Cursor.X - width + COLUMN_WIDTH), - // ContentOffset.Y == -ContentSize.Height + Bounds.Height ? ContentOffset.Y - 1 : ContentOffset.Y); + // ContentOffset.Y == -ContentSize.Height + Viewport.Height ? ContentOffset.Y - 1 : ContentOffset.Y); // } else { // ContentOffset = new ( // ContentOffset.X - Cursor.X, - // ContentOffset.Y == -ContentSize.Height + Bounds.Height ? ContentOffset.Y - 1 : ContentOffset.Y); + // ContentOffset.Y == -ContentSize.Height + Viewport.Height ? ContentOffset.Y - 1 : ContentOffset.Y); // } //} else if (!ShowHorizontalScrollIndicator && ContentSize.Height > (int)(MaxCodePoint / 16 + 1)) { // //ContentSize = new (CharMap.RowWidth, (int)(MaxCodePoint / 16 + 1)); // // Snap 1st column into view if it's been scrolled horizontally - // ContentOffset = new (0, ContentOffset.Y < -ContentSize.Height + Bounds.Height ? ContentOffset.Y - 1 : ContentOffset.Y); + // ContentOffset = new (0, ContentOffset.Y < -ContentSize.Height + Viewport.Height ? ContentOffset.Y - 1 : ContentOffset.Y); //} base.OnDrawContent (contentArea); } diff --git a/UICatalog/Scenarios/ViewExperiments.cs b/UICatalog/Scenarios/ViewExperiments.cs index 159dd7587..8fe1a5503 100644 --- a/UICatalog/Scenarios/ViewExperiments.cs +++ b/UICatalog/Scenarios/ViewExperiments.cs @@ -217,17 +217,17 @@ public class ViewExperiments : Scenario containerLabel.Text = $"Container.Frame: { Application.Top.Frame - } .Bounds: { + } .Viewport: { Application.Top.Viewport }\nView.Frame: { view.Frame - } .Bounds: { + } .Viewport: { view.Viewport } .BoundsOffset: { view.GetBoundsOffset () }\n .Padding.Frame: { view.Padding.Frame - } .Padding.Bounds: { + } .Padding.Viewport: { view.Padding.Viewport }"; }; diff --git a/UnitTests/Application/MouseTests.cs b/UnitTests/Application/MouseTests.cs index 8c0791070..0d64503b6 100644 --- a/UnitTests/Application/MouseTests.cs +++ b/UnitTests/Application/MouseTests.cs @@ -61,7 +61,7 @@ public class MouseTests /// /// Tests that the mouse coordinates passed to the focused view are correct when the mouse is clicked. No adornments; - /// Frame == Bounds + /// Frame == Viewport /// [Theory] [AutoInitShutdown] @@ -134,7 +134,7 @@ public class MouseTests /// /// Tests that the mouse coordinates passed to the focused view are correct when the mouse is clicked. With - /// Frames; Frame != Bounds + /// Frames; Frame != Viewport /// [AutoInitShutdown] [Theory] @@ -206,7 +206,7 @@ public class MouseTests var view = new View { X = pos.X, Y = pos.Y, Width = size.Width, Height = size.Height }; - // Give the view a border. With PR #2920, mouse clicks are only passed if they are inside the view's Bounds. + // Give the view a border. With PR #2920, mouse clicks are only passed if they are inside the view's Viewport. view.BorderStyle = LineStyle.Single; view.CanFocus = true; diff --git a/UnitTests/Drawing/LineCanvasTests.cs b/UnitTests/Drawing/LineCanvasTests.cs index 35968090b..c386fdcc8 100644 --- a/UnitTests/Drawing/LineCanvasTests.cs +++ b/UnitTests/Drawing/LineCanvasTests.cs @@ -380,7 +380,7 @@ public class LineCanvasTests canvas.AddLine (new Point (x, y), length, Orientation.Horizontal, LineStyle.Single); canvas.AddLine (new Point (x, y), length, Orientation.Vertical, LineStyle.Single); - Assert.Equal (new Rectangle (expectedX, expectedY, expectedWidth, expectedHeight), canvas.Bounds); + Assert.Equal (new Rectangle (expectedX, expectedY, expectedWidth, expectedHeight), canvas.Viewport); } [InlineData ( @@ -461,7 +461,7 @@ public class LineCanvasTests var canvas = new LineCanvas (); canvas.AddLine (new Point (x, y), length, Orientation.Horizontal, LineStyle.Single); - Assert.Equal (new Rectangle (expectedX, expectedY, expectedWidth, expectedHeight), canvas.Bounds); + Assert.Equal (new Rectangle (expectedX, expectedY, expectedWidth, expectedHeight), canvas.Viewport); } [Fact] @@ -483,27 +483,27 @@ public class LineCanvasTests // Add a short horiz line for ╔╡ lc.AddLine (new Point (x, y), 2, Orientation.Horizontal, LineStyle.Double); - Assert.Equal (new Rectangle (x, y, 2, 1), lc.Bounds); + Assert.Equal (new Rectangle (x, y, 2, 1), lc.Viewport); //LHS line down lc.AddLine (new Point (x, y), height, Orientation.Vertical, LineStyle.Double); - Assert.Equal (new Rectangle (x, y, 2, 2), lc.Bounds); + Assert.Equal (new Rectangle (x, y, 2, 2), lc.Viewport); //Vertical line before Title, results in a ╡ lc.AddLine (new Point (x + 1, y), 0, Orientation.Vertical, LineStyle.Single); - Assert.Equal (new Rectangle (x, y, 2, 2), lc.Bounds); + Assert.Equal (new Rectangle (x, y, 2, 2), lc.Viewport); //Vertical line after Title, results in a ╞ lc.AddLine (new Point (x + 2, y), 0, Orientation.Vertical, LineStyle.Single); - Assert.Equal (new Rectangle (x, y, 3, 2), lc.Bounds); + Assert.Equal (new Rectangle (x, y, 3, 2), lc.Viewport); // remainder of top line lc.AddLine (new Point (x + 2, y), width - 1, Orientation.Horizontal, LineStyle.Double); - Assert.Equal (new Rectangle (x, y, 4, 2), lc.Bounds); + Assert.Equal (new Rectangle (x, y, 4, 2), lc.Viewport); //RHS line down lc.AddLine (new Point (x + width, y), height, Orientation.Vertical, LineStyle.Double); - Assert.Equal (new Rectangle (x, y, 4, 2), lc.Bounds); + Assert.Equal (new Rectangle (x, y, 4, 2), lc.Viewport); TestHelpers.AssertEqual ( output, @@ -533,27 +533,27 @@ public class LineCanvasTests // Add a short horiz line for ╔╡ lc.AddLine (new Point (x, y), 2, Orientation.Horizontal, LineStyle.Double); - Assert.Equal (new Rectangle (x, y, 2, 1), lc.Bounds); + Assert.Equal (new Rectangle (x, y, 2, 1), lc.Viewport); //LHS line down lc.AddLine (new Point (x, y), height, Orientation.Vertical, LineStyle.Double); - Assert.Equal (new Rectangle (x, y, 2, 2), lc.Bounds); + Assert.Equal (new Rectangle (x, y, 2, 2), lc.Viewport); //Vertical line before Title, results in a ╡ lc.AddLine (new Point (x + 1, y), 0, Orientation.Vertical, LineStyle.Single); - Assert.Equal (new Rectangle (x, y, 2, 2), lc.Bounds); + Assert.Equal (new Rectangle (x, y, 2, 2), lc.Viewport); //Vertical line after Title, results in a ╞ lc.AddLine (new Point (x + 2, y), 0, Orientation.Vertical, LineStyle.Single); - Assert.Equal (new Rectangle (x, y, 3, 2), lc.Bounds); + Assert.Equal (new Rectangle (x, y, 3, 2), lc.Viewport); // remainder of top line lc.AddLine (new Point (x + 2, y), width - 1, Orientation.Horizontal, LineStyle.Double); - Assert.Equal (new Rectangle (x, y, 4, 2), lc.Bounds); + Assert.Equal (new Rectangle (x, y, 4, 2), lc.Viewport); //RHS line down lc.AddLine (new Point (x + width, y), height, Orientation.Vertical, LineStyle.Double); - Assert.Equal (new Rectangle (x, y, 4, 2), lc.Bounds); + Assert.Equal (new Rectangle (x, y, 4, 2), lc.Viewport); TestHelpers.AssertEqual ( output, @@ -570,13 +570,13 @@ public class LineCanvasTests { var lc = new LineCanvas (); - Assert.Equal (Rectangle.Empty, lc.Bounds); + Assert.Equal (Rectangle.Empty, lc.Viewport); lc.AddLine (Point.Empty, 2, Orientation.Horizontal, LineStyle.Double); - Assert.NotEqual (Rectangle.Empty, lc.Bounds); + Assert.NotEqual (Rectangle.Empty, lc.Viewport); lc.Clear (); - Assert.Equal (Rectangle.Empty, lc.Bounds); + Assert.Equal (Rectangle.Empty, lc.Viewport); } [InlineData (0, 0, Orientation.Horizontal, "─")] @@ -873,7 +873,7 @@ public class LineCanvasTests //// Left Up //canvas.AddLine (new Point (0, 3), -3, Orientation.Vertical, LineStyle.Single); - Assert.Equal (new Rectangle (0, 0, 2, 2), canvas.Bounds); + Assert.Equal (new Rectangle (0, 0, 2, 2), canvas.Viewport); Dictionary map = canvas.GetMap (); Assert.Equal (2, map.Count); diff --git a/UnitTests/Drawing/StraightLineTests.cs b/UnitTests/Drawing/StraightLineTests.cs index 1745c6286..bb6870821 100644 --- a/UnitTests/Drawing/StraightLineTests.cs +++ b/UnitTests/Drawing/StraightLineTests.cs @@ -309,7 +309,7 @@ public class StraightLineTests )] [Theory] [SetupFakeDriver] - public void Bounds ( + public void Viewport ( Orientation orientation, int x, int y, @@ -322,6 +322,6 @@ public class StraightLineTests { var sl = new StraightLine (new Point (x, y), length, orientation, LineStyle.Single); - Assert.Equal (new Rectangle (expectedX, expectedY, expectedWidth, expectedHeight), sl.Bounds); + Assert.Equal (new Rectangle (expectedX, expectedY, expectedWidth, expectedHeight), sl.Viewport); } } diff --git a/UnitTests/View/Adornment/ToScreenTests.cs b/UnitTests/View/Adornment/ToScreenTests.cs index ddc5aa300..518b38f76 100644 --- a/UnitTests/View/Adornment/ToScreenTests.cs +++ b/UnitTests/View/Adornment/ToScreenTests.cs @@ -286,7 +286,7 @@ public class AdornmentToScreenTests (ITestOutputHelper output) view.Margin.Thickness = new (1); view.Border.Thickness = new (1); view.Padding.Thickness = new (1); - // Total thickness is 3 (view.Bounds will be Frame.Width - 6) + // Total thickness is 3 (view.Viewport will be Frame.Width - 6) view.Frame = frame; Assert.Equal(4, view.Viewport.Width); diff --git a/UnitTests/View/DrawTests.cs b/UnitTests/View/DrawTests.cs index 9b616ad7b..ad8c9ac73 100644 --- a/UnitTests/View/DrawTests.cs +++ b/UnitTests/View/DrawTests.cs @@ -232,7 +232,7 @@ public class DrawTests var view = new View { Width = 2, Height = 2, BorderStyle = LineStyle.Single }; view.BeginInit (); view.EndInit (); - view.SetRelativeLayout (Application.Driver.Bounds); + view.SetRelativeLayout (Application.Driver.Viewport); Assert.Equal (new (0,0,2,2), view.Frame); Assert.Equal (Rectangle.Empty, view.Viewport); @@ -257,7 +257,7 @@ public class DrawTests view.Border.Thickness = new Thickness (1, 1, 1, 0); view.BeginInit (); view.EndInit (); - view.SetRelativeLayout (Application.Driver.Bounds); + view.SetRelativeLayout (Application.Driver.Viewport); Assert.Equal (new (0,0,2,1), view.Frame); Assert.Equal (Rectangle.Empty, view.Viewport); @@ -275,7 +275,7 @@ public class DrawTests view.Border.Thickness = new Thickness (0, 1, 1, 1); view.BeginInit (); view.EndInit (); - view.SetRelativeLayout (Application.Driver.Bounds); + view.SetRelativeLayout (Application.Driver.Viewport); Assert.Equal (new (0,0,1,2), view.Frame); Assert.Equal (Rectangle.Empty, view.Viewport); @@ -300,7 +300,7 @@ public class DrawTests view.Border.Thickness = new Thickness (1, 1, 0, 1); view.BeginInit (); view.EndInit (); - view.SetRelativeLayout (Application.Driver.Bounds); + view.SetRelativeLayout (Application.Driver.Viewport); Assert.Equal (new (0,0,1,2), view.Frame); Assert.Equal (Rectangle.Empty, view.Viewport); @@ -326,7 +326,7 @@ public class DrawTests view.BeginInit (); view.EndInit (); - view.SetRelativeLayout (Application.Driver.Bounds); + view.SetRelativeLayout (Application.Driver.Viewport); Assert.Equal (new (0,0,2,1), view.Frame); Assert.Equal (Rectangle.Empty, view.Viewport); diff --git a/UnitTests/View/Layout/AbsoluteLayoutTests.cs b/UnitTests/View/Layout/AbsoluteLayoutTests.cs index 193670453..ef3cf21b9 100644 --- a/UnitTests/View/Layout/AbsoluteLayoutTests.cs +++ b/UnitTests/View/Layout/AbsoluteLayoutTests.cs @@ -32,7 +32,7 @@ public class AbsoluteLayoutTests Assert.Equal ( new Rectangle (0, 0, newFrame.Width, newFrame.Height), v.Viewport - ); // With Absolute Bounds *is* deterministic before Layout + ); // With Absolute Viewport *is* deterministic before Layout Assert.Equal (Pos.At (1), v.X); Assert.Equal (Pos.At (2), v.Y); Assert.Equal (Dim.Sized (30), v.Width); @@ -47,7 +47,7 @@ public class AbsoluteLayoutTests Assert.Equal ( new Rectangle (0, 0, newFrame.Width, newFrame.Height), v.Viewport - ); // With Absolute Bounds *is* deterministic before Layout + ); // With Absolute Viewport *is* deterministic before Layout Assert.Equal (Pos.At (1), v.X); Assert.Equal (Pos.At (2), v.Y); Assert.Equal (Dim.Sized (30), v.Width); @@ -63,7 +63,7 @@ public class AbsoluteLayoutTests Assert.Equal ( new Rectangle (0, 0, newFrame.Width, newFrame.Height), v.Viewport - ); // With Absolute Bounds *is* deterministic before Layout + ); // With Absolute Viewport *is* deterministic before Layout Assert.Equal (Pos.At (10), v.X); Assert.Equal (Pos.At (20), v.Y); Assert.Equal (Dim.Sized (30), v.Width); @@ -78,7 +78,7 @@ public class AbsoluteLayoutTests Assert.Equal ( new Rectangle (0, 0, newFrame.Width, newFrame.Height), v.Viewport - ); // With Absolute Bounds *is* deterministic before Layout + ); // With Absolute Viewport *is* deterministic before Layout Assert.Equal (Pos.At (10), v.X); Assert.Equal (Pos.At (20), v.Y); Assert.Equal (Dim.Sized (30), v.Width); @@ -102,7 +102,7 @@ public class AbsoluteLayoutTests Assert.Equal ( new Rectangle (0, 0, newFrame.Width, newFrame.Height), v.Viewport - ); // With Absolute Bounds *is* deterministic before Layout + ); // With Absolute Viewport *is* deterministic before Layout Assert.Equal (Pos.At (1), v.X); Assert.Equal (Pos.At (2), v.Y); Assert.Equal ($"Absolute({newFrame.Height})", v.Height.ToString ()); @@ -137,7 +137,7 @@ public class AbsoluteLayoutTests Assert.Equal ( new Rectangle (0, 0, newFrame.Width, newFrame.Height), v.Viewport - ); // With Absolute Bounds *is* deterministic before Layout + ); // With Absolute Viewport *is* deterministic before Layout Assert.Equal ($"Absolute({newFrame.X})", v.X.ToString ()); Assert.Equal ($"Absolute({newFrame.Y})", v.Y.ToString ()); Assert.Equal (Dim.Sized (3), v.Width); @@ -251,7 +251,7 @@ public class AbsoluteLayoutTests Assert.Equal ( new Rectangle (0, 0, frame.Width, frame.Height), v.Viewport - ); // With Absolute Bounds *is* deterministic before Layout + ); // With Absolute Viewport *is* deterministic before Layout Assert.Equal (Pos.At (0), v.X); Assert.Equal (Pos.At (0), v.Y); Assert.Equal (Dim.Sized (0), v.Width); @@ -266,7 +266,7 @@ public class AbsoluteLayoutTests Assert.Equal ( new Rectangle (0, 0, frame.Width, frame.Height), v.Viewport - ); // With Absolute Bounds *is* deterministic before Layout + ); // With Absolute Viewport *is* deterministic before Layout Assert.Equal (Pos.At (1), v.X); Assert.Equal (Pos.At (2), v.Y); Assert.Equal (Dim.Sized (3), v.Width); @@ -280,7 +280,7 @@ public class AbsoluteLayoutTests Assert.Equal ( new Rectangle (0, 0, frame.Width, frame.Height), v.Viewport - ); // With Absolute Bounds *is* deterministic before Layout + ); // With Absolute Viewport *is* deterministic before Layout Assert.Equal (Pos.At (1), v.X); Assert.Equal (Pos.At (2), v.Y); Assert.Equal (Dim.Sized (3), v.Width); @@ -294,7 +294,7 @@ public class AbsoluteLayoutTests // That is correct it should be 0,0 because AutoSize is false // and the size wasn't set on the initializer Assert.Equal (new Rectangle (frame.X, frame.Y, 0, 0), v.Frame); - Assert.Equal (new Rectangle (0, 0, 0, 0), v.Viewport); // With Absolute Bounds *is* deterministic before Layout + Assert.Equal (new Rectangle (0, 0, 0, 0), v.Viewport); // With Absolute Viewport *is* deterministic before Layout Assert.Equal (Pos.At (1), v.X); Assert.Equal (Pos.At (2), v.Y); Assert.Equal (Dim.Sized (0), v.Width); @@ -304,7 +304,7 @@ public class AbsoluteLayoutTests v = new View (); Assert.True (v.LayoutStyle == LayoutStyle.Absolute); Assert.Equal (new Rectangle (0, 0, 0, 0), v.Frame); - Assert.Equal (new Rectangle (0, 0, 0, 0), v.Viewport); // With Absolute Bounds *is* deterministic before Layout + Assert.Equal (new Rectangle (0, 0, 0, 0), v.Viewport); // With Absolute Viewport *is* deterministic before Layout Assert.Equal (Pos.At (0), v.X); Assert.Equal (Pos.At (0), v.Y); Assert.Equal (Dim.Sized (0), v.Width); @@ -314,7 +314,7 @@ public class AbsoluteLayoutTests v = new View { X = frame.X, Y = frame.Y, Width = frame.Width, Height = frame.Height }; Assert.True (v.LayoutStyle == LayoutStyle.Absolute); Assert.Equal (new Rectangle (frame.X, frame.Y, 3, 4), v.Frame); - Assert.Equal (new Rectangle (0, 0, 3, 4), v.Viewport); // With Absolute Bounds *is* deterministic before Layout + Assert.Equal (new Rectangle (0, 0, 3, 4), v.Viewport); // With Absolute Viewport *is* deterministic before Layout Assert.Equal (Pos.At (1), v.X); Assert.Equal (Pos.At (2), v.Y); Assert.Equal (Dim.Sized (3), v.Width); @@ -348,7 +348,7 @@ public class AbsoluteLayoutTests [Fact] public void AbsoluteLayout_Setting_Bounds_Location_NotEmpty () { - // TODO: Should we enforce Bounds.X/Y == 0? The code currently ignores value.X/Y which is + // TODO: Should we enforce Viewport.X/Y == 0? The code currently ignores value.X/Y which is // TODO: correct behavior, but is silent. Perhaps an exception? var frame = new Rectangle (1, 2, 3, 4); var newBounds = new Rectangle (10, 20, 30, 40); @@ -389,7 +389,7 @@ public class AbsoluteLayoutTests v.BorderStyle = LineStyle.Single; - // Bounds should shrink + // Viewport should shrink Assert.Equal (new Rectangle (0, 0, 1, 2), v.Viewport); // Frame should not change diff --git a/UnitTests/View/Layout/BoundsTests.cs b/UnitTests/View/Layout/BoundsTests.cs index 69bb1d87b..7af892b6c 100644 --- a/UnitTests/View/Layout/BoundsTests.cs +++ b/UnitTests/View/Layout/BoundsTests.cs @@ -4,7 +4,7 @@ namespace Terminal.Gui.ViewTests; /// /// Test the . -/// DOES NOT TEST Adornment.Bounds methods. Those are in ./Adornment/BoundsTests.cs +/// DOES NOT TEST Adornment.Viewport methods. Those are in ./Adornment/BoundsTests.cs /// /// public class BoundsTests (ITestOutputHelper output) diff --git a/UnitTests/View/Layout/DimTests.cs b/UnitTests/View/Layout/DimTests.cs index c700c6dbe..fc6801a82 100644 --- a/UnitTests/View/Layout/DimTests.cs +++ b/UnitTests/View/Layout/DimTests.cs @@ -669,7 +669,7 @@ public class DimTests #if DEBUG Assert.Equal ($"Combine(View(Width,Button(v1){v1.Frame})-View(Width,Button(v3){v3.Viewport}))", v5.Width.ToString ()); #else - Assert.Equal ($"Combine(View(Height,Button(){v1.Frame})-View(Height,Button(){v3.Bounds}))", v5.Height.ToString ( )); + Assert.Equal ($"Combine(View(Height,Button(){v1.Frame})-View(Height,Button(){v3.Viewport}))", v5.Height.ToString ( )); #endif Assert.Equal (38, v5.Frame.Width); // 47-9=38 Assert.Equal (80, v5.Frame.Height); // 89-9=80 diff --git a/UnitTests/View/Layout/PosTests.cs b/UnitTests/View/Layout/PosTests.cs index 5fb9cf782..b48f4210e 100644 --- a/UnitTests/View/Layout/PosTests.cs +++ b/UnitTests/View/Layout/PosTests.cs @@ -141,12 +141,12 @@ public class PosTests frame.Draw (); Assert.Equal (6, btn.Viewport.Width); - Assert.Equal (10, btn.Frame.X); // frame.Bounds.Width (16) - btn.Frame.Width (6) = 10 + Assert.Equal (10, btn.Frame.X); // frame.Viewport.Width (16) - btn.Frame.Width (6) = 10 Assert.Equal (0, btn.Frame.Y); Assert.Equal (6, btn.Frame.Width); Assert.Equal (1, btn.Frame.Height); - Assert.Equal (9, view.Viewport.Width); // frame.Bounds.Width (16) - Dim.Fill (1) - Dim.Function (6) = 9 + Assert.Equal (9, view.Viewport.Width); // frame.Viewport.Width (16) - Dim.Fill (1) - Dim.Function (6) = 9 Assert.Equal (0, view.Frame.X); Assert.Equal (0, view.Frame.Y); Assert.Equal (9, view.Frame.Width); diff --git a/UnitTests/View/SubviewTests.cs b/UnitTests/View/SubviewTests.cs index 0d7bff9fa..bde692a1f 100644 --- a/UnitTests/View/SubviewTests.cs +++ b/UnitTests/View/SubviewTests.cs @@ -82,12 +82,12 @@ public class SubviewTests { Application.Init (new FakeDriver ()); - var top = new Toplevel { Id = "0" }; // Frame: 0, 0, 80, 25; Bounds: 0, 0, 80, 25 + var top = new Toplevel { Id = "0" }; // Frame: 0, 0, 80, 25; Viewport: 0, 0, 80, 25 var winAddedToTop = new Window { Id = "t", Width = Dim.Fill (), Height = Dim.Fill () - }; // Frame: 0, 0, 80, 25; Bounds: 0, 0, 78, 23 + }; // Frame: 0, 0, 80, 25; Viewport: 0, 0, 78, 23 var v1AddedToWin = new View { @@ -159,37 +159,37 @@ public class SubviewTests { v1c++; - // Top.Frame: 0, 0, 80, 25; Top.Bounds: 0, 0, 80, 25 + // Top.Frame: 0, 0, 80, 25; Top.Viewport: 0, 0, 80, 25 // BUGBUG: This is wrong, it should be 78, 23. This test has always been broken. - // in no way should the v1AddedToWin.Frame be the same as the Top.Frame/Bounds + // in no way should the v1AddedToWin.Frame be the same as the Top.Frame/Viewport // as it is a subview of winAddedToTop, which has a border! - //Assert.Equal (top.Bounds.Width, v1AddedToWin.Frame.Width); - //Assert.Equal (top.Bounds.Height, v1AddedToWin.Frame.Height); + //Assert.Equal (top.Viewport.Width, v1AddedToWin.Frame.Width); + //Assert.Equal (top.Viewport.Height, v1AddedToWin.Frame.Height); }; v2AddedToWin.Initialized += (s, e) => { v2c++; - // Top.Frame: 0, 0, 80, 25; Top.Bounds: 0, 0, 80, 25 + // Top.Frame: 0, 0, 80, 25; Top.Viewport: 0, 0, 80, 25 // BUGBUG: This is wrong, it should be 78, 23. This test has always been broken. - // in no way should the v2AddedToWin.Frame be the same as the Top.Frame/Bounds + // in no way should the v2AddedToWin.Frame be the same as the Top.Frame/Viewport // as it is a subview of winAddedToTop, which has a border! - //Assert.Equal (top.Bounds.Width, v2AddedToWin.Frame.Width); - //Assert.Equal (top.Bounds.Height, v2AddedToWin.Frame.Height); + //Assert.Equal (top.Viewport.Width, v2AddedToWin.Frame.Width); + //Assert.Equal (top.Viewport.Height, v2AddedToWin.Frame.Height); }; svAddedTov1.Initialized += (s, e) => { sv1c++; - // Top.Frame: 0, 0, 80, 25; Top.Bounds: 0, 0, 80, 25 + // Top.Frame: 0, 0, 80, 25; Top.Viewport: 0, 0, 80, 25 // BUGBUG: This is wrong, it should be 78, 23. This test has always been broken. - // in no way should the svAddedTov1.Frame be the same as the Top.Frame/Bounds + // in no way should the svAddedTov1.Frame be the same as the Top.Frame/Viewport // because sv1AddedTov1 is a subview of v1AddedToWin, which is a subview of // winAddedToTop, which has a border! - //Assert.Equal (top.Bounds.Width, svAddedTov1.Frame.Width); - //Assert.Equal (top.Bounds.Height, svAddedTov1.Frame.Height); + //Assert.Equal (top.Viewport.Width, svAddedTov1.Frame.Width); + //Assert.Equal (top.Viewport.Height, svAddedTov1.Frame.Height); Assert.False (svAddedTov1.CanFocus); Assert.Throws (() => svAddedTov1.CanFocus = true); Assert.False (svAddedTov1.CanFocus); @@ -266,16 +266,16 @@ public class SubviewTests { v1c++; - //Assert.Equal (t.Bounds.Width, v1.Frame.Width); - //Assert.Equal (t.Bounds.Height, v1.Frame.Height); + //Assert.Equal (t.Viewport.Width, v1.Frame.Width); + //Assert.Equal (t.Viewport.Height, v1.Frame.Height); }; v2.Initialized += (s, e) => { v2c++; - //Assert.Equal (t.Bounds.Width, v2.Frame.Width); - //Assert.Equal (t.Bounds.Height, v2.Frame.Height); + //Assert.Equal (t.Viewport.Width, v2.Frame.Width); + //Assert.Equal (t.Viewport.Height, v2.Frame.Height); }; w.Add (v1, v2); t.Add (w); diff --git a/UnitTests/View/ViewTests.cs b/UnitTests/View/ViewTests.cs index c13362261..dbd813478 100644 --- a/UnitTests/View/ViewTests.cs +++ b/UnitTests/View/ViewTests.cs @@ -1123,7 +1123,7 @@ At 0,0 { var idx = 0; - // BUGBUG: v2 - this should use Bounds, not Frame + // BUGBUG: v2 - this should use Viewport, not Frame for (var r = 0; r < Frame.Height; r++) { for (var c = 0; c < Frame.Width; c++) diff --git a/UnitTests/Views/ScrollBarViewTests.cs b/UnitTests/Views/ScrollBarViewTests.cs index 4422a133b..4b1e30ef3 100644 --- a/UnitTests/Views/ScrollBarViewTests.cs +++ b/UnitTests/Views/ScrollBarViewTests.cs @@ -421,7 +421,7 @@ This is a tes { newScrollBarView.Position = 100; - //Assert.Equal (newScrollBarView.Position, newScrollBarView.Size - listView.LeftItem + (listView.LeftItem - listView.Bounds.Width)); + //Assert.Equal (newScrollBarView.Position, newScrollBarView.Size - listView.LeftItem + (listView.LeftItem - listView.Viewport.Width)); Assert.Equal (newScrollBarView.Position, listView.LeftItem); //Assert.Equal (92, newScrollBarView.Position); diff --git a/UnitTests/Views/TextViewTests.cs b/UnitTests/Views/TextViewTests.cs index f71cb9978..d597495b2 100644 --- a/UnitTests/Views/TextViewTests.cs +++ b/UnitTests/Views/TextViewTests.cs @@ -7657,7 +7657,7 @@ This is the second line. ); ((FakeDriver)Application.Driver).SetBufferSize (6, 25); - tv.SetRelativeLayout (Application.Driver.Bounds); + tv.SetRelativeLayout (Application.Driver.Viewport); tv.Draw (); Assert.Equal (new Point (4, 2), tv.CursorPosition); Assert.Equal (new Point (12, 0), cp);