diff --git a/Terminal.Gui/View/Adornment/Adornment.cs b/Terminal.Gui/View/Adornment/Adornment.cs index a1db317cbb..14bd66d391 100644 --- a/Terminal.Gui/View/Adornment/Adornment.cs +++ b/Terminal.Gui/View/Adornment/Adornment.cs @@ -188,23 +188,25 @@ public override void OnDrawContent (Rectangle viewport) /// Does nothing for Adornment /// - public override bool OnRenderLineCanvas () { return false; } - - /// - /// Adornments only render to their 's or Parent's SuperView's LineCanvas, so setting this - /// property throws an . - /// - public override bool SuperViewRendersLineCanvas + public override bool OnRenderLineCanvas () { - get => false; - set => throw new InvalidOperationException (@"Adornment can only render to their Parent or Parent's Superview."); + return base.OnRenderLineCanvas(); } + ///// + ///// Adornments only render to their 's or Parent's SuperView's LineCanvas, so setting this + ///// property throws an . + ///// + //public override bool SuperViewRendersLineCanvas + //{ + // get => false; + // set => throw new InvalidOperationException (@"Adornment can only render to their Parent or Parent's Superview."); + //} + #endregion View Overrides #region Mouse Support - /// /// Indicates whether the specified Parent's SuperView-relative coordinates are within the Adornment's Thickness. /// diff --git a/Terminal.Gui/View/Adornment/Border.cs b/Terminal.Gui/View/Adornment/Border.cs index 2931cd9ad2..a97432002d 100644 --- a/Terminal.Gui/View/Adornment/Border.cs +++ b/Terminal.Gui/View/Adornment/Border.cs @@ -1,3 +1,6 @@ +#define SUBVIEW_BASED_BORDER +using System.Diagnostics; + namespace Terminal.Gui; /// The Border for a . @@ -62,7 +65,13 @@ public Border (View parent) : base (parent) } #if SUBVIEW_BASED_BORDER - private Line _left; + public Line TopLeft { get; internal set; } + public Line TopRight { get; internal set; } + public Line Left { get; internal set; } + public Line Right { get; internal set; } + public Line Bottom { get; internal set; } + public View TitleLabel { get; internal set; } + /// /// The close button for the border. Set to , to to enable. @@ -81,51 +90,137 @@ public override void BeginInit () } #endif - base.BeginInit (); + //base.BeginInit(); -#if SUBVIEW_BASED_BORDER - if (Parent is { }) + SuperViewRendersLineCanvas = false; + + TopLeft = new () { - // Left - _left = new () - { - Orientation = Orientation.Vertical, - }; - Add (_left); + Orientation = Orientation.Horizontal, + SuperViewRendersLineCanvas = true, + BorderStyle = LineStyle + }; + Add (TopLeft); - CloseButton = new Button () - { - Text = "X", - CanFocus = true, - Visible = false, - }; - CloseButton.Accept += (s, e) => - { - e.Cancel = Parent.InvokeCommand (Command.QuitToplevel) == true; - }; - Add (CloseButton); + TopRight = new () + { + Orientation = Orientation.Horizontal, + SuperViewRendersLineCanvas = true, + BorderStyle = LineStyle + }; + Add (TopRight); - LayoutStarted += OnLayoutStarted; - } -#endif + Left = new () + { + Orientation = Orientation.Vertical, + SuperViewRendersLineCanvas = true, + BorderStyle = LineStyle, + }; + Add (Left); + + Right = new () + { + Orientation = Orientation.Vertical, + SuperViewRendersLineCanvas = true, + BorderStyle = LineStyle, + }; + + Add (Right); + + Bottom = new () + { + Orientation = Orientation.Horizontal, + SuperViewRendersLineCanvas = true, + BorderStyle = LineStyle, + }; + Add (Bottom); + + TitleLabel = new View () + { + Id = "TitleLabel", + Text = Parent.Title, + CanFocus = false, + SuperViewRendersLineCanvas = true, + TextAlignment = Alignment.Center, + VerticalTextAlignment = Alignment.Center, + }; + Add (TitleLabel); + + //CloseButton = new Button () + //{ + // Text = "X", + // CanFocus = true, + // Visible = false, + // NoPadding = true, + // NoDecorations = true, + // WantContinuousButtonPressed = true, + // SuperViewRendersLineCanvas = true, + //}; + + //CloseButton.Accept += (s, e) => + //{ + // e.Handled = Parent.InvokeCommand (Command.QuitToplevel) == true; + //}; + //Add (CloseButton); + + Debug.Assert (IsInitialized == false); + + SetSubviewLayout (); } -#if SUBVIEW_BASED_BORDER - private void OnLayoutStarted (object sender, LayoutEventArgs e) + /// + public override void EndInit () { - _left.Border.LineStyle = LineStyle; - - _left.X = Thickness.Left - 1; - _left.Y = Thickness.Top - 1; - _left.Width = 1; - _left.Height = Height; + Debug.Assert (TopLeft is { }); + base.EndInit (); + } - CloseButton.X = Pos.AnchorEnd (Thickness.Right / 2 + 1) - - (Pos.Right (CloseButton) - - Pos.Left (CloseButton)); - CloseButton.Y = 0; -} -#endif + private void SetSubviewLayout () + { + TopLeft.X = Pos.Func (() => Thickness.Left / 2); + TopLeft.Y = Pos.Func (() => Thickness.Top / 2); + TopLeft.Width = 2; + TopLeft.Height = 1; + TopLeft.Visible = Thickness.Top > 0; + + TopRight.X = Pos.Right (TitleLabel); + TopRight.Y = Pos.Func (() => Thickness.Top / 2); + TopRight.Width = Dim.Fill () - Dim.Func (() => Thickness.Right / 2); + TopRight.Height = 1; + TopRight.Visible = Thickness.Top > 0; + + Left.X = Pos.Func (() => Thickness.Left / 2); + Left.Y = Pos.Top (TopRight); + Left.Height = Dim.Fill () - Dim.Func (() => Thickness.Bottom / 2); + Left.Width = 1; + Left.Visible = Thickness.Left > 0; + + Right.X = Pos.Right (TopRight) - 1; + Right.Y = Pos.Top (TopRight); + Right.Height = Dim.Fill () - Dim.Func (() => Thickness.Bottom / 2); + Right.Width = 1; + Right.Visible = Thickness.Right > 0; + + Bottom.X = Pos.Func (() => Thickness.Left / 2); + Bottom.Y = Pos.Bottom (Left) - 1; + Bottom.Width = Dim.Fill () - Dim.Func (() => Thickness.Right / 2); + Bottom.Height = 1; + Bottom.Visible = Thickness.Bottom > 0; + + TitleLabel.X = Pos.Right (TopLeft); + TitleLabel.Y = Pos.Func (() => Thickness.Top / 2 - TitleLabel.Frame.Height / 2); + TitleLabel.Height = _settings.FastHasFlags (BorderSettings.Title) ? Thickness.Top : 0; + TitleLabel.Width = Dim.Func (() => _settings.FastHasFlags (BorderSettings.Title) ? TitleLabel.TextFormatter.GetAutoSize ().Width + TitleLabel.GetAdornmentsThickness ().Horizontal : 0); + TitleLabel.Border.Thickness = new (1, 0, 1, 0); + TitleLabel.Border.LineStyle = LineStyle.Dotted; + TitleLabel.SuperViewRendersLineCanvas = true; + + //CloseButton.X = Pos.Left (Right) - 1; + //CloseButton.Y = Pos.Func (() => Thickness.Top / 2); + //CloseButton.Width = 1; + //CloseButton.Height = 1; + //CloseButton.Visible = false; + } /// /// The color scheme for the Border. If set to , gets the @@ -145,36 +240,21 @@ public override ColorScheme ColorScheme set { base.ColorScheme = value; +#if SUBVIEW_BASED_BORDER + if (IsInitialized) + { + TopLeft.ColorScheme = value; + TopRight.ColorScheme = value; + Left.ColorScheme = value; + Right.ColorScheme = value; + Bottom.ColorScheme = value; + TitleLabel.ColorScheme = value; + } +#endif Parent?.SetNeedsDisplay (); } } - private Rectangle GetBorderRectangle (Rectangle screenRect) - { - return new ( - screenRect.X + Math.Max (0, Thickness.Left - 1), - screenRect.Y + Math.Max (0, Thickness.Top - 1), - Math.Max ( - 0, - screenRect.Width - - Math.Max ( - 0, - Math.Max (0, Thickness.Left - 1) - + Math.Max (0, Thickness.Right - 1) - ) - ), - Math.Max ( - 0, - screenRect.Height - - Math.Max ( - 0, - Math.Max (0, Thickness.Top - 1) - + Math.Max (0, Thickness.Bottom - 1) - ) - ) - ); - } - /// /// Sets the style of the border by changing the . This is a helper API for setting the /// to (1,1,1,1) and setting the line style of the views that comprise the border. If @@ -194,7 +274,25 @@ public LineStyle LineStyle // TODO: all this. return Parent.SuperView?.BorderStyle ?? LineStyle.None; } - set => _lineStyle = value; + set + { + if (_lineStyle == value) + { + return; + } + + _lineStyle = value; +#if SUBVIEW_BASED_BORDER + if (IsInitialized) + { + TopLeft.BorderStyle = value; + TopRight.BorderStyle = value; + Left.BorderStyle = value; + Right.BorderStyle = value; + Bottom.BorderStyle = value; + } +#endif + } } private BorderSettings _settings = BorderSettings.Title; @@ -214,6 +312,8 @@ public BorderSettings Settings _settings = value; + SetSubviewLayout (); + Parent?.SetNeedsDisplay (); } } @@ -251,7 +351,7 @@ private void Border_Highlight (object sender, CancelEventArgs e) { _savedHighlightLineStyle = Parent?.BorderStyle ?? LineStyle; } - LineStyle = LineStyle.Double; + BorderStyle = BorderStyle.Double; } #endif @@ -388,306 +488,20 @@ private void Application_UnGrabbingMouse (object sender, GrabMouseEventArgs e) /// public override void OnDrawContent (Rectangle viewport) { - base.OnDrawContent (viewport); - if (Thickness == Thickness.Empty) + // TODO: This should not be done on each draw? + if (Settings.FastHasFlags (BorderSettings.Gradient)) { - return; + SetupGradientLineCanvas (Parent.LineCanvas, ViewportToScreen (viewport)); } - - //Driver.SetAttribute (Colors.ColorSchemes ["Error"].Normal); - Rectangle screenBounds = ViewportToScreen (viewport); - - //OnDrawSubviews (bounds); - - // TODO: v2 - this will eventually be two controls: "BorderView" and "Label" (for the title) - - // The border adornment (and title) are drawn at the outermost edge of border; - // For Border - // ...thickness extends outward (border/title is always as far in as possible) - // PERF: How about a call to Rectangle.Offset? - - Rectangle borderBounds = GetBorderRectangle (screenBounds); - int topTitleLineY = borderBounds.Y; - int titleY = borderBounds.Y; - var titleBarsLength = 0; // the little vertical thingies - - int maxTitleWidth = Math.Max ( - 0, - Math.Min ( - Parent.TitleTextFormatter.FormatAndGetSize ().Width, - Math.Min (screenBounds.Width - 4, borderBounds.Width - 4) - ) - ); - - Parent.TitleTextFormatter.Size = new (maxTitleWidth, 1); - - int sideLineLength = borderBounds.Height; - bool canDrawBorder = borderBounds is { Width: > 0, Height: > 0 }; - - if (Settings.FastHasFlags (BorderSettings.Title)) + else { - if (Thickness.Top == 2) - { - topTitleLineY = borderBounds.Y - 1; - titleY = topTitleLineY + 1; - titleBarsLength = 2; - } - - // ┌────┐ - //┌┘View└ - //│ - if (Thickness.Top == 3) - { - topTitleLineY = borderBounds.Y - (Thickness.Top - 1); - titleY = topTitleLineY + 1; - titleBarsLength = 3; - sideLineLength++; - } - - // ┌────┐ - //┌┘View└ - //│ - if (Thickness.Top > 3) - { - topTitleLineY = borderBounds.Y - 2; - titleY = topTitleLineY + 1; - titleBarsLength = 3; - sideLineLength++; - } - } - - if (canDrawBorder && Thickness.Top > 0 && maxTitleWidth > 0 && Settings.FastHasFlags (BorderSettings.Title) && !string.IsNullOrEmpty (Parent?.Title)) - { - Attribute focus = Parent.GetNormalColor (); - - if (Parent.SuperView is { } && Parent.SuperView?.Subviews!.Count (s => s.CanFocus) > 1) - { - // Only use focus color if there are multiple focusable views - focus = Parent.GetFocusColor (); - } - - Parent.TitleTextFormatter.Draw ( - new (borderBounds.X + 2, titleY, maxTitleWidth, 1), - Parent.HasFocus ? focus : Parent.GetNormalColor (), - Parent.HasFocus ? focus : Parent.GetHotNormalColor ()); - } - - if (canDrawBorder && LineStyle != LineStyle.None) - { - LineCanvas lc = Parent?.LineCanvas; - - bool drawTop = Thickness.Top > 0 && Frame.Width > 1 && Frame.Height >= 1; - bool drawLeft = Thickness.Left > 0 && (Frame.Height > 1 || Thickness.Top == 0); - bool drawBottom = Thickness.Bottom > 0 && Frame.Width > 1 && Frame.Height > 1; - bool drawRight = Thickness.Right > 0 && (Frame.Height > 1 || Thickness.Top == 0); - - Attribute prevAttr = Driver.GetAttribute (); - - if (ColorScheme is { }) - { - Driver.SetAttribute (GetNormalColor ()); - } - else - { - Driver.SetAttribute (Parent.GetNormalColor ()); - } - - if (drawTop) - { - // ╔╡Title╞═════╗ - // ╔╡╞═════╗ - if (borderBounds.Width < 4 || !Settings.FastHasFlags (BorderSettings.Title) || string.IsNullOrEmpty (Parent?.Title)) - { - // ╔╡╞╗ should be ╔══╗ - lc.AddLine ( - new (borderBounds.Location.X, titleY), - borderBounds.Width, - Orientation.Horizontal, - LineStyle, - Driver.GetAttribute () - ); - } - else - { - // ┌────┐ - //┌┘View└ - //│ - if (Thickness.Top == 2) - { - lc.AddLine ( - new (borderBounds.X + 1, topTitleLineY), - Math.Min (borderBounds.Width - 2, maxTitleWidth + 2), - Orientation.Horizontal, - LineStyle, - Driver.GetAttribute () - ); - } - - // ┌────┐ - //┌┘View└ - //│ - if (borderBounds.Width >= 4 && Thickness.Top > 2) - { - lc.AddLine ( - new (borderBounds.X + 1, topTitleLineY), - Math.Min (borderBounds.Width - 2, maxTitleWidth + 2), - Orientation.Horizontal, - LineStyle, - Driver.GetAttribute () - ); - - lc.AddLine ( - new (borderBounds.X + 1, topTitleLineY + 2), - Math.Min (borderBounds.Width - 2, maxTitleWidth + 2), - Orientation.Horizontal, - LineStyle, - Driver.GetAttribute () - ); - } - - // ╔╡Title╞═════╗ - // Add a short horiz line for ╔╡ - lc.AddLine ( - new (borderBounds.Location.X, titleY), - 2, - Orientation.Horizontal, - LineStyle, - Driver.GetAttribute () - ); - - // Add a vert line for ╔╡ - lc.AddLine ( - new (borderBounds.X + 1, topTitleLineY), - titleBarsLength, - Orientation.Vertical, - LineStyle.Single, - Driver.GetAttribute () - ); - - // Add a vert line for ╞ - lc.AddLine ( - new ( - borderBounds.X - + 1 - + Math.Min (borderBounds.Width - 2, maxTitleWidth + 2) - - 1, - topTitleLineY - ), - titleBarsLength, - Orientation.Vertical, - LineStyle.Single, - Driver.GetAttribute () - ); - - // Add the right hand line for ╞═════╗ - lc.AddLine ( - new ( - borderBounds.X - + 1 - + Math.Min (borderBounds.Width - 2, maxTitleWidth + 2) - - 1, - titleY - ), - borderBounds.Width - Math.Min (borderBounds.Width - 2, maxTitleWidth + 2), - Orientation.Horizontal, - LineStyle, - Driver.GetAttribute () - ); - } - } - -#if !SUBVIEW_BASED_BORDER - - if (drawLeft) - { - lc.AddLine ( - new (borderBounds.Location.X, titleY), - sideLineLength, - Orientation.Vertical, - LineStyle, - Driver.GetAttribute () - ); - } -#endif - - if (drawBottom) - { - lc.AddLine ( - new (borderBounds.X, borderBounds.Y + borderBounds.Height - 1), - borderBounds.Width, - Orientation.Horizontal, - LineStyle, - Driver.GetAttribute () - ); - } - - if (drawRight) - { - lc.AddLine ( - new (borderBounds.X + borderBounds.Width - 1, titleY), - sideLineLength, - Orientation.Vertical, - LineStyle, - Driver.GetAttribute () - ); - } - - Driver.SetAttribute (prevAttr); - - // TODO: This should be moved to LineCanvas as a new BorderStyle.Ruler - if (Diagnostics.HasFlag (ViewDiagnosticFlags.Ruler)) - { - // Top - var hruler = new Ruler { Length = screenBounds.Width, Orientation = Orientation.Horizontal }; - - if (drawTop) - { - hruler.Draw (new (screenBounds.X, screenBounds.Y)); - } - - // Redraw title - if (drawTop && maxTitleWidth > 0 && Settings.FastHasFlags (BorderSettings.Title)) - { - Parent.TitleTextFormatter.Draw ( - new (borderBounds.X + 2, titleY, maxTitleWidth, 1), - Parent.HasFocus ? Parent.GetFocusColor () : Parent.GetNormalColor (), - Parent.HasFocus ? Parent.GetFocusColor () : Parent.GetNormalColor ()); - } - - //Left - var vruler = new Ruler { Length = screenBounds.Height - 2, Orientation = Orientation.Vertical }; - - if (drawLeft) - { - vruler.Draw (new (screenBounds.X, screenBounds.Y + 1), 1); - } - - // Bottom - if (drawBottom) - { - hruler.Draw (new (screenBounds.X, screenBounds.Y + screenBounds.Height - 1)); - } - - // Right - if (drawRight) - { - vruler.Draw (new (screenBounds.X + screenBounds.Width - 1, screenBounds.Y + 1), 1); - } - } - - // TODO: This should not be done on each draw? - if (Settings.FastHasFlags (BorderSettings.Gradient)) - { - SetupGradientLineCanvas (lc, screenBounds); - } - else - { - lc.Fill = null; - } + Parent.LineCanvas.Fill = null; } + base.OnDrawContent (viewport); } + private void SetupGradientLineCanvas (LineCanvas lc, Rectangle rect) { GetAppealingGradientColors (out List stops, out List steps); @@ -703,7 +517,7 @@ private void SetupGradientLineCanvas (LineCanvas lc, Rectangle rect) private static void GetAppealingGradientColors (out List stops, out List steps) { // Define the colors of the gradient stops with more appealing colors - stops = new() + stops = new () { new (0, 128, 255), // Bright Blue new (0, 255, 128), // Bright Green @@ -714,6 +528,6 @@ private static void GetAppealingGradientColors (out List stops, out List< // Define the number of steps between each color for smoother transitions // If we pass only a single value then it will assume equal steps between all pairs - steps = new() { 15 }; + steps = new () { 15 }; } } diff --git a/Terminal.Gui/View/View.cs b/Terminal.Gui/View/View.cs index 1e016e8ae0..553c7eb35b 100644 --- a/Terminal.Gui/View/View.cs +++ b/Terminal.Gui/View/View.cs @@ -209,7 +209,7 @@ public View () /// inheritance hierarchies to override base class layout code optimally by doing so only on first /// run, instead of on every run. /// - public virtual bool IsInitialized { get; set; } + public bool IsInitialized { get; set; } /// Signals the View that initialization is starting. See . /// @@ -236,8 +236,6 @@ public virtual void BeginInit () _oldCanFocus = CanFocus; _oldTabIndex = _tabIndex; - BeginInitAdornments (); - if (_subviews?.Count > 0) { foreach (View view in _subviews) @@ -248,6 +246,9 @@ public virtual void BeginInit () } } } + + BeginInitAdornments (); + EndInitAdornments (); } // TODO: Implement logic that allows EndInit to throw if BeginInit has not been called @@ -266,8 +267,6 @@ public virtual void EndInit () IsInitialized = true; - EndInitAdornments (); - // 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 Viewport which is indeterminate until EndInit is called. diff --git a/Terminal.Gui/View/ViewAdornments.cs b/Terminal.Gui/View/ViewAdornments.cs index accb15aba9..e12203324a 100644 --- a/Terminal.Gui/View/ViewAdornments.cs +++ b/Terminal.Gui/View/ViewAdornments.cs @@ -237,7 +237,7 @@ public Thickness GetAdornmentsThickness () /// internal virtual void LayoutAdornments () { - if (Margin is null) + if (Margin is null || !Margin.IsInitialized) { return; // CreateAdornments () has not been called yet } diff --git a/Terminal.Gui/View/ViewDrawing.cs b/Terminal.Gui/View/ViewDrawing.cs index 67778536f2..9ba14aab70 100644 --- a/Terminal.Gui/View/ViewDrawing.cs +++ b/Terminal.Gui/View/ViewDrawing.cs @@ -28,9 +28,21 @@ public virtual ColorScheme ColorScheme } } + private readonly LineCanvas _lineCanvas = new (); + /// The canvas that any line drawing that is to be shared by subviews of this view should add lines to. /// adds border lines to this LineCanvas. - public LineCanvas LineCanvas { get; } = new (); + public LineCanvas LineCanvas + { + get + { + //if (SuperView is Adornment adornment) + //{ + // return adornment.Parent.LineCanvas; + //} + return _lineCanvas; + } + } // The view-relative region that needs to be redrawn. Marked internal for unit tests. internal Rectangle _needsDisplayRect = Rectangle.Empty; @@ -249,6 +261,8 @@ public void Draw () // Invoke DrawContentCompleteEvent OnDrawContentComplete (Viewport); + //OnRenderLineCanvas (); + // BUGBUG: v2 - We should be able to use View.SetClip here and not have to resort to knowing Driver details. ClearLayoutNeeded (); ClearNeedsDisplay (); diff --git a/Terminal.Gui/Views/Line.cs b/Terminal.Gui/Views/Line.cs index 6a25fa55b7..f16b42483b 100644 --- a/Terminal.Gui/Views/Line.cs +++ b/Terminal.Gui/Views/Line.cs @@ -49,6 +49,11 @@ public override void SetBorderStyle (LineStyle value) /// public override void OnDrawContent (Rectangle viewport) { + if (viewport.Width == 0 || viewport.Height == 0) + { + return; + } + LineCanvas lc = LineCanvas; if (SuperViewRendersLineCanvas) @@ -66,20 +71,21 @@ public override void OnDrawContent (Rectangle viewport) if (SuperViewRendersLineCanvas && Orientation == Orientation.Horizontal) { - pos.Offset (-SuperView.Border.Thickness.Left, 0); - length += SuperView.Border.Thickness.Horizontal; + pos.Offset (-SuperView.Border?.Thickness.Left ?? 0, 0); + length += SuperView.Border?.Thickness.Horizontal ?? 0; } if (SuperViewRendersLineCanvas && Orientation == Orientation.Vertical) { - pos.Offset (0, -SuperView.Border.Thickness.Top); - length += SuperView.Border.Thickness.Vertical; + pos.Offset (0, -SuperView.Border?.Thickness.Top ?? 0); + length += SuperView.Border?.Thickness.Vertical ?? 0; } lc.AddLine ( pos, length, Orientation, - BorderStyle + Border.LineStyle, + GetNormalColor() ); } } diff --git a/UICatalog/Properties/launchSettings.json b/UICatalog/Properties/launchSettings.json index 041a5c22dc..2f99b79980 100644 --- a/UICatalog/Properties/launchSettings.json +++ b/UICatalog/Properties/launchSettings.json @@ -23,10 +23,6 @@ "commandLineArgs": "dotnet UICatalog.dll --driver NetDriver", "distributionName": "" }, - "Sliders": { - "commandName": "Project", - "commandLineArgs": "Sliders" - }, "Wizards": { "commandName": "Project", "commandLineArgs": "Wizards" @@ -73,6 +69,10 @@ "Frames Demo": { "commandName": "Project", "commandLineArgs": "\"Frames Demo\"" + }, + "Line Canvas Experiments": { + "commandName": "Project", + "commandLineArgs": "\"LineCanvas Experiments\"" } } } \ No newline at end of file diff --git a/UICatalog/Scenarios/Adornments.cs b/UICatalog/Scenarios/Adornments.cs index 8e19ecaaa8..2ea93f884f 100644 --- a/UICatalog/Scenarios/Adornments.cs +++ b/UICatalog/Scenarios/Adornments.cs @@ -23,7 +23,7 @@ public override void Main () Arrangement = ViewArrangement.Movable, X = Pos.AnchorEnd(), }; - editor.Border.Thickness = new Thickness (1, 2, 1, 1); + editor.Border.Thickness = new Thickness (1, 1, 1, 1); app.Add (editor); @@ -99,6 +99,8 @@ public override void Main () window.Initialized += (s, e) => { + window.BorderStyle = LineStyle.HeavyDotted; + var labelInPadding = new Label { X = 1, Y = 0, Title = "_Text:" }; window.Padding.Add (labelInPadding); diff --git a/UICatalog/Scenarios/AdornmentsEditor.cs b/UICatalog/Scenarios/AdornmentsEditor.cs index bfdbec5ebf..5280b04737 100644 --- a/UICatalog/Scenarios/AdornmentsEditor.cs +++ b/UICatalog/Scenarios/AdornmentsEditor.cs @@ -44,7 +44,7 @@ public AdornmentsEditor () private void AdornmentsEditor_Initialized (object sender, EventArgs e) { - BorderStyle = LineStyle.Dotted; + //BorderStyle = LineStyle.Dotted; ExpanderButton expandButton = new ExpanderButton () { diff --git a/UICatalog/Scenarios/LineCanvasExperiment.cs b/UICatalog/Scenarios/LineCanvasExperiment.cs index 8061e3e5df..6cc3675b99 100644 --- a/UICatalog/Scenarios/LineCanvasExperiment.cs +++ b/UICatalog/Scenarios/LineCanvasExperiment.cs @@ -24,9 +24,9 @@ public override void Main () Y = 0, Width = Dim.Fill (), Height = Dim.Fill (), - ColorScheme = Colors.ColorSchemes ["Base"] + ColorScheme = Colors.ColorSchemes ["Base"], + BorderStyle = LineStyle.None }; - frame1.BorderStyle = LineStyle.Double; //View.Diagnostics ^= DiagnosticFlags.FrameRuler; @@ -46,79 +46,99 @@ public override void Main () }; win1.Padding.Thickness = new (1); - frame1.Add (win1); - - var win2 = new Window - { - Title = "win2", - Text = "Win2 right of win1, 30%/70% Single.", - X = Pos.Right (win1) - 1, - Y = 0, - Width = Dim.Percent (30), - Height = Dim.Percent (70), - - //ColorScheme = Colors.ColorSchemes ["Error"], - SuperViewRendersLineCanvas = true - }; - - frame1.Add (win2); - - var view3 = new FrameView - { - Title = "View 3", - Text = "View3 right of win2 Fill/Fill Single", - X = Pos.Right (win2) - 1, - Y = 0, - Width = Dim.Fill (-1), - Height = Dim.Fill (-1), - SuperViewRendersLineCanvas = true - - //ColorScheme = Colors.ColorSchemes ["Menu"], - }; - - frame1.Add (view3); - - var view4 = new FrameView - { - Title = "View 4", - Text = "View4 below win2 win2.Width/5 Single", - X = Pos.Left (win2), - Y = Pos.Bottom (win2) - 1, - Width = win2.Width, - Height = 5, - SuperViewRendersLineCanvas = true - - //ColorScheme = Colors.ColorSchemes ["TopLevel"], - }; - - frame1.Add (view4); - - var win5 = new Window - { - Title = "Win 5", - Text = "win5 below View4 view4.Width/5 Double", - X = Pos.Left (win2), - Y = Pos.Bottom (view4) - 1, - Width = view4.Width, - Height = 5, - - //ColorScheme = Colors.ColorSchemes ["TopLevel"], - SuperViewRendersLineCanvas = true, - BorderStyle = LineStyle.Double - }; - - frame1.Add (win5); - - var line = new Line - { - X = 1, - Y = 1, - Width = 10, - Height = 1, - Orientation = Orientation.Horizontal, - SuperViewRendersLineCanvas = true - }; - frame1.Add (line); + //app.Add (win1); + + //var win2 = new Window + //{ + // Title = "win2", + // Text = "Win2 right of win1, 30%/70% Single.", + // X = Pos.Right (win1) - 1, + // Y = 0, + // Width = Dim.Percent (30), + // Height = Dim.Percent (70), + + // //ColorScheme = Colors.ColorSchemes ["Error"], + // SuperViewRendersLineCanvas = true + //}; + + //app.Add (win2); + + //var view3 = new FrameView + //{ + // Title = "View 3", + // Text = "View3 right of win2 Fill/Fill Single", + // X = Pos.Right (win2) - 1, + // Y = 0, + // Width = Dim.Fill (-1), + // Height = Dim.Fill (-1), + // SuperViewRendersLineCanvas = true + + // //ColorScheme = Colors.ColorSchemes ["Menu"], + //}; + + //app.Add (view3); + + //var view4 = new FrameView + //{ + // Title = "View 4", + // Text = "View4 below win2 win2.Width/5 Single", + // X = Pos.Left (win2), + // Y = Pos.Bottom (win2) - 1, + // Width = win2.Width, + // Height = 5, + // SuperViewRendersLineCanvas = true + + // //ColorScheme = Colors.ColorSchemes ["TopLevel"], + //}; + + //app.Add (view4); + + //var win5 = new Window + //{ + // Title = "Win 5", + // Text = "win5 below View4 view4.Width/5 Double", + // X = Pos.Left (win2), + // Y = Pos.Bottom (view4) - 1, + // Width = view4.Width, + // Height = 5, + + // //ColorScheme = Colors.ColorSchemes ["TopLevel"], + // SuperViewRendersLineCanvas = true, + // BorderStyle = LineStyle.Double + //}; + + //app.Add (win5); + + + //var marginWindow = new Window + //{ + // Title = "Positive Margin", + // X = 15, + // Y = 10, + // Width = 10, + // Height = 10, + + // //ColorScheme = Colors.ColorSchemes ["Error"], + // SuperViewRendersLineCanvas = true + //}; + //marginWindow.Margin.ColorScheme = Colors.ColorSchemes ["Dialog"]; + //marginWindow.Margin.Thickness = new Thickness (1); + //marginWindow.Border.Thickness = new Thickness (1, 2, 1, 1); + + //app.Add (marginWindow); + + + //var line = new Line + //{ + // Id = "line1", + // X = 1, + // Y = 1, + // Width = 10, + // Height = 1, + // Orientation = Orientation.Horizontal, + // SuperViewRendersLineCanvas = true + //}; + //app.Add (line); var marginWindow = new Window {