Skip to content

Commit ae66daf

Browse files
committed
Import NeuropixelsV1e GUI files
1 parent 60e22f1 commit ae66daf

40 files changed

+3142
-138
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<PackageIcon>icon.png</PackageIcon>
1616
<VersionPrefix>0.1.0</VersionPrefix>
1717
<VersionSuffix></VersionSuffix>
18-
<LangVersion>9.0</LangVersion>
18+
<LangVersion>10.0</LangVersion>
1919
<Features>strict</Features>
2020
</PropertyGroup>
2121

OpenEphys.Onix1.Design/Bno055Dialog.Designer.cs

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
3+
namespace OpenEphys.Onix1.Design
4+
{
5+
/// <summary>
6+
/// Simple dialog that attaches the <see cref="ConfigureBno055"/> to a property grid.
7+
/// </summary>
8+
public partial class Bno055Dialog : GenericDeviceDialog
9+
{
10+
/// <summary>
11+
/// Gets or sets the <see cref="ConfigureBno055"/>, allowing for changes made in the dialog to be reflected in the main editor.
12+
/// </summary>
13+
public ConfigureBno055 ConfigureNode
14+
{
15+
get => (ConfigureBno055)propertyGrid.SelectedObject;
16+
set => propertyGrid.SelectedObject = value;
17+
}
18+
19+
/// <summary>
20+
/// Initializes a new dialog for the <see cref="ConfigureBno055"/> operator.
21+
/// </summary>
22+
/// <param name="configureNode"></param>
23+
public Bno055Dialog(ConfigureBno055 configureNode)
24+
{
25+
InitializeComponent();
26+
Shown += FormShown;
27+
28+
ConfigureNode = new(configureNode);
29+
}
30+
31+
private void FormShown(object sender, EventArgs e)
32+
{
33+
if (!TopLevel)
34+
{
35+
splitContainer1.Panel2Collapsed = true;
36+
splitContainer1.Panel2.Hide();
37+
38+
MaximumSize = new System.Drawing.Size(0, 0);
39+
}
40+
}
41+
}
42+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Bonsai.Design;
2+
using System.ComponentModel;
3+
using System.Windows.Forms;
4+
using System;
5+
6+
namespace OpenEphys.Onix1.Design
7+
{
8+
/// <summary>
9+
/// Class that opens a new dialog for a <see cref="ConfigureBno055"/>.
10+
/// </summary>
11+
public class Bno055Editor : WorkflowComponentEditor
12+
{
13+
/// <inheritdoc/>
14+
public override bool EditComponent(ITypeDescriptorContext context, object component, IServiceProvider provider, IWin32Window owner)
15+
{
16+
if (provider != null)
17+
{
18+
var editorState = (IWorkflowEditorState)provider.GetService(typeof(IWorkflowEditorState));
19+
if (editorState != null && !editorState.WorkflowRunning && component is ConfigureBno055 configureBno055)
20+
{
21+
using var editorDialog = new Bno055Dialog(configureBno055);
22+
23+
if (editorDialog.ShowDialog() == DialogResult.OK)
24+
{
25+
configureBno055.Enable = editorDialog.ConfigureNode.Enable;
26+
27+
return true;
28+
}
29+
}
30+
}
31+
32+
return false;
33+
}
34+
}
35+
}

OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public ChannelConfigurationDialog(ProbeGroup probeGroup)
4444

4545
SelectedContacts = new bool[ChannelConfiguration.NumberOfContacts];
4646

47+
ReferenceContacts = new List<int>();
48+
4749
zedGraphChannels.MouseDownEvent += MouseDownEvent;
4850
zedGraphChannels.MouseMoveEvent += MouseMoveEvent;
4951
zedGraphChannels.MouseUpEvent += MouseUpEvent;
@@ -1079,7 +1081,6 @@ private bool MouseMoveEvent(ZedGraphControl sender, MouseEventArgs e)
10791081
private bool MouseUpEvent(ZedGraphControl sender, MouseEventArgs e)
10801082
{
10811083
sender.Cursor = Cursors.Arrow;
1082-
10831084
if (e.Button == MouseButtons.Left)
10841085
{
10851086
if (sender.GraphPane.GraphObjList[SelectionAreaTag] is BoxObj selectionArea && selectionArea != null && ChannelConfiguration != null)
@@ -1095,7 +1096,6 @@ private bool MouseUpEvent(ZedGraphControl sender, MouseEventArgs e)
10951096
{
10961097
var x = c.Location.X + c.Location.Width / 2;
10971098
var y = c.Location.Y - c.Location.Height / 2;
1098-
10991099
return c is not PolyObj &&
11001100
x >= rect.X &&
11011101
x <= rect.X + rect.Width &&

OpenEphys.Onix1.Design/ContactTag.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22

33
namespace OpenEphys.Onix1.Design
44
{

OpenEphys.Onix1.Design/DesignHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;

OpenEphys.Onix1.Design/NeuropixelsV1eBno055Dialog.Designer.cs

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
3+
namespace OpenEphys.Onix1.Design
4+
{
5+
/// <summary>
6+
/// Partial class to create a GUI for <see cref="ConfigureNeuropixelsV1eBno055"/>.
7+
/// </summary>
8+
public partial class NeuropixelsV1eBno055Dialog : GenericDeviceDialog
9+
{
10+
/// <summary>
11+
/// Gets or sets the <see cref="ConfigureNeuropixelsV1eBno055"/> object attached to
12+
/// the property grid.
13+
/// </summary>
14+
public ConfigureNeuropixelsV1eBno055 ConfigureNode
15+
{
16+
get => (ConfigureNeuropixelsV1eBno055)propertyGrid.SelectedObject;
17+
set => propertyGrid.SelectedObject = value;
18+
}
19+
20+
/// <summary>
21+
/// Initializes a new <see cref="NeuropixelsV1eBno055Dialog"/> instance with the given
22+
/// <see cref="ConfigureNeuropixelsV1eBno055"/> object.
23+
/// </summary>
24+
/// <param name="configureNode">A <see cref="ConfigureNeuropixelsV1eBno055"/> object that contains configuration settings.</param>
25+
public NeuropixelsV1eBno055Dialog(ConfigureNeuropixelsV1eBno055 configureNode)
26+
{
27+
InitializeComponent();
28+
Shown += FormShown;
29+
30+
ConfigureNode = new(configureNode);
31+
}
32+
33+
private void FormShown(object sender, EventArgs e)
34+
{
35+
if (!TopLevel)
36+
{
37+
splitContainer1.Panel2Collapsed = true;
38+
splitContainer1.Panel2.Hide();
39+
}
40+
}
41+
}
42+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.ComponentModel;
3+
using Bonsai.Design;
4+
using System.Windows.Forms;
5+
6+
namespace OpenEphys.Onix1.Design
7+
{
8+
internal class NeuropixelsV1eBno055Editor : WorkflowComponentEditor
9+
{
10+
public override bool EditComponent(ITypeDescriptorContext context, object component, IServiceProvider provider, IWin32Window owner)
11+
{
12+
if (provider != null)
13+
{
14+
var editorState = (IWorkflowEditorState)provider.GetService(typeof(IWorkflowEditorState));
15+
if (editorState != null && !editorState.WorkflowRunning && component is ConfigureNeuropixelsV1eBno055 configureBno055)
16+
{
17+
using var editorDialog = new NeuropixelsV1eBno055Dialog(configureBno055);
18+
19+
if (editorDialog.ShowDialog() == DialogResult.OK)
20+
{
21+
configureBno055.Enable = editorDialog.ConfigureNode.Enable;
22+
23+
return true;
24+
}
25+
}
26+
}
27+
28+
return false;
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)