Browse Source

Merge pull request #574 from tig/sort_uicatalog

sorted scenarios and categories
Charlie Kindel 5 years ago
parent
commit
a0ee8b0840

+ 2 - 1
UICatalog/Scenarios/Editor.cs

@@ -6,12 +6,13 @@ namespace UICatalog {
 	[ScenarioMetadata (Name: "Editor", Description: "A Terminal.Gui Text Editor via TextView")]
 	[ScenarioMetadata (Name: "Editor", Description: "A Terminal.Gui Text Editor via TextView")]
 	[ScenarioCategory ("Controls")]
 	[ScenarioCategory ("Controls")]
 	[ScenarioCategory ("Text")]
 	[ScenarioCategory ("Text")]
+	[ScenarioCategory ("Dialogs")]
+	[ScenarioCategory ("TopLevel")]
 	class Editor : Scenario {
 	class Editor : Scenario {
 		private string _fileName = "demo.txt";
 		private string _fileName = "demo.txt";
 		private TextView _textView;
 		private TextView _textView;
 		private bool _saved = true;
 		private bool _saved = true;
 
 
-
 		public override void Init (Toplevel top)
 		public override void Init (Toplevel top)
 		{
 		{
 			base.Init (top);
 			base.Init (top);

+ 3 - 0
UICatalog/Scenarios/HexEditor.cs

@@ -7,6 +7,8 @@ namespace UICatalog {
 	[ScenarioMetadata (Name: "HexEditor", Description: "A Terminal.Gui binary (hex) editor via HexView")]
 	[ScenarioMetadata (Name: "HexEditor", Description: "A Terminal.Gui binary (hex) editor via HexView")]
 	[ScenarioCategory ("Controls")]
 	[ScenarioCategory ("Controls")]
 	[ScenarioCategory ("Text")]
 	[ScenarioCategory ("Text")]
+	[ScenarioCategory ("Dialogs")]
+	[ScenarioCategory ("TopLevel")]
 	class HexEditor : Scenario {
 	class HexEditor : Scenario {
 		private string _fileName = "demo.bin";
 		private string _fileName = "demo.bin";
 		private HexView _hexView;
 		private HexView _hexView;
@@ -16,6 +18,7 @@ namespace UICatalog {
 		{
 		{
 			Win.Title = this.GetName() + "-" + _fileName ?? "Untitled";
 			Win.Title = this.GetName() + "-" + _fileName ?? "Untitled";
 			Win.Y = 1;
 			Win.Y = 1;
+			Win.Height = Dim.Fill (1);
 			Top.LayoutSubviews ();
 			Top.LayoutSubviews ();
 
 
 			var menu = new MenuBar (new MenuBarItem [] {
 			var menu = new MenuBar (new MenuBarItem [] {

+ 1 - 0
UICatalog/Scenarios/WindowExperiment.cs

@@ -5,6 +5,7 @@ using Terminal.Gui;
 namespace UICatalog {
 namespace UICatalog {
 	[ScenarioMetadata (Name: "Windows & FrameViews", Description: "Shows Windows, sub-Windows, FrameViews, and how TAB doesn't work right (#434, #522)")]
 	[ScenarioMetadata (Name: "Windows & FrameViews", Description: "Shows Windows, sub-Windows, FrameViews, and how TAB doesn't work right (#434, #522)")]
 	[ScenarioCategory ("Views")]
 	[ScenarioCategory ("Views")]
+	[ScenarioCategory ("Layout")]
 	class WindowExperiment : Scenario {
 	class WindowExperiment : Scenario {
 		public override void Init (Toplevel top)
 		public override void Init (Toplevel top)
 		{
 		{

+ 2 - 2
UICatalog/UICatalog.cs

@@ -58,7 +58,7 @@ namespace UICatalog {
 			if (Debugger.IsAttached)
 			if (Debugger.IsAttached)
 				CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo ("en-US");
 				CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo ("en-US");
 
 
-			_scenarios = Scenario.GetDerivedClassesCollection ().ToList ();
+			_scenarios = Scenario.GetDerivedClassesCollection ().OrderBy (t => Scenario.ScenarioMetadata.GetName (t)).ToList ();
 
 
 			if (args.Length > 0) {
 			if (args.Length > 0) {
 				var item = _scenarios.FindIndex (t => Scenario.ScenarioMetadata.GetName (t).Equals (args [0], StringComparison.OrdinalIgnoreCase));
 				var item = _scenarios.FindIndex (t => Scenario.ScenarioMetadata.GetName (t).Equals (args [0], StringComparison.OrdinalIgnoreCase));
@@ -104,7 +104,7 @@ namespace UICatalog {
 			};
 			};
 
 
 
 
-			_categories = Scenario.GetAllCategories ();
+			_categories = Scenario.GetAllCategories ().OrderBy (c => c).ToList ();
 			_categoryListView = new ListView (_categories) {
 			_categoryListView = new ListView (_categories) {
 				X = 0,
 				X = 0,
 				Y = 0,
 				Y = 0,