diff --git a/OpenEphys.Onix1.Design/ChannelConfigurationDialog.Designer.cs b/OpenEphys.Onix1.Design/ChannelConfigurationDialog.Designer.cs index 9e7cd798..1d6990ac 100644 --- a/OpenEphys.Onix1.Design/ChannelConfigurationDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/ChannelConfigurationDialog.Designer.cs @@ -30,50 +30,25 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ChannelConfigurationDialog)); - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.zedGraphChannels = new ZedGraph.ZedGraphControl(); - this.buttonCancel = new System.Windows.Forms.Button(); - this.buttonOK = new System.Windows.Forms.Button(); + this.buttonResetZoom = new System.Windows.Forms.Button(); this.menuStrip = new System.Windows.Forms.MenuStrip(); this.fileMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.dropDownOpenFile = new System.Windows.Forms.ToolStripMenuItem(); this.dropDownSaveFile = new System.Windows.Forms.ToolStripMenuItem(); this.dropDownLoadDefault = new System.Windows.Forms.ToolStripMenuItem(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); - this.splitContainer1.Panel1.SuspendLayout(); - this.splitContainer1.Panel2.SuspendLayout(); - this.splitContainer1.SuspendLayout(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.menuStrip.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.flowLayoutPanel2.SuspendLayout(); this.SuspendLayout(); // - // splitContainer1 - // - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; - this.splitContainer1.IsSplitterFixed = true; - this.splitContainer1.Location = new System.Drawing.Point(0, 24); - this.splitContainer1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.splitContainer1.Name = "splitContainer1"; - this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.zedGraphChannels); - // - // splitContainer1.Panel2 - // - this.splitContainer1.Panel2.Controls.Add(this.buttonCancel); - this.splitContainer1.Panel2.Controls.Add(this.buttonOK); - this.splitContainer1.Size = new System.Drawing.Size(609, 562); - this.splitContainer1.SplitterDistance = 525; - this.splitContainer1.TabIndex = 0; - this.splitContainer1.TabStop = false; - // // zedGraphChannels // this.zedGraphChannels.AutoSize = true; this.zedGraphChannels.Dock = System.Windows.Forms.DockStyle.Fill; - this.zedGraphChannels.Location = new System.Drawing.Point(0, 0); + this.zedGraphChannels.Location = new System.Drawing.Point(5, 6); this.zedGraphChannels.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); this.zedGraphChannels.Name = "zedGraphChannels"; this.zedGraphChannels.ScrollGrace = 0D; @@ -83,35 +58,24 @@ private void InitializeComponent() this.zedGraphChannels.ScrollMinX = 0D; this.zedGraphChannels.ScrollMinY = 0D; this.zedGraphChannels.ScrollMinY2 = 0D; - this.zedGraphChannels.Size = new System.Drawing.Size(609, 525); + this.zedGraphChannels.Size = new System.Drawing.Size(599, 496); this.zedGraphChannels.TabIndex = 4; this.zedGraphChannels.TabStop = false; this.zedGraphChannels.UseExtendedPrintDialog = true; this.zedGraphChannels.ZoomEvent += new ZedGraph.ZedGraphControl.ZoomEventHandler(this.ZoomEvent); // - // buttonCancel - // - this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(452, 1); - 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 = 1; - this.buttonCancel.Text = "Cancel"; - this.buttonCancel.UseVisualStyleBackColor = true; - // - // buttonOK - // - this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonOK.Location = new System.Drawing.Point(289, 1); - 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 = 0; - this.buttonOK.Text = "OK"; - this.buttonOK.UseVisualStyleBackColor = true; - this.buttonOK.Click += new System.EventHandler(this.ButtonOK); + // buttonResetZoom + // + this.buttonResetZoom.Image = global::OpenEphys.Onix1.Design.Properties.Resources.MagnifyingGlass; + this.buttonResetZoom.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.buttonResetZoom.Location = new System.Drawing.Point(3, 3); + this.buttonResetZoom.Name = "buttonResetZoom"; + this.buttonResetZoom.Size = new System.Drawing.Size(132, 32); + this.buttonResetZoom.TabIndex = 0; + this.buttonResetZoom.Text = "Reset Zoom"; + this.buttonResetZoom.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.buttonResetZoom.UseVisualStyleBackColor = true; + this.buttonResetZoom.Click += new System.EventHandler(this.ButtonResetZoom_Click); // // menuStrip // @@ -156,12 +120,37 @@ private void InitializeComponent() this.dropDownLoadDefault.Text = "Load Default Channel Configuration"; this.dropDownLoadDefault.Click += new System.EventHandler(this.MenuItemLoadDefaultConfig); // + // 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.zedGraphChannels, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24); + 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, 42F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 42F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(609, 550); + this.tableLayoutPanel1.TabIndex = 6; + // + // flowLayoutPanel2 + // + this.flowLayoutPanel2.Controls.Add(this.buttonResetZoom); + this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 511); + this.flowLayoutPanel2.Name = "flowLayoutPanel2"; + this.flowLayoutPanel2.Size = new System.Drawing.Size(603, 36); + this.flowLayoutPanel2.TabIndex = 5; + // // ChannelConfigurationDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(609, 586); - this.Controls.Add(this.splitContainer1); + this.ClientSize = new System.Drawing.Size(609, 574); + this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.menuStrip); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip; @@ -169,28 +158,25 @@ private void InitializeComponent() this.Name = "ChannelConfigurationDialog"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Channel Configuration"; - this.splitContainer1.Panel1.ResumeLayout(false); - this.splitContainer1.Panel1.PerformLayout(); - this.splitContainer1.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); - this.splitContainer1.ResumeLayout(false); this.menuStrip.ResumeLayout(false); this.menuStrip.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.flowLayoutPanel2.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); } #endregion - - private System.Windows.Forms.SplitContainer splitContainer1; internal ZedGraph.ZedGraphControl zedGraphChannels; - private System.Windows.Forms.Button buttonCancel; - private System.Windows.Forms.Button buttonOK; private System.Windows.Forms.MenuStrip menuStrip; private System.Windows.Forms.ToolStripMenuItem fileMenuItem; private System.Windows.Forms.ToolStripMenuItem dropDownOpenFile; private System.Windows.Forms.ToolStripMenuItem dropDownSaveFile; private System.Windows.Forms.ToolStripMenuItem dropDownLoadDefault; + private System.Windows.Forms.Button buttonResetZoom; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; } } diff --git a/OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs b/OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs index 15124500..51dd1caf 100644 --- a/OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/ChannelConfigurationDialog.cs @@ -1,11 +1,11 @@ -using System.Drawing; +using System; +using System.Collections.Generic; +using System.Drawing; using System.IO; using System.Linq; using System.Windows.Forms; -using ZedGraph; -using System; using OpenEphys.ProbeInterface.NET; -using System.Collections.Generic; +using ZedGraph; namespace OpenEphys.Onix1.Design { @@ -17,6 +17,7 @@ namespace OpenEphys.Onix1.Design public partial class ChannelConfigurationDialog : Form { internal event EventHandler OnResizeZedGraph; + internal event EventHandler OnDrawProbeGroup; internal ProbeGroup ProbeGroup; @@ -56,7 +57,23 @@ public ChannelConfigurationDialog(ProbeGroup probeGroup) zedGraphChannels.MouseMoveEvent += MouseMoveEvent; zedGraphChannels.MouseUpEvent += MouseUpEvent; - InitializeZedGraphChannels(); + if (IsDrawScale()) + { + var pane = new GraphPane(); + + InitializeScalePane(pane); + + zedGraphChannels.MasterPane.Add(pane); + } + + InitializeZedGraphControl(zedGraphChannels); + InitializeProbePane(zedGraphChannels.GraphPane); + + foreach (var pane in zedGraphChannels.MasterPane.PaneList) + { + pane.Chart.Fill = new Fill(Color.WhiteSmoke); + } + DrawProbeGroup(); RefreshZedGraph(); } @@ -100,17 +117,21 @@ internal virtual void ZoomEvent(ZedGraphControl sender, ZoomState oldState, Zoom if (CheckZoomBoundaries(sender)) { CenterAxesOnCursor(sender); - CheckProbeIsInView(sender); } else { sender.ZoomOut(sender.GraphPane); } } - else if (newState.Type == ZoomState.StateType.Pan) - { - CheckProbeIsInView(sender); - } + + 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) @@ -169,173 +190,6 @@ private void CenterAxesOnCursor(ZedGraphControl zedGraphControl) zedGraphControl.GraphPane.YAxis.Scale.Max += diffY; } - private struct ProbeEdge - { - public double Left; - public double Bottom; - public double Right; - public double Top; - - public ProbeEdge(ZedGraphControl zedGraphControl) - { - Left = GetProbeLeft(zedGraphControl.GraphPane.GraphObjList); - Right = GetProbeRight(zedGraphControl.GraphPane.GraphObjList); - Bottom = GetProbeBottom(zedGraphControl.GraphPane.GraphObjList); - Top = GetProbeTop(zedGraphControl.GraphPane.GraphObjList); - } - } - - private struct ScaleEdge - { - public double Left; - public double Bottom; - public double Right; - public double Top; - - public ScaleEdge(ZedGraphControl zedGraphControl) - { - Left = zedGraphControl.GraphPane.XAxis.Scale.Min; - Right = zedGraphControl.GraphPane.XAxis.Scale.Max; - Bottom = zedGraphControl.GraphPane.YAxis.Scale.Min; - Top = zedGraphControl.GraphPane.YAxis.Scale.Max; - } - } - - private void CheckProbeIsInView(ZedGraphControl zedGraphControl) - { - var probeEdge = new ProbeEdge(zedGraphControl); - var scaleEdge = new ScaleEdge(zedGraphControl); - - var rangeX = CalculateScaleRange(zedGraphControl.GraphPane.XAxis.Scale); - var rangeY = CalculateScaleRange(zedGraphControl.GraphPane.YAxis.Scale); - - var boundaryX = rangeX / 4; - var boundaryY = rangeY / 4; - - if (IsProbeCentered(probeEdge, scaleEdge)) - { - return; - } - else if (IsProbeCenteredX(probeEdge, scaleEdge)) - { - if (IsProbeTooHigh(probeEdge, scaleEdge, boundaryY)) - { - MoveProbeDown(zedGraphControl, probeEdge, scaleEdge, boundaryY); - } - else if (IsProbeTooLow(probeEdge, scaleEdge, boundaryY)) - { - MoveProbeUp(zedGraphControl, probeEdge, scaleEdge, boundaryY); - } - } - else if (IsProbeCenteredY(probeEdge, scaleEdge)) - { - if (IsProbeTooLeft(probeEdge, scaleEdge, boundaryX)) - { - MoveProbeRight(zedGraphControl, probeEdge, scaleEdge, boundaryX); - } - else if (IsProbeTooRight(probeEdge, scaleEdge, boundaryX)) - { - MoveProbeLeft(zedGraphControl, probeEdge, scaleEdge, boundaryX); - } - } - else - { - if (IsProbeTooHigh(probeEdge, scaleEdge, boundaryY)) - { - MoveProbeDown(zedGraphControl, probeEdge, scaleEdge, boundaryY); - } - else if (IsProbeTooLow(probeEdge, scaleEdge, boundaryY)) - { - MoveProbeUp(zedGraphControl, probeEdge, scaleEdge, boundaryY); - } - - if (IsProbeTooLeft(probeEdge, scaleEdge, boundaryX)) - { - MoveProbeRight(zedGraphControl, probeEdge, scaleEdge, boundaryX); - } - else if (IsProbeTooRight(probeEdge, scaleEdge, boundaryX)) - { - MoveProbeLeft(zedGraphControl, probeEdge, scaleEdge, boundaryX); - } - } - } - - private void MoveProbeLeft(ZedGraphControl zedGraphControl, ProbeEdge probeEdge, ScaleEdge scaleEdge, double boundary) - { - bool probeSmallerThanScale = probeEdge.Right - probeEdge.Left < scaleEdge.Right - scaleEdge.Left; - - double diff = probeSmallerThanScale ? probeEdge.Right - scaleEdge.Right : probeEdge.Left - (scaleEdge.Left + boundary); - - zedGraphControl.GraphPane.XAxis.Scale.Min += diff; - zedGraphControl.GraphPane.XAxis.Scale.Max += diff; - } - - private bool IsProbeTooRight(ProbeEdge probeEdge, ScaleEdge scaleEdge, double boundary) - { - return probeEdge.Left > scaleEdge.Left + boundary; - } - - private void MoveProbeRight(ZedGraphControl zedGraphControl, ProbeEdge probeEdge, ScaleEdge scaleEdge, double boundary) - { - bool probeSmallerThanScale = probeEdge.Right - probeEdge.Left < scaleEdge.Right - scaleEdge.Left; - - var diff = probeSmallerThanScale ? probeEdge.Left - scaleEdge.Left : probeEdge.Right - (scaleEdge.Right - boundary); - - zedGraphControl.GraphPane.XAxis.Scale.Min += diff; - zedGraphControl.GraphPane.XAxis.Scale.Max += diff; - } - - private bool IsProbeTooLeft(ProbeEdge probeEdge, ScaleEdge scaleEdge, double boundary) - { - return probeEdge.Right < scaleEdge.Right - boundary; - } - - private void MoveProbeUp(ZedGraphControl zedGraphControl, ProbeEdge probeEdge, ScaleEdge scaleEdge, double boundary) - { - var diff = probeEdge.Top - (scaleEdge.Top - boundary); - - zedGraphControl.GraphPane.YAxis.Scale.Min += diff; - zedGraphControl.GraphPane.YAxis.Scale.Max += diff; - } - - private bool IsProbeTooLow(ProbeEdge probeEdge, ScaleEdge scaleEdge, double boundary) - { - return probeEdge.Top < scaleEdge.Top - boundary; - } - - private void MoveProbeDown(ZedGraphControl zedGraphControl, ProbeEdge probeEdge, ScaleEdge scaleEdge, double boundary) - { - var diff = probeEdge.Bottom - (scaleEdge.Bottom + boundary); - - zedGraphControl.GraphPane.YAxis.Scale.Min += diff; - zedGraphControl.GraphPane.YAxis.Scale.Max += diff; - } - - private bool IsProbeTooHigh(ProbeEdge probeEdge, ScaleEdge scaleEdge, double boundary) - { - return probeEdge.Bottom > scaleEdge.Bottom + boundary; - } - - private bool IsProbeCenteredY(ProbeEdge probeEdge, ScaleEdge scaleEdge) - { - return probeEdge.Bottom >= scaleEdge.Bottom && probeEdge.Top <= scaleEdge.Top || - probeEdge.Bottom <= scaleEdge.Bottom && probeEdge.Top >= scaleEdge.Top; - } - - private bool IsProbeCenteredX(ProbeEdge probeEdge, ScaleEdge scaleEdge) - { - return probeEdge.Left >= scaleEdge.Left && probeEdge.Right <= scaleEdge.Right || - probeEdge.Left <= scaleEdge.Left && probeEdge.Right >= scaleEdge.Right; - } - - private bool IsProbeCentered(ProbeEdge probeEdge, ScaleEdge scaleEdge) - { - return (probeEdge.Left >= scaleEdge.Left && probeEdge.Right <= scaleEdge.Right && - probeEdge.Bottom >= scaleEdge.Bottom && probeEdge.Top <= scaleEdge.Top) || - (probeEdge.Left <= scaleEdge.Left && probeEdge.Right >= scaleEdge.Right && - probeEdge.Bottom <= scaleEdge.Bottom && probeEdge.Top >= scaleEdge.Top); - } - internal static double CalculateScaleRange(Scale scale) { return scale.Max - scale.Min; @@ -415,20 +269,8 @@ private void FormShown(object sender, EventArgs e) { if (!TopLevel) { - DisconnectResizeEventHandler(); - - splitContainer1.Panel2Collapsed = true; - splitContainer1.Panel2.Hide(); - menuStrip.Visible = false; - - ConnectResizeEventHandler(); - ZedGraphChannels_Resize(null, null); - } - else - { - UpdateFontSize(); - zedGraphChannels.Refresh(); + ResizeZedGraph(); } } @@ -490,7 +332,18 @@ internal void DrawProbeGroup() HighlightEnabledContacts(); HighlightSelectedContacts(); DrawContactLabels(); - DrawScale(); + + if (IsDrawScale()) + { + DrawScale(); + } + + OnDrawProbeGroupHandler(); + } + + void OnDrawProbeGroupHandler() + { + OnDrawProbeGroup?.Invoke(this, EventArgs.Empty); } private double ZoomOutBoundaryLeft = default; @@ -791,6 +644,8 @@ 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() @@ -958,34 +813,107 @@ public static PointD[] ConvertFloatArrayToPointD(float[][] floats) return pointD; } - /// - /// Initialize the given so that almost everything other than the - /// axis itself is hidden, reducing visual clutter before plotting contacts - /// - public void InitializeZedGraphChannels() + static void InitializeZedGraphControl(ZedGraphControl zedGraph) + { + zedGraph.IsZoomOnMouseCenter = true; + zedGraph.IsAntiAlias = true; + zedGraph.BorderStyle = BorderStyle.None; + + EnablePan(zedGraph); + EnableZoom(zedGraph); + } + + static void EnablePan(ZedGraphControl zedGraph) + { + zedGraph.IsEnableHPan = true; + zedGraph.IsEnableVPan = true; + } + + static void DisablePan(ZedGraphControl zedGraph) { - zedGraphChannels.IsZoomOnMouseCenter = true; + zedGraph.IsEnableHPan = false; + zedGraph.IsEnableVPan = false; + } + + 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; - zedGraphChannels.IsAntiAlias = true; + 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; - zedGraphChannels.GraphPane.Title.IsVisible = false; - zedGraphChannels.GraphPane.TitleGap = 0; - zedGraphChannels.GraphPane.Border.IsVisible = false; - zedGraphChannels.GraphPane.Border.Width = 0; - zedGraphChannels.GraphPane.Chart.Border.IsVisible = false; - zedGraphChannels.GraphPane.Margin.All = -1; - zedGraphChannels.GraphPane.IsFontsScaled = true; - zedGraphChannels.BorderStyle = BorderStyle.None; + pane.YAxis.MajorGrid.IsZeroLine = false; + pane.YAxis.MajorGrid.IsVisible = false; + pane.YAxis.MinorGrid.IsVisible = false; - zedGraphChannels.GraphPane.XAxis.IsVisible = false; - zedGraphChannels.GraphPane.XAxis.IsAxisSegmentVisible = false; - zedGraphChannels.GraphPane.XAxis.Scale.MaxAuto = true; - zedGraphChannels.GraphPane.XAxis.Scale.MinAuto = true; + 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; - zedGraphChannels.GraphPane.YAxis.IsVisible = false; - zedGraphChannels.GraphPane.YAxis.IsAxisSegmentVisible = false; - zedGraphChannels.GraphPane.YAxis.Scale.MaxAuto = true; - zedGraphChannels.GraphPane.YAxis.Scale.MinAuto = true; + 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; + graphPane.TitleGap = 0; + graphPane.Border.IsVisible = false; + graphPane.Border.Width = 0; + graphPane.Chart.Border.IsVisible = false; + graphPane.Margin.All = -1; + graphPane.IsFontsScaled = true; + + graphPane.XAxis.IsVisible = false; + graphPane.XAxis.IsAxisSegmentVisible = false; + graphPane.XAxis.Scale.MaxAuto = true; + graphPane.XAxis.Scale.MinAuto = true; + + graphPane.YAxis.IsVisible = false; + graphPane.YAxis.IsAxisSegmentVisible = false; + graphPane.YAxis.Scale.MaxAuto = true; + graphPane.YAxis.Scale.MinAuto = true; } private void MenuItemSaveFile(object sender, EventArgs e) @@ -1016,23 +944,26 @@ internal void DisconnectResizeEventHandler() private void ZedGraphChannels_Resize(object sender, EventArgs e) { - if (zedGraphChannels.Size.Width == zedGraphChannels.Size.Height && - zedGraphChannels.Size.Height == zedGraphChannels.GraphPane.Rect.Height && - zedGraphChannels.Location.X == zedGraphChannels.GraphPane.Rect.X) + ResizeZedGraph(); + } + + internal void ResizeZedGraph() + { + ResizeAxes(); + + if (IsDrawScale()) { - if (zedGraphChannels.GraphPane.Chart.Rect != zedGraphChannels.GraphPane.Rect) - { - zedGraphChannels.GraphPane.Chart.Rect = zedGraphChannels.GraphPane.Rect; - } + var rect = zedGraphChannels.MasterPane.Rect; - return; + 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); } - ResizeAxes(); - UpdateControlSizeBasedOnAxisSize(); UpdateFontSize(); - DrawScale(); RefreshZedGraph(); + Update(); OnResizeHandler(); } @@ -1041,42 +972,40 @@ private void OnResizeHandler() OnResizeZedGraph?.Invoke(this, EventArgs.Empty); } - /// - /// After a resize event (such as changing the window size), readjust the size of the control to - /// ensure an equal aspect ratio for axes. - /// - public void ResizeAxes() + void ResizeAxes() { - SetEqualAspectRatio(); + float scalingFactor = IsDrawScale() ? 1.15f : 1.0f; + RectangleF rect = IsDrawScale() ? zedGraphChannels.MasterPane.Rect : zedGraphChannels.GraphPane.Rect; - RectangleF axisRect = zedGraphChannels.GraphPane.Rect; + float width = rect.Width; + float height = rect.Height; - if (axisRect.Width > axisRect.Height) - { - axisRect.X += (axisRect.Width - axisRect.Height) / 2; - axisRect.Width = axisRect.Height; - } - else if (axisRect.Height > axisRect.Width) + float desiredWidth = height * scalingFactor; + + if (width < desiredWidth) { - axisRect.Y += (axisRect.Height - axisRect.Width) / 2; - axisRect.Height = axisRect.Width; + height = width / scalingFactor; } else { - zedGraphChannels.GraphPane.Chart.Rect = axisRect; - return; + width = desiredWidth; } - zedGraphChannels.GraphPane.Rect = axisRect; - zedGraphChannels.GraphPane.Chart.Rect = axisRect; - } + float x = MathF.Round(rect.Left + (rect.Width - width) / 2f); + float y = MathF.Round(rect.Top + (rect.Height - height) / 2f); - private void UpdateControlSizeBasedOnAxisSize() - { - RectangleF axisRect = zedGraphChannels.GraphPane.Rect; + var newRect = new RectangleF(x, y, width, height); - zedGraphChannels.Size = new Size((int)axisRect.Width, (int)axisRect.Height); - zedGraphChannels.Location = new Point((int)axisRect.X, (int)axisRect.Y); + 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(); + } } private void MenuItemOpenFile(object sender, EventArgs e) @@ -1137,6 +1066,9 @@ 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]); } internal float GetRelativeVerticalPosition() @@ -1208,10 +1140,30 @@ private bool MouseMoveEvent(ZedGraphControl sender, MouseEventArgs e) return true; } + else if (e.Button == MouseButtons.Middle) + { + if (IsDrawScale()) + SyncYAxes(zedGraphChannels.MasterPane.PaneList[0], zedGraphChannels.MasterPane.PaneList[1]); + + return false; + } else if (e.Button == MouseButtons.None) { 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; } @@ -1351,8 +1303,8 @@ internal static bool HasContactAnnotations(ProbeGroup probeGroup) { foreach (var probe in probeGroup.Probes) { - if (probe.ContactAnnotations != null - && probe.ContactAnnotations.Annotations != null + if (probe.ContactAnnotations != null + && probe.ContactAnnotations.Annotations != null && probe.ContactAnnotations.Annotations.Length > 0) { return true; @@ -1361,5 +1313,15 @@ internal static bool HasContactAnnotations(ProbeGroup probeGroup) return false; } + + private void ButtonResetZoom_Click(object sender, EventArgs e) + { + ResetZoom(); + + if (IsDrawScale()) + SyncYAxes(zedGraphChannels.MasterPane.PaneList[0], zedGraphChannels.MasterPane.PaneList[1]); + + RefreshZedGraph(); + } } } diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1ChannelConfigurationDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV1ChannelConfigurationDialog.cs index 64655cd4..afe9cdf9 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1ChannelConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1ChannelConfigurationDialog.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Drawing; using System.Linq; using System.Windows.Forms; using OpenEphys.ProbeInterface.NET; @@ -40,9 +39,6 @@ public NeuropixelsV1ChannelConfigurationDialog(NeuropixelsV1ProbeConfiguration p ProbeConfiguration = probeConfiguration; - ZoomInBoundaryX = 400; - ZoomInBoundaryY = 400; - HighlightEnabledContacts(); UpdateContactLabels(); DrawScale(); @@ -87,7 +83,6 @@ internal override void ZoomEvent(ZedGraphControl sender, ZoomState oldState, Zoo base.ZoomEvent(sender, oldState, newState); UpdateFontSize(); - DrawScale(); RefreshZedGraph(); OnZoomHandler(); @@ -98,90 +93,21 @@ private void OnZoomHandler() OnZoom?.Invoke(this, EventArgs.Empty); } + internal override bool IsDrawScale() => true; + internal override void DrawScale() { - if (ProbeConfiguration == null) + if (ProbeConfiguration == null || zedGraphChannels.MasterPane.PaneList.Count < 2) return; - const string ScalePointsTag = "scale_points"; - const string ScaleTextTag = "scale_text"; - - zedGraphChannels.GraphPane.GraphObjList.RemoveAll(obj => obj is TextObj && obj.Tag is string tag && tag == ScaleTextTag); - zedGraphChannels.GraphPane.CurveList.RemoveAll(curve => curve.Tag is string tag && tag == ScalePointsTag); - - const int MajorTickIncrement = 100; - const int MajorTickLength = 10; - const int MinorTickIncrement = 10; - const int MinorTickLength = 5; - - if (ProbeConfiguration.ProbeGroup.Probes.ElementAt(0).SiUnits != ProbeSiUnits.um) - { - MessageBox.Show("Warning: Expected ProbeGroup units to be in microns, but it is in millimeters. Scale might not be accurate."); - } - - var fontSize = CalculateFontSize(); - - var zoomedOut = fontSize <= 2; - - fontSize = zoomedOut ? 6 : fontSize * 3; - var majorTickOffset = MajorTickLength + CalculateScaleRange(zedGraphChannels.GraphPane.XAxis.Scale) * 0.015; - majorTickOffset = majorTickOffset > 50 ? 50 : majorTickOffset; - - var x = GetProbeRight(zedGraphChannels.GraphPane.GraphObjList) + 40; - var minY = GetProbeBottom(zedGraphChannels.GraphPane.GraphObjList); - var maxY = GetProbeTop(zedGraphChannels.GraphPane.GraphObjList); - - int textPosition = 0; - - PointPairList pointList = new(); - - var countMajorTicks = 0; - - for (int i = (int)minY; i < maxY; i += MajorTickIncrement) - { - PointPair majorTickLocation = new(x + MajorTickLength, minY + MajorTickIncrement * countMajorTicks); - - pointList.Add(new PointPair(x, minY + MajorTickIncrement * countMajorTicks)); - pointList.Add(majorTickLocation); - pointList.Add(new PointPair(x, minY + MajorTickIncrement * countMajorTicks)); - - if (!zoomedOut || countMajorTicks % 5 == 0) - { - TextObj textObj = new($"{textPosition} µm", majorTickLocation.X + 10, majorTickLocation.Y, CoordType.AxisXYScale, AlignH.Left, AlignV.Center) - { - Tag = ScaleTextTag - }; - textObj.FontSpec.Border.IsVisible = false; - textObj.FontSpec.Size = fontSize; - zedGraphChannels.GraphPane.GraphObjList.Add(textObj); - - textPosition += zoomedOut ? 5 * MajorTickIncrement : MajorTickIncrement; - } - - if (!zoomedOut) - { - var countMinorTicks = 1; - - for (int j = i + MinorTickIncrement; j < i + MajorTickIncrement && i + MinorTickIncrement * countMinorTicks < maxY; j += MinorTickIncrement) - { - pointList.Add(new PointPair(x, minY + MajorTickIncrement * countMajorTicks + MinorTickIncrement * countMinorTicks)); - pointList.Add(new PointPair(x + MinorTickLength, minY + MajorTickIncrement * countMajorTicks + MinorTickIncrement * countMinorTicks)); - pointList.Add(new PointPair(x, minY + MajorTickIncrement * countMajorTicks + MinorTickIncrement * countMinorTicks)); - - countMinorTicks++; - } - } - - countMajorTicks++; - } - - var curve = zedGraphChannels.GraphPane.AddCurve(ScalePointsTag, pointList, Color.Black, SymbolType.None); + var pane = zedGraphChannels.MasterPane.PaneList[1]; - const float scaleBarWidth = 1; + pane.YAxis.Scale.Min = GetProbeBottom(zedGraphChannels.GraphPane.GraphObjList); + pane.YAxis.Scale.Max = GetProbeTop(zedGraphChannels.GraphPane.GraphObjList); - curve.Line.Width = scaleBarWidth; - curve.Label.IsVisible = false; - curve.Symbol.IsVisible = false; + pane.YAxis.Scale.Format = "#####0' " + ProbeGroup.Probes.First().SiUnits.ToString() + "'"; + pane.YAxis.Scale.Mag = 0; + pane.YAxis.Scale.MagAuto = false; } internal override void HighlightEnabledContacts() diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.Designer.cs b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.Designer.cs index 00cce85b..c1387367 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.Designer.cs @@ -29,8 +29,6 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.Label label1; - System.Windows.Forms.Label label3; System.Windows.Forms.Label label4; System.Windows.Forms.Label label2; System.Windows.Forms.Label labelPresets; @@ -51,9 +49,12 @@ 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.panelTrackBar = new System.Windows.Forms.Panel(); this.trackBarProbePosition = new System.Windows.Forms.TrackBar(); + 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.panelOptions = new System.Windows.Forms.Panel(); this.checkBoxInvertPolarity = new System.Windows.Forms.CheckBox(); this.textBoxLfpCorrection = new System.Windows.Forms.TextBox(); @@ -64,18 +65,12 @@ private void InitializeComponent() this.buttonEnableContacts = new System.Windows.Forms.Button(); this.buttonClearSelections = new System.Windows.Forms.Button(); this.comboBoxChannelPresets = new System.Windows.Forms.ComboBox(); - this.buttonResetZoom = new System.Windows.Forms.Button(); this.checkBoxSpikeFilter = new System.Windows.Forms.CheckBox(); this.textBoxAdcCalibrationFile = new System.Windows.Forms.TextBox(); this.textBoxGainCalibrationFile = new System.Windows.Forms.TextBox(); this.comboBoxReference = new System.Windows.Forms.ComboBox(); this.comboBoxLfpGain = new System.Windows.Forms.ComboBox(); this.comboBoxApGain = new System.Windows.Forms.ComboBox(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.buttonCancel = new System.Windows.Forms.Button(); - this.buttonOkay = new System.Windows.Forms.Button(); - label1 = new System.Windows.Forms.Label(); - label3 = new System.Windows.Forms.Label(); label4 = new System.Windows.Forms.Label(); label2 = new System.Windows.Forms.Label(); labelPresets = new System.Windows.Forms.Label(); @@ -89,42 +84,19 @@ private void InitializeComponent() this.statusStrip1.SuspendLayout(); this.menuStrip.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); - this.panelProbe.SuspendLayout(); this.panelTrackBar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.trackBarProbePosition)).BeginInit(); - this.panelOptions.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); + this.panelOptions.SuspendLayout(); this.SuspendLayout(); // - // label1 - // - label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - label1.AutoSize = true; - label1.Location = new System.Drawing.Point(19, 671); - label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - label1.Name = "label1"; - label1.Size = new System.Drawing.Size(39, 16); - label1.TabIndex = 31; - label1.Text = "0 mm"; - // - // label3 - // - label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - label3.AutoSize = true; - label3.Location = new System.Drawing.Point(15, 0); - label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - label3.Name = "label3"; - label3.Size = new System.Drawing.Size(46, 16); - label3.TabIndex = 32; - label3.Text = "10 mm"; - // // label4 // label4.AutoSize = true; label4.Location = new System.Drawing.Point(13, 277); label4.Name = "label4"; label4.Size = new System.Drawing.Size(71, 16); - label4.TabIndex = 40; + label4.TabIndex = 13; label4.Text = "Correction:"; // // label2 @@ -133,7 +105,7 @@ private void InitializeComponent() label2.Location = new System.Drawing.Point(13, 210); label2.Name = "label2"; label2.Size = new System.Drawing.Size(71, 16); - label2.TabIndex = 38; + label2.TabIndex = 9; label2.Text = "Correction:"; // // labelPresets @@ -142,7 +114,7 @@ private void InitializeComponent() labelPresets.Location = new System.Drawing.Point(13, 405); labelPresets.Name = "labelPresets"; labelPresets.Size = new System.Drawing.Size(56, 32); - labelPresets.TabIndex = 25; + labelPresets.TabIndex = 21; labelPresets.Text = "Channel\r\nPresets:"; // // adcCalibrationFile @@ -152,7 +124,7 @@ private void InitializeComponent() adcCalibrationFile.MaximumSize = new System.Drawing.Size(177, 36); adcCalibrationFile.Name = "adcCalibrationFile"; adcCalibrationFile.Size = new System.Drawing.Size(130, 16); - adcCalibrationFile.TabIndex = 11; + adcCalibrationFile.TabIndex = 0; adcCalibrationFile.Text = "ADC Calibration File:"; // // gainCalibrationFile @@ -162,7 +134,7 @@ private void InitializeComponent() gainCalibrationFile.MaximumSize = new System.Drawing.Size(177, 36); gainCalibrationFile.Name = "gainCalibrationFile"; gainCalibrationFile.Size = new System.Drawing.Size(130, 16); - gainCalibrationFile.TabIndex = 8; + gainCalibrationFile.TabIndex = 4; gainCalibrationFile.Text = "Gain Calibration File:"; // // spikeFilter @@ -171,7 +143,7 @@ private void InitializeComponent() spikeFilter.Location = new System.Drawing.Point(13, 310); spikeFilter.Name = "spikeFilter"; spikeFilter.Size = new System.Drawing.Size(77, 16); - spikeFilter.TabIndex = 6; + spikeFilter.TabIndex = 15; spikeFilter.Text = "Spike Filter:"; // // Reference @@ -180,7 +152,7 @@ private void InitializeComponent() Reference.Location = new System.Drawing.Point(13, 378); Reference.Name = "Reference"; Reference.Size = new System.Drawing.Size(73, 16); - Reference.TabIndex = 4; + Reference.TabIndex = 19; Reference.Text = "Reference:"; // // lfpGain @@ -189,7 +161,7 @@ private void InitializeComponent() lfpGain.Location = new System.Drawing.Point(13, 244); lfpGain.Name = "lfpGain"; lfpGain.Size = new System.Drawing.Size(65, 16); - lfpGain.TabIndex = 2; + lfpGain.TabIndex = 11; lfpGain.Text = "LFP Gain:"; // // apGain @@ -198,7 +170,7 @@ private void InitializeComponent() apGain.Location = new System.Drawing.Point(13, 178); apGain.Name = "apGain"; apGain.Size = new System.Drawing.Size(59, 16); - apGain.TabIndex = 0; + apGain.TabIndex = 7; apGain.Text = "AP Gain:"; // // invertPolarity @@ -207,7 +179,7 @@ private void InitializeComponent() invertPolarity.Location = new System.Drawing.Point(13, 332); invertPolarity.Name = "invertPolarity"; invertPolarity.Size = new System.Drawing.Size(55, 32); - invertPolarity.TabIndex = 42; + invertPolarity.TabIndex = 17; invertPolarity.Text = "Invert\r\nPolarity:"; // // toolStripLabelAdcCalibrationSN @@ -236,10 +208,10 @@ private void InitializeComponent() this.toolStripAdcCalSN, this.toolStripLabelGainCalibrationSn, this.toolStripGainCalSN}); - this.statusStrip1.Location = new System.Drawing.Point(0, 771); + this.statusStrip1.Location = new System.Drawing.Point(0, 736); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 13, 0); - this.statusStrip1.Size = new System.Drawing.Size(1320, 25); + this.statusStrip1.Size = new System.Drawing.Size(1234, 25); this.statusStrip1.TabIndex = 35; this.statusStrip1.Text = "statusStrip1"; // @@ -265,7 +237,7 @@ private void InitializeComponent() this.menuStrip.Location = new System.Drawing.Point(0, 0); this.menuStrip.Name = "menuStrip"; this.menuStrip.Padding = new System.Windows.Forms.Padding(5, 1, 0, 1); - this.menuStrip.Size = new System.Drawing.Size(1320, 24); + this.menuStrip.Size = new System.Drawing.Size(1234, 24); this.menuStrip.TabIndex = 36; this.menuStrip.Text = "menuStrip1"; // @@ -277,12 +249,14 @@ private void InitializeComponent() // // tableLayoutPanel1 // - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 75F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + 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.panelProbe, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.panelOptions, 1, 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.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); @@ -290,44 +264,29 @@ private void InitializeComponent() 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.Size = new System.Drawing.Size(1320, 747); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1234, 712); this.tableLayoutPanel1.TabIndex = 0; // - // panelProbe - // - this.panelProbe.BackColor = System.Drawing.SystemColors.Control; - this.panelProbe.Controls.Add(this.panelTrackBar); - 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(982, 697); - this.panelProbe.TabIndex = 0; - // // panelTrackBar // - this.panelTrackBar.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.panelTrackBar.Controls.Add(label1); - this.panelTrackBar.Controls.Add(label3); this.panelTrackBar.Controls.Add(this.trackBarProbePosition); - this.panelTrackBar.Location = new System.Drawing.Point(917, 5); + 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(61, 686); + this.panelTrackBar.Size = new System.Drawing.Size(47, 662); this.panelTrackBar.TabIndex = 33; // // trackBarProbePosition // - this.trackBarProbePosition.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.trackBarProbePosition.AutoSize = false; this.trackBarProbePosition.BackColor = System.Drawing.SystemColors.Control; - this.trackBarProbePosition.Location = new System.Drawing.Point(4, 9); + 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(45, 670); + this.trackBarProbePosition.Size = new System.Drawing.Size(47, 662); this.trackBarProbePosition.TabIndex = 30; this.trackBarProbePosition.TabStop = false; this.trackBarProbePosition.TickFrequency = 2; @@ -335,6 +294,51 @@ private void InitializeComponent() this.trackBarProbePosition.Value = 50; this.trackBarProbePosition.Scroll += new System.EventHandler(this.TrackBarScroll); // + // 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.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(1228, 38); + this.flowLayoutPanel1.TabIndex = 0; + // + // buttonCancel + // + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.Location = new System.Drawing.Point(1114, 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.DialogResult = System.Windows.Forms.DialogResult.OK; + this.buttonOkay.Location = new System.Drawing.Point(997, 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; + // // panelOptions // this.panelOptions.BackColor = System.Drawing.SystemColors.ControlLightLight; @@ -351,7 +355,6 @@ private void InitializeComponent() this.panelOptions.Controls.Add(this.buttonClearSelections); this.panelOptions.Controls.Add(this.comboBoxChannelPresets); this.panelOptions.Controls.Add(labelPresets); - this.panelOptions.Controls.Add(this.buttonResetZoom); this.panelOptions.Controls.Add(this.checkBoxSpikeFilter); this.panelOptions.Controls.Add(this.textBoxAdcCalibrationFile); this.panelOptions.Controls.Add(adcCalibrationFile); @@ -365,10 +368,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(993, 2); + this.panelOptions.Location = new System.Drawing.Point(922, 2); this.panelOptions.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panelOptions.Name = "panelOptions"; - this.panelOptions.Size = new System.Drawing.Size(324, 701); + this.panelOptions.Size = new System.Drawing.Size(309, 666); this.panelOptions.TabIndex = 2; // // checkBoxInvertPolarity @@ -378,7 +381,7 @@ private void InitializeComponent() this.checkBoxInvertPolarity.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.checkBoxInvertPolarity.Name = "checkBoxInvertPolarity"; this.checkBoxInvertPolarity.Size = new System.Drawing.Size(77, 20); - this.checkBoxInvertPolarity.TabIndex = 5; + this.checkBoxInvertPolarity.TabIndex = 18; this.checkBoxInvertPolarity.Text = "Enabled"; this.checkBoxInvertPolarity.UseVisualStyleBackColor = true; // @@ -390,8 +393,8 @@ 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(210, 22); - this.textBoxLfpCorrection.TabIndex = 41; + this.textBoxLfpCorrection.Size = new System.Drawing.Size(195, 22); + this.textBoxLfpCorrection.TabIndex = 14; this.textBoxLfpCorrection.TabStop = false; // // textBoxApCorrection @@ -402,8 +405,8 @@ 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(210, 22); - this.textBoxApCorrection.TabIndex = 39; + this.textBoxApCorrection.Size = new System.Drawing.Size(195, 22); + this.textBoxApCorrection.TabIndex = 10; this.textBoxApCorrection.TabStop = false; // // buttonViewAdcs @@ -414,8 +417,8 @@ private void InitializeComponent() this.buttonViewAdcs.Location = new System.Drawing.Point(13, 66); this.buttonViewAdcs.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonViewAdcs.Name = "buttonViewAdcs"; - this.buttonViewAdcs.Size = new System.Drawing.Size(299, 38); - this.buttonViewAdcs.TabIndex = 37; + this.buttonViewAdcs.Size = new System.Drawing.Size(284, 38); + this.buttonViewAdcs.TabIndex = 3; this.buttonViewAdcs.Text = "View ADC Correction Values"; this.buttonViewAdcs.UseVisualStyleBackColor = true; this.buttonViewAdcs.Click += new System.EventHandler(this.ViewAdcs_Click); @@ -423,11 +426,11 @@ 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(275, 30); + this.buttonChooseAdcCalibrationFile.Location = new System.Drawing.Point(260, 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); - this.buttonChooseAdcCalibrationFile.TabIndex = 0; + this.buttonChooseAdcCalibrationFile.TabIndex = 2; this.buttonChooseAdcCalibrationFile.Text = "..."; this.buttonChooseAdcCalibrationFile.UseVisualStyleBackColor = true; this.buttonChooseAdcCalibrationFile.Click += new System.EventHandler(this.ChooseAdcCalibrationFile_Click); @@ -435,11 +438,11 @@ 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(275, 133); + this.buttonChooseGainCalibrationFile.Location = new System.Drawing.Point(260, 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); - this.buttonChooseGainCalibrationFile.TabIndex = 1; + this.buttonChooseGainCalibrationFile.TabIndex = 6; this.buttonChooseGainCalibrationFile.Text = "..."; this.buttonChooseGainCalibrationFile.UseVisualStyleBackColor = true; this.buttonChooseGainCalibrationFile.Click += new System.EventHandler(this.ChooseGainCalibrationFile_Click); @@ -451,8 +454,8 @@ 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(299, 44); - this.buttonEnableContacts.TabIndex = 8; + this.buttonEnableContacts.Size = new System.Drawing.Size(283, 44); + this.buttonEnableContacts.TabIndex = 23; this.buttonEnableContacts.Text = "Enable Selected Electrodes"; this.buttonEnableContacts.UseVisualStyleBackColor = true; this.buttonEnableContacts.Click += new System.EventHandler(this.EnableContacts_Click); @@ -464,8 +467,8 @@ 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(299, 44); - this.buttonClearSelections.TabIndex = 9; + this.buttonClearSelections.Size = new System.Drawing.Size(283, 44); + this.buttonClearSelections.TabIndex = 24; this.buttonClearSelections.Text = "Clear Electrode Selection"; this.buttonClearSelections.UseVisualStyleBackColor = true; this.buttonClearSelections.Click += new System.EventHandler(this.ClearSelection_Click); @@ -479,21 +482,8 @@ 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(210, 24); - this.comboBoxChannelPresets.TabIndex = 7; - // - // buttonResetZoom - // - this.buttonResetZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.buttonResetZoom.Location = new System.Drawing.Point(13, 562); - this.buttonResetZoom.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.buttonResetZoom.Name = "buttonResetZoom"; - this.buttonResetZoom.Size = new System.Drawing.Size(299, 44); - this.buttonResetZoom.TabIndex = 10; - this.buttonResetZoom.Text = "Reset Zoom"; - this.buttonResetZoom.UseVisualStyleBackColor = true; - this.buttonResetZoom.Click += new System.EventHandler(this.ResetZoom_Click); + this.comboBoxChannelPresets.Size = new System.Drawing.Size(195, 24); + this.comboBoxChannelPresets.TabIndex = 22; // // checkBoxSpikeFilter // @@ -502,7 +492,7 @@ private void InitializeComponent() this.checkBoxSpikeFilter.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.checkBoxSpikeFilter.Name = "checkBoxSpikeFilter"; this.checkBoxSpikeFilter.Size = new System.Drawing.Size(77, 20); - this.checkBoxSpikeFilter.TabIndex = 4; + this.checkBoxSpikeFilter.TabIndex = 16; this.checkBoxSpikeFilter.Text = "Enabled"; this.checkBoxSpikeFilter.UseVisualStyleBackColor = true; // @@ -514,8 +504,8 @@ private void InitializeComponent() this.textBoxAdcCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxAdcCalibrationFile.Name = "textBoxAdcCalibrationFile"; this.textBoxAdcCalibrationFile.ReadOnly = true; - this.textBoxAdcCalibrationFile.Size = new System.Drawing.Size(255, 22); - this.textBoxAdcCalibrationFile.TabIndex = 12; + this.textBoxAdcCalibrationFile.Size = new System.Drawing.Size(241, 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); @@ -528,8 +518,8 @@ private void InitializeComponent() this.textBoxGainCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxGainCalibrationFile.Name = "textBoxGainCalibrationFile"; this.textBoxGainCalibrationFile.ReadOnly = true; - this.textBoxGainCalibrationFile.Size = new System.Drawing.Size(255, 22); - this.textBoxGainCalibrationFile.TabIndex = 9; + this.textBoxGainCalibrationFile.Size = new System.Drawing.Size(241, 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); @@ -543,8 +533,8 @@ 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(210, 24); - this.comboBoxReference.TabIndex = 6; + this.comboBoxReference.Size = new System.Drawing.Size(195, 24); + this.comboBoxReference.TabIndex = 20; // // comboBoxLfpGain // @@ -555,8 +545,8 @@ 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(210, 24); - this.comboBoxLfpGain.TabIndex = 3; + this.comboBoxLfpGain.Size = new System.Drawing.Size(195, 24); + this.comboBoxLfpGain.TabIndex = 12; // // comboBoxApGain // @@ -567,49 +557,14 @@ private void InitializeComponent() this.comboBoxApGain.Location = new System.Drawing.Point(101, 174); this.comboBoxApGain.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxApGain.Name = "comboBoxApGain"; - this.comboBoxApGain.Size = new System.Drawing.Size(210, 24); - this.comboBoxApGain.TabIndex = 2; - // - // flowLayoutPanel1 - // - this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutPanel1, 2); - 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, 707); - this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(1314, 38); - this.flowLayoutPanel1.TabIndex = 0; - // - // buttonCancel - // - this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(1200, 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.DialogResult = System.Windows.Forms.DialogResult.OK; - this.buttonOkay.Location = new System.Drawing.Point(1083, 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; + this.comboBoxApGain.Size = new System.Drawing.Size(196, 24); + this.comboBoxApGain.TabIndex = 8; // // NeuropixelsV1ProbeConfigurationDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1320, 796); + this.ClientSize = new System.Drawing.Size(1234, 761); this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.menuStrip); this.Controls.Add(this.statusStrip1); @@ -623,13 +578,11 @@ private void InitializeComponent() this.menuStrip.ResumeLayout(false); this.menuStrip.PerformLayout(); this.tableLayoutPanel1.ResumeLayout(false); - this.panelProbe.ResumeLayout(false); this.panelTrackBar.ResumeLayout(false); - this.panelTrackBar.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.trackBarProbePosition)).EndInit(); + this.flowLayoutPanel1.ResumeLayout(false); this.panelOptions.ResumeLayout(false); this.panelOptions.PerformLayout(); - this.flowLayoutPanel1.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -656,7 +609,6 @@ private void InitializeComponent() private System.Windows.Forms.Button buttonEnableContacts; private System.Windows.Forms.Button buttonClearSelections; private System.Windows.Forms.ComboBox comboBoxChannelPresets; - private System.Windows.Forms.Button buttonResetZoom; private System.Windows.Forms.CheckBox checkBoxSpikeFilter; internal System.Windows.Forms.TextBox textBoxAdcCalibrationFile; internal System.Windows.Forms.TextBox textBoxGainCalibrationFile; diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.cs index 2eb1e07f..4a329309 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.cs @@ -116,13 +116,6 @@ private void FormShown(object sender, EventArgs e) ChannelConfiguration.Show(); ChannelConfiguration.ConnectResizeEventHandler(); - ChannelConfiguration.OnResizeZedGraph += ResizeTrackBar; - } - - private void ResizeTrackBar(object sender, EventArgs e) - { - panelTrackBar.Height = ((ChannelConfigurationDialog)sender).zedGraphChannels.Size.Height; - panelTrackBar.Location = new Point(panelProbe.Size.Width - panelTrackBar.Width, ChannelConfiguration.zedGraphChannels.Location.Y); } private void GainCalibrationFileTextChanged(object sender, EventArgs e) @@ -317,22 +310,22 @@ private void CheckStatus() panelProbe.Visible = adcCalibration.HasValue && gainCorrection.HasValue; - if (toolStripAdcCalSN.Text == NoFileSelected) + if (toolStripAdcCalSN.Text == NoFileSelected) toolStripLabelAdcCalibrationSN.Image = Properties.Resources.StatusWarningImage; - else if (toolStripAdcCalSN.Text == InvalidFile) + else if (toolStripAdcCalSN.Text == InvalidFile) toolStripLabelAdcCalibrationSN.Image = Properties.Resources.StatusCriticalImage; else if (toolStripGainCalSN.Text != NoFileSelected && toolStripGainCalSN.Text != InvalidFile && toolStripAdcCalSN.Text != toolStripGainCalSN.Text) toolStripLabelAdcCalibrationSN.Image = Properties.Resources.StatusBlockedImage; - else + else toolStripLabelAdcCalibrationSN.Image = Properties.Resources.StatusReadyImage; - if (toolStripGainCalSN.Text == NoFileSelected) + if (toolStripGainCalSN.Text == NoFileSelected) toolStripLabelGainCalibrationSn.Image = Properties.Resources.StatusWarningImage; - else if (toolStripGainCalSN.Text == InvalidFile) + else if (toolStripGainCalSN.Text == InvalidFile) toolStripLabelGainCalibrationSn.Image = Properties.Resources.StatusCriticalImage; else if (toolStripAdcCalSN.Text != NoFileSelected && toolStripAdcCalSN.Text != InvalidFile && toolStripAdcCalSN.Text != toolStripGainCalSN.Text) toolStripLabelGainCalibrationSn.Image = Properties.Resources.StatusBlockedImage; - else + else toolStripLabelGainCalibrationSn.Image = Properties.Resources.StatusReadyImage; } @@ -377,11 +370,6 @@ private void ChooseAdcCalibrationFile_Click(object sender, EventArgs e) CheckStatus(); } - private void ResetZoom_Click(object sender, EventArgs e) - { - ResetZoom(); - } - private void ClearSelection_Click(object sender, EventArgs e) { DeselectContacts(); @@ -451,13 +439,6 @@ private void DeselectContacts() ChannelConfiguration.RefreshZedGraph(); } - private void ResetZoom() - { - ChannelConfiguration.ResetZoom(); - ChannelConfiguration.RefreshZedGraph(); - ChannelConfiguration.DrawScale(); - } - private void MoveToVerticalPosition(float relativePosition) { ChannelConfiguration.MoveToVerticalPosition(relativePosition); diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.resx b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.resx index 9282f66e..7a974dc9 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.resx +++ b/OpenEphys.Onix1.Design/NeuropixelsV1ProbeConfigurationDialog.resx @@ -117,12 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - False - - - False - False diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageDialog.Designer.cs b/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageDialog.Designer.cs index e3d98c7e..e3e816e0 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1eHeadstageDialog.Designer.cs @@ -57,7 +57,7 @@ private void InitializeComponent() this.tabControl1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(1350, 732); + this.tabControl1.Size = new System.Drawing.Size(1328, 741); this.tabControl1.TabIndex = 0; // // tabPageNeuropixelsV1e @@ -67,7 +67,7 @@ private void InitializeComponent() this.tabPageNeuropixelsV1e.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tabPageNeuropixelsV1e.Name = "tabPageNeuropixelsV1e"; this.tabPageNeuropixelsV1e.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.tabPageNeuropixelsV1e.Size = new System.Drawing.Size(1342, 703); + this.tabPageNeuropixelsV1e.Size = new System.Drawing.Size(1320, 712); this.tabPageNeuropixelsV1e.TabIndex = 0; this.tabPageNeuropixelsV1e.Text = "NeuropixelsV1e"; this.tabPageNeuropixelsV1e.UseVisualStyleBackColor = true; @@ -79,7 +79,7 @@ private void InitializeComponent() this.panelNeuropixelsV1e.Location = new System.Drawing.Point(3, 2); this.panelNeuropixelsV1e.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panelNeuropixelsV1e.Name = "panelNeuropixelsV1e"; - this.panelNeuropixelsV1e.Size = new System.Drawing.Size(1336, 699); + this.panelNeuropixelsV1e.Size = new System.Drawing.Size(1314, 708); this.panelNeuropixelsV1e.TabIndex = 0; // // tabPageBno055 @@ -106,7 +106,7 @@ private void InitializeComponent() // buttonCancel // this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(1238, 2); + this.buttonCancel.Location = new System.Drawing.Point(1216, 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); @@ -117,7 +117,7 @@ private void InitializeComponent() // buttonOK // this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonOK.Location = new System.Drawing.Point(1121, 2); + this.buttonOK.Location = new System.Drawing.Point(1099, 2); this.buttonOK.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(111, 34); @@ -134,14 +134,14 @@ private void InitializeComponent() this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Padding = new System.Windows.Forms.Padding(5, 1, 0, 1); - this.menuStrip1.Size = new System.Drawing.Size(1356, 26); + this.menuStrip1.Size = new System.Drawing.Size(1334, 24); this.menuStrip1.TabIndex = 2; this.menuStrip1.Text = "menuStrip1"; // // fileToolStripMenuItem // this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(46, 24); + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 22); this.fileToolStripMenuItem.Text = "File"; // // tableLayoutPanel1 @@ -151,13 +151,13 @@ private void InitializeComponent() this.tableLayoutPanel1.Controls.Add(this.tabControl1, 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, 26); + 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.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.Size = new System.Drawing.Size(1356, 778); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1334, 787); this.tableLayoutPanel1.TabIndex = 3; // // flowLayoutPanel1 @@ -166,17 +166,17 @@ private void InitializeComponent() 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(2, 738); + this.flowLayoutPanel1.Location = new System.Drawing.Point(2, 747); this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(1352, 38); + this.flowLayoutPanel1.Size = new System.Drawing.Size(1330, 38); this.flowLayoutPanel1.TabIndex = 0; // // NeuropixelsV1eHeadstageDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1356, 804); + this.ClientSize = new System.Drawing.Size(1334, 811); this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.menuStrip1); this.DoubleBuffered = true; diff --git a/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.Designer.cs b/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.Designer.cs index e6bece73..50738f3a 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV1fHeadstageDialog.Designer.cs @@ -32,6 +32,8 @@ private void InitializeComponent() this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPageNeuropixelsV1A = new System.Windows.Forms.TabPage(); this.panelNeuropixelsV1A = new System.Windows.Forms.Panel(); + this.tabPageNeuropixelsV1B = new System.Windows.Forms.TabPage(); + this.panelNeuropixelsV1B = new System.Windows.Forms.Panel(); this.tabPageBno055 = new System.Windows.Forms.TabPage(); this.panelBno055 = new System.Windows.Forms.Panel(); this.buttonCancel = new System.Windows.Forms.Button(); @@ -40,15 +42,13 @@ private void InitializeComponent() this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.tabPageNeuropixelsV1B = new System.Windows.Forms.TabPage(); - this.panelNeuropixelsV1B = new System.Windows.Forms.Panel(); this.tabControl1.SuspendLayout(); this.tabPageNeuropixelsV1A.SuspendLayout(); + this.tabPageNeuropixelsV1B.SuspendLayout(); this.tabPageBno055.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); - this.tabPageNeuropixelsV1B.SuspendLayout(); this.SuspendLayout(); // // tabControl1 @@ -61,7 +61,7 @@ private void InitializeComponent() this.tabControl1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(1350, 732); + this.tabControl1.Size = new System.Drawing.Size(1328, 741); this.tabControl1.TabIndex = 0; // // tabPageNeuropixelsV1A @@ -69,7 +69,7 @@ private void InitializeComponent() this.tabPageNeuropixelsV1A.Controls.Add(this.panelNeuropixelsV1A); this.tabPageNeuropixelsV1A.Location = new System.Drawing.Point(4, 25); this.tabPageNeuropixelsV1A.Name = "tabPageNeuropixelsV1A"; - this.tabPageNeuropixelsV1A.Size = new System.Drawing.Size(1342, 703); + this.tabPageNeuropixelsV1A.Size = new System.Drawing.Size(1320, 712); this.tabPageNeuropixelsV1A.TabIndex = 0; this.tabPageNeuropixelsV1A.Text = "NeuropixelsV1A"; this.tabPageNeuropixelsV1A.UseVisualStyleBackColor = true; @@ -80,9 +80,29 @@ private void InitializeComponent() this.panelNeuropixelsV1A.Location = new System.Drawing.Point(0, 0); this.panelNeuropixelsV1A.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panelNeuropixelsV1A.Name = "panelNeuropixelsV1A"; - this.panelNeuropixelsV1A.Size = new System.Drawing.Size(1342, 703); + this.panelNeuropixelsV1A.Size = new System.Drawing.Size(1320, 712); this.panelNeuropixelsV1A.TabIndex = 0; // + // tabPageNeuropixelsV1B + // + this.tabPageNeuropixelsV1B.Controls.Add(this.panelNeuropixelsV1B); + this.tabPageNeuropixelsV1B.Location = new System.Drawing.Point(4, 25); + this.tabPageNeuropixelsV1B.Name = "tabPageNeuropixelsV1B"; + this.tabPageNeuropixelsV1B.Size = new System.Drawing.Size(1342, 703); + this.tabPageNeuropixelsV1B.TabIndex = 2; + this.tabPageNeuropixelsV1B.Text = "NeuropixelsV1B"; + this.tabPageNeuropixelsV1B.UseVisualStyleBackColor = true; + // + // panelNeuropixelsV1B + // + this.panelNeuropixelsV1B.AutoSize = true; + this.panelNeuropixelsV1B.Dock = System.Windows.Forms.DockStyle.Fill; + this.panelNeuropixelsV1B.Location = new System.Drawing.Point(0, 0); + this.panelNeuropixelsV1B.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.panelNeuropixelsV1B.Name = "panelNeuropixelsV1B"; + this.panelNeuropixelsV1B.Size = new System.Drawing.Size(1342, 703); + this.panelNeuropixelsV1B.TabIndex = 1; + // // tabPageBno055 // this.tabPageBno055.Controls.Add(this.panelBno055); @@ -107,7 +127,7 @@ private void InitializeComponent() // buttonCancel // this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(1238, 2); + this.buttonCancel.Location = new System.Drawing.Point(1216, 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); @@ -118,7 +138,7 @@ private void InitializeComponent() // buttonOK // this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonOK.Location = new System.Drawing.Point(1121, 2); + this.buttonOK.Location = new System.Drawing.Point(1099, 2); this.buttonOK.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(111, 34); @@ -135,14 +155,14 @@ private void InitializeComponent() this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Padding = new System.Windows.Forms.Padding(5, 1, 0, 1); - this.menuStrip1.Size = new System.Drawing.Size(1356, 26); + this.menuStrip1.Size = new System.Drawing.Size(1334, 24); this.menuStrip1.TabIndex = 2; this.menuStrip1.Text = "menuStrip1"; // // fileToolStripMenuItem // this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(46, 24); + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 22); this.fileToolStripMenuItem.Text = "File"; // // tableLayoutPanel1 @@ -152,13 +172,13 @@ private void InitializeComponent() this.tableLayoutPanel1.Controls.Add(this.tabControl1, 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, 26); + 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.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.Size = new System.Drawing.Size(1356, 778); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1334, 787); this.tableLayoutPanel1.TabIndex = 3; // // flowLayoutPanel1 @@ -167,37 +187,17 @@ private void InitializeComponent() 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(2, 738); + this.flowLayoutPanel1.Location = new System.Drawing.Point(2, 747); this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(1352, 38); + this.flowLayoutPanel1.Size = new System.Drawing.Size(1330, 38); this.flowLayoutPanel1.TabIndex = 0; // - // tabPageNeuropixelsV1B - // - this.tabPageNeuropixelsV1B.Controls.Add(this.panelNeuropixelsV1B); - this.tabPageNeuropixelsV1B.Location = new System.Drawing.Point(4, 25); - this.tabPageNeuropixelsV1B.Name = "tabPageNeuropixelsV1B"; - this.tabPageNeuropixelsV1B.Size = new System.Drawing.Size(1342, 703); - this.tabPageNeuropixelsV1B.TabIndex = 2; - this.tabPageNeuropixelsV1B.Text = "NeuropixelsV1B"; - this.tabPageNeuropixelsV1B.UseVisualStyleBackColor = true; - // - // panelNeuropixelsV1B - // - this.panelNeuropixelsV1B.AutoSize = true; - this.panelNeuropixelsV1B.Dock = System.Windows.Forms.DockStyle.Fill; - this.panelNeuropixelsV1B.Location = new System.Drawing.Point(0, 0); - this.panelNeuropixelsV1B.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.panelNeuropixelsV1B.Name = "panelNeuropixelsV1B"; - this.panelNeuropixelsV1B.Size = new System.Drawing.Size(1342, 703); - this.panelNeuropixelsV1B.TabIndex = 1; - // // NeuropixelsV1fHeadstageDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1356, 804); + this.ClientSize = new System.Drawing.Size(1334, 811); this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.menuStrip1); this.DoubleBuffered = true; @@ -209,13 +209,13 @@ private void InitializeComponent() this.Text = "NeuropixelsV1f Headstage Configuration"; this.tabControl1.ResumeLayout(false); this.tabPageNeuropixelsV1A.ResumeLayout(false); + this.tabPageNeuropixelsV1B.ResumeLayout(false); + this.tabPageNeuropixelsV1B.PerformLayout(); this.tabPageBno055.ResumeLayout(false); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.tableLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.ResumeLayout(false); - this.tabPageNeuropixelsV1B.ResumeLayout(false); - this.tabPageNeuropixelsV1B.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eChannelConfigurationDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eChannelConfigurationDialog.cs index b9fdceaa..32d2cd81 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eChannelConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eChannelConfigurationDialog.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Drawing; using System.Linq; using System.Windows.Forms; using OpenEphys.ProbeInterface.NET; @@ -36,11 +34,9 @@ public NeuropixelsV2eChannelConfigurationDialog(NeuropixelsV2QuadShankProbeConfi ProbeConfiguration = probeConfiguration; - ZoomInBoundaryX = 600; - ZoomInBoundaryY = 600; - HighlightEnabledContacts(); UpdateContactLabels(); + DrawScale(); RefreshZedGraph(); } @@ -81,7 +77,6 @@ internal override void ZoomEvent(ZedGraphControl sender, ZoomState oldState, Zoo base.ZoomEvent(sender, oldState, newState); UpdateFontSize(); - DrawScale(); RefreshZedGraph(); OnZoomHandler(); @@ -92,91 +87,21 @@ private void OnZoomHandler() OnZoom?.Invoke(this, EventArgs.Empty); } + internal override bool IsDrawScale() => true; + internal override void DrawScale() { - if (ProbeConfiguration == null) + if (ProbeConfiguration == null || zedGraphChannels.MasterPane.PaneList.Count < 2) return; - const string ScalePointsTag = "scale_points"; - const string ScaleTextTag = "scale_text"; - - zedGraphChannels.GraphPane.GraphObjList.RemoveAll(obj => obj is TextObj && obj.Tag is string tag && tag == ScaleTextTag); - zedGraphChannels.GraphPane.CurveList.RemoveAll(curve => curve.Tag is string tag && tag == ScalePointsTag); - - const int MajorTickIncrement = 100; - const int MajorTickLength = 10; - const int MinorTickIncrement = 10; - const int MinorTickLength = 5; - - if (ProbeConfiguration.ProbeGroup.Probes.ElementAt(0).SiUnits != ProbeSiUnits.um) - { - MessageBox.Show("Warning: Expected ProbeGroup units to be in microns, but it is in millimeters. Scale might not be accurate."); - } - - var fontSize = CalculateFontSize(); - - var zoomedOut = fontSize <= 2; - - fontSize = zoomedOut ? 8 : fontSize * 4; - var majorTickOffset = MajorTickLength + CalculateScaleRange(zedGraphChannels.GraphPane.XAxis.Scale) * 0.015; - majorTickOffset = majorTickOffset > 50 ? 50 : majorTickOffset; - - var x = GetProbeRight(zedGraphChannels.GraphPane.GraphObjList) + 50; - var minY = GetProbeBottom(zedGraphChannels.GraphPane.GraphObjList); - var maxY = GetProbeTop(zedGraphChannels.GraphPane.GraphObjList); - - int textPosition = 0; - - PointPairList pointList = new(); - - var countMajorTicks = 0; - - for (int i = (int)minY; i < maxY; i += MajorTickIncrement) - { - PointPair majorTickLocation = new(x + majorTickOffset, minY + MajorTickIncrement * countMajorTicks); - - pointList.Add(new PointPair(x, minY + MajorTickIncrement * countMajorTicks)); - pointList.Add(majorTickLocation); - pointList.Add(new PointPair(x, minY + MajorTickIncrement * countMajorTicks)); - - if (!zoomedOut || countMajorTicks % 5 == 0) - { - TextObj textObj = new($"{textPosition} µm\n", majorTickLocation.X + 5, majorTickLocation.Y, CoordType.AxisXYScale, AlignH.Left, AlignV.Center) - { - Tag = ScaleTextTag, - }; - textObj.FontSpec.Border.IsVisible = false; - textObj.FontSpec.Size = fontSize; - zedGraphChannels.GraphPane.GraphObjList.Add(textObj); - - textPosition += zoomedOut ? 5 * MajorTickIncrement : MajorTickIncrement; - } - - if (!zoomedOut) - { - var countMinorTicks = 1; - - for (int j = i + MinorTickIncrement; j < i + MajorTickIncrement && i + MinorTickIncrement * countMinorTicks < maxY; j += MinorTickIncrement) - { - pointList.Add(new PointPair(x, minY + MajorTickIncrement * countMajorTicks + MinorTickIncrement * countMinorTicks)); - pointList.Add(new PointPair(x + MinorTickLength, minY + MajorTickIncrement * countMajorTicks + MinorTickIncrement * countMinorTicks)); - pointList.Add(new PointPair(x, minY + MajorTickIncrement * countMajorTicks + MinorTickIncrement * countMinorTicks)); - - countMinorTicks++; - } - } - - countMajorTicks++; - } - - var curve = zedGraphChannels.GraphPane.AddCurve("", pointList, Color.Black, SymbolType.None); + var pane = zedGraphChannels.MasterPane.PaneList[1]; - const float scaleBarWidth = 1; + pane.YAxis.Scale.Min = GetProbeBottom(zedGraphChannels.GraphPane.GraphObjList); + pane.YAxis.Scale.Max = GetProbeTop(zedGraphChannels.GraphPane.GraphObjList); - curve.Line.Width = scaleBarWidth; - curve.Label.IsVisible = false; - curve.Symbol.IsVisible = false; - curve.Tag = ScalePointsTag; + pane.YAxis.Scale.Format = "#####0' " + ProbeGroup.Probes.First().SiUnits.ToString() + "'"; + pane.YAxis.Scale.Mag = 0; + pane.YAxis.Scale.MagAuto = false; } internal override void HighlightEnabledContacts() diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageDialog.Designer.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageDialog.Designer.cs index a51eaa00..fe5cf85b 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eHeadstageDialog.Designer.cs @@ -52,7 +52,7 @@ private void InitializeComponent() // this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(996, 2); + this.buttonCancel.Location = new System.Drawing.Point(1179, 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); @@ -63,7 +63,7 @@ private void InitializeComponent() // buttonOkay // this.buttonOkay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonOkay.Location = new System.Drawing.Point(846, 2); + this.buttonOkay.Location = new System.Drawing.Point(1029, 2); this.buttonOkay.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonOkay.Name = "buttonOkay"; this.buttonOkay.Size = new System.Drawing.Size(144, 32); @@ -80,7 +80,7 @@ private void InitializeComponent() this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Padding = new System.Windows.Forms.Padding(5, 1, 0, 1); - this.menuStrip1.Size = new System.Drawing.Size(1151, 24); + this.menuStrip1.Size = new System.Drawing.Size(1334, 24); this.menuStrip1.TabIndex = 2; this.menuStrip1.Text = "menuStrip1"; // @@ -103,7 +103,7 @@ private void InitializeComponent() 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.Size = new System.Drawing.Size(1151, 625); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1334, 787); this.tableLayoutPanel1.TabIndex = 3; // // tabControl1 @@ -115,7 +115,7 @@ private void InitializeComponent() this.tabControl1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(1145, 579); + this.tabControl1.Size = new System.Drawing.Size(1328, 741); this.tabControl1.TabIndex = 0; this.tabControl1.TabStop = false; // @@ -126,7 +126,7 @@ private void InitializeComponent() this.tabPageNeuropixelsV2e.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tabPageNeuropixelsV2e.Name = "tabPageNeuropixelsV2e"; this.tabPageNeuropixelsV2e.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.tabPageNeuropixelsV2e.Size = new System.Drawing.Size(1137, 550); + this.tabPageNeuropixelsV2e.Size = new System.Drawing.Size(1320, 712); this.tabPageNeuropixelsV2e.TabIndex = 0; this.tabPageNeuropixelsV2e.Text = "NeuropixelsV2e"; this.tabPageNeuropixelsV2e.UseVisualStyleBackColor = true; @@ -137,7 +137,7 @@ private void InitializeComponent() this.panelNeuropixelsV2e.Location = new System.Drawing.Point(3, 2); this.panelNeuropixelsV2e.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panelNeuropixelsV2e.Name = "panelNeuropixelsV2e"; - this.panelNeuropixelsV2e.Size = new System.Drawing.Size(1131, 546); + this.panelNeuropixelsV2e.Size = new System.Drawing.Size(1314, 708); this.panelNeuropixelsV2e.TabIndex = 0; // // tabPageBno055 @@ -170,17 +170,17 @@ private void InitializeComponent() 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, 587); + this.flowLayoutPanel1.Location = new System.Drawing.Point(4, 749); this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(1143, 34); + this.flowLayoutPanel1.Size = new System.Drawing.Size(1326, 34); this.flowLayoutPanel1.TabIndex = 1; // // NeuropixelsV2eHeadstageDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1151, 649); + this.ClientSize = new System.Drawing.Size(1334, 811); this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.menuStrip1); this.DoubleBuffered = true; diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.Designer.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.Designer.cs index d5856629..f1e2c72a 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.Designer.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.Designer.cs @@ -29,8 +29,6 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.Label label6; - System.Windows.Forms.Label label7; System.Windows.Forms.Label probeCalibrationFile; System.Windows.Forms.Label Reference; System.Windows.Forms.Label labelPresets; @@ -43,7 +41,6 @@ private void InitializeComponent() this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.buttonEnableContacts = new System.Windows.Forms.Button(); this.buttonClearSelections = new System.Windows.Forms.Button(); - this.buttonResetZoom = 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(); @@ -60,15 +57,12 @@ private void InitializeComponent() this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripGainCalSN = new System.Windows.Forms.ToolStripStatusLabel(); - label6 = new System.Windows.Forms.Label(); - label7 = 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.panelProbe.SuspendLayout(); this.panelTrackBar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.trackBarProbePosition)).BeginInit(); this.panelChannelOptions.SuspendLayout(); @@ -77,27 +71,6 @@ private void InitializeComponent() this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // - // label6 - // - label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - label6.AutoSize = true; - label6.Location = new System.Drawing.Point(0, 542); - label6.Name = "label6"; - label6.Size = new System.Drawing.Size(39, 16); - label6.TabIndex = 28; - label6.Text = "0 mm"; - // - // label7 - // - label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - label7.AutoSize = true; - label7.Location = new System.Drawing.Point(0, 0); - label7.Name = "label7"; - label7.Size = new System.Drawing.Size(46, 16); - label7.TabIndex = 29; - label7.Text = "10 mm"; - label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // // probeCalibrationFile // probeCalibrationFile.AutoSize = true; @@ -105,7 +78,7 @@ private void InitializeComponent() probeCalibrationFile.MaximumSize = new System.Drawing.Size(177, 36); probeCalibrationFile.Name = "probeCalibrationFile"; probeCalibrationFile.Size = new System.Drawing.Size(139, 16); - probeCalibrationFile.TabIndex = 32; + probeCalibrationFile.TabIndex = 0; probeCalibrationFile.Text = "Probe Calibration File:"; // // Reference @@ -114,7 +87,7 @@ private void InitializeComponent() Reference.Location = new System.Drawing.Point(15, 114); Reference.Name = "Reference"; Reference.Size = new System.Drawing.Size(73, 16); - Reference.TabIndex = 30; + Reference.TabIndex = 5; Reference.Text = "Reference:"; // // labelPresets @@ -123,7 +96,7 @@ private void InitializeComponent() labelPresets.Location = new System.Drawing.Point(15, 146); labelPresets.Name = "labelPresets"; labelPresets.Size = new System.Drawing.Size(59, 32); - labelPresets.TabIndex = 23; + labelPresets.TabIndex = 7; labelPresets.Text = "Channel \nPresets:"; // // label1 @@ -132,7 +105,7 @@ private void InitializeComponent() label1.Location = new System.Drawing.Point(15, 63); label1.Name = "label1"; label1.Size = new System.Drawing.Size(71, 32); - label1.TabIndex = 35; + label1.TabIndex = 3; label1.Text = "Gain\r\nCorrection:"; // // invertPolarity @@ -141,7 +114,7 @@ private void InitializeComponent() invertPolarity.Location = new System.Drawing.Point(15, 187); invertPolarity.Name = "invertPolarity"; invertPolarity.Size = new System.Drawing.Size(55, 32); - invertPolarity.TabIndex = 44; + invertPolarity.TabIndex = 9; invertPolarity.Text = "Invert\r\nPolarity:"; // // toolStripLabelGainCalibrationSN @@ -161,7 +134,7 @@ private void InitializeComponent() this.menuStrip.Location = new System.Drawing.Point(0, 0); this.menuStrip.Name = "menuStrip"; this.menuStrip.Padding = new System.Windows.Forms.Padding(5, 1, 0, 1); - this.menuStrip.Size = new System.Drawing.Size(1112, 24); + this.menuStrip.Size = new System.Drawing.Size(1234, 24); this.menuStrip.TabIndex = 0; this.menuStrip.Text = "menuStripNeuropixelsV2e"; // @@ -175,11 +148,11 @@ private void InitializeComponent() // this.buttonEnableContacts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.buttonEnableContacts.Location = new System.Drawing.Point(15, 226); + 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(243, 44); - this.buttonEnableContacts.TabIndex = 4; + this.buttonEnableContacts.Size = new System.Drawing.Size(280, 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" + "ble the selected electrodes. \r\nNot all electrode combinations are possible."); @@ -190,39 +163,25 @@ private void InitializeComponent() // this.buttonClearSelections.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.buttonClearSelections.Location = new System.Drawing.Point(15, 276); + 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(243, 44); - this.buttonClearSelections.TabIndex = 5; + this.buttonClearSelections.Size = new System.Drawing.Size(280, 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" + "trodes, but simply deselects them."); this.buttonClearSelections.UseVisualStyleBackColor = true; this.buttonClearSelections.Click += new System.EventHandler(this.ClearSelection_Click); // - // buttonResetZoom - // - this.buttonResetZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.buttonResetZoom.Location = new System.Drawing.Point(15, 325); - this.buttonResetZoom.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.buttonResetZoom.Name = "buttonResetZoom"; - this.buttonResetZoom.Size = new System.Drawing.Size(243, 44); - this.buttonResetZoom.TabIndex = 6; - this.buttonResetZoom.Text = "Reset Zoom"; - this.toolTip.SetToolTip(this.buttonResetZoom, "Reset the zoom in the probe view so that the probe is zoomed out and centered."); - this.buttonResetZoom.UseVisualStyleBackColor = true; - this.buttonResetZoom.Click += new System.EventHandler(this.ResetZoom_Click); - // // 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(220, 30); + this.buttonChooseCalibrationFile.Location = new System.Drawing.Point(258, 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 = 0; + this.buttonChooseCalibrationFile.TabIndex = 2; this.buttonChooseCalibrationFile.Text = "..."; this.toolTip.SetToolTip(this.buttonChooseCalibrationFile, "Browse for a gain calibration file."); this.buttonChooseCalibrationFile.UseVisualStyleBackColor = true; @@ -231,37 +190,33 @@ private void InitializeComponent() // panelProbe // this.panelProbe.AutoSize = true; - this.panelProbe.Controls.Add(this.panelTrackBar); 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(828, 557); + this.panelProbe.Size = new System.Drawing.Size(858, 662); this.panelProbe.TabIndex = 1; // // panelTrackBar // - this.panelTrackBar.Anchor = System.Windows.Forms.AnchorStyles.None; - this.panelTrackBar.Controls.Add(label6); - this.panelTrackBar.Controls.Add(label7); this.panelTrackBar.Controls.Add(this.trackBarProbePosition); - this.panelTrackBar.Location = new System.Drawing.Point(775, 0); - this.panelTrackBar.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + 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(49, 559); + this.panelTrackBar.Size = new System.Drawing.Size(47, 658); this.panelTrackBar.TabIndex = 30; // // trackBarProbePosition // - this.trackBarProbePosition.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Right))); this.trackBarProbePosition.AutoSize = false; - this.trackBarProbePosition.Location = new System.Drawing.Point(-8, 11); + 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(49, 535); + this.trackBarProbePosition.Size = new System.Drawing.Size(47, 658); this.trackBarProbePosition.TabIndex = 22; this.trackBarProbePosition.TabStop = false; this.trackBarProbePosition.TickFrequency = 2; @@ -287,12 +242,11 @@ private void InitializeComponent() this.panelChannelOptions.Controls.Add(labelPresets); this.panelChannelOptions.Controls.Add(this.buttonEnableContacts); this.panelChannelOptions.Controls.Add(this.buttonClearSelections); - this.panelChannelOptions.Controls.Add(this.buttonResetZoom); this.panelChannelOptions.Dock = System.Windows.Forms.DockStyle.Fill; - this.panelChannelOptions.Location = new System.Drawing.Point(837, 2); + this.panelChannelOptions.Location = new System.Drawing.Point(922, 2); this.panelChannelOptions.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panelChannelOptions.Name = "panelChannelOptions"; - this.panelChannelOptions.Size = new System.Drawing.Size(272, 557); + this.panelChannelOptions.Size = new System.Drawing.Size(309, 662); this.panelChannelOptions.TabIndex = 1; // // checkBoxInvertPolarity @@ -302,7 +256,7 @@ private void InitializeComponent() this.checkBoxInvertPolarity.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.checkBoxInvertPolarity.Name = "checkBoxInvertPolarity"; this.checkBoxInvertPolarity.Size = new System.Drawing.Size(77, 20); - this.checkBoxInvertPolarity.TabIndex = 3; + this.checkBoxInvertPolarity.TabIndex = 10; this.checkBoxInvertPolarity.Text = "Enabled"; this.checkBoxInvertPolarity.UseVisualStyleBackColor = true; // @@ -314,8 +268,8 @@ 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(151, 22); - this.textBoxGainCorrection.TabIndex = 36; + this.textBoxGainCorrection.Size = new System.Drawing.Size(188, 22); + this.textBoxGainCorrection.TabIndex = 4; this.textBoxGainCorrection.TabStop = false; // // textBoxProbeCalibrationFile @@ -326,8 +280,8 @@ private void InitializeComponent() this.textBoxProbeCalibrationFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxProbeCalibrationFile.Name = "textBoxProbeCalibrationFile"; this.textBoxProbeCalibrationFile.ReadOnly = true; - this.textBoxProbeCalibrationFile.Size = new System.Drawing.Size(198, 22); - this.textBoxProbeCalibrationFile.TabIndex = 33; + this.textBoxProbeCalibrationFile.Size = new System.Drawing.Size(235, 22); + this.textBoxProbeCalibrationFile.TabIndex = 1; this.textBoxProbeCalibrationFile.TabStop = false; this.textBoxProbeCalibrationFile.TextChanged += new System.EventHandler(this.FileTextChanged); // @@ -340,8 +294,8 @@ 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(151, 24); - this.comboBoxReference.TabIndex = 1; + this.comboBoxReference.Size = new System.Drawing.Size(188, 24); + this.comboBoxReference.TabIndex = 6; // // comboBoxChannelPresets // @@ -352,15 +306,15 @@ 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(151, 24); - this.comboBoxChannelPresets.TabIndex = 2; + this.comboBoxChannelPresets.Size = new System.Drawing.Size(188, 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(990, 2); + 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); @@ -373,7 +327,7 @@ private void InitializeComponent() 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(873, 2); + 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); @@ -385,34 +339,35 @@ private void InitializeComponent() // this.tableLayoutPanel1.AutoSize = true; this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 75F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tableLayoutPanel1.Controls.Add(this.panelChannelOptions, 1, 0); + 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.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, 4, 4, 4); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); 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, 46F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1112, 607); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1234, 712); this.tableLayoutPanel1.TabIndex = 0; // // flowLayoutPanel1 // - this.tableLayoutPanel1.SetColumnSpan(this.flowLayoutPanel1, 2); + 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, 565); - this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + 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(1104, 38); + this.flowLayoutPanel1.Size = new System.Drawing.Size(1226, 38); this.flowLayoutPanel1.TabIndex = 2; // // statusStrip1 @@ -421,10 +376,10 @@ private void InitializeComponent() this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripLabelGainCalibrationSN, this.toolStripGainCalSN}); - this.statusStrip1.Location = new System.Drawing.Point(0, 631); + this.statusStrip1.Location = new System.Drawing.Point(0, 736); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 13, 0); - this.statusStrip1.Size = new System.Drawing.Size(1112, 25); + this.statusStrip1.Size = new System.Drawing.Size(1234, 25); this.statusStrip1.TabIndex = 3; this.statusStrip1.Text = "statusStrip1"; // @@ -439,7 +394,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(1112, 656); + this.ClientSize = new System.Drawing.Size(1234, 761); this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.menuStrip); @@ -452,9 +407,7 @@ private void InitializeComponent() this.Text = "NeuropixelsV2e Probe Configuration"; this.menuStrip.ResumeLayout(false); this.menuStrip.PerformLayout(); - this.panelProbe.ResumeLayout(false); this.panelTrackBar.ResumeLayout(false); - this.panelTrackBar.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.trackBarProbePosition)).EndInit(); this.panelChannelOptions.ResumeLayout(false); this.panelChannelOptions.PerformLayout(); @@ -485,7 +438,6 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox comboBoxChannelPresets; private System.Windows.Forms.Button buttonEnableContacts; private System.Windows.Forms.Button buttonClearSelections; - private System.Windows.Forms.Button buttonResetZoom; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.TextBox textBoxGainCorrection; diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.cs b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.cs index 8f497b44..045fff35 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.cs @@ -138,16 +138,6 @@ private void FormShown(object sender, EventArgs e) ChannelConfiguration.Show(); ChannelConfiguration.ConnectResizeEventHandler(); - ChannelConfiguration.OnResizeZedGraph += ResizeTrackBar; - } - - private void ResizeTrackBar(object sender, EventArgs e) - { - if (sender is ChannelConfigurationDialog dialog) - { - panelTrackBar.Height = dialog.zedGraphChannels.Size.Height; - panelTrackBar.Location = new Point(panelProbe.Size.Width - panelTrackBar.Width, ChannelConfiguration.zedGraphChannels.Location.Y); - } } private void SelectedReferenceChanged(object sender, EventArgs e) @@ -604,11 +594,6 @@ internal void ChooseCalibrationFile_Click(object sender, EventArgs e) CheckStatus(); } - internal void ResetZoom_Click(object sender, EventArgs e) - { - ResetZoom(); - } - internal void ClearSelection_Click(object sender, EventArgs e) { DeselectContacts(); @@ -640,13 +625,6 @@ private void DeselectContacts() ChannelConfiguration.RefreshZedGraph(); } - private void ResetZoom() - { - ChannelConfiguration.ResetZoom(); - ChannelConfiguration.DrawScale(); - ChannelConfiguration.RefreshZedGraph(); - } - private void MoveToVerticalPosition(float relativePosition) { ChannelConfiguration.MoveToVerticalPosition(relativePosition); diff --git a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.resx b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.resx index 5d721569..05161bfb 100644 --- a/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.resx +++ b/OpenEphys.Onix1.Design/NeuropixelsV2eProbeConfigurationDialog.resx @@ -117,12 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - False - - - False - False @@ -135,15 +129,15 @@ False + + False + 17, 17 274, 17 - - False - 382, 17 diff --git a/OpenEphys.Onix1.Design/Properties/Resources.Designer.cs b/OpenEphys.Onix1.Design/Properties/Resources.Designer.cs index e45b694d..e122b753 100644 --- a/OpenEphys.Onix1.Design/Properties/Resources.Designer.cs +++ b/OpenEphys.Onix1.Design/Properties/Resources.Designer.cs @@ -60,6 +60,16 @@ internal Resources() { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap MagnifyingGlass { + get { + object obj = ResourceManager.GetObject("MagnifyingGlass", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/OpenEphys.Onix1.Design/Properties/Resources.resx b/OpenEphys.Onix1.Design/Properties/Resources.resx index 59d3809d..fb0f5258 100644 --- a/OpenEphys.Onix1.Design/Properties/Resources.resx +++ b/OpenEphys.Onix1.Design/Properties/Resources.resx @@ -118,6 +118,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\MagnifyingGlass.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\StatusBlockedImage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/OpenEphys.Onix1.Design/Resources/MagnifyingGlass.png b/OpenEphys.Onix1.Design/Resources/MagnifyingGlass.png new file mode 100644 index 00000000..be1d2bec Binary files /dev/null and b/OpenEphys.Onix1.Design/Resources/MagnifyingGlass.png differ diff --git a/OpenEphys.Onix1.Design/Rhs2116ChannelConfigurationDialog.cs b/OpenEphys.Onix1.Design/Rhs2116ChannelConfigurationDialog.cs index a3d72399..6d99c8e3 100644 --- a/OpenEphys.Onix1.Design/Rhs2116ChannelConfigurationDialog.cs +++ b/OpenEphys.Onix1.Design/Rhs2116ChannelConfigurationDialog.cs @@ -1,7 +1,6 @@ using System; using System.Linq; using System.Windows.Forms; -using Newtonsoft.Json; using OpenEphys.ProbeInterface.NET; using ZedGraph; @@ -30,9 +29,10 @@ public Rhs2116ChannelConfigurationDialog(Rhs2116ProbeGroup probeGroup) zedGraphChannels.ZoomStepFraction = 0.5; - ZoomInBoundaryX = 5; - ZoomInBoundaryY = 5; + ZoomInBoundaryX = 2; + ZoomInBoundaryY = 2; + DrawProbeGroup(); RefreshZedGraph(); } @@ -105,35 +105,5 @@ internal override string ContactString(int deviceChannelIndex, int index) return s; } - - // NB: Currently there is only a text label drawn as the scale for this dialog, used to denote the - // absolute orientation of the default probe group - internal override void DrawScale() - { - const string scaleTag = "scale"; - - zedGraphChannels.GraphPane.GraphObjList.RemoveAll(obj => obj.Tag is string tag && tag == scaleTag); - - bool isDefault = JsonConvert.SerializeObject(ProbeGroup) == JsonConvert.SerializeObject(new Rhs2116ProbeGroup()); - - if (isDefault) - { - var middle = GetProbeContourLeft(zedGraphChannels.GraphPane.GraphObjList) - + (GetProbeContourRight(zedGraphChannels.GraphPane.GraphObjList) - GetProbeContourLeft(zedGraphChannels.GraphPane.GraphObjList)) / 2; - var top = GetProbeContourTop(zedGraphChannels.GraphPane.GraphObjList); - - TextObj textObj = new("Tether Side", middle, top + 0.5, CoordType.AxisXYScale, AlignH.Center, AlignV.Center) - { - ZOrder = ZOrder.A_InFront, - Tag = scaleTag - }; - - SetTextObj(textObj); - - textObj.FontSpec.Size = CalculateFontSize(4.0); - - zedGraphChannels.GraphPane.GraphObjList.Add(textObj); - } - } } }