Explorar o código

Clean up old code

Tig Kindel %!s(int64=2) %!d(string=hai) anos
pai
achega
5dc2ec7606

+ 1 - 4
UICatalog/Scenario.cs

@@ -77,10 +77,7 @@ namespace UICatalog {
 		{
 		{
 			Application.Init ();
 			Application.Init ();
 
 
-			Top = top;
-			if (Top == null) {
-				Top = Application.Top;
-			}
+			Top = top != null ? top : Application.Top;
 
 
 			Win = new Window ($"CTRL-Q to Close - Scenario: {GetName ()}") {
 			Win = new Window ($"CTRL-Q to Close - Scenario: {GetName ()}") {
 				X = 0,
 				X = 0,

+ 1 - 4
UICatalog/Scenarios/AllViewsTester.cs

@@ -44,10 +44,7 @@ namespace UICatalog.Scenarios {
 		{
 		{
 			Application.Init ();
 			Application.Init ();
 
 
-			Top = top;
-			if (Top == null) {
-				Top = Application.Top;
-			}
+			Top = top != null ? top : Application.Top;
 
 
 			//Win = new Window ($"CTRL-Q to Close - Scenario: {GetName ()}") {
 			//Win = new Window ($"CTRL-Q to Close - Scenario: {GetName ()}") {
 			//	X = 0,
 			//	X = 0,

+ 0 - 1
UICatalog/Scenarios/BordersComparisons.cs

@@ -7,7 +7,6 @@ namespace UICatalog.Scenarios {
 	public class BordersComparisons : Scenario {
 	public class BordersComparisons : Scenario {
 		public override void Init (Toplevel top, ColorScheme colorScheme)
 		public override void Init (Toplevel top, ColorScheme colorScheme)
 		{
 		{
-			top.Dispose ();
 			Application.Init ();
 			Application.Init ();
 
 
 			top = Application.Top;
 			top = Application.Top;

+ 1 - 11
UICatalog/Scenarios/Clipping.cs

@@ -11,19 +11,9 @@ namespace UICatalog.Scenarios {
 		{
 		{
 			Application.Init ();
 			Application.Init ();
 
 
-			Top = top;
-			if (Top == null) {
-				Top = Application.Top;
-			}
+			Top = top != null ? top : Application.Top;
 
 
 			Top.ColorScheme = Colors.Base;
 			Top.ColorScheme = Colors.Base;
-			//Win = new TopLevel($"CTRL-Q to Close - Scenario: {GetName ()}") {
-			//	X = 0,
-			//	Y = 0,
-			//	Width = Dim.Fill (),
-			//	Height = Dim.Fill ()
-			//};
-			//Top.Add (Win);
 		}
 		}
 
 
 		public override void Setup ()
 		public override void Setup ()

+ 1 - 4
UICatalog/Scenarios/Editor.cs

@@ -35,10 +35,7 @@ namespace UICatalog.Scenarios {
 		public override void Init (Toplevel top, ColorScheme colorScheme)
 		public override void Init (Toplevel top, ColorScheme colorScheme)
 		{
 		{
 			Application.Init ();
 			Application.Init ();
-			Top = top;
-			if (Top == null) {
-				Top = Application.Top;
-			}
+			Top = top != null ? top : Application.Top;
 
 
 			Win = new Window (_fileName ?? "Untitled") {
 			Win = new Window (_fileName ?? "Untitled") {
 				X = 0,
 				X = 0,

+ 1 - 4
UICatalog/Scenarios/WindowsAndFrameViews.cs

@@ -10,10 +10,7 @@ namespace UICatalog.Scenarios {
 		{
 		{
 			Application.Init ();
 			Application.Init ();
 
 
-			Top = top;
-			if (Top == null) {
-				Top = Application.Top;
-			}
+			Top = top != null ? top : Application.Top;
 		}
 		}
 
 
 		public override void RequestStop ()
 		public override void RequestStop ()

+ 4 - 15
UICatalog/UICatalog.cs

@@ -57,7 +57,9 @@ namespace UICatalog {
 		private static StatusItem _numlock;
 		private static StatusItem _numlock;
 		private static StatusItem _scrolllock;
 		private static StatusItem _scrolllock;
 
 
+		// If set, holds the scenario the user selected
 		private static Scenario _selectedScenario = null;
 		private static Scenario _selectedScenario = null;
+		
 		private static bool _useSystemConsole = false;
 		private static bool _useSystemConsole = false;
 		private static ConsoleDriver.DiagnosticFlags _diagnosticFlags;
 		private static ConsoleDriver.DiagnosticFlags _diagnosticFlags;
 		private static bool _heightAsBuffer = false;
 		private static bool _heightAsBuffer = false;
@@ -140,10 +142,6 @@ namespace UICatalog {
 #endif
 #endif
 			}
 			}
 
 
-			// This call to Application.Shutdown brackets the Application.Init call
-			// for the main UI Catalog app (in SelectScenario()).
-			//Application.Shutdown ();
-
 #if DEBUG_IDISPOSABLE
 #if DEBUG_IDISPOSABLE
 			// This proves that when the user exited the UI Catalog app
 			// This proves that when the user exited the UI Catalog app
 			// it cleaned up properly.
 			// it cleaned up properly.
@@ -291,12 +289,9 @@ namespace UICatalog {
 			_categoryListView.SelectedItem = _cachedCategoryIndex;
 			_categoryListView.SelectedItem = _cachedCategoryIndex;
 			_scenarioListView.SelectedItem = _cachedScenarioIndex;
 			_scenarioListView.SelectedItem = _cachedScenarioIndex;
 
 
-			// Run UI Catalog UI. When it exits, if _runningScenario is != null then
+			// Run UI Catalog UI. When it exits, if _selectedScenario is != null then
 			// a Scenario was selected. Otherwise, the user wants to exit UI Catalog.
 			// a Scenario was selected. Otherwise, the user wants to exit UI Catalog.
 			Application.Run (Application.Top);
 			Application.Run (Application.Top);
-
-			// BUGBUG: Shouldn't Application.Shutdown() be called here? Why is it currently
-			// outside of the SelectScenario() loop?
 			Application.Shutdown ();
 			Application.Shutdown ();
 
 
 			return _selectedScenario;
 			return _selectedScenario;
@@ -304,7 +299,7 @@ namespace UICatalog {
 
 
 
 
 		/// <summary>
 		/// <summary>
-		/// Launches the selected scenario, setting the global _runningScenario
+		/// Launches the selected scenario, setting the global _selectedScenario
 		/// </summary>
 		/// </summary>
 		/// <param name="e"></param>
 		/// <param name="e"></param>
 		private static void _scenarioListView_OpenSelectedItem (EventArgs e)
 		private static void _scenarioListView_OpenSelectedItem (EventArgs e)
@@ -504,12 +499,6 @@ namespace UICatalog {
 			return menuItems.ToArray ();
 			return menuItems.ToArray ();
 		}
 		}
 
 
-		/// <summary>
-		/// When Scenarios are running we need to override the behavior of the Menu 
-		/// and Statusbar to enable Scenarios that use those (or related key input)
-		/// to not be impacted. Same as for tabs.
-		/// </summary>
-		/// <param name="ke"></param>
 		private static void KeyDownHandler (View.KeyEventEventArgs a)
 		private static void KeyDownHandler (View.KeyEventEventArgs a)
 		{
 		{
 			if (a.KeyEvent.IsCapslock) {
 			if (a.KeyEvent.IsCapslock) {