Create universal tool window

This commit is contained in:
Tiago Conceição
2020-09-05 23:10:48 +01:00
parent 4bbef72acb
commit 2703bab0cb
14 changed files with 5663 additions and 17 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
* (Fix) CWS: Add missing Platform X,Y,Z size when converting from SL1
* (Fix) CWS: Invert XY resolution when converting from SL1
* (Fix) Layer Preview: When selecting issues using SHIFT in the layer preview, the selected issue doesn't update in the issue list until after shift is released and slow operation
* (Fix) PrusaSlicer Printer: Kelant S400 Y Resolution from 1440 to 1600 and default slice settings, inverted XY resolution
* (Fix) PrusaSlicer Printer: Kelant S400 Y Resolution from 1440 to 1600 and default slice settings, FLIP_XY removed, portait mode to landscape
* (Fix) Layer Clone window title was set to Pattern
## 04/08/2020 - v0.7.0.0
+65
View File
@@ -0,0 +1,65 @@
namespace UVtools.GUI.Controls
{
partial class CtrlDescriptionPanel
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lbDescription = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lbDescription
//
this.lbDescription.AutoSize = true;
this.lbDescription.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbDescription.Location = new System.Drawing.Point(0, 0);
this.lbDescription.Name = "lbDescription";
this.lbDescription.Padding = new System.Windows.Forms.Padding(20);
this.lbDescription.Size = new System.Drawing.Size(129, 60);
this.lbDescription.TabIndex = 0;
this.lbDescription.Text = "Description";
//
// CtrlDescriptionPanel
//
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.BackColor = System.Drawing.Color.WhiteSmoke;
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Controls.Add(this.lbDescription);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "CtrlDescriptionPanel";
this.Size = new System.Drawing.Size(129, 60);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lbDescription;
}
}
@@ -0,0 +1,19 @@
using System.ComponentModel;
using System.Windows.Forms;
namespace UVtools.GUI.Controls
{
public partial class CtrlDescriptionPanel : UserControl
{
public string Description
{
get => lbDescription.Text;
set => lbDescription.Text = value;
}
public CtrlDescriptionPanel()
{
InitializeComponent();
}
}
}
@@ -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>
+233
View File
@@ -0,0 +1,233 @@
using UVtools.GUI.Controls;
namespace UVtools.GUI.Forms
{
partial class FrmToolLayerImport
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmToolLayerImport));
this.lbLayerRange = new System.Windows.Forms.Label();
this.nmInsertAfterLayer = new System.Windows.Forms.NumericUpDown();
this.cmLayerRange = new System.Windows.Forms.ContextMenuStrip(this.components);
this.btnLayerRangeAllLayers = new System.Windows.Forms.ToolStripMenuItem();
this.btnLayerRangeCurrentLayer = new System.Windows.Forms.ToolStripMenuItem();
this.btnLayerRangeBottomLayers = new System.Windows.Forms.ToolStripMenuItem();
this.btnLayerRangeNormalLayers = new System.Windows.Forms.ToolStripMenuItem();
this.lbHeight = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
this.ctrlDescriptionPanel1 = new UVtools.GUI.Controls.CtrlDescriptionPanel();
((System.ComponentModel.ISupportInitialize)(this.nmInsertAfterLayer)).BeginInit();
this.cmLayerRange.SuspendLayout();
this.SuspendLayout();
//
// lbLayerRange
//
this.lbLayerRange.AutoSize = true;
this.lbLayerRange.Location = new System.Drawing.Point(20, 181);
this.lbLayerRange.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbLayerRange.Name = "lbLayerRange";
this.lbLayerRange.Size = new System.Drawing.Size(128, 20);
this.lbLayerRange.TabIndex = 9;
this.lbLayerRange.Text = "Insert after layer:";
//
// nmInsertAfterLayer
//
this.nmInsertAfterLayer.Location = new System.Drawing.Point(156, 178);
this.nmInsertAfterLayer.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.nmInsertAfterLayer.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.nmInsertAfterLayer.Name = "nmInsertAfterLayer";
this.nmInsertAfterLayer.Size = new System.Drawing.Size(90, 26);
this.nmInsertAfterLayer.TabIndex = 0;
this.nmInsertAfterLayer.ValueChanged += new System.EventHandler(this.EventValueChanged);
//
// cmLayerRange
//
this.cmLayerRange.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnLayerRangeAllLayers,
this.btnLayerRangeCurrentLayer,
this.btnLayerRangeBottomLayers,
this.btnLayerRangeNormalLayers});
this.cmLayerRange.Name = "cmLayerRange";
this.cmLayerRange.Size = new System.Drawing.Size(226, 92);
//
// btnLayerRangeAllLayers
//
this.btnLayerRangeAllLayers.Name = "btnLayerRangeAllLayers";
this.btnLayerRangeAllLayers.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.A)));
this.btnLayerRangeAllLayers.Size = new System.Drawing.Size(225, 22);
this.btnLayerRangeAllLayers.Text = "&All Layers";
this.btnLayerRangeAllLayers.Click += new System.EventHandler(this.EventClick);
//
// btnLayerRangeCurrentLayer
//
this.btnLayerRangeCurrentLayer.Name = "btnLayerRangeCurrentLayer";
this.btnLayerRangeCurrentLayer.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.C)));
this.btnLayerRangeCurrentLayer.Size = new System.Drawing.Size(225, 22);
this.btnLayerRangeCurrentLayer.Text = "&Current Layer";
this.btnLayerRangeCurrentLayer.Click += new System.EventHandler(this.EventClick);
//
// btnLayerRangeBottomLayers
//
this.btnLayerRangeBottomLayers.Name = "btnLayerRangeBottomLayers";
this.btnLayerRangeBottomLayers.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.B)));
this.btnLayerRangeBottomLayers.Size = new System.Drawing.Size(225, 22);
this.btnLayerRangeBottomLayers.Text = "&Bottom Layers";
this.btnLayerRangeBottomLayers.Click += new System.EventHandler(this.EventClick);
//
// btnLayerRangeNormalLayers
//
this.btnLayerRangeNormalLayers.Name = "btnLayerRangeNormalLayers";
this.btnLayerRangeNormalLayers.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.N)));
this.btnLayerRangeNormalLayers.Size = new System.Drawing.Size(225, 22);
this.btnLayerRangeNormalLayers.Text = "&Normal Layers";
this.btnLayerRangeNormalLayers.Click += new System.EventHandler(this.EventClick);
//
// lbHeight
//
this.lbHeight.AutoSize = true;
this.lbHeight.Location = new System.Drawing.Point(254, 181);
this.lbHeight.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbHeight.Name = "lbHeight";
this.lbHeight.Size = new System.Drawing.Size(85, 20);
this.lbHeight.TabIndex = 24;
this.lbHeight.Text = "(10.10mm)";
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(438, 179);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(153, 24);
this.checkBox1.TabIndex = 25;
this.checkBox1.Text = "Replace this layer";
this.checkBox1.UseVisualStyleBackColor = true;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Image = global::UVtools.GUI.Properties.Resources.Cancel_24x24;
this.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnCancel.Location = new System.Drawing.Point(434, 418);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(150, 48);
this.btnCancel.TabIndex = 6;
this.btnCancel.Text = "&Cancel";
this.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.EventClick);
//
// btnOk
//
this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnOk.Image = global::UVtools.GUI.Properties.Resources.Ok_24x24;
this.btnOk.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnOk.Location = new System.Drawing.Point(276, 418);
this.btnOk.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(150, 48);
this.btnOk.TabIndex = 5;
this.btnOk.Text = "&Clone";
this.btnOk.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.EventClick);
//
// ctrlDescriptionPanel1
//
this.ctrlDescriptionPanel1.AutoSize = true;
this.ctrlDescriptionPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ctrlDescriptionPanel1.BackColor = System.Drawing.Color.WhiteSmoke;
this.ctrlDescriptionPanel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ctrlDescriptionPanel1.Description = "Import layers from local files at a defined height.";
this.ctrlDescriptionPanel1.Dock = System.Windows.Forms.DockStyle.Top;
this.ctrlDescriptionPanel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ctrlDescriptionPanel1.Location = new System.Drawing.Point(0, 0);
this.ctrlDescriptionPanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.ctrlDescriptionPanel1.Name = "ctrlDescriptionPanel1";
this.ctrlDescriptionPanel1.Size = new System.Drawing.Size(599, 62);
this.ctrlDescriptionPanel1.TabIndex = 26;
//
// FrmToolLayerImport
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(599, 480);
this.Controls.Add(this.ctrlDescriptionPanel1);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.lbHeight);
this.Controls.Add(this.nmInsertAfterLayer);
this.Controls.Add(this.lbLayerRange);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.btnCancel);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmToolLayerImport";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Import layer(s)";
this.TopMost = true;
((System.ComponentModel.ISupportInitialize)(this.nmInsertAfterLayer)).EndInit();
this.cmLayerRange.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Label lbLayerRange;
private System.Windows.Forms.NumericUpDown nmInsertAfterLayer;
private System.Windows.Forms.ContextMenuStrip cmLayerRange;
private System.Windows.Forms.ToolStripMenuItem btnLayerRangeAllLayers;
private System.Windows.Forms.ToolStripMenuItem btnLayerRangeCurrentLayer;
private System.Windows.Forms.ToolStripMenuItem btnLayerRangeBottomLayers;
private System.Windows.Forms.ToolStripMenuItem btnLayerRangeNormalLayers;
private System.Windows.Forms.Label lbHeight;
private System.Windows.Forms.CheckBox checkBox1;
private CtrlDescriptionPanel ctrlDescriptionPanel1;
}
}
+155
View File
@@ -0,0 +1,155 @@
/*
* GNU AFFERO GENERAL PUBLIC LICENSE
* Version 3, 19 November 2007
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
using System;
using System.Windows.Forms;
namespace UVtools.GUI.Forms
{
public partial class FrmToolLayerImport : Form
{
#region Properties
public uint InsertAfterLayer
{
get => (uint) nmInsertAfterLayer.Value;
set => nmInsertAfterLayer.Value = value;
}
#endregion
#region Constructors
public FrmToolLayerImport(int layerIndex = -1)
{
InitializeComponent();
//nmLayerRangeEnd.Value = Program.SlicerFile.LayerCount - 1;
if (layerIndex > 0)
{
nmInsertAfterLayer.Value = layerIndex;
}
EventValueChanged(nmInsertAfterLayer, null);
}
#endregion
#region Overrides
protected override void OnKeyUp(KeyEventArgs e)
{
base.OnKeyUp(e);
if (e.KeyCode == Keys.Enter)
{
btnOk.PerformClick();
e.Handled = true;
return;
}
if ((ModifierKeys & Keys.Shift) == Keys.Shift && (ModifierKeys & Keys.Control) == Keys.Control)
{
if (e.KeyCode == Keys.A)
{
btnLayerRangeAllLayers.PerformClick();
e.Handled = true;
return;
}
if (e.KeyCode == Keys.C)
{
btnLayerRangeCurrentLayer.PerformClick();
e.Handled = true;
return;
}
if (e.KeyCode == Keys.B)
{
btnLayerRangeBottomLayers.PerformClick();
e.Handled = true;
return;
}
if (e.KeyCode == Keys.N)
{
btnLayerRangeNormalLayers.PerformClick();
e.Handled = true;
return;
}
}
}
#endregion
#region Events
private void EventClick(object sender, EventArgs e)
{
/*if (ReferenceEquals(sender, btnLayerRangeAllLayers))
{
nmInsertAfterLayer.Value = 0;
nmLayerRangeEnd.Value = Program.SlicerFile.LayerCount-1;
return;
}
if (ReferenceEquals(sender, btnLayerRangeCurrentLayer))
{
nmInsertAfterLayer.Value = Program.FrmMain.ActualLayer;
nmLayerRangeEnd.Value = Program.FrmMain.ActualLayer;
return;
}
if (ReferenceEquals(sender, btnLayerRangeBottomLayers))
{
nmInsertAfterLayer.Value = 0;
nmLayerRangeEnd.Value = Program.SlicerFile.InitialLayerCount-1;
return;
}
if (ReferenceEquals(sender, btnLayerRangeNormalLayers))
{
nmInsertAfterLayer.Value = Program.SlicerFile.InitialLayerCount - 1;
nmLayerRangeEnd.Value = Program.SlicerFile.LayerCount - 1;
return;
}
if (ReferenceEquals(sender, btnOk))
{
if (!btnOk.Enabled) return;
if (LayerRangeStart > LayerRangeEnd)
{
MessageBox.Show("Layer range start can't be higher than layer end.\nPlease fix and try again.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
nmInsertAfterLayer.Select();
return;
}
if (MessageBox.Show($"Are you sure you want to clone the selected layers times {nmClones.Value}?", Text, MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.Yes)
{
DialogResult = DialogResult.OK;
Close();
}
return;
}*/
if (ReferenceEquals(sender, btnCancel))
{
DialogResult = DialogResult.Cancel;
return;
}
}
#endregion
private void EventValueChanged(object sender, EventArgs e)
{
/*uint extraLayers = (uint) Math.Max(0, (nmLayerRangeEnd.Value - nmInsertAfterLayer.Value + 1) * nmClones.Value);
float extraHeight = (float) Math.Round(extraLayers * Program.SlicerFile.LayerHeight, 2);
lbLayersCount.Text = $"Layers: {Program.SlicerFile.TotalHeight} → {Program.SlicerFile.TotalHeight + extraLayers} (+ {extraLayers})";
lbHeights.Text = $"Heights: {Program.SlicerFile.TotalHeight}mm → {Program.SlicerFile.TotalHeight + extraHeight}mm (+ {extraHeight}mm)";*/
}
}
}
File diff suppressed because it is too large Load Diff
+364
View File
@@ -0,0 +1,364 @@
using UVtools.GUI.Controls;
namespace UVtools.GUI.Forms
{
partial class FrmToolWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmToolWindow));
this.pnDescription = new System.Windows.Forms.Panel();
this.lbDescription = new System.Windows.Forms.Label();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
this.pnActions = new System.Windows.Forms.Panel();
this.pnContent = new System.Windows.Forms.Panel();
this.pnLayerRange = new System.Windows.Forms.Panel();
this.gbLayerRange = new System.Windows.Forms.GroupBox();
this.lbLayerRangeFromMM = new System.Windows.Forms.Label();
this.lbLayerRangeToMM = new System.Windows.Forms.Label();
this.nmLayerRangeEnd = new System.Windows.Forms.NumericUpDown();
this.cmLayerRange = new System.Windows.Forms.ContextMenuStrip(this.components);
this.btnLayerRangeAllLayers = new System.Windows.Forms.ToolStripMenuItem();
this.btnLayerRangeCurrentLayer = new System.Windows.Forms.ToolStripMenuItem();
this.btnLayerRangeBottomLayers = new System.Windows.Forms.ToolStripMenuItem();
this.btnLayerRangeNormalLayers = new System.Windows.Forms.ToolStripMenuItem();
this.lbLayerRange = new System.Windows.Forms.Label();
this.lbLayerRangeTo = new System.Windows.Forms.Label();
this.nmLayerRangeStart = new System.Windows.Forms.NumericUpDown();
this.btnLayerRangeSelect = new UVtools.GUI.Controls.SplitButton();
this.label1 = new System.Windows.Forms.Label();
this.pnDescription.SuspendLayout();
this.pnActions.SuspendLayout();
this.pnLayerRange.SuspendLayout();
this.gbLayerRange.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeEnd)).BeginInit();
this.cmLayerRange.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeStart)).BeginInit();
this.SuspendLayout();
//
// pnDescription
//
this.pnDescription.AutoSize = true;
this.pnDescription.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.pnDescription.BackColor = System.Drawing.Color.WhiteSmoke;
this.pnDescription.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pnDescription.Controls.Add(this.lbDescription);
this.pnDescription.Dock = System.Windows.Forms.DockStyle.Top;
this.pnDescription.Location = new System.Drawing.Point(0, 0);
this.pnDescription.Name = "pnDescription";
this.pnDescription.Size = new System.Drawing.Size(547, 62);
this.pnDescription.TabIndex = 7;
//
// lbDescription
//
this.lbDescription.AutoSize = true;
this.lbDescription.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbDescription.Location = new System.Drawing.Point(0, 0);
this.lbDescription.Name = "lbDescription";
this.lbDescription.Padding = new System.Windows.Forms.Padding(20);
this.lbDescription.Size = new System.Drawing.Size(129, 60);
this.lbDescription.TabIndex = 1;
this.lbDescription.Text = "Description";
this.lbDescription.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Image = global::UVtools.GUI.Properties.Resources.Cancel_24x24;
this.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnCancel.Location = new System.Drawing.Point(383, 15);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
this.btnCancel.Size = new System.Drawing.Size(150, 48);
this.btnCancel.TabIndex = 6;
this.btnCancel.Text = "&Cancel";
this.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.EventClick);
//
// btnOk
//
this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOk.Image = global::UVtools.GUI.Properties.Resources.Ok_24x24;
this.btnOk.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnOk.Location = new System.Drawing.Point(225, 15);
this.btnOk.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnOk.Name = "btnOk";
this.btnOk.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
this.btnOk.Size = new System.Drawing.Size(150, 48);
this.btnOk.TabIndex = 5;
this.btnOk.Text = "&Ok";
this.btnOk.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.EventClick);
//
// pnActions
//
this.pnActions.BackColor = System.Drawing.Color.WhiteSmoke;
this.pnActions.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pnActions.Controls.Add(this.btnCancel);
this.pnActions.Controls.Add(this.btnOk);
this.pnActions.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnActions.Location = new System.Drawing.Point(0, 402);
this.pnActions.Name = "pnActions";
this.pnActions.Size = new System.Drawing.Size(547, 78);
this.pnActions.TabIndex = 8;
//
// pnContent
//
this.pnContent.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnContent.Location = new System.Drawing.Point(0, 154);
this.pnContent.Name = "pnContent";
this.pnContent.Size = new System.Drawing.Size(547, 248);
this.pnContent.TabIndex = 9;
//
// pnLayerRange
//
this.pnLayerRange.Controls.Add(this.gbLayerRange);
this.pnLayerRange.Dock = System.Windows.Forms.DockStyle.Top;
this.pnLayerRange.Location = new System.Drawing.Point(0, 62);
this.pnLayerRange.Name = "pnLayerRange";
this.pnLayerRange.Size = new System.Drawing.Size(547, 92);
this.pnLayerRange.TabIndex = 0;
//
// gbLayerRange
//
this.gbLayerRange.Controls.Add(this.label1);
this.gbLayerRange.Controls.Add(this.lbLayerRangeFromMM);
this.gbLayerRange.Controls.Add(this.lbLayerRangeToMM);
this.gbLayerRange.Controls.Add(this.nmLayerRangeEnd);
this.gbLayerRange.Controls.Add(this.btnLayerRangeSelect);
this.gbLayerRange.Controls.Add(this.lbLayerRange);
this.gbLayerRange.Controls.Add(this.lbLayerRangeTo);
this.gbLayerRange.Controls.Add(this.nmLayerRangeStart);
this.gbLayerRange.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbLayerRange.Location = new System.Drawing.Point(0, 0);
this.gbLayerRange.Name = "gbLayerRange";
this.gbLayerRange.Size = new System.Drawing.Size(547, 92);
this.gbLayerRange.TabIndex = 19;
this.gbLayerRange.TabStop = false;
this.gbLayerRange.Text = "Layer Range Selector";
//
// lbLayerRangeFromMM
//
this.lbLayerRangeFromMM.Location = new System.Drawing.Point(65, 58);
this.lbLayerRangeFromMM.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbLayerRangeFromMM.Name = "lbLayerRangeFromMM";
this.lbLayerRangeFromMM.Size = new System.Drawing.Size(120, 20);
this.lbLayerRangeFromMM.TabIndex = 20;
this.lbLayerRangeFromMM.Text = "From mm";
this.lbLayerRangeFromMM.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lbLayerRangeToMM
//
this.lbLayerRangeToMM.Location = new System.Drawing.Point(232, 58);
this.lbLayerRangeToMM.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbLayerRangeToMM.Name = "lbLayerRangeToMM";
this.lbLayerRangeToMM.Size = new System.Drawing.Size(120, 20);
this.lbLayerRangeToMM.TabIndex = 19;
this.lbLayerRangeToMM.Text = "(mm)";
this.lbLayerRangeToMM.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// nmLayerRangeEnd
//
this.nmLayerRangeEnd.Location = new System.Drawing.Point(232, 27);
this.nmLayerRangeEnd.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.nmLayerRangeEnd.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.nmLayerRangeEnd.Name = "nmLayerRangeEnd";
this.nmLayerRangeEnd.Size = new System.Drawing.Size(120, 26);
this.nmLayerRangeEnd.TabIndex = 14;
this.nmLayerRangeEnd.ValueChanged += new System.EventHandler(this.EventValueChanged);
//
// cmLayerRange
//
this.cmLayerRange.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnLayerRangeAllLayers,
this.btnLayerRangeCurrentLayer,
this.btnLayerRangeBottomLayers,
this.btnLayerRangeNormalLayers});
this.cmLayerRange.Name = "cmLayerRange";
this.cmLayerRange.Size = new System.Drawing.Size(226, 92);
//
// btnLayerRangeAllLayers
//
this.btnLayerRangeAllLayers.Name = "btnLayerRangeAllLayers";
this.btnLayerRangeAllLayers.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.A)));
this.btnLayerRangeAllLayers.Size = new System.Drawing.Size(225, 22);
this.btnLayerRangeAllLayers.Text = "&All Layers";
this.btnLayerRangeAllLayers.Click += new System.EventHandler(this.EventClick);
//
// btnLayerRangeCurrentLayer
//
this.btnLayerRangeCurrentLayer.Name = "btnLayerRangeCurrentLayer";
this.btnLayerRangeCurrentLayer.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.C)));
this.btnLayerRangeCurrentLayer.Size = new System.Drawing.Size(225, 22);
this.btnLayerRangeCurrentLayer.Text = "&Current Layer";
this.btnLayerRangeCurrentLayer.Click += new System.EventHandler(this.EventClick);
//
// btnLayerRangeBottomLayers
//
this.btnLayerRangeBottomLayers.Name = "btnLayerRangeBottomLayers";
this.btnLayerRangeBottomLayers.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.B)));
this.btnLayerRangeBottomLayers.Size = new System.Drawing.Size(225, 22);
this.btnLayerRangeBottomLayers.Text = "&Bottom Layers";
this.btnLayerRangeBottomLayers.Click += new System.EventHandler(this.EventClick);
//
// btnLayerRangeNormalLayers
//
this.btnLayerRangeNormalLayers.Name = "btnLayerRangeNormalLayers";
this.btnLayerRangeNormalLayers.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.N)));
this.btnLayerRangeNormalLayers.Size = new System.Drawing.Size(225, 22);
this.btnLayerRangeNormalLayers.Text = "&Normal Layers";
this.btnLayerRangeNormalLayers.Click += new System.EventHandler(this.EventClick);
//
// lbLayerRange
//
this.lbLayerRange.AutoSize = true;
this.lbLayerRange.Location = new System.Drawing.Point(7, 30);
this.lbLayerRange.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbLayerRange.Name = "lbLayerRange";
this.lbLayerRange.Size = new System.Drawing.Size(50, 20);
this.lbLayerRange.TabIndex = 16;
this.lbLayerRange.Text = "From:";
//
// lbLayerRangeTo
//
this.lbLayerRangeTo.AutoSize = true;
this.lbLayerRangeTo.Location = new System.Drawing.Point(193, 30);
this.lbLayerRangeTo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbLayerRangeTo.Name = "lbLayerRangeTo";
this.lbLayerRangeTo.Size = new System.Drawing.Size(31, 20);
this.lbLayerRangeTo.TabIndex = 17;
this.lbLayerRangeTo.Text = "To:";
//
// nmLayerRangeStart
//
this.nmLayerRangeStart.Location = new System.Drawing.Point(65, 27);
this.nmLayerRangeStart.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.nmLayerRangeStart.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.nmLayerRangeStart.Name = "nmLayerRangeStart";
this.nmLayerRangeStart.Size = new System.Drawing.Size(120, 26);
this.nmLayerRangeStart.TabIndex = 13;
this.nmLayerRangeStart.ValueChanged += new System.EventHandler(this.EventValueChanged);
//
// btnLayerRangeSelect
//
this.btnLayerRangeSelect.Location = new System.Drawing.Point(359, 27);
this.btnLayerRangeSelect.Menu = this.cmLayerRange;
this.btnLayerRangeSelect.Name = "btnLayerRangeSelect";
this.btnLayerRangeSelect.Size = new System.Drawing.Size(175, 26);
this.btnLayerRangeSelect.TabIndex = 18;
this.btnLayerRangeSelect.Text = "Select";
this.btnLayerRangeSelect.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.Location = new System.Drawing.Point(359, 58);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(175, 20);
this.label1.TabIndex = 21;
this.label1.Text = "(layers)";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// FrmToolWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(547, 480);
this.Controls.Add(this.pnContent);
this.Controls.Add(this.pnLayerRange);
this.Controls.Add(this.pnActions);
this.Controls.Add(this.pnDescription);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmToolWindow";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "UVtools ToolWindow";
this.TopMost = true;
this.pnDescription.ResumeLayout(false);
this.pnDescription.PerformLayout();
this.pnActions.ResumeLayout(false);
this.pnLayerRange.ResumeLayout(false);
this.gbLayerRange.ResumeLayout(false);
this.gbLayerRange.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeEnd)).EndInit();
this.cmLayerRange.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeStart)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public System.Windows.Forms.Panel pnActions;
public System.Windows.Forms.Button btnCancel;
public System.Windows.Forms.Button btnOk;
public System.Windows.Forms.Panel pnDescription;
public System.Windows.Forms.Label lbDescription;
private System.Windows.Forms.Panel pnContent;
private System.Windows.Forms.Panel pnLayerRange;
private System.Windows.Forms.ContextMenuStrip cmLayerRange;
private System.Windows.Forms.ToolStripMenuItem btnLayerRangeAllLayers;
private System.Windows.Forms.ToolStripMenuItem btnLayerRangeCurrentLayer;
private System.Windows.Forms.ToolStripMenuItem btnLayerRangeBottomLayers;
private System.Windows.Forms.ToolStripMenuItem btnLayerRangeNormalLayers;
public System.Windows.Forms.Label lbLayerRangeTo;
public System.Windows.Forms.NumericUpDown nmLayerRangeEnd;
public System.Windows.Forms.NumericUpDown nmLayerRangeStart;
public System.Windows.Forms.Label lbLayerRange;
public System.Windows.Forms.GroupBox gbLayerRange;
public SplitButton btnLayerRangeSelect;
public System.Windows.Forms.Label lbLayerRangeToMM;
public System.Windows.Forms.Label lbLayerRangeFromMM;
public System.Windows.Forms.Label label1;
}
}
+245
View File
@@ -0,0 +1,245 @@
/*
* GNU AFFERO GENERAL PUBLIC LICENSE
* Version 3, 19 November 2007
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms;
namespace UVtools.GUI.Forms
{
public partial class FrmToolWindow : Form
{
#region Properties
public string Description
{
get => lbDescription.Text;
set => lbDescription.Text = value;
}
[Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
[SettingsBindable(true)]
public string ButtonOkText
{
get => btnOk.Text;
set => btnOk.Text = value;
}
[Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
[SettingsBindable(true)]
public string ButtonCancelText
{
get => btnOk.Text;
set => btnOk.Text = value;
}
[SettingsBindable(true)]
public bool LayerRangeVisible
{
get => pnLayerRange.Visible;
set => pnLayerRange.Visible = value;
}
[SettingsBindable(true)]
public bool LayerRangeEndVisible
{
get => nmLayerRangeEnd.Visible;
set =>
nmLayerRangeEnd.Visible =
lbLayerRangeTo.Visible =
lbLayerRangeToMM.Visible =
btnLayerRangeSelect.Visible = value;
}
[SettingsBindable(true)]
public uint LayerRangeStart
{
get => (uint)nmLayerRangeStart.Value;
set => nmLayerRangeStart.Value = value;
}
[SettingsBindable(true)]
public uint LayerRangeEnd
{
get => (uint)Math.Min(nmLayerRangeEnd.Value, Program.SlicerFile.LayerCount - 1);
set => nmLayerRangeEnd.Value = value;
}
[Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
[SettingsBindable(true)]
public virtual string ConfirmationText { get; } = "do this action?";
#endregion
#region Constructors
public FrmToolWindow()
{
InitializeComponent();
}
public FrmToolWindow(string description, string buttonOkText, bool layerRangeVisible = true) : this()
{
Description = description;
ButtonOkText = buttonOkText;
LayerRangeVisible = layerRangeVisible;
LayerRangeEnd = Program.SlicerFile.LayerCount - 1;
EventValueChanged(nmLayerRangeStart, EventArgs.Empty);
EventValueChanged(nmLayerRangeEnd, EventArgs.Empty);
}
public FrmToolWindow(string description, string buttonOkText, uint layerIndex) : this(description, buttonOkText)
{
LayerRangeStart = LayerRangeEnd = layerIndex;
}
#endregion
#region Overrides
protected override void OnKeyUp(KeyEventArgs e)
{
base.OnKeyUp(e);
if (e.KeyCode == Keys.Enter)
{
btnOk.PerformClick();
e.Handled = true;
return;
}
if ((ModifierKeys & Keys.Shift) == Keys.Shift && (ModifierKeys & Keys.Control) == Keys.Control)
{
if (e.KeyCode == Keys.A)
{
btnLayerRangeAllLayers.PerformClick();
e.Handled = true;
return;
}
if (e.KeyCode == Keys.C)
{
btnLayerRangeCurrentLayer.PerformClick();
e.Handled = true;
return;
}
if (e.KeyCode == Keys.B)
{
btnLayerRangeBottomLayers.PerformClick();
e.Handled = true;
return;
}
if (e.KeyCode == Keys.N)
{
btnLayerRangeNormalLayers.PerformClick();
e.Handled = true;
return;
}
}
}
#endregion
#region Events
private void EventClick(object sender, EventArgs e)
{
if (ReferenceEquals(sender, btnLayerRangeAllLayers))
{
nmLayerRangeStart.Value = 0;
nmLayerRangeEnd.Value = Program.SlicerFile.LayerCount-1;
return;
}
if (ReferenceEquals(sender, btnLayerRangeCurrentLayer))
{
nmLayerRangeStart.Value = Program.FrmMain.ActualLayer;
nmLayerRangeEnd.Value = Program.FrmMain.ActualLayer;
return;
}
if (ReferenceEquals(sender, btnLayerRangeBottomLayers))
{
nmLayerRangeStart.Value = 0;
nmLayerRangeEnd.Value = Program.SlicerFile.InitialLayerCount-1;
return;
}
if (ReferenceEquals(sender, btnLayerRangeNormalLayers))
{
nmLayerRangeStart.Value = Program.SlicerFile.InitialLayerCount - 1;
nmLayerRangeEnd.Value = Program.SlicerFile.LayerCount - 1;
return;
}
if (ReferenceEquals(sender, btnOk))
{
if (!btnOk.Enabled) return;
if (!ValidateForm()) return;
if (MessageBox.Show($"Are you sure you want to {ConfirmationText}", Text, MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.Yes)
{
DialogResult = DialogResult.OK;
Close();
}
return;
}
if (ReferenceEquals(sender, btnCancel))
{
DialogResult = DialogResult.Cancel;
return;
}
}
private void EventValueChanged(object sender, EventArgs e)
{
if (ReferenceEquals(sender, nmLayerRangeStart) || ReferenceEquals(sender, nmLayerRangeEnd))
{
uint layerIndex = (uint) ((NumericUpDown) sender).Value;
if (layerIndex >= Program.SlicerFile.LayerCount) return;
var layer = Program.SlicerFile[layerIndex];
var text = $"({layer.PositionZ}mm)";
if (ReferenceEquals(sender, nmLayerRangeStart))
{
lbLayerRangeFromMM.Text = text;
return;
}
if (ReferenceEquals(sender, nmLayerRangeEnd))
{
lbLayerRangeToMM.Text = text;
return;
}
return;
}
}
#endregion
#region Methods
public virtual bool ValidateForm()
{
if (LayerRangeStart > LayerRangeEnd)
{
MessageBox.Show("Layer range start can't be higher than layer end.\nPlease fix and try again.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
nmLayerRangeStart.Select();
return false;
}
return true;
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
+15 -15
View File
@@ -254,6 +254,7 @@ namespace UVtools.GUI
this.panelLayerNavigation = new System.Windows.Forms.Panel();
this.pbTrackerIssues = new System.Windows.Forms.PictureBox();
this.lbActualLayer = new System.Windows.Forms.Label();
this.tbLayer = new UVtools.GUI.Controls.TrackBarEx();
this.lbInitialLayer = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.btnFindLayer = new System.Windows.Forms.Button();
@@ -264,7 +265,6 @@ namespace UVtools.GUI
this.toolTipInformation = new System.Windows.Forms.ToolTip(this.components);
this.layerScrollTimer = new System.Windows.Forms.Timer(this.components);
this.mouseHoldTimer = new System.Windows.Forms.Timer(this.components);
this.tbLayer = new UVtools.GUI.Controls.TrackBarEx();
this.menu.SuspendLayout();
this.mainTable.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.scCenter)).BeginInit();
@@ -323,8 +323,8 @@ namespace UVtools.GUI
this.tlRight.SuspendLayout();
this.panelLayerNavigation.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbTrackerIssues)).BeginInit();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tbLayer)).BeginInit();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// menu
@@ -2816,6 +2816,18 @@ namespace UVtools.GUI
this.lbActualLayer.TabIndex = 9;
this.lbActualLayer.Text = "?";
//
// tbLayer
//
this.tbLayer.Dock = System.Windows.Forms.DockStyle.Right;
this.tbLayer.Location = new System.Drawing.Point(93, 0);
this.tbLayer.Margin = new System.Windows.Forms.Padding(0);
this.tbLayer.Name = "tbLayer";
this.tbLayer.Orientation = System.Windows.Forms.Orientation.Vertical;
this.tbLayer.Size = new System.Drawing.Size(45, 557);
this.tbLayer.TabIndex = 8;
this.tbLayer.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
this.tbLayer.ValueChanged += new System.EventHandler(this.ValueChanged);
//
// lbInitialLayer
//
this.lbInitialLayer.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -2906,18 +2918,6 @@ namespace UVtools.GUI
this.mouseHoldTimer.Interval = 1000;
this.mouseHoldTimer.Tick += new System.EventHandler(this.EventTimerTick);
//
// tbLayer
//
this.tbLayer.Dock = System.Windows.Forms.DockStyle.Right;
this.tbLayer.Location = new System.Drawing.Point(93, 0);
this.tbLayer.Margin = new System.Windows.Forms.Padding(0);
this.tbLayer.Name = "tbLayer";
this.tbLayer.Orientation = System.Windows.Forms.Orientation.Vertical;
this.tbLayer.Size = new System.Drawing.Size(45, 557);
this.tbLayer.TabIndex = 8;
this.tbLayer.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
this.tbLayer.ValueChanged += new System.EventHandler(this.ValueChanged);
//
// FrmMain
//
this.AllowDrop = true;
@@ -3024,8 +3024,8 @@ namespace UVtools.GUI
this.panelLayerNavigation.ResumeLayout(false);
this.panelLayerNavigation.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbTrackerIssues)).EndInit();
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.tbLayer)).EndInit();
this.panel2.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
+10
View File
@@ -1157,6 +1157,16 @@ namespace UVtools.GUI
}
}
if (ReferenceEquals(sender, btnLayerImageActionImport))
{
using (var frm = new FrmToolWindow("Test", "Ok", ActualLayer))
{
frm.ShowDialog();
}
return;
}
if (ReferenceEquals(sender, menuToolsLayerClone) || ReferenceEquals(sender, btnLayerImageActionClone))
{
using (var frm = new FrmToolLayerClone((int)ActualLayer))
+1 -1
View File
@@ -158,7 +158,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABk
FAAAAk1TRnQBSQFMAgEBBgEAATgBCgE4AQoBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
FAAAAk1TRnQBSQFMAgEBBgEAAUABCgFAAQoBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
AwABIAMAAQEBAAEgBgABIC4AAxgBIgMwAUsDMAFMAzIBUDMAAQEDJAE2AysBQqwAAyIBMQNWAbkDXQHi
AwAB/wMAAf8BKgEtASgB/gNTAawDTQGVAwABARgAAwkBDAMzAVIDUAGdA1cB6AMAAf4DKwH8Ay8BSqQA
AyEBMANZAewBKwEuASkB+gNRAfcDUgH0A1MB8QNIAfYDQQH5AwAB/wNPAZsDAAEBCAADFQEdAz8BbgNV
+27
View File
@@ -152,6 +152,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Controls\BenchmarkTest.cs" />
<Compile Include="Controls\CtrlDescriptionPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\CtrlDescriptionPanel.Designer.cs">
<DependentUpon>CtrlDescriptionPanel.cs</DependentUpon>
</Compile>
<Compile Include="Controls\CtrlKernel.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -209,6 +215,18 @@
<Compile Include="Forms\FrmToolChangeResolution.Designer.cs">
<DependentUpon>FrmToolChangeResolution.cs</DependentUpon>
</Compile>
<Compile Include="Forms\FrmToolWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\FrmToolWindow.Designer.cs">
<DependentUpon>FrmToolWindow.cs</DependentUpon>
</Compile>
<Compile Include="Forms\FrmToolLayerImport.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\FrmToolLayerImport.Designer.cs">
<DependentUpon>FrmToolLayerImport.cs</DependentUpon>
</Compile>
<Compile Include="Forms\FrmToolLayerReHeight.cs">
<SubType>Form</SubType>
</Compile>
@@ -303,6 +321,9 @@
<Compile Include="Mutation.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Controls\CtrlDescriptionPanel.resx">
<DependentUpon>CtrlDescriptionPanel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\CtrlKernel.resx">
<DependentUpon>CtrlKernel.cs</DependentUpon>
</EmbeddedResource>
@@ -330,6 +351,12 @@
<EmbeddedResource Include="Forms\FrmToolChangeResolution.resx">
<DependentUpon>FrmToolChangeResolution.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\FrmToolWindow.resx">
<DependentUpon>FrmToolWindow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\FrmToolLayerImport.resx">
<DependentUpon>FrmToolLayerImport.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\FrmToolLayerReHeight.resx">
<DependentUpon>FrmToolLayerReHeight.cs</DependentUpon>
</EmbeddedResource>