|
@@ -1,4 +1,4 @@
|
|
-global using Attribute = Terminal.Gui.Attribute;
|
|
|
|
|
|
+global using Attribute = Terminal.Gui.Attribute;
|
|
global using CM = Terminal.Gui.ConfigurationManager;
|
|
global using CM = Terminal.Gui.ConfigurationManager;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
@@ -295,6 +295,7 @@ internal class UICatalogApp
|
|
_selectedScenario.Main ();
|
|
_selectedScenario.Main ();
|
|
_selectedScenario.Dispose ();
|
|
_selectedScenario.Dispose ();
|
|
_selectedScenario = null;
|
|
_selectedScenario = null;
|
|
|
|
+
|
|
// TODO: Throw if shutdown was not called already
|
|
// TODO: Throw if shutdown was not called already
|
|
Application.Shutdown ();
|
|
Application.Shutdown ();
|
|
VerifyObjectsWereDisposed ();
|
|
VerifyObjectsWereDisposed ();
|
|
@@ -302,20 +303,6 @@ internal class UICatalogApp
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- _aboutMessage = new ();
|
|
|
|
- _aboutMessage.AppendLine (@"A comprehensive sample library for");
|
|
|
|
- _aboutMessage.AppendLine (@"");
|
|
|
|
- _aboutMessage.AppendLine (@" _______ _ _ _____ _ ");
|
|
|
|
- _aboutMessage.AppendLine (@"|__ __| (_) | | / ____| (_)");
|
|
|
|
- _aboutMessage.AppendLine (@" | | ___ _ __ _ __ ___ _ _ __ __ _| || | __ _ _ _ ");
|
|
|
|
- _aboutMessage.AppendLine (@" | |/ _ \ '__| '_ ` _ \| | '_ \ / _` | || | |_ | | | | |");
|
|
|
|
- _aboutMessage.AppendLine (@" | | __/ | | | | | | | | | | | (_| | || |__| | |_| | |");
|
|
|
|
- _aboutMessage.AppendLine (@" |_|\___|_| |_| |_| |_|_|_| |_|\__,_|_(_)_____|\__,_|_|");
|
|
|
|
- _aboutMessage.AppendLine (@"");
|
|
|
|
- _aboutMessage.AppendLine (@"v2 - Work in Progress");
|
|
|
|
- _aboutMessage.AppendLine (@"");
|
|
|
|
- _aboutMessage.AppendLine (@"https://github.com/gui-cs/Terminal.Gui");
|
|
|
|
-
|
|
|
|
while (RunUICatalogTopLevel () is { } scenario)
|
|
while (RunUICatalogTopLevel () is { } scenario)
|
|
{
|
|
{
|
|
VerifyObjectsWereDisposed ();
|
|
VerifyObjectsWereDisposed ();
|
|
@@ -346,7 +333,6 @@ internal class UICatalogApp
|
|
// 'app' closed cleanly.
|
|
// 'app' closed cleanly.
|
|
foreach (Responder? inst in Responder.Instances)
|
|
foreach (Responder? inst in Responder.Instances)
|
|
{
|
|
{
|
|
-
|
|
|
|
Debug.Assert (inst.WasDisposed);
|
|
Debug.Assert (inst.WasDisposed);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -375,7 +361,9 @@ internal class UICatalogApp
|
|
public MenuItem? MiIsMenuBorderDisabled;
|
|
public MenuItem? MiIsMenuBorderDisabled;
|
|
public MenuItem? MiIsMouseDisabled;
|
|
public MenuItem? MiIsMouseDisabled;
|
|
public MenuItem? MiUseSubMenusSingleFrame;
|
|
public MenuItem? MiUseSubMenusSingleFrame;
|
|
|
|
+
|
|
public Shortcut? ShForce16Colors;
|
|
public Shortcut? ShForce16Colors;
|
|
|
|
+
|
|
//public Shortcut? ShDiagnostics;
|
|
//public Shortcut? ShDiagnostics;
|
|
public Shortcut? ShVersion;
|
|
public Shortcut? ShVersion;
|
|
|
|
|
|
@@ -388,11 +376,27 @@ internal class UICatalogApp
|
|
|
|
|
|
public UICatalogTopLevel ()
|
|
public UICatalogTopLevel ()
|
|
{
|
|
{
|
|
- _diagnosticFlags = View.Diagnostics;
|
|
|
|
|
|
+ _diagnosticFlags = Diagnostics;
|
|
|
|
|
|
_themeMenuItems = CreateThemeMenuItems ();
|
|
_themeMenuItems = CreateThemeMenuItems ();
|
|
_themeMenuBarItem = new ("_Themes", _themeMenuItems);
|
|
_themeMenuBarItem = new ("_Themes", _themeMenuItems);
|
|
|
|
|
|
|
|
+ _aboutMessage = new ();
|
|
|
|
+ _aboutMessage.AppendLine (@"A comprehensive sample library for");
|
|
|
|
+ _aboutMessage.AppendLine (
|
|
|
|
+ """
|
|
|
|
+ _______ _ _ _____ _
|
|
|
|
+ |__ __| (_) | | / ____| (_)
|
|
|
|
+ | | ___ _ __ _ __ ___ _ _ __ __ _| || | __ _ _ _
|
|
|
|
+ | |/ _ \ '__| '_ ` _ \| | '_ \ / _` | || | |_ | | | | |
|
|
|
|
+ | | __/ | | | | | | | | | | | (_| | || |__| | |_| | |
|
|
|
|
+ |_|\___|_| |_| |_| |_|_|_| |_|\__,_|_(_)_____|\__,_|_|
|
|
|
|
+ """);
|
|
|
|
+ _aboutMessage.AppendLine (@"");
|
|
|
|
+ _aboutMessage.AppendLine (@"v2 - Pre-Alpha");
|
|
|
|
+ _aboutMessage.AppendLine (@"");
|
|
|
|
+ _aboutMessage.Append (@"https://github.com/gui-cs/Terminal.Gui");
|
|
|
|
+
|
|
MenuBar = new ()
|
|
MenuBar = new ()
|
|
{
|
|
{
|
|
Menus =
|
|
Menus =
|
|
@@ -436,9 +440,8 @@ internal class UICatalogApp
|
|
() => MessageBox.Query (
|
|
() => MessageBox.Query (
|
|
"About UI Catalog",
|
|
"About UI Catalog",
|
|
_aboutMessage!.ToString (),
|
|
_aboutMessage!.ToString (),
|
|
- 0,
|
|
|
|
- false,
|
|
|
|
- "_Ok"
|
|
|
|
|
|
+ wrapMessage: false,
|
|
|
|
+ buttons: "_Ok"
|
|
),
|
|
),
|
|
null,
|
|
null,
|
|
null,
|
|
null,
|
|
@@ -460,35 +463,34 @@ internal class UICatalogApp
|
|
ShVersion = new ()
|
|
ShVersion = new ()
|
|
{
|
|
{
|
|
Title = "Version Info",
|
|
Title = "Version Info",
|
|
- CanFocus = false,
|
|
|
|
-
|
|
|
|
|
|
+ CanFocus = false
|
|
};
|
|
};
|
|
|
|
|
|
- Shortcut statusBarShortcut = new Shortcut ()
|
|
|
|
|
|
+ var statusBarShortcut = new Shortcut
|
|
{
|
|
{
|
|
Key = Key.F10,
|
|
Key = Key.F10,
|
|
- Title = "Show/Hide Status Bar",
|
|
|
|
|
|
+ Title = "Show/Hide Status Bar"
|
|
};
|
|
};
|
|
statusBarShortcut.Accept += (sender, args) => { StatusBar.Visible = !StatusBar.Visible; };
|
|
statusBarShortcut.Accept += (sender, args) => { StatusBar.Visible = !StatusBar.Visible; };
|
|
|
|
|
|
- ShForce16Colors = new Shortcut ()
|
|
|
|
|
|
+ ShForce16Colors = new()
|
|
{
|
|
{
|
|
- CommandView = new CheckBox ()
|
|
|
|
|
|
+ CommandView = new CheckBox
|
|
{
|
|
{
|
|
Title = "16 color mode",
|
|
Title = "16 color mode",
|
|
State = Application.Force16Colors ? CheckState.Checked : CheckState.UnChecked,
|
|
State = Application.Force16Colors ? CheckState.Checked : CheckState.UnChecked,
|
|
- CanFocus = false,
|
|
|
|
|
|
+ CanFocus = false
|
|
},
|
|
},
|
|
HelpText = "",
|
|
HelpText = "",
|
|
- Key = Key.F6,
|
|
|
|
|
|
+ Key = Key.F6
|
|
};
|
|
};
|
|
|
|
|
|
((CheckBox)ShForce16Colors.CommandView).Toggle += (sender, args) =>
|
|
((CheckBox)ShForce16Colors.CommandView).Toggle += (sender, args) =>
|
|
- {
|
|
|
|
- Application.Force16Colors = args.NewValue == CheckState.Checked;
|
|
|
|
- MiForce16Colors!.Checked = Application.Force16Colors;
|
|
|
|
- Application.Refresh ();
|
|
|
|
- };
|
|
|
|
|
|
+ {
|
|
|
|
+ Application.Force16Colors = args.NewValue == CheckState.Checked;
|
|
|
|
+ MiForce16Colors!.Checked = Application.Force16Colors;
|
|
|
|
+ Application.Refresh ();
|
|
|
|
+ };
|
|
|
|
|
|
//ShDiagnostics = new Shortcut ()
|
|
//ShDiagnostics = new Shortcut ()
|
|
//{
|
|
//{
|
|
@@ -503,10 +505,10 @@ internal class UICatalogApp
|
|
//};
|
|
//};
|
|
|
|
|
|
StatusBar.Add (
|
|
StatusBar.Add (
|
|
- new Shortcut ()
|
|
|
|
|
|
+ new Shortcut
|
|
{
|
|
{
|
|
Title = "Quit",
|
|
Title = "Quit",
|
|
- Key = Application.QuitKey,
|
|
|
|
|
|
+ Key = Application.QuitKey
|
|
},
|
|
},
|
|
statusBarShortcut,
|
|
statusBarShortcut,
|
|
ShForce16Colors,
|
|
ShForce16Colors,
|
|
@@ -846,24 +848,24 @@ internal class UICatalogApp
|
|
string GetDiagnosticsTitle (Enum diag)
|
|
string GetDiagnosticsTitle (Enum diag)
|
|
{
|
|
{
|
|
return Enum.GetName (_diagnosticFlags.GetType (), diag) switch
|
|
return Enum.GetName (_diagnosticFlags.GetType (), diag) switch
|
|
- {
|
|
|
|
- "Off" => OFF,
|
|
|
|
- "Ruler" => RULER,
|
|
|
|
- "Padding" => PADDING,
|
|
|
|
- "MouseEnter" => MOUSEENTER,
|
|
|
|
- _ => ""
|
|
|
|
- };
|
|
|
|
|
|
+ {
|
|
|
|
+ "Off" => OFF,
|
|
|
|
+ "Ruler" => RULER,
|
|
|
|
+ "Padding" => PADDING,
|
|
|
|
+ "MouseEnter" => MOUSEENTER,
|
|
|
|
+ _ => ""
|
|
|
|
+ };
|
|
}
|
|
}
|
|
|
|
|
|
Enum GetDiagnosticsEnumValue (string title)
|
|
Enum GetDiagnosticsEnumValue (string title)
|
|
{
|
|
{
|
|
return title switch
|
|
return title switch
|
|
- {
|
|
|
|
- RULER => ViewDiagnosticFlags.Ruler,
|
|
|
|
- PADDING => ViewDiagnosticFlags.Padding,
|
|
|
|
- MOUSEENTER => ViewDiagnosticFlags.MouseEnter,
|
|
|
|
- _ => null!
|
|
|
|
- };
|
|
|
|
|
|
+ {
|
|
|
|
+ RULER => ViewDiagnosticFlags.Ruler,
|
|
|
|
+ PADDING => ViewDiagnosticFlags.Padding,
|
|
|
|
+ MOUSEENTER => ViewDiagnosticFlags.MouseEnter,
|
|
|
|
+ _ => null!
|
|
|
|
+ };
|
|
}
|
|
}
|
|
|
|
|
|
void SetDiagnosticsFlag (Enum diag, bool add)
|
|
void SetDiagnosticsFlag (Enum diag, bool add)
|
|
@@ -1007,7 +1009,9 @@ internal class UICatalogApp
|
|
MiForce16Colors.Action += () =>
|
|
MiForce16Colors.Action += () =>
|
|
{
|
|
{
|
|
MiForce16Colors.Checked = Application.Force16Colors = (bool)!MiForce16Colors.Checked!;
|
|
MiForce16Colors.Checked = Application.Force16Colors = (bool)!MiForce16Colors.Checked!;
|
|
- ((CheckBox)ShForce16Colors!.CommandView!).State = Application.Force16Colors ? CheckState.Checked : CheckState.UnChecked;
|
|
|
|
|
|
+
|
|
|
|
+ ((CheckBox)ShForce16Colors!.CommandView!).State =
|
|
|
|
+ Application.Force16Colors ? CheckState.Checked : CheckState.UnChecked;
|
|
Application.Refresh ();
|
|
Application.Refresh ();
|
|
};
|
|
};
|
|
menuItems.Add (MiForce16Colors);
|
|
menuItems.Add (MiForce16Colors);
|