mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
debugging iterations
This commit is contained in:
@@ -510,7 +510,7 @@ public static partial class Application // Run (Begin, Run, End, Stop)
|
||||
|
||||
if (clear || forceRedraw)
|
||||
{
|
||||
Driver?.ClearContents ();
|
||||
//Driver?.ClearContents ();
|
||||
}
|
||||
|
||||
foreach (Toplevel tl in TopLevels.Reverse ())
|
||||
@@ -519,6 +519,7 @@ public static partial class Application // Run (Begin, Run, End, Stop)
|
||||
{
|
||||
tl.SetNeedsDisplay ();
|
||||
}
|
||||
|
||||
tl.Draw ();
|
||||
}
|
||||
|
||||
|
||||
@@ -155,11 +155,11 @@ public class Adornment : View, IDesignable
|
||||
return parentOrSuperView.ScreenToFrame (new (location.X - Frame.X, location.Y - Frame.Y));
|
||||
}
|
||||
|
||||
/// <summary>Does nothing for Adornment</summary>
|
||||
/// <returns></returns>
|
||||
protected override bool OnDrawingAdornments () { return false; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <summary>
|
||||
/// Called when the <see cref="Thickness"/> of the Adornment is to be cleared.
|
||||
/// </summary>
|
||||
/// <param name="viewport"></param>
|
||||
/// <returns><see langword="true"/> to stop further clearing.</returns>
|
||||
protected override bool OnClearingViewport (Rectangle viewport)
|
||||
{
|
||||
if (Thickness == Thickness.Empty)
|
||||
|
||||
@@ -5,8 +5,6 @@ namespace Terminal.Gui;
|
||||
|
||||
public partial class View // Drawing APIs
|
||||
{
|
||||
#region Drawing Engine
|
||||
|
||||
/// <summary>
|
||||
/// Draws the view if it needs to be drawn.
|
||||
/// </summary>
|
||||
@@ -22,18 +20,14 @@ public partial class View // Drawing APIs
|
||||
/// </remarks>
|
||||
public void Draw ()
|
||||
{
|
||||
if (!CanBeVisible (this))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!NeedsDisplay && !SubViewNeedsDisplay)
|
||||
if (!CanBeVisible (this) || (!NeedsDisplay && !SubViewNeedsDisplay))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DoDrawAdornments ();
|
||||
|
||||
// Set the color scheme for the view after adornments have been drawn
|
||||
if (ColorScheme is { })
|
||||
{
|
||||
Driver?.SetAttribute (GetNormalColor ());
|
||||
@@ -44,27 +38,20 @@ public partial class View // Drawing APIs
|
||||
// so via settings. SetClip honors the ViewportSettings.DisableVisibleContentClipping flag.
|
||||
Rectangle prevClip = SetClip ();
|
||||
|
||||
// Clear Viewport
|
||||
DoClearViewport (Viewport);
|
||||
|
||||
// Draw Text
|
||||
DoDrawText (Viewport);
|
||||
|
||||
// Draw Content
|
||||
DoDrawContent (Viewport);
|
||||
|
||||
// Draw Subviews
|
||||
DoDrawSubviews (Viewport);
|
||||
|
||||
// Restore the clip before rendering the line canvas and adornment subviews
|
||||
// because they may draw outside the viewport.
|
||||
if (Driver is { })
|
||||
{
|
||||
Driver.Clip = prevClip;
|
||||
}
|
||||
|
||||
DoRenderLineCanvas ();
|
||||
|
||||
DoDrawAdornmentSubViews ();
|
||||
|
||||
ClearNeedsDisplay ();
|
||||
|
||||
// We're done
|
||||
@@ -75,6 +62,8 @@ public partial class View // Drawing APIs
|
||||
|
||||
private void DoDrawAdornmentSubViews ()
|
||||
{
|
||||
// This causes the Adornment's subviews to be REDRAWN
|
||||
// TODO: Figure out how to make this more efficient
|
||||
if (Margin?.Subviews is { })
|
||||
{
|
||||
foreach (View subview in Margin.Subviews)
|
||||
@@ -279,6 +268,8 @@ public partial class View // Drawing APIs
|
||||
|
||||
// We assume that the text has been drawn over the entire area; ensure that the subviews are redrawn.
|
||||
SetSubViewNeedsDisplay ();
|
||||
|
||||
Debug.WriteLine($"DrawText: {Id}");
|
||||
}
|
||||
|
||||
#endregion DrawText
|
||||
@@ -646,6 +637,4 @@ public partial class View // Drawing APIs
|
||||
}
|
||||
|
||||
#endregion NeedsDisplay
|
||||
|
||||
#endregion Drawing Engine
|
||||
}
|
||||
|
||||
@@ -382,6 +382,7 @@ public static class MessageBox
|
||||
|
||||
var d = new Dialog
|
||||
{
|
||||
Id = "MessageBox",
|
||||
Title = title,
|
||||
ButtonAlignment = MessageBox.DefaultButtonAlignment,
|
||||
ButtonAlignmentModes = AlignmentModes.StartToEnd | AlignmentModes.AddSpaceBetweenItems,
|
||||
|
||||
@@ -373,8 +373,9 @@ public class ContentScrolling : Scenario
|
||||
|
||||
var buttonAnchored = new Button
|
||||
{
|
||||
X = Pos.AnchorEnd (), Y = Pos.AnchorEnd (), Text = "Bottom Right"
|
||||
X = Pos.AnchorEnd (), Y = Pos.AnchorEnd (), Text = "Bottom Rig_ht"
|
||||
};
|
||||
buttonAnchored.Accepting += (sender, args) => MessageBox.Query ("Hi", $"You pressed {((Button)sender)?.Text}", "_Ok");
|
||||
|
||||
view.Margin.Data = "Margin";
|
||||
view.Margin.Thickness = new (0);
|
||||
|
||||
@@ -17,7 +17,11 @@ public sealed class Generic : Scenario
|
||||
Title = GetQuitKeyAndName (),
|
||||
};
|
||||
|
||||
var button = new Button { X = Pos.Center (), Y = Pos.Center (), Text = "_Press me!" };
|
||||
var button = new Button { Id = "button", X = Pos.Center (), Y = 1, Text = "_Press me!" };
|
||||
|
||||
button.ShadowStyle = ShadowStyle.None;
|
||||
button.HighlightStyle = HighlightStyle.None;
|
||||
|
||||
button.Accepting += (s, e) => MessageBox.ErrorQuery ("Error", "You pressed the button!", "_Ok");
|
||||
appWindow.Add (button);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user