From a3a680b3e24f771506b6fcb2951123d4cfe5e805 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Sun, 6 May 2018 17:50:24 -0400 Subject: [PATCH] Small fixes to the Open File dialog --- Example/demo.cs | 2 +- Terminal.Gui/Core.cs | 28 +++++++++++++++++++++------- Terminal.Gui/Dialogs/FileDialog.cs | 2 +- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Example/demo.cs b/Example/demo.cs index aecbd4212..550367e07 100644 --- a/Example/demo.cs +++ b/Example/demo.cs @@ -211,7 +211,7 @@ static class Demo { Application.Init (); var top = Application.Top; var tframe = top.Frame; - Open (); + //Open (); #if true var win = new Window ("Hello") { X = 0, diff --git a/Terminal.Gui/Core.cs b/Terminal.Gui/Core.cs index 3a311de0f..d80a6c4ff 100644 --- a/Terminal.Gui/Core.cs +++ b/Terminal.Gui/Core.cs @@ -1020,9 +1020,9 @@ namespace Terminal.Gui { w = width.Anchor (hostFrame.Width); _x = x.Anchor (hostFrame.Width - w); } else { - if (x == null) + if (x == null) _x = 0; - else + else _x = x.Anchor (hostFrame.Width); if (width == null) w = hostFrame.Width; @@ -1240,7 +1240,7 @@ namespace Terminal.Gui { Focused?.SetNeedsDisplay (); } return true; - + case Key.ControlL: Application.Refresh (); return true; @@ -1271,6 +1271,20 @@ namespace Terminal.Gui { class ContentView : View { public ContentView (Rect frame) : base (frame) { } public ContentView () : base () { } +#if false + public override void Redraw (Rect region) + { + Driver.SetAttribute (ColorScheme.Focus); + + for (int y = 0; y < Frame.Height; y++) { + Move (0, y); + for (int x = 0; x < Frame.Width; x++) { + + Driver.AddRune ('x'); + } + } + } +#endif } /// @@ -1319,11 +1333,11 @@ namespace Terminal.Gui { public Window (ustring title = null, int padding = 0) : base () { this.Title = title; - int wb = 2 * (1 + padding); + int wb = 1 + padding; this.padding = padding; - contentView = new ContentView () { - X = 1 + padding, - Y = 1 + padding, + contentView = new ContentView () { + X = wb, + Y = wb, Width = Dim.Fill (wb), Height = Dim.Fill (wb) }; diff --git a/Terminal.Gui/Dialogs/FileDialog.cs b/Terminal.Gui/Dialogs/FileDialog.cs index 7967bd08e..e31878396 100644 --- a/Terminal.Gui/Dialogs/FileDialog.cs +++ b/Terminal.Gui/Dialogs/FileDialog.cs @@ -254,7 +254,7 @@ namespace Terminal.Gui { X = 1, Y = 3 + msgLines + 2, Width = Dim.Fill (), - Height = Dim.Fill (), + Height = Dim.Fill ()-2, Directory = "." }; Add (dirListView);