feat: replace best-fit viewer dropdown with DrawingListBox in split view
Swap the ComboBox drawing selector with the same DrawingListBox control used in EditNestForm, placed in a resizable SplitContainer. Add selection highlighting and HideQuantity option to DrawingListBox. Show a centered loading message while computing, and allow switching drawings mid-compute. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,8 @@ namespace OpenNest.Controls
|
||||
|
||||
public bool HideDepletedParts { get; set; }
|
||||
|
||||
public bool HideQuantity { get; set; }
|
||||
|
||||
protected override void OnDrawItem(DrawItemEventArgs e)
|
||||
{
|
||||
if (e.Index >= Items.Count || e.Index <= -1)
|
||||
@@ -38,8 +40,15 @@ namespace OpenNest.Controls
|
||||
if (dwg == null)
|
||||
return;
|
||||
|
||||
var isComplete = dwg.Quantity.Nested > 0 && dwg.Quantity.Remaining == 0;
|
||||
var bgBrush = isComplete ? SystemBrushes.Info : Brushes.White;
|
||||
var isSelected = (e.State & DrawItemState.Selected) != 0;
|
||||
Brush bgBrush;
|
||||
|
||||
if (isSelected)
|
||||
bgBrush = SystemBrushes.Highlight;
|
||||
else if (!HideQuantity && dwg.Quantity.Nested > 0 && dwg.Quantity.Remaining == 0)
|
||||
bgBrush = SystemBrushes.Info;
|
||||
else
|
||||
bgBrush = Brushes.White;
|
||||
|
||||
e.Graphics.FillRectangle(bgBrush, e.Bounds);
|
||||
|
||||
@@ -57,19 +66,32 @@ namespace OpenNest.Controls
|
||||
|
||||
pt.X += imageSize.Width + 10;
|
||||
|
||||
e.Graphics.DrawString(dwg.Name, nameFont, Brushes.Black, pt);
|
||||
var textBrush = isSelected ? SystemBrushes.HighlightText : Brushes.Black;
|
||||
var detailBrush = isSelected ? SystemBrushes.HighlightText : Brushes.Gray;
|
||||
|
||||
e.Graphics.DrawString(dwg.Name, nameFont, textBrush, pt);
|
||||
|
||||
var bounds = dwg.Program.BoundingBox();
|
||||
var text1 = string.Format("{0} of {1} nested", dwg.Quantity.Nested, dwg.Quantity.Required);
|
||||
var text2 = bounds.Size.ToString(4);
|
||||
var text3 = string.Format("{0} sq/{1}", System.Math.Round(dwg.Area, 4), UnitsHelper.GetShortString(Units));
|
||||
|
||||
pt.Y += 22;
|
||||
e.Graphics.DrawString(text1, Font, Brushes.Gray, pt);
|
||||
pt.Y += 18;
|
||||
e.Graphics.DrawString(text2, Font, Brushes.Gray, pt);
|
||||
pt.Y += 18;
|
||||
e.Graphics.DrawString(text3, Font, Brushes.Gray, pt);
|
||||
if (HideQuantity)
|
||||
{
|
||||
pt.Y += 22;
|
||||
e.Graphics.DrawString(text2, Font, detailBrush, pt);
|
||||
pt.Y += 18;
|
||||
e.Graphics.DrawString(text3, Font, detailBrush, pt);
|
||||
}
|
||||
else
|
||||
{
|
||||
var text1 = string.Format("{0} of {1} nested", dwg.Quantity.Nested, dwg.Quantity.Required);
|
||||
pt.Y += 22;
|
||||
e.Graphics.DrawString(text1, Font, detailBrush, pt);
|
||||
pt.Y += 18;
|
||||
e.Graphics.DrawString(text2, Font, detailBrush, pt);
|
||||
pt.Y += 18;
|
||||
e.Graphics.DrawString(text3, Font, detailBrush, pt);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
|
||||
259
OpenNest/Forms/BestFitViewerForm.Designer.cs
generated
259
OpenNest/Forms/BestFitViewerForm.Designer.cs
generated
@@ -13,134 +13,157 @@ namespace OpenNest.Forms
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.gridPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.toolbarPanel = new System.Windows.Forms.Panel();
|
||||
this.lblDrawing = new System.Windows.Forms.Label();
|
||||
this.cboDrawing = new System.Windows.Forms.ComboBox();
|
||||
this.navPanel = new System.Windows.Forms.Panel();
|
||||
this.btnPrev = new System.Windows.Forms.Button();
|
||||
this.btnNext = new System.Windows.Forms.Button();
|
||||
this.txtPage = new System.Windows.Forms.TextBox();
|
||||
this.lblPageCount = new System.Windows.Forms.Label();
|
||||
this.toolbarPanel.SuspendLayout();
|
||||
this.navPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
splitContainer = new System.Windows.Forms.SplitContainer();
|
||||
drawingListBox = new OpenNest.Controls.DrawingListBox();
|
||||
gridPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
navPanel = new System.Windows.Forms.Panel();
|
||||
btnPrev = new System.Windows.Forms.Button();
|
||||
txtPage = new System.Windows.Forms.TextBox();
|
||||
lblPageCount = new System.Windows.Forms.Label();
|
||||
btnNext = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)splitContainer).BeginInit();
|
||||
splitContainer.Panel1.SuspendLayout();
|
||||
splitContainer.Panel2.SuspendLayout();
|
||||
splitContainer.SuspendLayout();
|
||||
navPanel.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// splitContainer
|
||||
//
|
||||
splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
splitContainer.Location = new System.Drawing.Point(0, 0);
|
||||
splitContainer.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
splitContainer.Name = "splitContainer";
|
||||
//
|
||||
// splitContainer.Panel1
|
||||
//
|
||||
splitContainer.Panel1.Controls.Add(drawingListBox);
|
||||
splitContainer.Panel1MinSize = 180;
|
||||
//
|
||||
// splitContainer.Panel2
|
||||
//
|
||||
splitContainer.Panel2.Controls.Add(gridPanel);
|
||||
splitContainer.Panel2.Controls.Add(navPanel);
|
||||
splitContainer.Size = new System.Drawing.Size(792, 486);
|
||||
splitContainer.SplitterDistance = 280;
|
||||
splitContainer.SplitterWidth = 6;
|
||||
splitContainer.TabIndex = 0;
|
||||
//
|
||||
// drawingListBox
|
||||
//
|
||||
drawingListBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
drawingListBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
drawingListBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
|
||||
drawingListBox.FormattingEnabled = true;
|
||||
drawingListBox.HideDepletedParts = false;
|
||||
drawingListBox.ItemHeight = 85;
|
||||
drawingListBox.Location = new System.Drawing.Point(0, 0);
|
||||
drawingListBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
drawingListBox.Name = "drawingListBox";
|
||||
drawingListBox.Size = new System.Drawing.Size(280, 486);
|
||||
drawingListBox.TabIndex = 0;
|
||||
drawingListBox.Units = Units.Inches;
|
||||
//
|
||||
// gridPanel
|
||||
//
|
||||
this.gridPanel.ColumnCount = 5;
|
||||
this.gridPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.gridPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.gridPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.gridPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.gridPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.gridPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gridPanel.Location = new System.Drawing.Point(0, 32);
|
||||
this.gridPanel.Name = "gridPanel";
|
||||
this.gridPanel.RowCount = 3;
|
||||
this.gridPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33F));
|
||||
this.gridPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.34F));
|
||||
this.gridPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33F));
|
||||
this.gridPanel.Size = new System.Drawing.Size(1200, 732);
|
||||
this.gridPanel.TabIndex = 0;
|
||||
//
|
||||
// toolbarPanel
|
||||
//
|
||||
this.toolbarPanel.Controls.Add(this.lblDrawing);
|
||||
this.toolbarPanel.Controls.Add(this.cboDrawing);
|
||||
this.toolbarPanel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.toolbarPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolbarPanel.Name = "toolbarPanel";
|
||||
this.toolbarPanel.Size = new System.Drawing.Size(1200, 32);
|
||||
this.toolbarPanel.TabIndex = 2;
|
||||
//
|
||||
// lblDrawing
|
||||
//
|
||||
this.lblDrawing.Location = new System.Drawing.Point(6, 0);
|
||||
this.lblDrawing.Name = "lblDrawing";
|
||||
this.lblDrawing.Size = new System.Drawing.Size(55, 32);
|
||||
this.lblDrawing.TabIndex = 0;
|
||||
this.lblDrawing.Text = "Drawing:";
|
||||
this.lblDrawing.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// cboDrawing
|
||||
//
|
||||
this.cboDrawing.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cboDrawing.Location = new System.Drawing.Point(64, 5);
|
||||
this.cboDrawing.Name = "cboDrawing";
|
||||
this.cboDrawing.Size = new System.Drawing.Size(250, 21);
|
||||
this.cboDrawing.TabIndex = 1;
|
||||
//
|
||||
//
|
||||
gridPanel.ColumnCount = 5;
|
||||
gridPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
gridPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
gridPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
gridPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
gridPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
gridPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
gridPanel.Location = new System.Drawing.Point(0, 0);
|
||||
gridPanel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
gridPanel.Name = "gridPanel";
|
||||
gridPanel.RowCount = 3;
|
||||
gridPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33F));
|
||||
gridPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.34F));
|
||||
gridPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33F));
|
||||
gridPanel.Size = new System.Drawing.Size(506, 444);
|
||||
gridPanel.TabIndex = 0;
|
||||
//
|
||||
// navPanel
|
||||
//
|
||||
this.navPanel.Controls.Add(this.btnPrev);
|
||||
this.navPanel.Controls.Add(this.txtPage);
|
||||
this.navPanel.Controls.Add(this.lblPageCount);
|
||||
this.navPanel.Controls.Add(this.btnNext);
|
||||
this.navPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.navPanel.Location = new System.Drawing.Point(0, 764);
|
||||
this.navPanel.Name = "navPanel";
|
||||
this.navPanel.Size = new System.Drawing.Size(1200, 36);
|
||||
this.navPanel.TabIndex = 1;
|
||||
//
|
||||
//
|
||||
navPanel.Controls.Add(btnPrev);
|
||||
navPanel.Controls.Add(txtPage);
|
||||
navPanel.Controls.Add(lblPageCount);
|
||||
navPanel.Controls.Add(btnNext);
|
||||
navPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
navPanel.Location = new System.Drawing.Point(0, 444);
|
||||
navPanel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
navPanel.Name = "navPanel";
|
||||
navPanel.Size = new System.Drawing.Size(506, 42);
|
||||
navPanel.TabIndex = 1;
|
||||
//
|
||||
// btnPrev
|
||||
//
|
||||
this.btnPrev.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnPrev.Name = "btnPrev";
|
||||
this.btnPrev.Size = new System.Drawing.Size(80, 28);
|
||||
this.btnPrev.TabIndex = 0;
|
||||
this.btnPrev.Text = "< Prev";
|
||||
this.btnPrev.Click += new System.EventHandler(this.btnPrev_Click);
|
||||
//
|
||||
//
|
||||
btnPrev.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
btnPrev.Location = new System.Drawing.Point(0, 0);
|
||||
btnPrev.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
btnPrev.Name = "btnPrev";
|
||||
btnPrev.Size = new System.Drawing.Size(93, 32);
|
||||
btnPrev.TabIndex = 0;
|
||||
btnPrev.Text = "< Prev";
|
||||
btnPrev.Click += btnPrev_Click;
|
||||
//
|
||||
// txtPage
|
||||
//
|
||||
this.txtPage.Name = "txtPage";
|
||||
this.txtPage.Size = new System.Drawing.Size(40, 20);
|
||||
this.txtPage.TabIndex = 1;
|
||||
this.txtPage.Text = "1";
|
||||
this.txtPage.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.txtPage.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtPage_KeyDown);
|
||||
//
|
||||
//
|
||||
txtPage.Location = new System.Drawing.Point(0, 0);
|
||||
txtPage.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
txtPage.Name = "txtPage";
|
||||
txtPage.Size = new System.Drawing.Size(46, 23);
|
||||
txtPage.TabIndex = 1;
|
||||
txtPage.Text = "1";
|
||||
txtPage.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
txtPage.KeyDown += txtPage_KeyDown;
|
||||
//
|
||||
// lblPageCount
|
||||
//
|
||||
this.lblPageCount.Name = "lblPageCount";
|
||||
this.lblPageCount.Size = new System.Drawing.Size(50, 28);
|
||||
this.lblPageCount.TabIndex = 2;
|
||||
this.lblPageCount.Text = "/ 1";
|
||||
this.lblPageCount.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
//
|
||||
lblPageCount.Location = new System.Drawing.Point(0, 0);
|
||||
lblPageCount.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
lblPageCount.Name = "lblPageCount";
|
||||
lblPageCount.Size = new System.Drawing.Size(58, 32);
|
||||
lblPageCount.TabIndex = 2;
|
||||
lblPageCount.Text = "/ 1";
|
||||
lblPageCount.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// btnNext
|
||||
//
|
||||
this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnNext.Name = "btnNext";
|
||||
this.btnNext.Size = new System.Drawing.Size(80, 28);
|
||||
this.btnNext.TabIndex = 3;
|
||||
this.btnNext.Text = "Next >";
|
||||
this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
|
||||
//
|
||||
//
|
||||
btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
btnNext.Location = new System.Drawing.Point(0, 0);
|
||||
btnNext.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
btnNext.Name = "btnNext";
|
||||
btnNext.Size = new System.Drawing.Size(93, 32);
|
||||
btnNext.TabIndex = 3;
|
||||
btnNext.Text = "Next >";
|
||||
btnNext.Click += btnNext_Click;
|
||||
//
|
||||
// BestFitViewerForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1200, 800);
|
||||
this.Controls.Add(this.gridPanel);
|
||||
this.Controls.Add(this.toolbarPanel);
|
||||
this.Controls.Add(this.navPanel);
|
||||
this.KeyPreview = true;
|
||||
this.Name = "BestFitViewerForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Best-Fit Viewer";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.toolbarPanel.ResumeLayout(false);
|
||||
this.navPanel.ResumeLayout(false);
|
||||
this.navPanel.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
//
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
ClientSize = new System.Drawing.Size(792, 486);
|
||||
Controls.Add(splitContainer);
|
||||
KeyPreview = true;
|
||||
Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
Name = "BestFitViewerForm";
|
||||
StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
Text = "Best-Fit Viewer";
|
||||
WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
splitContainer.Panel1.ResumeLayout(false);
|
||||
splitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)splitContainer).EndInit();
|
||||
splitContainer.ResumeLayout(false);
|
||||
navPanel.ResumeLayout(false);
|
||||
navPanel.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer;
|
||||
private Controls.DrawingListBox drawingListBox;
|
||||
private System.Windows.Forms.TableLayoutPanel gridPanel;
|
||||
private System.Windows.Forms.Panel toolbarPanel;
|
||||
private System.Windows.Forms.Label lblDrawing;
|
||||
private System.Windows.Forms.ComboBox cboDrawing;
|
||||
private System.Windows.Forms.Panel navPanel;
|
||||
private System.Windows.Forms.Button btnPrev;
|
||||
private System.Windows.Forms.Button btnNext;
|
||||
|
||||
@@ -41,11 +41,12 @@ namespace OpenNest.Forms
|
||||
private int currentPage;
|
||||
private int pageCount;
|
||||
private CancellationTokenSource computeCts;
|
||||
private Label lblLoading;
|
||||
|
||||
public BestFitResult SelectedResult { get; private set; }
|
||||
public Drawing SelectedDrawing => activeDrawing;
|
||||
|
||||
public BestFitViewerForm(DrawingCollection drawings, Plate plate)
|
||||
public BestFitViewerForm(DrawingCollection drawings, Plate plate, Units units = Units.Inches)
|
||||
{
|
||||
this.drawings = drawings.ToList();
|
||||
this.plate = plate;
|
||||
@@ -53,10 +54,12 @@ namespace OpenNest.Forms
|
||||
DoubleBuffered = true;
|
||||
InitializeComponent();
|
||||
|
||||
drawingListBox.Units = units;
|
||||
drawingListBox.HideQuantity = true;
|
||||
foreach (var d in drawings)
|
||||
cboDrawing.Items.Add(d.Name);
|
||||
cboDrawing.SelectedIndex = 0;
|
||||
cboDrawing.SelectedIndexChanged += cboDrawing_SelectedIndexChanged;
|
||||
drawingListBox.Items.Add(d);
|
||||
drawingListBox.SelectedIndex = 0;
|
||||
drawingListBox.SelectedIndexChanged += drawingListBox_SelectedIndexChanged;
|
||||
|
||||
navPanel.SizeChanged += (s, ev) => CenterNavControls();
|
||||
Shown += BestFitViewerForm_Shown;
|
||||
@@ -93,13 +96,13 @@ namespace OpenNest.Forms
|
||||
return base.ProcessCmdKey(ref msg, keyData);
|
||||
}
|
||||
|
||||
private void cboDrawing_SelectedIndexChanged(object sender, EventArgs e)
|
||||
private void drawingListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var index = cboDrawing.SelectedIndex;
|
||||
if (index < 0 || index >= drawings.Count)
|
||||
var drawing = drawingListBox.SelectedItem as Drawing;
|
||||
if (drawing == null)
|
||||
return;
|
||||
|
||||
activeDrawing = drawings[index];
|
||||
activeDrawing = drawing;
|
||||
LoadResultsAsync();
|
||||
}
|
||||
|
||||
@@ -145,7 +148,6 @@ namespace OpenNest.Forms
|
||||
private void SetLoading(bool loading)
|
||||
{
|
||||
Cursor = loading ? Cursors.WaitCursor : Cursors.Default;
|
||||
cboDrawing.Enabled = !loading;
|
||||
btnPrev.Enabled = !loading;
|
||||
btnNext.Enabled = !loading;
|
||||
txtPage.Enabled = !loading;
|
||||
@@ -155,8 +157,34 @@ namespace OpenNest.Forms
|
||||
Text = "Best-Fit Viewer — Computing...";
|
||||
gridPanel.SuspendLayout();
|
||||
gridPanel.Controls.Clear();
|
||||
lblLoading = null;
|
||||
EnsureLoadingLabel();
|
||||
lblLoading.Text = string.Format("Computing best fits for {0}...", activeDrawing.Name);
|
||||
gridPanel.ResumeLayout(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lblLoading != null)
|
||||
lblLoading.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void EnsureLoadingLabel()
|
||||
{
|
||||
if (lblLoading != null)
|
||||
return;
|
||||
|
||||
lblLoading = new Label
|
||||
{
|
||||
AutoSize = false,
|
||||
TextAlign = ContentAlignment.MiddleCenter,
|
||||
ForeColor = Color.Gray,
|
||||
Font = new Font(Font.FontFamily, 14f),
|
||||
Dock = DockStyle.Fill
|
||||
};
|
||||
gridPanel.Controls.Add(lblLoading, 0, 0);
|
||||
gridPanel.SetColumnSpan(lblLoading, Columns);
|
||||
gridPanel.SetRowSpan(lblLoading, Rows);
|
||||
}
|
||||
|
||||
private static ComputeResult ComputeResults(Drawing drawing, double length, double width, double spacing)
|
||||
|
||||
120
OpenNest/Forms/BestFitViewerForm.resx
Normal file
120
OpenNest/Forms/BestFitViewerForm.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -626,7 +626,7 @@ namespace OpenNest.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
using (var form = new BestFitViewerForm(drawings, plate))
|
||||
using (var form = new BestFitViewerForm(drawings, plate, activeForm.Nest.Units))
|
||||
{
|
||||
if (form.ShowDialog(this) == DialogResult.OK && form.SelectedResult != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user