From 473afe0732c1179b5658f0d6d34442624493a304 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Thu, 8 Oct 2020 13:47:47 -0600 Subject: [PATCH 1/2] poc --- Example/demo.cs | 8 ++++---- Terminal.Gui/Core/View.cs | 20 ++++++++++---------- Terminal.Gui/Core/Window.cs | 18 +++++++++--------- Terminal.Gui/Views/ScrollView.cs | 2 +- UnitTests/ViewTests.cs | 3 --- 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/Example/demo.cs b/Example/demo.cs index e395cb2ea..76bc82a76 100644 --- a/Example/demo.cs +++ b/Example/demo.cs @@ -185,16 +185,16 @@ static class Demo { }; var tf = new Button (3, 19, "Ok"); + var frameView = new FrameView (new Rect (3, 10, 25, 6), "Options"); + frameView.Add (new CheckBox (1, 0, "Remember me")); + frameView.Add (new RadioGroup (1, 2, new ustring [] { "_Personal", "_Company" })); // Add some content container.Add ( login, loginText, password, passText, - new FrameView (new Rect (3, 10, 25, 6), "Options"){ - new CheckBox (1, 0, "Remember me"), - new RadioGroup (1, 2, new ustring [] { "_Personal", "_Company" }), - }, + frameView, new ListView (new Rect (59, 6, 16, 4), new string [] { "First row", "<>", diff --git a/Terminal.Gui/Core/View.cs b/Terminal.Gui/Core/View.cs index 94ceace08..fe6e00d88 100644 --- a/Terminal.Gui/Core/View.cs +++ b/Terminal.Gui/Core/View.cs @@ -111,7 +111,7 @@ namespace Terminal.Gui { /// frames for the vies that use . /// /// - public partial class View : Responder, IEnumerable, ISupportInitializeNotification { + public partial class View : Responder, ISupportInitializeNotification { internal enum Direction { Forward, @@ -386,15 +386,15 @@ namespace Terminal.Gui { } } - /// - /// Gets an enumerator that enumerates the subviews in this view. - /// - /// The enumerator. - public IEnumerator GetEnumerator () - { - foreach (var v in InternalSubviews) - yield return v; - } + ///// + ///// Gets an enumerator that enumerates the subviews in this view. + ///// + ///// The enumerator. + //public IEnumerator GetEnumerator () + //{ + // foreach (var v in InternalSubviews) + // yield return v; + //} LayoutStyle layoutStyle; diff --git a/Terminal.Gui/Core/Window.cs b/Terminal.Gui/Core/Window.cs index d6592c31d..294c6e51d 100644 --- a/Terminal.Gui/Core/Window.cs +++ b/Terminal.Gui/Core/Window.cs @@ -20,7 +20,7 @@ namespace Terminal.Gui { /// The 'client area' of a is a rectangle deflated by one or more rows/columns from . A this time there is no /// API to determine this rectangle. /// - public class Window : Toplevel, IEnumerable { + public class Window : Toplevel { View contentView; ustring title; @@ -122,14 +122,14 @@ namespace Terminal.Gui { base.Add (contentView); } - /// - /// Enumerates the various s in the embedded . - /// - /// The enumerator. - public new IEnumerator GetEnumerator () - { - return contentView.GetEnumerator (); - } + ///// + ///// Enumerates the various s in the embedded . + ///// + ///// The enumerator. + //public new IEnumerator GetEnumerator () + //{ + // return contentView.GetEnumerator (); + //} /// public override void Add (View view) diff --git a/Terminal.Gui/Views/ScrollView.cs b/Terminal.Gui/Views/ScrollView.cs index 99117ef77..aee1a03a7 100644 --- a/Terminal.Gui/Views/ScrollView.cs +++ b/Terminal.Gui/Views/ScrollView.cs @@ -643,7 +643,7 @@ namespace Terminal.Gui { void SetViewsNeedsDisplay () { - foreach (View view in contentView) { + foreach (View view in contentView.Subviews) { view.SetNeedsDisplay (); } } diff --git a/UnitTests/ViewTests.cs b/UnitTests/ViewTests.cs index 4f20e5505..256e19a06 100644 --- a/UnitTests/ViewTests.cs +++ b/UnitTests/ViewTests.cs @@ -35,7 +35,6 @@ namespace Terminal.Gui { Assert.Empty (r.Subviews); Assert.False (r.WantContinuousButtonPressed); Assert.False (r.WantMousePositionReports); - Assert.Null (r.GetEnumerator ().Current); Assert.Null (r.SuperView); Assert.Null (r.MostFocused); @@ -59,7 +58,6 @@ namespace Terminal.Gui { Assert.Empty (r.Subviews); Assert.False (r.WantContinuousButtonPressed); Assert.False (r.WantMousePositionReports); - Assert.Null (r.GetEnumerator ().Current); Assert.Null (r.SuperView); Assert.Null (r.MostFocused); @@ -83,7 +81,6 @@ namespace Terminal.Gui { Assert.Empty (r.Subviews); Assert.False (r.WantContinuousButtonPressed); Assert.False (r.WantMousePositionReports); - Assert.Null (r.GetEnumerator ().Current); Assert.Null (r.SuperView); Assert.Null (r.MostFocused); From e5a16757412b0224edcc2558719d9684208778b1 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Thu, 8 Oct 2020 14:30:10 -0600 Subject: [PATCH 2/2] updated relnotes & version --- Terminal.Gui/Directory.Build.props | 6 +++--- Terminal.Gui/Terminal.Gui.csproj | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Terminal.Gui/Directory.Build.props b/Terminal.Gui/Directory.Build.props index 394cc4a11..c549feaa8 100644 --- a/Terminal.Gui/Directory.Build.props +++ b/Terminal.Gui/Directory.Build.props @@ -14,9 +14,9 @@ e.g. If AssemblyVersion is 1.2.3.4, Version could be EITHER 1.2.3.4 or 1.2.3-pre.4 depending on whether it's a pre-release or not. --> - 1.0.0-pre.4 - 1.0.0.4 - 1.0.0.4 + 1.0.0-pre.5 + 1.0.0.5 + 1.0.0.5 Miguel de Icaza, Charlie Kindel (@tig), @BDisp diff --git a/Terminal.Gui/Terminal.Gui.csproj b/Terminal.Gui/Terminal.Gui.csproj index e6ac2e0b8..cbff7b04e 100644 --- a/Terminal.Gui/Terminal.Gui.csproj +++ b/Terminal.Gui/Terminal.Gui.csproj @@ -24,7 +24,8 @@ v1.00 - * If StatusBar.Visible is set to false, TopLevel resizes correctly enabling hiding/showing of a StatusBar. UICatalog demonstrates. - * New sample/demo app - ReactiveExample - Shows how to use reactive extensions and ReactiveUI with gui.cs. + * New sample/demo app - ReactiveExample - Shows how to use reactive extensions and ReactiveUI with gui.cs. (Thanks @worldbeater) + * BREAKING API CHANGE - Removed IEnumerable from View and Window. Use Subviews property instead. See #950. v0.90 - "Feature Complete" pre-release of Terminal.Gui (aka gui.cs) 1.0. This release is a signficant upgrade from the previous published release (0.81). Most of the major changes and bug fixes are listed below. NOTE: This release includes breaking changes to the API; we will strive to avoid any more breaking changes before 1.0.