Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions OpenEphys.Onix1.Design/DesignHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MenuStrip>()
.FirstOrDefault() ?? throw new InvalidOperationException($"There are no menu strips in any child controls of the {childForm.Text} dialog.");

Expand Down Expand Up @@ -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<MenuStrip>()
.First() ?? throw new InvalidOperationException($"There are no menu strips in any child controls of the {childForm.Text} dialog.");

Expand Down
214 changes: 89 additions & 125 deletions OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.Designer.cs

Large diffs are not rendered by default.

46 changes: 16 additions & 30 deletions OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ namespace OpenEphys.Onix1.Design
/// </summary>
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;
Expand All @@ -25,37 +29,23 @@ public partial class GenericStimulusSequenceDialog : Form
InitializeComponent();

NumberOfChannels = 0;
UseProbeGroup = true;
}

/// <summary>
/// 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.
/// </summary>
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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -524,5 +506,9 @@ void ResetZoom()
zedGraphWaveform.Refresh();
}

void PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
{
DrawStimulusWaveform();
}
}
}
3 changes: 3 additions & 0 deletions OpenEphys.Onix1.Design/GenericStimulusSequenceDialog.resx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>626, 12</value>
</metadata>
<metadata name="bindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>724, 12</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
Expand Down
4 changes: 2 additions & 2 deletions OpenEphys.Onix1.Design/Headstage64Dialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions OpenEphys.Onix1.Design/Headstage64Dialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 5 additions & 3 deletions OpenEphys.Onix1.Design/Headstage64Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public Headstage64ElectricalStimulatorOptions()
/// <param name="electricalStimulator"></param>
public Headstage64ElectricalStimulatorOptions(ConfigureHeadstage64ElectricalStimulator electricalStimulator)
: this()
{
UpdateControls(electricalStimulator);
}

internal void UpdateControls(ConfigureHeadstage64ElectricalStimulator electricalStimulator)
{
textBoxPhaseOneCurrent.Text = electricalStimulator.PhaseOneCurrent.ToString();
textBoxPhaseOneDuration.Text = electricalStimulator.PhaseOneDuration.ToString();
Expand Down
Loading