diff --git a/README.md b/README.md
index c515d76c..e849f6ff 100644
--- a/README.md
+++ b/README.md
@@ -74,7 +74,7 @@ You can add new code to `MyDialog.cs` but avoid making any changes to `MyDialog.
For example in `MyDialog.cs` after `InitializeComponent()` add the following:
```csharp
-button1.Accept += ()=>MessageBox.Query("Hello","Hello World","Ok");
+button1.Accepting += ()=>MessageBox.Query("Hello","Hello World","Ok");
```
Now when run clicking the button will trigger a message box.
@@ -171,7 +171,7 @@ italics are experimental and require passing the `-e` flag when starting applica
- [x] Container views (e.g. TabView)
- [ ] To OS clipboard (e.g. open one Designer.cs View and copy to another)
- [x] Retain PosRelative mappings in pasted views (e.g. `A` LeftOf `B`)
-- [x] Move views to subviews
+- [x] Move views to SubViews
- [x] With mouse
- [ ] With keyboard
- [ ] Read and present xmldoc comments when editing properties
diff --git a/Showcase/Menu.Designer.cs b/Showcase/Menu.Designer.cs
new file mode 100644
index 00000000..e66b9d4d
--- /dev/null
+++ b/Showcase/Menu.Designer.cs
@@ -0,0 +1,303 @@
+
+//------------------------------------------------------------------------------
+
+//
+// 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 System.Collections;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.Drawing;
+
+
+ public partial class Menu : Terminal.Gui.Window {
+
+ private Terminal.Gui.MenuBar menuBar;
+
+ private Terminal.Gui.MenuBarItem fileF9Menu;
+
+ private Terminal.Gui.MenuBarItem newMenu;
+
+ private Terminal.Gui.MenuItem projectMenuItem;
+
+ private Terminal.Gui.MenuItem repositoryMenuItem;
+
+ private Terminal.Gui.MenuItem fileMenuItem;
+
+ private Terminal.Gui.MenuItem projectFromExistingCodeMenuItem;
+
+ private Terminal.Gui.MenuItem spellCheckerConfigurationForSelectedItemMenuItem;
+
+ private Terminal.Gui.MenuBarItem openMenu;
+
+ private Terminal.Gui.MenuItem projectSolutionMenuItem;
+
+ private Terminal.Gui.MenuItem folderMenuItem;
+
+ private Terminal.Gui.MenuItem workspaceMenuItem;
+
+ private Terminal.Gui.MenuItem cMakeMenuItem;
+
+ private Terminal.Gui.MenuItem fileMenuItem2;
+
+ private Terminal.Gui.MenuItem cloneRepositoryMenuItem;
+
+ private Terminal.Gui.MenuItem startWindowMenuItem;
+
+ private Terminal.Gui.MenuItem closeMenuItem;
+
+ private Terminal.Gui.MenuItem closeSolutionMenuItem;
+
+ private Terminal.Gui.MenuItem startLiveShareSessionMenuItem;
+
+ private Terminal.Gui.MenuItem joinLiveShareSessionMenuItem;
+
+ private Terminal.Gui.MenuItem saveMenucsMenuItem;
+
+ private Terminal.Gui.MenuItem saveMenucsAsMenuItem;
+
+ private Terminal.Gui.MenuItem saveAllMenuItem;
+
+ private Terminal.Gui.MenuItem pageSetupMenuItem;
+
+ private Terminal.Gui.MenuItem printMenuItem;
+
+ private Terminal.Gui.MenuItem accountSettingsMenuItem;
+
+ private Terminal.Gui.MenuBarItem recentFilesMenu;
+
+ private Terminal.Gui.MenuItem file1csMenuItem;
+
+ private Terminal.Gui.MenuItem file2csMenuItem;
+
+ private Terminal.Gui.MenuBarItem recentProjectsAndSolutionsMenu;
+
+ private Terminal.Gui.MenuItem terminalGuislnMenuItem;
+
+ private Terminal.Gui.MenuItem terminalGuiDesignerslnMenuItem;
+
+ private Terminal.Gui.MenuBarItem moveMenucsIntoMenu;
+
+ private Terminal.Gui.MenuItem solutionItemsMenuItem;
+
+ private Terminal.Gui.MenuItem unitTestsMenuItem;
+
+ private Terminal.Gui.MenuItem showcaseMenuItem;
+
+ private Terminal.Gui.MenuItem exitMenuItem;
+
+ private Terminal.Gui.MenuBarItem editMenu;
+
+ private Terminal.Gui.MenuBarItem goToMenu;
+
+ private Terminal.Gui.MenuItem goToLineMenuItem;
+
+ private void InitializeComponent() {
+ this.menuBar = new Terminal.Gui.MenuBar();
+ this.Width = Dim.Fill(0);
+ this.Height = Dim.Fill(0);
+ this.X = 0;
+ this.Y = 0;
+ this.Visible = true;
+ this.Arrangement = Terminal.Gui.ViewArrangement.Overlapped;
+ this.CanFocus = true;
+ this.ShadowStyle = Terminal.Gui.ShadowStyle.None;
+ this.Modal = false;
+ this.TextAlignment = Terminal.Gui.Alignment.Start;
+ this.Title = "";
+ this.menuBar.Width = Dim.Fill(0);
+ this.menuBar.Height = 1;
+ this.menuBar.X = 0;
+ this.menuBar.Y = 0;
+ this.menuBar.Visible = true;
+ this.menuBar.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.menuBar.CanFocus = false;
+ this.menuBar.ShadowStyle = Terminal.Gui.ShadowStyle.None;
+ this.menuBar.Data = "menuBar";
+ this.menuBar.TextAlignment = Terminal.Gui.Alignment.Start;
+ this.fileF9Menu = new Terminal.Gui.MenuBarItem();
+ this.fileF9Menu.Title = "_File (F9)";
+ this.newMenu = new Terminal.Gui.MenuBarItem();
+ this.newMenu.Title = "New";
+ this.projectMenuItem = new Terminal.Gui.MenuItem();
+ this.projectMenuItem.Title = "Project...";
+ this.projectMenuItem.Data = "projectMenuItem";
+ this.projectMenuItem.ShortcutKey = ((Terminal.Gui.KeyCode)(1342177358u));
+ this.repositoryMenuItem = new Terminal.Gui.MenuItem();
+ this.repositoryMenuItem.Title = "Repository...";
+ this.repositoryMenuItem.Data = "repositoryMenuItem";
+ this.fileMenuItem = new Terminal.Gui.MenuItem();
+ this.fileMenuItem.Title = "File...";
+ this.fileMenuItem.Data = "fileMenuItem";
+ this.projectFromExistingCodeMenuItem = new Terminal.Gui.MenuItem();
+ this.projectFromExistingCodeMenuItem.Title = "Project From Existing Code...";
+ this.projectFromExistingCodeMenuItem.Data = "projectFromExistingCodeMenuItem";
+ this.spellCheckerConfigurationForSelectedItemMenuItem = new Terminal.Gui.MenuItem();
+ this.spellCheckerConfigurationForSelectedItemMenuItem.Title = "Spell Checker Configuration for Selected Item";
+ this.spellCheckerConfigurationForSelectedItemMenuItem.Data = "spellCheckerConfigurationForSelectedItemMenuItem";
+ this.newMenu.Children = new Terminal.Gui.MenuItem[] {
+ this.projectMenuItem,
+ this.repositoryMenuItem,
+ this.fileMenuItem,
+ this.projectFromExistingCodeMenuItem,
+ null,
+ this.spellCheckerConfigurationForSelectedItemMenuItem};
+ this.openMenu = new Terminal.Gui.MenuBarItem();
+ this.openMenu.Title = "Open";
+ this.projectSolutionMenuItem = new Terminal.Gui.MenuItem();
+ this.projectSolutionMenuItem.Title = "Project/Solution...";
+ this.projectSolutionMenuItem.Data = "projectSolutionMenuItem";
+ this.projectSolutionMenuItem.ShortcutKey = ((Terminal.Gui.KeyCode)(1342177359u));
+ this.folderMenuItem = new Terminal.Gui.MenuItem();
+ this.folderMenuItem.Title = "Folder...";
+ this.folderMenuItem.Data = "folderMenuItem";
+ this.folderMenuItem.ShortcutKey = ((Terminal.Gui.KeyCode)(3489661007u));
+ this.workspaceMenuItem = new Terminal.Gui.MenuItem();
+ this.workspaceMenuItem.Title = "Workspace...";
+ this.workspaceMenuItem.Data = "workspaceMenuItem";
+ this.cMakeMenuItem = new Terminal.Gui.MenuItem();
+ this.cMakeMenuItem.Title = "CMake...";
+ this.cMakeMenuItem.Data = "cMakeMenuItem";
+ this.fileMenuItem2 = new Terminal.Gui.MenuItem();
+ this.fileMenuItem2.Title = "File...";
+ this.fileMenuItem2.Data = "fileMenuItem2";
+ this.fileMenuItem2.ShortcutKey = ((Terminal.Gui.KeyCode)(1073741903u));
+ this.openMenu.Children = new Terminal.Gui.MenuItem[] {
+ this.projectSolutionMenuItem,
+ this.folderMenuItem,
+ this.workspaceMenuItem,
+ this.cMakeMenuItem,
+ null,
+ this.fileMenuItem2};
+ this.cloneRepositoryMenuItem = new Terminal.Gui.MenuItem();
+ this.cloneRepositoryMenuItem.Title = "Clone Repository...";
+ this.cloneRepositoryMenuItem.Data = "cloneRepositoryMenuItem";
+ this.startWindowMenuItem = new Terminal.Gui.MenuItem();
+ this.startWindowMenuItem.Title = "Start Window";
+ this.startWindowMenuItem.Data = "startWindowMenuItem";
+ this.closeMenuItem = new Terminal.Gui.MenuItem();
+ this.closeMenuItem.Title = "Close";
+ this.closeMenuItem.Data = "closeMenuItem";
+ this.closeSolutionMenuItem = new Terminal.Gui.MenuItem();
+ this.closeSolutionMenuItem.Title = "Close Solution";
+ this.closeSolutionMenuItem.Data = "closeSolutionMenuItem";
+ this.startLiveShareSessionMenuItem = new Terminal.Gui.MenuItem();
+ this.startLiveShareSessionMenuItem.Title = "Start Live Share Session";
+ this.startLiveShareSessionMenuItem.Data = "startLiveShareSessionMenuItem";
+ this.joinLiveShareSessionMenuItem = new Terminal.Gui.MenuItem();
+ this.joinLiveShareSessionMenuItem.Title = "Join Live Share Session...";
+ this.joinLiveShareSessionMenuItem.Data = "joinLiveShareSessionMenuItem";
+ this.saveMenucsMenuItem = new Terminal.Gui.MenuItem();
+ this.saveMenucsMenuItem.Title = "Save Menu.cs";
+ this.saveMenucsMenuItem.Data = "saveMenucsMenuItem";
+ this.saveMenucsMenuItem.ShortcutKey = ((Terminal.Gui.KeyCode)(1073741907u));
+ this.saveMenucsAsMenuItem = new Terminal.Gui.MenuItem();
+ this.saveMenucsAsMenuItem.Title = "Save Menu.cs As...";
+ this.saveMenucsAsMenuItem.Data = "saveMenucsAsMenuItem";
+ this.saveAllMenuItem = new Terminal.Gui.MenuItem();
+ this.saveAllMenuItem.Title = "Save All";
+ this.saveAllMenuItem.Data = "saveAllMenuItem";
+ this.saveAllMenuItem.ShortcutKey = ((Terminal.Gui.KeyCode)(1342177363u));
+ this.pageSetupMenuItem = new Terminal.Gui.MenuItem();
+ this.pageSetupMenuItem.Title = "Page Setup...";
+ this.pageSetupMenuItem.Data = "pageSetupMenuItem";
+ this.printMenuItem = new Terminal.Gui.MenuItem();
+ this.printMenuItem.Title = "Print...";
+ this.printMenuItem.Data = "printMenuItem";
+ this.printMenuItem.ShortcutKey = ((Terminal.Gui.KeyCode)(1073741904u));
+ this.accountSettingsMenuItem = new Terminal.Gui.MenuItem();
+ this.accountSettingsMenuItem.Title = "Account Settings...";
+ this.accountSettingsMenuItem.Data = "accountSettingsMenuItem";
+ this.recentFilesMenu = new Terminal.Gui.MenuBarItem();
+ this.recentFilesMenu.Title = "Recent Files";
+ this.file1csMenuItem = new Terminal.Gui.MenuItem();
+ this.file1csMenuItem.Title = "File 1.cs";
+ this.file1csMenuItem.Data = "file1csMenuItem";
+ this.file2csMenuItem = new Terminal.Gui.MenuItem();
+ this.file2csMenuItem.Title = "File 2.cs";
+ this.file2csMenuItem.Data = "file2csMenuItem";
+ this.recentFilesMenu.Children = new Terminal.Gui.MenuItem[] {
+ this.file1csMenuItem,
+ this.file2csMenuItem};
+ this.recentProjectsAndSolutionsMenu = new Terminal.Gui.MenuBarItem();
+ this.recentProjectsAndSolutionsMenu.Title = "Recent Projects and Solutions";
+ this.terminalGuislnMenuItem = new Terminal.Gui.MenuItem();
+ this.terminalGuislnMenuItem.Title = "Terminal.Gui.sln";
+ this.terminalGuislnMenuItem.Data = "terminalGuislnMenuItem";
+ this.terminalGuiDesignerslnMenuItem = new Terminal.Gui.MenuItem();
+ this.terminalGuiDesignerslnMenuItem.Title = "TerminalGuiDesigner.sln";
+ this.terminalGuiDesignerslnMenuItem.Data = "terminalGuiDesignerslnMenuItem";
+ this.recentProjectsAndSolutionsMenu.Children = new Terminal.Gui.MenuItem[] {
+ this.terminalGuislnMenuItem,
+ this.terminalGuiDesignerslnMenuItem};
+ this.moveMenucsIntoMenu = new Terminal.Gui.MenuBarItem();
+ this.moveMenucsIntoMenu.Title = "Move Menu.cs into";
+ this.solutionItemsMenuItem = new Terminal.Gui.MenuItem();
+ this.solutionItemsMenuItem.Title = "1 Solution Items";
+ this.solutionItemsMenuItem.Data = "solutionItemsMenuItem";
+ this.unitTestsMenuItem = new Terminal.Gui.MenuItem();
+ this.unitTestsMenuItem.Title = "2 UnitTests";
+ this.unitTestsMenuItem.Data = "unitTestsMenuItem";
+ this.showcaseMenuItem = new Terminal.Gui.MenuItem();
+ this.showcaseMenuItem.Title = "3 Showcase";
+ this.showcaseMenuItem.Data = "showcaseMenuItem";
+ this.moveMenucsIntoMenu.Children = new Terminal.Gui.MenuItem[] {
+ this.solutionItemsMenuItem,
+ this.unitTestsMenuItem,
+ this.showcaseMenuItem};
+ this.exitMenuItem = new Terminal.Gui.MenuItem();
+ this.exitMenuItem.Title = "Exit";
+ this.exitMenuItem.Data = "exitMenuItem";
+ this.fileF9Menu.Children = new Terminal.Gui.MenuItem[] {
+ this.newMenu,
+ this.openMenu,
+ this.cloneRepositoryMenuItem,
+ this.startWindowMenuItem,
+ null,
+ this.closeMenuItem,
+ this.closeSolutionMenuItem,
+ null,
+ this.startLiveShareSessionMenuItem,
+ this.joinLiveShareSessionMenuItem,
+ null,
+ this.saveMenucsMenuItem,
+ this.saveMenucsAsMenuItem,
+ this.saveAllMenuItem,
+ null,
+ this.pageSetupMenuItem,
+ this.printMenuItem,
+ null,
+ this.accountSettingsMenuItem,
+ null,
+ this.recentFilesMenu,
+ this.recentProjectsAndSolutionsMenu,
+ null,
+ this.moveMenucsIntoMenu,
+ null,
+ this.exitMenuItem};
+ this.editMenu = new Terminal.Gui.MenuBarItem();
+ this.editMenu.Title = "Edit";
+ this.goToMenu = new Terminal.Gui.MenuBarItem();
+ this.goToMenu.Title = "Go To";
+ this.goToLineMenuItem = new Terminal.Gui.MenuItem();
+ this.goToLineMenuItem.Title = "Go To Line...";
+ this.goToLineMenuItem.Data = "goToLineMenuItem";
+ this.goToLineMenuItem.ShortcutKey = ((Terminal.Gui.KeyCode)(1073741895u));
+ this.goToMenu.Children = new Terminal.Gui.MenuItem[] {
+ this.goToLineMenuItem};
+ this.editMenu.Children = new Terminal.Gui.MenuItem[] {
+ this.goToMenu};
+ this.menuBar.Menus = new Terminal.Gui.MenuBarItem[] {
+ this.fileF9Menu,
+ this.editMenu};
+ this.Add(this.menuBar);
+ }
+ }
+}
diff --git a/Showcase/Menu.cs b/Showcase/Menu.cs
new file mode 100644
index 00000000..cbac1d06
--- /dev/null
+++ b/Showcase/Menu.cs
@@ -0,0 +1,20 @@
+
+//------------------------------------------------------------------------------
+
+//
+// This code was generated by:
+// TerminalGuiDesigner v2.0.0.0
+// You can make changes to this file and they will not be overwritten when saving.
+//
+// -----------------------------------------------------------------------------
+namespace Showcase {
+ using Terminal.Gui;
+
+
+ public partial class Menu {
+
+ public Menu() {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Showcase/NumericUpDown.Designer.cs b/Showcase/NumericUpDown.Designer.cs
index 5afbe074..bec4f4b7 100644
--- a/Showcase/NumericUpDown.Designer.cs
+++ b/Showcase/NumericUpDown.Designer.cs
@@ -65,15 +65,19 @@ private void InitializeComponent() {
this.Y = 0;
this.Visible = true;
this.Arrangement = (Terminal.Gui.ViewArrangement.Movable | Terminal.Gui.ViewArrangement.Overlapped);
+ this.CanFocus = true;
+ this.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.Modal = false;
this.TextAlignment = Terminal.Gui.Alignment.Start;
- this.Title = "";
+ this.Title = "Numeric Up Down Controls";
this.lblInt.Width = Dim.Auto();
this.lblInt.Height = 1;
this.lblInt.X = 0;
this.lblInt.Y = 0;
this.lblInt.Visible = true;
this.lblInt.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.lblInt.CanFocus = true;
+ this.lblInt.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.lblInt.Data = "lblInt";
this.lblInt.Text = "Int:";
this.lblInt.TextAlignment = Terminal.Gui.Alignment.Start;
@@ -84,6 +88,8 @@ private void InitializeComponent() {
this.numericUpDownInt.Y = 0;
this.numericUpDownInt.Visible = true;
this.numericUpDownInt.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.numericUpDownInt.CanFocus = true;
+ this.numericUpDownInt.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.numericUpDownInt.Data = "numericUpDownInt";
this.numericUpDownInt.TextAlignment = Terminal.Gui.Alignment.Start;
this.numericUpDownInt.Value = 1;
@@ -95,6 +101,8 @@ private void InitializeComponent() {
this.lblInt64.Y = 1;
this.lblInt64.Visible = true;
this.lblInt64.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.lblInt64.CanFocus = true;
+ this.lblInt64.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.lblInt64.Data = "lblInt64";
this.lblInt64.Text = "Int64:";
this.lblInt64.TextAlignment = Terminal.Gui.Alignment.Start;
@@ -105,6 +113,8 @@ private void InitializeComponent() {
this.numericUpDownInt64.Y = 1;
this.numericUpDownInt64.Visible = true;
this.numericUpDownInt64.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.numericUpDownInt64.CanFocus = true;
+ this.numericUpDownInt64.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.numericUpDownInt64.Data = "numericUpDownInt64";
this.numericUpDownInt64.TextAlignment = Terminal.Gui.Alignment.Start;
this.numericUpDownInt64.Value = 8943589458974;
@@ -116,6 +126,8 @@ private void InitializeComponent() {
this.label3.Y = 2;
this.label3.Visible = true;
this.label3.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.label3.CanFocus = true;
+ this.label3.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.label3.Data = "label3";
this.label3.Text = "Double:";
this.label3.TextAlignment = Terminal.Gui.Alignment.Start;
@@ -126,6 +138,8 @@ private void InitializeComponent() {
this.numericUpDown2.Y = 2;
this.numericUpDown2.Visible = true;
this.numericUpDown2.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.numericUpDown2.CanFocus = true;
+ this.numericUpDown2.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.numericUpDown2.Data = "numericUpDown2";
this.numericUpDown2.TextAlignment = Terminal.Gui.Alignment.Start;
this.numericUpDown2.Value = 32.3D;
@@ -137,6 +151,8 @@ private void InitializeComponent() {
this.label6.Y = 3;
this.label6.Visible = true;
this.label6.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.label6.CanFocus = true;
+ this.label6.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.label6.Data = "label6";
this.label6.Text = "Single:";
this.label6.TextAlignment = Terminal.Gui.Alignment.Start;
@@ -147,6 +163,8 @@ private void InitializeComponent() {
this.numericUpDownSingle.Y = 3;
this.numericUpDownSingle.Visible = true;
this.numericUpDownSingle.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.numericUpDownSingle.CanFocus = true;
+ this.numericUpDownSingle.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.numericUpDownSingle.Data = "numericUpDownSingle";
this.numericUpDownSingle.TextAlignment = Terminal.Gui.Alignment.Start;
this.numericUpDownSingle.Value = 1F;
@@ -158,6 +176,8 @@ private void InitializeComponent() {
this.label.Y = 4;
this.label.Visible = true;
this.label.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.label.CanFocus = true;
+ this.label.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.label.Data = "label";
this.label.Text = "Decimal:";
this.label.TextAlignment = Terminal.Gui.Alignment.Start;
@@ -168,6 +188,8 @@ private void InitializeComponent() {
this.numericUpDownDecimal.Y = 4;
this.numericUpDownDecimal.Visible = true;
this.numericUpDownDecimal.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.numericUpDownDecimal.CanFocus = true;
+ this.numericUpDownDecimal.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.numericUpDownDecimal.Data = "numericUpDownDecimal";
this.numericUpDownDecimal.TextAlignment = Terminal.Gui.Alignment.Start;
this.numericUpDownDecimal.Value = 0.00000000001m;
@@ -179,6 +201,8 @@ private void InitializeComponent() {
this.label4.Y = 7;
this.label4.Visible = true;
this.label4.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.label4.CanFocus = true;
+ this.label4.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.label4.Data = "label4";
this.label4.Text = "Single:";
this.label4.TextAlignment = Terminal.Gui.Alignment.Start;
@@ -189,6 +213,8 @@ private void InitializeComponent() {
this.numericUpDown3.Y = 7;
this.numericUpDown3.Visible = true;
this.numericUpDown3.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.numericUpDown3.CanFocus = true;
+ this.numericUpDown3.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.numericUpDown3.Data = "numericUpDown3";
this.numericUpDown3.TextAlignment = Terminal.Gui.Alignment.Start;
this.numericUpDown3.Value = float.PositiveInfinity;
@@ -200,6 +226,8 @@ private void InitializeComponent() {
this.label5.Y = 7;
this.label5.Visible = true;
this.label5.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.label5.CanFocus = true;
+ this.label5.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.label5.Data = "label5";
this.label5.Text = "(Supports infinitiy!?)";
this.label5.TextAlignment = Terminal.Gui.Alignment.Start;
diff --git a/Showcase/Showcase.csproj b/Showcase/Showcase.csproj
index 41aa7203..273199f7 100644
--- a/Showcase/Showcase.csproj
+++ b/Showcase/Showcase.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/Showcase/Slider.Designer.cs b/Showcase/Slider.Designer.cs
index 7ad8e1f7..db1bd361 100644
--- a/Showcase/Slider.Designer.cs
+++ b/Showcase/Slider.Designer.cs
@@ -31,7 +31,13 @@ public partial class Slider : Terminal.Gui.Window {
private Terminal.Gui.Slider slider3;
+ private Terminal.Gui.Line line;
+
+ private Terminal.Gui.Slider slider4;
+
private void InitializeComponent() {
+ this.slider4 = new Terminal.Gui.Slider();
+ this.line = new Terminal.Gui.Line();
this.slider3 = new Terminal.Gui.Slider();
this.lblStringSliderThin = new Terminal.Gui.Label();
this.slider2 = new Terminal.Gui.Slider();
@@ -44,15 +50,19 @@ private void InitializeComponent() {
this.Y = 0;
this.Visible = true;
this.Arrangement = (Terminal.Gui.ViewArrangement.Movable | Terminal.Gui.ViewArrangement.Overlapped);
+ this.CanFocus = true;
+ this.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.Modal = false;
this.TextAlignment = Terminal.Gui.Alignment.Start;
- this.Title = "";
+ this.Title = "Sliders";
this.label.Width = Dim.Auto();
this.label.Height = 1;
this.label.X = 0;
this.label.Y = 0;
this.label.Visible = true;
this.label.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.label.CanFocus = true;
+ this.label.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.label.Data = "label";
this.label.Text = "Int Slider (0 to 1):";
this.label.TextAlignment = Terminal.Gui.Alignment.Start;
@@ -63,12 +73,14 @@ private void InitializeComponent() {
this.slider1.Y = 0;
this.slider1.Visible = true;
this.slider1.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.slider1.CanFocus = true;
+ this.slider1.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.slider1.Options = new System.Collections.Generic.List>(new Terminal.Gui.SliderOption[] {
new Terminal.Gui.SliderOption("0", new System.Text.Rune('0'), 0),
new Terminal.Gui.SliderOption("1", new System.Text.Rune('1'), 1)});
this.slider1.Orientation = Terminal.Gui.Orientation.Horizontal;
this.slider1.RangeAllowSingle = false;
- this.slider1.AllowEmpty = false;
+ this.slider1.AllowEmpty = true;
this.slider1.MinimumInnerSpacing = 1;
this.slider1.LegendsOrientation = Terminal.Gui.Orientation.Horizontal;
this.slider1.ShowLegends = true;
@@ -83,6 +95,8 @@ private void InitializeComponent() {
this.lblStringSlider.Y = 2;
this.lblStringSlider.Visible = true;
this.lblStringSlider.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.lblStringSlider.CanFocus = true;
+ this.lblStringSlider.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.lblStringSlider.Data = "lblStringSlider";
this.lblStringSlider.Text = "String Slider (Wide):";
this.lblStringSlider.TextAlignment = Terminal.Gui.Alignment.Start;
@@ -93,6 +107,8 @@ private void InitializeComponent() {
this.slider2.Y = 2;
this.slider2.Visible = true;
this.slider2.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.slider2.CanFocus = true;
+ this.slider2.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.slider2.Options = new System.Collections.Generic.List>(new Terminal.Gui.SliderOption[] {
new Terminal.Gui.SliderOption("Fish", new System.Text.Rune('F'), "Fish"),
new Terminal.Gui.SliderOption("Cat", new System.Text.Rune('C'), "Cat"),
@@ -114,6 +130,8 @@ private void InitializeComponent() {
this.lblStringSliderThin.Y = 4;
this.lblStringSliderThin.Visible = true;
this.lblStringSliderThin.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.lblStringSliderThin.CanFocus = true;
+ this.lblStringSliderThin.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.lblStringSliderThin.Data = "lblStringSliderThin";
this.lblStringSliderThin.Text = "String Slider (Thin):";
this.lblStringSliderThin.TextAlignment = Terminal.Gui.Alignment.Start;
@@ -124,6 +142,8 @@ private void InitializeComponent() {
this.slider3.Y = 4;
this.slider3.Visible = true;
this.slider3.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.slider3.CanFocus = true;
+ this.slider3.ShadowStyle = Terminal.Gui.ShadowStyle.None;
this.slider3.Options = new System.Collections.Generic.List>(new Terminal.Gui.SliderOption[] {
new Terminal.Gui.SliderOption("Fish", new System.Text.Rune('F'), "Fish"),
new Terminal.Gui.SliderOption("Cat", new System.Text.Rune('C'), "Cat"),
@@ -139,6 +159,39 @@ private void InitializeComponent() {
this.slider3.Data = "slider3";
this.slider3.TextAlignment = Terminal.Gui.Alignment.Start;
this.Add(this.slider3);
+ this.line.Width = Dim.Fill(-1);
+ this.line.Height = 1;
+ this.line.X = -1;
+ this.line.Y = 6;
+ this.line.Visible = true;
+ this.line.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.line.CanFocus = true;
+ this.line.ShadowStyle = Terminal.Gui.ShadowStyle.None;
+ this.line.Data = "line";
+ this.line.Text = "";
+ this.line.TextAlignment = Terminal.Gui.Alignment.Start;
+ this.Add(this.line);
+ this.slider4.Width = 5;
+ this.slider4.Height = Dim.Auto();
+ this.slider4.X = 16;
+ this.slider4.Y = 9;
+ this.slider4.Visible = true;
+ this.slider4.Arrangement = Terminal.Gui.ViewArrangement.Fixed;
+ this.slider4.CanFocus = true;
+ this.slider4.ShadowStyle = Terminal.Gui.ShadowStyle.Transparent;
+ this.slider4.Options = new System.Collections.Generic.List>(new Terminal.Gui.SliderOption[] {
+ new Terminal.Gui.SliderOption("Zero", new System.Text.Rune('0'), 0D)});
+ this.slider4.Orientation = Terminal.Gui.Orientation.Horizontal;
+ this.slider4.RangeAllowSingle = false;
+ this.slider4.AllowEmpty = false;
+ this.slider4.MinimumInnerSpacing = 1;
+ this.slider4.LegendsOrientation = Terminal.Gui.Orientation.Horizontal;
+ this.slider4.ShowLegends = true;
+ this.slider4.ShowEndSpacing = false;
+ this.slider4.Type = Terminal.Gui.SliderType.Single;
+ this.slider4.Data = "slider4";
+ this.slider4.TextAlignment = Terminal.Gui.Alignment.Start;
+ this.Add(this.slider4);
}
}
}
diff --git a/src/ArrayExtensions.cs b/src/ArrayExtensions.cs
index 9b8cea42..799afc4d 100644
--- a/src/ArrayExtensions.cs
+++ b/src/ArrayExtensions.cs
@@ -31,6 +31,12 @@ public static class ArrayExtensions
return toReturn;
}
+ ///
+ /// Converts an enumerable to a
+ ///
+ ///
+ ///
+ ///
public static IListDataSource ToListDataSource(this IEnumerable enumerable)
{
// Get the type of the elements
@@ -46,7 +52,8 @@ public static IListDataSource ToListDataSource(this IEnumerable enumerable)
// Create an instance of ListWrapper
var listWrapperType = typeof(ListWrapper<>).MakeGenericType(elementType);
- return (IListDataSource)Activator.CreateInstance(listWrapperType, list);
+ return (IListDataSource)(Activator.CreateInstance(listWrapperType, list)
+ ?? throw new Exception("CreateInstance inexplicably returned null"));
}
}
diff --git a/src/ContextMenuExtensions.cs b/src/ContextMenuExtensions.cs
new file mode 100644
index 00000000..c920da5e
--- /dev/null
+++ b/src/ContextMenuExtensions.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Terminal.Gui;
+
+namespace TerminalGuiDesigner;
+
+internal static class ContextMenuExtensions
+{
+ public static void SetMenuItems(this ContextMenu menu, MenuBarItem? value)
+ {
+ var prop = typeof(ContextMenu).GetProperty(nameof(ContextMenu.MenuItems))
+ ?? throw new Exception($"Expected property {nameof(ContextMenu.MenuItems)} did not exist on {nameof(ContextMenu)}");
+ prop.SetValue(menu,value);
+ }
+}
+
diff --git a/src/Design.cs b/src/Design.cs
index a789ef8b..fe30f68f 100644
--- a/src/Design.cs
+++ b/src/Design.cs
@@ -44,8 +44,6 @@ public class Design
typeof(LineView),
typeof(ListView),
typeof(MenuBar),
- typeof(ScrollBarView),
- typeof(ScrollView),
typeof(TableView),
typeof(TabView),
typeof(TreeView),
@@ -168,10 +166,6 @@ public void CreateSubControlDesigns()
/// A new wrapper wrapping .
public Design CreateSubControlDesign(string name, View subView)
{
- // all views can be focused so that they can be edited
- // or deleted etc
- subView.CanFocus = true;
-
if (subView is TableView tv && tv.Table != null && tv.GetDataTable().Rows.Count == 0)
{
var dt = tv.GetDataTable();
@@ -215,14 +209,12 @@ public Design CreateSubControlDesign(string name, View subView)
{
// prevent control from responding to events
txt.MouseClick += (s, e) => this.SuppressNativeClickEvents(s, e);
- txt.KeyDown += this.SuppressNativeKeyboardEvents;
}
if (subView is TextField tf)
{
// prevent control from responding to events
tf.MouseClick += (s,e)=>this.SuppressNativeClickEvents(s,e);
- tf.KeyDown += SuppressNativeKeyboardEvents;
}
if (subView.GetType().IsGenericType(typeof(Slider<>)))
@@ -466,7 +458,7 @@ public IEnumerable GetSiblings()
yield break;
}
- foreach (var v in this.View.SuperView.Subviews)
+ foreach (var v in this.View.SuperView.SubViews)
{
if (v == this.View)
{
@@ -626,7 +618,7 @@ private void CreateSubControlDesigns(View view)
}
}
- private void SuppressNativeClickEvents(object? sender, MouseEventEventArgs obj, bool alsoSuppressClick = false)
+ private void SuppressNativeClickEvents(object? sender, MouseEventArgs obj, bool alsoSuppressClick = false)
{
if (alsoSuppressClick)
{
@@ -635,25 +627,10 @@ private void SuppressNativeClickEvents(object? sender, MouseEventEventArgs obj,
else
{
// Suppress everything except single click (selection)
- obj.Handled = obj.MouseEvent.Flags != MouseFlags.Button1Clicked;
+ obj.Handled = obj.Flags != MouseFlags.Button1Clicked;
}
}
- private void SuppressNativeKeyboardEvents(object? sender, Key e)
- {
- if (sender == null)
- {
- return;
- }
-
- if (e == Key.Tab || e == Key.Tab.WithShift || e == Key.Esc || e == Application.QuitKey)
- {
- e.Handled = false;
- return;
- }
-
- e.Handled = true;
- }
private void RegisterCheckboxDesignTimeChanges(CheckBox cb)
{
@@ -662,7 +639,7 @@ private void RegisterCheckboxDesignTimeChanges(CheckBox cb)
cb.KeyBindings.Remove(Key.Space);
cb.MouseClick += (s, e) =>
{
- if (e.MouseEvent.Flags.HasFlag(MouseFlags.Button1Clicked))
+ if (e.Flags.HasFlag(MouseFlags.Button1Clicked))
{
e.Handled = true;
cb.SetFocus();
@@ -684,9 +661,13 @@ private IEnumerable LoadDesignableProperties()
yield return this.CreateSuppressedProperty(nameof(this.View.Visible), true);
yield return this.CreateSuppressedProperty(nameof(this.View.Arrangement), ViewArrangement.Fixed);
+
yield return new ColorSchemeProperty(this);
+ yield return this.CreateSuppressedProperty(nameof(View.CanFocus), true);
+ yield return this.CreateProperty(nameof(this.View.ShadowStyle));
+
// its important that this comes before Text because
// changing the validator clears the text
if (this.View is TextValidateField)
diff --git a/src/DesignState.cs b/src/DesignState.cs
index 22c2c411..930c2cd3 100644
--- a/src/DesignState.cs
+++ b/src/DesignState.cs
@@ -22,8 +22,8 @@ public DesignState(Design design)
{
this.Design = design;
this.OriginalScheme = this.Design.View.GetExplicitColorScheme();
- this.Design.View.DrawContentComplete += this.DrawContentComplete;
- this.Design.View.Enter += this.Enter;
+ this.Design.View.DrawComplete += this.DrawContentComplete;
+ this.Design.View.HasFocusChanged += this.Enter;
}
///
@@ -39,8 +39,13 @@ public DesignState(Design design)
///
public Design Design { get; }
- private void Enter(object? sender, FocusEventArgs obj)
+ private void Enter(object? sender, HasFocusEventArgs obj)
{
+ // it's not enter
+ if (!obj.NewValue)
+ {
+ return;
+ }
// when tabbing or clicking into this View when nothing complicated is going on (e.g. Ctrl+Click multi select)
if (SelectionManager.Instance.Selected.Count <= 1)
{
diff --git a/src/DimExtensions.cs b/src/DimExtensions.cs
index 107b8907..c0a06e32 100644
--- a/src/DimExtensions.cs
+++ b/src/DimExtensions.cs
@@ -17,7 +17,7 @@ public static class DimExtensions
private const bool TreatNullDimAs0 = true;
///
- /// Returns true if the is a DimFactor (i.e. created by ).
+ /// Returns true if the is a DimFactor (i.e. created by ).
///
/// Dimension to determine Type.
/// true if is DimFactor.
@@ -34,7 +34,7 @@ public static bool IsPercent(this Dim d)
///
/// The to determine whether it represents a percent.
/// The 'percentage' value of . This is the value that would/could be
- /// passed to to produce the or 0 if is
+ /// passed to to produce the or 0 if is
/// not DimFactor.
public static bool IsPercent(this Dim d, out int percent)
{
@@ -50,10 +50,10 @@ public static bool IsPercent(this Dim d, out int percent)
}
///
- /// Determines whether an input is a .
+ /// Determines whether an input is a .
///
/// Input to classify.
- /// if is the result of a call.
+ /// if is the result of a call.
public static bool IsFill(this Dim d)
{
if (d == null)
@@ -66,13 +66,13 @@ public static bool IsFill(this Dim d)
///
/// Input to classify.
- /// The margin of the used to create or 0.
+ /// The margin of the used to create or 0.
public static bool IsFill(this Dim d, out int margin)
{
if (d != null && d.IsFill())
{
var df = (DimFill)d;
- margin = df.Margin;
+ margin = ((DimAbsolute)df.Margin).Size;
return true;
}
@@ -100,6 +100,9 @@ public static bool IsAbsolute(this Dim d)
/// True if is a width/height.
///
/// The to determine whether it is auto.
+ /// If is then this is .
+ /// If is then this is
+ /// If is then this is
/// if is a auto sizing.
public static bool IsAuto(this Dim d, out DimAutoStyle das, out Dim? min, out Dim? max)
{
@@ -193,8 +196,8 @@ public static bool IsCombine(this Dim d, out Dim left, out Dim right, out bool a
///
/// The to determine type of.
/// The determined type.
- /// The numerical element of the type e.g. for
- /// the is the percentage but for the
+ /// The numerical element of the type e.g. for
+ /// the is the percentage but for the
/// is the margin.
/// The numerical offset if any, for example -5 in the following:
/// Dim.Fill(1)-5
diff --git a/src/DimType.cs b/src/DimType.cs
index 2e2670a3..dbe9e759 100644
--- a/src/DimType.cs
+++ b/src/DimType.cs
@@ -13,12 +13,12 @@ public enum DimType
Absolute,
///
- /// Percent of the remaining width/height e.g. .
+ /// Percent of the remaining width/height e.g. .
///
Percent,
///
- /// Filling the remaining space with a margin e.g. .
+ /// Filling the remaining space with a margin e.g. .
///
Fill,
diff --git a/src/Operations/AddViewOperation.cs b/src/Operations/AddViewOperation.cs
index ed890487..0dec5cd1 100644
--- a/src/Operations/AddViewOperation.cs
+++ b/src/Operations/AddViewOperation.cs
@@ -46,7 +46,7 @@ public AddViewOperation(Design design)
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
if (this.add == null)
{
@@ -55,11 +55,11 @@ public override void Redo()
var v = this.GetViewToAddTo();
v.Add(this.add);
- v.SetNeedsDisplay();
+ v.SetNeedsDraw();
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
if (this.add == null)
{
@@ -68,7 +68,7 @@ public override void Undo()
var v = this.GetViewToAddTo();
v.Remove(this.add);
- v.SetNeedsDisplay();
+ v.SetNeedsDraw();
}
///
@@ -118,7 +118,7 @@ protected override bool DoImpl()
SelectionManager.Instance.ForceSetSelection(design);
- v.SetNeedsDisplay();
+ v.SetNeedsDraw();
return true;
}
diff --git a/src/Operations/CompositeOperation.cs b/src/Operations/CompositeOperation.cs
index da09d9d8..0c1dcb08 100644
--- a/src/Operations/CompositeOperation.cs
+++ b/src/Operations/CompositeOperation.cs
@@ -33,12 +33,12 @@ public CompositeOperation(params Operation[] operations)
}
///
- /// Gets the collection of sub operations performed on / .
+ /// Gets the collection of sub operations performed on / .
///
public IReadOnlyCollection Operations => new ReadOnlyCollection(this.operations);
///
- public override void Redo()
+ protected override void RedoImpl()
{
foreach (var op in this.operations)
{
@@ -47,7 +47,7 @@ public override void Redo()
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
foreach (var op in this.operations)
{
diff --git a/src/Operations/CopyOperation.cs b/src/Operations/CopyOperation.cs
index 80a509ba..e7febe4a 100644
--- a/src/Operations/CopyOperation.cs
+++ b/src/Operations/CopyOperation.cs
@@ -57,7 +57,7 @@ public override string ToString()
/// Throws as you cannot undo a copy.
///
/// Thrown if method run.
- public override void Undo()
+ protected override void UndoImpl()
{
throw new NotSupportedException();
}
@@ -66,7 +66,7 @@ public override void Undo()
/// Throws as you cannot redo a copy.
///
/// Thrown if method run.
- public override void Redo()
+ protected override void RedoImpl()
{
throw new NotSupportedException();
}
diff --git a/src/Operations/DeleteColorSchemeOperation.cs b/src/Operations/DeleteColorSchemeOperation.cs
index 15a82dcb..03f963b3 100644
--- a/src/Operations/DeleteColorSchemeOperation.cs
+++ b/src/Operations/DeleteColorSchemeOperation.cs
@@ -36,13 +36,13 @@ public DeleteColorSchemeOperation(Design design, NamedColorScheme toDelete)
public NamedColorScheme ToDelete { get; }
///
- public override void Redo()
+ protected override void RedoImpl()
{
this.Do();
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
foreach (var u in this.users)
{
diff --git a/src/Operations/DeleteViewOperation.cs b/src/Operations/DeleteViewOperation.cs
index 5a527696..ddacff47 100644
--- a/src/Operations/DeleteViewOperation.cs
+++ b/src/Operations/DeleteViewOperation.cs
@@ -42,13 +42,13 @@ public DeleteViewOperation(params Design[] delete)
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
this.Do();
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
for (int i = 0; i < this.delete.Length; i++)
{
diff --git a/src/Operations/DragOperation.cs b/src/Operations/DragOperation.cs
index b4eb800e..0f208c36 100644
--- a/src/Operations/DragOperation.cs
+++ b/src/Operations/DragOperation.cs
@@ -140,7 +140,7 @@ public View? DropInto
///
/// Moves all dragged views back to original positions.
///
- public override void Undo()
+ protected override void UndoImpl()
{
foreach (var mem in this.mementos)
{
@@ -149,7 +149,7 @@ public override void Undo()
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
this.Do();
}
diff --git a/src/Operations/Generics/AddOperation.cs b/src/Operations/Generics/AddOperation.cs
index e49edbf2..7e8e9fc0 100644
--- a/src/Operations/Generics/AddOperation.cs
+++ b/src/Operations/Generics/AddOperation.cs
@@ -41,13 +41,13 @@ public AddOperation(
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
this.Remove(this.newItem);
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
this.Add(this.newItem);
}
@@ -83,7 +83,7 @@ protected override bool DoImpl()
this.newItem = this.elementFactory(this.View, uniqueName);
this.Add(this.newItem);
- this.SetNeedsDisplay();
+ this.SetNeedsDraw();
return true;
}
}
\ No newline at end of file
diff --git a/src/Operations/Generics/GenericArrayOperation.cs b/src/Operations/Generics/GenericArrayOperation.cs
index 1b54c7d4..5f1cba9d 100644
--- a/src/Operations/Generics/GenericArrayOperation.cs
+++ b/src/Operations/Generics/GenericArrayOperation.cs
@@ -63,16 +63,16 @@ protected virtual void Add(T2? newItem)
current.Add(newItem);
this.ArraySetter(this.View, current.Cast().ToArray());
- this.SetNeedsDisplay();
+ this.SetNeedsDraw();
}
///
/// Calls any update/refresh status code that is needed after making changes to collection.
- /// Default implementation just calls on .
+ /// Default implementation just calls on .
///
- protected virtual void SetNeedsDisplay()
+ protected virtual void SetNeedsDraw()
{
- this.View.SetNeedsDisplay();
+ this.View.SetNeedsDraw();
}
///
@@ -92,7 +92,7 @@ protected bool Remove(T2? toRemove)
current.Remove(toRemove);
this.ArraySetter(this.View, current.Cast().ToArray());
- this.SetNeedsDisplay();
+ this.SetNeedsDraw();
return true;
}
diff --git a/src/Operations/Generics/MoveOperation.cs b/src/Operations/Generics/MoveOperation.cs
index 38db9bad..c70f700b 100644
--- a/src/Operations/Generics/MoveOperation.cs
+++ b/src/Operations/Generics/MoveOperation.cs
@@ -80,13 +80,13 @@ public override string ToString()
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
this.Do();
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
var list = this.ArrayGetter(this.View).ToList();
@@ -94,7 +94,7 @@ public override void Undo()
list.Insert(this.originalIdx, this.OperateOn);
this.ArraySetter(this.View, list.Cast().ToArray());
- this.SetNeedsDisplay();
+ this.SetNeedsDraw();
}
///
@@ -106,7 +106,7 @@ protected override bool DoImpl()
list.Insert(this.newIndex, this.OperateOn);
this.ArraySetter(this.View, list.Cast().ToArray());
- this.SetNeedsDisplay();
+ this.SetNeedsDraw();
return true;
}
}
diff --git a/src/Operations/Generics/RemoveOperation.cs b/src/Operations/Generics/RemoveOperation.cs
index da98e0c3..58edf422 100644
--- a/src/Operations/Generics/RemoveOperation.cs
+++ b/src/Operations/Generics/RemoveOperation.cs
@@ -33,7 +33,7 @@ public RemoveOperation(
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
// its not there anyways
if (this.OperateOn == null)
@@ -44,11 +44,11 @@ public override void Undo()
var current = this.ArrayGetter(this.View).Cast().ToList();
current.Insert(this.idx, this.OperateOn);
this.ArraySetter(this.View, current.ToArray());
- this.SetNeedsDisplay();
+ this.SetNeedsDraw();
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
this.Do();
}
diff --git a/src/Operations/Generics/RenameOperation.cs b/src/Operations/Generics/RenameOperation.cs
index b2e086c0..6d1bb988 100644
--- a/src/Operations/Generics/RenameOperation.cs
+++ b/src/Operations/Generics/RenameOperation.cs
@@ -49,7 +49,7 @@ public override string ToString()
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
if (this.newName == null)
{
@@ -57,14 +57,14 @@ public override void Redo()
}
this.stringSetter(this.OperateOn, this.newName);
- this.SetNeedsDisplay();
+ this.SetNeedsDraw();
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
this.stringSetter(this.OperateOn, this.originalName);
- this.SetNeedsDisplay();
+ this.SetNeedsDraw();
}
///
@@ -84,7 +84,7 @@ protected override bool DoImpl()
}
this.stringSetter(this.OperateOn, this.newName);
- this.SetNeedsDisplay();
+ this.SetNeedsDraw();
return true;
}
diff --git a/src/Operations/IOperation.cs b/src/Operations/IOperation.cs
index 1f9822da..18aad942 100644
--- a/src/Operations/IOperation.cs
+++ b/src/Operations/IOperation.cs
@@ -33,7 +33,7 @@ public interface IOperation
///
/// Gets the number of times this has been executed successfully
///
- ref int TimesDone { get; }
+ int TimesDone { get; }
///
/// Performs the operation.
diff --git a/src/Operations/MenuOperations/AddMenuItemOperation.cs b/src/Operations/MenuOperations/AddMenuItemOperation.cs
index 35c5056b..381a4024 100644
--- a/src/Operations/MenuOperations/AddMenuItemOperation.cs
+++ b/src/Operations/MenuOperations/AddMenuItemOperation.cs
@@ -28,7 +28,7 @@ public AddMenuItemOperation(MenuItem adjacentTo)
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
if (this.added != null)
{
@@ -37,7 +37,7 @@ public override void Redo()
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
if (this.added == null)
{
@@ -79,7 +79,7 @@ private bool Add(MenuItem menuItem)
children.Insert(insertAt, menuItem);
this.Parent.Children = children.ToArray();
- this.Bar?.SetNeedsDisplay();
+ this.Bar?.SetNeedsDraw();
return true;
}
diff --git a/src/Operations/MenuOperations/ConvertMenuItemToSeperatorOperation.cs b/src/Operations/MenuOperations/ConvertMenuItemToSeperatorOperation.cs
index b1a6e468..828bb869 100644
--- a/src/Operations/MenuOperations/ConvertMenuItemToSeperatorOperation.cs
+++ b/src/Operations/MenuOperations/ConvertMenuItemToSeperatorOperation.cs
@@ -22,13 +22,13 @@ public ConvertMenuItemToSeperatorOperation(MenuItem toConvert)
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
this.Do();
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
if (this.Parent == null || this.OperateOn == null)
{
@@ -39,7 +39,7 @@ public override void Undo()
children[this.removedAtIdx] = this.OperateOn;
this.Parent.Children = children.ToArray();
- this.Bar?.SetNeedsDisplay();
+ this.Bar?.SetNeedsDraw();
}
///
@@ -56,7 +56,7 @@ protected override bool DoImpl()
children[this.removedAtIdx] = null;
this.Parent.Children = children.ToArray();
- this.Bar?.SetNeedsDisplay();
+ this.Bar?.SetNeedsDraw();
return true;
}
diff --git a/src/Operations/MenuOperations/MoveMenuItemLeftOperation.cs b/src/Operations/MenuOperations/MoveMenuItemLeftOperation.cs
index 3bcfe173..8e701f71 100644
--- a/src/Operations/MenuOperations/MoveMenuItemLeftOperation.cs
+++ b/src/Operations/MenuOperations/MoveMenuItemLeftOperation.cs
@@ -38,13 +38,13 @@ public MoveMenuItemLeftOperation(MenuItem toMove)
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
this.Do();
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
if (this.OperateOn == null || this.IsImpossible)
{
@@ -94,7 +94,7 @@ protected override bool DoImpl()
MenuTracker.Instance.ConvertEmptyMenus();
- this.Bar?.SetNeedsDisplay();
+ this.Bar?.SetNeedsDraw();
return true;
}
diff --git a/src/Operations/MenuOperations/MoveMenuItemOperation.cs b/src/Operations/MenuOperations/MoveMenuItemOperation.cs
index 75c7f1b8..062a5716 100644
--- a/src/Operations/MenuOperations/MoveMenuItemOperation.cs
+++ b/src/Operations/MenuOperations/MoveMenuItemOperation.cs
@@ -45,13 +45,13 @@ public MoveMenuItemOperation(MenuItem toMove, bool up)
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
this.Do();
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
this.Move(this.up ? 1 : -1);
}
@@ -80,7 +80,7 @@ private bool Move(int amount)
this.siblings.Insert(moveTo, this.OperateOn);
this.Parent.Children = this.siblings.ToArray();
- this.Bar?.SetNeedsDisplay();
+ this.Bar?.SetNeedsDraw();
return true;
}
diff --git a/src/Operations/MenuOperations/MoveMenuItemRightOperation.cs b/src/Operations/MenuOperations/MoveMenuItemRightOperation.cs
index 39800333..1d925c92 100644
--- a/src/Operations/MenuOperations/MoveMenuItemRightOperation.cs
+++ b/src/Operations/MenuOperations/MoveMenuItemRightOperation.cs
@@ -31,7 +31,7 @@ public MoveMenuItemRightOperation(MenuItem toMove)
public int? InsertionIndex { get; set; }
///
- public override void Redo()
+ protected override void RedoImpl()
{
if (this.OperateOn == null)
{
@@ -42,7 +42,7 @@ public override void Redo()
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
if (this.Parent == null || this.OperateOn == null)
{
@@ -96,7 +96,7 @@ protected override bool DoImpl()
// update the sub-menu
addTo.Children = submenuChildren.ToArray();
- this.Bar?.SetNeedsDisplay();
+ this.Bar?.SetNeedsDraw();
return true;
}
diff --git a/src/Operations/MenuOperations/RemoveMenuItemOperation.cs b/src/Operations/MenuOperations/RemoveMenuItemOperation.cs
index c6cc9d60..d951564e 100644
--- a/src/Operations/MenuOperations/RemoveMenuItemOperation.cs
+++ b/src/Operations/MenuOperations/RemoveMenuItemOperation.cs
@@ -51,13 +51,13 @@ public RemoveMenuItemOperation(MenuItem toRemove)
public bool PrunedTopLevelMenu => this.prunedEmptyTopLevelMenus != null && this.prunedEmptyTopLevelMenus.Any();
///
- public override void Redo()
+ protected override void RedoImpl()
{
this.Do();
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
if (this.Parent == null || this.OperateOn == null)
{
@@ -70,7 +70,7 @@ public override void Undo()
this.OperateOn,
.. Parent.Children[ removedAtIdx .. ]
];
- this.Bar?.SetNeedsDisplay();
+ this.Bar?.SetNeedsDraw();
// if any MenuBarItem were converted to vanilla MenuItem
// because we were removed from a sub-menu then convert
@@ -131,7 +131,7 @@ protected override bool DoImpl()
.. Parent.Children[ ..removedAtIdx ],
.. Parent.Children[ ( removedAtIdx + 1 ).. ]
];
- this.Bar?.SetNeedsDisplay();
+ this.Bar?.SetNeedsDraw();
if (this.Bar != null)
{
diff --git a/src/Operations/MenuOperations/RenameMenuItemOperation.cs b/src/Operations/MenuOperations/RenameMenuItemOperation.cs
index dc71a2f1..5b82da44 100644
--- a/src/Operations/MenuOperations/RenameMenuItemOperation.cs
+++ b/src/Operations/MenuOperations/RenameMenuItemOperation.cs
@@ -28,7 +28,7 @@ public RenameMenuItemOperation(MenuItem toRename)
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
if (this.OperateOn != null)
{
@@ -37,7 +37,7 @@ public override void Redo()
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
if (this.OperateOn != null)
{
diff --git a/src/Operations/MoveViewOperation.cs b/src/Operations/MoveViewOperation.cs
index ebdf1aae..40b8af0b 100644
--- a/src/Operations/MoveViewOperation.cs
+++ b/src/Operations/MoveViewOperation.cs
@@ -90,13 +90,13 @@ public MoveViewOperation(Design toMove, int deltaX, int deltaY)
public int DestinationX { get; }
///
- public override void Redo()
+ protected override void RedoImpl()
{
this.Do();
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
if (this.BeingMoved.View.X.IsAbsolute())
{
diff --git a/src/Operations/Operation.cs b/src/Operations/Operation.cs
index be32983c..019861ab 100644
--- a/src/Operations/Operation.cs
+++ b/src/Operations/Operation.cs
@@ -1,11 +1,17 @@
-namespace TerminalGuiDesigner.Operations;
+using NLog;
+using Terminal.Gui;
+
+namespace TerminalGuiDesigner.Operations;
///
/// Abstract base class for .
///
public abstract class Operation : IOperation
{
- protected int _timesDone;
+ ///
+ /// The number of times the operation has been performed.
+ ///
+ private int _timesDone;
///
/// The name to give to all objects which do not have a title/text etc.
@@ -20,7 +26,7 @@ public abstract class Operation : IOperation
public bool SupportsUndo { get; protected set; } = true;
///
- public ref int TimesDone => ref _timesDone;
+ public int TimesDone => _timesDone;
///
/// Defaults to .
@@ -45,6 +51,8 @@ public bool Do()
return false;
}
+ Logging.Information($"Do Operation {UniqueIdentifier} ({GetType().Name})");
+
if ( this.DoImpl( ) )
{
Interlocked.Increment( ref _timesDone );
@@ -55,10 +63,24 @@ public bool Do()
}
///
- public abstract void Undo();
+ public void Undo()
+ {
+ Logging.Information($"Undo Operation {UniqueIdentifier} ({GetType().Name})");
+ UndoImpl();
+ }
+
+ ///
+ protected abstract void UndoImpl();
///
- public abstract void Redo();
+ public void Redo()
+ {
+ Logging.Information($"Redo Operation {UniqueIdentifier} ({GetType().Name})");
+ RedoImpl();
+ }
+
+ ///
+ protected abstract void RedoImpl();
///
protected abstract bool DoImpl();
diff --git a/src/Operations/OperationFactory.cs b/src/Operations/OperationFactory.cs
index 84fcf032..9ec55f3b 100644
--- a/src/Operations/OperationFactory.cs
+++ b/src/Operations/OperationFactory.cs
@@ -26,12 +26,12 @@ public OperationFactory(PropertyValueGetterDelegate valueGetter)
/// set of given the mouse state.
///
/// All that are currently selected (see ).
- /// (if any) that prompted this request e.g. if user right clicks a .
+ /// (if any) that prompted this request e.g. if user right clicks a .
/// If is populated then this should be the wrapper for
- /// the that the mouse was over at the time it was clicked (see .
+ /// the that the mouse was over at the time it was clicked (see .
/// String that represents what the returned act upon e.g. "myLabel" or "8 objects".
/// Collection of all that can be offered to user as runnable given the current selection.
- public IEnumerable CreateOperations(Design[] selected, MouseEvent? m, Design? rightClicked, out string name)
+ public IEnumerable CreateOperations(Design[] selected, MouseEventArgs? m, Design? rightClicked, out string name)
{
List toReturn = new();
@@ -99,7 +99,7 @@ public IEnumerable CreateOperations(Design[] selected, MouseEvent? m
return toReturn;
}
- private IEnumerable CreateOperations(MouseEvent? m, Design d)
+ private IEnumerable CreateOperations(MouseEventArgs? m, Design d)
{
var ops = m == null ?
d.GetExtraOperations() :
diff --git a/src/Operations/PasteOperation.cs b/src/Operations/PasteOperation.cs
index 606006c4..4e1508b6 100644
--- a/src/Operations/PasteOperation.cs
+++ b/src/Operations/PasteOperation.cs
@@ -63,7 +63,7 @@ public PasteOperation(Design addTo)
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
foreach (var a in this.addOperations)
{
@@ -74,7 +74,7 @@ public override void Undo()
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
foreach (var a in this.addOperations)
{
diff --git a/src/Operations/ResizeOperation.cs b/src/Operations/ResizeOperation.cs
index 4f6019e1..4242ef66 100644
--- a/src/Operations/ResizeOperation.cs
+++ b/src/Operations/ResizeOperation.cs
@@ -55,14 +55,15 @@ public ResizeOperation(Design beingResized, int destX, int destY)
public int DestinationY { get; private set; }
///
- public override void Undo()
+ protected override void UndoImpl()
{
this.BeingResized.GetDesignableProperty("Width")?.SetValue(this.OriginalWidth);
this.BeingResized.GetDesignableProperty("Height")?.SetValue(this.OriginalHeight);
+ this.BeingResized.View.Layout();
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
this.Do();
}
@@ -81,6 +82,8 @@ public void ContinueResize(Point dest)
this.DestinationY = dest.Y;
this.SetHeight();
+
+ this.BeingResized.View.Layout();
}
///
diff --git a/src/Operations/SetPropertyOperation.cs b/src/Operations/SetPropertyOperation.cs
index 13f77269..ec03965a 100644
--- a/src/Operations/SetPropertyOperation.cs
+++ b/src/Operations/SetPropertyOperation.cs
@@ -116,7 +116,7 @@ public IReadOnlyCollection Designs
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
foreach (var m in this.mementos)
{
@@ -125,7 +125,7 @@ public override void Undo()
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
foreach (var m in this.mementos)
{
diff --git a/src/Operations/StatusBarOperations/MoveStatusItemOperation.cs b/src/Operations/StatusBarOperations/MoveStatusItemOperation.cs
index f8c4797f..4525179d 100644
--- a/src/Operations/StatusBarOperations/MoveStatusItemOperation.cs
+++ b/src/Operations/StatusBarOperations/MoveStatusItemOperation.cs
@@ -4,7 +4,7 @@
namespace TerminalGuiDesigner.Operations.StatusBarOperations
{
///
- /// Moves a on a left or right.
+ /// Moves a on a left or right.
///
public class MoveStatusItemOperation : MoveOperation
{
diff --git a/src/Operations/StatusBarOperations/RemoveStatusItemOperation.cs b/src/Operations/StatusBarOperations/RemoveStatusItemOperation.cs
index 5f0cc8ed..25f59f54 100644
--- a/src/Operations/StatusBarOperations/RemoveStatusItemOperation.cs
+++ b/src/Operations/StatusBarOperations/RemoveStatusItemOperation.cs
@@ -5,7 +5,7 @@
namespace TerminalGuiDesigner.Operations.StatusBarOperations
{
///
- /// Removes a from a .
+ /// Removes a from a .
///
public class RemoveStatusItemOperation : RemoveOperation
{
@@ -13,7 +13,7 @@ public class RemoveStatusItemOperation : RemoveOperation
/// Initializes a new instance of the class.
///
/// Wrapper for a .
- /// A to remove from bar.
+ /// A to remove from bar.
public RemoveStatusItemOperation(Design design, Shortcut toRemove)
: base(
(v) => v.GetShortcuts(),
diff --git a/src/Operations/StatusBarOperations/RenameStatusItemOperation.cs b/src/Operations/StatusBarOperations/RenameStatusItemOperation.cs
index f32eee92..fd83e73b 100644
--- a/src/Operations/StatusBarOperations/RenameStatusItemOperation.cs
+++ b/src/Operations/StatusBarOperations/RenameStatusItemOperation.cs
@@ -5,7 +5,7 @@
namespace TerminalGuiDesigner.Operations.StatusBarOperations
{
///
- /// Renames a on a .
+ /// Renames a on a .
///
public class RenameStatusItemOperation : RenameOperation
{
@@ -13,7 +13,7 @@ public class RenameStatusItemOperation : RenameOperation
/// Initializes a new instance of the class.
///
/// Design wrapper for a .
- /// The to rename.
+ /// The to rename.
/// The new name to use or null to prompt user.
public RenameStatusItemOperation(Design design, Shortcut toRename, string? newName)
: base(
diff --git a/src/Operations/StatusBarOperations/SetShortcutOperation.cs b/src/Operations/StatusBarOperations/SetShortcutOperation.cs
index f0c8195d..38cc6608 100644
--- a/src/Operations/StatusBarOperations/SetShortcutOperation.cs
+++ b/src/Operations/StatusBarOperations/SetShortcutOperation.cs
@@ -5,19 +5,19 @@
namespace TerminalGuiDesigner.Operations.StatusBarOperations
{
///
- /// Changes the of a on
+ /// Changes the of a on
/// a .
///
public class SetShortcutOperation : GenericArrayElementOperation
{
private Key originalShortcut;
- private Key? shortcut;
+ private Key shortcut;
///
/// Initializes a new instance of the class.
///
/// Wrapper for a .
- /// The whose shortcut you want to change.
+ /// The whose shortcut you want to change.
/// The new shortcut or null to prompt user at runtime.
public SetShortcutOperation(Design design, Shortcut statusItem, Key? shortcut)
: base(
@@ -27,14 +27,14 @@ public SetShortcutOperation(Design design, Shortcut statusItem, Key? shortcut)
design,
statusItem)
{
- this.shortcut = shortcut;
+ this.shortcut = shortcut ?? Key.Empty;
this.originalShortcut = statusItem.Key;
}
///
- public override void Redo()
+ protected override void RedoImpl()
{
- if (this.shortcut == null)
+ if (this.shortcut == Key.Empty)
{
return;
}
@@ -43,7 +43,7 @@ public override void Redo()
}
///
- public override void Undo()
+ protected override void UndoImpl()
{
this.OperateOn.Key = this.originalShortcut;
}
@@ -51,7 +51,7 @@ public override void Undo()
///
protected override bool DoImpl()
{
- if (this.shortcut == null)
+ if (this.shortcut == Key.Empty)
{
this.shortcut = Modals.GetShortcut();
}
diff --git a/src/Operations/TabOperations/RemoveTabOperation.cs b/src/Operations/TabOperations/RemoveTabOperation.cs
index 4a447bc1..afad922e 100644
--- a/src/Operations/TabOperations/RemoveTabOperation.cs
+++ b/src/Operations/TabOperations/RemoveTabOperation.cs
@@ -26,13 +26,13 @@ public RemoveTabOperation(Design design, Tab toRemove)
}
///
- protected override void SetNeedsDisplay()
+ protected override void SetNeedsDraw()
{
if (!this.View.Tabs.Contains(this.View.SelectedTab))
{
this.View.SelectedTab = this.View.Tabs.FirstOrDefault();
}
- base.SetNeedsDisplay();
+ base.SetNeedsDraw();
}
}
diff --git a/src/Operations/TabOperations/RenameTabOperation.cs b/src/Operations/TabOperations/RenameTabOperation.cs
index 461604d8..c40177cf 100644
--- a/src/Operations/TabOperations/RenameTabOperation.cs
+++ b/src/Operations/TabOperations/RenameTabOperation.cs
@@ -4,14 +4,14 @@
namespace TerminalGuiDesigner.Operations.TabOperations;
///
-/// Renames the of the currently selected
+/// Renames the of the currently selected
/// of a .
///
public class RenameTabOperation : RenameOperation
{
///
/// Initializes a new instance of the class.
- /// This command changes the on a .
+ /// This command changes the on a .
///
/// Wrapper for a .
/// Tab to rename.
diff --git a/src/Operations/TableViewOperations/AddColumnOperation.cs b/src/Operations/TableViewOperations/AddColumnOperation.cs
index d524ff19..72682afe 100644
--- a/src/Operations/TableViewOperations/AddColumnOperation.cs
+++ b/src/Operations/TableViewOperations/AddColumnOperation.cs
@@ -28,9 +28,9 @@ public AddColumnOperation(Design design, string? newColumnName)
}
///
- protected override void SetNeedsDisplay()
+ protected override void SetNeedsDraw()
{
this.View.Update();
- base.SetNeedsDisplay();
+ base.SetNeedsDraw();
}
}
diff --git a/src/Options.cs b/src/Options.cs
index bf8657e5..4e51a9a0 100644
--- a/src/Options.cs
+++ b/src/Options.cs
@@ -56,5 +56,19 @@ public static IEnumerable Examples
[Option('e', HelpText = "Enables experimental features")]
public bool Experimental { get; set; }
+
+ ///
+ /// Gets or sets a which driver to use.
+ ///
+ [Option('d', HelpText = "Driver to use. v2, v2net, v2win, WindowsDriver, CursesDriver or NetDriver",
+ Default = "v2")]
+ public string Driver { get; set; } = "v2";
+
+
+ ///
+ /// Gets or sets a value indicating whether to enable logging.
+ ///
+ [Option('q', HelpText = "Pass to suppress log generation")]
+ public bool Quiet { get; set; }
#nullable enable warnings
}
diff --git a/src/PosExtensions.cs b/src/PosExtensions.cs
index 853d2835..87e6d0da 100644
--- a/src/PosExtensions.cs
+++ b/src/PosExtensions.cs
@@ -196,7 +196,9 @@ public static bool IsRelative(this Pos? p, IList knownDesigns, [NotNullW
}
- ///
+ ///
+ ///Returns true if the is a summation or subtraction of two other
+ ///
/// to classify.
/// The left hand operand of the summation/subtraction.
/// The right hand operand of the summation/subtraction.
diff --git a/src/Program.cs b/src/Program.cs
index 62bf379f..18184629 100644
--- a/src/Program.cs
+++ b/src/Program.cs
@@ -19,8 +19,9 @@ public static void Main(string[] args)
.WithParsed(o =>
{
Editor.Experimental = o.Experimental;
-
- Application.Init();
+ Editor.Quiet = o.Quiet;
+
+ Application.Init(null,o.Driver);
var editor = new Editor();
editor.Run(o);
});
diff --git a/src/Properties/launchSettings.json b/src/Properties/launchSettings.json
index 0ba7ea9b..dc17da51 100644
--- a/src/Properties/launchSettings.json
+++ b/src/Properties/launchSettings.json
@@ -1,7 +1,16 @@
{
"profiles": {
- "TerminalGuiDesigner": {
- "commandName": "Project"
+ "WSL": {
+ "commandName": "WSL2",
+ "distributionName": ""
+ },
+ "v2net": {
+ "commandName": "Project",
+ "commandLineArgs": "-d v2net"
+ },
+ "v2win": {
+ "commandName": "Project",
+ "commandLineArgs": "-d v2win"
}
}
}
\ No newline at end of file
diff --git a/src/ReflectionHelpers.cs b/src/ReflectionHelpers.cs
index a7e954bd..4df4dc7d 100644
--- a/src/ReflectionHelpers.cs
+++ b/src/ReflectionHelpers.cs
@@ -35,7 +35,10 @@ internal static TOut GetNonNullNonPublicFieldValue( this TIn? item, s
ArgumentNullException.ThrowIfNull( item, nameof( item ) );
ArgumentException.ThrowIfNullOrEmpty( fieldName, nameof( fieldName ) );
+ // Try get private field e.g. 'blah'. But because upstream often flips
+ // around the naming of privates lets also look for '_blah'
FieldInfo selectedField = typeof( TIn ).GetField( fieldName, BindingFlags.NonPublic | BindingFlags.Instance )
+ ??typeof(TIn).GetField("_"+fieldName, BindingFlags.NonPublic | BindingFlags.Instance)
?? throw new MissingFieldException( $"Expected non-public instance field {fieldName} was not present on {typeof( TIn ).Name}" );
if ( selectedField.FieldType != typeof( TOut ) )
diff --git a/src/StatusBarExtensions.cs b/src/StatusBarExtensions.cs
index 3a34d90f..fd20b13d 100644
--- a/src/StatusBarExtensions.cs
+++ b/src/StatusBarExtensions.cs
@@ -9,11 +9,11 @@ namespace TerminalGuiDesigner;
public static class StatusBarExtensions
{
///
- /// Returns the that appears at the of the click.
+ /// Returns the that appears at the of the click.
///
/// you want to find the clicked (top level menu) for.
/// Screen coordinate of the click in X.
- /// The under the mouse at this position or null (only considers X).
+ /// The under the mouse at this position or null (only considers X).
public static Shortcut? ScreenToMenuBarItem(this StatusBar statusBar, int screenX)
{
// These might be changed in Terminal.Gui library
@@ -38,7 +38,7 @@ public static class StatusBarExtensions
int distance = initialWhitespace;
Dictionary xLocations = new();
- foreach (var si in statusBar.Subviews.OfType())
+ foreach (var si in statusBar.SubViews.OfType())
{
xLocations.Add(distance, si);
distance += si.Title.GetColumns() + afterEachItemWhitespace;
@@ -65,14 +65,26 @@ public static class StatusBarExtensions
///
public static int CountShortcuts(this StatusBar bar)
{
- return bar.Subviews.OfType().Count();
+ return bar.SubViews.OfType().Count();
}
+ ///
+ /// Returns the items on the (previously
+ /// called StatusBarItems now called just )
+ ///
+ ///
+ ///
public static Shortcut[] GetShortcuts(this StatusBar bar)
{
- return bar.Subviews.OfType().ToArray();
+ return bar.SubViews.OfType().ToArray();
}
+ ///
+ /// Replaces all items on the with the new
+ /// .
+ ///
+ ///
+ ///
public static void SetShortcuts(this StatusBar bar, Shortcut[] shortcuts)
{
foreach(var old in bar.GetShortcuts())
diff --git a/src/TerminalGuiDesigner.csproj b/src/TerminalGuiDesigner.csproj
index 730d58b9..d0f2b0f0 100644
--- a/src/TerminalGuiDesigner.csproj
+++ b/src/TerminalGuiDesigner.csproj
@@ -20,7 +20,7 @@
./nupkg
enable
TerminalGuiDesigner
- 2.0.0-alpha.2203
+ 2.0.0-develop.4400
Thomas Nind
enable
MIT
@@ -33,6 +33,8 @@
logo.png
README.md
+ 2.0.0-alpha.4400
+ * V2 driver support
2.0.0-alpha.2203
* True color `ColorPicker`
2.0.0-alpha.2189
@@ -129,7 +131,7 @@
* Right click context menu support
* Increased mouse resizing click hit box
* Added progress indicator for creating new Views
- * Fixed mouse dragging/resizing of views in subviews (e.g. TabViews)
+ * Fixed mouse dragging/resizing of views in SubViews (e.g. TabViews)
@@ -143,14 +145,15 @@
-
-
-
+
+
+
+
diff --git a/src/ToCode/EnumToCode.cs b/src/ToCode/EnumToCode.cs
index 0e62dad2..594fb07b 100644
--- a/src/ToCode/EnumToCode.cs
+++ b/src/ToCode/EnumToCode.cs
@@ -2,18 +2,31 @@
namespace TerminalGuiDesigner.ToCode;
+///
+/// Code generation methods for writing out enum values
+/// using CodeDom.
+///
public class EnumToCode : ToCodeBase
{
private readonly Enum value;
private readonly Type enumType;
-
+ ///
+ /// Creates a new instance of the class, primed to generate code
+ /// for the supplied
+ ///
+ ///
public EnumToCode(Enum value)
{
this.value = value;
this.enumType = value.GetType();
}
+ ///
+ /// Returns code expression similar to MyEnum.SomeValue.
+ /// Supports Flags enums e.g. generating things like MyEnum.ValA | MyEnum.ValB
+ ///
+ ///
public CodeExpression ToCode()
{
var isFlags = enumType.IsDefined(typeof(FlagsAttribute), false);
diff --git a/src/ToCode/InstanceOfProperty.cs b/src/ToCode/InstanceOfProperty.cs
index f161f666..366105e3 100644
--- a/src/ToCode/InstanceOfProperty.cs
+++ b/src/ToCode/InstanceOfProperty.cs
@@ -11,15 +11,29 @@ namespace TerminalGuiDesigner.ToCode;
///
public class InstanceOfProperty : Property
{
- public Type MustBeDerrivedFrom { get; }
+ ///
+ /// Places a restriction on the that
+ /// can be supplied. When setting the value must be a class derrived
+ /// from this .
+ ///
+ public Type MustBeDerivedFrom { get; }
+ ///
+ /// Creates a new instance of designable property .
+ /// In which values set the supplied
+ ///
+ ///
+ ///
+ ///
+ ///
public InstanceOfProperty(Design design, PropertyInfo property)
: base(design, property)
{
- this.MustBeDerrivedFrom = property.PropertyType
+ this.MustBeDerivedFrom = property.PropertyType
?? throw new Exception("Unable to determine property type");
}
+ ///
public override CodeExpression GetRhs()
{
var instance = this.GetValue();
diff --git a/src/ToCode/Property.cs b/src/ToCode/Property.cs
index 4df3c3a1..97c04e52 100644
--- a/src/ToCode/Property.cs
+++ b/src/ToCode/Property.cs
@@ -108,13 +108,13 @@ public virtual void SetValue(object? value)
case Orientation.Horizontal:
v.Width = v.Height;
v.Height = 1;
- v.LineRune = ConfigurationManager.Glyphs.HLine;
+ v.LineRune = Glyphs.HLine;
break;
case Orientation.Vertical:
v.Height = v.Width;
v.Width = 1;
- v.LineRune = ConfigurationManager.Glyphs.VLine;
+ v.LineRune = Glyphs.VLine;
break;
default:
throw new ArgumentException($"Unknown Orientation {newOrientation}");
@@ -310,9 +310,9 @@ private CodeExpression ValueFactory(object val)
if (type.GetGenericTypeDefinition() == typeof(SliderOption<>))
{
// TODO: this feels very brittle!
- var a1 = type.GetProperty(nameof(SliderOption