Skip to content

Commit 54bc601

Browse files
committed
Add PropertyGrid to NeuropixelsV2 dialogs
1 parent a34a941 commit 54bc601

11 files changed

+199
-94
lines changed

OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ void ForceBindingUpdate(object sender, EventArgs e)
9191

9292
bindingSource.ResetCurrentItem();
9393
}
94-
;
9594

9695
comboBoxApGain.DataSource = Enum.GetValues(typeof(NeuropixelsV1Gain));
9796
comboBoxApGain.DataBindings.Add("SelectedItem",

OpenEphys.Onix1.Design/NeuropixelsV2eChannelConfigurationDialog.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ public partial class NeuropixelsV2eChannelConfigurationDialog : ChannelConfigura
2424
/// </summary>
2525
/// <param name="probeConfiguration">A <see cref="NeuropixelsV2ProbeConfiguration"/> object holding the current configuration settings.</param>
2626
public NeuropixelsV2eChannelConfigurationDialog(NeuropixelsV2ProbeConfiguration probeConfiguration)
27-
: base(probeConfiguration.ProbeGroup.Clone())
27+
: base(probeConfiguration.ProbeGroup)
2828
{
2929
zedGraphChannels.ZoomButtons = MouseButtons.None;
3030
zedGraphChannels.ZoomButtons2 = MouseButtons.None;
3131

3232
zedGraphChannels.ZoomStepFraction = 0.5;
3333

34-
ProbeConfiguration = probeConfiguration.Clone();
35-
ProbeConfiguration.ProbeGroup = (NeuropixelsV2eProbeGroup)ProbeGroup;
34+
ProbeConfiguration = probeConfiguration;
3635

3736
GetChannelNumberFunc = ProbeConfiguration.ChannelMap[0].GetChannelNumberFunc();
3837

OpenEphys.Onix1.Design/NeuropixelsV2eDialog.Designer.cs

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenEphys.Onix1.Design/NeuropixelsV2eDialog.cs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ internal NeuropixelsV2ProbeConfiguration ProbeConfigurationB
3535
/// Public <see cref="IConfigureNeuropixelsV2"/> interface that is manipulated by
3636
/// <see cref="NeuropixelsV2eDialog"/>.
3737
/// </summary>
38-
[Obsolete]
39-
public IConfigureNeuropixelsV2 ConfigureNode { get; set; }
38+
public IConfigureNeuropixelsV2 ConfigureNode
39+
{
40+
get => (IConfigureNeuropixelsV2)propertyGrid.SelectedObject;
41+
set => propertyGrid.SelectedObject = value;
42+
}
4043

4144
/// <summary>
4245
/// Initializes a new instance of <see cref="NeuropixelsV2eDialog"/>.
@@ -47,6 +50,8 @@ public NeuropixelsV2eDialog(IConfigureNeuropixelsV2 configureNode)
4750
InitializeComponent();
4851
Shown += FormShown;
4952

53+
propertyGrid.SelectedObject = configureNode;
54+
5055
if (configureNode is ConfigureNeuropixelsV2eBeta)
5156
{
5257
Text = Text.Replace("NeuropixelsV2e ", "NeuropixelsV2eBeta ");
@@ -60,11 +65,8 @@ public NeuropixelsV2eDialog(IConfigureNeuropixelsV2 configureNode)
6065

6166
foreach (var channelConfiguration in ProbeConfigurations)
6267
{
63-
string probeName = channelConfiguration.Key.ToString();
64-
65-
tabControlProbe.TabPages.Add(probeName, probeName);
66-
channelConfiguration.Value.SetChildFormProperties(this).AddDialogToTab(tabControlProbe.TabPages[probeName]);
67-
this.AddMenuItemsFromDialogToFileOption(channelConfiguration.Value, probeName);
68+
channelConfiguration.Value.SetChildFormProperties(this);
69+
this.AddMenuItemsFromDialogToFileOption(channelConfiguration.Value, channelConfiguration.Key.ToString());
6870
}
6971
}
7072

@@ -78,10 +80,19 @@ private void FormShown(object sender, EventArgs e)
7880
menuStrip.Visible = false;
7981
}
8082

83+
int index = 0;
84+
8185
foreach (var channelConfiguration in ProbeConfigurations)
8286
{
87+
string probeName = channelConfiguration.Key.ToString();
88+
89+
tabControlProbe.TabPages.Insert(index++, probeName, probeName);
90+
tabControlProbe.TabPages[probeName].Controls.Add(channelConfiguration.Value);
91+
8392
channelConfiguration.Value.Show();
8493
}
94+
95+
tabControlProbe.SelectedIndex = 0;
8596
}
8697

8798
internal void Okay_Click(object sender, EventArgs e)

OpenEphys.Onix1.Design/NeuropixelsV2eEditor.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon
1818
var editorState = (IWorkflowEditorState)provider.GetService(typeof(IWorkflowEditorState));
1919
if (editorState != null && !editorState.WorkflowRunning && component is IConfigureNeuropixelsV2 configureNeuropixelsV2e)
2020
{
21-
using var editorDialog = new NeuropixelsV2eDialog(configureNeuropixelsV2e);
21+
var configureNode = configureNeuropixelsV2e.Clone();
22+
23+
using var editorDialog = new NeuropixelsV2eDialog(configureNode);
2224

2325
if (editorDialog.ShowDialog() == DialogResult.OK)
2426
{
25-
DesignHelper.CopyProperties(editorDialog.ProbeConfigurationA, configureNeuropixelsV2e.ProbeConfigurationA, DesignHelper.PropertiesToIgnore);
26-
DesignHelper.CopyProperties(editorDialog.ProbeConfigurationB, configureNeuropixelsV2e.ProbeConfigurationB, DesignHelper.PropertiesToIgnore);
27+
DesignHelper.CopyProperties(editorDialog.ConfigureNode, configureNeuropixelsV2e, DesignHelper.PropertiesToIgnore);
2728

2829
return true;
2930
}

OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public NeuropixelsV2eHeadstageDialog(IConfigureNeuropixelsV2 configureNeuropixel
4141
tabPageNeuropixelsV2e.Text = "NeuropixelsV2eBeta";
4242
}
4343

44-
DialogBno055 = new(new ConfigurePolledBno055(configureBno055));
44+
DialogBno055 = new(configureBno055);
4545

4646
DialogBno055.SetChildFormProperties(this).AddDialogToPanel(panelBno055);
4747
}

OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageEditor.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,30 @@ public override bool EditComponent(ITypeDescriptorContext context, object compon
1919

2020
if (editorState != null && !editorState.WorkflowRunning && component is ConfigureHeadstageNeuropixelsV2e configureV2eHeadstage)
2121
{
22-
using var editorDialog = new NeuropixelsV2eHeadstageDialog(configureV2eHeadstage.NeuropixelsV2e, configureV2eHeadstage.Bno055);
22+
var configureNode = configureV2eHeadstage.Clone();
23+
24+
using var editorDialog = new NeuropixelsV2eHeadstageDialog(configureNode.NeuropixelsV2e, configureNode.Bno055);
2325

2426
if (editorDialog.ShowDialog() == DialogResult.OK)
2527
{
2628
DesignHelper.CopyProperties((ConfigurePolledBno055)editorDialog.DialogBno055.Device, configureV2eHeadstage.Bno055, DesignHelper.PropertiesToIgnore);
2729

28-
configureV2eHeadstage.NeuropixelsV2e.ProbeConfigurationA = editorDialog.DialogNeuropixelsV2e.ProbeConfigurationA;
29-
configureV2eHeadstage.NeuropixelsV2e.ProbeConfigurationB = editorDialog.DialogNeuropixelsV2e.ProbeConfigurationB;
30+
DesignHelper.CopyProperties((ConfigureNeuropixelsV2e)editorDialog.DialogNeuropixelsV2e.ConfigureNode, configureV2eHeadstage.NeuropixelsV2e, DesignHelper.PropertiesToIgnore);
3031

3132
return true;
3233
}
3334
}
3435
else if (editorState != null && !editorState.WorkflowRunning && component is ConfigureHeadstageNeuropixelsV2eBeta configureV2eBetaHeadstage)
3536
{
36-
using var editorDialog = new NeuropixelsV2eHeadstageDialog(configureV2eBetaHeadstage.NeuropixelsV2eBeta, configureV2eBetaHeadstage.Bno055);
37+
var configureNode = configureV2eBetaHeadstage.Clone();
38+
39+
using var editorDialog = new NeuropixelsV2eHeadstageDialog(configureNode.NeuropixelsV2eBeta, configureNode.Bno055);
3740

3841
if (editorDialog.ShowDialog() == DialogResult.OK)
3942
{
4043
DesignHelper.CopyProperties((ConfigurePolledBno055)editorDialog.DialogBno055.Device, configureV2eBetaHeadstage.Bno055, DesignHelper.PropertiesToIgnore);
4144

42-
configureV2eBetaHeadstage.NeuropixelsV2eBeta.ProbeConfigurationA = editorDialog.DialogNeuropixelsV2e.ProbeConfigurationA;
43-
configureV2eBetaHeadstage.NeuropixelsV2eBeta.ProbeConfigurationB = editorDialog.DialogNeuropixelsV2e.ProbeConfigurationB;
45+
DesignHelper.CopyProperties((ConfigureNeuropixelsV2eBeta)editorDialog.DialogNeuropixelsV2e.ConfigureNode, configureV2eBetaHeadstage.NeuropixelsV2eBeta, DesignHelper.PropertiesToIgnore);
4446

4547
return true;
4648
}

0 commit comments

Comments
 (0)