Compare commits

...

2 Commits

Author SHA1 Message Date
aj 21a16e5b7c feat(ui): move add/remove plate buttons to header bar
Relocated add and remove plate buttons from the Plates tab toolstrip
to the right side of the plate header, keeping plate actions together.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 09:46:08 -04:00
aj 4616f077d5 feat(ui): move plate navigation from toolbar to header above PlateView
Plate nav buttons (first/prev/next/last) now sit in a centered header
bar above the PlateView with a plate info label on the left, making
navigation more accessible without reaching up to the main toolbar.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 09:35:18 -04:00
4 changed files with 118 additions and 122 deletions
-38
View File
@@ -37,9 +37,6 @@
this.sizeColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.qtyColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.toolStripButtonAddPlate = new System.Windows.Forms.ToolStripButton();
this.toolStripButtonRemovePlate = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.drawingListBox1 = new OpenNest.Controls.DrawingListBox();
@@ -136,9 +133,6 @@
this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
this.toolStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButtonAddPlate,
this.toolStripButtonRemovePlate,
this.toolStripSeparator2,
this.toolStripButton1});
this.toolStrip1.Location = new System.Drawing.Point(3, 3);
this.toolStrip1.Name = "toolStrip1";
@@ -146,35 +140,6 @@
this.toolStrip1.TabIndex = 2;
this.toolStrip1.Text = "toolStrip1";
//
// toolStripButtonAddPlate
//
this.toolStripButtonAddPlate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButtonAddPlate.Image = global::OpenNest.Properties.Resources.add;
this.toolStripButtonAddPlate.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.toolStripButtonAddPlate.Name = "toolStripButtonAddPlate";
this.toolStripButtonAddPlate.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.toolStripButtonAddPlate.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.toolStripButtonAddPlate.Size = new System.Drawing.Size(38, 28);
this.toolStripButtonAddPlate.Text = "Add Plate";
this.toolStripButtonAddPlate.Click += new System.EventHandler(this.AddPlate_Click);
//
// toolStripButtonRemovePlate
//
this.toolStripButtonRemovePlate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButtonRemovePlate.Image = global::OpenNest.Properties.Resources.remove;
this.toolStripButtonRemovePlate.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.toolStripButtonRemovePlate.Name = "toolStripButtonRemovePlate";
this.toolStripButtonRemovePlate.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.toolStripButtonRemovePlate.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.toolStripButtonRemovePlate.Size = new System.Drawing.Size(38, 28);
this.toolStripButtonRemovePlate.Text = "Remove Selected Plate";
this.toolStripButtonRemovePlate.Click += new System.EventHandler(this.RemoveSelectedPlate_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(6, 31);
//
// toolStripButton1
//
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
@@ -293,13 +258,10 @@
private System.Windows.Forms.ColumnHeader sizeColumn;
private System.Windows.Forms.ColumnHeader qtyColumn;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton toolStripButtonAddPlate;
private System.Windows.Forms.ToolStripButton toolStripButtonRemovePlate;
private System.Windows.Forms.ToolStripButton toolStripButton1;
private System.Windows.Forms.TabPage tabPage2;
private Controls.DrawingListBox drawingListBox1;
private System.Windows.Forms.ColumnHeader plateNumColumn;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStrip toolStrip2;
private System.Windows.Forms.ToolStripButton toolStripButton2;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
+117
View File
@@ -28,6 +28,14 @@ namespace OpenNest.Forms
private readonly Timer updateDrawingListTimer;
private Panel plateHeaderPanel;
private Label plateInfoLabel;
private Button btnFirstPlate;
private Button btnPreviousPlate;
private Button btnNextPlate;
private Button btnLastPlate;
/// <summary>
/// Used to distinguish between single/double click on drawing within drawinglistbox.
/// If double click, this is set to false so the single click action won't be triggered.
@@ -43,8 +51,10 @@ namespace OpenNest.Forms
PlateView.Dock = DockStyle.Fill;
InitializeComponent();
CreatePlateHeader();
splitContainer.Panel2.Controls.Add(PlateView);
splitContainer.Panel2.Controls.Add(plateHeaderPanel);
var renderer = new ToolStripRenderer(ToolbarTheme.Toolbar);
toolStrip1.Renderer = renderer;
@@ -62,6 +72,91 @@ namespace OpenNest.Forms
};
}
private void CreatePlateHeader()
{
plateHeaderPanel = new Panel
{
Dock = DockStyle.Top,
Height = 30,
BackColor = Color.FromArgb(240, 240, 240),
Padding = new Padding(4, 0, 4, 0)
};
plateInfoLabel = new Label
{
AutoSize = true,
TextAlign = ContentAlignment.MiddleLeft,
Font = new Font("Segoe UI", 12f, FontStyle.Bold),
ForeColor = Color.FromArgb(120, 120, 120),
Dock = DockStyle.Left,
Padding = new Padding(4, 4, 4, 4)
};
var btnSize = new System.Drawing.Size(28, 28);
btnFirstPlate = CreateNavButton(Resources.move_first);
btnFirstPlate.Click += (s, e) => LoadFirstPlate();
btnPreviousPlate = CreateNavButton(Resources.move_previous);
btnPreviousPlate.Click += (s, e) => LoadPreviousPlate();
btnNextPlate = CreateNavButton(Resources.move_next);
btnNextPlate.Click += (s, e) => LoadNextPlate();
btnLastPlate = CreateNavButton(Resources.move_last);
btnLastPlate.Click += (s, e) => LoadLastPlate();
// Panel that holds the nav buttons and centers itself in the header
var navPanel = new Panel
{
Width = btnSize.Width * 4,
Height = btnSize.Height,
Anchor = AnchorStyles.None
};
btnFirstPlate.Location = new Point(0, 0);
btnPreviousPlate.Location = new Point(btnSize.Width, 0);
btnNextPlate.Location = new Point(btnSize.Width * 2, 0);
btnLastPlate.Location = new Point(btnSize.Width * 3, 0);
navPanel.Controls.AddRange(new Control[] { btnFirstPlate, btnPreviousPlate, btnNextPlate, btnLastPlate });
var btnRemovePlate = CreateNavButton(Resources.remove);
btnRemovePlate.Dock = DockStyle.Right;
btnRemovePlate.Click += (s, e) => RemoveCurrentPlate();
var btnAddPlate = CreateNavButton(Resources.add);
btnAddPlate.Dock = DockStyle.Right;
btnAddPlate.Click += (s, e) => Nest.CreatePlate();
plateHeaderPanel.Controls.Add(navPanel);
plateHeaderPanel.Controls.Add(plateInfoLabel);
plateHeaderPanel.Controls.Add(btnRemovePlate);
plateHeaderPanel.Controls.Add(btnAddPlate);
// Center the nav panel on resize
CenterNavPanel(navPanel);
plateHeaderPanel.Resize += (s, e) => CenterNavPanel(navPanel);
}
private void CenterNavPanel(Panel navPanel)
{
navPanel.Left = (plateHeaderPanel.Width - navPanel.Width) / 2;
navPanel.Top = (plateHeaderPanel.Height - navPanel.Height) / 2;
}
private static Button CreateNavButton(System.Drawing.Image image)
{
return new Button
{
Image = image,
Size = new System.Drawing.Size(28, 28),
FlatStyle = FlatStyle.Flat,
FlatAppearance = { BorderSize = 0 },
Cursor = Cursors.Hand
};
}
public EditNestForm(Nest nest)
: this()
{
@@ -518,10 +613,32 @@ namespace OpenNest.Forms
if (updateListView)
platesListView.Items[CurrentPlateIndex].Selected = true;
UpdatePlateHeader();
if (PlateChanged != null)
PlateChanged.Invoke(this, EventArgs.Empty);
}
private void UpdatePlateHeader()
{
var plate = Nest.Plates.Count > 0 ? Nest.Plates[CurrentPlateIndex] : null;
if (plate != null)
{
plateInfoLabel.Text = string.Format("Plate {0} of {1} | {2}",
CurrentPlateIndex + 1, Nest.Plates.Count, plate.Size);
}
else
{
plateInfoLabel.Text = "No plates";
}
btnFirstPlate.Enabled = !IsFirstPlate();
btnPreviousPlate.Enabled = !IsFirstPlate();
btnNextPlate.Enabled = !IsLastPlate();
btnLastPlate.Enabled = !IsLastPlate();
}
#region Overrides
protected override void OnSizeChanged(EventArgs e)
+1 -66
View File
@@ -137,11 +137,6 @@
btnSave = new System.Windows.Forms.ToolStripButton();
btnSaveAs = new System.Windows.Forms.ToolStripButton();
toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
btnFirstPlate = new System.Windows.Forms.ToolStripButton();
btnPreviousPlate = new System.Windows.Forms.ToolStripButton();
btnNextPlate = new System.Windows.Forms.ToolStripButton();
btnLastPlate = new System.Windows.Forms.ToolStripButton();
toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
btnZoomOut = new System.Windows.Forms.ToolStripButton();
btnZoomIn = new System.Windows.Forms.ToolStripButton();
btnZoomToFit = new System.Windows.Forms.ToolStripButton();
@@ -889,7 +884,7 @@
// toolStrip1
//
toolStrip1.AutoSize = false;
toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { btnNew, btnOpen, btnSave, btnSaveAs, toolStripSeparator1, btnFirstPlate, btnPreviousPlate, btnNextPlate, btnLastPlate, toolStripSeparator3, btnZoomOut, btnZoomIn, btnZoomToFit, toolStripSeparator4, engineLabel, engineComboBox, btnAutoNest, btnShowRemnants });
toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { btnNew, btnOpen, btnSave, btnSaveAs, toolStripSeparator1, btnZoomOut, btnZoomIn, btnZoomToFit, toolStripSeparator4, engineLabel, engineComboBox, btnAutoNest, btnShowRemnants });
toolStrip1.Location = new System.Drawing.Point(0, 24);
toolStrip1.Name = "toolStrip1";
toolStrip1.Size = new System.Drawing.Size(1281, 40);
@@ -949,61 +944,6 @@
toolStripSeparator1.Name = "toolStripSeparator1";
toolStripSeparator1.Size = new System.Drawing.Size(6, 40);
//
// btnFirstPlate
//
btnFirstPlate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
btnFirstPlate.Image = Properties.Resources.move_first;
btnFirstPlate.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
btnFirstPlate.ImageTransparentColor = System.Drawing.Color.Magenta;
btnFirstPlate.Name = "btnFirstPlate";
btnFirstPlate.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
btnFirstPlate.Size = new System.Drawing.Size(38, 37);
btnFirstPlate.Text = "Go to First Plate";
btnFirstPlate.Click += LoadFirstPlate_Click;
//
// btnPreviousPlate
//
btnPreviousPlate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
btnPreviousPlate.Image = Properties.Resources.move_previous;
btnPreviousPlate.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
btnPreviousPlate.ImageTransparentColor = System.Drawing.Color.Magenta;
btnPreviousPlate.Name = "btnPreviousPlate";
btnPreviousPlate.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
btnPreviousPlate.Size = new System.Drawing.Size(38, 37);
btnPreviousPlate.Text = "Go to Previous Plate";
btnPreviousPlate.Click += LoadPreviousPlate_Click;
//
// btnNextPlate
//
btnNextPlate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
btnNextPlate.Image = Properties.Resources.move_next;
btnNextPlate.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
btnNextPlate.ImageTransparentColor = System.Drawing.Color.Magenta;
btnNextPlate.Name = "btnNextPlate";
btnNextPlate.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
btnNextPlate.RightToLeft = System.Windows.Forms.RightToLeft.No;
btnNextPlate.Size = new System.Drawing.Size(38, 37);
btnNextPlate.Text = "Go to Next Plate";
btnNextPlate.Click += LoadNextPlate_Click;
//
// btnLastPlate
//
btnLastPlate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
btnLastPlate.Image = Properties.Resources.move_last;
btnLastPlate.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
btnLastPlate.ImageTransparentColor = System.Drawing.Color.Magenta;
btnLastPlate.Name = "btnLastPlate";
btnLastPlate.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
btnLastPlate.RightToLeft = System.Windows.Forms.RightToLeft.No;
btnLastPlate.Size = new System.Drawing.Size(38, 37);
btnLastPlate.Text = "Go to Last Plate";
btnLastPlate.Click += LoadLastPlate_Click;
//
// toolStripSeparator3
//
toolStripSeparator3.Name = "toolStripSeparator3";
toolStripSeparator3.Size = new System.Drawing.Size(6, 40);
//
// btnZoomOut
//
btnZoomOut.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
@@ -1165,8 +1105,6 @@
private System.Windows.Forms.ToolStripButton btnOpen;
private System.Windows.Forms.ToolStripStatusLabel plateIndexStatusLabel;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripButton btnPreviousPlate;
private System.Windows.Forms.ToolStripButton btnNextPlate;
private System.Windows.Forms.ToolStripMenuItem mnuWindow;
private System.Windows.Forms.ToolStripMenuItem mnuWindowCascade;
private System.Windows.Forms.ToolStripMenuItem mnuWindowTileVertical;
@@ -1200,13 +1138,10 @@
private System.Windows.Forms.ToolStripMenuItem mnuPlateViewInCad;
private System.Windows.Forms.ToolStripButton btnNew;
private System.Windows.Forms.ToolStripMenuItem mnuPlateAdd;
private System.Windows.Forms.ToolStripButton btnFirstPlate;
private System.Windows.Forms.ToolStripButton btnLastPlate;
private System.Windows.Forms.ToolStripButton btnZoomToFit;
private System.Windows.Forms.ToolStripMenuItem mnuNestRemoveEmptyPlates;
private System.Windows.Forms.ToolStripMenuItem mnuViewZoomIn;
private System.Windows.Forms.ToolStripMenuItem mnuViewZoomOut;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem14;
private System.Windows.Forms.ToolStripMenuItem mnuSetOffsetIncrement;
private System.Windows.Forms.ToolStripMenuItem mnuSetRotationIncrement;
-18
View File
@@ -155,30 +155,16 @@ namespace OpenNest.Forms
if (activeForm == null)
{
mnuNestPreviousPlate.Enabled = false;
btnPreviousPlate.Enabled = false;
mnuNestNextPlate.Enabled = false;
btnNextPlate.Enabled = false;
mnuNestFirstPlate.Enabled = false;
btnFirstPlate.Enabled = false;
mnuNestLastPlate.Enabled = false;
btnLastPlate.Enabled = false;
}
else
{
mnuNestPreviousPlate.Enabled = !activeForm.IsFirstPlate();
btnPreviousPlate.Enabled = !activeForm.IsFirstPlate();
mnuNestNextPlate.Enabled = !activeForm.IsLastPlate();
btnNextPlate.Enabled = !activeForm.IsLastPlate();
mnuNestFirstPlate.Enabled = activeForm.PlateCount > 0 && !activeForm.IsFirstPlate();
btnFirstPlate.Enabled = activeForm.PlateCount > 0 && !activeForm.IsFirstPlate();
mnuNestLastPlate.Enabled = activeForm.PlateCount > 0 && !activeForm.IsLastPlate();
btnLastPlate.Enabled = activeForm.PlateCount > 0 && !activeForm.IsLastPlate();
}
}
@@ -192,13 +178,9 @@ namespace OpenNest.Forms
// Lock plate navigation
mnuNestPreviousPlate.Enabled = !locked && activeForm != null && !activeForm.IsFirstPlate();
btnPreviousPlate.Enabled = mnuNestPreviousPlate.Enabled;
mnuNestNextPlate.Enabled = !locked && activeForm != null && !activeForm.IsLastPlate();
btnNextPlate.Enabled = mnuNestNextPlate.Enabled;
mnuNestFirstPlate.Enabled = !locked && activeForm != null && activeForm.PlateCount > 0 && !activeForm.IsFirstPlate();
btnFirstPlate.Enabled = mnuNestFirstPlate.Enabled;
mnuNestLastPlate.Enabled = !locked && activeForm != null && activeForm.PlateCount > 0 && !activeForm.IsLastPlate();
btnLastPlate.Enabled = mnuNestLastPlate.Enabled;
}
private void UpdateLocationStatus()