From fdf49b2a31904a152bf05166ebc6b7c2ac3ee864 Mon Sep 17 00:00:00 2001 From: bparks13 Date: Tue, 18 Nov 2025 16:20:48 -0500 Subject: [PATCH 01/11] Filter for top level menu strips to avoid inconsistent menu items --- OpenEphys.Onix1.Design/DesignHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenEphys.Onix1.Design/DesignHelper.cs b/OpenEphys.Onix1.Design/DesignHelper.cs index 8090455d..14f4a350 100644 --- a/OpenEphys.Onix1.Design/DesignHelper.cs +++ b/OpenEphys.Onix1.Design/DesignHelper.cs @@ -51,7 +51,7 @@ public static Form AddMenuItemsFromDialogToFileOption(this Form thisForm, Form c if (childForm != null) { - var childMenuStrip = childForm.GetAllControls() + var childMenuStrip = childForm.GetTopLevelControls() .OfType() .FirstOrDefault() ?? throw new InvalidOperationException($"There are no menu strips in any child controls of the {childForm.Text} dialog."); @@ -97,7 +97,7 @@ public static Form AddMenuItemsFromDialogToFileOption(this Form thisForm, Form c if (childForm != null) { - var childMenuStrip = childForm.GetAllControls() + var childMenuStrip = childForm.GetTopLevelControls() .OfType() .First() ?? throw new InvalidOperationException($"There are no menu strips in any child controls of the {childForm.Text} dialog."); From e6e31379a11a120001822bf4f2946a92508c5654 Mon Sep 17 00:00:00 2001 From: bparks13 Date: Tue, 18 Nov 2025 16:21:36 -0500 Subject: [PATCH 02/11] Add copy constructors to main library classes --- OpenEphys.Onix1.Design/NeuropixelsV1Editor.cs | 2 +- OpenEphys.Onix1/ConfigureHeadstage64.cs | 16 ++++++++++++++++ .../ConfigureHeadstageNeuropixelsV1e.cs | 13 +++++++++++++ .../ConfigureHeadstageNeuropixelsV1f.cs | 15 +++++++++++++++ .../ConfigureHeadstageNeuropixelsV2e.cs | 15 ++++++++++++++- .../ConfigureHeadstageNeuropixelsV2eBeta.cs | 13 +++++++++++++ OpenEphys.Onix1/ConfigureHeadstageRhs2116.cs | 13 +++++++++++++ OpenEphys.Onix1/ConfigureNeuropixelsV1e.cs | 9 +++++++++ OpenEphys.Onix1/ConfigureNeuropixelsV1f.cs | 9 +++++++++ OpenEphys.Onix1/ConfigureNeuropixelsV2e.cs | 9 +++++++++ OpenEphys.Onix1/ConfigureNeuropixelsV2eBeta.cs | 9 +++++++++ OpenEphys.Onix1/IConfigureNeuropixelsV1.cs | 5 +++++ OpenEphys.Onix1/IConfigureNeuropixelsV2.cs | 5 +++++ 13 files changed, 131 insertions(+), 2 deletions(-) diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1Editor.cs b/OpenEphys.Onix1.Design/NeuropixelsV1Editor.cs index 440e8ab8..93a4b820 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1Editor.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1Editor.cs @@ -22,7 +22,7 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon if (editorDialog.ShowDialog() == DialogResult.OK) { - configureNeuropixelsV1.ProbeConfiguration = editorDialog.ProbeConfigurationDialog.ProbeConfiguration; + DesignHelper.CopyProperties(editorDialog.ConfigureNode, configureNeuropixelsV1, DesignHelper.PropertiesToIgnore); return true; } diff --git a/OpenEphys.Onix1/ConfigureHeadstage64.cs b/OpenEphys.Onix1/ConfigureHeadstage64.cs index 321ed807..5891d8be 100644 --- a/OpenEphys.Onix1/ConfigureHeadstage64.cs +++ b/OpenEphys.Onix1/ConfigureHeadstage64.cs @@ -44,6 +44,22 @@ public ConfigureHeadstage64() PortControl.HubConfiguration = HubConfiguration.Standard; } + /// + /// Initializes a copied instance of the class. + /// + /// Existing instance. + public ConfigureHeadstage64(ConfigureHeadstage64 configureNode) + { + Name = configureNode.Name; + Port = configureNode.Port; + PortControl = configureNode.PortControl; + Rhd2164 = new(configureNode.Rhd2164); + Bno055 = new(configureNode.Bno055); + TS4231 = new(configureNode.TS4231); + ElectricalStimulator = new(configureNode.ElectricalStimulator); + OpticalStimulator = new(configureNode.OpticalStimulator); + } + /// /// Gets or sets the Rhd2164 configuration. /// diff --git a/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV1e.cs b/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV1e.cs index 768c9d84..2c41cc70 100644 --- a/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV1e.cs +++ b/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV1e.cs @@ -38,6 +38,19 @@ public ConfigureHeadstageNeuropixelsV1e() PortControl.HubConfiguration = HubConfiguration.Passthrough; } + /// + /// Initializes a copied instance of the class. + /// + /// Existing instance. + public ConfigureHeadstageNeuropixelsV1e(ConfigureHeadstageNeuropixelsV1e configureNode) + { + Name = configureNode.Name; + Port = configureNode.Port; + PortControl = configureNode.PortControl; + NeuropixelsV1e = configureNode.NeuropixelsV1e.Clone() as ConfigureNeuropixelsV1e ?? throw new InvalidOperationException($"Unable to copy {nameof(NeuropixelsV1e)} property. Could not cast to the correct type."); + Bno055 = new(configureNode.Bno055); + } + /// /// Gets or sets the NeuropixelsV1e configuration. /// diff --git a/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV1f.cs b/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV1f.cs index 9fde2bc8..e6f1236c 100644 --- a/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV1f.cs +++ b/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV1f.cs @@ -40,6 +40,21 @@ public ConfigureHeadstageNeuropixelsV1f() PortControl.HubConfiguration = HubConfiguration.Standard; } + /// + /// Initializes a copied instance of the class. + /// + /// Existing instance. + public ConfigureHeadstageNeuropixelsV1f(ConfigureHeadstageNeuropixelsV1f configureNode) + { + Name = configureNode.Name; + Port = configureNode.Port; + PortControl = configureNode.PortControl; + NeuropixelsV1A = configureNode.NeuropixelsV1A.Clone() as ConfigureNeuropixelsV1f ?? throw new InvalidOperationException($"Unable to copy {nameof(NeuropixelsV1A)} property. Could not cast to the correct type."); + NeuropixelsV1B = configureNode.NeuropixelsV1B.Clone() as ConfigureNeuropixelsV1f ?? throw new InvalidOperationException($"Unable to copy {nameof(NeuropixelsV1B)} property. Could not cast to the correct type."); + Bno055 = new(configureNode.Bno055); + TS4231 = new(configureNode.TS4231); + } + /// /// Gets or sets the NeuropixelsV1 probe A configuration. /// diff --git a/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV2e.cs b/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV2e.cs index fd67ef0d..80181ba4 100644 --- a/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV2e.cs +++ b/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV2e.cs @@ -29,7 +29,7 @@ public class ConfigureHeadstageNeuropixelsV2e : MultiDeviceFactory readonly ConfigureNeuropixelsV2ePortController PortControl = new(); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public ConfigureHeadstageNeuropixelsV2e() { @@ -37,6 +37,19 @@ public ConfigureHeadstageNeuropixelsV2e() PortControl.HubConfiguration = HubConfiguration.Passthrough; } + /// + /// Initializes a copied instance of the class. + /// + /// Existing instance. + public ConfigureHeadstageNeuropixelsV2e(ConfigureHeadstageNeuropixelsV2e configureNode) + { + Name = configureNode.Name; + Port = configureNode.Port; + PortControl = configureNode.PortControl; + NeuropixelsV2e = configureNode.NeuropixelsV2e.Clone() as ConfigureNeuropixelsV2e ?? throw new InvalidOperationException($"Unable to copy {nameof(NeuropixelsV2e)} property. Could not cast to the correct type."); + Bno055 = new(configureNode.Bno055); + } + /// /// Gets or sets the NeuropixelsV2e configuration. /// diff --git a/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV2eBeta.cs b/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV2eBeta.cs index 08e28bec..45a97008 100644 --- a/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV2eBeta.cs +++ b/OpenEphys.Onix1/ConfigureHeadstageNeuropixelsV2eBeta.cs @@ -37,6 +37,19 @@ public ConfigureHeadstageNeuropixelsV2eBeta() PortControl.HubConfiguration = HubConfiguration.Passthrough; } + /// + /// Initializes a copied instance of the class. + /// + /// Existing instance. + public ConfigureHeadstageNeuropixelsV2eBeta(ConfigureHeadstageNeuropixelsV2eBeta configureNode) + { + Name = configureNode.Name; + Port = configureNode.Port; + PortControl = configureNode.PortControl; + NeuropixelsV2eBeta = configureNode.NeuropixelsV2eBeta.Clone() as ConfigureNeuropixelsV2eBeta ?? throw new InvalidOperationException($"Unable to copy {nameof(NeuropixelsV2eBeta)} property. Could not cast to the correct type."); + Bno055 = new(configureNode.Bno055); + } + /// /// Gets or sets the NeuropixelsV2eBeta configuration. /// diff --git a/OpenEphys.Onix1/ConfigureHeadstageRhs2116.cs b/OpenEphys.Onix1/ConfigureHeadstageRhs2116.cs index 25c1df9d..f057e3e8 100644 --- a/OpenEphys.Onix1/ConfigureHeadstageRhs2116.cs +++ b/OpenEphys.Onix1/ConfigureHeadstageRhs2116.cs @@ -38,6 +38,19 @@ public ConfigureHeadstageRhs2116() LinkController.HubConfiguration = HubConfiguration.Standard; } + /// + /// Initializes a copied instance of the class. + /// + /// Existing instance. + public ConfigureHeadstageRhs2116(ConfigureHeadstageRhs2116 configureNode) + { + Name = configureNode.Name; + Port = configureNode.Port; + LinkController = configureNode.LinkController; + Rhs2116Pair = new(configureNode.Rhs2116Pair); + StimulusTrigger = new(configureNode.StimulusTrigger); + } + /// /// Gets or sets the Rhs2116Pair configuration. /// diff --git a/OpenEphys.Onix1/ConfigureNeuropixelsV1e.cs b/OpenEphys.Onix1/ConfigureNeuropixelsV1e.cs index 281b25a7..d25cb4ec 100644 --- a/OpenEphys.Onix1/ConfigureNeuropixelsV1e.cs +++ b/OpenEphys.Onix1/ConfigureNeuropixelsV1e.cs @@ -40,6 +40,15 @@ public ConfigureNeuropixelsV1e(ConfigureNeuropixelsV1e configureNeuropixelsV1e) DeviceAddress = configureNeuropixelsV1e.DeviceAddress; } + /// + /// Returns a deep copy of the current instance. + /// + /// instance. + public IConfigureNeuropixelsV1 Clone() + { + return new ConfigureNeuropixelsV1e(this); + } + /// /// /// If set to true, will produce data. If set to false, diff --git a/OpenEphys.Onix1/ConfigureNeuropixelsV1f.cs b/OpenEphys.Onix1/ConfigureNeuropixelsV1f.cs index 66a240d6..02fee6af 100644 --- a/OpenEphys.Onix1/ConfigureNeuropixelsV1f.cs +++ b/OpenEphys.Onix1/ConfigureNeuropixelsV1f.cs @@ -48,6 +48,15 @@ public ConfigureNeuropixelsV1f(ConfigureNeuropixelsV1f configureNeuropixelsV1f) DeviceAddress = configureNeuropixelsV1f.DeviceAddress; } + /// + /// Returns a deep copy of the current instance. + /// + /// instance. + public IConfigureNeuropixelsV1 Clone() + { + return new ConfigureNeuropixelsV1f(this); + } + /// /// /// If set to true, will produce data. If set to false, diff --git a/OpenEphys.Onix1/ConfigureNeuropixelsV2e.cs b/OpenEphys.Onix1/ConfigureNeuropixelsV2e.cs index 7de863f1..27c2d777 100644 --- a/OpenEphys.Onix1/ConfigureNeuropixelsV2e.cs +++ b/OpenEphys.Onix1/ConfigureNeuropixelsV2e.cs @@ -36,6 +36,15 @@ public ConfigureNeuropixelsV2e(ConfigureNeuropixelsV2e configureNode) DeviceAddress = configureNode.DeviceAddress; } + /// + /// Returns a deep copy of the current instance. + /// + /// instance. + public IConfigureNeuropixelsV2 Clone() + { + return new ConfigureNeuropixelsV2e(this); + } + /// /// /// If set to true, will produce data. If set to false, diff --git a/OpenEphys.Onix1/ConfigureNeuropixelsV2eBeta.cs b/OpenEphys.Onix1/ConfigureNeuropixelsV2eBeta.cs index e382e969..f8082b9f 100644 --- a/OpenEphys.Onix1/ConfigureNeuropixelsV2eBeta.cs +++ b/OpenEphys.Onix1/ConfigureNeuropixelsV2eBeta.cs @@ -41,6 +41,15 @@ public ConfigureNeuropixelsV2eBeta(ConfigureNeuropixelsV2eBeta configureNode) DeviceAddress = configureNode.DeviceAddress; } + /// + /// Returns a deep copy of the current instance. + /// + /// instance. + public IConfigureNeuropixelsV2 Clone() + { + return new ConfigureNeuropixelsV2eBeta(this); + } + /// /// /// If set to true, will produce data. If set to false, diff --git a/OpenEphys.Onix1/IConfigureNeuropixelsV1.cs b/OpenEphys.Onix1/IConfigureNeuropixelsV1.cs index 851940ac..3be90d8f 100644 --- a/OpenEphys.Onix1/IConfigureNeuropixelsV1.cs +++ b/OpenEphys.Onix1/IConfigureNeuropixelsV1.cs @@ -5,6 +5,11 @@ /// public interface IConfigureNeuropixelsV1 { + /// + /// Returns a deep copy of the current instance. + /// + public IConfigureNeuropixelsV1 Clone(); + /// /// Gets or sets the device enable state. /// diff --git a/OpenEphys.Onix1/IConfigureNeuropixelsV2.cs b/OpenEphys.Onix1/IConfigureNeuropixelsV2.cs index 1ef0b0f7..f7aa3a31 100644 --- a/OpenEphys.Onix1/IConfigureNeuropixelsV2.cs +++ b/OpenEphys.Onix1/IConfigureNeuropixelsV2.cs @@ -5,6 +5,11 @@ /// public interface IConfigureNeuropixelsV2 { + /// + /// Returns a deep copy of the current instance. + /// + public IConfigureNeuropixelsV2 Clone(); + /// /// Gets or sets the device enable state. /// From e5c2a11137d9e492b5405116cb5413db764c63c6 Mon Sep 17 00:00:00 2001 From: bparks13 Date: Tue, 28 Oct 2025 16:19:56 -0400 Subject: [PATCH 03/11] Add PropertyGrid to stimulus sequence dialogs - Remove constructor arguments from base class - Rhs2116 is not refactored, as the controls are not 1:1 tied to an underlying object, but are dynamic controls depending on what is selected --- .../GenericStimulusSequenceDialog.Designer.cs | 214 +++++++-------- .../GenericStimulusSequenceDialog.cs | 46 ++-- .../GenericStimulusSequenceDialog.resx | 3 + .../Headstage64Dialog.Designer.cs | 4 +- OpenEphys.Onix1.Design/Headstage64Dialog.cs | 6 +- OpenEphys.Onix1.Design/Headstage64Editor.cs | 8 +- ...ge64ElectricalStimulatorComponentEditor.cs | 4 +- .../Headstage64ElectricalStimulatorOptions.cs | 5 + ...age64ElectricalStimulatorSequenceDialog.cs | 243 ++++++++---------- ...stage64ElectricalStimulatorUITypeEditor.cs | 4 +- ...stage64OpticalStimulatorComponentEditor.cs | 4 +- ...dstage64OpticalStimulatorSequenceDialog.cs | 216 +++++++--------- ...eadstage64OpticalStimulatorUITypeEditor.cs | 4 +- .../HeadstageRhs2116Dialog.cs | 2 +- .../HeadstageRhs2116Editor.cs | 7 +- .../Rhs2116StimulusSequenceDialog.cs | 80 ++++-- .../Rhs2116StimulusSequenceEditor.cs | 4 +- ...Rhs2116StimulusSequenceOptions.Designer.cs | 72 ++++-- OpenEphys.Onix1.Design/TextBoxBinding.cs | 46 ---- 19 files changed, 463 insertions(+), 509 deletions(-) delete mode 100644 OpenEphys.Onix1.Design/TextBoxBinding.cs diff --git a/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.Designer.cs b/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.Designer.cs index 885b5da8..b37b63bf 100644 --- a/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.Designer.cs @@ -35,34 +35,32 @@ private void InitializeComponent() this.toolStripStatusIsValid = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusText = new System.Windows.Forms.ToolStripStatusLabel(); this.buttonOk = new System.Windows.Forms.Button(); - this.panelProbe = new System.Windows.Forms.Panel(); this.menuStrip = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.stimulusWaveformToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.groupBoxDefineStimuli = new System.Windows.Forms.GroupBox(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.panelWaveform = new System.Windows.Forms.Panel(); - this.tabControlVisualization = new System.Windows.Forms.TabControl(); - this.tabPageWaveform = new System.Windows.Forms.TabPage(); this.zedGraphWaveform = new ZedGraph.ZedGraphControl(); - this.tabPageTable = new System.Windows.Forms.TabPage(); - this.dataGridViewStimulusTable = new System.Windows.Forms.DataGridView(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); - this.button1 = new System.Windows.Forms.Button(); + this.buttonResetZoom = new System.Windows.Forms.Button(); + this.tabControlProperties = new System.Windows.Forms.TabControl(); + this.tabPageDefineStimuli = new System.Windows.Forms.TabPage(); + this.tabPageProperties = new System.Windows.Forms.TabPage(); + this.propertyGrid = new System.Windows.Forms.PropertyGrid(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.bindingSource = new System.Windows.Forms.BindingSource(this.components); this.statusStrip.SuspendLayout(); this.menuStrip.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); this.panelWaveform.SuspendLayout(); - this.tabControlVisualization.SuspendLayout(); - this.tabPageWaveform.SuspendLayout(); - this.tabPageTable.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridViewStimulusTable)).BeginInit(); this.flowLayoutPanel2.SuspendLayout(); + this.tabControlProperties.SuspendLayout(); + this.tabPageProperties.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit(); this.SuspendLayout(); // // buttonCancel @@ -121,15 +119,6 @@ private void InitializeComponent() this.buttonOk.UseVisualStyleBackColor = true; this.buttonOk.Click += new System.EventHandler(this.ButtonOk_Click); // - // panelProbe - // - this.panelProbe.Dock = System.Windows.Forms.DockStyle.Fill; - this.panelProbe.Location = new System.Drawing.Point(698, 2); - this.panelProbe.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.panelProbe.Name = "panelProbe"; - this.panelProbe.Size = new System.Drawing.Size(445, 167); - this.panelProbe.TabIndex = 0; - // // menuStrip // this.menuStrip.ImageScalingSize = new System.Drawing.Size(24, 24); @@ -156,21 +145,21 @@ private void InitializeComponent() this.openFileToolStripMenuItem, this.saveFileToolStripMenuItem}); this.stimulusWaveformToolStripMenuItem.Name = "stimulusWaveformToolStripMenuItem"; - this.stimulusWaveformToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.stimulusWaveformToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.stimulusWaveformToolStripMenuItem.Text = "Stimulus Waveform"; // // openFileToolStripMenuItem // this.openFileToolStripMenuItem.Name = "openFileToolStripMenuItem"; - this.openFileToolStripMenuItem.Size = new System.Drawing.Size(124, 22); - this.openFileToolStripMenuItem.Text = "Open File"; + this.openFileToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.openFileToolStripMenuItem.Text = "Import File"; this.openFileToolStripMenuItem.Click += new System.EventHandler(this.MenuItemLoadFile_Click); // // saveFileToolStripMenuItem // this.saveFileToolStripMenuItem.Name = "saveFileToolStripMenuItem"; - this.saveFileToolStripMenuItem.Size = new System.Drawing.Size(124, 22); - this.saveFileToolStripMenuItem.Text = "Save File"; + this.saveFileToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.saveFileToolStripMenuItem.Text = "Export File"; this.saveFileToolStripMenuItem.Click += new System.EventHandler(this.MenuItemSaveFile_Click); // // tableLayoutPanel1 @@ -178,36 +167,22 @@ private void InitializeComponent() this.tableLayoutPanel1.ColumnCount = 2; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 451F)); - this.tableLayoutPanel1.Controls.Add(this.groupBoxDefineStimuli, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.panelProbe, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 2); this.tableLayoutPanel1.Controls.Add(this.panelWaveform, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.tabControlProperties, 1, 0); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 4; + this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 308F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 42F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 42F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(1146, 563); this.tableLayoutPanel1.TabIndex = 8; // - // groupBoxDefineStimuli - // - this.groupBoxDefineStimuli.Dock = System.Windows.Forms.DockStyle.Fill; - this.groupBoxDefineStimuli.Location = new System.Drawing.Point(698, 173); - this.groupBoxDefineStimuli.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.groupBoxDefineStimuli.Name = "groupBoxDefineStimuli"; - this.groupBoxDefineStimuli.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.tableLayoutPanel1.SetRowSpan(this.groupBoxDefineStimuli, 2); - this.groupBoxDefineStimuli.Size = new System.Drawing.Size(445, 346); - this.groupBoxDefineStimuli.TabIndex = 0; - this.groupBoxDefineStimuli.TabStop = false; - this.groupBoxDefineStimuli.Text = "Define Stimuli"; - // // flowLayoutPanel1 // this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutPanel1, 2); @@ -223,41 +198,17 @@ private void InitializeComponent() // // panelWaveform // - this.panelWaveform.Controls.Add(this.tabControlVisualization); + this.panelWaveform.Controls.Add(this.zedGraphWaveform); this.panelWaveform.Dock = System.Windows.Forms.DockStyle.Fill; this.panelWaveform.Location = new System.Drawing.Point(3, 3); this.panelWaveform.Name = "panelWaveform"; - this.tableLayoutPanel1.SetRowSpan(this.panelWaveform, 2); this.panelWaveform.Size = new System.Drawing.Size(689, 473); this.panelWaveform.TabIndex = 8; // - // tabControlVisualization - // - this.tabControlVisualization.Controls.Add(this.tabPageWaveform); - this.tabControlVisualization.Controls.Add(this.tabPageTable); - this.tabControlVisualization.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControlVisualization.Location = new System.Drawing.Point(0, 0); - this.tabControlVisualization.Name = "tabControlVisualization"; - this.tabControlVisualization.SelectedIndex = 0; - this.tabControlVisualization.Size = new System.Drawing.Size(689, 473); - this.tabControlVisualization.TabIndex = 6; - // - // tabPageWaveform - // - this.tabPageWaveform.Controls.Add(this.zedGraphWaveform); - this.tabPageWaveform.Location = new System.Drawing.Point(4, 25); - this.tabPageWaveform.Name = "tabPageWaveform"; - this.tabPageWaveform.Padding = new System.Windows.Forms.Padding(3); - this.tabPageWaveform.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - this.tabPageWaveform.Size = new System.Drawing.Size(681, 444); - this.tabPageWaveform.TabIndex = 0; - this.tabPageWaveform.Text = "Stimulus Waveform"; - this.tabPageWaveform.UseVisualStyleBackColor = true; - // // zedGraphWaveform // this.zedGraphWaveform.Dock = System.Windows.Forms.DockStyle.Fill; - this.zedGraphWaveform.Location = new System.Drawing.Point(3, 3); + this.zedGraphWaveform.Location = new System.Drawing.Point(0, 0); this.zedGraphWaveform.Margin = new System.Windows.Forms.Padding(0); this.zedGraphWaveform.Name = "zedGraphWaveform"; this.zedGraphWaveform.ScrollGrace = 0D; @@ -267,57 +218,72 @@ private void InitializeComponent() this.zedGraphWaveform.ScrollMinX = 0D; this.zedGraphWaveform.ScrollMinY = 0D; this.zedGraphWaveform.ScrollMinY2 = 0D; - this.zedGraphWaveform.Size = new System.Drawing.Size(675, 438); - this.zedGraphWaveform.TabIndex = 5; + this.zedGraphWaveform.Size = new System.Drawing.Size(689, 473); + this.zedGraphWaveform.TabIndex = 6; this.zedGraphWaveform.UseExtendedPrintDialog = true; // - // tabPageTable - // - this.tabPageTable.Controls.Add(this.dataGridViewStimulusTable); - this.tabPageTable.Location = new System.Drawing.Point(4, 25); - this.tabPageTable.Name = "tabPageTable"; - this.tabPageTable.Padding = new System.Windows.Forms.Padding(3); - this.tabPageTable.Size = new System.Drawing.Size(681, 444); - this.tabPageTable.TabIndex = 1; - this.tabPageTable.Text = "Table"; - this.tabPageTable.UseVisualStyleBackColor = true; - // - // dataGridViewStimulusTable - // - this.dataGridViewStimulusTable.AllowUserToAddRows = false; - this.dataGridViewStimulusTable.AllowUserToDeleteRows = false; - this.dataGridViewStimulusTable.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; - this.dataGridViewStimulusTable.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridViewStimulusTable.Dock = System.Windows.Forms.DockStyle.Fill; - this.dataGridViewStimulusTable.Location = new System.Drawing.Point(3, 3); - this.dataGridViewStimulusTable.Name = "dataGridViewStimulusTable"; - this.dataGridViewStimulusTable.ReadOnly = true; - this.dataGridViewStimulusTable.RowHeadersWidth = 62; - this.dataGridViewStimulusTable.RowTemplate.Height = 24; - this.dataGridViewStimulusTable.Size = new System.Drawing.Size(675, 438); - this.dataGridViewStimulusTable.TabIndex = 0; - this.dataGridViewStimulusTable.TabStop = false; - // // flowLayoutPanel2 // - this.flowLayoutPanel2.Controls.Add(this.button1); + this.flowLayoutPanel2.Controls.Add(this.buttonResetZoom); this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 482); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Size = new System.Drawing.Size(689, 36); this.flowLayoutPanel2.TabIndex = 9; // - // button1 - // - this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.button1.Location = new System.Drawing.Point(3, 2); - this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(144, 32); - this.button1.TabIndex = 5; - this.button1.Text = "Reset Zoom"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.ResetZoom_Click); + // buttonResetZoom + // + this.buttonResetZoom.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.buttonResetZoom.Location = new System.Drawing.Point(3, 2); + this.buttonResetZoom.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonResetZoom.Name = "buttonResetZoom"; + this.buttonResetZoom.Size = new System.Drawing.Size(144, 32); + this.buttonResetZoom.TabIndex = 5; + this.buttonResetZoom.Text = "Reset Zoom"; + this.buttonResetZoom.UseVisualStyleBackColor = true; + this.buttonResetZoom.Click += new System.EventHandler(this.ResetZoom_Click); + // + // tabControlProperties + // + this.tabControlProperties.Controls.Add(this.tabPageDefineStimuli); + this.tabControlProperties.Controls.Add(this.tabPageProperties); + this.tabControlProperties.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControlProperties.Location = new System.Drawing.Point(698, 3); + this.tabControlProperties.Name = "tabControlProperties"; + this.tableLayoutPanel1.SetRowSpan(this.tabControlProperties, 2); + this.tabControlProperties.SelectedIndex = 0; + this.tabControlProperties.Size = new System.Drawing.Size(445, 515); + this.tabControlProperties.TabIndex = 10; + // + // tabPageDefineStimuli + // + this.tabPageDefineStimuli.Location = new System.Drawing.Point(4, 25); + this.tabPageDefineStimuli.Name = "tabPageDefineStimuli"; + this.tabPageDefineStimuli.Padding = new System.Windows.Forms.Padding(3); + this.tabPageDefineStimuli.Size = new System.Drawing.Size(437, 486); + this.tabPageDefineStimuli.TabIndex = 0; + this.tabPageDefineStimuli.Text = "Define Stimuli"; + this.tabPageDefineStimuli.UseVisualStyleBackColor = true; + // + // tabPageProperties + // + this.tabPageProperties.Controls.Add(this.propertyGrid); + this.tabPageProperties.Location = new System.Drawing.Point(4, 25); + this.tabPageProperties.Name = "tabPageProperties"; + this.tabPageProperties.Padding = new System.Windows.Forms.Padding(3); + this.tabPageProperties.Size = new System.Drawing.Size(437, 486); + this.tabPageProperties.TabIndex = 1; + this.tabPageProperties.Text = "Properties"; + this.tabPageProperties.UseVisualStyleBackColor = true; + // + // propertyGrid + // + this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill; + this.propertyGrid.Location = new System.Drawing.Point(3, 3); + this.propertyGrid.Name = "propertyGrid"; + this.propertyGrid.Size = new System.Drawing.Size(431, 480); + this.propertyGrid.TabIndex = 0; + this.propertyGrid.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.PropertyValueChanged); // // GenericStimulusSequenceDialog // @@ -343,11 +309,10 @@ private void InitializeComponent() this.tableLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.ResumeLayout(false); this.panelWaveform.ResumeLayout(false); - this.tabControlVisualization.ResumeLayout(false); - this.tabPageWaveform.ResumeLayout(false); - this.tabPageTable.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.dataGridViewStimulusTable)).EndInit(); this.flowLayoutPanel2.ResumeLayout(false); + this.tabControlProperties.ResumeLayout(false); + this.tabPageProperties.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -361,21 +326,20 @@ private void InitializeComponent() private System.Windows.Forms.Button buttonOk; private System.Windows.Forms.MenuStrip menuStrip; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - internal System.Windows.Forms.Panel panelProbe; internal System.Windows.Forms.ToolStripMenuItem openFileToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem saveFileToolStripMenuItem; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; - internal System.Windows.Forms.GroupBox groupBoxDefineStimuli; - private System.Windows.Forms.Panel panelWaveform; - private ZedGraph.ZedGraphControl zedGraphWaveform; - private System.Windows.Forms.TabControl tabControlVisualization; - private System.Windows.Forms.TabPage tabPageWaveform; - private System.Windows.Forms.TabPage tabPageTable; - internal System.Windows.Forms.DataGridView dataGridViewStimulusTable; internal System.Windows.Forms.ToolStripMenuItem stimulusWaveformToolStripMenuItem; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; - private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button buttonResetZoom; + internal System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + internal System.Windows.Forms.Panel panelWaveform; + private ZedGraph.ZedGraphControl zedGraphWaveform; + internal System.Windows.Forms.TabPage tabPageDefineStimuli; + internal System.Windows.Forms.TabPage tabPageProperties; + internal System.Windows.Forms.PropertyGrid propertyGrid; + internal System.Windows.Forms.BindingSource bindingSource; + internal System.Windows.Forms.TabControl tabControlProperties; } } diff --git a/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs b/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs index 4176c064..a14d9073 100644 --- a/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs +++ b/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs @@ -12,9 +12,13 @@ namespace OpenEphys.Onix1.Design /// public partial class GenericStimulusSequenceDialog : Form { + internal object Device + { + get => propertyGrid.SelectedObject; + set => propertyGrid.SelectedObject = value; + } + readonly int NumberOfChannels; - readonly bool UseProbeGroup; - readonly bool UseTable; internal const double ZeroPeakToPeak = 1e-12; internal readonly double ChannelScale = 1.1; @@ -25,37 +29,23 @@ public partial class GenericStimulusSequenceDialog : Form InitializeComponent(); NumberOfChannels = 0; - UseProbeGroup = true; } /// - /// Opens a dialog allowing for easy changing of stimulus sequence parameters, with visual feedback on what the resulting stimulus sequence looks like. + /// Opens a dialog allowing for easy changing of stimulus sequence parameters, + /// with visual feedback on what the resulting stimulus sequence looks like. /// - public GenericStimulusSequenceDialog(int numberOfChannels, bool useProbeGroup, bool useTable = false) + public GenericStimulusSequenceDialog(object device, int numberOfChannels) { InitializeComponent(); Shown += FormShown; - NumberOfChannels = numberOfChannels; - UseProbeGroup = useProbeGroup; - UseTable = useTable; + Device = device; + bindingSource.DataSource = Device; - if (!UseProbeGroup) - { - tableLayoutPanel1.Controls.Remove(panelProbe); - GroupBox gb = tableLayoutPanel1.Controls[nameof(groupBoxDefineStimuli)] as GroupBox; - tableLayoutPanel1.SetRow(gb, 0); - tableLayoutPanel1.SetRowSpan(gb, 2); - } - - if (!UseTable) - { - panelWaveform.Controls.Remove(tabControlVisualization); - panelWaveform.Controls.Add(zedGraphWaveform); - } + NumberOfChannels = numberOfChannels; InitializeZedGraphWaveform(); - SetTableDataSource(); zedGraphWaveform.ZoomEvent += OnZoom_Waveform; zedGraphWaveform.MouseMoveEvent += MouseMoveEvent; @@ -210,8 +200,6 @@ internal void DrawStimulusWaveform(bool setZoomState = true) return Math.Abs(val).ToString("0"); }; - dataGridViewStimulusTable.Refresh(); - if (setZoomState && XMin != 0 && XMax != 0) { zedGraphWaveform.GraphPane.XAxis.Scale.Min = XMin; @@ -505,12 +493,6 @@ internal void HideMenuStrip() menuStrip.Enabled = false; } - internal virtual void SetTableDataSource() - { - if (UseTable) - throw new NotImplementedException(); - } - void ResetZoom_Click(object sender, EventArgs e) { ResetZoom(); @@ -524,5 +506,9 @@ void ResetZoom() zedGraphWaveform.Refresh(); } + void PropertyValueChanged(object s, PropertyValueChangedEventArgs e) + { + DrawStimulusWaveform(); + } } } diff --git a/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.resx b/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.resx index 43b3c732..b9fe649d 100644 --- a/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.resx +++ b/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.resx @@ -126,6 +126,9 @@ 626, 12 + + 724, 12 + 25 diff --git a/OpenEphys.Onix1.Design/Headstage64Dialog.Designer.cs b/OpenEphys.Onix1.Design/Headstage64Dialog.Designer.cs index 1b64c413..f2672787 100644 --- a/OpenEphys.Onix1.Design/Headstage64Dialog.Designer.cs +++ b/OpenEphys.Onix1.Design/Headstage64Dialog.Designer.cs @@ -97,7 +97,7 @@ private void InitializeComponent() this.buttonOK.UseVisualStyleBackColor = true; this.buttonOK.Click += new System.EventHandler(this.OnClickOk); // - // tabControl + // tabControlProperties // this.tabControl.Controls.Add(this.tabPageElectricalStimulator); this.tabControl.Controls.Add(this.tabPageOpticalStimulator); @@ -107,7 +107,7 @@ private void InitializeComponent() this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl.Location = new System.Drawing.Point(3, 2); this.tabControl.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.tabControl.Name = "tabControl"; + this.tabControl.Name = "tabControlProperties"; this.tabControl.SelectedIndex = 0; this.tabControl.Size = new System.Drawing.Size(1178, 541); this.tabControl.TabIndex = 1; diff --git a/OpenEphys.Onix1.Design/Headstage64Dialog.cs b/OpenEphys.Onix1.Design/Headstage64Dialog.cs index 613d7558..9f1e1117 100644 --- a/OpenEphys.Onix1.Design/Headstage64Dialog.cs +++ b/OpenEphys.Onix1.Design/Headstage64Dialog.cs @@ -22,13 +22,13 @@ public Headstage64Dialog(ConfigureHeadstage64 configureNode) { InitializeComponent(); - Rhd2164Dialog = new(new ConfigureRhd2164(configureNode.Rhd2164)); + Rhd2164Dialog = new(configureNode.Rhd2164); Rhd2164Dialog.SetChildFormProperties(this).AddDialogToTab(tabPageRhd2164); - Bno055Dialog = new(new ConfigureBno055(configureNode.Bno055)); + Bno055Dialog = new(configureNode.Bno055); Bno055Dialog.SetChildFormProperties(this).AddDialogToTab(tabPageBno055); - TS4231V1Dialog = new(new ConfigureTS4231V1(configureNode.TS4231)); + TS4231V1Dialog = new(configureNode.TS4231); TS4231V1Dialog.SetChildFormProperties(this).AddDialogToTab(tabPageTS4231); ElectricalStimulatorSequenceDialog = new(configureNode.ElectricalStimulator); diff --git a/OpenEphys.Onix1.Design/Headstage64Editor.cs b/OpenEphys.Onix1.Design/Headstage64Editor.cs index a3cb6774..d3c3d53f 100644 --- a/OpenEphys.Onix1.Design/Headstage64Editor.cs +++ b/OpenEphys.Onix1.Design/Headstage64Editor.cs @@ -18,7 +18,9 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon var editorState = (IWorkflowEditorState)provider.GetService(typeof(IWorkflowEditorState)); if (editorState != null && !editorState.WorkflowRunning && component is ConfigureHeadstage64 configureNode) { - using var editorDialog = new Headstage64Dialog(configureNode); + var configuration = new ConfigureHeadstage64(configureNode); + + using var editorDialog = new Headstage64Dialog(configuration); if (editorDialog.ShowDialog() == DialogResult.OK) { @@ -27,10 +29,10 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon DesignHelper.CopyProperties((ConfigureTS4231V1)editorDialog.TS4231V1Dialog.Device, configureNode.TS4231, DesignHelper.PropertiesToIgnore); if (editorDialog.ElectricalStimulatorSequenceDialog.DialogResult == DialogResult.OK) - configureNode.ElectricalStimulator = editorDialog.ElectricalStimulatorSequenceDialog.ElectricalStimulator; + DesignHelper.CopyProperties((ConfigureHeadstage64ElectricalStimulator)editorDialog.ElectricalStimulatorSequenceDialog.Device, configureNode.ElectricalStimulator, DesignHelper.PropertiesToIgnore); if (editorDialog.OpticalStimulatorSequenceDialog.DialogResult == DialogResult.OK) - configureNode.OpticalStimulator = editorDialog.OpticalStimulatorSequenceDialog.OpticalStimulator; + DesignHelper.CopyProperties((ConfigureHeadstage64OpticalStimulator)editorDialog.OpticalStimulatorSequenceDialog.Device, configureNode.OpticalStimulator, DesignHelper.PropertiesToIgnore); return true; } diff --git a/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorComponentEditor.cs b/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorComponentEditor.cs index 8da1c0dd..4a51d9de 100644 --- a/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorComponentEditor.cs +++ b/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorComponentEditor.cs @@ -15,7 +15,9 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon var editorState = (IWorkflowEditorState)provider.GetService(typeof(IWorkflowEditorState)); if (editorState != null && !editorState.WorkflowRunning && component is ConfigureHeadstage64ElectricalStimulator configureNode) { - using var editorDialog = new Headstage64ElectricalStimulatorSequenceDialog(configureNode); + var configuration = new ConfigureHeadstage64ElectricalStimulator(configureNode); + + using var editorDialog = new Headstage64ElectricalStimulatorSequenceDialog(configuration); if (editorDialog.ShowDialog() == DialogResult.OK) { diff --git a/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorOptions.cs b/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorOptions.cs index d5968551..e783ce04 100644 --- a/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorOptions.cs +++ b/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorOptions.cs @@ -21,6 +21,11 @@ public Headstage64ElectricalStimulatorOptions() /// public Headstage64ElectricalStimulatorOptions(ConfigureHeadstage64ElectricalStimulator electricalStimulator) : this() + { + UpdateControls(electricalStimulator); + } + + internal void UpdateControls(ConfigureHeadstage64ElectricalStimulator electricalStimulator) { textBoxPhaseOneCurrent.Text = electricalStimulator.PhaseOneCurrent.ToString(); textBoxPhaseOneDuration.Text = electricalStimulator.PhaseOneDuration.ToString(); diff --git a/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorSequenceDialog.cs b/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorSequenceDialog.cs index c5b749fd..a88085de 100644 --- a/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorSequenceDialog.cs +++ b/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorSequenceDialog.cs @@ -12,115 +12,127 @@ namespace OpenEphys.Onix1.Design /// public partial class Headstage64ElectricalStimulatorSequenceDialog : GenericStimulusSequenceDialog { - internal readonly ConfigureHeadstage64ElectricalStimulator ElectricalStimulator; + internal ConfigureHeadstage64ElectricalStimulator ElectricalStimulator + { + get => (ConfigureHeadstage64ElectricalStimulator)Device; + } readonly Headstage64ElectricalStimulatorOptions StimulusSequenceOptions; readonly static int NumberOfChannels = 1; - readonly Dictionary> currentBindings; - readonly Dictionary> timeBindings; - readonly Dictionary> countBindings; - /// /// Opens a dialog allowing for easy changing of stimulus sequence parameters, with /// visual feedback on what the resulting stimulus sequence looks like. /// /// Existing stimulus sequence. public Headstage64ElectricalStimulatorSequenceDialog(ConfigureHeadstage64ElectricalStimulator electricalStimulator) - : base(NumberOfChannels, false) + : base(electricalStimulator, NumberOfChannels) { InitializeComponent(); HideMenuStrip(); - ElectricalStimulator = new(electricalStimulator); - StimulusSequenceOptions = new(ElectricalStimulator); StimulusSequenceOptions.SetChildFormProperties(this); - groupBoxDefineStimuli.Controls.Add(StimulusSequenceOptions); - - currentBindings = new() - { - { StimulusSequenceOptions.textBoxPhaseOneCurrent, - new TextBoxBinding( - StimulusSequenceOptions.textBoxPhaseOneCurrent, - value => { ElectricalStimulator.PhaseOneCurrent = value; return ElectricalStimulator.PhaseOneCurrent; }, - double.Parse) }, - { StimulusSequenceOptions.textBoxInterPhaseCurrent, - new TextBoxBinding( - StimulusSequenceOptions.textBoxInterPhaseCurrent, - value => { ElectricalStimulator.InterPhaseCurrent = value; return ElectricalStimulator.InterPhaseCurrent; }, - double.Parse) }, - { StimulusSequenceOptions.textBoxPhaseTwoCurrent, - new TextBoxBinding( - StimulusSequenceOptions.textBoxPhaseTwoCurrent, - value => { ElectricalStimulator.PhaseTwoCurrent = value; return ElectricalStimulator.PhaseTwoCurrent; }, - double.Parse) } - }; - - timeBindings = new Dictionary> - { - { StimulusSequenceOptions.textBoxPhaseOneDuration, - new TextBoxBinding( - StimulusSequenceOptions.textBoxPhaseOneDuration, - value => { ElectricalStimulator.PhaseOneDuration = value; return ElectricalStimulator.PhaseOneDuration; }, - uint.Parse) }, - { StimulusSequenceOptions.textBoxPhaseTwoDuration, - new TextBoxBinding( - StimulusSequenceOptions.textBoxPhaseTwoDuration, - value => { ElectricalStimulator.PhaseTwoDuration = value; return ElectricalStimulator.PhaseTwoDuration; }, - uint.Parse) }, - { StimulusSequenceOptions.textBoxInterPhaseDuration, - new TextBoxBinding( - StimulusSequenceOptions.textBoxInterPhaseDuration, - value => { ElectricalStimulator.InterPhaseInterval = value; return ElectricalStimulator.InterPhaseInterval; }, - uint.Parse) }, - { StimulusSequenceOptions.textBoxInterBurstInterval, - new TextBoxBinding( - StimulusSequenceOptions.textBoxInterBurstInterval, - value => { ElectricalStimulator.InterBurstInterval = value; return ElectricalStimulator.InterBurstInterval; }, - uint.Parse) }, - { StimulusSequenceOptions.textBoxPulsePeriod, - new TextBoxBinding( - StimulusSequenceOptions.textBoxPulsePeriod, - value => { ElectricalStimulator.InterPulseInterval = value; return ElectricalStimulator.InterPulseInterval; }, - uint.Parse) }, - { StimulusSequenceOptions.textBoxTrainDelay, - new TextBoxBinding( - StimulusSequenceOptions.textBoxTrainDelay, - value => { ElectricalStimulator.TriggerDelay = value; return ElectricalStimulator.TriggerDelay; }, - uint.Parse) } - }; - - countBindings = new Dictionary> + tabPageDefineStimuli.Controls.Add(StimulusSequenceOptions); + + StimulusSequenceOptions.textBoxPhaseOneCurrent.DataBindings.Add( + "Text", + bindingSource, + nameof(ElectricalStimulator.PhaseOneCurrent), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxInterPhaseCurrent.DataBindings.Add( + "Text", + bindingSource, + nameof(ElectricalStimulator.InterPhaseCurrent), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxPhaseTwoCurrent.DataBindings.Add( + "Text", + bindingSource, + nameof(ElectricalStimulator.PhaseTwoCurrent), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxPhaseOneDuration.DataBindings.Add( + "Text", + bindingSource, + nameof(ElectricalStimulator.PhaseOneDuration), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxPhaseTwoDuration.DataBindings.Add( + "Text", + bindingSource, + nameof(ElectricalStimulator.PhaseTwoDuration), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxInterPhaseDuration.DataBindings.Add( + "Text", + bindingSource, + nameof(ElectricalStimulator.InterPhaseInterval), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxInterBurstInterval.DataBindings.Add( + "Text", + bindingSource, + nameof(ElectricalStimulator.InterBurstInterval), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxPulsePeriod.DataBindings.Add( + "Text", + bindingSource, + nameof(ElectricalStimulator.InterPulseInterval), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxTrainDelay.DataBindings.Add( + "Text", + bindingSource, + nameof(ElectricalStimulator.TriggerDelay), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxBurstPulseCount.DataBindings.Add( + "Text", + bindingSource, + nameof(ElectricalStimulator.BurstPulseCount), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxTrainBurstCount.DataBindings.Add( + "Text", + bindingSource, + nameof(ElectricalStimulator.TrainBurstCount), + false, + DataSourceUpdateMode.OnValidation); + + foreach (Control control in StimulusSequenceOptions.GetAllControls().OfType()) { - { StimulusSequenceOptions.textBoxBurstPulseCount, - new TextBoxBinding( - StimulusSequenceOptions.textBoxBurstPulseCount, - value => { ElectricalStimulator.BurstPulseCount = value; return ElectricalStimulator.BurstPulseCount; }, - uint.Parse) }, - { StimulusSequenceOptions.textBoxTrainBurstCount, - new TextBoxBinding( - StimulusSequenceOptions.textBoxTrainBurstCount, - value => { ElectricalStimulator.TrainBurstCount = value; return ElectricalStimulator.TrainBurstCount; }, - uint.Parse) } - }; + control.Validated += (sender, e) => + { + DrawStimulusWaveform(); + }; - foreach (var binding in currentBindings) - { - binding.Key.Leave += TextBoxChanged; - binding.Key.KeyPress += KeyPressed; - } + control.KeyPress += (sender, e) => + { + if (e.KeyChar == '\r' && sender is TextBox tb) + { + foreach (Binding binding in tb.DataBindings) + { + binding.WriteValue(); + } - foreach (var binding in timeBindings) - { - binding.Key.Leave += TextBoxChanged; - binding.Key.KeyPress += KeyPressed; - } + bindingSource.ResetCurrentItem(); - foreach (var binding in countBindings) - { - binding.Key.Leave += TextBoxChanged; - binding.Key.KeyPress += KeyPressed; + DrawStimulusWaveform(); + } + }; } StimulusSequenceOptions.Show(); @@ -134,57 +146,26 @@ public Headstage64ElectricalStimulatorSequenceDialog(ConfigureHeadstage64Electri DisableVerticalZoom(); DrawStimulusWaveform(); - } - void TextBoxChanged(object sender, EventArgs e) - { - if (sender is TextBox textBox) + bindingSource.ListChanged += (sender, eventArgs) => propertyGrid.Refresh(); + + tabControlProperties.SelectedIndexChanged += (sender, eventArgs) => { - if (currentBindings.ContainsKey(textBox)) - { - currentBindings[textBox].UpdateFromTextBox(); - } - else if (timeBindings.ContainsKey(textBox)) - { - timeBindings[textBox].UpdateFromTextBox(); - } - else if (countBindings.ContainsKey(textBox)) - { - countBindings[textBox].UpdateFromTextBox(); - } - else - { - throw new Exception($"No valid text box found when updating parameters in {nameof(Headstage64ElectricalStimulatorSequenceDialog)}"); - } + if (tabControlProperties.SelectedTab == tabPageProperties) + propertyGrid.Refresh(); - SetStatusValidity(); - DrawStimulusWaveform(); - } + else if (tabControlProperties.SelectedTab == tabPageDefineStimuli) + bindingSource.ResetCurrentItem(); + }; } internal void SetTextBoxBackgroundDefault() { - foreach (var binding in currentBindings) - { - SetTextBoxBackgroundDefault(binding.Key); - } - - foreach (var binding in timeBindings) - { - SetTextBoxBackgroundDefault(binding.Key); - } + var textBoxes = StimulusSequenceOptions.GetAllControls().OfType(); - foreach (var binding in countBindings) - { - SetTextBoxBackgroundDefault(binding.Key); - } - } - - void KeyPressed(object sender, KeyPressEventArgs e) - { - if (e.KeyChar == '\r' && sender is TextBox) + foreach (var textBox in textBoxes) { - TextBoxChanged(sender, e); + SetTextBoxBackgroundDefault(textBox); } } diff --git a/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorUITypeEditor.cs b/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorUITypeEditor.cs index 38c17fda..701c680b 100644 --- a/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorUITypeEditor.cs +++ b/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorUITypeEditor.cs @@ -28,7 +28,9 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide if (editorService != null && editorState != null && !editorState.WorkflowRunning && value is ConfigureHeadstage64ElectricalStimulator configureNode) { - using var editorDialog = new Headstage64ElectricalStimulatorSequenceDialog(configureNode); + var configuration = new ConfigureHeadstage64ElectricalStimulator(configureNode); + + using var editorDialog = new Headstage64ElectricalStimulatorSequenceDialog(configuration); if (editorDialog.ShowDialog() == DialogResult.OK) { diff --git a/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorComponentEditor.cs b/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorComponentEditor.cs index 7afc9a39..c2327e89 100644 --- a/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorComponentEditor.cs +++ b/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorComponentEditor.cs @@ -14,7 +14,9 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon var editorState = (IWorkflowEditorState)provider.GetService(typeof(IWorkflowEditorState)); if (editorState != null && !editorState.WorkflowRunning && component is ConfigureHeadstage64OpticalStimulator configureNode) { - using var editorDialog = new Headstage64OpticalStimulatorSequenceDialog(configureNode); + var configuration = new ConfigureHeadstage64OpticalStimulator(configureNode); + + using var editorDialog = new Headstage64OpticalStimulatorSequenceDialog(configuration); if (editorDialog.ShowDialog() == DialogResult.OK) { diff --git a/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorSequenceDialog.cs b/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorSequenceDialog.cs index 66611490..ca15b8d1 100644 --- a/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorSequenceDialog.cs +++ b/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorSequenceDialog.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Drawing; -using System.IO; using System.Linq; using System.Windows.Forms; using ZedGraph; @@ -15,116 +14,114 @@ public partial class Headstage64OpticalStimulatorSequenceDialog : GenericStimulu { readonly static int NumberOfChannels = 2; - internal readonly ConfigureHeadstage64OpticalStimulator OpticalStimulator; + internal ConfigureHeadstage64OpticalStimulator OpticalStimulator + { + get => (ConfigureHeadstage64OpticalStimulator)Device; + } readonly Headstage64OpticalStimulatorOptions StimulusSequenceOptions; - readonly Dictionary> currentBindings; - readonly Dictionary> timeBindings; - readonly Dictionary> countBindings; - /// /// Opens a dialog allowing for easy changing of stimulus sequence parameters, with /// visual feedback on what the resulting stimulus sequence looks like. /// /// Existing stimulus sequence. public Headstage64OpticalStimulatorSequenceDialog(ConfigureHeadstage64OpticalStimulator opticalStimulator) - : base(NumberOfChannels, false) + : base(opticalStimulator, NumberOfChannels) { InitializeComponent(); HideMenuStrip(); - OpticalStimulator = new(opticalStimulator); - StimulusSequenceOptions = new(OpticalStimulator); StimulusSequenceOptions.SetChildFormProperties(this); - groupBoxDefineStimuli.Controls.Add(StimulusSequenceOptions); + tabPageDefineStimuli.Controls.Add(StimulusSequenceOptions); StimulusSequenceOptions.trackBarChannelOnePercent.Scroll += ChannelPercentTrackBarChanged; StimulusSequenceOptions.trackBarChannelTwoPercent.Scroll += ChannelPercentTrackBarChanged; - currentBindings = new() - { - { StimulusSequenceOptions.textBoxMaxCurrent, - new TextBoxBinding( - StimulusSequenceOptions.textBoxMaxCurrent, - value => { OpticalStimulator.MaxCurrent = value; return OpticalStimulator.MaxCurrent; }, - double.Parse) }, - { StimulusSequenceOptions.textBoxChannelOnePercent, - new TextBoxBinding( - StimulusSequenceOptions.textBoxChannelOnePercent, - value => - { - OpticalStimulator.ChannelOneCurrent = value; - StimulusSequenceOptions.trackBarChannelOnePercent.Value = (int)(OpticalStimulator.ChannelOneCurrent * StimulusSequenceOptions.channelOneScalingFactor); - return OpticalStimulator.ChannelOneCurrent; - }, - double.Parse) }, - { StimulusSequenceOptions.textBoxChannelTwoPercent, - new TextBoxBinding( - StimulusSequenceOptions.textBoxChannelTwoPercent, - value => - { - OpticalStimulator.ChannelTwoCurrent = value; - StimulusSequenceOptions.trackBarChannelTwoPercent.Value = (int)(OpticalStimulator.ChannelTwoCurrent * StimulusSequenceOptions.channelTwoScalingFactor); - return OpticalStimulator.ChannelTwoCurrent; - }, - double.Parse) } - }; - - timeBindings = new() - { - { StimulusSequenceOptions.textBoxInterBurstInterval, - new TextBoxBinding( - StimulusSequenceOptions.textBoxInterBurstInterval, - value => { OpticalStimulator.InterBurstInterval = value; return OpticalStimulator.InterBurstInterval; }, - double.Parse) }, - { StimulusSequenceOptions.textBoxDelay, - new TextBoxBinding( - StimulusSequenceOptions.textBoxDelay, - value => { OpticalStimulator.Delay = value; return OpticalStimulator.Delay; }, - double.Parse) }, - { StimulusSequenceOptions.textBoxPulseDuration, - new TextBoxBinding( - StimulusSequenceOptions.textBoxPulseDuration, - value => { OpticalStimulator.PulseDuration = value; return OpticalStimulator.PulseDuration; }, - double.Parse) }, - { StimulusSequenceOptions.textBoxPulsePeriod, - new TextBoxBinding( - StimulusSequenceOptions.textBoxPulsePeriod, - value => { OpticalStimulator.PulsesPerSecond = value; return OpticalStimulator.PulsesPerSecond; }, - double.Parse) }, - }; - - countBindings = new() + StimulusSequenceOptions.textBoxMaxCurrent.DataBindings.Add( + "Text", + bindingSource, + nameof(OpticalStimulator.MaxCurrent), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxChannelOnePercent.DataBindings.Add( + "Text", + bindingSource, + nameof(OpticalStimulator.ChannelOneCurrent), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxChannelTwoPercent.DataBindings.Add( + "Text", + bindingSource, + nameof(OpticalStimulator.ChannelTwoCurrent), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxInterBurstInterval.DataBindings.Add( + "Text", + bindingSource, + nameof(OpticalStimulator.InterBurstInterval), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxDelay.DataBindings.Add( + "Text", + bindingSource, + nameof(OpticalStimulator.Delay), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxPulseDuration.DataBindings.Add( + "Text", + bindingSource, + nameof(OpticalStimulator.PulseDuration), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxPulsePeriod.DataBindings.Add( + "Text", + bindingSource, + nameof(OpticalStimulator.PulsesPerSecond), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxPulsesPerBurst.DataBindings.Add( + "Text", + bindingSource, + nameof(OpticalStimulator.PulsesPerBurst), + false, + DataSourceUpdateMode.OnValidation); + + StimulusSequenceOptions.textBoxBurstsPerTrain.DataBindings.Add( + "Text", + bindingSource, + nameof(OpticalStimulator.BurstsPerTrain), + false, + DataSourceUpdateMode.OnValidation); + + foreach (Control control in StimulusSequenceOptions.GetAllControls().OfType()) { - { StimulusSequenceOptions.textBoxPulsesPerBurst, - new TextBoxBinding( - StimulusSequenceOptions.textBoxPulsesPerBurst, - value => { OpticalStimulator.PulsesPerBurst = value; return OpticalStimulator.PulsesPerBurst; }, - uint.Parse) }, - { StimulusSequenceOptions.textBoxBurstsPerTrain, - new TextBoxBinding( - StimulusSequenceOptions.textBoxBurstsPerTrain, - value => { OpticalStimulator.BurstsPerTrain = value; return OpticalStimulator.BurstsPerTrain; }, - uint.Parse) } - }; + control.Validated += (sender, e) => + { + DrawStimulusWaveform(); + }; - foreach (var binding in currentBindings) - { - binding.Key.Leave += TextBoxChanged; - binding.Key.KeyPress += KeyPressed; - } + control.KeyPress += (sender, e) => + { + if (e.KeyChar == '\r' && sender is TextBox tb) + { + foreach (Binding binding in tb.DataBindings) + { + binding.WriteValue(); + } - foreach (var binding in timeBindings) - { - binding.Key.Leave += TextBoxChanged; - binding.Key.KeyPress += KeyPressed; - } + bindingSource.ResetCurrentItem(); - foreach (var binding in countBindings) - { - binding.Key.Leave += TextBoxChanged; - binding.Key.KeyPress += KeyPressed; + DrawStimulusWaveform(); + } + }; } StimulusSequenceOptions.Show(); @@ -138,41 +135,16 @@ public Headstage64OpticalStimulatorSequenceDialog(ConfigureHeadstage64OpticalSti DrawStimulusWaveform(); - stimulusWaveformToolStripMenuItem.Text = "Optical Stimulus Sequence"; - } + bindingSource.ListChanged += (sender, eventArgs) => propertyGrid.Refresh(); - void KeyPressed(object sender, KeyPressEventArgs e) - { - if (e.KeyChar == '\r' && sender is TextBox) + tabControlProperties.SelectedIndexChanged += (sender, eventArgs) => { - TextBoxChanged(sender, e); - } - } + if (tabControlProperties.SelectedTab == tabPageProperties) + propertyGrid.Refresh(); - void TextBoxChanged(object sender, EventArgs e) - { - if (sender is TextBox textBox) - { - if (currentBindings.TryGetValue(textBox, out var currentBinding)) - { - currentBinding.UpdateFromTextBox(); - } - else if (timeBindings.TryGetValue(textBox, out var timeBinding)) - { - timeBinding.UpdateFromTextBox(); - } - else if (countBindings.TryGetValue(textBox, out var countBinding)) - { - countBinding.UpdateFromTextBox(); - } - else - { - throw new NotImplementedException($"No valid text box found when updating parameters in {nameof(Headstage64OpticalStimulatorSequenceDialog)}"); - } - - SetTextBoxBackgroundDefault(textBox); - DrawStimulusWaveform(); - } + else if (tabControlProperties.SelectedTab == tabPageDefineStimuli) + bindingSource.ResetCurrentItem(); + }; } void ChannelPercentTrackBarChanged(object sender, EventArgs eventArgs) @@ -196,6 +168,8 @@ void ChannelPercentTrackBarChanged(object sender, EventArgs eventArgs) throw new NotImplementedException($"Could not find a valid track bar when updating parameters in {nameof(Headstage64OpticalStimulatorSequenceDialog)}"); } + propertyGrid.Refresh(); + DrawStimulusWaveform(); } } diff --git a/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorUITypeEditor.cs b/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorUITypeEditor.cs index fdf00b2a..d6736e7e 100644 --- a/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorUITypeEditor.cs +++ b/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorUITypeEditor.cs @@ -28,7 +28,9 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide if (editorService != null && editorState != null && !editorState.WorkflowRunning && value is ConfigureHeadstage64OpticalStimulator configureNode) { - using var editorDialog = new Headstage64OpticalStimulatorSequenceDialog(configureNode); + var configuration = new ConfigureHeadstage64OpticalStimulator(configureNode); + + using var editorDialog = new Headstage64OpticalStimulatorSequenceDialog(configuration); if (editorDialog.ShowDialog() == DialogResult.OK) { diff --git a/OpenEphys.Onix1.Design/HeadstageRhs2116Dialog.cs b/OpenEphys.Onix1.Design/HeadstageRhs2116Dialog.cs index 354523a7..6f1ba0d6 100644 --- a/OpenEphys.Onix1.Design/HeadstageRhs2116Dialog.cs +++ b/OpenEphys.Onix1.Design/HeadstageRhs2116Dialog.cs @@ -29,7 +29,7 @@ public HeadstageRhs2116Dialog(ConfigureRhs2116Trigger rhs2116Trigger, ConfigureR StimulusSequenceDialog.SetChildFormProperties(this).AddDialogToTab(tabPageStimulusSequence); this.AddMenuItemsFromDialogToFileOption(StimulusSequenceDialog); - Rhs2116Dialog = new(new ConfigureRhs2116Pair(rhs2116)); + Rhs2116Dialog = new(rhs2116); Rhs2116Dialog.SetChildFormProperties(this).AddDialogToTab(tabPageRhs2116); } diff --git a/OpenEphys.Onix1.Design/HeadstageRhs2116Editor.cs b/OpenEphys.Onix1.Design/HeadstageRhs2116Editor.cs index 3e6d5dbe..af2662fd 100644 --- a/OpenEphys.Onix1.Design/HeadstageRhs2116Editor.cs +++ b/OpenEphys.Onix1.Design/HeadstageRhs2116Editor.cs @@ -18,11 +18,14 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon var editorState = (IWorkflowEditorState)provider.GetService(typeof(IWorkflowEditorState)); if (editorState != null && !editorState.WorkflowRunning && component is ConfigureHeadstageRhs2116 configureNode) { - using var editorDialog = new HeadstageRhs2116Dialog(configureNode.StimulusTrigger, configureNode.Rhs2116Pair); + var configuration = new ConfigureHeadstageRhs2116(configureNode); + + using var editorDialog = new HeadstageRhs2116Dialog(configuration.StimulusTrigger, configuration.Rhs2116Pair); if (editorDialog.ShowDialog() == DialogResult.OK) { - configureNode.StimulusTrigger = editorDialog.StimulusSequenceDialog.Trigger; + DesignHelper.CopyProperties(editorDialog.StimulusSequenceDialog.Trigger, configureNode.StimulusTrigger, DesignHelper.PropertiesToIgnore); + DesignHelper.CopyProperties((ConfigureRhs2116Pair)editorDialog.Rhs2116Dialog.Device, configureNode.Rhs2116Pair, DesignHelper.PropertiesToIgnore); return true; diff --git a/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceDialog.cs b/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceDialog.cs index 7909238e..88605ec8 100644 --- a/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceDialog.cs +++ b/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceDialog.cs @@ -12,12 +12,21 @@ namespace OpenEphys.Onix1.Design /// public partial class Rhs2116StimulusSequenceDialog : GenericStimulusSequenceDialog { + readonly TabControl tabControlVisualization = new(); + readonly TabPage tabPageWaveform = new(); + readonly TabPage tabPageTable = new(); + readonly DataGridView dataGridViewStimulusTable = new(); + const double SamplePeriodMilliSeconds = 1e3 / Rhs2116.SampleFrequencyHz; const int NumberOfChannels = 32; internal Rhs2116StimulusSequencePair Sequence { get => Trigger.StimulusSequence; } - internal ConfigureRhs2116Trigger Trigger { get; set; } + internal ConfigureRhs2116Trigger Trigger + { + get => (ConfigureRhs2116Trigger)Device; + private set => Device = value; + } readonly Rhs2116StimulusSequencePair SequenceCopy = new(); @@ -39,7 +48,7 @@ public partial class Rhs2116StimulusSequenceDialog : GenericStimulusSequenceDial /// /// Existing object. public Rhs2116StimulusSequenceDialog(ConfigureRhs2116Trigger rhs2116Trigger) - : base(NumberOfChannels, true, true) + : base(rhs2116Trigger, NumberOfChannels) { if (rhs2116Trigger.ProbeGroup.NumberOfContacts != NumberOfChannels) { @@ -48,7 +57,46 @@ public Rhs2116StimulusSequenceDialog(ConfigureRhs2116Trigger rhs2116Trigger) InitializeComponent(); - Trigger = new(rhs2116Trigger); + // NB: Add a tabbed control to show the table of stimuli values + tableLayoutPanel1.Controls.Remove(panelWaveform); + + tabControlVisualization.SuspendLayout(); + tabPageWaveform.SuspendLayout(); + tabPageTable.SuspendLayout(); + + tabControlVisualization.Controls.Add(tabPageWaveform); + tabControlVisualization.Controls.Add(tabPageTable); + tabControlVisualization.Dock = DockStyle.Fill; + tabControlVisualization.Name = nameof(tabControlVisualization); + + tabPageWaveform.Controls.Add(panelWaveform); + tabPageWaveform.Name = nameof(tabPageWaveform); + tabPageWaveform.Text = "Stimulus Waveform"; + tabPageWaveform.UseVisualStyleBackColor = true; + + tabPageTable.Controls.Add(dataGridViewStimulusTable); + tabPageTable.Name = nameof(tabPageTable); + tabPageTable.Text = "Table"; + tabPageTable.UseVisualStyleBackColor = true; + + dataGridViewStimulusTable.AllowUserToAddRows = false; + dataGridViewStimulusTable.AllowUserToDeleteRows = false; + dataGridViewStimulusTable.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridViewStimulusTable.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewStimulusTable.Dock = DockStyle.Fill; + dataGridViewStimulusTable.Name = nameof(dataGridViewStimulusTable); + dataGridViewStimulusTable.ReadOnly = true; + dataGridViewStimulusTable.RowHeadersWidth = 62; + dataGridViewStimulusTable.RowTemplate.Height = 24; + dataGridViewStimulusTable.TabStop = false; + + tableLayoutPanel1.Controls.Add(tabControlVisualization); + + tabControlVisualization.ResumeLayout(false); + tabPageWaveform.ResumeLayout(false); + tabPageTable.ResumeLayout(false); + + Trigger = rhs2116Trigger; dataGridViewStimulusTable.DataBindingComplete += DataBindingComplete; SetTableDataSource(); @@ -64,17 +112,8 @@ public Rhs2116StimulusSequenceDialog(ConfigureRhs2116Trigger rhs2116Trigger) StepSize = Sequence.CurrentStepSize; - ChannelDialog = new(rhs2116Trigger.ProbeGroup); - - ChannelDialog.SetChildFormProperties(this).AddDialogToPanel(panelProbe); - this.AddMenuItemsFromDialogToFileOption(ChannelDialog, "Channel Configuration"); - - ChannelDialog.OnSelect += OnSelect; - ChannelDialog.OnZoom += OnZoom; - ChannelDialog.OnFileLoad += OnFileLoad; - StimulusSequenceOptions = new(); - groupBoxDefineStimuli.Controls.Add(StimulusSequenceOptions.SetChildFormProperties(this)); + tabPageDefineStimuli.Controls.Add(StimulusSequenceOptions.SetChildFormProperties(this)); StimulusSequenceOptions.buttonAddPulses.Click += ButtonAddPulses_Click; StimulusSequenceOptions.buttonReadPulses.Click += ButtonReadPulses_Click; @@ -107,6 +146,14 @@ public Rhs2116StimulusSequenceDialog(ConfigureRhs2116Trigger rhs2116Trigger) StimulusSequenceOptions.numericUpDownNumberOfPulses.KeyDown += NumericUpDownNumberOfPulses_KeyDown; StimulusSequenceOptions.numericUpDownNumberOfPulses.Leave += NumericUpDownNumberOfPulses_Leave; + ChannelDialog = new(rhs2116Trigger.ProbeGroup); + + ChannelDialog.SetChildFormProperties(this).AddDialogToPanel(StimulusSequenceOptions.panelProbe); + this.AddMenuItemsFromDialogToFileOption(ChannelDialog, "Channel Configuration"); + + ChannelDialog.OnSelect += OnSelect; + ChannelDialog.OnZoom += OnZoom; + StimulusSequenceOptions.Show(); StimulusSequenceOptions.textBoxStepSize.Text = GetStepSizeStringuA(StepSize); @@ -114,11 +161,6 @@ public Rhs2116StimulusSequenceDialog(ConfigureRhs2116Trigger rhs2116Trigger) DrawStimulusWaveform(); } - void OnFileLoad(object sender, EventArgs e) - { - Trigger.ProbeGroup = (Rhs2116ProbeGroup)ChannelDialog.ProbeGroup; - } - internal void OnZoom(object sender, EventArgs e) { ChannelDialog.UpdateFontSize(); @@ -923,7 +965,7 @@ internal override void DeserializeStimulusSequence(string fileName) } } - internal override void SetTableDataSource() + internal void SetTableDataSource() { dataGridViewStimulusTable.DataSource = Trigger?.StimulusSequence.Stimuli; } diff --git a/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceEditor.cs b/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceEditor.cs index 7c5a211a..ec0bae46 100644 --- a/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceEditor.cs +++ b/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceEditor.cs @@ -18,7 +18,9 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon var editorState = (IWorkflowEditorState)provider.GetService(typeof(IWorkflowEditorState)); if (editorState != null && !editorState.WorkflowRunning && component is ConfigureRhs2116Trigger configureNode) { - using var editorDialog = new Rhs2116StimulusSequenceDialog(configureNode); + var configuration = new ConfigureRhs2116Trigger(configureNode); + + using var editorDialog = new Rhs2116StimulusSequenceDialog(configuration); if (editorDialog.ShowDialog() == DialogResult.OK) { diff --git a/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceOptions.Designer.cs b/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceOptions.Designer.cs index b8f24ee8..10520f42 100644 --- a/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceOptions.Designer.cs +++ b/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceOptions.Designer.cs @@ -57,15 +57,19 @@ private void InitializeComponent() this.checkboxBiphasicSymmetrical = new System.Windows.Forms.CheckBox(); this.textboxInterStimulusInterval = new System.Windows.Forms.TextBox(); this.labelInterStimulusInterval = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.panelProbe = new System.Windows.Forms.Panel(); this.panelParameters.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownNumberOfPulses)).BeginInit(); this.groupBoxCathode.SuspendLayout(); this.groupBoxAnode.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // panelParameters // this.panelParameters.AutoScroll = true; + this.panelParameters.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panelParameters.Controls.Add(this.numericUpDownNumberOfPulses); this.panelParameters.Controls.Add(this.textBoxStepSize); this.panelParameters.Controls.Add(this.groupBoxCathode); @@ -84,15 +88,15 @@ private void InitializeComponent() this.panelParameters.Controls.Add(this.textboxInterStimulusInterval); this.panelParameters.Controls.Add(this.labelInterStimulusInterval); this.panelParameters.Dock = System.Windows.Forms.DockStyle.Fill; - this.panelParameters.Location = new System.Drawing.Point(0, 0); + this.panelParameters.Location = new System.Drawing.Point(3, 225); this.panelParameters.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panelParameters.Name = "panelParameters"; - this.panelParameters.Size = new System.Drawing.Size(438, 289); + this.panelParameters.Size = new System.Drawing.Size(432, 286); this.panelParameters.TabIndex = 1; // // numericUpDownNumberOfPulses // - this.numericUpDownNumberOfPulses.Location = new System.Drawing.Point(363, 203); + this.numericUpDownNumberOfPulses.Location = new System.Drawing.Point(355, 203); this.numericUpDownNumberOfPulses.Maximum = new decimal(new int[] { 10000, 0, @@ -110,7 +114,7 @@ private void InitializeComponent() // textBoxStepSize // this.textBoxStepSize.Enabled = false; - this.textBoxStepSize.Location = new System.Drawing.Point(256, 32); + this.textBoxStepSize.Location = new System.Drawing.Point(248, 32); this.textBoxStepSize.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxStepSize.Name = "textBoxStepSize"; this.textBoxStepSize.ReadOnly = true; @@ -125,7 +129,7 @@ private void InitializeComponent() this.groupBoxCathode.Controls.Add(this.labelPulseWidthCathodic); this.groupBoxCathode.Controls.Add(this.textboxPulseWidthCathodic); this.groupBoxCathode.Controls.Add(this.textboxAmplitudeCathodicRequested); - this.groupBoxCathode.Location = new System.Drawing.Point(231, 94); + this.groupBoxCathode.Location = new System.Drawing.Point(223, 94); this.groupBoxCathode.Margin = new System.Windows.Forms.Padding(4); this.groupBoxCathode.Name = "groupBoxCathode"; this.groupBoxCathode.Padding = new System.Windows.Forms.Padding(4); @@ -186,7 +190,7 @@ private void InitializeComponent() this.groupBoxAnode.Controls.Add(this.labelPulseWidthAnodic); this.groupBoxAnode.Controls.Add(this.textboxPulseWidthAnodic); this.groupBoxAnode.Controls.Add(this.textboxAmplitudeAnodicRequested); - this.groupBoxAnode.Location = new System.Drawing.Point(13, 94); + this.groupBoxAnode.Location = new System.Drawing.Point(5, 94); this.groupBoxAnode.Margin = new System.Windows.Forms.Padding(4); this.groupBoxAnode.Name = "groupBoxAnode"; this.groupBoxAnode.Padding = new System.Windows.Forms.Padding(4); @@ -242,7 +246,7 @@ private void InitializeComponent() // buttonClearPulses // this.buttonClearPulses.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); - this.buttonClearPulses.Location = new System.Drawing.Point(19, 238); + this.buttonClearPulses.Location = new System.Drawing.Point(7, 238); this.buttonClearPulses.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonClearPulses.Name = "buttonClearPulses"; this.buttonClearPulses.Size = new System.Drawing.Size(99, 34); @@ -253,7 +257,7 @@ private void InitializeComponent() // buttonReadPulses // this.buttonReadPulses.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); - this.buttonReadPulses.Location = new System.Drawing.Point(123, 238); + this.buttonReadPulses.Location = new System.Drawing.Point(112, 238); this.buttonReadPulses.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonReadPulses.Name = "buttonReadPulses"; this.buttonReadPulses.Size = new System.Drawing.Size(100, 34); @@ -263,7 +267,7 @@ private void InitializeComponent() // // textboxInterPulseInterval // - this.textboxInterPulseInterval.Location = new System.Drawing.Point(363, 66); + this.textboxInterPulseInterval.Location = new System.Drawing.Point(355, 66); this.textboxInterPulseInterval.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textboxInterPulseInterval.Name = "textboxInterPulseInterval"; this.textboxInterPulseInterval.Size = new System.Drawing.Size(55, 22); @@ -272,7 +276,7 @@ private void InitializeComponent() // labelInterPulseInterval // this.labelInterPulseInterval.AutoSize = true; - this.labelInterPulseInterval.Location = new System.Drawing.Point(251, 70); + this.labelInterPulseInterval.Location = new System.Drawing.Point(243, 70); this.labelInterPulseInterval.Name = "labelInterPulseInterval"; this.labelInterPulseInterval.Size = new System.Drawing.Size(99, 16); this.labelInterPulseInterval.TabIndex = 6; @@ -281,7 +285,7 @@ private void InitializeComponent() // labelStepSizeAmplitude // this.labelStepSizeAmplitude.AutoSize = true; - this.labelStepSizeAmplitude.Location = new System.Drawing.Point(251, 14); + this.labelStepSizeAmplitude.Location = new System.Drawing.Point(243, 14); this.labelStepSizeAmplitude.Name = "labelStepSizeAmplitude"; this.labelStepSizeAmplitude.Size = new System.Drawing.Size(135, 16); this.labelStepSizeAmplitude.TabIndex = 2; @@ -293,7 +297,7 @@ private void InitializeComponent() this.checkBoxAnodicFirst.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.checkBoxAnodicFirst.Checked = true; this.checkBoxAnodicFirst.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxAnodicFirst.Location = new System.Drawing.Point(91, 33); + this.checkBoxAnodicFirst.Location = new System.Drawing.Point(83, 33); this.checkBoxAnodicFirst.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.checkBoxAnodicFirst.Name = "checkBoxAnodicFirst"; this.checkBoxAnodicFirst.Size = new System.Drawing.Size(96, 20); @@ -304,7 +308,7 @@ private void InitializeComponent() // buttonAddPulses // this.buttonAddPulses.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); - this.buttonAddPulses.Location = new System.Drawing.Point(318, 238); + this.buttonAddPulses.Location = new System.Drawing.Point(310, 238); this.buttonAddPulses.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonAddPulses.Name = "buttonAddPulses"; this.buttonAddPulses.Size = new System.Drawing.Size(100, 34); @@ -314,7 +318,7 @@ private void InitializeComponent() // // textboxDelay // - this.textboxDelay.Location = new System.Drawing.Point(143, 66); + this.textboxDelay.Location = new System.Drawing.Point(135, 66); this.textboxDelay.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textboxDelay.Name = "textboxDelay"; this.textboxDelay.Size = new System.Drawing.Size(55, 22); @@ -323,7 +327,7 @@ private void InitializeComponent() // labelNumberOfPulses // this.labelNumberOfPulses.AutoSize = true; - this.labelNumberOfPulses.Location = new System.Drawing.Point(237, 206); + this.labelNumberOfPulses.Location = new System.Drawing.Point(229, 206); this.labelNumberOfPulses.Name = "labelNumberOfPulses"; this.labelNumberOfPulses.Size = new System.Drawing.Size(113, 16); this.labelNumberOfPulses.TabIndex = 12; @@ -332,7 +336,7 @@ private void InitializeComponent() // labelDelay // this.labelDelay.AutoSize = true; - this.labelDelay.Location = new System.Drawing.Point(61, 70); + this.labelDelay.Location = new System.Drawing.Point(53, 70); this.labelDelay.Name = "labelDelay"; this.labelDelay.Size = new System.Drawing.Size(72, 16); this.labelDelay.TabIndex = 4; @@ -344,7 +348,7 @@ private void InitializeComponent() this.checkboxBiphasicSymmetrical.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.checkboxBiphasicSymmetrical.Checked = true; this.checkboxBiphasicSymmetrical.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkboxBiphasicSymmetrical.Location = new System.Drawing.Point(43, 14); + this.checkboxBiphasicSymmetrical.Location = new System.Drawing.Point(35, 14); this.checkboxBiphasicSymmetrical.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.checkboxBiphasicSymmetrical.Name = "checkboxBiphasicSymmetrical"; this.checkboxBiphasicSymmetrical.Size = new System.Drawing.Size(144, 20); @@ -354,7 +358,7 @@ private void InitializeComponent() // // textboxInterStimulusInterval // - this.textboxInterStimulusInterval.Location = new System.Drawing.Point(143, 201); + this.textboxInterStimulusInterval.Location = new System.Drawing.Point(135, 201); this.textboxInterStimulusInterval.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textboxInterStimulusInterval.Name = "textboxInterStimulusInterval"; this.textboxInterStimulusInterval.Size = new System.Drawing.Size(55, 22); @@ -363,18 +367,41 @@ private void InitializeComponent() // labelInterStimulusInterval // this.labelInterStimulusInterval.AutoSize = true; - this.labelInterStimulusInterval.Location = new System.Drawing.Point(15, 204); + this.labelInterStimulusInterval.Location = new System.Drawing.Point(7, 204); this.labelInterStimulusInterval.Name = "labelInterStimulusInterval"; this.labelInterStimulusInterval.Size = new System.Drawing.Size(115, 16); this.labelInterStimulusInterval.TabIndex = 10; this.labelInterStimulusInterval.Text = "Inter-Stimulus [ms]"; // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.panelParameters, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.panelProbe, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 290F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(438, 513); + this.tableLayoutPanel1.TabIndex = 2; + // + // panelProbe + // + this.panelProbe.Dock = System.Windows.Forms.DockStyle.Fill; + this.panelProbe.Location = new System.Drawing.Point(3, 3); + this.panelProbe.Name = "panelProbe"; + this.panelProbe.Size = new System.Drawing.Size(432, 217); + this.panelProbe.TabIndex = 2; + // // Rhs2116StimulusSequenceOptions // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(438, 289); - this.Controls.Add(this.panelParameters); + this.ClientSize = new System.Drawing.Size(438, 513); + this.Controls.Add(this.tableLayoutPanel1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "Rhs2116StimulusSequenceOptions"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; @@ -386,6 +413,7 @@ private void InitializeComponent() this.groupBoxCathode.PerformLayout(); this.groupBoxAnode.ResumeLayout(false); this.groupBoxAnode.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); this.ResumeLayout(false); } @@ -420,5 +448,7 @@ private void InitializeComponent() internal System.Windows.Forms.TextBox textboxInterStimulusInterval; private System.Windows.Forms.Label labelInterStimulusInterval; internal System.Windows.Forms.NumericUpDown numericUpDownNumberOfPulses; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + internal System.Windows.Forms.Panel panelProbe; } } diff --git a/OpenEphys.Onix1.Design/TextBoxBinding.cs b/OpenEphys.Onix1.Design/TextBoxBinding.cs deleted file mode 100644 index 06497398..00000000 --- a/OpenEphys.Onix1.Design/TextBoxBinding.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace OpenEphys.Onix1.Design -{ - internal class TextBoxBinding - { - readonly TextBox textBox; - readonly Func setter; - readonly Func parser; - readonly T defaultValue; - - public TextBoxBinding( - TextBox textBox, - Func setter, - Func parser, - T defaultValue = default) - { - this.textBox = textBox; - this.setter = setter; - this.parser = parser; - this.defaultValue = defaultValue; - } - - public void UpdateFromTextBox() - { - if (string.IsNullOrEmpty(textBox.Text)) - { - setter(defaultValue); - return; - } - - try - { - var value = parser(textBox.Text); - value = setter(value); - textBox.Text = value.ToString(); - } - catch - { - setter(defaultValue); - textBox.Text = defaultValue.ToString(); - } - } - } -} From 3af80f7eb352867dc44c5c8c4b92c7f470744332 Mon Sep 17 00:00:00 2001 From: bparks13 Date: Wed, 29 Oct 2025 12:45:21 -0400 Subject: [PATCH 04/11] Add PropertyGrid to NeuropixelsV1 dialogs --- ...NeuropixelsV1ChannelConfigurationDialog.cs | 2 +- OpenEphys.Onix1.Design/NeuropixelsV1Dialog.cs | 13 +- OpenEphys.Onix1.Design/NeuropixelsV1Editor.cs | 4 +- ...xelsV1ProbeConfigurationDialog.Designer.cs | 153 +++++++++---- .../NeuropixelsV1ProbeConfigurationDialog.cs | 209 +++++++++++------- ...NeuropixelsV1ProbeConfigurationDialog.resx | 3 + .../NeuropixelsV1eHeadstageDialog.cs | 2 +- .../NeuropixelsV1eHeadstageEditor.cs | 6 +- .../NeuropixelsV1fHeadstageDialog.cs | 2 +- .../NeuropixelsV1fHeadstageEditor.cs | 9 +- 10 files changed, 256 insertions(+), 147 deletions(-) diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1ChannelConfigurationDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV1ChannelConfigurationDialog.cs index d2dcf8d7..04a10e73 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1ChannelConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1ChannelConfigurationDialog.cs @@ -37,7 +37,7 @@ public NeuropixelsV1ChannelConfigurationDialog(NeuropixelsV1ProbeConfiguration p ReferenceContacts.AddRange(ReferenceContactsList); - ProbeConfiguration = new(probeConfiguration); + ProbeConfiguration = probeConfiguration; HighlightEnabledContacts(); UpdateContactLabels(); diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1Dialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV1Dialog.cs index d7de267f..be2888ad 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1Dialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1Dialog.cs @@ -14,8 +14,11 @@ public partial class NeuropixelsV1Dialog : Form /// Public interface that is manipulated by /// . /// - [Obsolete] - public IConfigureNeuropixelsV1 ConfigureNode { get; set; } + public IConfigureNeuropixelsV1 ConfigureNode + { + get => (IConfigureNeuropixelsV1)ProbeConfigurationDialog.propertyGrid.SelectedObject; + set => ProbeConfigurationDialog.propertyGrid.SelectedObject = value; + } /// /// Initializes a new instance of . @@ -26,10 +29,8 @@ public NeuropixelsV1Dialog(IConfigureNeuropixelsV1 configureNode) InitializeComponent(); Shown += FormShown; - ProbeConfigurationDialog = new(configureNode.ProbeConfiguration); - ProbeConfigurationDialog - .SetChildFormProperties(this) - .AddDialogToPanel(panelProbe); + ProbeConfigurationDialog = new(configureNode); + ProbeConfigurationDialog.SetChildFormProperties(this).AddDialogToPanel(panelProbe); this.AddMenuItemsFromDialogToFileOption(ProbeConfigurationDialog); } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1Editor.cs b/OpenEphys.Onix1.Design/NeuropixelsV1Editor.cs index 93a4b820..3c49eb5d 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1Editor.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1Editor.cs @@ -18,7 +18,9 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon var editorState = (IWorkflowEditorState)provider.GetService(typeof(IWorkflowEditorState)); if (editorState != null && !editorState.WorkflowRunning && component is IConfigureNeuropixelsV1 configureNeuropixelsV1) { - using var editorDialog = new NeuropixelsV1Dialog(configureNeuropixelsV1); + var configuration = configureNeuropixelsV1.Clone(); + + using var editorDialog = new NeuropixelsV1Dialog(configuration); if (editorDialog.ShowDialog() == DialogResult.OK) { diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.Designer.cs b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.Designer.cs index fa2edd59..db889dac 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.Designer.cs @@ -53,6 +53,10 @@ private void InitializeComponent() this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.buttonCancel = new System.Windows.Forms.Button(); this.buttonOkay = new System.Windows.Forms.Button(); + this.panelTrackBar = new System.Windows.Forms.Panel(); + this.trackBarProbePosition = new System.Windows.Forms.TrackBar(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPageConfiguration = new System.Windows.Forms.TabPage(); this.panelOptions = new System.Windows.Forms.Panel(); this.checkBoxInvertPolarity = new System.Windows.Forms.CheckBox(); this.textBoxLfpCorrection = new System.Windows.Forms.TextBox(); @@ -69,8 +73,9 @@ private void InitializeComponent() this.comboBoxReference = new System.Windows.Forms.ComboBox(); this.comboBoxLfpGain = new System.Windows.Forms.ComboBox(); this.comboBoxApGain = new System.Windows.Forms.ComboBox(); - this.panelTrackBar = new System.Windows.Forms.Panel(); - this.trackBarProbePosition = new System.Windows.Forms.TrackBar(); + this.tabPageProperties = new System.Windows.Forms.TabPage(); + this.propertyGrid = new System.Windows.Forms.PropertyGrid(); + this.bindingSource = new System.Windows.Forms.BindingSource(this.components); label4 = new System.Windows.Forms.Label(); label2 = new System.Windows.Forms.Label(); labelPresets = new System.Windows.Forms.Label(); @@ -85,9 +90,13 @@ private void InitializeComponent() this.menuStrip.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); - this.panelOptions.SuspendLayout(); this.panelTrackBar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.trackBarProbePosition)).BeginInit(); + this.tabControl1.SuspendLayout(); + this.tabPageConfiguration.SuspendLayout(); + this.panelOptions.SuspendLayout(); + this.tabPageProperties.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit(); this.SuspendLayout(); // // label4 @@ -255,8 +264,8 @@ private void InitializeComponent() this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 315F)); this.tableLayoutPanel1.Controls.Add(this.panelProbe, 0, 0); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.panelOptions, 2, 0); this.tableLayoutPanel1.Controls.Add(this.panelTrackBar, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.tabControl1, 2, 0); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); @@ -312,6 +321,55 @@ private void InitializeComponent() this.buttonOkay.Text = "OK"; this.buttonOkay.UseVisualStyleBackColor = true; // + // panelTrackBar + // + this.panelTrackBar.Controls.Add(this.trackBarProbePosition); + this.panelTrackBar.Location = new System.Drawing.Point(868, 4); + this.panelTrackBar.Margin = new System.Windows.Forms.Padding(4); + this.panelTrackBar.Name = "panelTrackBar"; + this.panelTrackBar.Size = new System.Drawing.Size(47, 662); + this.panelTrackBar.TabIndex = 33; + // + // trackBarProbePosition + // + this.trackBarProbePosition.AutoSize = false; + this.trackBarProbePosition.BackColor = System.Drawing.SystemColors.Control; + this.trackBarProbePosition.Dock = System.Windows.Forms.DockStyle.Fill; + this.trackBarProbePosition.Location = new System.Drawing.Point(0, 0); + this.trackBarProbePosition.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.trackBarProbePosition.Maximum = 100; + this.trackBarProbePosition.Name = "trackBarProbePosition"; + this.trackBarProbePosition.Orientation = System.Windows.Forms.Orientation.Vertical; + this.trackBarProbePosition.Size = new System.Drawing.Size(47, 662); + this.trackBarProbePosition.TabIndex = 30; + this.trackBarProbePosition.TabStop = false; + this.trackBarProbePosition.TickFrequency = 2; + this.trackBarProbePosition.TickStyle = System.Windows.Forms.TickStyle.TopLeft; + this.trackBarProbePosition.Value = 50; + this.trackBarProbePosition.Scroll += new System.EventHandler(this.TrackBarScroll); + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPageConfiguration); + this.tabControl1.Controls.Add(this.tabPageProperties); + this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControl1.Location = new System.Drawing.Point(922, 3); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(309, 664); + this.tabControl1.TabIndex = 34; + // + // tabPageConfiguration + // + this.tabPageConfiguration.Controls.Add(this.panelOptions); + this.tabPageConfiguration.Location = new System.Drawing.Point(4, 25); + this.tabPageConfiguration.Name = "tabPageConfiguration"; + this.tabPageConfiguration.Padding = new System.Windows.Forms.Padding(3); + this.tabPageConfiguration.Size = new System.Drawing.Size(301, 635); + this.tabPageConfiguration.TabIndex = 0; + this.tabPageConfiguration.Text = "Configuration"; + this.tabPageConfiguration.UseVisualStyleBackColor = true; + // // panelOptions // this.panelOptions.BackColor = System.Drawing.SystemColors.ControlLightLight; @@ -341,10 +399,10 @@ private void InitializeComponent() this.panelOptions.Controls.Add(this.comboBoxApGain); this.panelOptions.Controls.Add(apGain); this.panelOptions.Dock = System.Windows.Forms.DockStyle.Fill; - this.panelOptions.Location = new System.Drawing.Point(922, 2); + this.panelOptions.Location = new System.Drawing.Point(3, 3); this.panelOptions.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panelOptions.Name = "panelOptions"; - this.panelOptions.Size = new System.Drawing.Size(309, 666); + this.panelOptions.Size = new System.Drawing.Size(295, 629); this.panelOptions.TabIndex = 2; // // checkBoxInvertPolarity @@ -366,7 +424,7 @@ private void InitializeComponent() this.textBoxLfpCorrection.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxLfpCorrection.Name = "textBoxLfpCorrection"; this.textBoxLfpCorrection.ReadOnly = true; - this.textBoxLfpCorrection.Size = new System.Drawing.Size(195, 22); + this.textBoxLfpCorrection.Size = new System.Drawing.Size(181, 22); this.textBoxLfpCorrection.TabIndex = 14; this.textBoxLfpCorrection.TabStop = false; // @@ -378,7 +436,7 @@ private void InitializeComponent() this.textBoxApCorrection.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxApCorrection.Name = "textBoxApCorrection"; this.textBoxApCorrection.ReadOnly = true; - this.textBoxApCorrection.Size = new System.Drawing.Size(195, 22); + this.textBoxApCorrection.Size = new System.Drawing.Size(181, 22); this.textBoxApCorrection.TabIndex = 10; this.textBoxApCorrection.TabStop = false; // @@ -387,10 +445,10 @@ private void InitializeComponent() this.buttonViewAdcs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.buttonViewAdcs.Enabled = false; - this.buttonViewAdcs.Location = new System.Drawing.Point(13, 66); + this.buttonViewAdcs.Location = new System.Drawing.Point(12, 66); this.buttonViewAdcs.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonViewAdcs.Name = "buttonViewAdcs"; - this.buttonViewAdcs.Size = new System.Drawing.Size(284, 38); + this.buttonViewAdcs.Size = new System.Drawing.Size(270, 38); this.buttonViewAdcs.TabIndex = 3; this.buttonViewAdcs.Text = "View ADC Correction Values"; this.buttonViewAdcs.UseVisualStyleBackColor = true; @@ -399,7 +457,7 @@ private void InitializeComponent() // buttonChooseAdcCalibrationFile // this.buttonChooseAdcCalibrationFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonChooseAdcCalibrationFile.Location = new System.Drawing.Point(260, 30); + this.buttonChooseAdcCalibrationFile.Location = new System.Drawing.Point(245, 30); this.buttonChooseAdcCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonChooseAdcCalibrationFile.Name = "buttonChooseAdcCalibrationFile"; this.buttonChooseAdcCalibrationFile.Size = new System.Drawing.Size(37, 25); @@ -411,7 +469,7 @@ private void InitializeComponent() // buttonChooseGainCalibrationFile // this.buttonChooseGainCalibrationFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonChooseGainCalibrationFile.Location = new System.Drawing.Point(260, 133); + this.buttonChooseGainCalibrationFile.Location = new System.Drawing.Point(245, 133); this.buttonChooseGainCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonChooseGainCalibrationFile.Name = "buttonChooseGainCalibrationFile"; this.buttonChooseGainCalibrationFile.Size = new System.Drawing.Size(37, 25); @@ -427,7 +485,7 @@ private void InitializeComponent() this.buttonEnableContacts.Location = new System.Drawing.Point(13, 464); this.buttonEnableContacts.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonEnableContacts.Name = "buttonEnableContacts"; - this.buttonEnableContacts.Size = new System.Drawing.Size(283, 44); + this.buttonEnableContacts.Size = new System.Drawing.Size(269, 44); this.buttonEnableContacts.TabIndex = 23; this.buttonEnableContacts.Text = "Enable Selected Electrodes"; this.buttonEnableContacts.UseVisualStyleBackColor = true; @@ -440,7 +498,7 @@ private void InitializeComponent() this.buttonClearSelections.Location = new System.Drawing.Point(13, 512); this.buttonClearSelections.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonClearSelections.Name = "buttonClearSelections"; - this.buttonClearSelections.Size = new System.Drawing.Size(283, 44); + this.buttonClearSelections.Size = new System.Drawing.Size(269, 44); this.buttonClearSelections.TabIndex = 24; this.buttonClearSelections.Text = "Clear Electrode Selection"; this.buttonClearSelections.UseVisualStyleBackColor = true; @@ -455,7 +513,7 @@ private void InitializeComponent() this.comboBoxChannelPresets.Location = new System.Drawing.Point(101, 411); this.comboBoxChannelPresets.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxChannelPresets.Name = "comboBoxChannelPresets"; - this.comboBoxChannelPresets.Size = new System.Drawing.Size(195, 24); + this.comboBoxChannelPresets.Size = new System.Drawing.Size(181, 24); this.comboBoxChannelPresets.TabIndex = 22; // // checkBoxSpikeFilter @@ -476,11 +534,10 @@ private void InitializeComponent() this.textBoxAdcCalibrationFile.Location = new System.Drawing.Point(13, 30); this.textBoxAdcCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxAdcCalibrationFile.Name = "textBoxAdcCalibrationFile"; - this.textBoxAdcCalibrationFile.Size = new System.Drawing.Size(241, 22); + this.textBoxAdcCalibrationFile.Size = new System.Drawing.Size(226, 22); this.textBoxAdcCalibrationFile.TabIndex = 1; this.textBoxAdcCalibrationFile.TabStop = false; this.textBoxAdcCalibrationFile.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.textBoxAdcCalibrationFile.TextChanged += new System.EventHandler(this.AdcCalibrationFileTextChanged); this.textBoxAdcCalibrationFile.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxKeyPress); // // textBoxGainCalibrationFile @@ -490,11 +547,10 @@ private void InitializeComponent() this.textBoxGainCalibrationFile.Location = new System.Drawing.Point(13, 133); this.textBoxGainCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxGainCalibrationFile.Name = "textBoxGainCalibrationFile"; - this.textBoxGainCalibrationFile.Size = new System.Drawing.Size(241, 22); + this.textBoxGainCalibrationFile.Size = new System.Drawing.Size(226, 22); this.textBoxGainCalibrationFile.TabIndex = 5; this.textBoxGainCalibrationFile.TabStop = false; this.textBoxGainCalibrationFile.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.textBoxGainCalibrationFile.TextChanged += new System.EventHandler(this.GainCalibrationFileTextChanged); this.textBoxGainCalibrationFile.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxKeyPress); // // comboBoxReference @@ -506,7 +562,7 @@ private void InitializeComponent() this.comboBoxReference.Location = new System.Drawing.Point(101, 373); this.comboBoxReference.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxReference.Name = "comboBoxReference"; - this.comboBoxReference.Size = new System.Drawing.Size(195, 24); + this.comboBoxReference.Size = new System.Drawing.Size(181, 24); this.comboBoxReference.TabIndex = 20; // // comboBoxLfpGain @@ -518,7 +574,7 @@ private void InitializeComponent() this.comboBoxLfpGain.Location = new System.Drawing.Point(101, 240); this.comboBoxLfpGain.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxLfpGain.Name = "comboBoxLfpGain"; - this.comboBoxLfpGain.Size = new System.Drawing.Size(195, 24); + this.comboBoxLfpGain.Size = new System.Drawing.Size(181, 24); this.comboBoxLfpGain.TabIndex = 12; // // comboBoxApGain @@ -527,38 +583,30 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.comboBoxApGain.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxApGain.FormattingEnabled = true; - this.comboBoxApGain.Location = new System.Drawing.Point(101, 174); + this.comboBoxApGain.Location = new System.Drawing.Point(100, 174); this.comboBoxApGain.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxApGain.Name = "comboBoxApGain"; - this.comboBoxApGain.Size = new System.Drawing.Size(196, 24); + this.comboBoxApGain.Size = new System.Drawing.Size(182, 24); this.comboBoxApGain.TabIndex = 8; // - // panelTrackBar + // tabPageProperties // - this.panelTrackBar.Controls.Add(this.trackBarProbePosition); - this.panelTrackBar.Location = new System.Drawing.Point(868, 4); - this.panelTrackBar.Margin = new System.Windows.Forms.Padding(4); - this.panelTrackBar.Name = "panelTrackBar"; - this.panelTrackBar.Size = new System.Drawing.Size(47, 662); - this.panelTrackBar.TabIndex = 33; + this.tabPageProperties.Controls.Add(this.propertyGrid); + this.tabPageProperties.Location = new System.Drawing.Point(4, 25); + this.tabPageProperties.Name = "tabPageProperties"; + this.tabPageProperties.Padding = new System.Windows.Forms.Padding(3); + this.tabPageProperties.Size = new System.Drawing.Size(301, 635); + this.tabPageProperties.TabIndex = 1; + this.tabPageProperties.Text = "Properties"; + this.tabPageProperties.UseVisualStyleBackColor = true; // - // trackBarProbePosition + // propertyGrid // - this.trackBarProbePosition.AutoSize = false; - this.trackBarProbePosition.BackColor = System.Drawing.SystemColors.Control; - this.trackBarProbePosition.Dock = System.Windows.Forms.DockStyle.Fill; - this.trackBarProbePosition.Location = new System.Drawing.Point(0, 0); - this.trackBarProbePosition.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.trackBarProbePosition.Maximum = 100; - this.trackBarProbePosition.Name = "trackBarProbePosition"; - this.trackBarProbePosition.Orientation = System.Windows.Forms.Orientation.Vertical; - this.trackBarProbePosition.Size = new System.Drawing.Size(47, 662); - this.trackBarProbePosition.TabIndex = 30; - this.trackBarProbePosition.TabStop = false; - this.trackBarProbePosition.TickFrequency = 2; - this.trackBarProbePosition.TickStyle = System.Windows.Forms.TickStyle.TopLeft; - this.trackBarProbePosition.Value = 50; - this.trackBarProbePosition.Scroll += new System.EventHandler(this.TrackBarScroll); + this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill; + this.propertyGrid.Location = new System.Drawing.Point(3, 3); + this.propertyGrid.Name = "propertyGrid"; + this.propertyGrid.Size = new System.Drawing.Size(295, 629); + this.propertyGrid.TabIndex = 0; // // NeuropixelsV1ProbeConfigurationDialog // @@ -579,10 +627,14 @@ private void InitializeComponent() this.menuStrip.PerformLayout(); this.tableLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.ResumeLayout(false); - this.panelOptions.ResumeLayout(false); - this.panelOptions.PerformLayout(); this.panelTrackBar.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.trackBarProbePosition)).EndInit(); + this.tabControl1.ResumeLayout(false); + this.tabPageConfiguration.ResumeLayout(false); + this.panelOptions.ResumeLayout(false); + this.panelOptions.PerformLayout(); + this.tabPageProperties.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -621,5 +673,10 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripStatusLabel toolStripLabelAdcCalibrationSN; private System.Windows.Forms.ToolStripStatusLabel toolStripLabelGainCalibrationSn; private System.Windows.Forms.CheckBox checkBoxInvertPolarity; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPageConfiguration; + internal System.Windows.Forms.PropertyGrid propertyGrid; + private System.Windows.Forms.TabPage tabPageProperties; + private System.Windows.Forms.BindingSource bindingSource; } } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.cs index 39573b2c..4538fba8 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.cs @@ -1,7 +1,9 @@ using System; +using System.ComponentModel; using System.Drawing; using System.IO; using System.Linq; +using System.Resources; using System.Windows.Forms; namespace OpenEphys.Onix1.Design @@ -26,12 +28,26 @@ private enum ChannelPreset } /// - /// Gets or sets the probe configuration. + /// Public interface that is manipulated by + /// . /// + /// + /// When a is passed to + /// , it is copied and stored in this + /// variable so that any modifications made to configuration settings can be easily reversed + /// by not copying the new settings back to the original instance. + /// public NeuropixelsV1ProbeConfiguration ProbeConfiguration { - get => ChannelConfiguration.ProbeConfiguration; - set => ChannelConfiguration.ProbeConfiguration = value; + get => ((IConfigureNeuropixelsV1)propertyGrid.SelectedObject).ProbeConfiguration; + set => ((IConfigureNeuropixelsV1)propertyGrid.SelectedObject).ProbeConfiguration = value; + } + + [Obsolete] + IConfigureNeuropixelsV1 ConfigureNode + { + get => (IConfigureNeuropixelsV1)propertyGrid.SelectedObject; + set => propertyGrid.SelectedObject = value; } /// @@ -45,56 +61,122 @@ public bool InvertPolarity /// /// Initializes a new instance of . /// - /// A object holding the current configuration settings. - public NeuropixelsV1ProbeConfigurationDialog(NeuropixelsV1ProbeConfiguration probeConfiguration) + /// Existing configuration node. + public NeuropixelsV1ProbeConfigurationDialog(IConfigureNeuropixelsV1 configureNode) { InitializeComponent(); Shown += FormShown; - ChannelConfiguration = new(probeConfiguration); - ChannelConfiguration - .SetChildFormProperties(this) - .AddDialogToPanel(panelProbe); - + ChannelConfiguration = new(configureNode.ProbeConfiguration); + ChannelConfiguration.SetChildFormProperties(this).AddDialogToPanel(panelProbe); this.AddMenuItemsFromDialogToFileOption(ChannelConfiguration); + panelProbe.Controls.Add(ChannelConfiguration); + ChannelConfiguration.OnZoom += UpdateTrackBarLocation; ChannelConfiguration.OnFileLoad += OnFileLoadEvent; - comboBoxApGain.DataSource = Enum.GetValues(typeof(NeuropixelsV1Gain)); - comboBoxApGain.SelectedItem = ProbeConfiguration.SpikeAmplifierGain; - comboBoxApGain.SelectedIndexChanged += SpikeAmplifierGainIndexChanged; + propertyGrid.SelectedObject = configureNode; + bindingSource.DataSource = configureNode; - comboBoxLfpGain.DataSource = Enum.GetValues(typeof(NeuropixelsV1Gain)); - comboBoxLfpGain.SelectedItem = ProbeConfiguration.LfpAmplifierGain; - comboBoxLfpGain.SelectedIndexChanged += LfpAmplifierGainIndexChanged; + // NB: Needed to capture mouse scroll wheel updates + void ForceBindingUpdate(object sender, EventArgs e) + { + var control = sender as Control; - comboBoxReference.DataSource = Enum.GetValues(typeof(NeuropixelsV1ReferenceSource)); - comboBoxReference.SelectedItem = ProbeConfiguration.Reference; - comboBoxReference.SelectedIndexChanged += ReferenceIndexChanged; + foreach (Binding binding in control.DataBindings) + { + binding.WriteValue(); + } - checkBoxSpikeFilter.Checked = ProbeConfiguration.SpikeFilter; - checkBoxSpikeFilter.CheckedChanged += SpikeFilterIndexChanged; + bindingSource.ResetCurrentItem(); + } + ; - checkBoxInvertPolarity.Checked = ProbeConfiguration.InvertPolarity; - checkBoxInvertPolarity.CheckedChanged += InvertPolarityIndexChanged; + comboBoxApGain.DataSource = Enum.GetValues(typeof(NeuropixelsV1Gain)); + comboBoxApGain.DataBindings.Add("SelectedItem", + bindingSource, + $"{nameof(configureNode.ProbeConfiguration)}.{nameof(configureNode.ProbeConfiguration.SpikeAmplifierGain)}", + false, + DataSourceUpdateMode.OnPropertyChanged); + comboBoxApGain.SelectedIndexChanged += (sender, e) => + { + ForceBindingUpdate(sender, e); + CheckStatus(); + }; - textBoxAdcCalibrationFile.Text = ProbeConfiguration.AdcCalibrationFileName; - textBoxAdcCalibrationFile.TextChanged += (sender, e) => ProbeConfiguration.AdcCalibrationFileName = ((TextBox)sender).Text; + comboBoxLfpGain.DataSource = Enum.GetValues(typeof(NeuropixelsV1Gain)); + comboBoxLfpGain.DataBindings.Add("SelectedItem", + bindingSource, + $"{nameof(configureNode.ProbeConfiguration)}.{nameof(configureNode.ProbeConfiguration.LfpAmplifierGain)}", + false, + DataSourceUpdateMode.OnPropertyChanged); + comboBoxLfpGain.SelectedIndexChanged += (sender, e) => + { + ForceBindingUpdate(sender, e); + CheckStatus(); + }; - textBoxGainCalibrationFile.Text = ProbeConfiguration.GainCalibrationFileName; - textBoxGainCalibrationFile.TextChanged += (sender, e) => ProbeConfiguration.GainCalibrationFileName = ((TextBox)sender).Text; + comboBoxReference.DataSource = Enum.GetValues(typeof(NeuropixelsV1ReferenceSource)); + comboBoxReference.DataBindings.Add("SelectedItem", + bindingSource, + $"{nameof(configureNode.ProbeConfiguration)}.{nameof(configureNode.ProbeConfiguration.Reference)}", + false, + DataSourceUpdateMode.OnPropertyChanged); + comboBoxReference.SelectedIndexChanged += ForceBindingUpdate; + + checkBoxSpikeFilter.DataBindings.Add("Checked", + bindingSource, + $"{nameof(configureNode.ProbeConfiguration)}.{nameof(configureNode.ProbeConfiguration.SpikeFilter)}", + false, + DataSourceUpdateMode.OnPropertyChanged); + + checkBoxInvertPolarity.DataBindings.Add("Checked", + bindingSource, + $"{nameof(configureNode.ProbeConfiguration)}.{nameof(configureNode.ProbeConfiguration.InvertPolarity)}", + false, + DataSourceUpdateMode.OnPropertyChanged); + + textBoxAdcCalibrationFile.DataBindings.Add("Text", + bindingSource, + $"{nameof(configureNode.ProbeConfiguration)}.{nameof(configureNode.ProbeConfiguration.AdcCalibrationFileName)}", + false, + DataSourceUpdateMode.OnPropertyChanged); + textBoxAdcCalibrationFile.TextChanged += (sender, e) => CheckStatus(); + + textBoxGainCalibrationFile.DataBindings.Add("Text", + bindingSource, + $"{nameof(configureNode.ProbeConfiguration)}.{nameof(configureNode.ProbeConfiguration.GainCalibrationFileName)}", + false, + DataSourceUpdateMode.OnPropertyChanged); + textBoxGainCalibrationFile.TextChanged += (sender, e) => CheckStatus(); comboBoxChannelPresets.DataSource = Enum.GetValues(typeof(ChannelPreset)); CheckForExistingChannelPreset(); - comboBoxChannelPresets.SelectedIndexChanged += ChannelPresetIndexChanged; + comboBoxChannelPresets.SelectedIndexChanged += (sender, e) => + { + var channelPreset = ((ComboBox)sender).SelectedItem is ChannelPreset preset + ? preset + : throw new InvalidEnumArgumentException($"Invalid channel preset value found."); + + if (channelPreset != ChannelPreset.None) + { + SetChannelPreset(channelPreset); + } + }; CheckStatus(); - } - private void InvertPolarityIndexChanged(object sender, EventArgs e) - { - ProbeConfiguration.InvertPolarity = ((CheckBox)sender).Checked; + bindingSource.ListChanged += (sender, eventArgs) => propertyGrid.Refresh(); + + tabControl1.SelectedIndexChanged += (sender, eventArgs) => + { + if (tabControl1.SelectedTab == tabPageProperties) + propertyGrid.Refresh(); + + else if (tabControl1.SelectedTab == tabPageConfiguration) + bindingSource.ResetCurrentItem(); + }; } private void FormShown(object sender, EventArgs e) @@ -111,75 +193,32 @@ private void FormShown(object sender, EventArgs e) ChannelConfiguration.ConnectResizeEventHandler(); } - private void GainCalibrationFileTextChanged(object sender, EventArgs e) - { - CheckStatus(); - } - - private void AdcCalibrationFileTextChanged(object sender, EventArgs e) - { - CheckStatus(); - } - - private void SpikeAmplifierGainIndexChanged(object sender, EventArgs e) - { - ProbeConfiguration.SpikeAmplifierGain = (NeuropixelsV1Gain)((ComboBox)sender).SelectedItem; - CheckStatus(); - } - - private void LfpAmplifierGainIndexChanged(object sender, EventArgs e) - { - ProbeConfiguration.LfpAmplifierGain = (NeuropixelsV1Gain)((ComboBox)sender).SelectedItem; - CheckStatus(); - } - - private void ReferenceIndexChanged(object sender, EventArgs e) - { - ProbeConfiguration.Reference = (NeuropixelsV1ReferenceSource)((ComboBox)sender).SelectedItem; - } - - private void ChannelPresetIndexChanged(object sender, EventArgs e) - { - var channelPreset = (ChannelPreset)((ComboBox)sender).SelectedItem; - - if (channelPreset != ChannelPreset.None) - { - SetChannelPreset(channelPreset); - } - } - - private void SpikeFilterIndexChanged(object sender, EventArgs e) - { - ProbeConfiguration.SpikeFilter = ((CheckBox)sender).Checked; - } - private void SetChannelPreset(ChannelPreset preset) { - var probeConfiguration = ChannelConfiguration.ProbeConfiguration; - var electrodes = NeuropixelsV1eProbeGroup.ToElectrodes(ChannelConfiguration.ProbeConfiguration.ProbeGroup); + var electrodes = NeuropixelsV1eProbeGroup.ToElectrodes(ProbeConfiguration.ProbeGroup); switch (preset) { case ChannelPreset.BankA: - probeConfiguration.SelectElectrodes(electrodes.Where(e => e.Bank == NeuropixelsV1Bank.A).ToArray()); + ProbeConfiguration.SelectElectrodes(electrodes.Where(e => e.Bank == NeuropixelsV1Bank.A).ToArray()); break; case ChannelPreset.BankB: - probeConfiguration.SelectElectrodes(electrodes.Where(e => e.Bank == NeuropixelsV1Bank.B).ToArray()); + ProbeConfiguration.SelectElectrodes(electrodes.Where(e => e.Bank == NeuropixelsV1Bank.B).ToArray()); break; case ChannelPreset.BankC: - probeConfiguration.SelectElectrodes(electrodes.Where(e => e.Bank == NeuropixelsV1Bank.C || + ProbeConfiguration.SelectElectrodes(electrodes.Where(e => e.Bank == NeuropixelsV1Bank.C || (e.Bank == NeuropixelsV1Bank.B && e.Index >= 576)).ToArray()); break; case ChannelPreset.SingleColumn: - probeConfiguration.SelectElectrodes(electrodes.Where(e => (e.Index % 2 == 0 && e.Bank == NeuropixelsV1Bank.A) || + ProbeConfiguration.SelectElectrodes(electrodes.Where(e => (e.Index % 2 == 0 && e.Bank == NeuropixelsV1Bank.A) || (e.Index % 2 == 1 && e.Bank == NeuropixelsV1Bank.B)).ToArray()); break; case ChannelPreset.Tetrodes: - probeConfiguration.SelectElectrodes(electrodes.Where(e => (e.Index % 8 < 4 && e.Bank == NeuropixelsV1Bank.A) || + ProbeConfiguration.SelectElectrodes(electrodes.Where(e => (e.Index % 8 < 4 && e.Bank == NeuropixelsV1Bank.A) || (e.Index % 8 > 3 && e.Bank == NeuropixelsV1Bank.B)).ToArray()); break; } @@ -192,7 +231,7 @@ private void SetChannelPreset(ChannelPreset preset) private void CheckForExistingChannelPreset() { - var channelMap = ChannelConfiguration.ProbeConfiguration.ChannelMap; + var channelMap = ProbeConfiguration.ChannelMap; if (channelMap.All(e => e.Bank == NeuropixelsV1Bank.A)) { @@ -225,7 +264,7 @@ private void CheckForExistingChannelPreset() private void OnFileLoadEvent(object sender, EventArgs e) { - // NB: Ensure that the newly loaded ProbeConfiguration in the ChannelConfigurationDialog is reflected here. + // NB: Ensure that the newly loaded ProbeGroup in the ChannelConfigurationDialog is reflected here. ProbeConfiguration = ChannelConfiguration.ProbeConfiguration; CheckForExistingChannelPreset(); } @@ -320,6 +359,8 @@ private void CheckStatus() toolStripLabelGainCalibrationSn.Image = Properties.Resources.StatusBlockedImage; else toolStripLabelGainCalibrationSn.Image = Properties.Resources.StatusReadyImage; + + propertyGrid.Refresh(); } private void ChooseGainCalibrationFile_Click(object sender, EventArgs e) @@ -379,7 +420,7 @@ private void ViewAdcs_Click(object sender, EventArgs e) if (Adcs == null) return; - System.Resources.ResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NeuropixelsV1Dialog)); + ResourceManager resources = new ComponentResourceManager(typeof(NeuropixelsV1Dialog)); var adcForm = new Form() { diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.resx b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.resx index 7a974dc9..21cfc316 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.resx +++ b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.resx @@ -156,6 +156,9 @@ 473, 17 + + 565, 5 + 25 diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageDialog.cs index 98517441..6fda6d6b 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageDialog.cs @@ -36,7 +36,7 @@ public NeuropixelsV1eHeadstageDialog(ConfigureNeuropixelsV1e configureNeuropixel this.AddMenuItemsFromDialogToFileOption(DialogNeuropixelsV1e, "NeuropixelsV1e"); - DialogBno055 = new(new ConfigurePolledBno055(configureBno055)); + DialogBno055 = new(configureBno055); DialogBno055.SetChildFormProperties(this).AddDialogToPanel(panelBno055); } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageEditor.cs b/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageEditor.cs index 122a19b9..a56f2d4d 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageEditor.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageEditor.cs @@ -19,13 +19,15 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon if (editorState != null && !editorState.WorkflowRunning && component is ConfigureHeadstageNeuropixelsV1e configureHeadstage) { - using var editorDialog = new NeuropixelsV1eHeadstageDialog(configureHeadstage.NeuropixelsV1e, configureHeadstage.Bno055); + var configuration = new ConfigureHeadstageNeuropixelsV1e(configureHeadstage); + + using var editorDialog = new NeuropixelsV1eHeadstageDialog(configuration.NeuropixelsV1e, configuration.Bno055); if (editorDialog.ShowDialog() == DialogResult.OK) { DesignHelper.CopyProperties((ConfigurePolledBno055)editorDialog.DialogBno055.Device, configureHeadstage.Bno055, DesignHelper.PropertiesToIgnore); - configureHeadstage.NeuropixelsV1e.ProbeConfiguration = editorDialog.DialogNeuropixelsV1e.ProbeConfigurationDialog.ProbeConfiguration; + DesignHelper.CopyProperties((ConfigureNeuropixelsV1e)editorDialog.DialogNeuropixelsV1e.ConfigureNode, configureHeadstage.NeuropixelsV1e, DesignHelper.PropertiesToIgnore); return true; } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.cs index 12cb445f..44f966a5 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.cs @@ -54,7 +54,7 @@ public NeuropixelsV1fHeadstageDialog(ConfigureNeuropixelsV1f configureNeuropixel this.AddMenuItemsFromDialogToFileOption(DialogNeuropixelsV1B, "NeuropixelsV1B"); - DialogBno055 = new(new ConfigureBno055(configureBno055)); + DialogBno055 = new(configureBno055); DialogBno055.SetChildFormProperties(this).AddDialogToPanel(panelBno055); } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageEditor.cs b/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageEditor.cs index b2386028..a9ed05ea 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageEditor.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageEditor.cs @@ -19,14 +19,17 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon if (editorState != null && !editorState.WorkflowRunning && component is ConfigureHeadstageNeuropixelsV1f configureHeadstage) { - using var editorDialog = new NeuropixelsV1fHeadstageDialog(configureHeadstage.NeuropixelsV1A, configureHeadstage.NeuropixelsV1B, configureHeadstage.Bno055); + var configuration = new ConfigureHeadstageNeuropixelsV1f(configureHeadstage); + + using var editorDialog = new NeuropixelsV1fHeadstageDialog(configuration.NeuropixelsV1A, configuration.NeuropixelsV1B, configuration.Bno055); if (editorDialog.ShowDialog() == DialogResult.OK) { DesignHelper.CopyProperties((ConfigureBno055)editorDialog.DialogBno055.Device, configureHeadstage.Bno055, DesignHelper.PropertiesToIgnore); - configureHeadstage.NeuropixelsV1A.ProbeConfiguration = editorDialog.DialogNeuropixelsV1A.ProbeConfigurationDialog.ProbeConfiguration; - configureHeadstage.NeuropixelsV1B.ProbeConfiguration = editorDialog.DialogNeuropixelsV1B.ProbeConfigurationDialog.ProbeConfiguration; + DesignHelper.CopyProperties((ConfigureNeuropixelsV1f)editorDialog.DialogNeuropixelsV1A.ConfigureNode, configureHeadstage.NeuropixelsV1A, DesignHelper.PropertiesToIgnore); + + DesignHelper.CopyProperties((ConfigureNeuropixelsV1f)editorDialog.DialogNeuropixelsV1B.ConfigureNode, configureHeadstage.NeuropixelsV1B, DesignHelper.PropertiesToIgnore); return true; } From eadc5d9e56c572c07e4338dca50f7121fb266572 Mon Sep 17 00:00:00 2001 From: bparks13 Date: Wed, 29 Oct 2025 14:56:35 -0400 Subject: [PATCH 05/11] Add PropertyGrid to NeuropixelsV2 dialogs --- .../NeuropixelsV1ProbeConfigurationDialog.cs | 1 - ...europixelsV2eChannelConfigurationDialog.cs | 5 +- .../NeuropixelsV2eDialog.Designer.cs | 27 ++++ .../NeuropixelsV2eDialog.cs | 25 ++-- .../NeuropixelsV2eEditor.cs | 7 +- .../NeuropixelsV2eHeadstageDialog.cs | 2 +- .../NeuropixelsV2eHeadstageEditor.cs | 14 ++- ...elsV2eProbeConfigurationDialog.Designer.cs | 85 +++++++++++-- .../NeuropixelsV2eProbeConfigurationDialog.cs | 118 +++++++++--------- ...europixelsV2eProbeConfigurationDialog.resx | 3 + .../NeuropixelsV2eProbeConfigurationEditor.cs | 6 +- 11 files changed, 199 insertions(+), 94 deletions(-) diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.cs index 4538fba8..f48b39d4 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.cs @@ -91,7 +91,6 @@ void ForceBindingUpdate(object sender, EventArgs e) bindingSource.ResetCurrentItem(); } - ; comboBoxApGain.DataSource = Enum.GetValues(typeof(NeuropixelsV1Gain)); comboBoxApGain.DataBindings.Add("SelectedItem", diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eChannelConfigurationDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eChannelConfigurationDialog.cs index f7d1a0d1..4bd07766 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eChannelConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eChannelConfigurationDialog.cs @@ -24,15 +24,14 @@ public partial class NeuropixelsV2eChannelConfigurationDialog : ChannelConfigura /// /// A object holding the current configuration settings. public NeuropixelsV2eChannelConfigurationDialog(NeuropixelsV2ProbeConfiguration probeConfiguration) - : base(probeConfiguration.ProbeGroup.Clone()) + : base(probeConfiguration.ProbeGroup) { zedGraphChannels.ZoomButtons = MouseButtons.None; zedGraphChannels.ZoomButtons2 = MouseButtons.None; zedGraphChannels.ZoomStepFraction = 0.5; - ProbeConfiguration = probeConfiguration.Clone(); - ProbeConfiguration.ProbeGroup = (NeuropixelsV2eProbeGroup)ProbeGroup; + ProbeConfiguration = probeConfiguration; GetChannelNumberFunc = ProbeConfiguration.ChannelMap[0].GetChannelNumberFunc(); diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.Designer.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.Designer.cs index 74b7f292..5fa29aec 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.Designer.cs @@ -36,9 +36,13 @@ private void InitializeComponent() this.buttonOkay = new System.Windows.Forms.Button(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.propertyGrid = new Bonsai.Design.PropertyGrid(); + this.tabPageProperties = new System.Windows.Forms.TabPage(); this.menuStrip.SuspendLayout(); + this.tabControlProbe.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); + this.tabPageProperties.SuspendLayout(); this.SuspendLayout(); // // menuStrip @@ -61,6 +65,7 @@ private void InitializeComponent() // // tabControlProbe // + this.tabControlProbe.Controls.Add(this.tabPageProperties); this.tabControlProbe.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControlProbe.Location = new System.Drawing.Point(3, 2); this.tabControlProbe.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); @@ -121,6 +126,24 @@ private void InitializeComponent() this.flowLayoutPanel1.Size = new System.Drawing.Size(1131, 41); this.flowLayoutPanel1.TabIndex = 2; // + // propertyGrid + // + this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Right; + this.propertyGrid.Location = new System.Drawing.Point(832, 0); + this.propertyGrid.Name = "propertyGrid"; + this.propertyGrid.Size = new System.Drawing.Size(293, 605); + this.propertyGrid.TabIndex = 0; + // + // tabPageProperties + // + this.tabPageProperties.Controls.Add(this.propertyGrid); + this.tabPageProperties.Location = new System.Drawing.Point(4, 25); + this.tabPageProperties.Name = "tabPageProperties"; + this.tabPageProperties.Size = new System.Drawing.Size(1125, 605); + this.tabPageProperties.TabIndex = 0; + this.tabPageProperties.Text = "Properties"; + this.tabPageProperties.UseVisualStyleBackColor = true; + // // NeuropixelsV2eDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); @@ -137,8 +160,10 @@ private void InitializeComponent() this.Text = "NeuropixelsV2e Configuration"; this.menuStrip.ResumeLayout(false); this.menuStrip.PerformLayout(); + this.tabControlProbe.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.ResumeLayout(false); + this.tabPageProperties.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -153,5 +178,7 @@ private void InitializeComponent() private System.Windows.Forms.TabControl tabControlProbe; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.TabPage tabPageProperties; + private Bonsai.Design.PropertyGrid propertyGrid; } } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs index 9166e5c3..c455213d 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs @@ -35,8 +35,11 @@ internal NeuropixelsV2ProbeConfiguration ProbeConfigurationB /// Public interface that is manipulated by /// . /// - [Obsolete] - public IConfigureNeuropixelsV2 ConfigureNode { get; set; } + public IConfigureNeuropixelsV2 ConfigureNode + { + get => (IConfigureNeuropixelsV2)propertyGrid.SelectedObject; + set => propertyGrid.SelectedObject = value; + } /// /// Initializes a new instance of . @@ -47,6 +50,8 @@ public NeuropixelsV2eDialog(IConfigureNeuropixelsV2 configureNode) InitializeComponent(); Shown += FormShown; + propertyGrid.SelectedObject = configureNode; + if (configureNode is ConfigureNeuropixelsV2eBeta) { Text = Text.Replace("NeuropixelsV2e ", "NeuropixelsV2eBeta "); @@ -60,11 +65,8 @@ public NeuropixelsV2eDialog(IConfigureNeuropixelsV2 configureNode) foreach (var channelConfiguration in ProbeConfigurations) { - string probeName = channelConfiguration.Key.ToString(); - - tabControlProbe.TabPages.Add(probeName, probeName); - channelConfiguration.Value.SetChildFormProperties(this).AddDialogToTab(tabControlProbe.TabPages[probeName]); - this.AddMenuItemsFromDialogToFileOption(channelConfiguration.Value, probeName); + channelConfiguration.Value.SetChildFormProperties(this); + this.AddMenuItemsFromDialogToFileOption(channelConfiguration.Value, channelConfiguration.Key.ToString()); } } @@ -78,10 +80,19 @@ private void FormShown(object sender, EventArgs e) menuStrip.Visible = false; } + int index = 0; + foreach (var channelConfiguration in ProbeConfigurations) { + string probeName = channelConfiguration.Key.ToString(); + + tabControlProbe.TabPages.Insert(index++, probeName, probeName); + tabControlProbe.TabPages[probeName].Controls.Add(channelConfiguration.Value); + channelConfiguration.Value.Show(); } + + tabControlProbe.SelectedIndex = 0; } internal void Okay_Click(object sender, EventArgs e) diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eEditor.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eEditor.cs index a9732579..7c503756 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eEditor.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eEditor.cs @@ -18,12 +18,13 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon var editorState = (IWorkflowEditorState)provider.GetService(typeof(IWorkflowEditorState)); if (editorState != null && !editorState.WorkflowRunning && component is IConfigureNeuropixelsV2 configureNeuropixelsV2e) { - using var editorDialog = new NeuropixelsV2eDialog(configureNeuropixelsV2e); + var configureNode = configureNeuropixelsV2e.Clone(); + + using var editorDialog = new NeuropixelsV2eDialog(configureNode); if (editorDialog.ShowDialog() == DialogResult.OK) { - DesignHelper.CopyProperties(editorDialog.ProbeConfigurationA, configureNeuropixelsV2e.ProbeConfigurationA, DesignHelper.PropertiesToIgnore); - DesignHelper.CopyProperties(editorDialog.ProbeConfigurationB, configureNeuropixelsV2e.ProbeConfigurationB, DesignHelper.PropertiesToIgnore); + DesignHelper.CopyProperties(editorDialog.ConfigureNode, configureNeuropixelsV2e, DesignHelper.PropertiesToIgnore); return true; } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageDialog.cs index ad2a4cfa..d0a6f75c 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageDialog.cs @@ -41,7 +41,7 @@ public NeuropixelsV2eHeadstageDialog(IConfigureNeuropixelsV2 configureNeuropixel tabPageNeuropixelsV2e.Text = "NeuropixelsV2eBeta"; } - DialogBno055 = new(new ConfigurePolledBno055(configureBno055)); + DialogBno055 = new(configureBno055); DialogBno055.SetChildFormProperties(this).AddDialogToPanel(panelBno055); } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageEditor.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageEditor.cs index 687c97a3..60a3631b 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageEditor.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageEditor.cs @@ -19,28 +19,30 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon if (editorState != null && !editorState.WorkflowRunning && component is ConfigureHeadstageNeuropixelsV2e configureV2eHeadstage) { - using var editorDialog = new NeuropixelsV2eHeadstageDialog(configureV2eHeadstage.NeuropixelsV2e, configureV2eHeadstage.Bno055); + var configureNode = new ConfigureHeadstageNeuropixelsV2e(configureV2eHeadstage); + + using var editorDialog = new NeuropixelsV2eHeadstageDialog(configureNode.NeuropixelsV2e, configureNode.Bno055); if (editorDialog.ShowDialog() == DialogResult.OK) { DesignHelper.CopyProperties((ConfigurePolledBno055)editorDialog.DialogBno055.Device, configureV2eHeadstage.Bno055, DesignHelper.PropertiesToIgnore); - configureV2eHeadstage.NeuropixelsV2e.ProbeConfigurationA = editorDialog.DialogNeuropixelsV2e.ProbeConfigurationA; - configureV2eHeadstage.NeuropixelsV2e.ProbeConfigurationB = editorDialog.DialogNeuropixelsV2e.ProbeConfigurationB; + DesignHelper.CopyProperties((ConfigureNeuropixelsV2e)editorDialog.DialogNeuropixelsV2e.ConfigureNode, configureV2eHeadstage.NeuropixelsV2e, DesignHelper.PropertiesToIgnore); return true; } } else if (editorState != null && !editorState.WorkflowRunning && component is ConfigureHeadstageNeuropixelsV2eBeta configureV2eBetaHeadstage) { - using var editorDialog = new NeuropixelsV2eHeadstageDialog(configureV2eBetaHeadstage.NeuropixelsV2eBeta, configureV2eBetaHeadstage.Bno055); + var configureNode = new ConfigureHeadstageNeuropixelsV2eBeta(configureV2eBetaHeadstage); + + using var editorDialog = new NeuropixelsV2eHeadstageDialog(configureNode.NeuropixelsV2eBeta, configureNode.Bno055); if (editorDialog.ShowDialog() == DialogResult.OK) { DesignHelper.CopyProperties((ConfigurePolledBno055)editorDialog.DialogBno055.Device, configureV2eBetaHeadstage.Bno055, DesignHelper.PropertiesToIgnore); - configureV2eBetaHeadstage.NeuropixelsV2eBeta.ProbeConfigurationA = editorDialog.DialogNeuropixelsV2e.ProbeConfigurationA; - configureV2eBetaHeadstage.NeuropixelsV2eBeta.ProbeConfigurationB = editorDialog.DialogNeuropixelsV2e.ProbeConfigurationB; + DesignHelper.CopyProperties((ConfigureNeuropixelsV2eBeta)editorDialog.DialogNeuropixelsV2e.ConfigureNode, configureV2eBetaHeadstage.NeuropixelsV2eBeta, DesignHelper.PropertiesToIgnore); return true; } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.Designer.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.Designer.cs index ef693b4a..a7a4a263 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.Designer.cs @@ -54,9 +54,14 @@ private void InitializeComponent() this.buttonCancel = new System.Windows.Forms.Button(); this.buttonOkay = new System.Windows.Forms.Button(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.tabControlProbe = new System.Windows.Forms.TabControl(); + this.tabPageConfiguration = new System.Windows.Forms.TabPage(); + this.tabPageProperties = new System.Windows.Forms.TabPage(); + this.propertyGrid = new Bonsai.Design.PropertyGrid(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripGainCalSN = new System.Windows.Forms.ToolStripStatusLabel(); + this.bindingSource = new System.Windows.Forms.BindingSource(this.components); probeCalibrationFile = new System.Windows.Forms.Label(); Reference = new System.Windows.Forms.Label(); labelPresets = new System.Windows.Forms.Label(); @@ -67,8 +72,12 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.trackBarProbePosition)).BeginInit(); this.panelChannelOptions.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); + this.tabControlProbe.SuspendLayout(); + this.tabPageConfiguration.SuspendLayout(); + this.tabPageProperties.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); this.statusStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit(); this.SuspendLayout(); // // probeCalibrationFile @@ -151,7 +160,7 @@ private void InitializeComponent() this.buttonEnableContacts.Location = new System.Drawing.Point(15, 232); this.buttonEnableContacts.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonEnableContacts.Name = "buttonEnableContacts"; - this.buttonEnableContacts.Size = new System.Drawing.Size(280, 44); + this.buttonEnableContacts.Size = new System.Drawing.Size(266, 44); this.buttonEnableContacts.TabIndex = 11; this.buttonEnableContacts.Text = "Enable Selected Electrodes"; this.toolTip.SetToolTip(this.buttonEnableContacts, "Click and drag to select electrodes in the probe view. \r\nPress this button to ena" + @@ -166,7 +175,7 @@ private void InitializeComponent() this.buttonClearSelections.Location = new System.Drawing.Point(15, 282); this.buttonClearSelections.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonClearSelections.Name = "buttonClearSelections"; - this.buttonClearSelections.Size = new System.Drawing.Size(280, 44); + this.buttonClearSelections.Size = new System.Drawing.Size(266, 44); this.buttonClearSelections.TabIndex = 12; this.buttonClearSelections.Text = "Clear Electrode Selection"; this.toolTip.SetToolTip(this.buttonClearSelections, "Deselect all electrodes in the probe view. \r\nNote that this does not disable elec" + @@ -177,7 +186,7 @@ private void InitializeComponent() // buttonChooseCalibrationFile // this.buttonChooseCalibrationFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonChooseCalibrationFile.Location = new System.Drawing.Point(258, 29); + this.buttonChooseCalibrationFile.Location = new System.Drawing.Point(244, 29); this.buttonChooseCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonChooseCalibrationFile.Name = "buttonChooseCalibrationFile"; this.buttonChooseCalibrationFile.Size = new System.Drawing.Size(37, 25); @@ -243,10 +252,10 @@ private void InitializeComponent() this.panelChannelOptions.Controls.Add(this.buttonEnableContacts); this.panelChannelOptions.Controls.Add(this.buttonClearSelections); this.panelChannelOptions.Dock = System.Windows.Forms.DockStyle.Fill; - this.panelChannelOptions.Location = new System.Drawing.Point(922, 2); + this.panelChannelOptions.Location = new System.Drawing.Point(3, 3); this.panelChannelOptions.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panelChannelOptions.Name = "panelChannelOptions"; - this.panelChannelOptions.Size = new System.Drawing.Size(309, 662); + this.panelChannelOptions.Size = new System.Drawing.Size(295, 599); this.panelChannelOptions.TabIndex = 1; // // checkBoxInvertPolarity @@ -268,7 +277,7 @@ private void InitializeComponent() this.textBoxGainCorrection.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxGainCorrection.Name = "textBoxGainCorrection"; this.textBoxGainCorrection.ReadOnly = true; - this.textBoxGainCorrection.Size = new System.Drawing.Size(188, 22); + this.textBoxGainCorrection.Size = new System.Drawing.Size(174, 22); this.textBoxGainCorrection.TabIndex = 4; this.textBoxGainCorrection.TabStop = false; // @@ -279,11 +288,9 @@ private void InitializeComponent() this.textBoxProbeCalibrationFile.Location = new System.Drawing.Point(15, 30); this.textBoxProbeCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxProbeCalibrationFile.Name = "textBoxProbeCalibrationFile"; - this.textBoxProbeCalibrationFile.Size = new System.Drawing.Size(235, 22); + this.textBoxProbeCalibrationFile.Size = new System.Drawing.Size(221, 22); this.textBoxProbeCalibrationFile.TabIndex = 1; this.textBoxProbeCalibrationFile.TabStop = false; - this.textBoxProbeCalibrationFile.TextChanged += new System.EventHandler(this.FileTextChanged); - this.textBoxProbeCalibrationFile.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxKeyPress); // // comboBoxReference // @@ -294,7 +301,7 @@ private void InitializeComponent() this.comboBoxReference.Location = new System.Drawing.Point(107, 110); this.comboBoxReference.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxReference.Name = "comboBoxReference"; - this.comboBoxReference.Size = new System.Drawing.Size(188, 24); + this.comboBoxReference.Size = new System.Drawing.Size(174, 24); this.comboBoxReference.TabIndex = 6; // // comboBoxChannelPresets @@ -306,7 +313,7 @@ private void InitializeComponent() this.comboBoxChannelPresets.Location = new System.Drawing.Point(107, 150); this.comboBoxChannelPresets.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxChannelPresets.Name = "comboBoxChannelPresets"; - this.comboBoxChannelPresets.Size = new System.Drawing.Size(188, 24); + this.comboBoxChannelPresets.Size = new System.Drawing.Size(174, 24); this.comboBoxChannelPresets.TabIndex = 8; // // buttonCancel @@ -345,18 +352,60 @@ private void InitializeComponent() this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 315F)); this.tableLayoutPanel1.Controls.Add(this.panelTrackBar, 1, 0); this.tableLayoutPanel1.Controls.Add(this.panelProbe, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.tabControlProbe, 2, 0); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.panelChannelOptions, 2, 0); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 46F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(1234, 712); this.tableLayoutPanel1.TabIndex = 0; // + // tabControlProbe + // + this.tabControlProbe.Controls.Add(this.tabPageConfiguration); + this.tabControlProbe.Controls.Add(this.tabPageProperties); + this.tabControlProbe.Location = new System.Drawing.Point(922, 2); + this.tabControlProbe.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.tabControlProbe.Name = "tabControlProbe"; + this.tabControlProbe.SelectedIndex = 0; + this.tabControlProbe.Size = new System.Drawing.Size(309, 634); + this.tabControlProbe.TabIndex = 31; + this.tabControlProbe.TabStop = false; + // + // tabPageConfiguration + // + this.tabPageConfiguration.Controls.Add(this.panelChannelOptions); + this.tabPageConfiguration.Location = new System.Drawing.Point(4, 25); + this.tabPageConfiguration.Name = "tabPageConfiguration"; + this.tabPageConfiguration.Padding = new System.Windows.Forms.Padding(3); + this.tabPageConfiguration.Size = new System.Drawing.Size(301, 605); + this.tabPageConfiguration.TabIndex = 1; + this.tabPageConfiguration.Text = "Configuration"; + this.tabPageConfiguration.UseVisualStyleBackColor = true; + // + // tabPageProperties + // + this.tabPageProperties.Controls.Add(this.propertyGrid); + this.tabPageProperties.Location = new System.Drawing.Point(4, 25); + this.tabPageProperties.Name = "tabPageProperties"; + this.tabPageProperties.Size = new System.Drawing.Size(301, 605); + this.tabPageProperties.TabIndex = 0; + this.tabPageProperties.Text = "Properties"; + this.tabPageProperties.UseVisualStyleBackColor = true; + // + // propertyGrid + // + this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Right; + this.propertyGrid.Location = new System.Drawing.Point(8, 0); + this.propertyGrid.Name = "propertyGrid"; + this.propertyGrid.Size = new System.Drawing.Size(293, 605); + this.propertyGrid.TabIndex = 0; + // // flowLayoutPanel1 // this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutPanel1, 3); @@ -413,9 +462,14 @@ private void InitializeComponent() this.panelChannelOptions.PerformLayout(); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); + this.tabControlProbe.ResumeLayout(false); + this.tabPageConfiguration.ResumeLayout(false); + this.tabPageConfiguration.PerformLayout(); + this.tabPageProperties.ResumeLayout(false); this.flowLayoutPanel1.ResumeLayout(false); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -445,5 +499,10 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripStatusLabel toolStripGainCalSN; private System.Windows.Forms.ToolStripStatusLabel toolStripLabelGainCalibrationSN; private System.Windows.Forms.CheckBox checkBoxInvertPolarity; + private System.Windows.Forms.TabControl tabControlProbe; + private System.Windows.Forms.TabPage tabPageProperties; + private Bonsai.Design.PropertyGrid propertyGrid; + private System.Windows.Forms.TabPage tabPageConfiguration; + private System.Windows.Forms.BindingSource bindingSource; } } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.cs index 70f0abf2..364e6fe1 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.cs @@ -13,8 +13,6 @@ public partial class NeuropixelsV2eProbeConfigurationDialog : Form { readonly NeuropixelsV2eChannelConfigurationDialog ChannelConfiguration; - internal event EventHandler InvertPolarityChanged; - /// /// Public object that is manipulated by /// . @@ -43,9 +41,6 @@ public NeuropixelsV2eProbeConfigurationDialog(NeuropixelsV2ProbeConfiguration co InitializeComponent(); Shown += FormShown; - textBoxProbeCalibrationFile.Text = configuration.GainCalibrationFileName; - textBoxProbeCalibrationFile.TextChanged += (sender, e) => ProbeConfiguration.GainCalibrationFileName = ((TextBox)sender).Text; - ChannelConfiguration = new(configuration); ChannelConfiguration.SetChildFormProperties(this).AddDialogToPanel(panelProbe); @@ -54,23 +49,78 @@ public NeuropixelsV2eProbeConfigurationDialog(NeuropixelsV2ProbeConfiguration co ChannelConfiguration.OnZoom += UpdateTrackBarLocation; ChannelConfiguration.OnFileLoad += OnFileLoadEvent; + propertyGrid.SelectedObject = configuration; + bindingSource.DataSource = configuration; + ProbeData = ProbeDataFactory(configuration); + textBoxProbeCalibrationFile.DataBindings.Add("Text", + bindingSource, + $"{nameof(configuration.GainCalibrationFileName)}", + false, + DataSourceUpdateMode.OnPropertyChanged); + textBoxProbeCalibrationFile.TextChanged += (sender, e) => CheckStatus(); + comboBoxReference.DataSource = ProbeData.GetReferenceEnumValues(); - comboBoxReference.SelectedItem = ProbeConfiguration.Reference; - comboBoxReference.SelectedIndexChanged += SelectedReferenceChanged; + comboBoxReference.DataBindings.Add("SelectedItem", + bindingSource, + nameof(configuration.Reference), + false, + DataSourceUpdateMode.OnPropertyChanged); + comboBoxReference.SelectedIndexChanged += (sender, e) => + { + // NB: Needed to capture mouse scroll wheel updates + var control = sender as Control; - comboBoxChannelPresets.DataSource = ProbeData.GetComboBoxChannelPresets(); - comboBoxChannelPresets.SelectedIndexChanged += SelectedChannelPresetChanged; + foreach (Binding binding in control.DataBindings) + { + binding.WriteValue(); + } - checkBoxInvertPolarity.Checked = ProbeConfiguration.InvertPolarity; - checkBoxInvertPolarity.CheckedChanged += InvertPolarityIndexChanged; + bindingSource.ResetCurrentItem(); + }; + comboBoxChannelPresets.DataSource = ProbeData.GetComboBoxChannelPresets(); CheckForExistingChannelPreset(); + comboBoxChannelPresets.SelectedIndexChanged += (sender, e) => + { + try + { + Enum channelPreset = ((ComboBox)sender).SelectedItem as Enum ?? throw new InvalidEnumArgumentException("Invalid argument given for the channel preset."); + ProbeConfiguration.SelectElectrodes(ProbeData.GetChannelPreset(channelPreset)); + } + catch (InvalidEnumArgumentException ex) + { + MessageBox.Show(ex.Message, "Invalid Preset Chosen"); + return; + } + + ChannelConfiguration.HighlightEnabledContacts(); + ChannelConfiguration.HighlightSelectedContacts(); + ChannelConfiguration.UpdateContactLabels(); + ChannelConfiguration.RefreshZedGraph(); + }; + + checkBoxInvertPolarity.DataBindings.Add("Checked", + bindingSource, + $"{nameof(configuration.InvertPolarity)}", + false, + DataSourceUpdateMode.OnPropertyChanged); CheckStatus(); Text += ": " + ProbeConfiguration.Probe.ToString(); + + bindingSource.ListChanged += (sender, eventArgs) => propertyGrid.Refresh(); + + tabControlProbe.SelectedIndexChanged += (sender, eventArgs) => + { + if (tabControlProbe.SelectedTab == tabPageProperties) + propertyGrid.Refresh(); + + else if (tabControlProbe.SelectedTab == tabPageConfiguration) + bindingSource.ResetCurrentItem(); + }; } static INeuropixelsV2ProbeInfo ProbeDataFactory(NeuropixelsV2ProbeConfiguration configuration) @@ -83,26 +133,6 @@ static INeuropixelsV2ProbeInfo ProbeDataFactory(NeuropixelsV2ProbeConfiguration throw new NotImplementedException("Unknown configuration found."); } - private void InvertPolarityIndexChanged(object sender, EventArgs e) - { - ProbeConfiguration.InvertPolarity = ((CheckBox)sender).Checked; - OnInvertPolarityChangedHandler(); - } - - /// - /// Set the value to the given boolean. - /// - /// Boolean denoting whether or not to invert the neural data polarity. - public void SetInvertPolarity(bool invertPolarity) - { - checkBoxInvertPolarity.Checked = invertPolarity; - } - - private void OnInvertPolarityChangedHandler() - { - InvertPolarityChanged?.Invoke(this, EventArgs.Empty); - } - private void FormShown(object sender, EventArgs e) { if (!TopLevel) @@ -118,22 +148,6 @@ private void FormShown(object sender, EventArgs e) ChannelConfiguration.ResizeZedGraph(); } - private void SelectedReferenceChanged(object sender, EventArgs e) - { - ProbeConfiguration.Reference = (Enum)((ComboBox)sender).SelectedItem; - } - - private void SelectedChannelPresetChanged(object sender, EventArgs e) - { - Enum channelPreset = ((ComboBox)sender).SelectedItem as Enum ?? throw new InvalidEnumArgumentException("Invalid argument given for the channel preset."); - ProbeConfiguration.SelectElectrodes(ProbeData.GetChannelPreset(channelPreset)); - - ChannelConfiguration.HighlightEnabledContacts(); - ChannelConfiguration.HighlightSelectedContacts(); - ChannelConfiguration.UpdateContactLabels(); - ChannelConfiguration.RefreshZedGraph(); - } - void CheckForExistingChannelPreset() { comboBoxChannelPresets.SelectedItem = ProbeData.CheckForExistingChannelPreset(ProbeConfiguration.ChannelMap); @@ -144,11 +158,6 @@ private void OnFileLoadEvent(object sender, EventArgs e) CheckForExistingChannelPreset(); } - private void FileTextChanged(object sender, EventArgs e) - { - CheckStatus(); - } - private void CheckStatus() { const string NoFileSelected = "No file selected."; @@ -257,10 +266,5 @@ private void UpdateTrackBarLocation(object sender, EventArgs e) { trackBarProbePosition.Value = (int)(ChannelConfiguration.GetRelativeVerticalPosition() * trackBarProbePosition.Maximum); } - - void TextBoxKeyPress(object sender, KeyPressEventArgs e) - { - CheckStatus(); - } } } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.resx b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.resx index 05161bfb..ea19c317 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.resx +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.resx @@ -141,6 +141,9 @@ 382, 17 + + 497, 17 + diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationEditor.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationEditor.cs index 3198600d..21b20ad5 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationEditor.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationEditor.cs @@ -29,11 +29,11 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide if (editorService != null && editorState != null && !editorState.WorkflowRunning && value is NeuropixelsV2ProbeConfiguration configuration) { - var instance = (IConfigureNeuropixelsV2)context.Instance; + bool isBeta = (IConfigureNeuropixelsV2)context.Instance is ConfigureNeuropixelsV2eBeta; - bool isBeta = instance is ConfigureNeuropixelsV2eBeta; + var configurationCopy = configuration.Clone(); - using var editorDialog = new NeuropixelsV2eProbeConfigurationDialog(configuration); + using var editorDialog = new NeuropixelsV2eProbeConfigurationDialog(configurationCopy); if (isBeta) { From 2ef5fbd3df6ada159ca850edc281001ba26d4dea Mon Sep 17 00:00:00 2001 From: bparks13 Date: Tue, 9 Dec 2025 11:43:07 -0500 Subject: [PATCH 06/11] Address review comments - Add categories to properties - Allow the GUI panels to be resized so the property grid can be better visualized - Fix the stimulus sequence options so that they resize properly - Adjust NeuropixelsV2Dialog to show device properties at all times, and display probe configuration dialogs when selected from the property grid --- .../ChannelConfigurationDialog.cs | 8 + .../GenericStimulusSequenceDialog.Designer.cs | 215 ++++++---- .../GenericStimulusSequenceDialog.cs | 4 +- ...tage64OpticalStimulatorOptions.Designer.cs | 60 +-- ...xelsV1ProbeConfigurationDialog.Designer.cs | 133 +++--- .../NeuropixelsV2eDialog.Designer.cs | 89 ++-- .../NeuropixelsV2eDialog.cs | 45 +- ...elsV2eProbeConfigurationDialog.Designer.cs | 388 ++++++++++-------- .../NeuropixelsV2eProbeConfigurationDialog.cs | 13 +- ...europixelsV2eProbeConfigurationDialog.resx | 20 +- .../NeuropixelsV2eProbeConfigurationEditor.cs | 6 +- .../Rhs2116StimulusSequenceDialog.cs | 2 +- ...Rhs2116StimulusSequenceOptions.Designer.cs | 17 + .../ConfigureHeadstage64OpticalStimulator.cs | 1 + OpenEphys.Onix1/ConfigureRhs2116Trigger.cs | 1 + .../NeuropixelsV2ProbeConfiguration.cs | 3 + 16 files changed, 586 insertions(+), 419 deletions(-) diff --git a/OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs b/OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs index b69d801e..43453c7a 100644 --- a/OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs @@ -367,6 +367,14 @@ internal void DrawProbeGroup() OnDrawProbeGroupHandler(); } + internal void UpdateProbeGroup() + { + HighlightEnabledContacts(); + HighlightSelectedContacts(); + UpdateContactLabels(); + RefreshZedGraph(); + } + void OnDrawProbeGroupHandler() { OnDrawProbeGroup?.Invoke(this, EventArgs.Empty); diff --git a/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.Designer.cs b/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.Designer.cs index b37b63bf..49d3f8cf 100644 --- a/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.Designer.cs @@ -30,51 +30,46 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GenericStimulusSequenceDialog)); - this.buttonCancel = new System.Windows.Forms.Button(); this.statusStrip = new System.Windows.Forms.StatusStrip(); this.toolStripStatusIsValid = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusText = new System.Windows.Forms.ToolStripStatusLabel(); - this.buttonOk = new System.Windows.Forms.Button(); this.menuStrip = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.stimulusWaveformToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.panelWaveform = new System.Windows.Forms.Panel(); - this.zedGraphWaveform = new ZedGraph.ZedGraphControl(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.buttonResetZoom = new System.Windows.Forms.Button(); + this.panelWaveform = new System.Windows.Forms.Panel(); + this.zedGraphWaveform = new ZedGraph.ZedGraphControl(); this.tabControlProperties = new System.Windows.Forms.TabControl(); this.tabPageDefineStimuli = new System.Windows.Forms.TabPage(); this.tabPageProperties = new System.Windows.Forms.TabPage(); this.propertyGrid = new System.Windows.Forms.PropertyGrid(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonOk = new System.Windows.Forms.Button(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.bindingSource = new System.Windows.Forms.BindingSource(this.components); this.statusStrip.SuspendLayout(); this.menuStrip.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); - this.flowLayoutPanel1.SuspendLayout(); - this.panelWaveform.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout(); + this.panelWaveform.SuspendLayout(); this.tabControlProperties.SuspendLayout(); this.tabPageProperties.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit(); this.SuspendLayout(); // - // buttonCancel - // - this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonCancel.Location = new System.Drawing.Point(993, 2); - this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.Size = new System.Drawing.Size(144, 32); - this.buttonCancel.TabIndex = 0; - this.buttonCancel.Text = "Cancel"; - this.buttonCancel.UseVisualStyleBackColor = true; - // // statusStrip // this.statusStrip.AutoSize = false; @@ -107,18 +102,6 @@ private void InitializeComponent() this.toolStripStatusText.Size = new System.Drawing.Size(0, 21); this.toolStripStatusText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // buttonOk - // - this.buttonOk.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonOk.Location = new System.Drawing.Point(843, 2); - this.buttonOk.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.buttonOk.Name = "buttonOk"; - this.buttonOk.Size = new System.Drawing.Size(144, 32); - this.buttonOk.TabIndex = 4; - this.buttonOk.Text = "OK"; - this.buttonOk.UseVisualStyleBackColor = true; - this.buttonOk.Click += new System.EventHandler(this.ButtonOk_Click); - // // menuStrip // this.menuStrip.ImageScalingSize = new System.Drawing.Size(24, 24); @@ -145,56 +128,94 @@ private void InitializeComponent() this.openFileToolStripMenuItem, this.saveFileToolStripMenuItem}); this.stimulusWaveformToolStripMenuItem.Name = "stimulusWaveformToolStripMenuItem"; - this.stimulusWaveformToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.stimulusWaveformToolStripMenuItem.Size = new System.Drawing.Size(178, 22); this.stimulusWaveformToolStripMenuItem.Text = "Stimulus Waveform"; // // openFileToolStripMenuItem // this.openFileToolStripMenuItem.Name = "openFileToolStripMenuItem"; - this.openFileToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.openFileToolStripMenuItem.Size = new System.Drawing.Size(131, 22); this.openFileToolStripMenuItem.Text = "Import File"; this.openFileToolStripMenuItem.Click += new System.EventHandler(this.MenuItemLoadFile_Click); // // saveFileToolStripMenuItem // this.saveFileToolStripMenuItem.Name = "saveFileToolStripMenuItem"; - this.saveFileToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.saveFileToolStripMenuItem.Size = new System.Drawing.Size(131, 22); this.saveFileToolStripMenuItem.Text = "Export File"; this.saveFileToolStripMenuItem.Click += new System.EventHandler(this.MenuItemSaveFile_Click); // // tableLayoutPanel1 // - this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnCount = 1; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 451F)); - this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.panelWaveform, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.tabControlProperties, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.splitContainer1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowCount = 2; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 42F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 42F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(1146, 563); this.tableLayoutPanel1.TabIndex = 8; // - // flowLayoutPanel1 + // splitContainer1 // - this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutPanel1, 2); - this.flowLayoutPanel1.Controls.Add(this.buttonCancel); - this.flowLayoutPanel1.Controls.Add(this.buttonOk); - this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 523); - this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(1140, 38); - this.flowLayoutPanel1.TabIndex = 7; + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(3, 3); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.tableLayoutPanel2); + this.splitContainer1.Panel1MinSize = 150; + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.tabControlProperties); + this.splitContainer1.Panel2MinSize = 335; + this.splitContainer1.Size = new System.Drawing.Size(1140, 515); + this.splitContainer1.SplitterDistance = 776; + this.splitContainer1.TabIndex = 11; + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 1; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.Controls.Add(this.flowLayoutPanel2, 0, 1); + this.tableLayoutPanel2.Controls.Add(this.panelWaveform, 0, 0); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 2; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 42F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(776, 515); + this.tableLayoutPanel2.TabIndex = 0; + // + // flowLayoutPanel2 + // + this.flowLayoutPanel2.Controls.Add(this.buttonResetZoom); + this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 476); + this.flowLayoutPanel2.Name = "flowLayoutPanel2"; + this.flowLayoutPanel2.Size = new System.Drawing.Size(770, 36); + this.flowLayoutPanel2.TabIndex = 9; + // + // buttonResetZoom + // + this.buttonResetZoom.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.buttonResetZoom.Location = new System.Drawing.Point(3, 2); + this.buttonResetZoom.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonResetZoom.Name = "buttonResetZoom"; + this.buttonResetZoom.Size = new System.Drawing.Size(144, 32); + this.buttonResetZoom.TabIndex = 5; + this.buttonResetZoom.Text = "Reset Zoom"; + this.buttonResetZoom.UseVisualStyleBackColor = true; + this.buttonResetZoom.Click += new System.EventHandler(this.ResetZoom_Click); // // panelWaveform // @@ -202,7 +223,7 @@ private void InitializeComponent() this.panelWaveform.Dock = System.Windows.Forms.DockStyle.Fill; this.panelWaveform.Location = new System.Drawing.Point(3, 3); this.panelWaveform.Name = "panelWaveform"; - this.panelWaveform.Size = new System.Drawing.Size(689, 473); + this.panelWaveform.Size = new System.Drawing.Size(770, 467); this.panelWaveform.TabIndex = 8; // // zedGraphWaveform @@ -218,41 +239,19 @@ private void InitializeComponent() this.zedGraphWaveform.ScrollMinX = 0D; this.zedGraphWaveform.ScrollMinY = 0D; this.zedGraphWaveform.ScrollMinY2 = 0D; - this.zedGraphWaveform.Size = new System.Drawing.Size(689, 473); + this.zedGraphWaveform.Size = new System.Drawing.Size(770, 467); this.zedGraphWaveform.TabIndex = 6; this.zedGraphWaveform.UseExtendedPrintDialog = true; // - // flowLayoutPanel2 - // - this.flowLayoutPanel2.Controls.Add(this.buttonResetZoom); - this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 482); - this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Size = new System.Drawing.Size(689, 36); - this.flowLayoutPanel2.TabIndex = 9; - // - // buttonResetZoom - // - this.buttonResetZoom.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonResetZoom.Location = new System.Drawing.Point(3, 2); - this.buttonResetZoom.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.buttonResetZoom.Name = "buttonResetZoom"; - this.buttonResetZoom.Size = new System.Drawing.Size(144, 32); - this.buttonResetZoom.TabIndex = 5; - this.buttonResetZoom.Text = "Reset Zoom"; - this.buttonResetZoom.UseVisualStyleBackColor = true; - this.buttonResetZoom.Click += new System.EventHandler(this.ResetZoom_Click); - // // tabControlProperties // this.tabControlProperties.Controls.Add(this.tabPageDefineStimuli); this.tabControlProperties.Controls.Add(this.tabPageProperties); this.tabControlProperties.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControlProperties.Location = new System.Drawing.Point(698, 3); + this.tabControlProperties.Location = new System.Drawing.Point(0, 0); this.tabControlProperties.Name = "tabControlProperties"; - this.tableLayoutPanel1.SetRowSpan(this.tabControlProperties, 2); this.tabControlProperties.SelectedIndex = 0; - this.tabControlProperties.Size = new System.Drawing.Size(445, 515); + this.tabControlProperties.Size = new System.Drawing.Size(360, 515); this.tabControlProperties.TabIndex = 10; // // tabPageDefineStimuli @@ -260,7 +259,7 @@ private void InitializeComponent() this.tabPageDefineStimuli.Location = new System.Drawing.Point(4, 25); this.tabPageDefineStimuli.Name = "tabPageDefineStimuli"; this.tabPageDefineStimuli.Padding = new System.Windows.Forms.Padding(3); - this.tabPageDefineStimuli.Size = new System.Drawing.Size(437, 486); + this.tabPageDefineStimuli.Size = new System.Drawing.Size(352, 486); this.tabPageDefineStimuli.TabIndex = 0; this.tabPageDefineStimuli.Text = "Define Stimuli"; this.tabPageDefineStimuli.UseVisualStyleBackColor = true; @@ -271,7 +270,7 @@ private void InitializeComponent() this.tabPageProperties.Location = new System.Drawing.Point(4, 25); this.tabPageProperties.Name = "tabPageProperties"; this.tabPageProperties.Padding = new System.Windows.Forms.Padding(3); - this.tabPageProperties.Size = new System.Drawing.Size(437, 486); + this.tabPageProperties.Size = new System.Drawing.Size(432, 486); this.tabPageProperties.TabIndex = 1; this.tabPageProperties.Text = "Properties"; this.tabPageProperties.UseVisualStyleBackColor = true; @@ -281,10 +280,45 @@ private void InitializeComponent() this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill; this.propertyGrid.Location = new System.Drawing.Point(3, 3); this.propertyGrid.Name = "propertyGrid"; - this.propertyGrid.Size = new System.Drawing.Size(431, 480); + this.propertyGrid.Size = new System.Drawing.Size(426, 480); this.propertyGrid.TabIndex = 0; this.propertyGrid.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.PropertyValueChanged); // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.Controls.Add(this.buttonCancel); + this.flowLayoutPanel1.Controls.Add(this.buttonOk); + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; + this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 523); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(1140, 38); + this.flowLayoutPanel1.TabIndex = 7; + // + // buttonCancel + // + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.buttonCancel.Location = new System.Drawing.Point(993, 2); + this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(144, 32); + this.buttonCancel.TabIndex = 0; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + // + // buttonOk + // + this.buttonOk.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.buttonOk.Location = new System.Drawing.Point(843, 2); + this.buttonOk.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonOk.Name = "buttonOk"; + this.buttonOk.Size = new System.Drawing.Size(144, 32); + this.buttonOk.TabIndex = 4; + this.buttonOk.Text = "OK"; + this.buttonOk.UseVisualStyleBackColor = true; + this.buttonOk.Click += new System.EventHandler(this.ButtonOk_Click); + // // GenericStimulusSequenceDialog // this.AccessibleDescription = ""; @@ -307,11 +341,16 @@ private void InitializeComponent() this.menuStrip.ResumeLayout(false); this.menuStrip.PerformLayout(); this.tableLayoutPanel1.ResumeLayout(false); - this.flowLayoutPanel1.ResumeLayout(false); - this.panelWaveform.ResumeLayout(false); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.tableLayoutPanel2.ResumeLayout(false); this.flowLayoutPanel2.ResumeLayout(false); + this.panelWaveform.ResumeLayout(false); this.tabControlProperties.ResumeLayout(false); this.tabPageProperties.ResumeLayout(false); + this.flowLayoutPanel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -321,15 +360,12 @@ private void InitializeComponent() #endregion private System.Windows.Forms.StatusStrip statusStrip; internal System.Windows.Forms.ToolStripStatusLabel toolStripStatusIsValid; - private System.Windows.Forms.Button buttonCancel; internal System.Windows.Forms.ToolStripStatusLabel toolStripStatusText; - private System.Windows.Forms.Button buttonOk; private System.Windows.Forms.MenuStrip menuStrip; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem openFileToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem saveFileToolStripMenuItem; private System.Windows.Forms.ToolTip toolTip1; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; internal System.Windows.Forms.ToolStripMenuItem stimulusWaveformToolStripMenuItem; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; private System.Windows.Forms.Button buttonResetZoom; @@ -341,5 +377,10 @@ private void InitializeComponent() internal System.Windows.Forms.PropertyGrid propertyGrid; internal System.Windows.Forms.BindingSource bindingSource; internal System.Windows.Forms.TabControl tabControlProperties; + private System.Windows.Forms.SplitContainer splitContainer1; + internal System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Button buttonOk; } } diff --git a/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs b/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs index a14d9073..735be5b8 100644 --- a/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs +++ b/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs @@ -56,10 +56,12 @@ void FormShown(object sender, EventArgs e) if (!TopLevel) { tableLayoutPanel1.Controls.Remove(flowLayoutPanel1); - tableLayoutPanel1.RowCount = 2; + tableLayoutPanel1.RowCount -= 1; menuStrip.Visible = false; } + + splitContainer1.SplitterDistance = splitContainer1.Size.Width - splitContainer1.Panel2MinSize; } void ButtonOk_Click(object sender, EventArgs e) diff --git a/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorOptions.Designer.cs b/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorOptions.Designer.cs index 9c3c103b..157cab5f 100644 --- a/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorOptions.Designer.cs +++ b/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorOptions.Designer.cs @@ -54,15 +54,15 @@ private void InitializeComponent() // // textBoxDelay // - this.textBoxDelay.Location = new System.Drawing.Point(356, 244); + this.textBoxDelay.Location = new System.Drawing.Point(346, 244); this.textBoxDelay.Name = "textBoxDelay"; - this.textBoxDelay.Size = new System.Drawing.Size(75, 22); + this.textBoxDelay.Size = new System.Drawing.Size(70, 22); this.textBoxDelay.TabIndex = 19; // // labelDelay // this.labelDelay.AutoSize = true; - this.labelDelay.Location = new System.Drawing.Point(218, 247); + this.labelDelay.Location = new System.Drawing.Point(208, 247); this.labelDelay.Name = "labelDelay"; this.labelDelay.Size = new System.Drawing.Size(72, 16); this.labelDelay.TabIndex = 18; @@ -70,16 +70,16 @@ private void InitializeComponent() // // textBoxBurstsPerTrain // - this.textBoxBurstsPerTrain.Location = new System.Drawing.Point(133, 244); + this.textBoxBurstsPerTrain.Location = new System.Drawing.Point(130, 244); this.textBoxBurstsPerTrain.Name = "textBoxBurstsPerTrain"; - this.textBoxBurstsPerTrain.Size = new System.Drawing.Size(75, 22); + this.textBoxBurstsPerTrain.Size = new System.Drawing.Size(70, 22); this.textBoxBurstsPerTrain.TabIndex = 17; this.textBoxBurstsPerTrain.TextChanged += new System.EventHandler(this.BurstsPerTrainChanged); // // labelBurstsPerTrain // this.labelBurstsPerTrain.AutoSize = true; - this.labelBurstsPerTrain.Location = new System.Drawing.Point(6, 247); + this.labelBurstsPerTrain.Location = new System.Drawing.Point(3, 247); this.labelBurstsPerTrain.Name = "labelBurstsPerTrain"; this.labelBurstsPerTrain.Size = new System.Drawing.Size(102, 16); this.labelBurstsPerTrain.TabIndex = 16; @@ -87,14 +87,14 @@ private void InitializeComponent() // // textBoxInterBurstInterval // - this.textBoxInterBurstInterval.Location = new System.Drawing.Point(356, 195); + this.textBoxInterBurstInterval.Location = new System.Drawing.Point(346, 195); this.textBoxInterBurstInterval.Name = "textBoxInterBurstInterval"; - this.textBoxInterBurstInterval.Size = new System.Drawing.Size(75, 22); + this.textBoxInterBurstInterval.Size = new System.Drawing.Size(70, 22); this.textBoxInterBurstInterval.TabIndex = 15; // // labelInterBurstInterval // - this.labelInterBurstInterval.Location = new System.Drawing.Point(216, 198); + this.labelInterBurstInterval.Location = new System.Drawing.Point(206, 198); this.labelInterBurstInterval.Name = "labelInterBurstInterval"; this.labelInterBurstInterval.Size = new System.Drawing.Size(146, 19); this.labelInterBurstInterval.TabIndex = 14; @@ -102,16 +102,16 @@ private void InitializeComponent() // // textBoxPulsesPerBurst // - this.textBoxPulsesPerBurst.Location = new System.Drawing.Point(133, 195); + this.textBoxPulsesPerBurst.Location = new System.Drawing.Point(130, 195); this.textBoxPulsesPerBurst.Name = "textBoxPulsesPerBurst"; - this.textBoxPulsesPerBurst.Size = new System.Drawing.Size(75, 22); + this.textBoxPulsesPerBurst.Size = new System.Drawing.Size(70, 22); this.textBoxPulsesPerBurst.TabIndex = 13; this.textBoxPulsesPerBurst.TextChanged += new System.EventHandler(this.PulsesPerBurstChanged); // // labelPulsesPerBurst // this.labelPulsesPerBurst.AutoSize = true; - this.labelPulsesPerBurst.Location = new System.Drawing.Point(6, 198); + this.labelPulsesPerBurst.Location = new System.Drawing.Point(3, 198); this.labelPulsesPerBurst.Name = "labelPulsesPerBurst"; this.labelPulsesPerBurst.Size = new System.Drawing.Size(105, 16); this.labelPulsesPerBurst.TabIndex = 12; @@ -120,7 +120,7 @@ private void InitializeComponent() // labelMaxCurrent // this.labelMaxCurrent.AutoSize = true; - this.labelMaxCurrent.Location = new System.Drawing.Point(6, 20); + this.labelMaxCurrent.Location = new System.Drawing.Point(3, 20); this.labelMaxCurrent.Name = "labelMaxCurrent"; this.labelMaxCurrent.Size = new System.Drawing.Size(108, 16); this.labelMaxCurrent.TabIndex = 0; @@ -128,22 +128,22 @@ private void InitializeComponent() // // textBoxMaxCurrent // - this.textBoxMaxCurrent.Location = new System.Drawing.Point(133, 17); + this.textBoxMaxCurrent.Location = new System.Drawing.Point(130, 17); this.textBoxMaxCurrent.Name = "textBoxMaxCurrent"; - this.textBoxMaxCurrent.Size = new System.Drawing.Size(75, 22); + this.textBoxMaxCurrent.Size = new System.Drawing.Size(70, 22); this.textBoxMaxCurrent.TabIndex = 1; // // textBoxChannelOnePercent // - this.textBoxChannelOnePercent.Location = new System.Drawing.Point(133, 58); + this.textBoxChannelOnePercent.Location = new System.Drawing.Point(130, 58); this.textBoxChannelOnePercent.Name = "textBoxChannelOnePercent"; - this.textBoxChannelOnePercent.Size = new System.Drawing.Size(75, 22); + this.textBoxChannelOnePercent.Size = new System.Drawing.Size(70, 22); this.textBoxChannelOnePercent.TabIndex = 3; // // labelChannelOnePercent // this.labelChannelOnePercent.AutoSize = true; - this.labelChannelOnePercent.Location = new System.Drawing.Point(6, 61); + this.labelChannelOnePercent.Location = new System.Drawing.Point(3, 61); this.labelChannelOnePercent.Name = "labelChannelOnePercent"; this.labelChannelOnePercent.Size = new System.Drawing.Size(107, 16); this.labelChannelOnePercent.TabIndex = 2; @@ -152,7 +152,7 @@ private void InitializeComponent() // trackBarChannelOnePercent // this.trackBarChannelOnePercent.LargeChange = 125; - this.trackBarChannelOnePercent.Location = new System.Drawing.Point(11, 83); + this.trackBarChannelOnePercent.Location = new System.Drawing.Point(8, 83); this.trackBarChannelOnePercent.Margin = new System.Windows.Forms.Padding(0); this.trackBarChannelOnePercent.Maximum = 1000; this.trackBarChannelOnePercent.Name = "trackBarChannelOnePercent"; @@ -165,15 +165,15 @@ private void InitializeComponent() // // textBoxPulseDuration // - this.textBoxPulseDuration.Location = new System.Drawing.Point(133, 146); + this.textBoxPulseDuration.Location = new System.Drawing.Point(130, 146); this.textBoxPulseDuration.Name = "textBoxPulseDuration"; - this.textBoxPulseDuration.Size = new System.Drawing.Size(75, 22); + this.textBoxPulseDuration.Size = new System.Drawing.Size(70, 22); this.textBoxPulseDuration.TabIndex = 9; // // labelPulseDuration // this.labelPulseDuration.AutoSize = true; - this.labelPulseDuration.Location = new System.Drawing.Point(6, 149); + this.labelPulseDuration.Location = new System.Drawing.Point(3, 149); this.labelPulseDuration.Name = "labelPulseDuration"; this.labelPulseDuration.Size = new System.Drawing.Size(123, 16); this.labelPulseDuration.TabIndex = 8; @@ -182,7 +182,7 @@ private void InitializeComponent() // trackBarChannelTwoPercent // this.trackBarChannelTwoPercent.LargeChange = 125; - this.trackBarChannelTwoPercent.Location = new System.Drawing.Point(219, 83); + this.trackBarChannelTwoPercent.Location = new System.Drawing.Point(209, 83); this.trackBarChannelTwoPercent.Margin = new System.Windows.Forms.Padding(0); this.trackBarChannelTwoPercent.Maximum = 1000; this.trackBarChannelTwoPercent.Name = "trackBarChannelTwoPercent"; @@ -194,15 +194,15 @@ private void InitializeComponent() // // textBoxChannelTwoPercent // - this.textBoxChannelTwoPercent.Location = new System.Drawing.Point(356, 58); + this.textBoxChannelTwoPercent.Location = new System.Drawing.Point(346, 58); this.textBoxChannelTwoPercent.Name = "textBoxChannelTwoPercent"; - this.textBoxChannelTwoPercent.Size = new System.Drawing.Size(75, 22); + this.textBoxChannelTwoPercent.Size = new System.Drawing.Size(70, 22); this.textBoxChannelTwoPercent.TabIndex = 5; // // labelChannelTwoPercent // this.labelChannelTwoPercent.AutoSize = true; - this.labelChannelTwoPercent.Location = new System.Drawing.Point(216, 61); + this.labelChannelTwoPercent.Location = new System.Drawing.Point(206, 61); this.labelChannelTwoPercent.Name = "labelChannelTwoPercent"; this.labelChannelTwoPercent.Size = new System.Drawing.Size(108, 16); this.labelChannelTwoPercent.TabIndex = 4; @@ -210,15 +210,15 @@ private void InitializeComponent() // // textBoxPulsePeriod // - this.textBoxPulsePeriod.Location = new System.Drawing.Point(356, 146); + this.textBoxPulsePeriod.Location = new System.Drawing.Point(346, 146); this.textBoxPulsePeriod.Name = "textBoxPulsePeriod"; - this.textBoxPulsePeriod.Size = new System.Drawing.Size(75, 22); + this.textBoxPulsePeriod.Size = new System.Drawing.Size(70, 22); this.textBoxPulsePeriod.TabIndex = 11; // // labelPulsePeriod // this.labelPulsePeriod.AutoSize = true; - this.labelPulsePeriod.Location = new System.Drawing.Point(216, 149); + this.labelPulsePeriod.Location = new System.Drawing.Point(206, 149); this.labelPulsePeriod.Name = "labelPulsePeriod"; this.labelPulsePeriod.Size = new System.Drawing.Size(113, 16); this.labelPulsePeriod.TabIndex = 10; @@ -228,7 +228,7 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(438, 289); + this.ClientSize = new System.Drawing.Size(421, 289); this.Controls.Add(this.textBoxPulsePeriod); this.Controls.Add(this.labelPulsePeriod); this.Controls.Add(this.trackBarChannelTwoPercent); diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.Designer.cs b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.Designer.cs index db889dac..bd25873d 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.Designer.cs @@ -49,11 +49,10 @@ private void InitializeComponent() this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.panelProbe = new System.Windows.Forms.Panel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.buttonCancel = new System.Windows.Forms.Button(); this.buttonOkay = new System.Windows.Forms.Button(); - this.panelTrackBar = new System.Windows.Forms.Panel(); + this.panelProbe = new System.Windows.Forms.Panel(); this.trackBarProbePosition = new System.Windows.Forms.TrackBar(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPageConfiguration = new System.Windows.Forms.TabPage(); @@ -76,6 +75,8 @@ private void InitializeComponent() this.tabPageProperties = new System.Windows.Forms.TabPage(); this.propertyGrid = new System.Windows.Forms.PropertyGrid(); this.bindingSource = new System.Windows.Forms.BindingSource(this.components); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); label4 = new System.Windows.Forms.Label(); label2 = new System.Windows.Forms.Label(); labelPresets = new System.Windows.Forms.Label(); @@ -90,13 +91,17 @@ private void InitializeComponent() this.menuStrip.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); - this.panelTrackBar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.trackBarProbePosition)).BeginInit(); this.tabControl1.SuspendLayout(); this.tabPageConfiguration.SuspendLayout(); this.panelOptions.SuspendLayout(); this.tabPageProperties.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); this.SuspendLayout(); // // label4 @@ -258,42 +263,30 @@ private void InitializeComponent() // // tableLayoutPanel1 // - this.tableLayoutPanel1.ColumnCount = 3; + this.tableLayoutPanel1.ColumnCount = 1; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 55F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 315F)); - this.tableLayoutPanel1.Controls.Add(this.panelProbe, 0, 0); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.panelTrackBar, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.tabControl1, 2, 0); + this.tableLayoutPanel1.Controls.Add(this.splitContainer1, 0, 0); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowCount = 3; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 42F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(1234, 712); this.tableLayoutPanel1.TabIndex = 0; // - // panelProbe - // - this.panelProbe.BackColor = System.Drawing.SystemColors.Control; - this.panelProbe.Dock = System.Windows.Forms.DockStyle.Fill; - this.panelProbe.Location = new System.Drawing.Point(4, 4); - this.panelProbe.Margin = new System.Windows.Forms.Padding(4); - this.panelProbe.Name = "panelProbe"; - this.panelProbe.Size = new System.Drawing.Size(856, 662); - this.panelProbe.TabIndex = 0; - // // flowLayoutPanel1 // - this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutPanel1, 3); this.flowLayoutPanel1.Controls.Add(this.buttonCancel); this.flowLayoutPanel1.Controls.Add(this.buttonOkay); this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 672); + this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 652); this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Size = new System.Drawing.Size(1228, 38); @@ -321,26 +314,27 @@ private void InitializeComponent() this.buttonOkay.Text = "OK"; this.buttonOkay.UseVisualStyleBackColor = true; // - // panelTrackBar + // panelProbe // - this.panelTrackBar.Controls.Add(this.trackBarProbePosition); - this.panelTrackBar.Location = new System.Drawing.Point(868, 4); - this.panelTrackBar.Margin = new System.Windows.Forms.Padding(4); - this.panelTrackBar.Name = "panelTrackBar"; - this.panelTrackBar.Size = new System.Drawing.Size(47, 662); - this.panelTrackBar.TabIndex = 33; + this.panelProbe.BackColor = System.Drawing.SystemColors.Control; + this.panelProbe.Dock = System.Windows.Forms.DockStyle.Fill; + this.panelProbe.Location = new System.Drawing.Point(4, 4); + this.panelProbe.Margin = new System.Windows.Forms.Padding(4); + this.panelProbe.Name = "panelProbe"; + this.panelProbe.Size = new System.Drawing.Size(816, 636); + this.panelProbe.TabIndex = 0; // // trackBarProbePosition // this.trackBarProbePosition.AutoSize = false; this.trackBarProbePosition.BackColor = System.Drawing.SystemColors.Control; this.trackBarProbePosition.Dock = System.Windows.Forms.DockStyle.Fill; - this.trackBarProbePosition.Location = new System.Drawing.Point(0, 0); + this.trackBarProbePosition.Location = new System.Drawing.Point(827, 2); this.trackBarProbePosition.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.trackBarProbePosition.Maximum = 100; this.trackBarProbePosition.Name = "trackBarProbePosition"; this.trackBarProbePosition.Orientation = System.Windows.Forms.Orientation.Vertical; - this.trackBarProbePosition.Size = new System.Drawing.Size(47, 662); + this.trackBarProbePosition.Size = new System.Drawing.Size(41, 640); this.trackBarProbePosition.TabIndex = 30; this.trackBarProbePosition.TabStop = false; this.trackBarProbePosition.TickFrequency = 2; @@ -353,10 +347,10 @@ private void InitializeComponent() this.tabControl1.Controls.Add(this.tabPageConfiguration); this.tabControl1.Controls.Add(this.tabPageProperties); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControl1.Location = new System.Drawing.Point(922, 3); + this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(309, 664); + this.tabControl1.Size = new System.Drawing.Size(353, 644); this.tabControl1.TabIndex = 34; // // tabPageConfiguration @@ -365,7 +359,7 @@ private void InitializeComponent() this.tabPageConfiguration.Location = new System.Drawing.Point(4, 25); this.tabPageConfiguration.Name = "tabPageConfiguration"; this.tabPageConfiguration.Padding = new System.Windows.Forms.Padding(3); - this.tabPageConfiguration.Size = new System.Drawing.Size(301, 635); + this.tabPageConfiguration.Size = new System.Drawing.Size(345, 615); this.tabPageConfiguration.TabIndex = 0; this.tabPageConfiguration.Text = "Configuration"; this.tabPageConfiguration.UseVisualStyleBackColor = true; @@ -402,7 +396,7 @@ private void InitializeComponent() this.panelOptions.Location = new System.Drawing.Point(3, 3); this.panelOptions.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panelOptions.Name = "panelOptions"; - this.panelOptions.Size = new System.Drawing.Size(295, 629); + this.panelOptions.Size = new System.Drawing.Size(339, 609); this.panelOptions.TabIndex = 2; // // checkBoxInvertPolarity @@ -424,7 +418,7 @@ private void InitializeComponent() this.textBoxLfpCorrection.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxLfpCorrection.Name = "textBoxLfpCorrection"; this.textBoxLfpCorrection.ReadOnly = true; - this.textBoxLfpCorrection.Size = new System.Drawing.Size(181, 22); + this.textBoxLfpCorrection.Size = new System.Drawing.Size(225, 22); this.textBoxLfpCorrection.TabIndex = 14; this.textBoxLfpCorrection.TabStop = false; // @@ -436,7 +430,7 @@ private void InitializeComponent() this.textBoxApCorrection.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxApCorrection.Name = "textBoxApCorrection"; this.textBoxApCorrection.ReadOnly = true; - this.textBoxApCorrection.Size = new System.Drawing.Size(181, 22); + this.textBoxApCorrection.Size = new System.Drawing.Size(225, 22); this.textBoxApCorrection.TabIndex = 10; this.textBoxApCorrection.TabStop = false; // @@ -448,7 +442,7 @@ private void InitializeComponent() this.buttonViewAdcs.Location = new System.Drawing.Point(12, 66); this.buttonViewAdcs.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonViewAdcs.Name = "buttonViewAdcs"; - this.buttonViewAdcs.Size = new System.Drawing.Size(270, 38); + this.buttonViewAdcs.Size = new System.Drawing.Size(314, 38); this.buttonViewAdcs.TabIndex = 3; this.buttonViewAdcs.Text = "View ADC Correction Values"; this.buttonViewAdcs.UseVisualStyleBackColor = true; @@ -457,7 +451,7 @@ private void InitializeComponent() // buttonChooseAdcCalibrationFile // this.buttonChooseAdcCalibrationFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonChooseAdcCalibrationFile.Location = new System.Drawing.Point(245, 30); + this.buttonChooseAdcCalibrationFile.Location = new System.Drawing.Point(289, 30); this.buttonChooseAdcCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonChooseAdcCalibrationFile.Name = "buttonChooseAdcCalibrationFile"; this.buttonChooseAdcCalibrationFile.Size = new System.Drawing.Size(37, 25); @@ -469,7 +463,7 @@ private void InitializeComponent() // buttonChooseGainCalibrationFile // this.buttonChooseGainCalibrationFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonChooseGainCalibrationFile.Location = new System.Drawing.Point(245, 133); + this.buttonChooseGainCalibrationFile.Location = new System.Drawing.Point(289, 133); this.buttonChooseGainCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonChooseGainCalibrationFile.Name = "buttonChooseGainCalibrationFile"; this.buttonChooseGainCalibrationFile.Size = new System.Drawing.Size(37, 25); @@ -485,7 +479,7 @@ private void InitializeComponent() this.buttonEnableContacts.Location = new System.Drawing.Point(13, 464); this.buttonEnableContacts.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonEnableContacts.Name = "buttonEnableContacts"; - this.buttonEnableContacts.Size = new System.Drawing.Size(269, 44); + this.buttonEnableContacts.Size = new System.Drawing.Size(313, 44); this.buttonEnableContacts.TabIndex = 23; this.buttonEnableContacts.Text = "Enable Selected Electrodes"; this.buttonEnableContacts.UseVisualStyleBackColor = true; @@ -498,7 +492,7 @@ private void InitializeComponent() this.buttonClearSelections.Location = new System.Drawing.Point(13, 512); this.buttonClearSelections.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonClearSelections.Name = "buttonClearSelections"; - this.buttonClearSelections.Size = new System.Drawing.Size(269, 44); + this.buttonClearSelections.Size = new System.Drawing.Size(313, 44); this.buttonClearSelections.TabIndex = 24; this.buttonClearSelections.Text = "Clear Electrode Selection"; this.buttonClearSelections.UseVisualStyleBackColor = true; @@ -513,7 +507,7 @@ private void InitializeComponent() this.comboBoxChannelPresets.Location = new System.Drawing.Point(101, 411); this.comboBoxChannelPresets.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxChannelPresets.Name = "comboBoxChannelPresets"; - this.comboBoxChannelPresets.Size = new System.Drawing.Size(181, 24); + this.comboBoxChannelPresets.Size = new System.Drawing.Size(225, 24); this.comboBoxChannelPresets.TabIndex = 22; // // checkBoxSpikeFilter @@ -534,7 +528,7 @@ private void InitializeComponent() this.textBoxAdcCalibrationFile.Location = new System.Drawing.Point(13, 30); this.textBoxAdcCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxAdcCalibrationFile.Name = "textBoxAdcCalibrationFile"; - this.textBoxAdcCalibrationFile.Size = new System.Drawing.Size(226, 22); + this.textBoxAdcCalibrationFile.Size = new System.Drawing.Size(270, 22); this.textBoxAdcCalibrationFile.TabIndex = 1; this.textBoxAdcCalibrationFile.TabStop = false; this.textBoxAdcCalibrationFile.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; @@ -547,7 +541,7 @@ private void InitializeComponent() this.textBoxGainCalibrationFile.Location = new System.Drawing.Point(13, 133); this.textBoxGainCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxGainCalibrationFile.Name = "textBoxGainCalibrationFile"; - this.textBoxGainCalibrationFile.Size = new System.Drawing.Size(226, 22); + this.textBoxGainCalibrationFile.Size = new System.Drawing.Size(270, 22); this.textBoxGainCalibrationFile.TabIndex = 5; this.textBoxGainCalibrationFile.TabStop = false; this.textBoxGainCalibrationFile.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; @@ -562,7 +556,7 @@ private void InitializeComponent() this.comboBoxReference.Location = new System.Drawing.Point(101, 373); this.comboBoxReference.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxReference.Name = "comboBoxReference"; - this.comboBoxReference.Size = new System.Drawing.Size(181, 24); + this.comboBoxReference.Size = new System.Drawing.Size(225, 24); this.comboBoxReference.TabIndex = 20; // // comboBoxLfpGain @@ -574,7 +568,7 @@ private void InitializeComponent() this.comboBoxLfpGain.Location = new System.Drawing.Point(101, 240); this.comboBoxLfpGain.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxLfpGain.Name = "comboBoxLfpGain"; - this.comboBoxLfpGain.Size = new System.Drawing.Size(181, 24); + this.comboBoxLfpGain.Size = new System.Drawing.Size(225, 24); this.comboBoxLfpGain.TabIndex = 12; // // comboBoxApGain @@ -586,7 +580,7 @@ private void InitializeComponent() this.comboBoxApGain.Location = new System.Drawing.Point(100, 174); this.comboBoxApGain.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxApGain.Name = "comboBoxApGain"; - this.comboBoxApGain.Size = new System.Drawing.Size(182, 24); + this.comboBoxApGain.Size = new System.Drawing.Size(226, 24); this.comboBoxApGain.TabIndex = 8; // // tabPageProperties @@ -595,7 +589,7 @@ private void InitializeComponent() this.tabPageProperties.Location = new System.Drawing.Point(4, 25); this.tabPageProperties.Name = "tabPageProperties"; this.tabPageProperties.Padding = new System.Windows.Forms.Padding(3); - this.tabPageProperties.Size = new System.Drawing.Size(301, 635); + this.tabPageProperties.Size = new System.Drawing.Size(345, 615); this.tabPageProperties.TabIndex = 1; this.tabPageProperties.Text = "Properties"; this.tabPageProperties.UseVisualStyleBackColor = true; @@ -605,9 +599,43 @@ private void InitializeComponent() this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill; this.propertyGrid.Location = new System.Drawing.Point(3, 3); this.propertyGrid.Name = "propertyGrid"; - this.propertyGrid.Size = new System.Drawing.Size(295, 629); + this.propertyGrid.Size = new System.Drawing.Size(339, 609); this.propertyGrid.TabIndex = 0; // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(3, 3); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.tableLayoutPanel2); + this.splitContainer1.Panel1MinSize = 150; + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.tabControl1); + this.splitContainer1.Panel2MinSize = 250; + this.splitContainer1.Size = new System.Drawing.Size(1228, 644); + this.splitContainer1.SplitterDistance = 871; + this.splitContainer1.TabIndex = 1; + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 2; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 47F)); + this.tableLayoutPanel2.Controls.Add(this.panelProbe, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.trackBarProbePosition, 1, 0); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 1; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(871, 644); + this.tableLayoutPanel2.TabIndex = 31; + // // NeuropixelsV1ProbeConfigurationDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); @@ -627,7 +655,6 @@ private void InitializeComponent() this.menuStrip.PerformLayout(); this.tableLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.ResumeLayout(false); - this.panelTrackBar.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.trackBarProbePosition)).EndInit(); this.tabControl1.ResumeLayout(false); this.tabPageConfiguration.ResumeLayout(false); @@ -635,6 +662,11 @@ private void InitializeComponent() this.panelOptions.PerformLayout(); this.tabPageProperties.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).EndInit(); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.tableLayoutPanel2.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -650,7 +682,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolTip toolTip; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.Panel panelProbe; - private System.Windows.Forms.Panel panelTrackBar; private System.Windows.Forms.TrackBar trackBarProbePosition; private System.Windows.Forms.Panel panelOptions; private System.Windows.Forms.TextBox textBoxLfpCorrection; @@ -678,5 +709,7 @@ private void InitializeComponent() internal System.Windows.Forms.PropertyGrid propertyGrid; private System.Windows.Forms.TabPage tabPageProperties; private System.Windows.Forms.BindingSource bindingSource; + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; } } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.Designer.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.Designer.cs index 5fa29aec..e1fbad92 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.Designer.cs @@ -31,18 +31,20 @@ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NeuropixelsV2eDialog)); this.menuStrip = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.tabControlProbe = new System.Windows.Forms.TabControl(); this.buttonCancel = new System.Windows.Forms.Button(); this.buttonOkay = new System.Windows.Forms.Button(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.splitContainer = new System.Windows.Forms.SplitContainer(); this.propertyGrid = new Bonsai.Design.PropertyGrid(); - this.tabPageProperties = new System.Windows.Forms.TabPage(); + this.panelConfigurationDialogs = new System.Windows.Forms.Panel(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.menuStrip.SuspendLayout(); - this.tabControlProbe.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); + this.splitContainer.Panel1.SuspendLayout(); + this.splitContainer.Panel2.SuspendLayout(); + this.splitContainer.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); - this.tabPageProperties.SuspendLayout(); this.SuspendLayout(); // // menuStrip @@ -63,18 +65,6 @@ private void InitializeComponent() this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 22); this.fileToolStripMenuItem.Text = "File"; // - // tabControlProbe - // - this.tabControlProbe.Controls.Add(this.tabPageProperties); - this.tabControlProbe.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControlProbe.Location = new System.Drawing.Point(3, 2); - this.tabControlProbe.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.tabControlProbe.Name = "tabControlProbe"; - this.tabControlProbe.SelectedIndex = 0; - this.tabControlProbe.Size = new System.Drawing.Size(1133, 634); - this.tabControlProbe.TabIndex = 1; - this.tabControlProbe.TabStop = false; - // // buttonCancel // this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; @@ -102,7 +92,7 @@ private void InitializeComponent() // this.tableLayoutPanel1.ColumnCount = 1; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Controls.Add(this.tabControlProbe, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.splitContainer, 0, 0); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24); @@ -114,6 +104,41 @@ private void InitializeComponent() this.tableLayoutPanel1.Size = new System.Drawing.Size(1139, 687); this.tableLayoutPanel1.TabIndex = 3; // + // splitContainer + // + this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer.Location = new System.Drawing.Point(3, 3); + this.splitContainer.Name = "splitContainer"; + // + // splitContainer.Panel1 + // + this.splitContainer.Panel1.Controls.Add(this.propertyGrid); + // + // splitContainer.Panel2 + // + this.splitContainer.Panel2.Controls.Add(this.panelConfigurationDialogs); + this.splitContainer.Size = new System.Drawing.Size(1133, 632); + this.splitContainer.SplitterDistance = 221; + this.splitContainer.TabIndex = 3; + // + // propertyGrid + // + this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill; + this.propertyGrid.Location = new System.Drawing.Point(0, 0); + this.propertyGrid.Name = "propertyGrid"; + this.propertyGrid.Size = new System.Drawing.Size(221, 632); + this.propertyGrid.TabIndex = 0; + this.propertyGrid.SelectedGridItemChanged += new System.Windows.Forms.SelectedGridItemChangedEventHandler(this.PropertyGridChanged); + // + // panelConfigurationDialogs + // + this.panelConfigurationDialogs.Dock = System.Windows.Forms.DockStyle.Fill; + this.panelConfigurationDialogs.Location = new System.Drawing.Point(0, 0); + this.panelConfigurationDialogs.Margin = new System.Windows.Forms.Padding(0); + this.panelConfigurationDialogs.Name = "panelConfigurationDialogs"; + this.panelConfigurationDialogs.Size = new System.Drawing.Size(908, 632); + this.panelConfigurationDialogs.TabIndex = 0; + // // flowLayoutPanel1 // this.flowLayoutPanel1.Controls.Add(this.buttonCancel); @@ -126,24 +151,6 @@ private void InitializeComponent() this.flowLayoutPanel1.Size = new System.Drawing.Size(1131, 41); this.flowLayoutPanel1.TabIndex = 2; // - // propertyGrid - // - this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Right; - this.propertyGrid.Location = new System.Drawing.Point(832, 0); - this.propertyGrid.Name = "propertyGrid"; - this.propertyGrid.Size = new System.Drawing.Size(293, 605); - this.propertyGrid.TabIndex = 0; - // - // tabPageProperties - // - this.tabPageProperties.Controls.Add(this.propertyGrid); - this.tabPageProperties.Location = new System.Drawing.Point(4, 25); - this.tabPageProperties.Name = "tabPageProperties"; - this.tabPageProperties.Size = new System.Drawing.Size(1125, 605); - this.tabPageProperties.TabIndex = 0; - this.tabPageProperties.Text = "Properties"; - this.tabPageProperties.UseVisualStyleBackColor = true; - // // NeuropixelsV2eDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); @@ -160,10 +167,12 @@ private void InitializeComponent() this.Text = "NeuropixelsV2e Configuration"; this.menuStrip.ResumeLayout(false); this.menuStrip.PerformLayout(); - this.tabControlProbe.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); + this.splitContainer.Panel1.ResumeLayout(false); + this.splitContainer.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); + this.splitContainer.ResumeLayout(false); this.flowLayoutPanel1.ResumeLayout(false); - this.tabPageProperties.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -175,10 +184,10 @@ private void InitializeComponent() private System.Windows.Forms.Button buttonCancel; private System.Windows.Forms.Button buttonOkay; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.TabControl tabControlProbe; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; - private System.Windows.Forms.TabPage tabPageProperties; + private System.Windows.Forms.SplitContainer splitContainer; private Bonsai.Design.PropertyGrid propertyGrid; + private System.Windows.Forms.Panel panelConfigurationDialogs; } } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs index c455213d..6dc3d62d 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs @@ -9,13 +9,13 @@ namespace OpenEphys.Onix1.Design /// public partial class NeuropixelsV2eDialog : Form { - internal readonly Dictionary ProbeConfigurations; + internal readonly Dictionary ProbeConfigurationDialogs; internal NeuropixelsV2ProbeConfiguration ProbeConfigurationA { get { - return ProbeConfigurations.TryGetValue(NeuropixelsV2Probe.ProbeA, out var probeConfigurationDialog) + return ProbeConfigurationDialogs.TryGetValue(NeuropixelsV2Probe.ProbeA, out var probeConfigurationDialog) ? probeConfigurationDialog.ProbeConfiguration : throw new NullReferenceException("Unable to find the probe configuration dialog for Probe A."); } @@ -25,7 +25,7 @@ internal NeuropixelsV2ProbeConfiguration ProbeConfigurationB { get { - return ProbeConfigurations.TryGetValue(NeuropixelsV2Probe.ProbeB, out var probeConfigurationDialog) + return ProbeConfigurationDialogs.TryGetValue(NeuropixelsV2Probe.ProbeB, out var probeConfigurationDialog) ? probeConfigurationDialog.ProbeConfiguration : throw new NullReferenceException("Unable to find the probe configuration dialog for Probe B."); } @@ -57,13 +57,13 @@ public NeuropixelsV2eDialog(IConfigureNeuropixelsV2 configureNode) Text = Text.Replace("NeuropixelsV2e ", "NeuropixelsV2eBeta "); } - ProbeConfigurations = new() + ProbeConfigurationDialogs = new() { { NeuropixelsV2Probe.ProbeA, new(configureNode.ProbeConfigurationA) }, { NeuropixelsV2Probe.ProbeB, new(configureNode.ProbeConfigurationB) } }; - foreach (var channelConfiguration in ProbeConfigurations) + foreach (var channelConfiguration in ProbeConfigurationDialogs) { channelConfiguration.Value.SetChildFormProperties(this); this.AddMenuItemsFromDialogToFileOption(channelConfiguration.Value, channelConfiguration.Key.ToString()); @@ -80,24 +80,39 @@ private void FormShown(object sender, EventArgs e) menuStrip.Visible = false; } - int index = 0; - - foreach (var channelConfiguration in ProbeConfigurations) + propertyGrid.Focus(); + var rootItem = propertyGrid.SelectedGridItem; + if (rootItem != null) { - string probeName = channelConfiguration.Key.ToString(); - - tabControlProbe.TabPages.Insert(index++, probeName, probeName); - tabControlProbe.TabPages[probeName].Controls.Add(channelConfiguration.Value); - - channelConfiguration.Value.Show(); + foreach (GridItem item in rootItem.Parent.GridItems) + { + if (item != null && item.Value is NeuropixelsV2ProbeConfiguration probeConfiguration && probeConfiguration.Probe == NeuropixelsV2Probe.ProbeA) + { + propertyGrid.SelectedGridItem = item; + item.Select(); + } + } } - tabControlProbe.SelectedIndex = 0; + const int PropertyGridStartingWidth = 200; + + splitContainer.SplitterDistance = PropertyGridStartingWidth; } internal void Okay_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; } + + void PropertyGridChanged(object sender, SelectedGridItemChangedEventArgs e) + { + if (e.NewSelection != null && e.NewSelection.Value is NeuropixelsV2ProbeConfiguration probeConfiguration) + { + panelConfigurationDialogs.Controls.Clear(); + var dialog = ProbeConfigurationDialogs[probeConfiguration.Probe]; + panelConfigurationDialogs.Controls.Add(dialog); + dialog.Show(); + } + } } } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.Designer.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.Designer.cs index a7a4a263..553d9b7b 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.Designer.cs @@ -29,57 +29,80 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); + System.Windows.Forms.Label invertPolarity; + System.Windows.Forms.Label label1; System.Windows.Forms.Label probeCalibrationFile; System.Windows.Forms.Label Reference; System.Windows.Forms.Label labelPresets; - System.Windows.Forms.Label label1; - System.Windows.Forms.Label invertPolarity; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NeuropixelsV2eProbeConfigurationDialog)); this.toolStripLabelGainCalibrationSN = new System.Windows.Forms.ToolStripStatusLabel(); this.menuStrip = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolTip = new System.Windows.Forms.ToolTip(this.components); + this.buttonChooseCalibrationFile = new System.Windows.Forms.Button(); this.buttonEnableContacts = new System.Windows.Forms.Button(); this.buttonClearSelections = new System.Windows.Forms.Button(); - this.buttonChooseCalibrationFile = new System.Windows.Forms.Button(); - this.panelProbe = new System.Windows.Forms.Panel(); - this.panelTrackBar = new System.Windows.Forms.Panel(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonOkay = new System.Windows.Forms.Button(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.trackBarProbePosition = new System.Windows.Forms.TrackBar(); + this.panelProbe = new System.Windows.Forms.Panel(); + this.tabControlProbe = new System.Windows.Forms.TabControl(); + this.tabPageConfiguration = new System.Windows.Forms.TabPage(); this.panelChannelOptions = new System.Windows.Forms.Panel(); this.checkBoxInvertPolarity = new System.Windows.Forms.CheckBox(); this.textBoxGainCorrection = new System.Windows.Forms.TextBox(); this.textBoxProbeCalibrationFile = new System.Windows.Forms.TextBox(); this.comboBoxReference = new System.Windows.Forms.ComboBox(); this.comboBoxChannelPresets = new System.Windows.Forms.ComboBox(); - this.buttonCancel = new System.Windows.Forms.Button(); - this.buttonOkay = new System.Windows.Forms.Button(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.tabControlProbe = new System.Windows.Forms.TabControl(); - this.tabPageConfiguration = new System.Windows.Forms.TabPage(); this.tabPageProperties = new System.Windows.Forms.TabPage(); this.propertyGrid = new Bonsai.Design.PropertyGrid(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripGainCalSN = new System.Windows.Forms.ToolStripStatusLabel(); this.bindingSource = new System.Windows.Forms.BindingSource(this.components); + invertPolarity = new System.Windows.Forms.Label(); + label1 = new System.Windows.Forms.Label(); probeCalibrationFile = new System.Windows.Forms.Label(); Reference = new System.Windows.Forms.Label(); labelPresets = new System.Windows.Forms.Label(); - label1 = new System.Windows.Forms.Label(); - invertPolarity = new System.Windows.Forms.Label(); this.menuStrip.SuspendLayout(); - this.panelTrackBar.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.trackBarProbePosition)).BeginInit(); - this.panelChannelOptions.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.trackBarProbePosition)).BeginInit(); this.tabControlProbe.SuspendLayout(); this.tabPageConfiguration.SuspendLayout(); + this.panelChannelOptions.SuspendLayout(); this.tabPageProperties.SuspendLayout(); - this.flowLayoutPanel1.SuspendLayout(); this.statusStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit(); this.SuspendLayout(); // + // invertPolarity + // + invertPolarity.AutoSize = true; + invertPolarity.Location = new System.Drawing.Point(15, 187); + invertPolarity.Name = "invertPolarity"; + invertPolarity.Size = new System.Drawing.Size(55, 32); + invertPolarity.TabIndex = 9; + invertPolarity.Text = "Invert\r\nPolarity:"; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new System.Drawing.Point(15, 63); + label1.Name = "label1"; + label1.Size = new System.Drawing.Size(71, 32); + label1.TabIndex = 3; + label1.Text = "Gain\r\nCorrection:"; + // // probeCalibrationFile // probeCalibrationFile.AutoSize = true; @@ -108,24 +131,6 @@ private void InitializeComponent() labelPresets.TabIndex = 7; labelPresets.Text = "Channel \nPresets:"; // - // label1 - // - label1.AutoSize = true; - label1.Location = new System.Drawing.Point(15, 63); - label1.Name = "label1"; - label1.Size = new System.Drawing.Size(71, 32); - label1.TabIndex = 3; - label1.Text = "Gain\r\nCorrection:"; - // - // invertPolarity - // - invertPolarity.AutoSize = true; - invertPolarity.Location = new System.Drawing.Point(15, 187); - invertPolarity.Name = "invertPolarity"; - invertPolarity.Size = new System.Drawing.Size(55, 32); - invertPolarity.TabIndex = 9; - invertPolarity.Text = "Invert\r\nPolarity:"; - // // toolStripLabelGainCalibrationSN // this.toolStripLabelGainCalibrationSN.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold); @@ -153,6 +158,19 @@ private void InitializeComponent() this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 22); this.fileToolStripMenuItem.Text = "File"; // + // buttonChooseCalibrationFile + // + this.buttonChooseCalibrationFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonChooseCalibrationFile.Location = new System.Drawing.Point(332, 29); + this.buttonChooseCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonChooseCalibrationFile.Name = "buttonChooseCalibrationFile"; + this.buttonChooseCalibrationFile.Size = new System.Drawing.Size(37, 25); + this.buttonChooseCalibrationFile.TabIndex = 2; + this.buttonChooseCalibrationFile.Text = "..."; + this.toolTip.SetToolTip(this.buttonChooseCalibrationFile, "Browse for a gain calibration file."); + this.buttonChooseCalibrationFile.UseVisualStyleBackColor = true; + this.buttonChooseCalibrationFile.Click += new System.EventHandler(this.ChooseCalibrationFile_Click); + // // buttonEnableContacts // this.buttonEnableContacts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -160,7 +178,7 @@ private void InitializeComponent() this.buttonEnableContacts.Location = new System.Drawing.Point(15, 232); this.buttonEnableContacts.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonEnableContacts.Name = "buttonEnableContacts"; - this.buttonEnableContacts.Size = new System.Drawing.Size(266, 44); + this.buttonEnableContacts.Size = new System.Drawing.Size(354, 44); this.buttonEnableContacts.TabIndex = 11; this.buttonEnableContacts.Text = "Enable Selected Electrodes"; this.toolTip.SetToolTip(this.buttonEnableContacts, "Click and drag to select electrodes in the probe view. \r\nPress this button to ena" + @@ -175,7 +193,7 @@ private void InitializeComponent() this.buttonClearSelections.Location = new System.Drawing.Point(15, 282); this.buttonClearSelections.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonClearSelections.Name = "buttonClearSelections"; - this.buttonClearSelections.Size = new System.Drawing.Size(266, 44); + this.buttonClearSelections.Size = new System.Drawing.Size(354, 44); this.buttonClearSelections.TabIndex = 12; this.buttonClearSelections.Text = "Clear Electrode Selection"; this.toolTip.SetToolTip(this.buttonClearSelections, "Deselect all electrodes in the probe view. \r\nNote that this does not disable elec" + @@ -183,49 +201,109 @@ private void InitializeComponent() this.buttonClearSelections.UseVisualStyleBackColor = true; this.buttonClearSelections.Click += new System.EventHandler(this.ClearSelection_Click); // - // buttonChooseCalibrationFile + // buttonCancel // - this.buttonChooseCalibrationFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonChooseCalibrationFile.Location = new System.Drawing.Point(244, 29); - this.buttonChooseCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.buttonChooseCalibrationFile.Name = "buttonChooseCalibrationFile"; - this.buttonChooseCalibrationFile.Size = new System.Drawing.Size(37, 25); - this.buttonChooseCalibrationFile.TabIndex = 2; - this.buttonChooseCalibrationFile.Text = "..."; - this.toolTip.SetToolTip(this.buttonChooseCalibrationFile, "Browse for a gain calibration file."); - this.buttonChooseCalibrationFile.UseVisualStyleBackColor = true; - this.buttonChooseCalibrationFile.Click += new System.EventHandler(this.ChooseCalibrationFile_Click); + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.Location = new System.Drawing.Point(1112, 2); + this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(111, 34); + this.buttonCancel.TabIndex = 1; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; // - // panelProbe + // buttonOkay // - this.panelProbe.AutoSize = true; - this.panelProbe.Dock = System.Windows.Forms.DockStyle.Fill; - this.panelProbe.Location = new System.Drawing.Point(3, 2); - this.panelProbe.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.panelProbe.Name = "panelProbe"; - this.panelProbe.Size = new System.Drawing.Size(858, 662); - this.panelProbe.TabIndex = 1; + this.buttonOkay.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOkay.DialogResult = System.Windows.Forms.DialogResult.OK; + this.buttonOkay.Location = new System.Drawing.Point(995, 2); + this.buttonOkay.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.buttonOkay.Name = "buttonOkay"; + this.buttonOkay.Size = new System.Drawing.Size(111, 34); + this.buttonOkay.TabIndex = 0; + this.buttonOkay.Text = "OK"; + this.buttonOkay.UseVisualStyleBackColor = true; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.AutoSize = true; + this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 55F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 315F)); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.splitContainer1, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 46F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1234, 712); + this.tableLayoutPanel1.TabIndex = 0; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.Controls.Add(this.buttonCancel); + this.flowLayoutPanel1.Controls.Add(this.buttonOkay); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; + this.flowLayoutPanel1.Location = new System.Drawing.Point(4, 670); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(1226, 38); + this.flowLayoutPanel1.TabIndex = 2; + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(3, 3); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 // - // panelTrackBar + this.splitContainer1.Panel1.Controls.Add(this.tableLayoutPanel2); + this.splitContainer1.Panel1MinSize = 150; // - this.panelTrackBar.Controls.Add(this.trackBarProbePosition); - this.panelTrackBar.Dock = System.Windows.Forms.DockStyle.Fill; - this.panelTrackBar.Location = new System.Drawing.Point(868, 4); - this.panelTrackBar.Margin = new System.Windows.Forms.Padding(4); - this.panelTrackBar.Name = "panelTrackBar"; - this.panelTrackBar.Size = new System.Drawing.Size(47, 658); - this.panelTrackBar.TabIndex = 30; + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.tabControlProbe); + this.splitContainer1.Panel2MinSize = 200; + this.splitContainer1.Size = new System.Drawing.Size(1228, 660); + this.splitContainer1.SplitterDistance = 827; + this.splitContainer1.TabIndex = 3; + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 2; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 47F)); + this.tableLayoutPanel2.Controls.Add(this.trackBarProbePosition, 1, 0); + this.tableLayoutPanel2.Controls.Add(this.panelProbe, 0, 0); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 1; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(827, 660); + this.tableLayoutPanel2.TabIndex = 3; // // trackBarProbePosition // this.trackBarProbePosition.AutoSize = false; this.trackBarProbePosition.Dock = System.Windows.Forms.DockStyle.Fill; - this.trackBarProbePosition.Location = new System.Drawing.Point(0, 0); + this.trackBarProbePosition.Location = new System.Drawing.Point(783, 2); this.trackBarProbePosition.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.trackBarProbePosition.Maximum = 100; this.trackBarProbePosition.Name = "trackBarProbePosition"; this.trackBarProbePosition.Orientation = System.Windows.Forms.Orientation.Vertical; - this.trackBarProbePosition.Size = new System.Drawing.Size(47, 658); + this.trackBarProbePosition.Size = new System.Drawing.Size(41, 656); this.trackBarProbePosition.TabIndex = 22; this.trackBarProbePosition.TabStop = false; this.trackBarProbePosition.TickFrequency = 2; @@ -233,6 +311,39 @@ private void InitializeComponent() this.trackBarProbePosition.Value = 50; this.trackBarProbePosition.Scroll += new System.EventHandler(this.TrackBarScroll); // + // panelProbe + // + this.panelProbe.Dock = System.Windows.Forms.DockStyle.Fill; + this.panelProbe.Location = new System.Drawing.Point(3, 2); + this.panelProbe.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.panelProbe.Name = "panelProbe"; + this.panelProbe.Size = new System.Drawing.Size(774, 656); + this.panelProbe.TabIndex = 2; + // + // tabControlProbe + // + this.tabControlProbe.Controls.Add(this.tabPageConfiguration); + this.tabControlProbe.Controls.Add(this.tabPageProperties); + this.tabControlProbe.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControlProbe.Location = new System.Drawing.Point(0, 0); + this.tabControlProbe.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.tabControlProbe.Name = "tabControlProbe"; + this.tabControlProbe.SelectedIndex = 0; + this.tabControlProbe.Size = new System.Drawing.Size(397, 660); + this.tabControlProbe.TabIndex = 31; + this.tabControlProbe.TabStop = false; + // + // tabPageConfiguration + // + this.tabPageConfiguration.Controls.Add(this.panelChannelOptions); + this.tabPageConfiguration.Location = new System.Drawing.Point(4, 25); + this.tabPageConfiguration.Name = "tabPageConfiguration"; + this.tabPageConfiguration.Padding = new System.Windows.Forms.Padding(3); + this.tabPageConfiguration.Size = new System.Drawing.Size(389, 631); + this.tabPageConfiguration.TabIndex = 1; + this.tabPageConfiguration.Text = "Configuration"; + this.tabPageConfiguration.UseVisualStyleBackColor = true; + // // panelChannelOptions // this.panelChannelOptions.AutoSize = true; @@ -255,7 +366,7 @@ private void InitializeComponent() this.panelChannelOptions.Location = new System.Drawing.Point(3, 3); this.panelChannelOptions.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panelChannelOptions.Name = "panelChannelOptions"; - this.panelChannelOptions.Size = new System.Drawing.Size(295, 599); + this.panelChannelOptions.Size = new System.Drawing.Size(383, 625); this.panelChannelOptions.TabIndex = 1; // // checkBoxInvertPolarity @@ -277,7 +388,7 @@ private void InitializeComponent() this.textBoxGainCorrection.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxGainCorrection.Name = "textBoxGainCorrection"; this.textBoxGainCorrection.ReadOnly = true; - this.textBoxGainCorrection.Size = new System.Drawing.Size(174, 22); + this.textBoxGainCorrection.Size = new System.Drawing.Size(262, 22); this.textBoxGainCorrection.TabIndex = 4; this.textBoxGainCorrection.TabStop = false; // @@ -288,7 +399,7 @@ private void InitializeComponent() this.textBoxProbeCalibrationFile.Location = new System.Drawing.Point(15, 30); this.textBoxProbeCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxProbeCalibrationFile.Name = "textBoxProbeCalibrationFile"; - this.textBoxProbeCalibrationFile.Size = new System.Drawing.Size(221, 22); + this.textBoxProbeCalibrationFile.Size = new System.Drawing.Size(309, 22); this.textBoxProbeCalibrationFile.TabIndex = 1; this.textBoxProbeCalibrationFile.TabStop = false; // @@ -301,7 +412,7 @@ private void InitializeComponent() this.comboBoxReference.Location = new System.Drawing.Point(107, 110); this.comboBoxReference.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxReference.Name = "comboBoxReference"; - this.comboBoxReference.Size = new System.Drawing.Size(174, 24); + this.comboBoxReference.Size = new System.Drawing.Size(262, 24); this.comboBoxReference.TabIndex = 6; // // comboBoxChannelPresets @@ -313,112 +424,27 @@ private void InitializeComponent() this.comboBoxChannelPresets.Location = new System.Drawing.Point(107, 150); this.comboBoxChannelPresets.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxChannelPresets.Name = "comboBoxChannelPresets"; - this.comboBoxChannelPresets.Size = new System.Drawing.Size(174, 24); + this.comboBoxChannelPresets.Size = new System.Drawing.Size(262, 24); this.comboBoxChannelPresets.TabIndex = 8; // - // buttonCancel - // - this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(1112, 2); - this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.Size = new System.Drawing.Size(111, 34); - this.buttonCancel.TabIndex = 1; - this.buttonCancel.Text = "Cancel"; - this.buttonCancel.UseVisualStyleBackColor = true; - // - // buttonOkay - // - this.buttonOkay.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.buttonOkay.DialogResult = System.Windows.Forms.DialogResult.OK; - this.buttonOkay.Location = new System.Drawing.Point(995, 2); - this.buttonOkay.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.buttonOkay.Name = "buttonOkay"; - this.buttonOkay.Size = new System.Drawing.Size(111, 34); - this.buttonOkay.TabIndex = 0; - this.buttonOkay.Text = "OK"; - this.buttonOkay.UseVisualStyleBackColor = true; - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.AutoSize = true; - this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel1.ColumnCount = 3; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 55F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 315F)); - this.tableLayoutPanel1.Controls.Add(this.panelTrackBar, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.panelProbe, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.tabControlProbe, 2, 0); - this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 1; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 46F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1234, 712); - this.tableLayoutPanel1.TabIndex = 0; - // - // tabControlProbe - // - this.tabControlProbe.Controls.Add(this.tabPageConfiguration); - this.tabControlProbe.Controls.Add(this.tabPageProperties); - this.tabControlProbe.Location = new System.Drawing.Point(922, 2); - this.tabControlProbe.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.tabControlProbe.Name = "tabControlProbe"; - this.tabControlProbe.SelectedIndex = 0; - this.tabControlProbe.Size = new System.Drawing.Size(309, 634); - this.tabControlProbe.TabIndex = 31; - this.tabControlProbe.TabStop = false; - // - // tabPageConfiguration - // - this.tabPageConfiguration.Controls.Add(this.panelChannelOptions); - this.tabPageConfiguration.Location = new System.Drawing.Point(4, 25); - this.tabPageConfiguration.Name = "tabPageConfiguration"; - this.tabPageConfiguration.Padding = new System.Windows.Forms.Padding(3); - this.tabPageConfiguration.Size = new System.Drawing.Size(301, 605); - this.tabPageConfiguration.TabIndex = 1; - this.tabPageConfiguration.Text = "Configuration"; - this.tabPageConfiguration.UseVisualStyleBackColor = true; - // // tabPageProperties // this.tabPageProperties.Controls.Add(this.propertyGrid); this.tabPageProperties.Location = new System.Drawing.Point(4, 25); this.tabPageProperties.Name = "tabPageProperties"; - this.tabPageProperties.Size = new System.Drawing.Size(301, 605); + this.tabPageProperties.Size = new System.Drawing.Size(389, 631); this.tabPageProperties.TabIndex = 0; this.tabPageProperties.Text = "Properties"; this.tabPageProperties.UseVisualStyleBackColor = true; // // propertyGrid // - this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Right; - this.propertyGrid.Location = new System.Drawing.Point(8, 0); + this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill; + this.propertyGrid.Location = new System.Drawing.Point(0, 0); this.propertyGrid.Name = "propertyGrid"; - this.propertyGrid.Size = new System.Drawing.Size(293, 605); + this.propertyGrid.Size = new System.Drawing.Size(389, 631); this.propertyGrid.TabIndex = 0; // - // flowLayoutPanel1 - // - this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutPanel1, 3); - this.flowLayoutPanel1.Controls.Add(this.buttonCancel); - this.flowLayoutPanel1.Controls.Add(this.buttonOkay); - this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.flowLayoutPanel1.Location = new System.Drawing.Point(4, 670); - this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(1226, 38); - this.flowLayoutPanel1.TabIndex = 2; - // // statusStrip1 // this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); @@ -456,17 +482,20 @@ private void InitializeComponent() this.Text = "NeuropixelsV2e Probe Configuration"; this.menuStrip.ResumeLayout(false); this.menuStrip.PerformLayout(); - this.panelTrackBar.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.trackBarProbePosition)).EndInit(); - this.panelChannelOptions.ResumeLayout(false); - this.panelChannelOptions.PerformLayout(); this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.tableLayoutPanel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.trackBarProbePosition)).EndInit(); this.tabControlProbe.ResumeLayout(false); this.tabPageConfiguration.ResumeLayout(false); this.tabPageConfiguration.PerformLayout(); + this.panelChannelOptions.ResumeLayout(false); + this.panelChannelOptions.PerformLayout(); this.tabPageProperties.ResumeLayout(false); - this.flowLayoutPanel1.ResumeLayout(false); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).EndInit(); @@ -480,29 +509,30 @@ private void InitializeComponent() private System.Windows.Forms.MenuStrip menuStrip; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolTip toolTip; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Button buttonOkay; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStripStatusLabel toolStripGainCalSN; + private System.Windows.Forms.ToolStripStatusLabel toolStripLabelGainCalibrationSN; + private System.Windows.Forms.BindingSource bindingSource; + private System.Windows.Forms.SplitContainer splitContainer1; private System.Windows.Forms.Panel panelProbe; - private System.Windows.Forms.Panel panelTrackBar; private System.Windows.Forms.TrackBar trackBarProbePosition; + private System.Windows.Forms.TabControl tabControlProbe; + private System.Windows.Forms.TabPage tabPageConfiguration; private System.Windows.Forms.Panel panelChannelOptions; - private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.CheckBox checkBoxInvertPolarity; + private System.Windows.Forms.TextBox textBoxGainCorrection; private System.Windows.Forms.Button buttonChooseCalibrationFile; - private System.Windows.Forms.Button buttonOkay; internal System.Windows.Forms.TextBox textBoxProbeCalibrationFile; private System.Windows.Forms.ComboBox comboBoxReference; private System.Windows.Forms.ComboBox comboBoxChannelPresets; private System.Windows.Forms.Button buttonEnableContacts; private System.Windows.Forms.Button buttonClearSelections; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; - private System.Windows.Forms.TextBox textBoxGainCorrection; - private System.Windows.Forms.StatusStrip statusStrip1; - private System.Windows.Forms.ToolStripStatusLabel toolStripGainCalSN; - private System.Windows.Forms.ToolStripStatusLabel toolStripLabelGainCalibrationSN; - private System.Windows.Forms.CheckBox checkBoxInvertPolarity; - private System.Windows.Forms.TabControl tabControlProbe; private System.Windows.Forms.TabPage tabPageProperties; private Bonsai.Design.PropertyGrid propertyGrid; - private System.Windows.Forms.TabPage tabPageConfiguration; - private System.Windows.Forms.BindingSource bindingSource; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; } } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.cs index 364e6fe1..c9cd87c3 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.cs @@ -20,6 +20,7 @@ public partial class NeuropixelsV2eProbeConfigurationDialog : Form public NeuropixelsV2ProbeConfiguration ProbeConfiguration { get => ChannelConfiguration.ProbeConfiguration; + internal set => ChannelConfiguration.ProbeConfiguration = value; } /// @@ -95,10 +96,7 @@ public NeuropixelsV2eProbeConfigurationDialog(NeuropixelsV2ProbeConfiguration co return; } - ChannelConfiguration.HighlightEnabledContacts(); - ChannelConfiguration.HighlightSelectedContacts(); - ChannelConfiguration.UpdateContactLabels(); - ChannelConfiguration.RefreshZedGraph(); + UpdateProbeGroup(); }; checkBoxInvertPolarity.DataBindings.Add("Checked", @@ -143,6 +141,8 @@ private void FormShown(object sender, EventArgs e) menuStrip.Visible = false; } + splitContainer1.SplitterDistance = splitContainer1.Size.Width - splitContainer1.Panel2MinSize; + ChannelConfiguration.Show(); ChannelConfiguration.ConnectResizeEventHandler(); ChannelConfiguration.ResizeZedGraph(); @@ -266,5 +266,10 @@ private void UpdateTrackBarLocation(object sender, EventArgs e) { trackBarProbePosition.Value = (int)(ChannelConfiguration.GetRelativeVerticalPosition() * trackBarProbePosition.Maximum); } + + internal void UpdateProbeGroup() + { + ChannelConfiguration.UpdateProbeGroup(); + } } } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.resx b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.resx index ea19c317..6848397e 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.resx +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.resx @@ -117,26 +117,26 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - False + + 17, 17 - - False + + 274, 17 - + False False - + False - - 17, 17 + + False - - 274, 17 + + False 382, 17 diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationEditor.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationEditor.cs index 21b20ad5..798ba7d4 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationEditor.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationEditor.cs @@ -26,9 +26,11 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide var editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); var editorState = (IWorkflowEditorState)provider.GetService(typeof(IWorkflowEditorState)); - if (editorService != null && editorState != null && !editorState.WorkflowRunning && - value is NeuropixelsV2ProbeConfiguration configuration) + if (editorService != null && value is NeuropixelsV2ProbeConfiguration configuration) { + if (editorState != null && editorState.WorkflowRunning) + return base.EditValue(context, provider, value); + bool isBeta = (IConfigureNeuropixelsV2)context.Instance is ConfigureNeuropixelsV2eBeta; var configurationCopy = configuration.Clone(); diff --git a/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceDialog.cs b/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceDialog.cs index 88605ec8..a6528036 100644 --- a/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceDialog.cs +++ b/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceDialog.cs @@ -90,7 +90,7 @@ public Rhs2116StimulusSequenceDialog(ConfigureRhs2116Trigger rhs2116Trigger) dataGridViewStimulusTable.RowTemplate.Height = 24; dataGridViewStimulusTable.TabStop = false; - tableLayoutPanel1.Controls.Add(tabControlVisualization); + tableLayoutPanel2.Controls.Add(tabControlVisualization); tabControlVisualization.ResumeLayout(false); tabPageWaveform.ResumeLayout(false); diff --git a/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceOptions.Designer.cs b/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceOptions.Designer.cs index 10520f42..dc8a29d2 100644 --- a/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceOptions.Designer.cs +++ b/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceOptions.Designer.cs @@ -96,6 +96,7 @@ private void InitializeComponent() // // numericUpDownNumberOfPulses // + this.numericUpDownNumberOfPulses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.numericUpDownNumberOfPulses.Location = new System.Drawing.Point(355, 203); this.numericUpDownNumberOfPulses.Maximum = new decimal(new int[] { 10000, @@ -113,6 +114,7 @@ private void InitializeComponent() // // textBoxStepSize // + this.textBoxStepSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.textBoxStepSize.Enabled = false; this.textBoxStepSize.Location = new System.Drawing.Point(248, 32); this.textBoxStepSize.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); @@ -124,6 +126,7 @@ private void InitializeComponent() // // groupBoxCathode // + this.groupBoxCathode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.groupBoxCathode.Controls.Add(this.textboxAmplitudeCathodic); this.groupBoxCathode.Controls.Add(this.labelAmplitudeCathodic); this.groupBoxCathode.Controls.Add(this.labelPulseWidthCathodic); @@ -185,6 +188,7 @@ private void InitializeComponent() // // groupBoxAnode // + this.groupBoxAnode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.groupBoxAnode.Controls.Add(this.textboxAmplitudeAnodic); this.groupBoxAnode.Controls.Add(this.labelAmplitudeAnodic); this.groupBoxAnode.Controls.Add(this.labelPulseWidthAnodic); @@ -245,6 +249,7 @@ private void InitializeComponent() // // buttonClearPulses // + this.buttonClearPulses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonClearPulses.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); this.buttonClearPulses.Location = new System.Drawing.Point(7, 238); this.buttonClearPulses.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); @@ -256,6 +261,7 @@ private void InitializeComponent() // // buttonReadPulses // + this.buttonReadPulses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonReadPulses.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); this.buttonReadPulses.Location = new System.Drawing.Point(112, 238); this.buttonReadPulses.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); @@ -267,6 +273,7 @@ private void InitializeComponent() // // textboxInterPulseInterval // + this.textboxInterPulseInterval.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.textboxInterPulseInterval.Location = new System.Drawing.Point(355, 66); this.textboxInterPulseInterval.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textboxInterPulseInterval.Name = "textboxInterPulseInterval"; @@ -275,6 +282,7 @@ private void InitializeComponent() // // labelInterPulseInterval // + this.labelInterPulseInterval.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.labelInterPulseInterval.AutoSize = true; this.labelInterPulseInterval.Location = new System.Drawing.Point(243, 70); this.labelInterPulseInterval.Name = "labelInterPulseInterval"; @@ -284,6 +292,7 @@ private void InitializeComponent() // // labelStepSizeAmplitude // + this.labelStepSizeAmplitude.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.labelStepSizeAmplitude.AutoSize = true; this.labelStepSizeAmplitude.Location = new System.Drawing.Point(243, 14); this.labelStepSizeAmplitude.Name = "labelStepSizeAmplitude"; @@ -293,6 +302,7 @@ private void InitializeComponent() // // checkBoxAnodicFirst // + this.checkBoxAnodicFirst.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.checkBoxAnodicFirst.AutoSize = true; this.checkBoxAnodicFirst.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.checkBoxAnodicFirst.Checked = true; @@ -307,6 +317,7 @@ private void InitializeComponent() // // buttonAddPulses // + this.buttonAddPulses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonAddPulses.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F); this.buttonAddPulses.Location = new System.Drawing.Point(310, 238); this.buttonAddPulses.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); @@ -318,6 +329,7 @@ private void InitializeComponent() // // textboxDelay // + this.textboxDelay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.textboxDelay.Location = new System.Drawing.Point(135, 66); this.textboxDelay.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textboxDelay.Name = "textboxDelay"; @@ -326,6 +338,7 @@ private void InitializeComponent() // // labelNumberOfPulses // + this.labelNumberOfPulses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.labelNumberOfPulses.AutoSize = true; this.labelNumberOfPulses.Location = new System.Drawing.Point(229, 206); this.labelNumberOfPulses.Name = "labelNumberOfPulses"; @@ -335,6 +348,7 @@ private void InitializeComponent() // // labelDelay // + this.labelDelay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.labelDelay.AutoSize = true; this.labelDelay.Location = new System.Drawing.Point(53, 70); this.labelDelay.Name = "labelDelay"; @@ -344,6 +358,7 @@ private void InitializeComponent() // // checkboxBiphasicSymmetrical // + this.checkboxBiphasicSymmetrical.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.checkboxBiphasicSymmetrical.AutoSize = true; this.checkboxBiphasicSymmetrical.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.checkboxBiphasicSymmetrical.Checked = true; @@ -358,6 +373,7 @@ private void InitializeComponent() // // textboxInterStimulusInterval // + this.textboxInterStimulusInterval.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.textboxInterStimulusInterval.Location = new System.Drawing.Point(135, 201); this.textboxInterStimulusInterval.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textboxInterStimulusInterval.Name = "textboxInterStimulusInterval"; @@ -366,6 +382,7 @@ private void InitializeComponent() // // labelInterStimulusInterval // + this.labelInterStimulusInterval.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.labelInterStimulusInterval.AutoSize = true; this.labelInterStimulusInterval.Location = new System.Drawing.Point(7, 204); this.labelInterStimulusInterval.Name = "labelInterStimulusInterval"; diff --git a/OpenEphys.Onix1/ConfigureHeadstage64OpticalStimulator.cs b/OpenEphys.Onix1/ConfigureHeadstage64OpticalStimulator.cs index 0bd34413..464c5019 100644 --- a/OpenEphys.Onix1/ConfigureHeadstage64OpticalStimulator.cs +++ b/OpenEphys.Onix1/ConfigureHeadstage64OpticalStimulator.cs @@ -238,6 +238,7 @@ public uint BurstsPerTrain /// /// This value should be kept below 50 mA to prevent excess head accumulation on the headstage. /// + [Category(AcquisitionCategory)] [Description("The total direct current required during the application of a burst (mA). Should be less than 50 mA.")] public double BurstCurrent { diff --git a/OpenEphys.Onix1/ConfigureRhs2116Trigger.cs b/OpenEphys.Onix1/ConfigureRhs2116Trigger.cs index bb3657ce..3a0d2420 100644 --- a/OpenEphys.Onix1/ConfigureRhs2116Trigger.cs +++ b/OpenEphys.Onix1/ConfigureRhs2116Trigger.cs @@ -232,6 +232,7 @@ public string ProbeGroupString /// [Category(AcquisitionCategory)] [Description("Stimulus sequence.")] + [TypeConverter(typeof(GenericPropertyConverter))] public Rhs2116StimulusSequencePair StimulusSequence { get => stimulusSequence.Value; diff --git a/OpenEphys.Onix1/NeuropixelsV2ProbeConfiguration.cs b/OpenEphys.Onix1/NeuropixelsV2ProbeConfiguration.cs index eddbba17..21cf4c4d 100644 --- a/OpenEphys.Onix1/NeuropixelsV2ProbeConfiguration.cs +++ b/OpenEphys.Onix1/NeuropixelsV2ProbeConfiguration.cs @@ -93,6 +93,7 @@ public abstract class NeuropixelsV2ProbeConfiguration /// Gets or sets the reference for all electrodes. /// [XmlIgnore] + [Category(DeviceFactory.ConfigurationCategory)] [Description("Defines the reference for the probe.")] public abstract Enum Reference { get; set; } @@ -114,6 +115,8 @@ public abstract class NeuropixelsV2ProbeConfiguration /// The channel map will always be 384 channels, and will return the 384 enabled electrodes. /// [XmlIgnore] + [Browsable(false)] + [Externalizable(false)] public abstract NeuropixelsV2Electrode[] ChannelMap { get; } /// From b91be4149ea3b43a6a6170beee2349a65a1cad9c Mon Sep 17 00:00:00 2001 From: bparks13 Date: Tue, 9 Dec 2025 11:59:03 -0500 Subject: [PATCH 07/11] Add scaled channel configuration dialog --- .../ChannelConfigurationDialog.cs | 159 +++------------- ...NeuropixelsV1ChannelConfigurationDialog.cs | 4 +- ...europixelsV2eChannelConfigurationDialog.cs | 5 +- .../ScaledChannelConfigurationDialog.cs | 172 ++++++++++++++++++ 4 files changed, 196 insertions(+), 144 deletions(-) create mode 100644 OpenEphys.Onix1.Design/ScaledChannelConfigurationDialog.cs diff --git a/OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs b/OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs index 43453c7a..227fdcd6 100644 --- a/OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs @@ -18,6 +18,7 @@ public partial class ChannelConfigurationDialog : Form { internal event EventHandler OnResizeZedGraph; internal event EventHandler OnDrawProbeGroup; + internal event EventHandler OnMoveProbeGroup; ProbeGroup probeGroup; @@ -65,15 +66,6 @@ public ChannelConfigurationDialog(ProbeGroup probeGroup) zedGraphChannels.MouseMoveEvent += MouseMoveEvent; zedGraphChannels.MouseUpEvent += MouseUpEvent; - if (IsDrawScale()) - { - var pane = new GraphPane(); - - InitializeScalePane(pane); - - zedGraphChannels.MasterPane.Add(pane); - } - InitializeZedGraphControl(zedGraphChannels); InitializeProbePane(zedGraphChannels.GraphPane); @@ -131,15 +123,6 @@ internal virtual void ZoomEvent(ZedGraphControl sender, ZoomState oldState, Zoom sender.ZoomOut(sender.GraphPane); } } - - if (IsDrawScale()) - SyncYAxes(zedGraphChannels.MasterPane.PaneList[0], zedGraphChannels.MasterPane.PaneList[1]); - } - - static void SyncYAxes(GraphPane source, GraphPane target) - { - target.YAxis.Scale.Min = source.YAxis.Scale.Min; - target.YAxis.Scale.Max = source.YAxis.Scale.Max; } private void SetEqualAxisLimits(ZedGraphControl zedGraphControl) @@ -359,11 +342,6 @@ internal void DrawProbeGroup() HighlightSelectedContacts(); DrawContactLabels(); - if (IsDrawScale()) - { - DrawScale(); - } - OnDrawProbeGroupHandler(); } @@ -678,10 +656,6 @@ internal virtual string ContactString(int deviceChannelIndex, int index) return deviceChannelIndex == -1 ? DisabledContactString : index.ToString(); } - internal virtual bool IsDrawScale() => false; - - internal virtual void DrawScale() { } - internal void UpdateFontSize() { var fontSize = CalculateFontSize(); @@ -857,78 +831,18 @@ static void InitializeZedGraphControl(ZedGraphControl zedGraph) EnableZoom(zedGraph); } - static void EnablePan(ZedGraphControl zedGraph) + internal static void EnablePan(ZedGraphControl zedGraph) { zedGraph.IsEnableHPan = true; zedGraph.IsEnableVPan = true; } - static void DisablePan(ZedGraphControl zedGraph) - { - zedGraph.IsEnableHPan = false; - zedGraph.IsEnableVPan = false; - } - - static void EnableZoom(ZedGraphControl zedGraph) + internal static void EnableZoom(ZedGraphControl zedGraph) { zedGraph.IsEnableZoom = true; zedGraph.IsEnableWheelZoom = true; } - static void DisableZoom(ZedGraphControl zedGraph) - { - zedGraph.IsEnableZoom = false; - zedGraph.IsEnableWheelZoom = false; - } - - static void InitializeScalePane(GraphPane pane) - { - pane.Title.IsVisible = false; - pane.TitleGap = 0; - pane.Border.IsVisible = false; - pane.Border.Width = 0; - pane.Chart.Border.IsVisible = false; - pane.Margin.All = 0; - - pane.Y2Axis.IsVisible = false; - - pane.XAxis.IsVisible = false; - pane.XAxis.IsAxisSegmentVisible = false; - pane.XAxis.Scale.MaxAuto = true; - pane.XAxis.Scale.MinAuto = true; - pane.XAxis.MajorGrid.IsZeroLine = false; - pane.XAxis.CrossAuto = false; - pane.XAxis.Cross = double.MinValue; - - pane.YAxis.IsVisible = true; - pane.YAxis.IsAxisSegmentVisible = true; - pane.YAxis.Scale.MaxAuto = true; - pane.YAxis.Scale.MinAuto = true; - pane.YAxis.CrossAuto = false; - pane.YAxis.Cross = double.MinValue; - - pane.YAxis.MajorGrid.IsZeroLine = false; - pane.YAxis.MajorGrid.IsVisible = false; - pane.YAxis.MinorGrid.IsVisible = false; - - pane.YAxis.Scale.IsPreventLabelOverlap = true; - pane.YAxis.Scale.MajorStep = 100; - pane.YAxis.Scale.IsLabelsInside = true; - pane.YAxis.Scale.FontSpec.Size = 65f; - pane.YAxis.Scale.FontSpec.IsBold = false; - pane.YAxis.Scale.LabelGap = 0.6f; - - pane.YAxis.MinorTic.IsInside = false; - pane.YAxis.MinorTic.IsOutside = false; - pane.YAxis.MinorTic.IsOpposite = false; - - pane.YAxis.MajorTic.IsInside = true; - pane.YAxis.MajorTic.IsOutside = false; - pane.YAxis.MajorTic.IsOpposite = false; - pane.YAxis.MajorTic.Size = 40f; - pane.YAxis.MajorTic.PenWidth = 1.5f; - } - static void InitializeProbePane(GraphPane graphPane) { graphPane.Title.IsVisible = false; @@ -984,21 +898,11 @@ private void ZedGraphChannels_Resize(object sender, EventArgs e) internal void ResizeZedGraph() { ResizeAxes(); - - if (IsDrawScale()) - { - var rect = zedGraphChannels.MasterPane.Rect; - - float squareSize = rect.Height; - - zedGraphChannels.MasterPane.PaneList[0].Rect = new RectangleF(rect.Left, rect.Top, squareSize, squareSize); - zedGraphChannels.MasterPane.PaneList[1].Rect = new RectangleF(rect.Left + squareSize, rect.Top, rect.Width - squareSize, squareSize); - } + OnResizeHandler(); UpdateFontSize(); RefreshZedGraph(); Update(); - OnResizeHandler(); } private void OnResizeHandler() @@ -1006,23 +910,20 @@ private void OnResizeHandler() OnResizeZedGraph?.Invoke(this, EventArgs.Empty); } - void ResizeAxes() + internal virtual void ResizeAxes() { - float scalingFactor = IsDrawScale() ? 1.15f : 1.0f; - RectangleF rect = IsDrawScale() ? zedGraphChannels.MasterPane.Rect : zedGraphChannels.GraphPane.Rect; + RectangleF rect = zedGraphChannels.GraphPane.Rect; float width = rect.Width; float height = rect.Height; - float desiredWidth = height * scalingFactor; - - if (width < desiredWidth) + if (width < height) { - height = width / scalingFactor; + height = width; } else { - width = desiredWidth; + width = height; } float x = MathF.Round(rect.Left + (rect.Width - width) / 2f); @@ -1030,16 +931,11 @@ void ResizeAxes() var newRect = new RectangleF(x, y, width, height); - if (IsDrawScale()) - zedGraphChannels.MasterPane.Rect = newRect; - else - { - zedGraphChannels.GraphPane.Rect = newRect; - DisconnectResizeEventHandler(); - zedGraphChannels.Size = new Size((int)newRect.Width, (int)newRect.Height); - zedGraphChannels.Location = new Point((int)newRect.X, (int)newRect.Y); - ConnectResizeEventHandler(); - } + zedGraphChannels.GraphPane.Rect = newRect; + DisconnectResizeEventHandler(); + zedGraphChannels.Size = new Size((int)newRect.Width, (int)newRect.Height); + zedGraphChannels.Location = new Point((int)newRect.X, (int)newRect.Y); + ConnectResizeEventHandler(); } private void MenuItemOpenFile(object sender, EventArgs e) @@ -1078,6 +974,11 @@ internal void ResetZoom() UpdateFontSize(); } + void OnMoveProbeGroupHandler() + { + OnMoveProbeGroup?.Invoke(this, EventArgs.Empty); + } + /// /// Shifts the whole ZedGraph to the given relative position, where 0.0 is the very bottom of the horizontal /// space, and 1.0 is the very top. Note that this accounts for a buffer on the top and bottom, so giving a @@ -1104,8 +1005,7 @@ public void MoveToVerticalPosition(float relativePosition) zedGraphChannels.GraphPane.YAxis.Scale.Min = newMinY; zedGraphChannels.GraphPane.YAxis.Scale.Max = newMinY + currentRange; - if (IsDrawScale()) - SyncYAxes(zedGraphChannels.MasterPane.PaneList[0], zedGraphChannels.MasterPane.PaneList[1]); + OnMoveProbeGroupHandler(); } internal float GetRelativeVerticalPosition() @@ -1179,8 +1079,7 @@ private bool MouseMoveEvent(ZedGraphControl sender, MouseEventArgs e) } else if (e.Button == MouseButtons.Middle) { - if (IsDrawScale()) - SyncYAxes(zedGraphChannels.MasterPane.PaneList[0], zedGraphChannels.MasterPane.PaneList[1]); + OnMoveProbeGroupHandler(); return false; } @@ -1188,19 +1087,6 @@ private bool MouseMoveEvent(ZedGraphControl sender, MouseEventArgs e) { sender.Cursor = Cursors.Arrow; - var currentPane = sender.MasterPane.FindPane(new PointF(e.X, e.Y)); - - if (currentPane == sender.MasterPane.PaneList[0]) - { - EnablePan(sender); - EnableZoom(sender); - } - else if (IsDrawScale() && currentPane == sender.MasterPane.PaneList[1]) - { - DisablePan(sender); - DisableZoom(sender); - } - return true; } @@ -1355,8 +1241,7 @@ private void ButtonResetZoom_Click(object sender, EventArgs e) { ResetZoom(); - if (IsDrawScale()) - SyncYAxes(zedGraphChannels.MasterPane.PaneList[0], zedGraphChannels.MasterPane.PaneList[1]); + OnMoveProbeGroupHandler(); RefreshZedGraph(); } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1ChannelConfigurationDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV1ChannelConfigurationDialog.cs index 04a10e73..94e195ed 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1ChannelConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1ChannelConfigurationDialog.cs @@ -10,7 +10,7 @@ namespace OpenEphys.Onix1.Design /// /// Partial class to create a channel configuration GUI for the class. /// - public partial class NeuropixelsV1ChannelConfigurationDialog : ChannelConfigurationDialog + public partial class NeuropixelsV1ChannelConfigurationDialog : ScaledChannelConfigurationDialog { internal event EventHandler OnZoom; internal event EventHandler OnFileLoad; @@ -91,8 +91,6 @@ private void OnZoomHandler() OnZoom?.Invoke(this, EventArgs.Empty); } - internal override bool IsDrawScale() => true; - internal override void DrawScale() { if (ProbeConfiguration == null || zedGraphChannels.MasterPane.PaneList.Count < 2) diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eChannelConfigurationDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eChannelConfigurationDialog.cs index 4bd07766..9eec781b 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eChannelConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eChannelConfigurationDialog.cs @@ -1,6 +1,5 @@ using System; using System.Linq; -using System.Reflection; using System.Windows.Forms; using OpenEphys.ProbeInterface.NET; using ZedGraph; @@ -10,7 +9,7 @@ namespace OpenEphys.Onix1.Design /// /// Partial class to create a channel configuration GUI for . /// - public partial class NeuropixelsV2eChannelConfigurationDialog : ChannelConfigurationDialog + public partial class NeuropixelsV2eChannelConfigurationDialog : ScaledChannelConfigurationDialog { internal event EventHandler OnZoom; internal event EventHandler OnFileLoad; @@ -95,8 +94,6 @@ private void OnZoomHandler() OnZoom?.Invoke(this, EventArgs.Empty); } - internal override bool IsDrawScale() => true; - internal override void DrawScale() { if (ProbeConfiguration == null || zedGraphChannels.MasterPane.PaneList.Count < 2) diff --git a/OpenEphys.Onix1.Design/ScaledChannelConfigurationDialog.cs b/OpenEphys.Onix1.Design/ScaledChannelConfigurationDialog.cs new file mode 100644 index 00000000..4c413dcc --- /dev/null +++ b/OpenEphys.Onix1.Design/ScaledChannelConfigurationDialog.cs @@ -0,0 +1,172 @@ +using System; +using System.Drawing; +using System.Windows.Forms; +using OpenEphys.ProbeInterface.NET; +using ZedGraph; + +namespace OpenEphys.Onix1.Design +{ + /// + /// Simple dialog window that serves as the base class for all scaled Channel Configuration windows. + /// Adds a scale bar in the same ZedGraph object as the original channel configuration. + /// + public abstract class ScaledChannelConfigurationDialog : ChannelConfigurationDialog + { + /// + /// Constructs the scaled dialog window using the given probe group, and plots all contacts after loading. + /// + /// Channel configuration given as a + public ScaledChannelConfigurationDialog(ProbeGroup probeGroup) : base(probeGroup) + { + var pane = new GraphPane(); + + InitializeScalePane(pane); + + zedGraphChannels.MasterPane.Add(pane); + pane.Chart.Fill = zedGraphChannels.GraphPane.Chart.Fill; + + OnDrawProbeGroup += (sender, e) => + { + DrawScale(); + }; + + OnResizeZedGraph += (sender, e) => + { + var rect = zedGraphChannels.MasterPane.Rect; + + float squareSize = rect.Height; + + zedGraphChannels.MasterPane.PaneList[0].Rect = new RectangleF(rect.Left, rect.Top, squareSize, squareSize); + zedGraphChannels.MasterPane.PaneList[1].Rect = new RectangleF(rect.Left + squareSize, rect.Top, rect.Width - squareSize, squareSize); + }; + + OnMoveProbeGroup += (sender, e) => + { + SyncYAxes(zedGraphChannels.MasterPane.PaneList[0], zedGraphChannels.MasterPane.PaneList[1]); + }; + + zedGraphChannels.MouseMoveEvent += (sender, e) => + { + if (e.Button == MouseButtons.None) + { + var currentPane = sender.MasterPane.FindPane(new PointF(e.X, e.Y)); + + if (currentPane == sender.MasterPane.PaneList[0]) + { + EnablePan(sender); + EnableZoom(sender); + } + else if (currentPane == sender.MasterPane.PaneList[1]) + { + DisablePan(sender); + DisableZoom(sender); + } + } + + return false; + }; + } + + static void InitializeScalePane(GraphPane pane) + { + pane.Title.IsVisible = false; + pane.TitleGap = 0; + pane.Border.IsVisible = false; + pane.Border.Width = 0; + pane.Chart.Border.IsVisible = false; + pane.Margin.All = 0; + + pane.Y2Axis.IsVisible = false; + + pane.XAxis.IsVisible = false; + pane.XAxis.IsAxisSegmentVisible = false; + pane.XAxis.Scale.MaxAuto = true; + pane.XAxis.Scale.MinAuto = true; + pane.XAxis.MajorGrid.IsZeroLine = false; + pane.XAxis.CrossAuto = false; + pane.XAxis.Cross = double.MinValue; + + pane.YAxis.IsVisible = true; + pane.YAxis.IsAxisSegmentVisible = true; + pane.YAxis.Scale.MaxAuto = true; + pane.YAxis.Scale.MinAuto = true; + pane.YAxis.CrossAuto = false; + pane.YAxis.Cross = double.MinValue; + + pane.YAxis.MajorGrid.IsZeroLine = false; + pane.YAxis.MajorGrid.IsVisible = false; + pane.YAxis.MinorGrid.IsVisible = false; + + pane.YAxis.Scale.IsPreventLabelOverlap = true; + pane.YAxis.Scale.MajorStep = 100; + pane.YAxis.Scale.IsLabelsInside = true; + pane.YAxis.Scale.FontSpec.Size = 65f; + pane.YAxis.Scale.FontSpec.IsBold = false; + pane.YAxis.Scale.LabelGap = 0.6f; + + pane.YAxis.MinorTic.IsInside = false; + pane.YAxis.MinorTic.IsOutside = false; + pane.YAxis.MinorTic.IsOpposite = false; + + pane.YAxis.MajorTic.IsInside = true; + pane.YAxis.MajorTic.IsOutside = false; + pane.YAxis.MajorTic.IsOpposite = false; + pane.YAxis.MajorTic.Size = 40f; + pane.YAxis.MajorTic.PenWidth = 1.5f; + } + + static void DisablePan(ZedGraphControl zedGraph) + { + zedGraph.IsEnableHPan = false; + zedGraph.IsEnableVPan = false; + } + + static void DisableZoom(ZedGraphControl zedGraph) + { + zedGraph.IsEnableZoom = false; + zedGraph.IsEnableWheelZoom = false; + } + + static void SyncYAxes(GraphPane source, GraphPane target) + { + target.YAxis.Scale.Min = source.YAxis.Scale.Min; + target.YAxis.Scale.Max = source.YAxis.Scale.Max; + } + + internal override void ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState) + { + base.ZoomEvent(sender, oldState, newState); + + SyncYAxes(zedGraphChannels.MasterPane.PaneList[0], zedGraphChannels.MasterPane.PaneList[1]); + } + + internal override void ResizeAxes() + { + const float ScalingFactor = 1.15f; + RectangleF rect = zedGraphChannels.MasterPane.Rect; + + float width = rect.Width; + float height = rect.Height; + + float desiredWidth = height * ScalingFactor; + + if (width < desiredWidth) + { + height = width / ScalingFactor; + } + else + { + width = desiredWidth; + } + + float x = MathF.Round(rect.Left + (rect.Width - width) / 2f); + float y = MathF.Round(rect.Top + (rect.Height - height) / 2f); + + var newRect = new RectangleF(x, y, width, height); + + zedGraphChannels.MasterPane.Rect = newRect; + } + + internal virtual void DrawScale() { } + } +} From 0bd818b49d567deebba39319d552d429e9d90a8c Mon Sep 17 00:00:00 2001 From: bparks13 Date: Wed, 10 Dec 2025 15:13:48 -0500 Subject: [PATCH 08/11] Revert change to disable ellipsis - NPX V2 probe configuration dialogs are not able to be opened from NPX V2e device dialogs --- .../NeuropixelsV2eProbeConfigurationEditor.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationEditor.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationEditor.cs index 798ba7d4..31c8f047 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationEditor.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationEditor.cs @@ -26,11 +26,8 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide var editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); var editorState = (IWorkflowEditorState)provider.GetService(typeof(IWorkflowEditorState)); - if (editorService != null && value is NeuropixelsV2ProbeConfiguration configuration) + if (editorService != null && editorState != null && editorState.WorkflowRunning && value is NeuropixelsV2ProbeConfiguration configuration) { - if (editorState != null && editorState.WorkflowRunning) - return base.EditValue(context, provider, value); - bool isBeta = (IConfigureNeuropixelsV2)context.Instance is ConfigureNeuropixelsV2eBeta; var configurationCopy = configuration.Clone(); From ffa7892613fd35c4d1d275e6bc8b3598b6cf286e Mon Sep 17 00:00:00 2001 From: bparks13 Date: Wed, 10 Dec 2025 15:15:01 -0500 Subject: [PATCH 09/11] Update NeuropixelsV2e dialog behavior - Close the probe configuration dialog when any property other than ProbeConfiguration is selected - Add text to panel giving instructions for the user on what to do to show the probe configuration dialog --- .../NeuropixelsV2eDialog.Designer.cs | 28 ++++++++++-- .../NeuropixelsV2eDialog.cs | 43 ++++++++++++++++--- 2 files changed, 63 insertions(+), 8 deletions(-) diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.Designer.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.Designer.cs index e1fbad92..351bbcf0 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.Designer.cs @@ -38,12 +38,14 @@ private void InitializeComponent() this.propertyGrid = new Bonsai.Design.PropertyGrid(); this.panelConfigurationDialogs = new System.Windows.Forms.Panel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.textBoxDefaultText = new System.Windows.Forms.TextBox(); this.menuStrip.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); this.splitContainer.SuspendLayout(); + this.panelConfigurationDialogs.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // @@ -118,7 +120,7 @@ private void InitializeComponent() // this.splitContainer.Panel2.Controls.Add(this.panelConfigurationDialogs); this.splitContainer.Size = new System.Drawing.Size(1133, 632); - this.splitContainer.SplitterDistance = 221; + this.splitContainer.SplitterDistance = 220; this.splitContainer.TabIndex = 3; // // propertyGrid @@ -126,17 +128,18 @@ private void InitializeComponent() this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill; this.propertyGrid.Location = new System.Drawing.Point(0, 0); this.propertyGrid.Name = "propertyGrid"; - this.propertyGrid.Size = new System.Drawing.Size(221, 632); + this.propertyGrid.Size = new System.Drawing.Size(220, 632); this.propertyGrid.TabIndex = 0; this.propertyGrid.SelectedGridItemChanged += new System.Windows.Forms.SelectedGridItemChangedEventHandler(this.PropertyGridChanged); // // panelConfigurationDialogs // + this.panelConfigurationDialogs.Controls.Add(this.textBoxDefaultText); this.panelConfigurationDialogs.Dock = System.Windows.Forms.DockStyle.Fill; this.panelConfigurationDialogs.Location = new System.Drawing.Point(0, 0); this.panelConfigurationDialogs.Margin = new System.Windows.Forms.Padding(0); this.panelConfigurationDialogs.Name = "panelConfigurationDialogs"; - this.panelConfigurationDialogs.Size = new System.Drawing.Size(908, 632); + this.panelConfigurationDialogs.Size = new System.Drawing.Size(909, 632); this.panelConfigurationDialogs.TabIndex = 0; // // flowLayoutPanel1 @@ -151,6 +154,22 @@ private void InitializeComponent() this.flowLayoutPanel1.Size = new System.Drawing.Size(1131, 41); this.flowLayoutPanel1.TabIndex = 2; // + // textBoxDefaultText + // + this.textBoxDefaultText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxDefaultText.BackColor = System.Drawing.SystemColors.Control; + this.textBoxDefaultText.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBoxDefaultText.Enabled = false; + this.textBoxDefaultText.Location = new System.Drawing.Point(333, 297); + this.textBoxDefaultText.Multiline = true; + this.textBoxDefaultText.Name = "textBoxDefaultText"; + this.textBoxDefaultText.ReadOnly = true; + this.textBoxDefaultText.Size = new System.Drawing.Size(242, 39); + this.textBoxDefaultText.TabIndex = 0; + this.textBoxDefaultText.Text = "Select a probe configuration property to view the currently enabled electrodes."; + // // NeuropixelsV2eDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); @@ -172,6 +191,8 @@ private void InitializeComponent() this.splitContainer.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); this.splitContainer.ResumeLayout(false); + this.panelConfigurationDialogs.ResumeLayout(false); + this.panelConfigurationDialogs.PerformLayout(); this.flowLayoutPanel1.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -189,5 +210,6 @@ private void InitializeComponent() private System.Windows.Forms.SplitContainer splitContainer; private Bonsai.Design.PropertyGrid propertyGrid; private System.Windows.Forms.Panel panelConfigurationDialogs; + private System.Windows.Forms.TextBox textBoxDefaultText; } } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs index 6dc3d62d..c6c768b0 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Windows.Forms; namespace OpenEphys.Onix1.Design @@ -106,12 +107,44 @@ internal void Okay_Click(object sender, EventArgs e) void PropertyGridChanged(object sender, SelectedGridItemChangedEventArgs e) { - if (e.NewSelection != null && e.NewSelection.Value is NeuropixelsV2ProbeConfiguration probeConfiguration) + void RemoveProbeConfigurationDialogs() { - panelConfigurationDialogs.Controls.Clear(); - var dialog = ProbeConfigurationDialogs[probeConfiguration.Probe]; - panelConfigurationDialogs.Controls.Add(dialog); - dialog.Show(); + foreach (var item in panelConfigurationDialogs.Controls.OfType().ToList()) + { + if (item != null && e.NewSelection.Parent.Value is not NeuropixelsV2ProbeConfiguration) + { + panelConfigurationDialogs.Controls.Remove(item); + } + } + } + + void ShowProbeConfigurationDialog(NeuropixelsV2Probe probe) + { + var dialog = ProbeConfigurationDialogs[probe]; + + if (!panelConfigurationDialogs.Controls.Contains(dialog)) + { + panelConfigurationDialogs.Controls.Add(dialog); + dialog.Show(); + } + + dialog.BringToFront(); + } + + if (e.NewSelection != null) + { + if (e.NewSelection.Value is NeuropixelsV2ProbeConfiguration probeConfiguration) + { + ShowProbeConfigurationDialog(probeConfiguration.Probe); + } + else if (e.NewSelection.Parent.Value is NeuropixelsV2ProbeConfiguration parentProbeConfiguration) + { + ShowProbeConfigurationDialog(parentProbeConfiguration.Probe); + } + else + { + RemoveProbeConfigurationDialogs(); + } } } } From 1b6127f52e361863c8ad86355cd19153c3256a5a Mon Sep 17 00:00:00 2001 From: bparks13 Date: Wed, 10 Dec 2025 15:18:15 -0500 Subject: [PATCH 10/11] Add comment --- .../NeuropixelsV2eDialog.cs | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs index c6c768b0..a193ecd6 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs @@ -107,17 +107,6 @@ internal void Okay_Click(object sender, EventArgs e) void PropertyGridChanged(object sender, SelectedGridItemChangedEventArgs e) { - void RemoveProbeConfigurationDialogs() - { - foreach (var item in panelConfigurationDialogs.Controls.OfType().ToList()) - { - if (item != null && e.NewSelection.Parent.Value is not NeuropixelsV2ProbeConfiguration) - { - panelConfigurationDialogs.Controls.Remove(item); - } - } - } - void ShowProbeConfigurationDialog(NeuropixelsV2Probe probe) { var dialog = ProbeConfigurationDialogs[probe]; @@ -131,6 +120,8 @@ void ShowProbeConfigurationDialog(NeuropixelsV2Probe probe) dialog.BringToFront(); } + // NB: If the property (or the parent's property) is a probe configuration, show the corresponding dialog. + // Otherwise, remove the probe configuration dialogs to show the default text box. if (e.NewSelection != null) { if (e.NewSelection.Value is NeuropixelsV2ProbeConfiguration probeConfiguration) @@ -143,7 +134,13 @@ void ShowProbeConfigurationDialog(NeuropixelsV2Probe probe) } else { - RemoveProbeConfigurationDialogs(); + foreach (var item in panelConfigurationDialogs.Controls.OfType().ToList()) + { + if (item != null && e.NewSelection.Parent.Value is not NeuropixelsV2ProbeConfiguration) + { + panelConfigurationDialogs.Controls.Remove(item); + } + } } } } From 999c55ada83b3cc33a41c64a762eee8434e09a60 Mon Sep 17 00:00:00 2001 From: bparks13 Date: Thu, 11 Dec 2025 17:31:48 -0500 Subject: [PATCH 11/11] Add ShowInCustomDialogAttribute - Hide certain properties when the property grid is displayed in a custom GUI, specifically hiding the DeviceName/DeviceAddress properties when a dialog comes from a ConfigureHeadstage* node to match the behavior of the Bonsai editor --- OpenEphys.Onix1.Design/GenericDeviceDialog.cs | 19 ++++++- .../GenericStimulusSequenceDialog.cs | 19 ++++++- OpenEphys.Onix1.Design/Headstage64Dialog.cs | 10 ++-- ...age64ElectricalStimulatorSequenceDialog.cs | 8 ++- ...dstage64OpticalStimulatorSequenceDialog.cs | 8 ++- .../HeadstageRhs2116Dialog.cs | 4 +- OpenEphys.Onix1.Design/NeuropixelsV1Dialog.cs | 17 +++++- .../NeuropixelsV1eHeadstageDialog.cs | 4 +- .../NeuropixelsV1fHeadstageDialog.cs | 6 +- .../NeuropixelsV2eDialog.cs | 17 +++++- .../NeuropixelsV2eHeadstageDialog.cs | 4 +- .../Rhs2116StimulusSequenceDialog.cs | 8 ++- OpenEphys.Onix1/DeviceFactory.cs | 2 + .../ShowInCustomDialogAttribute.cs | 56 +++++++++++++++++++ 14 files changed, 158 insertions(+), 24 deletions(-) create mode 100644 OpenEphys.Onix1/ShowInCustomDialogAttribute.cs diff --git a/OpenEphys.Onix1.Design/GenericDeviceDialog.cs b/OpenEphys.Onix1.Design/GenericDeviceDialog.cs index 412a04a4..ea3b1535 100644 --- a/OpenEphys.Onix1.Design/GenericDeviceDialog.cs +++ b/OpenEphys.Onix1.Design/GenericDeviceDialog.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Windows.Forms; namespace OpenEphys.Onix1.Design @@ -18,11 +19,27 @@ internal object Device /// /// Initializes a new instance of . /// - public GenericDeviceDialog(object device) + /// Device that will be displayed in the property grid. + /// + /// if the properties should be filtered by , + /// otherwise . Default is . + /// + public GenericDeviceDialog(object device, bool filterProperties = false) { InitializeComponent(); Shown += FormShown; + + if (filterProperties) + { + propertyGrid.BrowsableAttributes = new AttributeCollection( + new Attribute[] + { + new BrowsableAttribute(true), + new ShowInCustomDialogAttribute(true) + }); + } + Device = device; } diff --git a/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs b/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs index 735be5b8..6ecbed9c 100644 --- a/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs +++ b/OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Drawing; using System.IO; using System.Linq; @@ -35,11 +36,27 @@ internal object Device /// Opens a dialog allowing for easy changing of stimulus sequence parameters, /// with visual feedback on what the resulting stimulus sequence looks like. /// - public GenericStimulusSequenceDialog(object device, int numberOfChannels) + /// Device that will be displayed in the property grid. + /// Number of channels to draw for the stimulus waveform. + /// + /// if the properties should be filtered by , + /// otherwise . Default is . + /// + public GenericStimulusSequenceDialog(object device, int numberOfChannels, bool filterProperties = false) { InitializeComponent(); Shown += FormShown; + if (filterProperties) + { + propertyGrid.BrowsableAttributes = new AttributeCollection( + new Attribute[] + { + new BrowsableAttribute(true), + new ShowInCustomDialogAttribute(true) + }); + } + Device = device; bindingSource.DataSource = Device; diff --git a/OpenEphys.Onix1.Design/Headstage64Dialog.cs b/OpenEphys.Onix1.Design/Headstage64Dialog.cs index 9f1e1117..becda15e 100644 --- a/OpenEphys.Onix1.Design/Headstage64Dialog.cs +++ b/OpenEphys.Onix1.Design/Headstage64Dialog.cs @@ -22,19 +22,19 @@ public Headstage64Dialog(ConfigureHeadstage64 configureNode) { InitializeComponent(); - Rhd2164Dialog = new(configureNode.Rhd2164); + Rhd2164Dialog = new(configureNode.Rhd2164, true); Rhd2164Dialog.SetChildFormProperties(this).AddDialogToTab(tabPageRhd2164); - Bno055Dialog = new(configureNode.Bno055); + Bno055Dialog = new(configureNode.Bno055, true); Bno055Dialog.SetChildFormProperties(this).AddDialogToTab(tabPageBno055); - TS4231V1Dialog = new(configureNode.TS4231); + TS4231V1Dialog = new(configureNode.TS4231, true); TS4231V1Dialog.SetChildFormProperties(this).AddDialogToTab(tabPageTS4231); - ElectricalStimulatorSequenceDialog = new(configureNode.ElectricalStimulator); + ElectricalStimulatorSequenceDialog = new(configureNode.ElectricalStimulator, true); ElectricalStimulatorSequenceDialog.SetChildFormProperties(this).AddDialogToTab(tabPageElectricalStimulator); - OpticalStimulatorSequenceDialog = new(configureNode.OpticalStimulator); + OpticalStimulatorSequenceDialog = new(configureNode.OpticalStimulator, true); OpticalStimulatorSequenceDialog.SetChildFormProperties(this).AddDialogToTab(tabPageOpticalStimulator); menuStrip1.Visible = false; diff --git a/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorSequenceDialog.cs b/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorSequenceDialog.cs index a88085de..238a345f 100644 --- a/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorSequenceDialog.cs +++ b/OpenEphys.Onix1.Design/Headstage64ElectricalStimulatorSequenceDialog.cs @@ -25,8 +25,12 @@ internal ConfigureHeadstage64ElectricalStimulator ElectricalStimulator /// visual feedback on what the resulting stimulus sequence looks like. /// /// Existing stimulus sequence. - public Headstage64ElectricalStimulatorSequenceDialog(ConfigureHeadstage64ElectricalStimulator electricalStimulator) - : base(electricalStimulator, NumberOfChannels) + /// + /// if the properties should be filtered by , + /// otherwise . Default is . + /// + public Headstage64ElectricalStimulatorSequenceDialog(ConfigureHeadstage64ElectricalStimulator electricalStimulator, bool filterProperties = false) + : base(electricalStimulator, NumberOfChannels, filterProperties) { InitializeComponent(); HideMenuStrip(); diff --git a/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorSequenceDialog.cs b/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorSequenceDialog.cs index ca15b8d1..35801267 100644 --- a/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorSequenceDialog.cs +++ b/OpenEphys.Onix1.Design/Headstage64OpticalStimulatorSequenceDialog.cs @@ -25,8 +25,12 @@ internal ConfigureHeadstage64OpticalStimulator OpticalStimulator /// visual feedback on what the resulting stimulus sequence looks like. /// /// Existing stimulus sequence. - public Headstage64OpticalStimulatorSequenceDialog(ConfigureHeadstage64OpticalStimulator opticalStimulator) - : base(opticalStimulator, NumberOfChannels) + /// + /// if the properties should be filtered by , + /// otherwise . Default is . + /// + public Headstage64OpticalStimulatorSequenceDialog(ConfigureHeadstage64OpticalStimulator opticalStimulator, bool filterProperties = false) + : base(opticalStimulator, NumberOfChannels, filterProperties) { InitializeComponent(); HideMenuStrip(); diff --git a/OpenEphys.Onix1.Design/HeadstageRhs2116Dialog.cs b/OpenEphys.Onix1.Design/HeadstageRhs2116Dialog.cs index 6f1ba0d6..b12801cc 100644 --- a/OpenEphys.Onix1.Design/HeadstageRhs2116Dialog.cs +++ b/OpenEphys.Onix1.Design/HeadstageRhs2116Dialog.cs @@ -24,12 +24,12 @@ public HeadstageRhs2116Dialog(ConfigureRhs2116Trigger rhs2116Trigger, ConfigureR { InitializeComponent(); - StimulusSequenceDialog = new Rhs2116StimulusSequenceDialog(rhs2116Trigger); + StimulusSequenceDialog = new Rhs2116StimulusSequenceDialog(rhs2116Trigger, true); StimulusSequenceDialog.SetChildFormProperties(this).AddDialogToTab(tabPageStimulusSequence); this.AddMenuItemsFromDialogToFileOption(StimulusSequenceDialog); - Rhs2116Dialog = new(rhs2116); + Rhs2116Dialog = new(rhs2116, true); Rhs2116Dialog.SetChildFormProperties(this).AddDialogToTab(tabPageRhs2116); } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1Dialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV1Dialog.cs index be2888ad..bfe502f8 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1Dialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1Dialog.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Windows.Forms; namespace OpenEphys.Onix1.Design @@ -24,7 +25,11 @@ public IConfigureNeuropixelsV1 ConfigureNode /// Initializes a new instance of . /// /// A object holding the current configuration settings. - public NeuropixelsV1Dialog(IConfigureNeuropixelsV1 configureNode) + /// + /// if the properties should be filtered by , + /// otherwise . Default is . + /// + public NeuropixelsV1Dialog(IConfigureNeuropixelsV1 configureNode, bool filterProperties = false) { InitializeComponent(); Shown += FormShown; @@ -33,6 +38,16 @@ public NeuropixelsV1Dialog(IConfigureNeuropixelsV1 configureNode) ProbeConfigurationDialog.SetChildFormProperties(this).AddDialogToPanel(panelProbe); this.AddMenuItemsFromDialogToFileOption(ProbeConfigurationDialog); + + if (filterProperties) + { + ProbeConfigurationDialog.propertyGrid.BrowsableAttributes = new AttributeCollection( + new Attribute[] + { + new BrowsableAttribute(true), + new ShowInCustomDialogAttribute(true) + }); + } } private void FormShown(object sender, EventArgs e) diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageDialog.cs index 6fda6d6b..53868f1b 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageDialog.cs @@ -30,13 +30,13 @@ public NeuropixelsV1eHeadstageDialog(ConfigureNeuropixelsV1e configureNeuropixel { InitializeComponent(); - DialogNeuropixelsV1e = new(configureNeuropixelsV1e); + DialogNeuropixelsV1e = new(configureNeuropixelsV1e, true); DialogNeuropixelsV1e.SetChildFormProperties(this).AddDialogToPanel(panelNeuropixelsV1e); this.AddMenuItemsFromDialogToFileOption(DialogNeuropixelsV1e, "NeuropixelsV1e"); - DialogBno055 = new(configureBno055); + DialogBno055 = new(configureBno055, true); DialogBno055.SetChildFormProperties(this).AddDialogToPanel(panelBno055); } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.cs index 44f966a5..f5680d94 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.cs @@ -36,7 +36,7 @@ public NeuropixelsV1fHeadstageDialog(ConfigureNeuropixelsV1f configureNeuropixel { InitializeComponent(); - DialogNeuropixelsV1A = new(configureNeuropixelsV1A) + DialogNeuropixelsV1A = new(configureNeuropixelsV1A, true) { Tag = configureNeuropixelsV1A.ProbeName }; @@ -45,7 +45,7 @@ public NeuropixelsV1fHeadstageDialog(ConfigureNeuropixelsV1f configureNeuropixel this.AddMenuItemsFromDialogToFileOption(DialogNeuropixelsV1A, "NeuropixelsV1A"); - DialogNeuropixelsV1B = new(configureNeuropixelsV1B) + DialogNeuropixelsV1B = new(configureNeuropixelsV1B, true) { Tag = configureNeuropixelsV1B.ProbeName }; @@ -54,7 +54,7 @@ public NeuropixelsV1fHeadstageDialog(ConfigureNeuropixelsV1f configureNeuropixel this.AddMenuItemsFromDialogToFileOption(DialogNeuropixelsV1B, "NeuropixelsV1B"); - DialogBno055 = new(configureBno055); + DialogBno055 = new(configureBno055, true); DialogBno055.SetChildFormProperties(this).AddDialogToPanel(panelBno055); } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs index a193ecd6..1430994e 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Windows.Forms; @@ -46,11 +47,25 @@ public IConfigureNeuropixelsV2 ConfigureNode /// Initializes a new instance of . /// /// A object holding the current configuration settings. - public NeuropixelsV2eDialog(IConfigureNeuropixelsV2 configureNode) + /// + /// if the properties should be filtered by , + /// otherwise . Default is . + /// + public NeuropixelsV2eDialog(IConfigureNeuropixelsV2 configureNode, bool filterProperties = false) { InitializeComponent(); Shown += FormShown; + if (filterProperties) + { + propertyGrid.BrowsableAttributes = new AttributeCollection( + new Attribute[] + { + new BrowsableAttribute(true), + new ShowInCustomDialogAttribute(true) + }); + } + propertyGrid.SelectedObject = configureNode; if (configureNode is ConfigureNeuropixelsV2eBeta) diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageDialog.cs index d0a6f75c..d2673e5e 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageDialog.cs @@ -26,7 +26,7 @@ public NeuropixelsV2eHeadstageDialog(IConfigureNeuropixelsV2 configureNeuropixel { InitializeComponent(); - DialogNeuropixelsV2e = new(configureNeuropixelsV2e); + DialogNeuropixelsV2e = new(configureNeuropixelsV2e, true); DialogNeuropixelsV2e.SetChildFormProperties(this).AddDialogToPanel(panelNeuropixelsV2e); @@ -41,7 +41,7 @@ public NeuropixelsV2eHeadstageDialog(IConfigureNeuropixelsV2 configureNeuropixel tabPageNeuropixelsV2e.Text = "NeuropixelsV2eBeta"; } - DialogBno055 = new(configureBno055); + DialogBno055 = new(configureBno055, true); DialogBno055.SetChildFormProperties(this).AddDialogToPanel(panelBno055); } diff --git a/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceDialog.cs b/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceDialog.cs index a6528036..df2102c3 100644 --- a/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceDialog.cs +++ b/OpenEphys.Onix1.Design/Rhs2116StimulusSequenceDialog.cs @@ -47,8 +47,12 @@ internal ConfigureRhs2116Trigger Trigger /// visual feedback on what the resulting stimulus sequence looks like. /// /// Existing object. - public Rhs2116StimulusSequenceDialog(ConfigureRhs2116Trigger rhs2116Trigger) - : base(rhs2116Trigger, NumberOfChannels) + /// + /// if the properties should be filtered by , + /// otherwise . Default is . + /// + public Rhs2116StimulusSequenceDialog(ConfigureRhs2116Trigger rhs2116Trigger, bool filterProperties = false) + : base(rhs2116Trigger, NumberOfChannels, filterProperties) { if (rhs2116Trigger.ProbeGroup.NumberOfContacts != NumberOfChannels) { diff --git a/OpenEphys.Onix1/DeviceFactory.cs b/OpenEphys.Onix1/DeviceFactory.cs index f72b2ac7..73d50d94 100644 --- a/OpenEphys.Onix1/DeviceFactory.cs +++ b/OpenEphys.Onix1/DeviceFactory.cs @@ -54,6 +54,7 @@ internal SingleDeviceFactory(Type deviceType) /// [Description(DeviceNameDescription)] [Category(ConfigurationCategory)] + [ShowInCustomDialog(false)] public string DeviceName { get; set; } /// @@ -68,6 +69,7 @@ internal SingleDeviceFactory(Type deviceType) /// [Description(DeviceAddressDescription)] [Category(ConfigurationCategory)] + [ShowInCustomDialog(false)] public uint DeviceAddress { get; set; } /// diff --git a/OpenEphys.Onix1/ShowInCustomDialogAttribute.cs b/OpenEphys.Onix1/ShowInCustomDialogAttribute.cs new file mode 100644 index 00000000..641a37e0 --- /dev/null +++ b/OpenEphys.Onix1/ShowInCustomDialogAttribute.cs @@ -0,0 +1,56 @@ +using System; + +namespace OpenEphys.Onix1 +{ + /// + /// Specifies whether a property should be displayed in a custom dialog. + /// + [AttributeUsage(AttributeTargets.Property, Inherited = true)] + public sealed class ShowInCustomDialogAttribute : Attribute + { + /// + /// Specifies that the default value for this attribute is that a property should be displayed in a custom dialog. + /// + public static readonly ShowInCustomDialogAttribute Default = new(true); + + /// + /// Gets a value indicating whether a property should be shown in a custom dialog. + /// + public bool ShowInCustomDialog { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + /// + /// if the property can be displayed in a custom dialog; + /// otherwise, . The default is . + /// + public ShowInCustomDialogAttribute(bool showInCustomDialog) + { + ShowInCustomDialog = showInCustomDialog; + } + + /// + /// Returns a value indicating whether this instance is equal to a specified object. + /// + /// An object to compare with this instance. + /// + /// if is an instance of + /// and the state equals the state of this instance; otherwise, . + /// + public override bool Equals(object obj) + { + if (obj == this) return true; + return obj is ShowInCustomDialogAttribute other && other.ShowInCustomDialog == ShowInCustomDialog; + } + + /// + /// Returns the hash code for this instance. + /// + /// A 32-bit signed integer hash code. + public override int GetHashCode() + { + return ShowInCustomDialog.GetHashCode(); + } + } +}