diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index feb12c7b..6c22810b 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -6,7 +6,12 @@ jobs:
package:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '10.0.x'
- name: Build
run: cd src && dotnet build
diff --git a/.gitignore b/.gitignore
index dfcfd56f..a96e7a22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,8 @@
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
+.claude
+
# Mono auto generated files
mono_crash.*
diff --git a/README.md b/README.md
index b3d660dc..08e2dff9 100644
--- a/README.md
+++ b/README.md
@@ -198,12 +198,12 @@ italics are experimental and require passing the `-e` flag when starting applica
- [x] GraphView
- [x] HexView
- [x] Label
- - [x] LineView
+ - [x] Line
- [x] ListView
- [x] MenuBar
- [ ] Copy/Paste preserve menu entries
- [x] ProgressBar
- - [x] RadioGroup
+ - [x] OptionSelector
- [ ] [SplitContainer](https://github.com/gui-cs/Terminal.Gui/pull/2258) (Unreleased)
- [ ] Copy/Paste preserve split content panels
- [x] StatusBar
diff --git a/Showcase/Buttons.Designer.cs b/Showcase/Buttons.Designer.cs
new file mode 100644
index 00000000..2ca29bf6
--- /dev/null
+++ b/Showcase/Buttons.Designer.cs
@@ -0,0 +1,168 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using System;
+ using Terminal.Gui;
+ using Terminal.Gui.App;
+ using Terminal.Gui.Drawing;
+ using Terminal.Gui.Input;
+ using Terminal.Gui.ViewBase;
+ using Terminal.Gui.Views;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Drawing;
+
+
+ public partial class Buttons : Terminal.Gui.ViewBase.View {
+
+ private Terminal.Gui.Views.Button button;
+
+ private Terminal.Gui.Views.Button button2;
+
+ private Terminal.Gui.Views.Button button3;
+
+ private Terminal.Gui.Views.Button button4;
+
+ private Terminal.Gui.Views.Button button5;
+
+ private Terminal.Gui.Views.Label label;
+
+ private Terminal.Gui.Views.Button button6;
+
+ private Terminal.Gui.Views.Button button7;
+
+ private void InitializeComponent() {
+ this.button7 = new Terminal.Gui.Views.Button();
+ this.button6 = new Terminal.Gui.Views.Button();
+ this.label = new Terminal.Gui.Views.Label();
+ this.button5 = new Terminal.Gui.Views.Button();
+ this.button4 = new Terminal.Gui.Views.Button();
+ this.button3 = new Terminal.Gui.Views.Button();
+ this.button2 = new Terminal.Gui.Views.Button();
+ this.button = new Terminal.Gui.Views.Button();
+ this.Width = Dim.Fill(0);
+ this.Height = Dim.Fill(0);
+ this.X = 0;
+ this.Y = 0;
+ this.Visible = true;
+ this.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
+ this.CanFocus = false;
+ this.ShadowStyle = null;
+ this.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.button.Width = Dim.Auto();
+ this.button.Height = Dim.Auto();
+ this.button.X = 47;
+ this.button.Y = 0;
+ this.button.Visible = true;
+ this.button.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
+ this.button.CanFocus = true;
+ this.button.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyles.Opaque;
+ this.button.Data = "button";
+ this.button.Text = "Click _Me";
+ this.button.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.button.IsDefault = false;
+ this.Add(this.button);
+ this.button2.Width = Dim.Auto();
+ this.button2.Height = Dim.Auto();
+ this.button2.X = 43;
+ this.button2.Y = 2;
+ this.button2.Visible = true;
+ this.button2.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
+ this.button2.CanFocus = true;
+ this.button2.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyles.None;
+ this.button2.Data = "button2";
+ this.button2.Text = "Button without shadow";
+ this.button2.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.button2.IsDefault = false;
+ this.Add(this.button2);
+ this.button3.Width = Dim.Auto();
+ this.button3.Height = Dim.Auto();
+ this.button3.X = 46;
+ this.button3.Y = 4;
+ this.button3.Visible = true;
+ this.button3.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
+ this.button3.CanFocus = true;
+ this.button3.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyles.Opaque;
+ this.button3.Data = "button3";
+ this.button3.Text = "Default Button";
+ this.button3.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.button3.IsDefault = true;
+ this.Add(this.button3);
+ this.button4.Width = 37;
+ this.button4.Height = Dim.Auto();
+ this.button4.X = 38;
+ this.button4.Y = 6;
+ this.button4.Visible = true;
+ this.button4.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
+ this.button4.CanFocus = true;
+ this.button4.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyles.Opaque;
+ this.button4.Data = "button4";
+ this.button4.Text = "Fixed width button";
+ this.button4.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.button4.IsDefault = false;
+ this.Add(this.button4);
+ this.button5.Width = Dim.Auto();
+ this.button5.Height = Dim.Auto();
+ this.button5.X = 42;
+ this.button5.Y = 8;
+ this.button5.Visible = true;
+ this.button5.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
+ this.button5.CanFocus = true;
+ this.button5.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyles.Transparent;
+ this.button5.Data = "button5";
+ this.button5.Text = "Transparent shadow Button";
+ this.button5.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.button5.IsDefault = false;
+ this.Add(this.button5);
+ this.label.Width = Dim.Fill(0);
+ this.label.Height = Dim.Auto();
+ this.label.X = 0;
+ this.label.Y = 14;
+ this.label.Visible = true;
+ this.label.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
+ this.label.CanFocus = false;
+ this.label.ShadowStyle = null;
+ this.label.Data = "label";
+ this.label.Text = ("Button Showcase\r\n------------------\r\n\r\nOne button can be IsDefault\r\nTab to button" +
+ " and type to update label\r\nType underscore before a letter for \'alt\' hotkey\r\n\r\nS" +
+ "hadowStyle defaults to Opaque\r\nWidth defaults to AutoSize");
+ this.label.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.Add(this.label);
+ this.button6.Width = Dim.Auto();
+ this.button6.Height = Dim.Auto();
+ this.button6.X = Pos.Percent(30);
+ this.button6.Y = Pos.AnchorEnd(1);
+ this.button6.Visible = true;
+ this.button6.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
+ this.button6.CanFocus = true;
+ this.button6.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyles.Opaque;
+ this.button6.Data = "button6";
+ this.button6.Text = "Anchor End Button 1";
+ this.button6.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.button6.IsDefault = false;
+ this.Add(this.button6);
+ this.button7.Width = Dim.Auto();
+ this.button7.Height = Dim.Auto();
+ this.button7.X = Pos.Right(button6) + 1;
+ this.button7.Y = Pos.AnchorEnd(1);
+ this.button7.Visible = true;
+ this.button7.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
+ this.button7.CanFocus = true;
+ this.button7.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyles.Opaque;
+ this.button7.Data = "button7";
+ this.button7.Text = "Anchor End Button 2";
+ this.button7.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.button7.IsDefault = false;
+ this.Add(this.button7);
+ }
+ }
+}
diff --git a/Showcase/Buttons.cs b/Showcase/Buttons.cs
new file mode 100644
index 00000000..903cc26d
--- /dev/null
+++ b/Showcase/Buttons.cs
@@ -0,0 +1,20 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// You can make changes to this file and they will not be overwritten when saving.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using Terminal.Gui;
+
+
+ public partial class Buttons {
+
+ public Buttons() {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Showcase/Checkboxes.Designer.cs b/Showcase/Checkboxes.Designer.cs
new file mode 100644
index 00000000..e46fa241
--- /dev/null
+++ b/Showcase/Checkboxes.Designer.cs
@@ -0,0 +1,166 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using System;
+ using Terminal.Gui;
+ using Terminal.Gui.App;
+ using Terminal.Gui.Drawing;
+ using Terminal.Gui.Input;
+ using Terminal.Gui.ViewBase;
+ using Terminal.Gui.Views;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Drawing;
+
+
+ public partial class Checkboxes : Terminal.Gui.Views.Runnable {
+
+ private Terminal.Gui.Views.FrameView frameView;
+
+ private Terminal.Gui.Views.OptionSelector optionSelector;
+
+ private Terminal.Gui.Views.CheckBox checkBox;
+
+ private Terminal.Gui.Views.CheckBox checkBox2;
+
+ private Terminal.Gui.Views.CheckBox checkBox3;
+
+ private Terminal.Gui.Views.CheckBox checkBox4;
+
+ private Terminal.Gui.Views.CheckBox checkBox5;
+
+ private Terminal.Gui.Views.Label label;
+
+ private void InitializeComponent() {
+ this.label = new Terminal.Gui.Views.Label();
+ this.checkBox5 = new Terminal.Gui.Views.CheckBox();
+ this.checkBox4 = new Terminal.Gui.Views.CheckBox();
+ this.checkBox3 = new Terminal.Gui.Views.CheckBox();
+ this.checkBox2 = new Terminal.Gui.Views.CheckBox();
+ this.checkBox = new Terminal.Gui.Views.CheckBox();
+ this.optionSelector = new Terminal.Gui.Views.OptionSelector();
+ this.frameView = new Terminal.Gui.Views.FrameView();
+ this.Width = Dim.Fill(0);
+ this.Height = Dim.Fill(0);
+ this.X = 0;
+ this.Y = 0;
+ this.Visible = true;
+ this.CanFocus = true;
+ this.ShadowStyle = null;
+ this.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.frameView.Width = 20;
+ this.frameView.Height = 5;
+ this.frameView.X = 37;
+ this.frameView.Y = 1;
+ this.frameView.Visible = true;
+ this.frameView.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
+ this.frameView.CanFocus = true;
+ this.frameView.ShadowStyle = null;
+ this.frameView.Data = "frameView";
+ this.frameView.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.frameView.Title = "OptionSelector";
+ this.Add(this.frameView);
+ this.optionSelector.Width = 8;
+ this.optionSelector.Height = 3;
+ this.optionSelector.X = 0;
+ this.optionSelector.Y = 0;
+ this.optionSelector.Visible = true;
+ this.optionSelector.CanFocus = true;
+ this.optionSelector.ShadowStyle = null;
+ this.optionSelector.Data = "optionSelector";
+ this.optionSelector.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.optionSelector.Labels = new string[] {
+ "Cat",
+ "Fish",
+ "Dog"};
+ this.frameView.Add(this.optionSelector);
+ this.checkBox.Width = Dim.Auto();
+ this.checkBox.Height = Dim.Auto();
+ this.checkBox.X = 3;
+ this.checkBox.Y = 2;
+ this.checkBox.Visible = true;
+ this.checkBox.CanFocus = true;
+ this.checkBox.ShadowStyle = null;
+ this.checkBox.Data = "checkBox";
+ this.checkBox.Text = "Checkbox";
+ this.checkBox.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.checkBox.Value = Terminal.Gui.Views.CheckState.UnChecked;
+ this.checkBox.RadioStyle = false;
+ this.Add(this.checkBox);
+ this.checkBox2.Width = Dim.Auto();
+ this.checkBox2.Height = Dim.Auto();
+ this.checkBox2.X = 3;
+ this.checkBox2.Y = 4;
+ this.checkBox2.Visible = true;
+ this.checkBox2.CanFocus = true;
+ this.checkBox2.ShadowStyle = null;
+ this.checkBox2.Data = "checkBox2";
+ this.checkBox2.Text = "Use underscore for _hotkey";
+ this.checkBox2.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.checkBox2.Value = Terminal.Gui.Views.CheckState.UnChecked;
+ this.checkBox2.RadioStyle = false;
+ this.Add(this.checkBox2);
+ this.checkBox3.Width = Dim.Auto();
+ this.checkBox3.Height = Dim.Auto();
+ this.checkBox3.X = 3;
+ this.checkBox3.Y = 6;
+ this.checkBox3.Visible = true;
+ this.checkBox3.CanFocus = true;
+ this.checkBox3.ShadowStyle = null;
+ this.checkBox3.Data = "checkBox3";
+ this.checkBox3.Text = "Default Checked (Value=true)";
+ this.checkBox3.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.checkBox3.Value = Terminal.Gui.Views.CheckState.Checked;
+ this.checkBox3.RadioStyle = false;
+ this.Add(this.checkBox3);
+ this.checkBox4.Width = Dim.Auto();
+ this.checkBox4.Height = Dim.Auto();
+ this.checkBox4.X = 3;
+ this.checkBox4.Y = 8;
+ this.checkBox4.Visible = true;
+ this.checkBox4.CanFocus = true;
+ this.checkBox4.ShadowStyle = null;
+ this.checkBox4.Data = "checkBox4";
+ this.checkBox4.Text = "Radio style";
+ this.checkBox4.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.checkBox4.Value = Terminal.Gui.Views.CheckState.UnChecked;
+ this.checkBox4.RadioStyle = true;
+ this.Add(this.checkBox4);
+ this.checkBox5.Width = Dim.Auto();
+ this.checkBox5.Height = Dim.Auto();
+ this.checkBox5.X = 3;
+ this.checkBox5.Y = 10;
+ this.checkBox5.Visible = true;
+ this.checkBox5.CanFocus = true;
+ this.checkBox5.ShadowStyle = null;
+ this.checkBox5.Data = "checkBox5";
+ this.checkBox5.Text = "Radio style checked";
+ this.checkBox5.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.checkBox5.Value = Terminal.Gui.Views.CheckState.Checked;
+ this.checkBox5.RadioStyle = true;
+ this.Add(this.checkBox5);
+ this.label.Width = Dim.Fill(0);
+ this.label.Height = Dim.Auto();
+ this.label.X = 0;
+ this.label.Y = 14;
+ this.label.Visible = true;
+ this.label.CanFocus = false;
+ this.label.ShadowStyle = null;
+ this.label.Data = "label";
+ this.label.Text = ("Checkbox Demo\r\n---------------\r\nUse Value to indicate whether CheckBox is checked" +
+ "\r\nRadioStyle allows circular checkboxes but use OptionSelector instead if you wa" +
+ "nt real radio button grouping");
+ this.label.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.Add(this.label);
+ }
+ }
+}
diff --git a/Showcase/Checkboxes.cs b/Showcase/Checkboxes.cs
new file mode 100644
index 00000000..ce64c875
--- /dev/null
+++ b/Showcase/Checkboxes.cs
@@ -0,0 +1,20 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// You can make changes to this file and they will not be overwritten when saving.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using Terminal.Gui;
+
+
+ public partial class Checkboxes {
+
+ public Checkboxes() {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Showcase/ColorPickers.Designer.cs b/Showcase/ColorPickers.Designer.cs
new file mode 100644
index 00000000..47828c7b
--- /dev/null
+++ b/Showcase/ColorPickers.Designer.cs
@@ -0,0 +1,98 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using System;
+ using Terminal.Gui;
+ using Terminal.Gui.App;
+ using Terminal.Gui.Drawing;
+ using Terminal.Gui.Input;
+ using Terminal.Gui.ViewBase;
+ using Terminal.Gui.Views;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Drawing;
+
+
+ public partial class ColorPickers : Terminal.Gui.Views.Runnable {
+
+ private Terminal.Gui.Views.ColorPicker colorPicker;
+
+ private Terminal.Gui.Views.ColorPicker16 colorPicker16;
+
+ private Terminal.Gui.Views.Label label;
+
+ private Terminal.Gui.Views.Label label2;
+
+ private void InitializeComponent() {
+ this.label2 = new Terminal.Gui.Views.Label();
+ this.label = new Terminal.Gui.Views.Label();
+ this.colorPicker16 = new Terminal.Gui.Views.ColorPicker16();
+ this.colorPicker = new Terminal.Gui.Views.ColorPicker();
+ this.Width = Dim.Fill(0);
+ this.Height = Dim.Fill(0);
+ this.X = 0;
+ this.Y = 0;
+ this.Visible = true;
+ this.CanFocus = true;
+ this.ShadowStyle = null;
+ this.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.colorPicker.Width = 47;
+ this.colorPicker.Height = Dim.Auto();
+ this.colorPicker.X = 16;
+ this.colorPicker.Y = 3;
+ this.colorPicker.Visible = true;
+ this.colorPicker.CanFocus = true;
+ this.colorPicker.ShadowStyle = null;
+ this.colorPicker.Data = "colorPicker";
+ this.colorPicker.Text = "#048B3A";
+ this.colorPicker.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.colorPicker.Style.ColorModel = Terminal.Gui.Drawing.ColorModel.HSV;
+ this.colorPicker.Style.ShowColorName = false;
+ this.colorPicker.Style.ShowTextFields = true;
+ this.colorPicker.ApplyStyleChanges();
+ this.Add(this.colorPicker);
+ this.colorPicker16.Width = Dim.Auto();
+ this.colorPicker16.Height = Dim.Auto();
+ this.colorPicker16.X = 76;
+ this.colorPicker16.Y = 3;
+ this.colorPicker16.Visible = true;
+ this.colorPicker16.CanFocus = true;
+ this.colorPicker16.ShadowStyle = null;
+ this.colorPicker16.Data = "colorPicker16";
+ this.colorPicker16.Text = "";
+ this.colorPicker16.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.colorPicker16);
+ this.label.Width = Dim.Auto();
+ this.label.Height = Dim.Auto();
+ this.label.X = 31;
+ this.label.Y = 8;
+ this.label.Visible = true;
+ this.label.CanFocus = false;
+ this.label.ShadowStyle = null;
+ this.label.Data = "label";
+ this.label.Text = "--ColorPicker--";
+ this.label.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label);
+ this.label2.Width = Dim.Auto();
+ this.label2.Height = Dim.Auto();
+ this.label2.X = 83;
+ this.label2.Y = 8;
+ this.label2.Visible = true;
+ this.label2.CanFocus = false;
+ this.label2.ShadowStyle = null;
+ this.label2.Data = "label2";
+ this.label2.Text = "--ColorPicker16--";
+ this.label2.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label2);
+ }
+ }
+}
diff --git a/Showcase/ColorPickers.cs b/Showcase/ColorPickers.cs
new file mode 100644
index 00000000..71decd0f
--- /dev/null
+++ b/Showcase/ColorPickers.cs
@@ -0,0 +1,20 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// You can make changes to this file and they will not be overwritten when saving.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using Terminal.Gui;
+
+
+ public partial class ColorPickers {
+
+ public ColorPickers() {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Showcase/DateTimes.Designer.cs b/Showcase/DateTimes.Designer.cs
new file mode 100644
index 00000000..8a6b403e
--- /dev/null
+++ b/Showcase/DateTimes.Designer.cs
@@ -0,0 +1,125 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using System;
+ using Terminal.Gui;
+ using Terminal.Gui.App;
+ using Terminal.Gui.Drawing;
+ using Terminal.Gui.Input;
+ using Terminal.Gui.ViewBase;
+ using Terminal.Gui.Views;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Drawing;
+
+
+ public partial class DateTimes : Terminal.Gui.Views.Window {
+
+ private Terminal.Gui.Views.Label label;
+
+ private Terminal.Gui.Views.DateEditor dateEditor;
+
+ private Terminal.Gui.Views.Label label3;
+
+ private Terminal.Gui.Views.TimeEditor timeEditor;
+
+ private Terminal.Gui.Views.Label label2;
+
+ private Terminal.Gui.Views.DatePicker datePicker;
+
+ private void InitializeComponent() {
+ this.datePicker = new Terminal.Gui.Views.DatePicker();
+ this.label2 = new Terminal.Gui.Views.Label();
+ this.timeEditor = new Terminal.Gui.Views.TimeEditor();
+ this.label3 = new Terminal.Gui.Views.Label();
+ this.dateEditor = new Terminal.Gui.Views.DateEditor();
+
+ this.label = new Terminal.Gui.Views.Label();
+ this.Width = Dim.Fill(0);
+ this.Height = Dim.Fill(0);
+ this.X = 0;
+ this.Y = 0;
+ this.Visible = true;
+ this.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Overlapped;
+ this.CanFocus = true;
+ this.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyles.None;
+ this.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Title = "";
+ this.label.Width = Dim.Auto();
+ this.label.Height = Dim.Auto();
+ this.label.X = 0;
+ this.label.Y = 0;
+ this.label.Visible = true;
+ this.label.CanFocus = false;
+ this.label.ShadowStyle = null;
+ this.label.Data = "label";
+ this.label.Text = "DateEditor:";
+ this.label.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label);
+ this.dateEditor.Width = 10;
+ this.dateEditor.Height = 1;
+ this.dateEditor.X = 12;
+ this.dateEditor.Y = 0;
+ this.dateEditor.Visible = true;
+ this.dateEditor.CanFocus = true;
+ this.dateEditor.ShadowStyle = null;
+ this.dateEditor.Data = "dateEditor";
+ this.dateEditor.Text = "02/05/2026";
+ this.dateEditor.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.dateEditor);
+ this.label3.Width = Dim.Auto();
+ this.label3.Height = Dim.Auto();
+ this.label3.X = 24;
+ this.label3.Y = 0;
+ this.label3.Visible = true;
+ this.label3.CanFocus = false;
+ this.label3.ShadowStyle = null;
+ this.label3.Data = "label3";
+ this.label3.Text = "TimeEditor:";
+ this.label3.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label3);
+ this.timeEditor.Width = 8;
+ this.timeEditor.Height = 1;
+ this.timeEditor.X = 36;
+ this.timeEditor.Y = 0;
+ this.timeEditor.Visible = true;
+ this.timeEditor.CanFocus = true;
+ this.timeEditor.ShadowStyle = null;
+ this.timeEditor.Data = "timeEditor";
+ this.timeEditor.Text = "00:00:00";
+ this.timeEditor.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.timeEditor);
+ this.label2.Width = Dim.Auto();
+ this.label2.Height = Dim.Auto();
+ this.label2.X = 0;
+ this.label2.Y = 2;
+ this.label2.Visible = true;
+ this.label2.CanFocus = false;
+ this.label2.ShadowStyle = null;
+ this.label2.Data = "label2";
+ this.label2.Text = "DatePicker:";
+ this.label2.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label2);
+ this.datePicker.Width = Dim.Auto();
+ this.datePicker.Height = Dim.Auto();
+ this.datePicker.X = 0;
+ this.datePicker.Y = 3;
+ this.datePicker.Visible = true;
+ this.datePicker.CanFocus = true;
+ this.datePicker.ShadowStyle = null;
+ this.datePicker.Data = "datePicker";
+ this.datePicker.Text = "02/05/2026";
+ this.datePicker.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.datePicker);
+ }
+ }
+}
diff --git a/Showcase/DateTimes.cs b/Showcase/DateTimes.cs
new file mode 100644
index 00000000..91a1a33f
--- /dev/null
+++ b/Showcase/DateTimes.cs
@@ -0,0 +1,20 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// You can make changes to this file and they will not be overwritten when saving.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using Terminal.Gui;
+
+
+ public partial class DateTimes {
+
+ public DateTimes() {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Showcase/Lists.Designer.cs b/Showcase/Lists.Designer.cs
new file mode 100644
index 00000000..07ba4c73
--- /dev/null
+++ b/Showcase/Lists.Designer.cs
@@ -0,0 +1,104 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using System;
+ using Terminal.Gui;
+ using Terminal.Gui.App;
+ using Terminal.Gui.Drawing;
+ using Terminal.Gui.Input;
+ using Terminal.Gui.ViewBase;
+ using Terminal.Gui.Views;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Drawing;
+
+
+ public partial class Lists : Terminal.Gui.ViewBase.View {
+
+ private Terminal.Gui.Views.FrameView frameView;
+
+ private Terminal.Gui.Views.DropDownList dropDownList;
+
+ private Terminal.Gui.Views.FrameView frameView2;
+
+ private Terminal.Gui.Views.ListView listView;
+
+ private void InitializeComponent() {
+ this.listView = new Terminal.Gui.Views.ListView();
+ this.frameView2 = new Terminal.Gui.Views.FrameView();
+ this.dropDownList = new Terminal.Gui.Views.DropDownList();
+ this.frameView = new Terminal.Gui.Views.FrameView();
+ this.Width = Dim.Fill(0);
+ this.Height = Dim.Fill(0);
+ this.X = 0;
+ this.Y = 0;
+ this.Visible = true;
+ this.CanFocus = false;
+ this.ShadowStyle = null;
+ this.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.frameView.Width = 27;
+ this.frameView.Height = 5;
+ this.frameView.X = 0;
+ this.frameView.Y = 0;
+ this.frameView.Visible = true;
+ this.frameView.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
+ this.frameView.CanFocus = true;
+ this.frameView.ShadowStyle = null;
+ this.frameView.Data = "frameView";
+ this.frameView.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.frameView.Title = "DropDownList";
+ this.Add(this.frameView);
+ this.dropDownList.Width = 25;
+ this.dropDownList.Height = 2;
+ this.dropDownList.X = 0;
+ this.dropDownList.Y = 0;
+ this.dropDownList.Visible = true;
+ this.dropDownList.CanFocus = true;
+ this.dropDownList.ShadowStyle = null;
+ this.dropDownList.Secret = false;
+ this.dropDownList.Data = "dropDownList";
+ this.dropDownList.Text = "";
+ this.dropDownList.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.dropDownList.Source = new Terminal.Gui.Views.ListWrapper(new System.Collections.ObjectModel.ObservableCollection(new string[] {
+ "🐱 Cat",
+ "🐶 Dog",
+ "🐟 Fish"}));
+ this.frameView.Add(this.dropDownList);
+ this.frameView2.Width = 16;
+ this.frameView2.Height = 5;
+ this.frameView2.X = 27;
+ this.frameView2.Y = 0;
+ this.frameView2.Visible = true;
+ this.frameView2.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
+ this.frameView2.CanFocus = true;
+ this.frameView2.ShadowStyle = null;
+ this.frameView2.Data = "frameView2";
+ this.frameView2.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.frameView2.Title = "ListView";
+ this.Add(this.frameView2);
+ this.listView.Width = Dim.Fill(0);
+ this.listView.Height = 3;
+ this.listView.X = 0;
+ this.listView.Y = 0;
+ this.listView.Visible = true;
+ this.listView.CanFocus = true;
+ this.listView.ShadowStyle = null;
+ this.listView.Data = "listView";
+ this.listView.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.listView.Source = new Terminal.Gui.Views.ListWrapper(new System.Collections.ObjectModel.ObservableCollection(new string[] {
+ "🐱 Cat",
+ "🐶 Dog",
+ "🐟 Fish"}));
+ this.frameView2.Add(this.listView);
+ }
+ }
+}
diff --git a/Showcase/Tabs.cs b/Showcase/Lists.cs
similarity index 82%
rename from Showcase/Tabs.cs
rename to Showcase/Lists.cs
index 0b1d06f7..d5aa2774 100644
--- a/Showcase/Tabs.cs
+++ b/Showcase/Lists.cs
@@ -3,7 +3,7 @@
//
// This code was generated by:
-// TerminalGuiDesigner v2.0.0.0
+// TerminalGuiDesigner v2.0.2.0
// You can make changes to this file and they will not be overwritten when saving.
//
// -----------------------------------------------------------------------------
@@ -11,9 +11,9 @@ namespace Showcase {
using Terminal.Gui;
- public partial class Tabs {
+ public partial class Lists {
- public Tabs() {
+ public Lists() {
InitializeComponent();
}
}
diff --git a/Showcase/Menus.Designer.cs b/Showcase/Menus.Designer.cs
index 33652cf4..5df7bcc5 100644
--- a/Showcase/Menus.Designer.cs
+++ b/Showcase/Menus.Designer.cs
@@ -3,7 +3,7 @@
//
// This code was generated by:
-// TerminalGuiDesigner v2.0.0.0
+// TerminalGuiDesigner v2.0.2.0
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
@@ -22,39 +22,101 @@ namespace Showcase {
using System.Drawing;
- public partial class Menus : Terminal.Gui.ViewBase.View {
+ public partial class Menus : Terminal.Gui.Views.Dialog {
+
+ private Terminal.Gui.Views.Label label;
private Terminal.Gui.Views.MenuBar menuBar;
- private Terminal.Gui.Views.MenuBarItem fileF9Menu;
+ private Terminal.Gui.Views.MenuBarItem fileMenu;
+
+ private Terminal.Gui.Views.MenuItem newMenuItem;
- private Terminal.Gui.Views.MenuBarItem newMenu;
+ private Terminal.Gui.Views.MenuItem projectSolutionMenuItem;
- private Terminal.Gui.Views.MenuItem projectMenuItem;
+ private Terminal.Gui.Views.MenuItem projectFromExistingCodeMenuItem;
private Terminal.Gui.Views.MenuItem repositoryMenuItem;
private Terminal.Gui.Views.MenuItem fileMenuItem;
- private Terminal.Gui.Views.MenuItem projectFromExistingCodeMenuItem;
-
- private Terminal.Gui.Views.MenuItem spellCheckerConfigurationForSelectedItemMenuItem;
+ private Terminal.Gui.Views.MenuItem openMenuItem;
- private Terminal.Gui.Views.MenuBarItem openMenu;
-
- private Terminal.Gui.Views.MenuItem projectSolutionMenuItem;
+ private Terminal.Gui.Views.MenuItem projectSolutionMenuItem2;
private Terminal.Gui.Views.MenuItem folderMenuItem;
private Terminal.Gui.Views.MenuItem workspaceMenuItem;
- private Terminal.Gui.Views.MenuItem cMakeMenuItem;
-
private Terminal.Gui.Views.MenuItem fileMenuItem2;
+ private Terminal.Gui.Views.MenuItem clonERepositoryMenuItem;
+
+ private Terminal.Gui.Views.MenuItem startWindowMenuItem;
+
+ private Terminal.Gui.Views.MenuItem aDdMenuItem;
+
+ private Terminal.Gui.Views.MenuItem newProjectMenuItem;
+
+ private Terminal.Gui.Views.MenuItem existingProjectMenuItem;
+
+ private Terminal.Gui.Views.MenuItem existingWebSiteMenuItem;
+
+ private Terminal.Gui.Views.MenuItem closeMenuItem;
+
+ private Terminal.Gui.Views.MenuItem closeSolutionMenuItem;
+
+ private Terminal.Gui.Views.MenuItem saveModalscsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem saveModalscsAsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem saveAllMenuItem;
+
+ private Terminal.Gui.Views.MenuItem saveSolutionAsFilterMenuItem;
+
+ private Terminal.Gui.Views.MenuItem pageSetupMenuItem;
+
+ private Terminal.Gui.Views.MenuItem printMenuItem;
+
+ private Terminal.Gui.Views.MenuItem accountSettingsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem moveModalscsIntoMenuItem;
+
+ private Terminal.Gui.Views.MenuItem terminalGuiDesignerMenuItem;
+
+ private Terminal.Gui.Views.MenuItem solutionItemsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem unitTestsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem recentFilesMenuItem;
+
+ private Terminal.Gui.Views.MenuItem dReposTerminalGuiDesignerShowcaseMenuscsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem dReposTerminalGuiDesignerShowcaseMenusDesignercsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem dReposTerminalGuiDesignertestsMenuBarTestscsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem dMenuOperationsMoveMenuItemRightOperationcsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem dReposTerminalGuiDesignerShowcaseProgramcsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem dReposTerminalGuiDesignersrcUIEditorcsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem dReposTerminalGuiDesignersrcProgramcsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem dsrcbinDebugnet100MyViewDesignercsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem dTerminalGuiDesignersrcToCodeShadowStylePropertycsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem dReposTerminalGuiDesignersrcDesigncsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem recentProjectsAndSolutionsMenuItem;
+
+ private Terminal.Gui.Views.MenuItem exitMenuItem;
+
private Terminal.Gui.Views.MenuBarItem editMenu;
- private Terminal.Gui.Views.MenuBarItem goToMenu;
+ private Terminal.Gui.Views.MenuItem goToMenuItem;
private Terminal.Gui.Views.MenuItem goToLineMenuItem;
@@ -62,9 +124,19 @@ public partial class Menus : Terminal.Gui.ViewBase.View {
private Terminal.Gui.Views.MenuItem goToAllMenuItem;
- private Terminal.Gui.Views.MenuItem findAndReplaceMenuItem;
+ private Terminal.Gui.Views.MenuItem goToFileMenuItem;
+
+ private Terminal.Gui.Views.MenuItem goToRecentFileMenuItem;
+
+ private Terminal.Gui.Views.MenuItem goToTypeMenuItem;
+
+ private Terminal.Gui.Views.MenuItem goToMemberMenuItem;
+
+ private Terminal.Gui.Views.MenuItem goToSymbolMenuItem;
- private Terminal.Gui.Views.MenuItem goToBaseMenuItem;
+ private Terminal.Gui.Views.MenuItem goToLastEditLocationMenuItem;
+
+ private Terminal.Gui.Views.MenuItem findAndReplaceMenuItem;
private Terminal.Gui.Views.MenuItem undoMenuItem;
@@ -80,151 +152,321 @@ public partial class Menus : Terminal.Gui.ViewBase.View {
private Terminal.Gui.Views.MenuItem pasteMenuItem;
- private Terminal.Gui.Views.MenuItem showClipboardHistoryMenuItem;
+ private Terminal.Gui.Views.MenuItem deleteMenuItem;
+
+ private Terminal.Gui.Views.MenuItem selectAllMenuItem;
+
+ private Terminal.Gui.Views.MenuItem advancedMenuItem;
+
+ private Terminal.Gui.Views.MenuItem bookmarksMenuItem;
+
+ private Terminal.Gui.Views.MenuItem intelliSenseMenuItem;
+
+ private Terminal.Gui.Views.MenuItem multipleCaretsMenuItem;
+
+ private Terminal.Gui.Views.MenuBarItem viewMenu;
+
+ private Terminal.Gui.Views.MenuItem editMeMenuItem;
+
+ private Terminal.Gui.Views.MenuBarItem gitMenu;
+
+ private Terminal.Gui.Views.MenuItem editMeMenuItem2;
+
+ private Terminal.Gui.Views.MenuBarItem projectMenu;
+
+ private Terminal.Gui.Views.MenuItem editMeMenuItem3;
+
+ private Terminal.Gui.Views.MenuBarItem buildMenu;
+
+ private Terminal.Gui.Views.MenuItem editMeMenuItem4;
+
+ private Terminal.Gui.Views.MenuBarItem debugMenu;
+
+ private Terminal.Gui.Views.MenuItem editMeMenuItem5;
+
+ private Terminal.Gui.Views.MenuBarItem testMenu;
+
+ private Terminal.Gui.Views.MenuItem editMeMenuItem6;
+
+ private Terminal.Gui.Views.MenuBarItem toolsMenu;
+
+ private Terminal.Gui.Views.MenuItem editMeMenuItem7;
+
+ private Terminal.Gui.Views.MenuBarItem extensionsMenu;
+
+ private Terminal.Gui.Views.MenuItem editMeMenuItem8;
+
+ private Terminal.Gui.Views.MenuBarItem windowMenu;
+
+ private Terminal.Gui.Views.MenuItem editMeMenuItem9;
+
+ private Terminal.Gui.Views.MenuBarItem helpMenu;
+
+ private Terminal.Gui.Views.MenuItem editMeMenuItem10;
private void InitializeComponent() {
this.menuBar = new Terminal.Gui.Views.MenuBar();
- this.Width = Dim.Fill(0);
- this.Height = Dim.Fill(0);
- this.X = 0;
- this.Y = 0;
+ this.label = new Terminal.Gui.Views.Label();
+ this.Width = Dim.Percent(90);
+ this.Height = Dim.Percent(80);
+ this.X = Pos.Center();
+ this.Y = Pos.Center();
this.Visible = true;
- this.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
- this.CanFocus = false;
- this.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyle.None;
+ this.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Overlapped;
+ this.CanFocus = true;
+ this.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyles.Transparent;
this.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.label.Width = Dim.Fill(0);
+ this.label.Height = Dim.Auto();
+ this.label.X = 0;
+ this.label.Y = Pos.Center();
+ this.label.Visible = true;
+ this.label.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
+ this.label.CanFocus = false;
+ this.label.ShadowStyle = null;
+ this.label.Data = "label";
+ this.label.Text = @"Menu Editor Showcase
+-----------------------
+
+F9 to open menu
+Type to change menu text
+Shift up/down to reorder
+Shift right to move to submenu
+Shift left to move back to root
+Ctrl+Z to undo
+Ctrl+T to set shortcut
+Type three hyphens for separator
+Type underscore before letter for alt key
+
+(Editor keybindings can be changed from launch screen)";
+ this.label.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.Add(this.label);
this.menuBar.Width = Dim.Fill(0);
- this.menuBar.Height = 1;
+ this.menuBar.Height = Dim.Auto();
this.menuBar.X = 0;
this.menuBar.Y = 0;
this.menuBar.Visible = true;
this.menuBar.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
this.menuBar.CanFocus = false;
- this.menuBar.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyle.None;
+ this.menuBar.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyles.None;
this.menuBar.Data = "menuBar";
this.menuBar.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
- this.fileF9Menu = new Terminal.Gui.Views.MenuBarItem();
- this.fileF9Menu.Title = "_File (F9)";
- this.newMenu = new Terminal.Gui.Views.MenuBarItem();
- this.newMenu.Title = "New";
- this.projectMenuItem = new Terminal.Gui.Views.MenuItem();
- this.projectMenuItem.Title = "Project...";
- this.projectMenuItem.Data = "projectMenuItem";
- this.projectMenuItem.ShortcutKey = ((Terminal.Gui.Drivers.KeyCode)(1073741902u));
+ this.fileMenu = new Terminal.Gui.Views.MenuBarItem();
+ this.fileMenu.Title = "_File";
+ this.fileMenu.Key = new Key("F9");
+ this.newMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.newMenuItem.Title = "_New";
+ this.projectSolutionMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.projectSolutionMenuItem.Title = "Project/Solution...";
+ this.projectSolutionMenuItem.Key = new Key("N, CtrlMask, AltMask");
+ this.projectFromExistingCodeMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.projectFromExistingCodeMenuItem.Title = "Project From Existing Code...";
this.repositoryMenuItem = new Terminal.Gui.Views.MenuItem();
this.repositoryMenuItem.Title = "Repository...";
- this.repositoryMenuItem.Data = "repositoryMenuItem";
this.fileMenuItem = new Terminal.Gui.Views.MenuItem();
this.fileMenuItem.Title = "File...";
- this.fileMenuItem.Data = "fileMenuItem";
- this.projectFromExistingCodeMenuItem = new Terminal.Gui.Views.MenuItem();
- this.projectFromExistingCodeMenuItem.Title = "Project From Existing Code...";
- this.projectFromExistingCodeMenuItem.Data = "projectFromExistingCodeMenuItem";
- this.spellCheckerConfigurationForSelectedItemMenuItem = new Terminal.Gui.Views.MenuItem();
- this.spellCheckerConfigurationForSelectedItemMenuItem.Title = "Spell Checker Configuration for Selected Item";
- this.spellCheckerConfigurationForSelectedItemMenuItem.Data = "spellCheckerConfigurationForSelectedItemMenuItem";
- this.newMenu.Children = new Terminal.Gui.Views.MenuItem[] {
- this.projectMenuItem,
- this.repositoryMenuItem,
- this.fileMenuItem,
- this.projectFromExistingCodeMenuItem,
- null,
- this.spellCheckerConfigurationForSelectedItemMenuItem};
- this.openMenu = new Terminal.Gui.Views.MenuBarItem();
- this.openMenu.Title = "Open";
- this.projectSolutionMenuItem = new Terminal.Gui.Views.MenuItem();
- this.projectSolutionMenuItem.Title = "Project/Solution";
- this.projectSolutionMenuItem.Data = "projectSolutionMenuItem";
- this.projectSolutionMenuItem.ShortcutKey = ((Terminal.Gui.Drivers.KeyCode)(1342177359u));
+ this.fileMenuItem.Key = new Key("N, CtrlMask");
+ this.newMenuItem.SubMenu = new Menu([projectSolutionMenuItem,projectFromExistingCodeMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },repositoryMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },fileMenuItem]);
+ this.openMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.openMenuItem.Title = "_Open";
+ this.projectSolutionMenuItem2 = new Terminal.Gui.Views.MenuItem();
+ this.projectSolutionMenuItem2.Title = "Project/Solution...";
+ this.projectSolutionMenuItem2.Key = new Key("O, CtrlMask");
this.folderMenuItem = new Terminal.Gui.Views.MenuItem();
this.folderMenuItem.Title = "Folder...";
- this.folderMenuItem.Data = "folderMenuItem";
+ this.folderMenuItem.Key = new Key("O, CtrlMask, AltMask");
this.workspaceMenuItem = new Terminal.Gui.Views.MenuItem();
this.workspaceMenuItem.Title = "Workspace...";
- this.workspaceMenuItem.Data = "workspaceMenuItem";
- this.cMakeMenuItem = new Terminal.Gui.Views.MenuItem();
- this.cMakeMenuItem.Title = "CMake...";
- this.cMakeMenuItem.Data = "cMakeMenuItem";
this.fileMenuItem2 = new Terminal.Gui.Views.MenuItem();
this.fileMenuItem2.Title = "File...";
- this.fileMenuItem2.Data = "fileMenuItem2";
- this.fileMenuItem2.ShortcutKey = ((Terminal.Gui.Drivers.KeyCode)(1073741903u));
- this.openMenu.Children = new Terminal.Gui.Views.MenuItem[] {
- this.projectSolutionMenuItem,
- this.folderMenuItem,
- this.workspaceMenuItem,
- this.cMakeMenuItem,
- null,
- this.fileMenuItem2};
- this.fileF9Menu.Children = new Terminal.Gui.Views.MenuItem[] {
- this.newMenu,
- this.openMenu};
+ this.fileMenuItem2.Key = new Key("O, CtrlMask");
+ this.openMenuItem.SubMenu = new Menu([projectSolutionMenuItem2,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },folderMenuItem,workspaceMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },fileMenuItem2]);
+ this.clonERepositoryMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.clonERepositoryMenuItem.Title = "Clon_e Repository...";
+ this.startWindowMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.startWindowMenuItem.Title = "Start _Window";
+ this.aDdMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.aDdMenuItem.Title = "A_dd";
+ this.newProjectMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.newProjectMenuItem.Title = "New Project...";
+ this.existingProjectMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.existingProjectMenuItem.Title = "Existing Project...";
+ this.existingWebSiteMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.existingWebSiteMenuItem.Title = "Existing Web Site...";
+ this.aDdMenuItem.SubMenu = new Menu([newProjectMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },existingProjectMenuItem,existingWebSiteMenuItem]);
+ this.closeMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.closeMenuItem.Title = "Close";
+ this.closeSolutionMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.closeSolutionMenuItem.Title = "Close Solution";
+ this.saveModalscsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.saveModalscsMenuItem.Title = "Save Modals.cs";
+ this.saveModalscsMenuItem.Key = new Key("S, CtrlMask");
+ this.saveModalscsAsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.saveModalscsAsMenuItem.Title = "Save Modals.cs As...";
+ this.saveAllMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.saveAllMenuItem.Title = "Save All";
+ this.saveSolutionAsFilterMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.saveSolutionAsFilterMenuItem.Title = "Save Solution as Filter...";
+ this.pageSetupMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.pageSetupMenuItem.Title = "Page Setup...";
+ this.printMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.printMenuItem.Title = "Print...";
+ this.accountSettingsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.accountSettingsMenuItem.Title = "Account Settings...";
+ this.moveModalscsIntoMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.moveModalscsIntoMenuItem.Title = "Move Modals.cs into";
+ this.terminalGuiDesignerMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.terminalGuiDesignerMenuItem.Title = "1 TerminalGuiDesigner";
+ this.solutionItemsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.solutionItemsMenuItem.Title = "2 Solution Items";
+ this.unitTestsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.unitTestsMenuItem.Title = "3 UnitTests";
+ this.moveModalscsIntoMenuItem.SubMenu = new Menu([terminalGuiDesignerMenuItem,solutionItemsMenuItem,unitTestsMenuItem]);
+ this.recentFilesMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.recentFilesMenuItem.Title = "Recent Files";
+ this.dReposTerminalGuiDesignerShowcaseMenuscsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.dReposTerminalGuiDesignerShowcaseMenuscsMenuItem.Title = "1 D:\\Repos\\TerminalGuiDesigner\\Showcase\\Menus.cs";
+ this.dReposTerminalGuiDesignerShowcaseMenusDesignercsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.dReposTerminalGuiDesignerShowcaseMenusDesignercsMenuItem.Title = "2 D:\\Repos\\TerminalGuiDesigner\\Showcase\\Menus.Designer.cs";
+ this.dReposTerminalGuiDesignertestsMenuBarTestscsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.dReposTerminalGuiDesignertestsMenuBarTestscsMenuItem.Title = "3 D:\\Repos\\TerminalGuiDesigner\\tests\\MenuBarTests.cs";
+ this.dMenuOperationsMoveMenuItemRightOperationcsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.dMenuOperationsMoveMenuItemRightOperationcsMenuItem.Title = "4 D:\\...\\MenuOperations\\MoveMenuItemRightOperation.cs";
+ this.dReposTerminalGuiDesignerShowcaseProgramcsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.dReposTerminalGuiDesignerShowcaseProgramcsMenuItem.Title = "5 D:\\Repos\\TerminalGuiDesigner\\Showcase\\Program.cs";
+ this.dReposTerminalGuiDesignersrcUIEditorcsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.dReposTerminalGuiDesignersrcUIEditorcsMenuItem.Title = "6 D:\\Repos\\TerminalGuiDesigner\\src\\UI\\Editor.cs";
+ this.dReposTerminalGuiDesignersrcProgramcsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.dReposTerminalGuiDesignersrcProgramcsMenuItem.Title = "7 D:\\Repos\\TerminalGuiDesigner\\src\\Program.cs";
+ this.dsrcbinDebugnet100MyViewDesignercsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.dsrcbinDebugnet100MyViewDesignercsMenuItem.Title = "8 D:\\...\\src\\bin\\Debug\\net10.0\\MyView.Designer.cs";
+ this.dTerminalGuiDesignersrcToCodeShadowStylePropertycsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.dTerminalGuiDesignersrcToCodeShadowStylePropertycsMenuItem.Title = "9 D:\\...\\TerminalGuiDesigner\\src\\ToCode\\ShadowStyleProperty.cs";
+ this.dReposTerminalGuiDesignersrcDesigncsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.dReposTerminalGuiDesignersrcDesigncsMenuItem.Title = "10 D:\\Repos\\TerminalGuiDesigner\\src\\Design.cs";
+ this.recentFilesMenuItem.SubMenu = new Menu([dReposTerminalGuiDesignerShowcaseMenuscsMenuItem,dReposTerminalGuiDesignerShowcaseMenusDesignercsMenuItem,dReposTerminalGuiDesignertestsMenuBarTestscsMenuItem,dMenuOperationsMoveMenuItemRightOperationcsMenuItem,dReposTerminalGuiDesignerShowcaseProgramcsMenuItem,dReposTerminalGuiDesignersrcUIEditorcsMenuItem,dReposTerminalGuiDesignersrcProgramcsMenuItem,dsrcbinDebugnet100MyViewDesignercsMenuItem,dTerminalGuiDesignersrcToCodeShadowStylePropertycsMenuItem,dReposTerminalGuiDesignersrcDesigncsMenuItem]);
+ this.recentProjectsAndSolutionsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.recentProjectsAndSolutionsMenuItem.Title = "Recent Projects and Solutions";
+ this.exitMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.exitMenuItem.Title = "Exit";
+ this.exitMenuItem.Key = new Key("X, CtrlMask");
+ this.fileMenu.PopoverMenu = new PopoverMenu([newMenuItem,openMenuItem,clonERepositoryMenuItem,startWindowMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },aDdMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },closeMenuItem,closeSolutionMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },saveModalscsMenuItem,saveModalscsAsMenuItem,saveAllMenuItem,saveSolutionAsFilterMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },pageSetupMenuItem,printMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },accountSettingsMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },moveModalscsIntoMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },recentFilesMenuItem,recentProjectsAndSolutionsMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },exitMenuItem]);
+ this.menuBar.Add(this.fileMenu);
this.editMenu = new Terminal.Gui.Views.MenuBarItem();
this.editMenu.Title = "Edit";
- this.goToMenu = new Terminal.Gui.Views.MenuBarItem();
- this.goToMenu.Title = "Go To";
+ this.goToMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.goToMenuItem.Title = "Go To";
this.goToLineMenuItem = new Terminal.Gui.Views.MenuItem();
this.goToLineMenuItem.Title = "Go To Line...";
- this.goToLineMenuItem.Data = "goToLineMenuItem";
- this.goToLineMenuItem.ShortcutKey = ((Terminal.Gui.Drivers.KeyCode)(1073741895u));
+ this.goToLineMenuItem.Key = new Key("G, CtrlMask");
this.goToTextMenuItem = new Terminal.Gui.Views.MenuItem();
this.goToTextMenuItem.Title = "Go To Text...";
- this.goToTextMenuItem.Data = "goToTextMenuItem";
- this.goToTextMenuItem.ShortcutKey = ((Terminal.Gui.Drivers.KeyCode)(2415919174u));
this.goToAllMenuItem = new Terminal.Gui.Views.MenuItem();
this.goToAllMenuItem.Title = "Go To All...";
- this.goToAllMenuItem.Data = "goToAllMenuItem";
- this.goToMenu.Children = new Terminal.Gui.Views.MenuItem[] {
- this.goToLineMenuItem,
- this.goToTextMenuItem,
- this.goToAllMenuItem};
+ this.goToFileMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.goToFileMenuItem.Title = "Go To File...";
+ this.goToRecentFileMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.goToRecentFileMenuItem.Title = "Go To Recent File...";
+ this.goToTypeMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.goToTypeMenuItem.Title = "Go To Type...";
+ this.goToMemberMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.goToMemberMenuItem.Title = "Go To Member...";
+ this.goToSymbolMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.goToSymbolMenuItem.Title = "Go To Symbol...";
+ this.goToLastEditLocationMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.goToLastEditLocationMenuItem.Title = "Go To Last Edit Location";
+ this.goToLastEditLocationMenuItem.Key = new Key("Backspace, CtrlMask");
+ this.goToMenuItem.SubMenu = new Menu([goToLineMenuItem,goToTextMenuItem,goToAllMenuItem,goToFileMenuItem,goToRecentFileMenuItem,goToTypeMenuItem,goToMemberMenuItem,goToSymbolMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },goToLastEditLocationMenuItem]);
this.findAndReplaceMenuItem = new Terminal.Gui.Views.MenuItem();
- this.findAndReplaceMenuItem.Title = "Find and Replace";
- this.findAndReplaceMenuItem.Data = "findAndReplaceMenuItem";
- this.goToBaseMenuItem = new Terminal.Gui.Views.MenuItem();
- this.goToBaseMenuItem.Title = "Go To Base";
- this.goToBaseMenuItem.Data = "goToBaseMenuItem";
+ this.findAndReplaceMenuItem.Title = "Find and Replace";
this.undoMenuItem = new Terminal.Gui.Views.MenuItem();
this.undoMenuItem.Title = "Undo";
- this.undoMenuItem.Data = "undoMenuItem";
this.redoMenuItem = new Terminal.Gui.Views.MenuItem();
this.redoMenuItem.Title = "Redo";
- this.redoMenuItem.Data = "redoMenuItem";
this.undoLastGlobalActionMenuItem = new Terminal.Gui.Views.MenuItem();
this.undoLastGlobalActionMenuItem.Title = "Undo Last Global Action";
- this.undoLastGlobalActionMenuItem.Data = "undoLastGlobalActionMenuItem";
this.redoLastGlobalActionMenuItem = new Terminal.Gui.Views.MenuItem();
this.redoLastGlobalActionMenuItem.Title = "Redo Last Global Action";
- this.redoLastGlobalActionMenuItem.Data = "redoLastGlobalActionMenuItem";
this.cutMenuItem = new Terminal.Gui.Views.MenuItem();
this.cutMenuItem.Title = "Cut";
- this.cutMenuItem.Data = "cutMenuItem";
this.copyMenuItem = new Terminal.Gui.Views.MenuItem();
this.copyMenuItem.Title = "Copy";
- this.copyMenuItem.Data = "copyMenuItem";
this.pasteMenuItem = new Terminal.Gui.Views.MenuItem();
this.pasteMenuItem.Title = "Paste";
- this.pasteMenuItem.Data = "pasteMenuItem";
- this.showClipboardHistoryMenuItem = new Terminal.Gui.Views.MenuItem();
- this.showClipboardHistoryMenuItem.Title = "Show Clipboard History";
- this.showClipboardHistoryMenuItem.Data = "showClipboardHistoryMenuItem";
- this.editMenu.Children = new Terminal.Gui.Views.MenuItem[] {
- this.goToMenu,
- this.findAndReplaceMenuItem,
- this.goToBaseMenuItem,
- null,
- this.undoMenuItem,
- this.redoMenuItem,
- this.undoLastGlobalActionMenuItem,
- this.redoLastGlobalActionMenuItem,
- null,
- this.cutMenuItem,
- this.copyMenuItem,
- this.pasteMenuItem,
- this.showClipboardHistoryMenuItem};
- this.menuBar.Menus = new Terminal.Gui.Views.MenuBarItem[] {
- this.fileF9Menu,
- this.editMenu};
+ this.deleteMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.deleteMenuItem.Title = "Delete";
+ this.selectAllMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.selectAllMenuItem.Title = "Select All";
+ this.advancedMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.advancedMenuItem.Title = "Advanced";
+ this.bookmarksMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.bookmarksMenuItem.Title = "Bookmarks";
+ this.intelliSenseMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.intelliSenseMenuItem.Title = "IntelliSense";
+ this.multipleCaretsMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.multipleCaretsMenuItem.Title = "Multiple Carets";
+ this.editMenu.PopoverMenu = new PopoverMenu([goToMenuItem,findAndReplaceMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },undoMenuItem,redoMenuItem,undoLastGlobalActionMenuItem,redoLastGlobalActionMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },cutMenuItem,copyMenuItem,pasteMenuItem,deleteMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },selectAllMenuItem,new Line { Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal },advancedMenuItem,bookmarksMenuItem,intelliSenseMenuItem,multipleCaretsMenuItem]);
+ this.menuBar.Add(this.editMenu);
+ this.viewMenu = new Terminal.Gui.Views.MenuBarItem();
+ this.viewMenu.Title = "View";
+ this.editMeMenuItem = new Terminal.Gui.Views.MenuItem();
+ this.editMeMenuItem.Title = "Edit Me";
+ this.viewMenu.PopoverMenu = new PopoverMenu([editMeMenuItem]);
+ this.menuBar.Add(this.viewMenu);
+ this.gitMenu = new Terminal.Gui.Views.MenuBarItem();
+ this.gitMenu.Title = "Git";
+ this.editMeMenuItem2 = new Terminal.Gui.Views.MenuItem();
+ this.editMeMenuItem2.Title = "Edit Me";
+ this.gitMenu.PopoverMenu = new PopoverMenu([editMeMenuItem2]);
+ this.menuBar.Add(this.gitMenu);
+ this.projectMenu = new Terminal.Gui.Views.MenuBarItem();
+ this.projectMenu.Title = "Project";
+ this.editMeMenuItem3 = new Terminal.Gui.Views.MenuItem();
+ this.editMeMenuItem3.Title = "Edit Me";
+ this.projectMenu.PopoverMenu = new PopoverMenu([editMeMenuItem3]);
+ this.menuBar.Add(this.projectMenu);
+ this.buildMenu = new Terminal.Gui.Views.MenuBarItem();
+ this.buildMenu.Title = "Build";
+ this.editMeMenuItem4 = new Terminal.Gui.Views.MenuItem();
+ this.editMeMenuItem4.Title = "Edit Me";
+ this.buildMenu.PopoverMenu = new PopoverMenu([editMeMenuItem4]);
+ this.menuBar.Add(this.buildMenu);
+ this.debugMenu = new Terminal.Gui.Views.MenuBarItem();
+ this.debugMenu.Title = "Debug";
+ this.editMeMenuItem5 = new Terminal.Gui.Views.MenuItem();
+ this.editMeMenuItem5.Title = "Edit Me";
+ this.debugMenu.PopoverMenu = new PopoverMenu([editMeMenuItem5]);
+ this.menuBar.Add(this.debugMenu);
+ this.testMenu = new Terminal.Gui.Views.MenuBarItem();
+ this.testMenu.Title = "Test";
+ this.editMeMenuItem6 = new Terminal.Gui.Views.MenuItem();
+ this.editMeMenuItem6.Title = "Edit Me";
+ this.testMenu.PopoverMenu = new PopoverMenu([editMeMenuItem6]);
+ this.menuBar.Add(this.testMenu);
+ this.toolsMenu = new Terminal.Gui.Views.MenuBarItem();
+ this.toolsMenu.Title = "Tools";
+ this.editMeMenuItem7 = new Terminal.Gui.Views.MenuItem();
+ this.editMeMenuItem7.Title = "Edit Me";
+ this.toolsMenu.PopoverMenu = new PopoverMenu([editMeMenuItem7]);
+ this.menuBar.Add(this.toolsMenu);
+ this.extensionsMenu = new Terminal.Gui.Views.MenuBarItem();
+ this.extensionsMenu.Title = "Extensions";
+ this.editMeMenuItem8 = new Terminal.Gui.Views.MenuItem();
+ this.editMeMenuItem8.Title = "Edit Me";
+ this.extensionsMenu.PopoverMenu = new PopoverMenu([editMeMenuItem8]);
+ this.menuBar.Add(this.extensionsMenu);
+ this.windowMenu = new Terminal.Gui.Views.MenuBarItem();
+ this.windowMenu.Title = "Window";
+ this.editMeMenuItem9 = new Terminal.Gui.Views.MenuItem();
+ this.editMeMenuItem9.Title = "Edit Me";
+ this.windowMenu.PopoverMenu = new PopoverMenu([editMeMenuItem9]);
+ this.menuBar.Add(this.windowMenu);
+ this.helpMenu = new Terminal.Gui.Views.MenuBarItem();
+ this.helpMenu.Title = "Help";
+ this.editMeMenuItem10 = new Terminal.Gui.Views.MenuItem();
+ this.editMeMenuItem10.Title = "Edit Me";
+ this.helpMenu.PopoverMenu = new PopoverMenu([editMeMenuItem10]);
+ this.menuBar.Add(this.helpMenu);
this.Add(this.menuBar);
}
}
diff --git a/Showcase/Numbers.Designer.cs b/Showcase/Numbers.Designer.cs
new file mode 100644
index 00000000..ccc8c562
--- /dev/null
+++ b/Showcase/Numbers.Designer.cs
@@ -0,0 +1,261 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using System;
+ using Terminal.Gui;
+ using Terminal.Gui.App;
+ using Terminal.Gui.Drawing;
+ using Terminal.Gui.Input;
+ using Terminal.Gui.ViewBase;
+ using Terminal.Gui.Views;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Drawing;
+
+
+ public partial class Numbers : Terminal.Gui.Views.Dialog {
+
+ private Terminal.Gui.Views.Label label;
+
+ private Terminal.Gui.Views.NumericUpDown numericUpDown;
+
+ private Terminal.Gui.Views.Label label2;
+
+ private Terminal.Gui.Views.NumericUpDown numericUpDown1;
+
+ private Terminal.Gui.Views.Label label3;
+
+ private Terminal.Gui.Views.NumericUpDown numericUpDown2;
+
+ private Terminal.Gui.Views.Label label4;
+
+ private Terminal.Gui.Views.NumericUpDown numericUpDown3;
+
+ private Terminal.Gui.Views.Label label5;
+
+ private Terminal.Gui.Views.NumericUpDown numericUpDown4;
+
+ private Terminal.Gui.Views.Label label6;
+
+ private Terminal.Gui.Views.NumericUpDown numericUpDown5;
+
+ private Terminal.Gui.Views.Label label7;
+
+ private Terminal.Gui.Views.ProgressBar progressBar;
+
+ private Terminal.Gui.Views.SpinnerView spinnerView;
+
+ private void InitializeComponent() {
+ this.spinnerView = new Terminal.Gui.Views.SpinnerView();
+ this.progressBar = new Terminal.Gui.Views.ProgressBar();
+ this.label7 = new Terminal.Gui.Views.Label();
+ this.numericUpDown5 = new Terminal.Gui.Views.NumericUpDown();
+ this.label6 = new Terminal.Gui.Views.Label();
+ this.numericUpDown4 = new Terminal.Gui.Views.NumericUpDown();
+ this.label5 = new Terminal.Gui.Views.Label();
+ this.numericUpDown3 = new Terminal.Gui.Views.NumericUpDown();
+ this.label4 = new Terminal.Gui.Views.Label();
+ this.numericUpDown2 = new Terminal.Gui.Views.NumericUpDown();
+ this.label3 = new Terminal.Gui.Views.Label();
+ this.numericUpDown1 = new Terminal.Gui.Views.NumericUpDown();
+ this.label2 = new Terminal.Gui.Views.Label();
+ this.numericUpDown = new Terminal.Gui.Views.NumericUpDown();
+ this.label = new Terminal.Gui.Views.Label();
+ this.Width = Dim.Percent(90);
+ this.Height = Dim.Percent(80);
+ this.X = Pos.Center();
+ this.Y = Pos.Center();
+ this.Visible = true;
+ this.CanFocus = true;
+ this.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyles.Transparent;
+ this.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.label.Width = Dim.Auto();
+ this.label.Height = Dim.Auto();
+ this.label.X = 0;
+ this.label.Y = 0;
+ this.label.Visible = true;
+ this.label.CanFocus = false;
+ this.label.ShadowStyle = null;
+ this.label.Data = "label";
+ this.label.Text = "NumericUpDown";
+ this.label.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label);
+ this.numericUpDown.Width = 8;
+ this.numericUpDown.Height = 1;
+ this.numericUpDown.X = 23;
+ this.numericUpDown.Y = 0;
+ this.numericUpDown.Visible = true;
+ this.numericUpDown.CanFocus = true;
+ this.numericUpDown.ShadowStyle = null;
+ this.numericUpDown.Data = "numericUpDown";
+ this.numericUpDown.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.numericUpDown.Value = 0;
+ this.numericUpDown.Increment = 1;
+ this.Add(this.numericUpDown);
+ this.label2.Width = Dim.Auto();
+ this.label2.Height = Dim.Auto();
+ this.label2.X = 0;
+ this.label2.Y = 1;
+ this.label2.Visible = true;
+ this.label2.CanFocus = false;
+ this.label2.ShadowStyle = null;
+ this.label2.Data = "label2";
+ this.label2.Text = "NumericUpDown";
+ this.label2.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label2);
+ this.numericUpDown1.Width = Dim.Auto();
+ this.numericUpDown1.Height = Dim.Auto();
+ this.numericUpDown1.X = 23;
+ this.numericUpDown1.Y = 1;
+ this.numericUpDown1.Visible = true;
+ this.numericUpDown1.CanFocus = true;
+ this.numericUpDown1.ShadowStyle = null;
+ this.numericUpDown1.Data = "numericUpDown1";
+ this.numericUpDown1.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.numericUpDown1.Value = 11.1m;
+ this.numericUpDown1.Increment = 0.001m;
+ this.Add(this.numericUpDown1);
+ this.label3.Width = Dim.Auto();
+ this.label3.Height = Dim.Auto();
+ this.label3.X = 0;
+ this.label3.Y = 2;
+ this.label3.Visible = true;
+ this.label3.CanFocus = false;
+ this.label3.ShadowStyle = null;
+ this.label3.Data = "label3";
+ this.label3.Text = "NumericUpDown";
+ this.label3.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label3);
+ this.numericUpDown2.Width = Dim.Auto();
+ this.numericUpDown2.Height = Dim.Auto();
+ this.numericUpDown2.X = 23;
+ this.numericUpDown2.Y = 2;
+ this.numericUpDown2.Visible = true;
+ this.numericUpDown2.CanFocus = true;
+ this.numericUpDown2.ShadowStyle = null;
+ this.numericUpDown2.Data = "numericUpDown2";
+ this.numericUpDown2.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.numericUpDown2.Value = 12.3D;
+ this.numericUpDown2.Increment = 0.1D;
+ this.Add(this.numericUpDown2);
+ this.label4.Width = Dim.Auto();
+ this.label4.Height = Dim.Auto();
+ this.label4.X = 0;
+ this.label4.Y = 3;
+ this.label4.Visible = true;
+ this.label4.CanFocus = false;
+ this.label4.ShadowStyle = null;
+ this.label4.Data = "label4";
+ this.label4.Text = "NumericUpDown";
+ this.label4.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label4);
+ this.numericUpDown3.Width = Dim.Auto();
+ this.numericUpDown3.Height = Dim.Auto();
+ this.numericUpDown3.X = 23;
+ this.numericUpDown3.Y = 3;
+ this.numericUpDown3.Visible = true;
+ this.numericUpDown3.CanFocus = true;
+ this.numericUpDown3.ShadowStyle = null;
+ this.numericUpDown3.Data = "numericUpDown3";
+ this.numericUpDown3.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.numericUpDown3.Value = 12312321;
+ this.numericUpDown3.Increment = 1;
+ this.Add(this.numericUpDown3);
+ this.label5.Width = Dim.Auto();
+ this.label5.Height = Dim.Auto();
+ this.label5.X = 0;
+ this.label5.Y = 4;
+ this.label5.Visible = true;
+ this.label5.CanFocus = false;
+ this.label5.ShadowStyle = null;
+ this.label5.Data = "label5";
+ this.label5.Text = "NumericUpDown";
+ this.label5.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label5);
+ this.numericUpDown4.Width = Dim.Auto();
+ this.numericUpDown4.Height = Dim.Auto();
+ this.numericUpDown4.X = 23;
+ this.numericUpDown4.Y = 4;
+ this.numericUpDown4.Visible = true;
+ this.numericUpDown4.CanFocus = true;
+ this.numericUpDown4.ShadowStyle = null;
+ this.numericUpDown4.Data = "numericUpDown4";
+ this.numericUpDown4.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.numericUpDown4.Value = 6147483647;
+ this.numericUpDown4.Increment = 10000000000;
+ this.Add(this.numericUpDown4);
+ this.label6.Width = Dim.Auto();
+ this.label6.Height = Dim.Auto();
+ this.label6.X = 0;
+ this.label6.Y = 5;
+ this.label6.Visible = true;
+ this.label6.CanFocus = false;
+ this.label6.ShadowStyle = null;
+ this.label6.Data = "label6";
+ this.label6.Text = "NumericUpDown";
+ this.label6.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label6);
+ this.numericUpDown5.Width = Dim.Auto();
+ this.numericUpDown5.Height = Dim.Auto();
+ this.numericUpDown5.X = 23;
+ this.numericUpDown5.Y = 5;
+ this.numericUpDown5.Visible = true;
+ this.numericUpDown5.CanFocus = true;
+ this.numericUpDown5.ShadowStyle = null;
+ this.numericUpDown5.Data = "numericUpDown5";
+ this.numericUpDown5.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.numericUpDown5.Value = 0F;
+ this.numericUpDown5.Increment = 1F;
+ this.Add(this.numericUpDown5);
+ this.label7.Width = Dim.Auto();
+ this.label7.Height = Dim.Auto();
+ this.label7.X = 0;
+ this.label7.Y = 7;
+ this.label7.Visible = true;
+ this.label7.CanFocus = false;
+ this.label7.ShadowStyle = null;
+ this.label7.Data = "label7";
+ this.label7.Text = "ProgressBar with Spinner";
+ this.label7.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label7);
+ this.progressBar.Width = 95;
+ this.progressBar.Height = 1;
+ this.progressBar.X = 0;
+ this.progressBar.Y = 8;
+ this.progressBar.Visible = true;
+ this.progressBar.CanFocus = false;
+ this.progressBar.ShadowStyle = null;
+ this.progressBar.Data = "progressBar";
+ this.progressBar.Text = "100%";
+ this.progressBar.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.progressBar.Fraction = 1F;
+ this.progressBar.BidirectionalMarquee = true;
+ this.progressBar.ProgressBarStyle = Terminal.Gui.Views.ProgressBarStyle.MarqueeBlocks;
+ this.progressBar.ProgressBarFormat = Terminal.Gui.Views.ProgressBarFormat.Simple;
+ this.progressBar.SegmentCharacter = new System.Text.Rune('▌');
+ this.Add(this.progressBar);
+ this.spinnerView.Width = 1;
+ this.spinnerView.Height = 1;
+ this.spinnerView.X = 96;
+ this.spinnerView.Y = 8;
+ this.spinnerView.Visible = true;
+ this.spinnerView.CanFocus = false;
+ this.spinnerView.ShadowStyle = null;
+ this.spinnerView.AutoSpin = true;
+ this.spinnerView.Style = new Terminal.Gui.Views.SpinnerStyle.Line();
+ this.spinnerView.Data = "spinnerView";
+ this.spinnerView.Text = "";
+ this.spinnerView.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.spinnerView);
+ }
+ }
+}
diff --git a/Showcase/Numbers.cs b/Showcase/Numbers.cs
new file mode 100644
index 00000000..31767cbc
--- /dev/null
+++ b/Showcase/Numbers.cs
@@ -0,0 +1,20 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// You can make changes to this file and they will not be overwritten when saving.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using Terminal.Gui;
+
+
+ public partial class Numbers {
+
+ public Numbers() {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Showcase/Program.cs b/Showcase/Program.cs
index c21b179a..82ad092f 100644
--- a/Showcase/Program.cs
+++ b/Showcase/Program.cs
@@ -1,8 +1,5 @@
-using System.Collections.ObjectModel;
-using System.Runtime.InteropServices.ComTypes;
-using Terminal.Gui;
-using Terminal.Gui.App;
-using Terminal.Gui.Drivers;
+using Terminal.Gui.App;
+using Terminal.Gui.Input;
using Terminal.Gui.ViewBase;
using Terminal.Gui.Views;
@@ -10,42 +7,65 @@ namespace Showcase
{
internal class Program
{
- private static Type[] views = new[]
- {
- typeof(Menus),
- typeof(Tabs)
-
- };
static void Main(string[] args)
{
- Application.Init();
+ Type[] types = [
+ typeof(Menus),
+ typeof(Buttons),
+ typeof(Text),
+ typeof(Checkboxes),
+ typeof(DateTimes),
+ typeof(ColorPickers),
+ typeof(Ranges),
+ typeof(Numbers),
+ typeof(Lists),
+ typeof(TablesAndGraphs)
+ ];
- var w = new Window()
+ using (var app = Application.Create())
{
- Title = "Showcase"
- };
+ var tv = new TableView()
+ {
+ Width = Dim.Fill(),
+ Height = Dim.Fill()
+ };
- var lv = new ListView()
- {
- Width = Dim.Fill(),
- Height = Dim.Fill(),
- };
- w.Add(lv);
- lv.SetSource(new ObservableCollection(views));
-
-
- lv.KeyDown += (_, e) =>
- {
- if (e.KeyCode == KeyCode.Enter)
+ tv.Table = new EnumerableTableSource(types,
+ new Dictionary> { { "Scenario (Enter to open, Esc to close/exit)", (t) => t.Name + $" ({t.BaseType?.Name})"} }
+ );
+
+ tv.KeyBindings.ReplaceCommands(Key.Enter,Command.Accept);
+
+ tv.Accepted += (s, e) =>
{
- var v = (Toplevel)Activator.CreateInstance(views[lv.SelectedItem]);
- e.Handled = true;
- Application.Run(v);
- }
- };
-
- Application.Run(w);
- Application.Shutdown();
+ var row = tv.Value.SelectedCell.Y;
+ if (row >= 0 && row < types.Length)
+ {
+ var toCreate = types[row];
+ View view = (View)Activator.CreateInstance(toCreate);
+
+ if(view is Runnable r)
+ {
+ app.Run(r);
+ }
+ else
+ {
+ var newRunnable = new Runnable();
+ newRunnable.Add(view);
+ app.Run(newRunnable);
+ }
+
+ e.Handled = true;
+ }
+ };
+
+ var r = new Runnable();
+ r.Add(tv);
+
+ app.Init();
+ app.Run(r);
+ app.Dispose();
+ }
}
}
}
diff --git a/Showcase/Ranges.Designer.cs b/Showcase/Ranges.Designer.cs
new file mode 100644
index 00000000..decb0106
--- /dev/null
+++ b/Showcase/Ranges.Designer.cs
@@ -0,0 +1,403 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using System;
+ using Terminal.Gui;
+ using Terminal.Gui.App;
+ using Terminal.Gui.Drawing;
+ using Terminal.Gui.Input;
+ using Terminal.Gui.ViewBase;
+ using Terminal.Gui.Views;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Drawing;
+
+
+ public partial class Ranges : Terminal.Gui.Views.Dialog {
+
+ private Terminal.Gui.Views.Line line;
+
+ private Terminal.Gui.Views.LinearRange linearRange1;
+
+ private Terminal.Gui.Views.Label label;
+
+ private Terminal.Gui.Views.LinearRange linearRange2;
+
+ private Terminal.Gui.Views.LinearRange linearRange5;
+
+ private Terminal.Gui.Views.Label label2;
+
+ private Terminal.Gui.Views.Label label4;
+
+ private Terminal.Gui.Views.LinearRange linearRange3;
+
+ private Terminal.Gui.Views.Label label3;
+
+ private Terminal.Gui.Views.LinearRange linearRange4;
+
+ private Terminal.Gui.Views.Label label5;
+
+ private Terminal.Gui.Views.Label label7;
+
+ private Terminal.Gui.Views.LinearRange linearRange6;
+
+ private Terminal.Gui.Views.Label label6;
+
+ private Terminal.Gui.Views.LinearRange linearRange7;
+
+ private Terminal.Gui.Views.Label label8;
+
+ private Terminal.Gui.Views.Line line2;
+
+ private Terminal.Gui.Views.Label label93;
+
+ private Terminal.Gui.Views.Label label9;
+
+ private Terminal.Gui.Views.Label label92;
+
+ private void InitializeComponent() {
+ this.label92 = new Terminal.Gui.Views.Label();
+ this.label9 = new Terminal.Gui.Views.Label();
+ this.label93 = new Terminal.Gui.Views.Label();
+ this.line2 = new Terminal.Gui.Views.Line();
+ this.label8 = new Terminal.Gui.Views.Label();
+ this.linearRange7 = new Terminal.Gui.Views.LinearRange();
+ this.label6 = new Terminal.Gui.Views.Label();
+ this.linearRange6 = new Terminal.Gui.Views.LinearRange();
+ this.label7 = new Terminal.Gui.Views.Label();
+ this.label5 = new Terminal.Gui.Views.Label();
+ this.linearRange4 = new Terminal.Gui.Views.LinearRange();
+ this.label3 = new Terminal.Gui.Views.Label();
+ this.linearRange3 = new Terminal.Gui.Views.LinearRange();
+ this.label4 = new Terminal.Gui.Views.Label();
+ this.label2 = new Terminal.Gui.Views.Label();
+ this.linearRange5 = new Terminal.Gui.Views.LinearRange();
+ this.linearRange2 = new Terminal.Gui.Views.LinearRange();
+ this.label = new Terminal.Gui.Views.Label();
+ this.linearRange1 = new Terminal.Gui.Views.LinearRange();
+ this.line = new Terminal.Gui.Views.Line();
+ this.Width = Dim.Percent(90);
+ this.Height = Dim.Percent(80);
+ this.X = Pos.Center();
+ this.Y = Pos.Center();
+ this.Visible = true;
+ this.CanFocus = true;
+ this.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyles.Transparent;
+ this.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.line.Width = 1;
+ this.line.Height = Dim.Fill(-1);
+ this.line.X = Pos.AnchorEnd(2);
+ this.line.Y = -1;
+ this.line.Visible = true;
+ this.line.CanFocus = false;
+ this.line.ShadowStyle = null;
+ this.line.Data = "line";
+ this.line.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.line.Orientation = Terminal.Gui.ViewBase.Orientation.Vertical;
+ this.Add(this.line);
+ this.linearRange1.Width = 15;
+ this.linearRange1.Height = 2;
+ this.linearRange1.X = 3;
+ this.linearRange1.Y = 0;
+ this.linearRange1.Visible = true;
+ this.linearRange1.CanFocus = true;
+ this.linearRange1.ShadowStyle = null;
+ this.linearRange1.Options = new System.Collections.Generic.List>(new Terminal.Gui.Views.LinearRangeOption[] {
+ new Terminal.Gui.Views.LinearRangeOption("True", new System.Text.Rune('T'), true),
+ new Terminal.Gui.Views.LinearRangeOption("False", new System.Text.Rune('F'), false)});
+ this.linearRange1.Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange1.RangeAllowSingle = false;
+ this.linearRange1.AllowEmpty = false;
+ this.linearRange1.MinimumInnerSpacing = 1;
+ this.linearRange1.LegendsOrientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange1.ShowLegends = true;
+ this.linearRange1.ShowEndSpacing = false;
+ this.linearRange1.Type = Terminal.Gui.Views.LinearRangeType.Single;
+ this.linearRange1.Data = "linearRange1";
+ this.linearRange1.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.linearRange1);
+ this.label.Width = Dim.Auto();
+ this.label.Height = Dim.Auto();
+ this.label.X = 59;
+ this.label.Y = 0;
+ this.label.Visible = true;
+ this.label.CanFocus = false;
+ this.label.ShadowStyle = null;
+ this.label.Data = "label";
+ this.label.Text = "LinearRange";
+ this.label.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label);
+ this.linearRange2.Width = 18;
+ this.linearRange2.Height = 2;
+ this.linearRange2.X = 3;
+ this.linearRange2.Y = 3;
+ this.linearRange2.Visible = true;
+ this.linearRange2.CanFocus = true;
+ this.linearRange2.ShadowStyle = null;
+ this.linearRange2.Options = new System.Collections.Generic.List>(new Terminal.Gui.Views.LinearRangeOption[] {
+ new Terminal.Gui.Views.LinearRangeOption("Low", new System.Text.Rune('L'), 0D),
+ new Terminal.Gui.Views.LinearRangeOption("Mid", new System.Text.Rune('M'), 0.5D),
+ new Terminal.Gui.Views.LinearRangeOption("High", new System.Text.Rune('H'), 1D)});
+ this.linearRange2.Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange2.RangeAllowSingle = false;
+ this.linearRange2.AllowEmpty = false;
+ this.linearRange2.MinimumInnerSpacing = 1;
+ this.linearRange2.LegendsOrientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange2.ShowLegends = true;
+ this.linearRange2.ShowEndSpacing = false;
+ this.linearRange2.Type = Terminal.Gui.Views.LinearRangeType.Single;
+ this.linearRange2.Data = "linearRange2";
+ this.linearRange2.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.linearRange2);
+ this.linearRange5.Width = 18;
+ this.linearRange5.Height = 2;
+ this.linearRange5.X = 3;
+ this.linearRange5.Y = 3;
+ this.linearRange5.Visible = true;
+ this.linearRange5.CanFocus = true;
+ this.linearRange5.ShadowStyle = null;
+ this.linearRange5.Options = new System.Collections.Generic.List>(new Terminal.Gui.Views.LinearRangeOption[] {
+ new Terminal.Gui.Views.LinearRangeOption("Low", new System.Text.Rune('L'), 0D),
+ new Terminal.Gui.Views.LinearRangeOption("Mid", new System.Text.Rune('M'), 0.5D),
+ new Terminal.Gui.Views.LinearRangeOption("High", new System.Text.Rune('H'), 1D)});
+ this.linearRange5.Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange5.RangeAllowSingle = false;
+ this.linearRange5.AllowEmpty = false;
+ this.linearRange5.MinimumInnerSpacing = 1;
+ this.linearRange5.LegendsOrientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange5.ShowLegends = true;
+ this.linearRange5.ShowEndSpacing = false;
+ this.linearRange5.Type = Terminal.Gui.Views.LinearRangeType.Single;
+ this.linearRange5.Data = "linearRange5";
+ this.linearRange5.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.linearRange5);
+ this.label2.Width = Dim.Auto();
+ this.label2.Height = Dim.Auto();
+ this.label2.X = 60;
+ this.label2.Y = 3;
+ this.label2.Visible = true;
+ this.label2.CanFocus = false;
+ this.label2.ShadowStyle = null;
+ this.label2.Data = "label2";
+ this.label2.Text = "LinearRange\r\n(Text Labels)";
+ this.label2.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.Add(this.label2);
+ this.label4.Width = Dim.Auto();
+ this.label4.Height = Dim.Auto();
+ this.label4.X = 60;
+ this.label4.Y = 3;
+ this.label4.Visible = true;
+ this.label4.CanFocus = false;
+ this.label4.ShadowStyle = null;
+ this.label4.Data = "label4";
+ this.label4.Text = "LinearRange\r\n(Text Labels)";
+ this.label4.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.Add(this.label4);
+ this.linearRange3.Width = 51;
+ this.linearRange3.Height = 2;
+ this.linearRange3.X = 3;
+ this.linearRange3.Y = 6;
+ this.linearRange3.Visible = true;
+ this.linearRange3.CanFocus = true;
+ this.linearRange3.ShadowStyle = null;
+ this.linearRange3.Options = new System.Collections.Generic.List>(new Terminal.Gui.Views.LinearRangeOption[] {
+ new Terminal.Gui.Views.LinearRangeOption("0", new System.Text.Rune('0'), 0D),
+ new Terminal.Gui.Views.LinearRangeOption("0.1", new System.Text.Rune('0'), 0.1D),
+ new Terminal.Gui.Views.LinearRangeOption("0.2", new System.Text.Rune('0'), 0.2D),
+ new Terminal.Gui.Views.LinearRangeOption("0.3", new System.Text.Rune('0'), 0.3D),
+ new Terminal.Gui.Views.LinearRangeOption("0.4", new System.Text.Rune('0'), 0.4D),
+ new Terminal.Gui.Views.LinearRangeOption("0.5", new System.Text.Rune('0'), 0.5D),
+ new Terminal.Gui.Views.LinearRangeOption("0.6", new System.Text.Rune('0'), 0.6D),
+ new Terminal.Gui.Views.LinearRangeOption("0.7", new System.Text.Rune('0'), 0.7D),
+ new Terminal.Gui.Views.LinearRangeOption("0.8", new System.Text.Rune('0'), 0.8D),
+ new Terminal.Gui.Views.LinearRangeOption("0.9", new System.Text.Rune('0'), 0.9D),
+ new Terminal.Gui.Views.LinearRangeOption("1", new System.Text.Rune('1'), 1D)});
+ this.linearRange3.Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange3.RangeAllowSingle = false;
+ this.linearRange3.AllowEmpty = false;
+ this.linearRange3.MinimumInnerSpacing = 1;
+ this.linearRange3.LegendsOrientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange3.ShowLegends = true;
+ this.linearRange3.ShowEndSpacing = false;
+ this.linearRange3.Type = Terminal.Gui.Views.LinearRangeType.Single;
+ this.linearRange3.Data = "linearRange3";
+ this.linearRange3.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.linearRange3);
+ this.label3.Width = Dim.Auto();
+ this.label3.Height = Dim.Auto();
+ this.label3.X = 60;
+ this.label3.Y = 6;
+ this.label3.Visible = true;
+ this.label3.CanFocus = false;
+ this.label3.ShadowStyle = null;
+ this.label3.Data = "label3";
+ this.label3.Text = "LinearRange\r\n(Decimal Labels)";
+ this.label3.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.Add(this.label3);
+ this.linearRange4.Width = 52;
+ this.linearRange4.Height = 2;
+ this.linearRange4.X = 3;
+ this.linearRange4.Y = 9;
+ this.linearRange4.Visible = true;
+ this.linearRange4.CanFocus = true;
+ this.linearRange4.ShadowStyle = null;
+ this.linearRange4.Options = new System.Collections.Generic.List>(new Terminal.Gui.Views.LinearRangeOption[] {
+ new Terminal.Gui.Views.LinearRangeOption("One", new System.Text.Rune('1'), 1),
+ new Terminal.Gui.Views.LinearRangeOption("Two", new System.Text.Rune('2'), 2),
+ new Terminal.Gui.Views.LinearRangeOption("Three", new System.Text.Rune('3'), 3)});
+ this.linearRange4.Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange4.RangeAllowSingle = false;
+ this.linearRange4.AllowEmpty = false;
+ this.linearRange4.MinimumInnerSpacing = 1;
+ this.linearRange4.LegendsOrientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange4.ShowLegends = true;
+ this.linearRange4.ShowEndSpacing = false;
+ this.linearRange4.Type = Terminal.Gui.Views.LinearRangeType.Single;
+ this.linearRange4.Data = "linearRange4";
+ this.linearRange4.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.linearRange4);
+ this.label5.Width = Dim.Auto();
+ this.label5.Height = Dim.Auto();
+ this.label5.X = 60;
+ this.label5.Y = 9;
+ this.label5.Visible = true;
+ this.label5.CanFocus = false;
+ this.label5.ShadowStyle = null;
+ this.label5.Data = "label5";
+ this.label5.Text = "LinearRange\r\n(Text Labels)";
+ this.label5.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.Add(this.label5);
+ this.label7.Width = Dim.Auto();
+ this.label7.Height = Dim.Auto();
+ this.label7.X = 60;
+ this.label7.Y = 9;
+ this.label7.Visible = true;
+ this.label7.CanFocus = false;
+ this.label7.ShadowStyle = null;
+ this.label7.Data = "label7";
+ this.label7.Text = "LinearRange\r\n(Text Labels)";
+ this.label7.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.Add(this.label7);
+ this.linearRange6.Width = 25;
+ this.linearRange6.Height = 2;
+ this.linearRange6.X = 3;
+ this.linearRange6.Y = 12;
+ this.linearRange6.Visible = true;
+ this.linearRange6.CanFocus = true;
+ this.linearRange6.ShadowStyle = null;
+ this.linearRange6.Options = new System.Collections.Generic.List>(new Terminal.Gui.Views.LinearRangeOption[] {
+ new Terminal.Gui.Views.LinearRangeOption("Cat", new System.Text.Rune('\uD83D', '\uDC31'), "Cat"),
+ new Terminal.Gui.Views.LinearRangeOption("Dog", new System.Text.Rune('\uD83D', '\uDC36'), "Dog"),
+ new Terminal.Gui.Views.LinearRangeOption("Fish", new System.Text.Rune('\uD83D', '\uDC1F'), "Fish")});
+ this.linearRange6.Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange6.RangeAllowSingle = false;
+ this.linearRange6.AllowEmpty = false;
+ this.linearRange6.MinimumInnerSpacing = 1;
+ this.linearRange6.LegendsOrientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange6.ShowLegends = true;
+ this.linearRange6.ShowEndSpacing = false;
+ this.linearRange6.Type = Terminal.Gui.Views.LinearRangeType.Single;
+ this.linearRange6.Data = "linearRange6";
+ this.linearRange6.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.linearRange6);
+ this.label6.Width = Dim.Auto();
+ this.label6.Height = Dim.Auto();
+ this.label6.X = 60;
+ this.label6.Y = 12;
+ this.label6.Visible = true;
+ this.label6.CanFocus = false;
+ this.label6.ShadowStyle = null;
+ this.label6.Data = "label6";
+ this.label6.Text = "LinearRange\r\n(Wide)";
+ this.label6.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.Add(this.label6);
+ this.linearRange7.Width = 9;
+ this.linearRange7.Height = 2;
+ this.linearRange7.X = 3;
+ this.linearRange7.Y = 15;
+ this.linearRange7.Visible = true;
+ this.linearRange7.CanFocus = true;
+ this.linearRange7.ShadowStyle = null;
+ this.linearRange7.Options = new System.Collections.Generic.List>(new Terminal.Gui.Views.LinearRangeOption[] {
+ new Terminal.Gui.Views.LinearRangeOption("Cat", new System.Text.Rune('\uD83D', '\uDC31'), "Cat"),
+ new Terminal.Gui.Views.LinearRangeOption("Dog", new System.Text.Rune('\uD83D', '\uDC36'), "Dog"),
+ new Terminal.Gui.Views.LinearRangeOption("Fish", new System.Text.Rune('\uD83D', '\uDC1F'), "Fish")});
+ this.linearRange7.Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange7.RangeAllowSingle = false;
+ this.linearRange7.AllowEmpty = false;
+ this.linearRange7.MinimumInnerSpacing = 1;
+ this.linearRange7.LegendsOrientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.linearRange7.ShowLegends = true;
+ this.linearRange7.ShowEndSpacing = false;
+ this.linearRange7.Type = Terminal.Gui.Views.LinearRangeType.Single;
+ this.linearRange7.Data = "linearRange7";
+ this.linearRange7.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.linearRange7);
+ this.label8.Width = Dim.Auto();
+ this.label8.Height = Dim.Auto();
+ this.label8.X = 60;
+ this.label8.Y = 15;
+ this.label8.Visible = true;
+ this.label8.CanFocus = false;
+ this.label8.ShadowStyle = null;
+ this.label8.Data = "label8";
+ this.label8.Text = "LinearRange\r\n(Thin)";
+ this.label8.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.Add(this.label8);
+ this.line2.Width = Dim.Fill(-1);
+ this.line2.Height = 1;
+ this.line2.X = -1;
+ this.line2.Y = 17;
+ this.line2.Visible = true;
+ this.line2.CanFocus = false;
+ this.line2.ShadowStyle = null;
+ this.line2.Data = "line2";
+ this.line2.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.line2.Orientation = Terminal.Gui.ViewBase.Orientation.Horizontal;
+ this.Add(this.line2);
+ this.label93.Width = Dim.Fill(0);
+ this.label93.Height = 1;
+ this.label93.X = 0;
+ this.label93.Y = Pos.AnchorEnd(3);
+ this.label93.Visible = true;
+ this.label93.CanFocus = false;
+ this.label93.ShadowStyle = null;
+ this.label93.Data = "label93";
+ this.label93.Text = "--Linear Range Showcase--";
+ this.label93.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.Add(this.label93);
+ this.label9.Width = Dim.Fill(0);
+ this.label9.Height = 1;
+ this.label9.X = 0;
+ this.label9.Y = Pos.AnchorEnd(2);
+ this.label9.Visible = true;
+ this.label9.CanFocus = false;
+ this.label9.ShadowStyle = null;
+ this.label9.Data = "label9";
+ this.label9.Text = ("LinearRange is a generic class Typed on value. Use \'Options\' to set the radio val" +
+ "ues");
+ this.label9.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.Add(this.label9);
+ this.label92.Width = Dim.Fill(0);
+ this.label92.Height = 1;
+ this.label92.X = 0;
+ this.label92.Y = Pos.AnchorEnd(1);
+ this.label92.Visible = true;
+ this.label92.CanFocus = false;
+ this.label92.ShadowStyle = null;
+ this.label92.Data = "label92";
+ this.label92.Text = "When there is not enough space the \'LegendAbbr\' is used";
+ this.label92.TextAlignment = Terminal.Gui.ViewBase.Alignment.Center;
+ this.Add(this.label92);
+ }
+ }
+}
diff --git a/Showcase/Ranges.cs b/Showcase/Ranges.cs
new file mode 100644
index 00000000..64975001
--- /dev/null
+++ b/Showcase/Ranges.cs
@@ -0,0 +1,20 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// You can make changes to this file and they will not be overwritten when saving.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using Terminal.Gui;
+
+
+ public partial class Ranges {
+
+ public Ranges() {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Showcase/Showcase.csproj b/Showcase/Showcase.csproj
index 624b4c1f..cc86b695 100644
--- a/Showcase/Showcase.csproj
+++ b/Showcase/Showcase.csproj
@@ -2,14 +2,14 @@
Exe
- net8.0
+ net10.0
enable
enable
false
-
+
diff --git a/Showcase/TablesAndGraphs.Designer.cs b/Showcase/TablesAndGraphs.Designer.cs
new file mode 100644
index 00000000..121e7d6a
--- /dev/null
+++ b/Showcase/TablesAndGraphs.Designer.cs
@@ -0,0 +1,122 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using System;
+ using Terminal.Gui;
+ using Terminal.Gui.App;
+ using Terminal.Gui.Drawing;
+ using Terminal.Gui.Input;
+ using Terminal.Gui.ViewBase;
+ using Terminal.Gui.Views;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Drawing;
+
+
+ public partial class TablesAndGraphs : Terminal.Gui.Views.Window {
+
+ private Terminal.Gui.Views.Label label;
+
+ private Terminal.Gui.Views.TableView tableView;
+
+ private Terminal.Gui.Views.GraphView graphView;
+
+ private void InitializeComponent() {
+ this.graphView = new Terminal.Gui.Views.GraphView();
+ this.tableView = new Terminal.Gui.Views.TableView();
+ this.label = new Terminal.Gui.Views.Label();
+ this.Width = Dim.Fill(0);
+ this.Height = Dim.Fill(0);
+ this.X = 0;
+ this.Y = 0;
+ this.Visible = true;
+ this.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Overlapped;
+ this.CanFocus = true;
+ this.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyles.None;
+ this.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Title = "Table/Graph Showcase";
+ this.label.Width = Dim.Auto();
+ this.label.Height = Dim.Auto();
+ this.label.X = 0;
+ this.label.Y = 0;
+ this.label.Visible = true;
+ this.label.CanFocus = false;
+ this.label.ShadowStyle = null;
+ this.label.Data = "label";
+ this.label.Text = "Processes:";
+ this.label.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.Add(this.label);
+ this.tableView.Width = 48;
+ this.tableView.Height = 12;
+ this.tableView.X = 0;
+ this.tableView.Y = 1;
+ this.tableView.Visible = true;
+ this.tableView.CanFocus = true;
+ this.tableView.ShadowStyle = null;
+ this.tableView.Data = "tableView";
+ this.tableView.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.tableView.FullRowSelect = false;
+ this.tableView.Style.AlwaysShowHeaders = false;
+ this.tableView.Style.ExpandLastColumn = true;
+ this.tableView.Style.InvertSelectedCellFirstCharacter = false;
+ this.tableView.Style.ShowHorizontalHeaderOverline = true;
+ this.tableView.Style.ShowHorizontalHeaderUnderline = true;
+ this.tableView.Style.ShowVerticalCellLines = true;
+ this.tableView.Style.ShowVerticalHeaderLines = true;
+ System.Data.DataTable tableViewTable;
+ tableViewTable = new System.Data.DataTable();
+ System.Data.DataColumn tableViewTableName;
+ tableViewTableName = new System.Data.DataColumn();
+ tableViewTableName.ColumnName = "Name";
+ tableViewTable.Columns.Add(tableViewTableName);
+ System.Data.DataColumn tableViewTableCPU;
+ tableViewTableCPU = new System.Data.DataColumn();
+ tableViewTableCPU.ColumnName = "CPU (%)";
+ tableViewTable.Columns.Add(tableViewTableCPU);
+ System.Data.DataColumn tableViewTableDisk;
+ tableViewTableDisk = new System.Data.DataColumn();
+ tableViewTableDisk.ColumnName = "Disk (%)";
+ tableViewTable.Columns.Add(tableViewTableDisk);
+ System.Data.DataColumn tableViewTableNetwork;
+ tableViewTableNetwork = new System.Data.DataColumn();
+ tableViewTableNetwork.ColumnName = "Network (%)";
+ tableViewTable.Columns.Add(tableViewTableNetwork);
+ this.tableView.Table = new Terminal.Gui.Views.DataTableSource(tableViewTable);
+ this.Add(this.tableView);
+ this.graphView.Width = Dim.Fill(3);
+ this.graphView.Height = Dim.Fill(3);
+ this.graphView.X = 50;
+ this.graphView.Y = 2;
+ this.graphView.Visible = true;
+ this.graphView.CanFocus = true;
+ this.graphView.ShadowStyle = null;
+ this.graphView.Data = "graphView";
+ this.graphView.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
+ this.graphView.GraphColor = new Terminal.Gui.Drawing.Attribute(Terminal.Gui.Drawing.Color.White,Terminal.Gui.Drawing.Color.Black);
+ this.graphView.ScrollOffset = new System.Drawing.PointF(0F, 0F);
+ this.graphView.MarginLeft = 2u;
+ this.graphView.MarginBottom = 2u;
+ this.graphView.CellSize = new System.Drawing.PointF(1F, 1F);
+ this.graphView.AxisX.Visible = true;
+ this.graphView.AxisX.Increment = 2.5F;
+ this.graphView.AxisX.ShowLabelsEvery = 2u;
+ this.graphView.AxisX.Minimum = null;
+ this.graphView.AxisX.Text = "X axis with increment every 2.5f";
+ this.graphView.AxisY.Visible = true;
+ this.graphView.AxisY.Increment = 1F;
+ this.graphView.AxisY.ShowLabelsEvery = 5u;
+ this.graphView.AxisY.Minimum = null;
+ this.graphView.AxisY.Text = "Y Axis";
+ this.Add(this.graphView);
+ }
+ }
+}
diff --git a/Showcase/TablesAndGraphs.cs b/Showcase/TablesAndGraphs.cs
new file mode 100644
index 00000000..7f4958ac
--- /dev/null
+++ b/Showcase/TablesAndGraphs.cs
@@ -0,0 +1,40 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// You can make changes to this file and they will not be overwritten when saving.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using Terminal.Gui;
+ using Terminal.Gui.Views;
+
+ public partial class TablesAndGraphs {
+
+ public TablesAndGraphs() {
+ InitializeComponent();
+
+ // Graphs do not render unless they have at least 1 series or annotation
+ graphView.Series.Add(new ScatterSeries()
+ {
+ Points = [
+ new System.Drawing.PointF(2.5f, 2f),
+ new System.Drawing.PointF(5.5f, 5f)
+ ],
+
+ Fill = new GraphCellToRender(new System.Text.Rune('x'))
+ });
+
+ graphView.Annotations.Add(new PathAnnotation()
+ {
+ BeforeSeries = true,
+ Points = [
+ new System.Drawing.PointF(2.5f, 2f),
+ new System.Drawing.PointF(5.5f, 5f)
+ ]
+ });
+ }
+ }
+}
diff --git a/Showcase/Tabs.Designer.cs b/Showcase/Tabs.Designer.cs
deleted file mode 100644
index d898e59a..00000000
--- a/Showcase/Tabs.Designer.cs
+++ /dev/null
@@ -1,942 +0,0 @@
-
-//------------------------------------------------------------------------------
-
-//
-// This code was generated by:
-// TerminalGuiDesigner v2.0.0.0
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// -----------------------------------------------------------------------------
-namespace Showcase {
- using System;
- using Terminal.Gui;
- using Terminal.Gui.App;
- using Terminal.Gui.Drawing;
- using Terminal.Gui.Input;
- using Terminal.Gui.ViewBase;
- using Terminal.Gui.Views;
- using System.Collections;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Drawing;
-
-
- public partial class Tabs : Terminal.Gui.Views.Dialog {
-
- private Terminal.Gui.Views.TabView tabView2;
-
- private Terminal.Gui.Views.TextView tvEditor;
-
- private Terminal.Gui.Views.TextView tvMouseManager;
-
- private Terminal.Gui.Views.TabView tabView;
-
- private Terminal.Gui.Views.GraphView graphView;
-
- private Terminal.Gui.Views.Label label;
-
- private Terminal.Gui.Views.TabView tabView3;
-
- private Terminal.Gui.Views.StatusBar statusBar;
-
- private Terminal.Gui.Views.Shortcut f1EditMe;
-
- private void InitializeComponent() {
- this.statusBar = new Terminal.Gui.Views.StatusBar();
- this.tabView3 = new Terminal.Gui.Views.TabView();
- this.label = new Terminal.Gui.Views.Label();
- this.graphView = new Terminal.Gui.Views.GraphView();
- this.tabView = new Terminal.Gui.Views.TabView();
- this.tvMouseManager = new Terminal.Gui.Views.TextView();
- this.tvEditor = new Terminal.Gui.Views.TextView();
- this.tabView2 = new Terminal.Gui.Views.TabView();
- this.Width = Dim.Percent(90);
- this.Height = Dim.Percent(80);
- this.X = Pos.Center();
- this.Y = Pos.Center();
- this.Visible = true;
- this.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Movable;
- this.CanFocus = true;
- this.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyle.None;
- this.Modal = true;
- this.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
- this.Title = "Tab Views Demo";
- this.tabView2.Width = Dim.Percent(75);
- this.tabView2.Height = Dim.Percent(75);
- this.tabView2.X = 0;
- this.tabView2.Y = 0;
- this.tabView2.Visible = true;
- this.tabView2.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
- this.tabView2.CanFocus = true;
- this.tabView2.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyle.None;
- this.tabView2.Data = "tabView2";
- this.tabView2.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
- this.tabView2.MaxTabTextWidth = 30u;
- this.tabView2.Style.ShowBorder = true;
- this.tabView2.Style.ShowTopLine = true;
- this.tabView2.Style.TabsOnBottom = true;
- Terminal.Gui.Views.Tab tabView2editorcs;
- tabView2editorcs = new Terminal.Gui.Views.Tab();
- tabView2editorcs.DisplayText = "Editor.cs";
- tabView2editorcs.View = new View();
- tabView2editorcs.View.Width = Dim.Fill();
- tabView2editorcs.View.Height = Dim.Fill();
- tabView2editorcs.View.CanFocus = true;
- this.tvEditor.Width = Dim.Fill(0);
- this.tvEditor.Height = Dim.Fill(0);
- this.tvEditor.X = 0;
- this.tvEditor.Y = 0;
- this.tvEditor.Visible = true;
- this.tvEditor.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
- this.tvEditor.CanFocus = true;
- this.tvEditor.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyle.None;
- this.tvEditor.AllowsTab = true;
- this.tvEditor.AllowsReturn = true;
- this.tvEditor.WordWrap = false;
- this.tvEditor.Data = "tvEditor";
- this.tvEditor.Text = "using System.Collections.ObjectModel;\r\nusing System.Reflection;\r\nusing System.Tex" +
- "t;\r\nusing System.Text.Json;\r\nusing Microsoft.Extensions.Configuration;\r\nusing Mi" +
- "crosoft.Extensions.Logging;\r\nusing Serilog;\r\nusing Terminal.Gui;\r\nusing Terminal" +
- ".Gui.App;\r\nusing Terminal.Gui.Drawing;\r\nusing Terminal.Gui.Drivers;\r\nusing Termi" +
- "nal.Gui.Input;\r\nusing Terminal.Gui.ViewBase;\r\nusing Terminal.Gui.Views;\r\nusing T" +
- "erminalGuiDesigner.FromCode;\r\nusing TerminalGuiDesigner.Operations;\r\nusing Termi" +
- "nalGuiDesigner.ToCode;\r\nusing TerminalGuiDesigner.UI.Windows;\r\nusing Attribute =" +
- " Terminal.Gui.Drawing.Attribute;\r\nusing ILogger = Microsoft.Extensions.Logging.I" +
- "Logger;\r\n\r\nnamespace TerminalGuiDesigner.UI;\r\n\r\n/// \r\n/// Root that is visible on loading the\r\n/// applicatio" +
- "n. Hooks key and mouse events and mounts as a sub-view whatever file\r\n/// the u" +
- "ser opens.\r\n/// \r\npublic class Editor : Toplevel\r\n{\r\n private KeyMa" +
- "p keyMap;\r\n private readonly KeyboardManager keyboardManager;\r\n private re" +
- "adonly MouseManager mouseManager;\r\n\r\n private Design? viewBeingEdited;\r\n p" +
- "rivate bool enableDrag = true;\r\n private bool enableShowFocused = true;\r\n " +
- "private bool editing = false;\r\n\r\n private ListView? rootCommandsListView;\r\n " +
- " private bool menuOpen;\r\n\r\n /// \r\n /// Set this to have a short " +
- "duration message appear in lower right\r\n /// (see ).\r\n /// \r\n private string? flashMessage = null;\r\n\r\n " +
- " /// \r\n /// The of the las" +
- "t undertaken\r\n /// operation at the time of the last save or null if no save " +
- "or last save\r\n /// was before applying any operations.\r\n /// \r\n " +
- " internal Guid? LastSavedOperation;\r\n\r\n private static string _keymapPath =" +
- " string.Empty;\r\n private static string _logDirectory = string.Empty;\r\n\r\n /" +
- "// \r\n /// True to disable logging (must be set before constructing <" +
- "see cref=\"Editor\"/>).\r\n /// \r\n public static bool Quiet = false;" +
- "\r\n\r\n /// \r\n /// Initializes a new instance of the class.\r\n /// \r\n public Editor()\r\n {\r\n // Bug: Th" +
- "is will have strange inheritance behavior if Editor is inherited from.\r\n " +
- "this.CanFocus = true;\r\n\r\n if (!Quiet)\r\n {\r\n Logging.Log" +
- "ger = CreateLogger();\r\n }\r\n\r\n LoadKeyMap();\r\n\r\n this.keyboa" +
- "rdManager = new KeyboardManager(this.keyMap);\r\n this.mouseManager = new M" +
- "ouseManager();\r\n this.Closing += this.Editor_Closing;\r\n\r\n this.Bui" +
- "ldRootMenu();\r\n }\r\n\r\n private void LoadKeyMap()\r\n {\r\n _keymapPat" +
- "h = Path.Combine(\r\n Environment.GetFolderPath(Environment.SpecialFold" +
- "er.ApplicationData),\r\n \"TerminalGuiDesigner\", \"keymap.json\");\r\n\r\n " +
- " try\r\n {\r\n if (File.Exists(_keymapPath))\r\n {\r\n " +
- " var json = File.ReadAllText(_keymapPath);\r\n this.ke" +
- "yMap = JsonSerializer.Deserialize(json) ?? new KeyMap();\r\n }\r" +
- "\n else\r\n {\r\n this.keyMap = new KeyMap();\r\n " +
- " }\r\n\r\n SelectionManager.Instance.SelectedScheme = this.keyM" +
- "ap.SelectionColor.Scheme;\r\n }\r\n catch (Exception ex)\r\n {\r\n " +
- " // if there is bad yaml use the defaults\r\n ExceptionViewer" +
- ".ShowException(\"Failed to read keybindings from configuration file\", ex);\r\n " +
- " this.keyMap = new KeyMap();\r\n }\r\n }\r\n\r\n\r\n private void SaveK" +
- "eyMap()\r\n {\r\n try\r\n {\r\n var json = JsonSerializer.Se" +
- "rialize(this.keyMap);\r\n File.WriteAllText(_keymapPath, json);\r\n " +
- " SelectionManager.Instance.SelectedScheme = this.keyMap.SelectionColor.Sche" +
- "me;\r\n }\r\n catch (Exception ex)\r\n {\r\n ExceptionVi" +
- "ewer.ShowException(\"Failed to save keybindings from configuration file\", ex);\r\n " +
- " }\r\n }\r\n\r\n static ILogger CreateLogger()\r\n {\r\n _logDirecto" +
- "ry = Path.Combine(\r\n Environment.GetFolderPath(Environment.SpecialFol" +
- "der.ApplicationData),\r\n \"TerminalGuiDesigner\", \"logs\");\r\n\r\n //" +
- " Configure Serilog to write logs to a file\r\n Log.Logger = new LoggerConfi" +
- "guration()\r\n .MinimumLevel.Verbose() // Verbose includes Trace and De" +
- "bug\r\n .WriteTo.File(Path.Combine(_logDirectory,\"logfile.txt\"), rollin" +
- "gInterval: RollingInterval.Day)\r\n .CreateLogger();\r\n\r\n // Crea" +
- "te a logger factory compatible with Microsoft.Extensions.Logging\r\n using " +
- "var loggerFactory = LoggerFactory.Create(builder =>\r\n {\r\n buil" +
- "der\r\n .AddSerilog(dispose: true) // Integrate Serilog with ILogge" +
- "r\r\n .SetMinimumLevel(LogLevel.Trace); // Set minimum log level\r\n " +
- " });\r\n\r\n // Get an ILogger instance\r\n return loggerFactory.C" +
- "reateLogger(\"Global Logger\");\r\n }\r\n\r\n /// \r\n /// Gets or Sets " +
- "a value indicating whether that do not have borders\r\n /// " +
- " should have a dotted line rendered around them so users don\'t lose track of whe" +
- "re\r\n /// they are on a same-colored background.\r\n /// \r\n // B" +
- "UG: Thread-safety\r\n public static bool ShowBorders { get; set; } = true;\r\n\r\n " +
- " /// \r\n /// Gets a value indicating whether to enable experimental" +
- " features.\r\n /// \r\n // BUG: Thread-safety\r\n public static boo" +
- "l Experimental { get; internal set; }\r\n\r\n /// \r\n /// Runs the .\r\n /// \r\n /// Command li" +
- "ne options provided by user (or default)\r\n /// indicating what file to open i" +
- "f any and other settings e.g. .\r\n public vo" +
- "id Run(Options options)\r\n {\r\n if (!string.IsNullOrWhiteSpace(options.P" +
- "ath))\r\n {\r\n try\r\n {\r\n var toLoadOrCr" +
- "eate = new FileInfo(options.Path);\r\n\r\n if (toLoadOrCreate.Exists)" +
- "\r\n {\r\n this.Open(toLoadOrCreate);\r\n " +
- " }\r\n else\r\n {\r\n Type toCrea" +
- "te = typeof(Window);\r\n\r\n if (!string.IsNullOrWhiteSpace(optio" +
- "ns.ViewType))\r\n {\r\n // TODO: We should" +
- " probably use something like IsAssignableTo instead\r\n toC" +
- "reate = GetSupportedRootViews().FirstOrDefault(v => v.Name.Equals(options.ViewTy" +
- "pe)) ?? toCreate;\r\n }\r\n\r\n this.New(toLoadO" +
- "rCreate, toCreate, options.Namespace);\r\n }\r\n }\r\n " +
- " catch (Exception ex)\r\n {\r\n MessageBox.ErrorQuery" +
- "(\"Error Loading Designer\", ex.Message, \"Ok\");\r\n Application.Shutd" +
- "own();\r\n return;\r\n }\r\n }\r\n\r\n Application" +
- ".KeyDown += (_, k) =>\r\n {\r\n if (this.editing || this.viewBeing" +
- "Edited == null)\r\n {\r\n return;\r\n }\r\n\r\n " +
- " try\r\n {\r\n if (this.HandleKey(k))\r\n " +
- " {\r\n k.Handled = true;\r\n }\r\n }\r\n " +
- " catch (Exception ex)\r\n {\r\n ExceptionViewer.S" +
- "howException(\"Error processing keystroke\", ex);\r\n }\r\n };\r\n\r\n " +
- " Application.MouseEvent += (s, m) =>\r\n {\r\n // if another " +
- "window is showing don\'t respond to mouse\r\n if (!this.IsCurrentTop)\r\n " +
- " {\r\n return;\r\n }\r\n\r\n // If disabl" +
- "ing drag we suppress all but right click (button 3)\r\n if (!m.Flags.Ha" +
- "sFlag(MouseFlags.Button3Clicked) && !this.enableDrag)\r\n {\r\n " +
- " return;\r\n }\r\n\r\n if (this.editing || this.viewBeingEd" +
- "ited == null)\r\n {\r\n return;\r\n }\r\n\r\n " +
- " try\r\n {\r\n this.mouseManager.HandleMouse(m, this.vi" +
- "ewBeingEdited);\r\n\r\n // right click\r\n if (m.Flags.H" +
- "asFlag(this.keyMap.RightClick))\r\n {\r\n var hit " +
- "= this.viewBeingEdited.View.HitTest(m, out _, out _);\r\n\r\n if " +
- "(hit != null)\r\n {\r\n var d = hit.GetNea" +
- "restDesign() ?? this.viewBeingEdited;\r\n if (d != null)\r\n " +
- " {\r\n this.CreateAndShowContextM" +
- "enu(m, d);\r\n }\r\n }\r\n }\r" +
- "\n }\r\n catch (Exception ex)\r\n {\r\n " +
- " ExceptionViewer.ShowException(\"Error processing mouse\", ex);\r\n }\r\n " +
- " };\r\n\r\n Application.Run(this, this.ErrorHandler);\r\n Applicati" +
- "on.Shutdown();\r\n }\r\n\r\n /// \r\n /// Tailors redrawing to add ove" +
- "rlays (e.g. showing what is selected etc.).\r\n /// Only runs when a view is op" +
- "en and .\r\n /// \r\n protected overrid" +
- "e void OnDrawComplete(DrawContext? context)\r\n {\r\n base.OnDrawComplete(" +
- "context);\r\n\r\n // if we are not editing a view\r\n if (this.viewBeing" +
- "Edited == null)\r\n {\r\n return;\r\n }\r\n\r\n var bounds" +
- " = Viewport;\r\n\r\n if (this.enableShowFocused)\r\n {\r\n stri" +
- "ng? toDisplay = this.GetLowerRightTextIfAny();\r\n\r\n // and have a desi" +
- "gnable view focused\r\n if (toDisplay != null)\r\n {\r\n " +
- " // write its name in the lower right\r\n int y = this.GetCo" +
- "ntentSize().Height - 1;\r\n int right = bounds.Width - 1;\r\n " +
- " var runes = toDisplay.EnumerateRunes().ToList();\r\n var le" +
- "n = runes.Count();\r\n\r\n for (int i = 0; i < len; i++)\r\n " +
- " {\r\n this.AddRune(right - len + i, y, runes[i]);\r\n " +
- " }\r\n }\r\n }\r\n\r\n if (this.mouseManager.SelectionB" +
- "ox != null)\r\n {\r\n var box = this.mouseManager.SelectionBox.Val" +
- "ue;\r\n for (int x = 0; x < box.Width; x++)\r\n {\r\n " +
- " for (int y = 0; y < box.Height; y++)\r\n {\r\n " +
- " if (y == 0 || y == box.Height - 1 || x == 0 || x == box.Width - 1)\r\n " +
- " {\r\n this.AddRune(box.X + x, box.Y + y, new Rune" +
- "(\'.\'));\r\n }\r\n }\r\n }\r\n }\r\n " +
- " }\r\n\r\n /// \r\n /// Draws title screen when no view is currently op" +
- "en\r\n /// \r\n protected override bool OnDrawingContent()\r\n {\r\n " +
- " var r = base.OnDrawingContent();\r\n\r\n if (viewBeingEdited != null)\r" +
- "\n {\r\n return true;\r\n }\r\n\r\n var bounds = Viewport" +
- ";\r\n\r\n Application.Driver.SetAttribute(new Attribute(Color.Black));\r\n " +
- " Application.Driver.FillRect(bounds,\' \');\r\n\r\n var top = new Rectangle(0" +
- ", 0, bounds.Width, rootCommandsListView.Frame.Top - 1);\r\n RenderTitle(top" +
- ");\r\n \r\n return r;\r\n }\r\n\r\n private void RenderTitle(Rectangle inA" +
- "rea)\r\n {\r\n var assembly = typeof(Label).Assembly;\r\n var informa" +
- "tionalVersion = assembly\r\n .GetCustomAttribute()?.InformationalVersion\r\n ?? \"unknown\";\r\n\r\n i" +
- "f (informationalVersion.Contains(\"+\"))\r\n {\r\n informationalVers" +
- "ion = informationalVersion.Substring(0, informationalVersion.IndexOf(\'+\'));\r\n " +
- " }\r\n\r\n // The main ASCII art text block\r\n string artText = \"\"\"" +
- "\r\n ___________ .__ .__ " +
- " \r\n \\__ ___/__________ _____ |__| ____ _____ | " +
- " | \r\n | |_/ __ \\_ __ \\/ \\| |/" +
- " \\\\__ \\ | | \r\n | |\\ ___/| | " +
- "\\/ Y Y \\ | | \\/ __ \\| |__ \r\n |___" +
- "_| \\___ >__| |__|_| /__|___| (____ /____/ \r\n " +
- " \\/ \\/ \\/ \\/ " +
- " \r\n ________ .__ ________ .__ " +
- " \r\n / _____/ __ __|__| \\______ \\ ____ _____|__| ____ ____ __________" +
- "_ \r\n / \\ ___| | \\ | | | \\_/ __ \\ / ___/ |/ ___\\ / \\_/ __ \\_ __" +
- " \\\r\n \\ \\_\\ \\ | / | | ` \\ ___/ \\___ \\| / /_/ > | \\ ___/| | " +
- "\\/\r\n \\______ /____/|__| /_______ /\\___ >____ >__\\___ /|___| /\\___ >__| " +
- " \r\n \\/ \\/ \\/ \\/ /_____/ \\/ \\/ " +
- " \r\n\"\"\";\r\n\r\n // Standardize the text\r\n artText = artText.Replace(\"" +
- "\\r\\n\", \"\\n\");\r\n\r\n // The version information line\r\n string version" +
- "Line = $\"(Alpha - {informationalVersion} )\";\r\n string logLine = \"Logs - \"" +
- " + _logDirectory;\r\n\r\n // Split the ASCII art into lines\r\n var artL" +
- "ines = artText.Split(\'\\n\');\r\n\r\n // Calculate the starting point for cente" +
- "ring the art text\r\n int artHeight = artLines.Length;\r\n int artWidt" +
- "h = artLines.Max(line => line.Length);\r\n\r\n // Check if there\'s enough spa" +
- "ce for the ASCII art and the version line\r\n if (inArea.Width < artWidth |" +
- "| inArea.Height < (artHeight + 2)) // +2 allows space for version line\r\n " +
- "{\r\n // Not enough space, render the simpler title\r\n\r\n // S" +
- "imple title and version\r\n string simpleTitle = \"Terminal Gui Designer" +
- "\";\r\n int simpleTitleX = inArea.X + (inArea.Width - simpleTitle.Length" +
- ") / 2;\r\n int versionLineX = inArea.X + (inArea.Width - versionLine.Le" +
- "ngth) / 2;\r\n\r\n // Create the gradient\r\n var gradient = new" +
- " Gradient(\r\n new[]\r\n {\r\n new Color(" +
- "\"#FF0000\"), // Red\r\n new Color(\"#FF7F00\"), // Orange\r\n " +
- " new Color(\"#FFFF00\"), // Yellow\r\n new Color(\"#00FF00\"), // G" +
- "reen\r\n new Color(\"#00FFFF\"), // Cyan\r\n new Color(\"" +
- "#0000FF\"), // Blue\r\n new Color(\"#8B00FF\") // Violet\r\n " +
- " },\r\n new[] { 10 }\r\n );\r\n var fill = ne" +
- "w GradientFill(inArea, gradient, GradientDirection.Diagonal);\r\n\r\n // " +
- "Render the simple title\r\n for (int i = 0; i < simpleTitle.Length; i++" +
- ")\r\n {\r\n int x = simpleTitleX + i;\r\n int" +
- " y = inArea.Y + inArea.Height / 2 - 1; // Center the title vertically\r\n\r\n " +
- " var colorAtPoint = fill.GetColor(new Point(x, y));\r\n Dri" +
- "ver.SetAttribute(new Attribute(new Color(colorAtPoint), new Color(Color.Black)))" +
- ";\r\n this.AddRune(x, y, (Rune)simpleTitle[i]);\r\n }\r\n\r\n " +
- " // Render the version line below the simple title\r\n for (i" +
- "nt i = 0; i < versionLine.Length; i++)\r\n {\r\n int x = v" +
- "ersionLineX + i;\r\n int y = inArea.Y + inArea.Height / 2; // Line " +
- "below the title\r\n\r\n var colorAtPoint = fill.GetColor(new Point(x," +
- " y));\r\n Driver.SetAttribute(new Attribute(new Color(colorAtPoint)" +
- ", new Color(Color.Black)));\r\n this.AddRune(x, y, (Rune)versionLin" +
- "e[i]);\r\n }\r\n }\r\n else\r\n {\r\n // Enough" +
- " space, render the ASCII art block\r\n\r\n int artStartX = inArea.X + (in" +
- "Area.Width - artWidth) / 2;\r\n int artStartY = inArea.Y + (inArea.Heig" +
- "ht - artHeight - 1) / 2; // -1 for the version line below\r\n\r\n // Crea" +
- "te the gradient\r\n var gradient = new Gradient(\r\n new[]" +
- "\r\n {\r\n new Color(\"#FF0000\"), // Red\r\n " +
- " new Color(\"#FF7F00\"), // Orange\r\n new Color(\"#FFFF00\"), // Yel" +
- "low\r\n new Color(\"#00FF00\"), // Green\r\n new Color(\"" +
- "#00FFFF\"), // Cyan\r\n new Color(\"#0000FF\"), // Blue\r\n " +
- " new Color(\"#8B00FF\") // Violet\r\n },\r\n new[] { " +
- "10 }\r\n );\r\n var fill = new GradientFill(inArea, gradient, " +
- "GradientDirection.Diagonal);\r\n\r\n // Render the ASCII art block\r\n " +
- " for (int i = 0; i < artLines.Length; i++)\r\n {\r\n " +
- " string line = artLines[i];\r\n for (int j = 0; j < line.Length; j+" +
- "+)\r\n {\r\n int x = artStartX + j;\r\n " +
- " int y = artStartY + i;\r\n\r\n var colorAtPoint = fill.Get" +
- "Color(new Point(x, y));\r\n Driver.SetAttribute(new Attribute(n" +
- "ew Color(colorAtPoint), new Color(Color.Black)));\r\n this.AddR" +
- "une(x, y, (Rune)line[j]);\r\n }\r\n }\r\n\r\n // Re" +
- "nder the version line below the ASCII art\r\n int versionLineX = inArea" +
- ".X + (inArea.Width - versionLine.Length) / 2;\r\n int versionLineY = ar" +
- "tStartY + artHeight;\r\n\r\n for (int i = 0; i < versionLine.Length; i++)" +
- "\r\n {\r\n int x = versionLineX + i;\r\n int " +
- "y = versionLineY;\r\n\r\n var colorAtPoint = fill.GetColor(new Point(" +
- "x, y));\r\n Driver.SetAttribute(new Attribute(new Color(colorAtPoin" +
- "t), new Color(Color.Black)));\r\n this.AddRune(x, y, (Rune)versionL" +
- "ine[i]);\r\n }\r\n\r\n if (Quiet)\r\n {\r\n " +
- " return;\r\n }\r\n\r\n // Render the log directory line below t" +
- "he version line\r\n int logLineX = inArea.X + (inArea.Width - logLine.L" +
- "ength) / 2;\r\n int logLineY = versionLineY+2;\r\n\r\n for (int " +
- "i = 0; i < logLine.Length; i++)\r\n {\r\n int x = logLineX" +
- " + i;\r\n int y = logLineY;\r\n\r\n var colorAtPoint = f" +
- "ill.GetColor(new Point(x, y));\r\n Driver.SetAttribute(new Attribut" +
- "e(new Color(colorAtPoint), new Color(Color.Black)));\r\n this.AddRu" +
- "ne(x, y, (Rune)logLine[i]);\r\n }\r\n }\r\n }\r\n\r\n\r\n\r\n\r\n /// \r\n /// Event handler for .\r\n /// <" +
- "/summary>\r\n /// The key pressed.\r\n /// " +
- "True if key is handled.\r\n public bool HandleKey(Key key)\r\n {\r\n " +
- " // if another window is showing don\'t respond to hotkeys\r\n if (!thi" +
- "s.IsCurrentTop)\r\n {\r\n return false;\r\n }\r\n\r\n if (" +
- "this.editing)\r\n {\r\n return false;\r\n }\r\n\r\n // Giv" +
- "e the keyboard manager first shot at consuming\r\n // this key e.g. for typ" +
- "ing into menus / reordering menus\r\n // etc\r\n if (this.keyboardMana" +
- "ger.HandleKey(\r\n SelectionManager.Instance.GetSingleSelectionOrNull()" +
- "?.View ?? this, key))\r\n {\r\n return true;\r\n }\r\n\r\n " +
- " try\r\n {\r\n this.editing = true;\r\n SelectionManager." +
- "Instance.LockSelection = true;\r\n\r\n string keyString = key.ToString( )" +
- ";\r\n if (keyString == this.keyMap.ShowContextMenu && !this.menuOpen)\r\n" +
- " {\r\n this.CreateAndShowContextMenu(null, null);\r\n " +
- " return true;\r\n }\r\n\r\n if (keyString == this.keyM" +
- "ap.EditProperties)\r\n {\r\n this.ShowEditProperties();\r\n " +
- " return true;\r\n }\r\n\r\n if (keyString == this." +
- "keyMap.Copy)\r\n {\r\n this.Copy();\r\n retur" +
- "n true;\r\n }\r\n\r\n if (keyString == this.keyMap.Paste)\r\n " +
- " {\r\n this.Paste();\r\n return true;\r\n " +
- " }\r\n\r\n if (keyString == this.keyMap.ViewSpecificOperations)\r\n " +
- " {\r\n this.ShowViewSpecificOperations();\r\n ret" +
- "urn true;\r\n }\r\n\r\n if (keyString == this.keyMap.EditRootPro" +
- "perties)\r\n {\r\n if (this.viewBeingEdited == null)\r\n " +
- " {\r\n return false;\r\n }\r\n\r\n " +
- " this.ShowEditProperties(this.viewBeingEdited);\r\n return tr" +
- "ue;\r\n }\r\n\r\n if (keyString == this.keyMap.Open)\r\n " +
- " {\r\n this.Open();\r\n return true;\r\n }\r\n" +
- "\r\n if (keyString == this.keyMap.Save)\r\n {\r\n " +
- " this.Save();\r\n return true;\r\n }\r\n\r\n if (ke" +
- "yString == this.keyMap.New)\r\n {\r\n this.New();\r\n " +
- " return true;\r\n }\r\n\r\n if (keyString == this.keyMap" +
- ".ShowHelp)\r\n {\r\n this.ShowHelp();\r\n ret" +
- "urn true;\r\n }\r\n\r\n if (keyString == this.keyMap.AddView)\r\n " +
- " {\r\n this.ShowAddViewWindow();\r\n return " +
- "true;\r\n }\r\n\r\n if (keyString == this.keyMap.ToggleDragging)" +
- "\r\n {\r\n this.enableDrag = !this.enableDrag;\r\n " +
- " return true;\r\n }\r\n\r\n if (keyString == this.keyMap.Un" +
- "do)\r\n {\r\n OperationManager.Instance.Undo();\r\n " +
- " return true;\r\n }\r\n\r\n if (keyString == this.keyMap.R" +
- "edo)\r\n {\r\n OperationManager.Instance.Redo();\r\n " +
- " return true;\r\n }\r\n\r\n if (keyString == this.keyMap." +
- "Delete)\r\n {\r\n this.Delete();\r\n return t" +
- "rue;\r\n }\r\n\r\n if (keyString == this.keyMap.ToggleShowFocuse" +
- "d)\r\n {\r\n this.enableShowFocused = !this.enableShowFocu" +
- "sed;\r\n this.SetNeedsDraw();\r\n return true;\r\n " +
- " }\r\n\r\n if (keyString == this.keyMap.ToggleShowBorders)\r\n " +
- " {\r\n ShowBorders = !ShowBorders;\r\n this.SetNeed" +
- "sDraw();\r\n return true;\r\n }\r\n\r\n if (keyStri" +
- "ng == this.keyMap.SelectAll)\r\n {\r\n this.SelectAll();\r\n" +
- " return true;\r\n }\r\n\r\n if (keyString == this" +
- ".keyMap.MoveUp)\r\n {\r\n this.MoveControl(0, -1);\r\n " +
- " return true;\r\n }\r\n\r\n if (keyString == this.keyMa" +
- "p.MoveDown)\r\n {\r\n this.MoveControl(0, 1);\r\n " +
- " return true;\r\n }\r\n\r\n if (keyString == this.keyMap.Mov" +
- "eLeft)\r\n {\r\n this.MoveControl(-1, 0);\r\n " +
- " return true;\r\n }\r\n\r\n if (keyString == this.keyMap.MoveRig" +
- "ht)\r\n {\r\n this.MoveControl(1, 0);\r\n ret" +
- "urn true;\r\n }\r\n\r\n if (keyString == this.keyMap.MoveDown)\r\n" +
- " {\r\n this.MoveControl(0, 1);\r\n return t" +
- "rue;\r\n }\r\n\r\n if (keyString == this.keyMap.MoveLeft)\r\n " +
- " {\r\n this.MoveControl(-1, 0);\r\n return true;" +
- "\r\n }\r\n\r\n if (keyString == this.keyMap.MoveRight)\r\n " +
- " {\r\n this.MoveControl(1, 0);\r\n return true;\r\n " +
- " }\r\n\r\n // Fast moving things\r\n switch (key.KeyCod" +
- "e)\r\n {\r\n case KeyCode.CursorUp | KeyCode.CtrlMask:\r\n " +
- " this.MoveControl(0, -3);\r\n return true;\r\n " +
- " case KeyCode.CursorDown | KeyCode.CtrlMask:\r\n t" +
- "his.MoveControl(0, 3);\r\n return true;\r\n case K" +
- "eyCode.CursorLeft | KeyCode.CtrlMask:\r\n this.MoveControl(-5, " +
- "0);\r\n return true;\r\n case KeyCode.CursorRight " +
- "| KeyCode.CtrlMask:\r\n this.MoveControl(5, 0);\r\n " +
- " return true;\r\n }\r\n }\r\n catch (Exception ex)\r\n " +
- " {\r\n ExceptionViewer.ShowException(\"Error\", ex);\r\n }\r\n " +
- " finally\r\n {\r\n SelectionManager.Instance.LockSelection = fal" +
- "se;\r\n this.editing = false;\r\n }\r\n\r\n return false;\r\n " +
- "}\r\n\r\n /// \r\n /// Gets a value indicating whether there have been " +
- "any s tracked by the \r\n " +
- "/// since the last save.\r\n /// \r\n /// if unsaved changes exist.\r\n public bool HasUnsavedChanges\r\n {" +
- "\r\n get\r\n {\r\n var savedOp = this.LastSavedOperation;\r\n " +
- " var currentOp = OperationManager.Instance.GetLastAppliedOperation( )?." +
- "UniqueIdentifier;\r\n\r\n // if we have nothing saved\r\n if ( s" +
- "avedOp == null )\r\n {\r\n // then we must save if we have" +
- " done something\r\n return currentOp != null;\r\n }\r\n\r\n " +
- " // we must save if the head of the operations stack doesn\'t match what " +
- "we saved\r\n // this lets us save, perform action, undo action and then" +
- " still consider us saved\r\n return savedOp != currentOp;\r\n }\r\n " +
- " }\r\n\r\n\r\n private string GetHelpWithEmptyFormLoaded()\r\n {\r\n return" +
- " $\"{this.keyMap.AddView} to Add a View\";\r\n }\r\n\r\n private string GetHelp()\r" +
- "\n {\r\n return $\"\"\"\r\n\r\n {this.keyMap.ShowHelp} - Show Hel" +
- "p\r\n {this.keyMap.New} - New Window/Class\r\n {this.k" +
- "eyMap.Open} - Open a .Designer.cs file\r\n {this.keyMap.Save} - Sav" +
- "e an opened .Designer.cs file\r\n {this.keyMap.ShowContextMenu} - S" +
- "how right click context menu;\r\n {this.keyMap.AddView} - Add View\r" +
- "\n {this.keyMap.ShowSchemes} - Color Schemes\r\n {thi" +
- "s.keyMap.ToggleDragging} - Toggle mouse dragging on/off\r\n {this.k" +
- "eyMap.ToggleShowFocused} - Toggle show focused view field name\r\n " +
- "{this.keyMap.ToggleShowBorders} - Toggle dotted borders for frameless views\r\n " +
- " {this.keyMap.EditProperties} - Edit View Properties\r\n " +
- " {this.keyMap.ViewSpecificOperations} - View Specific Operations\r\n " +
- " {this.keyMap.EditRootProperties} - Edit Root Properties\r\n {thi" +
- "s.keyMap.Delete} - Delete selected View\r\n Shift+Cursor - Move foc" +
- "used View\r\n Ctrl+Cursor - Move focused View quickly\r\n " +
- " Esc - Quit\r\n {this.keyMap.Undo} - Undo\r\n {this" +
- ".keyMap.Redo} - Redo\r\n \"\"\";\r\n }\r\n\r\n private void BuildRootM" +
- "enu()\r\n {\r\n /* setup views for when we are not editing a\r\n * v" +
- "iew (nothing is loaded) so show the generic\r\n * help (open, new etc.) in" +
- " the center of the\r\n * screen\r\n */\r\n\r\n var rootCommands =" +
- " new ObservableCollection\r\n {\r\n $\"{this.keyMap.ShowHel" +
- "p} - Show Help\",\r\n $\"{this.keyMap.New} - New Window/Class\",\r\n " +
- " $\"{this.keyMap.Open} - Open a .Designer.cs file\",\r\n $\"Keybindings" +
- "\",\r\n };\r\n\r\n // center all the commands\r\n int maxWidth = roo" +
- "tCommands.Max(v => v.Length);\r\n for (int i = 0; i < rootCommands.Count; i" +
- "++)\r\n {\r\n rootCommands[i] = rootCommands[i].PadBoth(maxWidth);" +
- "\r\n }\r\n\r\n this.rootCommandsListView = new ListView()\r\n {\r\n " +
- " X = Pos.Center(),\r\n Y = Pos.Percent(75),\r\n Width" +
- " = maxWidth,\r\n Height = 4,\r\n };\r\n rootCommandsListView." +
- "SetScheme(new Scheme\r\n {\r\n Normal = new Attribute(new Colo" +
- "r(Color.White), new Color(Color.Black)),\r\n Focus = new Attribute(new " +
- "Color(Color.Black), new Color(Color.White)),\r\n HotNormal = new Attrib" +
- "ute(new Color(Color.White), new Color(Color.Black)),\r\n HotFocus = new" +
- " Attribute(new Color(Color.White), new Color(Color.Black)),\r\n Disable" +
- "d = new Attribute(new Color(Color.Black), new Color(Color.White))\r\n });\r\n" +
- "\r\n this.rootCommandsListView.SetSource(rootCommands);\r\n this.rootC" +
- "ommandsListView.SelectedItem = 0;\r\n\r\n this.rootCommandsListView.KeyDown +" +
- "= (_, e) =>\r\n {\r\n if (e == Key.Enter)\r\n {\r\n " +
- " e.Handled = true;\r\n\r\n switch (this.rootCommandsListView.S" +
- "electedItem)\r\n {\r\n case 0:\r\n " +
- " this.ShowHelp();\r\n break;\r\n case" +
- " 1:\r\n this.New();\r\n break;\r\n " +
- " case 2:\r\n this.Open();\r\n " +
- " break;\r\n case 3:\r\n this.ChangeKey" +
- "bindings();\r\n break;\r\n }\r\n }\r\n\r" +
- "\n\r\n if (e == this.keyMap.New)\r\n {\r\n this.Ne" +
- "w();\r\n }\r\n\r\n if (e == this.keyMap.ShowHelp)\r\n {" +
- "\r\n this.ShowHelp();\r\n }\r\n\r\n if (e == this.k" +
- "eyMap.Open)\r\n {\r\n this.Open();\r\n }\r\n " +
- " };\r\n\r\n this.Add(this.rootCommandsListView);\r\n }\r\n\r\n private void C" +
- "hangeKeybindings()\r\n {\r\n var kb = new KeyBindingsUI(keyMap);\r\n " +
- "Application.Run(kb);\r\n \r\n if (kb.Save)\r\n {\r\n Sav" +
- "eKeyMap();\r\n }\r\n }\r\n\r\n\r\n private void Editor_Closing(object? sender" +
- ", ToplevelClosingEventArgs obj)\r\n {\r\n if (this.viewBeingEdited == null" +
- ")\r\n {\r\n return;\r\n }\r\n\r\n if (this.HasUnsavedChang" +
- "es)\r\n {\r\n int answer = ChoicesDialog.Query(\"Unsaved Changes\", " +
- "$\"You have unsaved changes to {this.viewBeingEdited.SourceCode.DesignerFile.Name" +
- "}\", \"Save\", \"Don\'t Save\", \"Cancel\");\r\n\r\n if (answer == 0)\r\n " +
- " {\r\n this.Save();\r\n }\r\n else\r\n " +
- "if (answer == 1)\r\n {\r\n return;\r\n }\r\n " +
- " else\r\n {\r\n obj.Cancel = true;\r\n }\r\n " +
- " }\r\n }\r\n\r\n private void CreateAndShowContextMenu(MouseEventArgs? m, De" +
- "sign? rightClicked)\r\n {\r\n if (this.viewBeingEdited == null)\r\n {" +
- "\r\n return;\r\n }\r\n\r\n var selected = SelectionManager.Inst" +
- "ance.Selected.ToArray();\r\n\r\n // BUG: This is an improper exception here a" +
- "nd could have unexpected behavior if this method is ever called asynchronously.\r" +
- "\n var factory = new OperationFactory(\r\n (p, v) => ValueFac" +
- "tory.GetNewValue(p.Design, p, v, out var newValue) ? newValue : throw new Operat" +
- "ionCanceledException() );\r\n\r\n var operations = factory\r\n .Crea" +
- "teOperations(selected, m, rightClicked, out string name)\r\n .Where(o =" +
- "> !o.IsImpossible)\r\n .ToArray();\r\n\r\n var setProps = operations" +
- ".OfType();\r\n var others = operations\r\n ." +
- "Except(setProps)\r\n .GroupBy(k => k.Category, ToMenuItem);\r\n\r\n " +
- "var setPropsItems = setProps.Select(ToMenuItem).ToArray();\r\n bool hasProp" +
- "sItems = setPropsItems.Any();\r\n\r\n var all = new List();\r\n\r\n " +
- " // only add the set properties category if there are some\r\n if (has" +
- "PropsItems)\r\n {\r\n all.Add(new MenuItemv2()\r\n {\r\n " +
- " Title = name,\r\n Action = () =>\r\n {\r\n " +
- " if (selected.Length == 1 || rightClicked != null)\r\n " +
- " {\r\n this.ShowEditProperties(rightClicked ?? sel" +
- "ected[0]);\r\n }\r\n },\r\n SubMenu =" +
- " new Menuv2(setPropsItems)\r\n });\r\n }\r\n\r\n // For each Ex" +
- "traOperation grouped by Category\r\n foreach (var g in others)\r\n {\r\n" +
- " // if there is no category\r\n if (string.IsNullOrWhiteSpac" +
- "e(g.Key))\r\n {\r\n // add the operations with no category" +
- " in alphabetical order\r\n all.AddRange(g.OrderBy(mi => mi.Title));" +
- "\r\n }\r\n else\r\n {\r\n // Add categor" +
- "ies first\r\n all.Insert(\r\n hasPropsItems ? 1 : " +
- "0,\r\n new MenuItemv2()\r\n {\r\n " +
- " Title = g.Key,\r\n SubMenu = new Menuv2(g.ToArray(" +
- "))\r\n });\r\n }\r\n }\r\n\r\n // there\'s noth" +
- "ing we can do\r\n if (all.Count == 0)\r\n {\r\n return;\r\n " +
- " }\r\n\r\n var menu = new PopoverMenu(all.ToArray());\r\n Point posit" +
- "ion;\r\n if (m != null)\r\n {\r\n position = m.Position;\r\n " +
- " }\r\n else\r\n {\r\n var d = SelectionManager.Instance.S" +
- "elected.FirstOrDefault() ?? this.viewBeingEdited;\r\n var pt = d.View.C" +
- "ontentToScreen(new Point(0, 0));\r\n position = new Point(pt.X, pt.Y);\r" +
- "\n }\r\n\r\n this.menuOpen = true;\r\n SelectionManager.Instance.L" +
- "ockSelection = true;\r\n \r\n if(m != null)\r\n {\r\n m." +
- "Handled = true;\r\n }\r\n\r\n \r\n // TODO: rly? you have to pass i" +
- "t its own menu items!?\r\n menu.MakeVisible(position);\r\n menu.Accept" +
- "ed += (_, _) =>\r\n {\r\n this.menuOpen = false;\r\n Sele" +
- "ctionManager.Instance.LockSelection = false;\r\n };\r\n }\r\n\r\n private s" +
- "tatic MenuItemv2 ToMenuItem(IOperation operation)\r\n {\r\n return new Men" +
- "uItemv2(operation.ToString(), string.Empty, () => Try(() => OperationManager.Ins" +
- "tance.Do(operation)));\r\n\r\n static void Try(Action action)\r\n {\r\n " +
- " try\r\n {\r\n // BUG: Thread-safety\r\n " +
- " // Race conditions because this is not a valid synchronization mechanism\r\n " +
- " SelectionManager.Instance.LockSelection = true;\r\n a" +
- "ction();\r\n }\r\n catch (Exception ex)\r\n {\r\n " +
- " ExceptionViewer.ShowException(\"Operation failed\", ex);\r\n }\r" +
- "\n finally\r\n {\r\n SelectionManager.Instance.L" +
- "ockSelection = false;\r\n }\r\n }\r\n }\r\n\r\n\r\n private string? " +
- "GetLowerRightTextIfAny()\r\n {\r\n if (this.flashMessage != null)\r\n " +
- " {\r\n var m = this.flashMessage;\r\n this.flashMessage = null" +
- ";\r\n return m;\r\n }\r\n\r\n if (MenuTracker.Instance.Currentl" +
- "yOpenMenuItem != null)\r\n {\r\n return $\"Selected: {MenuTracker.I" +
- "nstance.CurrentlyOpenMenuItem.Title}\";\r\n }\r\n\r\n var selected = Sele" +
- "ctionManager.Instance.Selected.ToArray();\r\n\r\n string name = selected.Leng" +
- "th == 1 ? selected[0].FieldName : $\"{selected.Length} objects\";\r\n\r\n if (s" +
- "elected.Any())\r\n {\r\n return $\"Selected: {name} ({this.keyMap.E" +
- "ditProperties} to Edit, {this.keyMap.ShowHelp} for Help)\";\r\n }\r\n\r\n " +
- " return this.GetHelpWithEmptyFormLoaded();\r\n }\r\n\r\n private void SelectAll(" +
- ")\r\n {\r\n if (this.viewBeingEdited == null)\r\n {\r\n retu" +
- "rn;\r\n }\r\n\r\n var everyone = this.viewBeingEdited.GetAllDesigns()\r\n " +
- " .Where(d => !d.IsRoot)\r\n .ToArray();\r\n\r\n SelectionM" +
- "anager.Instance.ForceSetSelection(everyone);\r\n }\r\n\r\n private void Paste()\r" +
- "\n {\r\n var d = SelectionManager.Instance.GetMostSelectedContainerOrNull" +
- "() ?? this.viewBeingEdited;\r\n\r\n if (d != null)\r\n {\r\n va" +
- "r paste = new PasteOperation(d);\r\n\r\n if (paste.IsImpossible)\r\n " +
- " {\r\n return;\r\n }\r\n\r\n OperationManager.I" +
- "nstance.Do(paste);\r\n }\r\n }\r\n\r\n private void Copy()\r\n {\r\n " +
- "var copy = new CopyOperation(SelectionManager.Instance.Selected.ToArray());\r\n " +
- " OperationManager.Instance.Do(copy);\r\n }\r\n\r\n private void ShowViewSpec" +
- "ificOperations()\r\n {\r\n var d = SelectionManager.Instance.GetSingleSele" +
- "ctionOrNull();\r\n\r\n if (d != null)\r\n {\r\n var options = d" +
- ".GetExtraOperations().Where(o => !o.IsImpossible).ToArray();\r\n\r\n if (" +
- "options.Any() && Modals.Get(\"Operations\", \"Ok\", options, null, out var selected)" +
- " && selected != null)\r\n {\r\n OperationManager.Instance." +
- "Do(selected);\r\n }\r\n }\r\n }\r\n\r\n private void ShowHelp()\r\n " +
- " {\r\n if (menuOpen)\r\n {\r\n return;\r\n }\r\n " +
- "var menuItem = MenuTracker.Instance.CurrentlyOpenMenuItem;\r\n\r\n // if we a" +
- "re in a menu\r\n if (menuItem != null)\r\n {\r\n return;\r\n " +
- " }\r\n \r\n ChoicesDialog.Query(\"Help\", this.GetHelp(), \"Ok\");\r\n " +
- " }\r\n\r\n private void MoveControl(int deltaX, int deltaY)\r\n {\r\n this" +
- ".DoForSelectedViews((d) => new MoveViewOperation(d, deltaX, deltaY));\r\n }\r\n\r\n" +
- " private void Delete()\r\n {\r\n if (this.viewBeingEdited == null)\r\n " +
- " {\r\n return;\r\n }\r\n\r\n if (SelectionManager.Instance." +
- "Selected.Any())\r\n {\r\n var cmd = new DeleteViewOperation(Select" +
- "ionManager.Instance.Selected.ToArray());\r\n OperationManager.Instance." +
- "Do(cmd);\r\n }\r\n }\r\n\r\n private void DoForSelectedViews(Func operationFunc, bool allowOnRoot = false)\r\n {\r\n if (this.view" +
- "BeingEdited == null)\r\n {\r\n return;\r\n }\r\n\r\n var s" +
- "elected = SelectionManager.Instance.Selected.ToArray();\r\n\r\n if (selected." +
- "Length > 1)\r\n {\r\n var op = new CompositeOperation(\r\n " +
- " SelectionManager.Instance.Selected\r\n .Select(operationFunc)" +
- ".ToArray());\r\n\r\n OperationManager.Instance.Do(op);\r\n }\r\n " +
- " else if (selected.Length == 1)\r\n {\r\n var viewDesign = select" +
- "ed.Single();\r\n\r\n // don\'t delete the root view\r\n if (viewD" +
- "esign.IsRoot && !allowOnRoot)\r\n {\r\n return;\r\n " +
- " }\r\n\r\n OperationManager.Instance.Do(operationFunc(viewDesign));\r\n " +
- " }\r\n }\r\n\r\n private void Open()\r\n {\r\n var ofd = new OpenDial" +
- "og()\r\n {\r\n Title = \"Open\",\r\n AllowedTypes = new Lis" +
- "t(new[] { new AllowedType(\"View\", SourceCodeFile.ExpectedExtension" +
- ") })\r\n };\r\n ofd.Layout();\r\n\r\n Application.Run(ofd, this.Err" +
- "orHandler);\r\n\r\n if (!ofd.Canceled)\r\n {\r\n try\r\n " +
- " {\r\n var path = ofd.Path.ToString();\r\n\r\n if (str" +
- "ing.IsNullOrEmpty(path))\r\n {\r\n return;\r\n " +
- " }\r\n\r\n this.Open(new FileInfo(path));\r\n }\r\n " +
- " catch (Exception ex)\r\n {\r\n ExceptionViewer.S" +
- "howException($\"Failed to open \'{ofd.Path}\'\", ex);\r\n }\r\n }\r\n " +
- " }\r\n\r\n private bool ErrorHandler(Exception arg)\r\n {\r\n ExceptionView" +
- "er.ShowException(\"Global Exception\", arg);\r\n return true;\r\n }\r\n\r\n p" +
- "rivate void Open(FileInfo toOpen)\r\n {\r\n var open = new LoadingDialog(t" +
- "oOpen);\r\n\r\n // since we are opening a new view we should\r\n // clea" +
- "r the history\r\n OperationManager.Instance.ClearUndoRedo();\r\n Desig" +
- "n? instance = null;\r\n SelectionManager.Instance.Clear();\r\n\r\n Task." +
- "Run(() =>\r\n {\r\n var decompiler = new CodeToView(new SourceCode" +
- "File(toOpen));\r\n instance = decompiler.CreateInstance();\r\n })." +
- "ContinueWith(\r\n (t, _) =>\r\n {\r\n // no longe" +
- "r loading\r\n Application.Invoke(() => Application.RequestStop());\r" +
- "\n\r\n if (t.Exception != null)\r\n {\r\n " +
- " Application.Invoke(() =>\r\n ExceptionViewer.ShowExcept" +
- "ion($\"Failed to open \'{toOpen.Name}\'\", t.Exception));\r\n retur" +
- "n;\r\n }\r\n\r\n // if loaded correctly then\r\n " +
- " if (instance != null)\r\n {\r\n this.Replace" +
- "ViewBeingEdited(instance);\r\n }\r\n },\r\n TaskS" +
- "cheduler.FromCurrentSynchronizationContext());\r\n\r\n Application.Run(open, " +
- "this.ErrorHandler);\r\n }\r\n\r\n private void New()\r\n {\r\n if (!Modals" +
- ".Get(\"Create New View\", \"Ok\", GetSupportedRootViews(), null, out var selected))\r" +
- "\n {\r\n return;\r\n }\r\n\r\n var ofd = new SaveDialog()" +
- "\r\n {\r\n Title = \"New\",\r\n AllowedTypes = new List() { new AllowedType(\"C# File\", \".cs\") },\r\n Path = \"MyView." +
- "cs\",\r\n };\r\n ofd.Style.PreserveFilenameOnDirectoryChanges = true;\r\n" +
- " ofd.Layout();\r\n\r\n Application.Run(ofd);\r\n\r\n if (!ofd.Cance" +
- "led)\r\n {\r\n try\r\n {\r\n var path = ofd." +
- "Path;\r\n\r\n if (string.IsNullOrWhiteSpace(path) || selected == null" +
- ")\r\n {\r\n return;\r\n }\r\n\r\n " +
- " var file = new FileInfo(path);\r\n\r\n // Check if we are abo" +
- "ut to overwrite some files\r\n // and if so warn the user\r\n " +
- " var files = new SourceCodeFile(file);\r\n\r\n if(!CodeDomArgs" +
- ".IsValidIdentifier(files.ClassName))\r\n {\r\n Cho" +
- "icesDialog.Query(\"Invalid Name\",$\"Invalid class name \'{files.ClassName}\'\",\"Ok\");" +
- "\r\n return;\r\n }\r\n\r\n var sb = new" +
- " StringBuilder();\r\n\r\n if (files.CsFile.Exists)\r\n {" +
- "\r\n sb.AppendLine(files.CsFile.Name);\r\n }\r\n\r\n " +
- " if (files.DesignerFile.Exists)\r\n {\r\n " +
- " sb.AppendLine(files.DesignerFile.Name);\r\n }\r\n\r\n " +
- " if (sb.Length > 0)\r\n {\r\n if (!ChoicesDialog" +
- ".Confirm(\"Overwrite Files?\", $\"The following files will be overwritten:{Environm" +
- "ent.NewLine}{sb.ToString().TrimEnd()}\", \"Ok\", \"Cancel\"))\r\n {\r" +
- "\n return; // user canceled overwrite\r\n " +
- " }\r\n }\r\n\r\n this.New(file, selected, null);\r\n " +
- " }\r\n catch (Exception ex)\r\n {\r\n Except" +
- "ionViewer.ShowException($\"Failed to create \'{ofd.Path}\'\", ex);\r\n " +
- "throw;\r\n }\r\n }\r\n }\r\n\r\n private static Type[] GetSupporte" +
- "dRootViews()\r\n {\r\n return new Type[] { typeof(Window), typeof(Dialog)," +
- " typeof(View), typeof(Toplevel) };\r\n }\r\n\r\n private void New(FileInfo toOpe" +
- "n, Type typeToCreate, string? explicitNamespace)\r\n {\r\n var viewToCode " +
- "= new ViewToCode();\r\n string? ns = explicitNamespace;\r\n\r\n // TODO:" +
- " The following two if statements can be combined and run in a loop until the use" +
- "r either cancels or gets it right\r\n // if no explicit one\r\n if (st" +
- "ring.IsNullOrWhiteSpace(ns))\r\n {\r\n // prompt user for namespac" +
- "e\r\n if (!Modals.GetString(\"Namespace\", \"Enter the namespace for your " +
- "class\", \"YourNamespace\", out ns))\r\n {\r\n // user cancel" +
- "led typing a namespace\r\n return;\r\n }\r\n }\r\n\r\n " +
- " // Validate the namespace\r\n if (string.IsNullOrWhiteSpace(ns) || ns." +
- "Contains(\' \') || char.IsDigit(ns.First()))\r\n {\r\n MessageBox.Er" +
- "rorQuery(\"Invalid Namespace\", \"Namespace must not contain spaces, be empty or be" +
- "gin with a number\", \"Ok\");\r\n return;\r\n }\r\n\r\n // since w" +
- "e are creating a new view we should\r\n // clear the history\r\n Opera" +
- "tionManager.Instance.ClearUndoRedo();\r\n Design? instance = null;\r\n " +
- " SelectionManager.Instance.Clear();\r\n\r\n var open = new LoadingDialog(toOp" +
- "en);\r\n\r\n // BUG: If this is not awaited, exceptions at any point of it ca" +
- "n be thrown at an indeterminate place and time.\r\n Task.Run(() =>\r\n " +
- " {\r\n // Create the view files and compile\r\n instance = vie" +
- "wToCode.GenerateNewView(toOpen, ns ?? \"YourNamespace\", typeToCreate);\r\n }" +
- ").ContinueWith(\r\n (t, _) =>\r\n {\r\n // no lon" +
- "ger loading\r\n Application.Invoke(() => Application.RequestStop())" +
- ";\r\n\r\n if (t.Exception != null)\r\n {\r\n " +
- " Application.Invoke(() =>\r\n ExceptionViewer.ShowExce" +
- "ption($\"Failed to create \'{toOpen.Name}\'\", t.Exception));\r\n r" +
- "eturn;\r\n }\r\n\r\n // if loaded correctly then\r\n " +
- " if (instance != null)\r\n {\r\n this.Rep" +
- "laceViewBeingEdited(instance);\r\n }\r\n },\r\n T" +
- "askScheduler.FromCurrentSynchronizationContext());\r\n\r\n Application.Run(op" +
- "en, this.ErrorHandler);\r\n }\r\n\r\n private void ReplaceViewBeingEdited(Design" +
- " design)\r\n {\r\n Application.Invoke(() =>\r\n {\r\n // rem" +
- "ove the old view\r\n if (this.viewBeingEdited != null)\r\n {\r\n" +
- " // and dispose it\r\n this.Remove(this.viewBeingEdi" +
- "ted.View);\r\n this.viewBeingEdited.View.Dispose();\r\n }\r" +
- "\n\r\n // remove list view to prevent it stealing keystrokes and jumping" +
- " back\r\n // into input focus\r\n this.Remove(this.rootCommand" +
- "sListView);\r\n\r\n // Load new instance\r\n this.viewBeingEdite" +
- "d = design;\r\n\r\n // And add it to the editing window\r\n this" +
- ".Add(this.viewBeingEdited.View);\r\n });\r\n }\r\n\r\n private void Save()\r" +
- "\n {\r\n if (this.viewBeingEdited == null)\r\n {\r\n return" +
- ";\r\n }\r\n\r\n var viewToCode = new ViewToCode();\r\n\r\n viewToCode" +
- ".GenerateDesignerCs(\r\n this.viewBeingEdited,\r\n this.viewBe" +
- "ingEdited.View.GetType().BaseType ?? throw new Exception(\"View being edited had " +
- "no base class\"));\r\n\r\n this.flashMessage = $\"Saved {this.viewBeingEdited.S" +
- "ourceCode.DesignerFile.Name}\";\r\n this.SetNeedsDraw();\r\n\r\n this.Las" +
- "tSavedOperation = OperationManager.Instance.GetLastAppliedOperation()?.UniqueIde" +
- "ntifier;\r\n }\r\n\r\n private void ShowAddViewWindow()\r\n {\r\n if (this" +
- ".viewBeingEdited == null)\r\n {\r\n return;\r\n }\r\n\r\n " +
- "// what is the currently selected design\r\n var toAddTo = SelectionManager" +
- ".Instance.GetMostSelectedContainerOrNull() ?? this.viewBeingEdited;\r\n\r\n O" +
- "perationManager.Instance.Do(\r\n new AddViewOperation(toAddTo));\r\n }" +
- "\r\n\r\n private void ShowEditProperties()\r\n {\r\n var d = SelectionManag" +
- "er.Instance.GetSingleSelectionOrNull();\r\n if (d != null)\r\n {\r\n " +
- " this.ShowEditProperties(d);\r\n }\r\n }\r\n\r\n private void ShowEd" +
- "itProperties(Design d)\r\n {\r\n var edit = new EditDialog(d);\r\n Ap" +
- "plication.Run(edit, this.ErrorHandler);\r\n }\r\n}\r\n";
- this.tvEditor.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
- tabView2editorcs.View.Add(this.tvEditor);
- tabView2.AddTab(tabView2editorcs, false);
- Terminal.Gui.Views.Tab tabView2mouseManagercs;
- tabView2mouseManagercs = new Terminal.Gui.Views.Tab();
- tabView2mouseManagercs.DisplayText = "MouseManager.cs";
- tabView2mouseManagercs.View = new View();
- tabView2mouseManagercs.View.Width = Dim.Fill();
- tabView2mouseManagercs.View.Height = Dim.Fill();
- tabView2mouseManagercs.View.CanFocus = true;
- this.tvMouseManager.Width = Dim.Fill(0);
- this.tvMouseManager.Height = Dim.Fill(0);
- this.tvMouseManager.X = 0;
- this.tvMouseManager.Y = 0;
- this.tvMouseManager.Visible = true;
- this.tvMouseManager.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
- this.tvMouseManager.CanFocus = true;
- this.tvMouseManager.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyle.None;
- this.tvMouseManager.AllowsTab = true;
- this.tvMouseManager.AllowsReturn = true;
- this.tvMouseManager.WordWrap = false;
- this.tvMouseManager.Data = "tvMouseManager";
- this.tvMouseManager.Text = "using Terminal.Gui;\r\nusing Terminal.Gui.App;\r\nusing Terminal.Gui.Input;\r\nusing Te" +
- "rminal.Gui.ViewBase;\r\nusing TerminalGuiDesigner.Operations;\r\n\r\nnamespace Termina" +
- "lGuiDesigner.UI;\r\n\r\n/// \r\n/// Manages responding to root mouse e.g. by\r" +
- "\n/// dragging around and/or resizing.\r\n/// \r\npubl" +
- "ic class MouseManager\r\n{\r\n private DragOperation? dragOperation = null;\r\n " +
- "private ResizeOperation? resizeOperation = null;\r\n\r\n /// \r\n /// I" +
- "f the user is dragging a selection box then this is the current area\r\n /// th" +
- "at is being pulled over or null if no multi select is underway.\r\n /// \r\n private Point? selectionStart = null;\r\n private Point? selectionEnd " +
- "= null;\r\n\r\n /// \r\n /// Gets the container that \'drag a box\' selec" +
- "tion is occurring in (if any).\r\n /// See also .\r\n " +
- " /// \r\n private View? selectionContainer;\r\n\r\n /// \r\n " +
- " /// Gets the current \'drag a box\' selection area that is ongoing (if any).\r\n " +
- " /// \r\n public Rectangle? SelectionBox => RectExtensions.FromBetwe" +
- "enPoints(this.selectionStart, this.selectionEnd);\r\n\r\n /// \r\n /// " +
- "Responds to (by changing a \'drag a box\' sele" +
- "ction area\r\n /// or starting a resize etc).\r\n /// \r\n /// The reported by .\r\n /// The root that is open in the .\r\n public void H" +
- "andleMouse(MouseEventArgs m, Design viewBeingEdited)\r\n {\r\n // start dr" +
- "agging\r\n if (m.Flags.HasFlag(MouseFlags.Button1Pressed)\r\n && t" +
- "his.resizeOperation == null && this.dragOperation == null && this.selectionStart" +
- " == null)\r\n {\r\n View? drag = viewBeingEdited.View.HitTest(m, o" +
- "ut bool isBorder, out bool isLowerRight);\r\n\r\n // if user is ctrl+clic" +
- "k\r\n if (m.Flags.HasFlag(MouseFlags.ButtonCtrl) && drag != null)\r\n " +
- " {\r\n // then add or remove the clicked item from the group" +
- " selection\r\n var addOrRemove = drag.GetNearestDesign();\r\n " +
- " var selection = SelectionManager.Instance.Selected.ToList();\r\n\r\n " +
- " if (addOrRemove != null && selection.Any())\r\n {\r\n " +
- " if (selection.Contains(addOrRemove))\r\n {\r\n " +
- " selection.Remove(addOrRemove);\r\n }\r\n " +
- " else\r\n {\r\n selection.Add(a" +
- "ddOrRemove);\r\n }\r\n\r\n SelectionManager.Inst" +
- "ance.ForceSetSelection(selection.ToArray());\r\n return;\r\n " +
- " }\r\n }\r\n\r\n // if mousing down in empty space\r\n " +
- " if (drag != null && drag.IsContainerView() && !isLowerRight && !isBord" +
- "er)\r\n {\r\n // start dragging a selection box\r\n " +
- " this.selectionContainer = drag;\r\n this.selectionStart = m." +
- "Position;\r\n }\r\n\r\n // if nothing is going on yet\r\n " +
- " if (drag != null && drag.Data is Design design && drag.SuperView != null\r\n " +
- " && this.resizeOperation == null && this.dragOperation == null && this." +
- "selectionStart == null)\r\n {\r\n var parent = drag.SuperV" +
- "iew;\r\n\r\n var dest = parent.ScreenToContent(m.Position);\r\n\r\n " +
- " if (isLowerRight)\r\n {\r\n this.resizeO" +
- "peration = new ResizeOperation(design, dest.X, dest.Y);\r\n }\r\n " +
- " else\r\n {\r\n var multiSelected = Sel" +
- "ectionManager.Instance.Selected.ToArray();\r\n\r\n // if user is " +
- "click and drag moving a single view\r\n // in a multi selection" +
- ".\r\n if (multiSelected.Contains(design))\r\n " +
- "{\r\n // drag all the views at once\r\n " +
- " this.dragOperation = new DragOperation(\r\n design,\r\n" +
- " dest.X,\r\n dest.Y,\r\n " +
- " multiSelected.Except(new[] { design }).ToArray());\r\n " +
- " }\r\n else\r\n {\r\n " +
- " // else drag only the non selected one\r\n this.d" +
- "ragOperation = new DragOperation(design, dest.X, dest.Y, new Design[0]);\r\n " +
- " }\r\n\r\n // don\'t begin an impossible drag!\r\n " +
- " if (this.dragOperation.IsImpossible)\r\n {\r\n " +
- " this.dragOperation = null;\r\n }\r\n " +
- " }\r\n }\r\n }\r\n\r\n // continue dragging a selection b" +
- "ox\r\n if (m.Flags.HasFlag(MouseFlags.Button1Pressed) && this.selectionStar" +
- "t != null)\r\n {\r\n // move selection box to new mouse position\r\n" +
- " this.selectionEnd = m.Position;\r\n viewBeingEdited.View.Se" +
- "tNeedsDraw();\r\n return;\r\n }\r\n\r\n // continue dragging a " +
- "view\r\n if (m.Flags.HasFlag(MouseFlags.Button1Pressed) && this.dragOperati" +
- "on?.BeingDragged.View?.SuperView != null)\r\n {\r\n var dest = thi" +
- "s.dragOperation?.BeingDragged.View.SuperView.ScreenToContent(m.Position);\r\n\r\n " +
- " if (dest != null && this.dragOperation != null)\r\n {\r\n " +
- " this.dragOperation.ContinueDrag(dest.Value);\r\n viewBeing" +
- "Edited.View.SetNeedsDraw();\r\n // BUG: Method is gone, will this f" +
- "unctionality work still without it?\r\n // Application.DoEvents();\r" +
- "\n }\r\n }\r\n\r\n // continue resizing\r\n if (m.Flags.H" +
- "asFlag(MouseFlags.Button1Pressed)\r\n && this.resizeOperation != null\r\n" +
- " && this.resizeOperation.BeingResized.View.SuperView != null)\r\n " +
- " {\r\n var dest = this.resizeOperation.BeingResized.View.SuperView.Scr" +
- "eenToContent(m.Position);\r\n\r\n this.resizeOperation.ContinueResize(des" +
- "t);\r\n\r\n viewBeingEdited.View.SetNeedsDraw();\r\n // BUG: Met" +
- "hod is gone, will this functionality work still without it?\r\n // Appl" +
- "ication.DoEvents();\r\n }\r\n\r\n // end things (because mouse released)" +
- "\r\n if (!m.Flags.HasFlag(MouseFlags.Button1Pressed))\r\n {\r\n " +
- " // end selection box\r\n if (this.selectionStart != null && this.Sel" +
- "ectionBox != null && this.selectionContainer != null)\r\n {\r\n " +
- " SelectionManager.Instance.SetSelection(\r\n this.selectio" +
- "nContainer.GetActualSubviews()\r\n .Where(v => v.IntersectsScre" +
- "enRect(this.SelectionBox.Value))\r\n .Select(v => v.GetNearestD" +
- "esign())\r\n .Where(d => d != null && !d.IsRoot)\r\n " +
- " .Cast()\r\n .ToArray());\r\n\r\n this" +
- ".selectionStart = null;\r\n this.selectionEnd = null;\r\n " +
- " this.selectionContainer = null;\r\n viewBeingEdited.View.SetNee" +
- "dsDraw();\r\n // BUG: Method is gone, will this functionality work " +
- "still without it?\r\n // Application.DoEvents();\r\n }\r\n\r\n" +
- " // end dragging\r\n if (this.dragOperation != null)\r\n " +
- " {\r\n // see if we are dragging into a new container\r\n " +
- " var dropInto = viewBeingEdited.View.HitTest(m, out _, out _, this.dragO" +
- "peration.BeingDragged.View);\r\n\r\n // TODO: this is quite hacky wor" +
- "karound for dropping on things like TabView top row. Need\r\n // a" +
- " better solution to this.\r\n\r\n // HitTest might return a sub-contr" +
- "ol (e.g. TabView top row tabs)\r\n // So grab the nearest user desi" +
- "gnable view. That\'s probably what\r\n // they want to move into an" +
- "yway.\r\n var into = dropInto?.GetNearestDesign();\r\n\r\n " +
- " if (into != null && dropInto != this.dragOperation.DropInto)\r\n " +
- " {\r\n // we are dragging into a new container\r\n " +
- " this.dragOperation.DropInto = into.View;\r\n\r\n // end drag" +
- "\r\n OperationManager.Instance.Do(this.dragOperation);\r\n " +
- " this.dragOperation = null;\r\n }\r\n }\r\n\r\n " +
- " // end resize\r\n if (this.resizeOperation != null)\r\n " +
- " {\r\n // end resize\r\n OperationManager.Instance.D" +
- "o(this.resizeOperation);\r\n this.resizeOperation = null;\r\n " +
- " }\r\n }\r\n }\r\n}\r\n";
- this.tvMouseManager.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
- tabView2mouseManagercs.View.Add(this.tvMouseManager);
- tabView2.AddTab(tabView2mouseManagercs, false);
- this.tabView2.ApplyStyleChanges();
- this.Add(this.tabView2);
- this.tabView.Width = 50;
- this.tabView.Height = Dim.Percent(75);
- this.tabView.X = Pos.Percent(75);
- this.tabView.Y = 0;
- this.tabView.Visible = true;
- this.tabView.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
- this.tabView.CanFocus = true;
- this.tabView.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyle.None;
- this.tabView.Data = "tabView";
- this.tabView.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
- this.tabView.MaxTabTextWidth = 30u;
- this.tabView.Style.ShowBorder = true;
- this.tabView.Style.ShowTopLine = true;
- this.tabView.Style.TabsOnBottom = false;
- Terminal.Gui.Views.Tab tabViewdiagnosticTools;
- tabViewdiagnosticTools = new Terminal.Gui.Views.Tab();
- tabViewdiagnosticTools.DisplayText = "Diagnostic Tools";
- tabViewdiagnosticTools.View = new View();
- tabViewdiagnosticTools.View.Width = Dim.Fill();
- tabViewdiagnosticTools.View.Height = Dim.Fill();
- tabViewdiagnosticTools.View.CanFocus = true;
- this.graphView.Width = Dim.Fill(0);
- this.graphView.Height = 5;
- this.graphView.X = 1;
- this.graphView.Y = 0;
- this.graphView.Visible = true;
- this.graphView.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
- this.graphView.CanFocus = true;
- this.graphView.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyle.None;
- this.graphView.Data = "graphView";
- this.graphView.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
- this.graphView.GraphColor = new Terminal.Gui.Drawing.Attribute(Terminal.Gui.Drawing.Color.White,Terminal.Gui.Drawing.Color.Black);
- this.graphView.ScrollOffset = new System.Drawing.PointF(0F, 0F);
- this.graphView.MarginLeft = 0u;
- this.graphView.MarginBottom = 0u;
- this.graphView.CellSize = new System.Drawing.PointF(1F, 1F);
- this.graphView.AxisX.Visible = true;
- this.graphView.AxisX.Increment = 1F;
- this.graphView.AxisX.ShowLabelsEvery = 5u;
- this.graphView.AxisX.Minimum = null;
- this.graphView.AxisX.Text = null;
- this.graphView.AxisY.Visible = true;
- this.graphView.AxisY.Increment = 1F;
- this.graphView.AxisY.ShowLabelsEvery = 5u;
- this.graphView.AxisY.Minimum = null;
- this.graphView.AxisY.Text = null;
- tabViewdiagnosticTools.View.Add(this.graphView);
- tabView.AddTab(tabViewdiagnosticTools, false);
- Terminal.Gui.Views.Tab tabViewgitChanges;
- tabViewgitChanges = new Terminal.Gui.Views.Tab();
- tabViewgitChanges.DisplayText = "Git Changes";
- tabViewgitChanges.View = new View();
- tabViewgitChanges.View.Width = Dim.Fill();
- tabViewgitChanges.View.Height = Dim.Fill();
- tabViewgitChanges.View.CanFocus = true;
- this.label.Width = Dim.Fill(0);
- this.label.Height = Dim.Auto();
- this.label.X = 0;
- this.label.Y = 0;
- this.label.Visible = true;
- this.label.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
- this.label.CanFocus = false;
- this.label.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyle.None;
- this.label.Data = "label";
- this.label.Text = "Branch has active pull request #314 without comments.";
- this.label.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
- tabViewgitChanges.View.Add(this.label);
- tabView.AddTab(tabViewgitChanges, false);
- this.tabView.ApplyStyleChanges();
- this.Add(this.tabView);
- this.tabView3.Width = Dim.Fill(0);
- this.tabView3.Height = 5;
- this.tabView3.X = 0;
- this.tabView3.Y = Pos.Bottom(tabView);
- this.tabView3.Visible = true;
- this.tabView3.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
- this.tabView3.CanFocus = true;
- this.tabView3.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyle.None;
- this.tabView3.Data = "tabView3";
- this.tabView3.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
- this.tabView3.MaxTabTextWidth = 30u;
- this.tabView3.Style.ShowBorder = true;
- this.tabView3.Style.ShowTopLine = true;
- this.tabView3.Style.TabsOnBottom = false;
- Terminal.Gui.Views.Tab tabView3callStack;
- tabView3callStack = new Terminal.Gui.Views.Tab();
- tabView3callStack.DisplayText = "Call Stack";
- tabView3callStack.View = new View();
- tabView3callStack.View.Width = Dim.Fill();
- tabView3callStack.View.Height = Dim.Fill();
- tabView3callStack.View.CanFocus = true;
- tabView3.AddTab(tabView3callStack, false);
- Terminal.Gui.Views.Tab tabView3watch1;
- tabView3watch1 = new Terminal.Gui.Views.Tab();
- tabView3watch1.DisplayText = "Watch 1";
- tabView3watch1.View = new View();
- tabView3watch1.View.Width = Dim.Fill();
- tabView3watch1.View.Height = Dim.Fill();
- tabView3watch1.View.CanFocus = true;
- tabView3.AddTab(tabView3watch1, false);
- this.tabView3.ApplyStyleChanges();
- this.Add(this.tabView3);
- this.statusBar.Width = Dim.Fill(0);
- this.statusBar.Height = Dim.Auto();
- this.statusBar.X = 0;
- this.statusBar.Y = Pos.AnchorEnd(0);
- this.statusBar.Visible = true;
- this.statusBar.Arrangement = Terminal.Gui.ViewBase.ViewArrangement.Fixed;
- this.statusBar.CanFocus = true;
- this.statusBar.ShadowStyle = Terminal.Gui.ViewBase.ShadowStyle.None;
- this.statusBar.Data = "statusBar";
- this.statusBar.Text = "";
- this.statusBar.TextAlignment = Terminal.Gui.ViewBase.Alignment.Start;
- this.f1EditMe = new Terminal.Gui.Views.Shortcut(((Terminal.Gui.Drivers.KeyCode)(1114223u)), "F1 - Edit Me", null);
- this.statusBar.Add(this.f1EditMe);
- this.Add(this.statusBar);
- }
- }
-}
diff --git a/Showcase/Text.Designer.cs b/Showcase/Text.Designer.cs
new file mode 100644
index 00000000..1cd75c98
--- /dev/null
+++ b/Showcase/Text.Designer.cs
@@ -0,0 +1,285 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.2.0
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using System;
+ using Terminal.Gui;
+ using Terminal.Gui.App;
+ using Terminal.Gui.Drawing;
+ using Terminal.Gui.Input;
+ using Terminal.Gui.ViewBase;
+ using Terminal.Gui.Views;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Drawing;
+
+
+ public partial class Text : Terminal.Gui.Views.Dialog {
+
+ private Terminal.Gui.Views.Label lblTextField;
+
+ private Terminal.Gui.Views.TextField textField;
+
+ private Terminal.Gui.Views.Label lblTextField2;
+
+ private Terminal.Gui.Views.TextField textField2;
+
+ private Terminal.Gui.Views.Window window;
+
+ private Terminal.Gui.Views.TextView textView;
+
+ private Terminal.Gui.Views.Label lblTextField3;
+
+ private Terminal.Gui.Views.Label lblTextField4;
+
+ private Terminal.Gui.Views.HexView hexView;
+
+ private Terminal.Gui.Views.TreeView
+ /// The application instance.
/// wrapper for a view of Type .
/// Optional explicit name to add with or null to prompt user interactively.
/// Thrown if the is not wrapping a .
- public AddMenuOperation(Design design, string? name)
+ public AddMenuOperation(IApplication app, Design design, string? name)
: base(
- (v) => v.Menus,
+ app,
+ (v) => v.SubViews.OfType().ToArray(),
(v, a) => v.Menus = a,
(s) => s.Title.ToString() ?? "blank menu",
(v, n) => new(n, new MenuItem[] { new() { Title = ViewFactory.DefaultMenuItemText } }),
diff --git a/src/Operations/MenuOperations/ConvertMenuItemToSeperatorOperation.cs b/src/Operations/MenuOperations/ConvertMenuItemToSeperatorOperation.cs
index 1aaf598a..b11f798a 100644
--- a/src/Operations/MenuOperations/ConvertMenuItemToSeperatorOperation.cs
+++ b/src/Operations/MenuOperations/ConvertMenuItemToSeperatorOperation.cs
@@ -1,4 +1,5 @@
-using Terminal.Gui;
+using Terminal.Gui;
+using Terminal.Gui.App;
using Terminal.Gui.Views;
namespace TerminalGuiDesigner.Operations.MenuOperations;
@@ -6,20 +7,28 @@ namespace TerminalGuiDesigner.Operations.MenuOperations;
///
///
/// Converts a into a Separator (horizontal line in menu).
-/// In Terminal.Gui this is represented as a null in the .
+/// In the designer the separator is stored as a with
+/// as its .
+/// When code is generated it becomes a new Line { Orientation = Orientation.Horizontal }
+/// and on load those Line views are converted back to sentinel MenuItems.
///
///
public class ConvertMenuItemToSeperatorOperation : MenuItemOperation
{
- private int removedAtIdx;
+ private string? originalTitle;
///
/// Initializes a new instance of the class.
///
- /// A to replace with a separator (null) in it's parent .
- public ConvertMenuItemToSeperatorOperation(MenuItem toConvert)
- : base(toConvert)
+ /// The application instance.
+ /// A to convert into a separator.
+ public ConvertMenuItemToSeperatorOperation(IApplication app, MenuItem toConvert)
+ : base(app, toConvert)
{
+ if (toConvert.Title?.ToString() == MenuBarExtensions.SeparatorTitle)
+ {
+ IsImpossible = true;
+ }
}
///
@@ -31,34 +40,26 @@ protected override void RedoImpl()
///
protected override void UndoImpl()
{
- if (this.Parent == null || this.OperateOn == null)
+ if (this.OperateOn == null)
{
return;
}
- var children = this.Parent.Children.ToList