Futher toolwindow implementation

This commit is contained in:
Tiago Conceição
2020-09-06 21:38:19 +01:00
parent 22e4eacee6
commit 40b9cb9429
15 changed files with 577 additions and 2612 deletions
+47
View File
@@ -0,0 +1,47 @@
namespace UVtools.GUI.Controls
{
partial class CtrlToolWindowContent
{
/// <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.SuspendLayout();
//
// CtrlToolWindowContent
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.MinimumSize = new System.Drawing.Size(563, 0);
this.Name = "CtrlToolWindowContent";
this.Size = new System.Drawing.Size(563, 261);
this.ResumeLayout(false);
}
#endregion
}
}
@@ -0,0 +1,59 @@
/*
* 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.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms;
namespace UVtools.GUI.Controls
{
public partial class CtrlToolWindowContent : UserControl
{
#region Properties
[Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
[SettingsBindable(true)]
public string Description { get; set; }
[Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
[SettingsBindable(true)]
public string ButtonOkText { get; set; } = "Ok";
[Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
[SettingsBindable(true)]
public string ButtonCancelText { get; set; } = "Cancel";
[SettingsBindable(true)] public bool LayerRangeVisible { get; set; } = true;
[SettingsBindable(true)] public bool LayerRangeEndVisible { get; set; } = true;
/*[SettingsBindable(true)]
public uint LayerRangeStart { get; set; }
[SettingsBindable(true)]
public uint LayerRangeEnd { get; set; }*/
[Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
[SettingsBindable(true)]
public virtual string ConfirmationText { get; } = "do this action?";
#endregion
#region Constructor
public CtrlToolWindowContent()
{
InitializeComponent();
}
#endregion
#region Methods
public virtual bool ValidateForm() => true;
#endregion
}
}
@@ -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>
+109
View File
@@ -0,0 +1,109 @@
namespace UVtools.GUI.Controls.Tools
{
partial class CtrlToolLayerImport
{
/// <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.checkBox1 = new System.Windows.Forms.CheckBox();
this.lbHeight = new System.Windows.Forms.Label();
this.nmInsertAfterLayer = new System.Windows.Forms.NumericUpDown();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.nmInsertAfterLayer)).BeginInit();
this.SuspendLayout();
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(212, 74);
this.checkBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(153, 24);
this.checkBox1.TabIndex = 33;
this.checkBox1.Text = "Replace this layer";
this.checkBox1.UseVisualStyleBackColor = true;
//
// lbHeight
//
this.lbHeight.AutoSize = true;
this.lbHeight.Location = new System.Drawing.Point(376, 116);
this.lbHeight.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.lbHeight.Name = "lbHeight";
this.lbHeight.Size = new System.Drawing.Size(85, 20);
this.lbHeight.TabIndex = 32;
this.lbHeight.Text = "(10.10mm)";
//
// nmInsertAfterLayer
//
this.nmInsertAfterLayer.Location = new System.Drawing.Point(230, 111);
this.nmInsertAfterLayer.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8);
this.nmInsertAfterLayer.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.nmInsertAfterLayer.Name = "nmInsertAfterLayer";
this.nmInsertAfterLayer.Size = new System.Drawing.Size(135, 26);
this.nmInsertAfterLayer.TabIndex = 30;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(26, 116);
this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(128, 20);
this.label1.TabIndex = 31;
this.label1.Text = "Insert after layer:";
//
// CtrlToolLayerImport
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.lbHeight);
this.Controls.Add(this.nmInsertAfterLayer);
this.Controls.Add(this.label1);
this.Description = "Import layer(s) from local files into a selected height.\r\nNOTE: Images must respe" +
"ct file resolution and greyscale color.";
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 = "CtrlToolLayerImport";
this.Size = new System.Drawing.Size(563, 263);
((System.ComponentModel.ISupportInitialize)(this.nmInsertAfterLayer)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Label lbHeight;
private System.Windows.Forms.NumericUpDown nmInsertAfterLayer;
private System.Windows.Forms.Label label1;
}
}
@@ -0,0 +1,23 @@
/*
* 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.
*/
namespace UVtools.GUI.Controls.Tools
{
public partial class CtrlToolLayerImport : CtrlToolWindowContent
{
public CtrlToolLayerImport()
{
InitializeComponent();
}
public override bool ValidateForm()
{
return true;
}
}
}
@@ -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
@@ -1,233 +0,0 @@
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
@@ -1,155 +0,0 @@
/*
* 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
-2
View File
@@ -7,9 +7,7 @@
*/
using System;
using System.Linq;
using System.Windows.Forms;
using UVtools.Core;
namespace UVtools.GUI.Forms
{
+6 -5
View File
@@ -125,18 +125,19 @@ namespace UVtools.GUI.Forms
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, 386);
this.pnActions.Location = new System.Drawing.Point(0, 182);
this.pnActions.Name = "pnActions";
this.pnActions.Size = new System.Drawing.Size(547, 78);
this.pnActions.TabIndex = 8;
//
// pnContent
//
this.pnContent.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.pnContent.BackColor = System.Drawing.Color.White;
this.pnContent.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnContent.Location = new System.Drawing.Point(0, 170);
this.pnContent.Name = "pnContent";
this.pnContent.Size = new System.Drawing.Size(547, 216);
this.pnContent.Size = new System.Drawing.Size(547, 12);
this.pnContent.TabIndex = 9;
//
// pnLayerRange
@@ -308,7 +309,7 @@ namespace UVtools.GUI.Forms
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, 464);
this.ClientSize = new System.Drawing.Size(547, 260);
this.Controls.Add(this.pnContent);
this.Controls.Add(this.pnLayerRange);
this.Controls.Add(this.pnActions);
@@ -320,7 +321,7 @@ namespace UVtools.GUI.Forms
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(563, 0);
this.MinimumSize = new System.Drawing.Size(563, 39);
this.Name = "FrmToolWindow";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
@@ -347,7 +348,6 @@ namespace UVtools.GUI.Forms
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;
@@ -363,5 +363,6 @@ namespace UVtools.GUI.Forms
public System.Windows.Forms.Label lbLayerRangeToMM;
public System.Windows.Forms.Label lbLayerRangeFromMM;
public System.Windows.Forms.Label lbLayerRangeCount;
public System.Windows.Forms.Panel pnContent;
}
}
+25 -3
View File
@@ -11,6 +11,7 @@ using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;
using UVtools.GUI.Controls;
namespace UVtools.GUI.Forms
{
@@ -18,6 +19,10 @@ namespace UVtools.GUI.Forms
{
#region Properties
public CtrlToolWindowContent Content { get; set; }
[Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
[SettingsBindable(true)]
public string Description
{
get => lbDescription.Text;
@@ -58,14 +63,16 @@ namespace UVtools.GUI.Forms
btnLayerRangeSelect.Visible = value;
}
[SettingsBindable(true)]
[ReadOnly(true)]
[Browsable(false)]
public uint LayerRangeStart
{
get => (uint)nmLayerRangeStart.Value;
set => nmLayerRangeStart.Value = value;
}
[SettingsBindable(true)]
[ReadOnly(true)]
[Browsable(false)]
public uint LayerRangeEnd
{
get => (uint)Math.Min(nmLayerRangeEnd.Value, Program.SlicerFile.LayerCount - 1);
@@ -101,6 +108,20 @@ namespace UVtools.GUI.Forms
{
LayerRangeStart = LayerRangeEnd = layerIndex;
}
public FrmToolWindow(CtrlToolWindowContent content, bool layerRangeVisible = true) : this(content.Description, content.ButtonOkText, layerRangeVisible)
{
pnContent.Controls.Add(content);
Width = Math.Max(MinimumSize.Width, content.Width);
Height += content.Height;
content.Dock = DockStyle.Fill;
Content = content;
}
public FrmToolWindow(CtrlToolWindowContent content, uint layerIndex) : this(content)
{
LayerRangeStart = LayerRangeEnd = layerIndex;
}
#endregion
#region Overrides
@@ -202,8 +223,9 @@ namespace UVtools.GUI.Forms
}
if (!ValidateForm()) return;
if (!ReferenceEquals(Content, null) && !ValidateForm()) return;
if (MessageBox.Show($"Are you sure you want to {ConfirmationText}", Text, MessageBoxButtons.YesNo,
if (MessageBox.Show($"Are you sure you want to {Content?.ConfirmationText ?? ConfirmationText}", Text, MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.Yes)
{
DialogResult = DialogResult.OK;
+48
View File
@@ -117,9 +117,57 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="pnDescription.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lbDescription.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnCancel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnOk.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pnActions.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pnContent.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pnLayerRange.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="gbLayerRange.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lbLayerRangeCount.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lbLayerRangeFromMM.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lbLayerRangeToMM.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="nmLayerRangeEnd.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnLayerRangeSelect.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cmLayerRange.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="lbLayerRange.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lbLayerRangeTo.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="nmLayerRangeStart.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
+2 -1
View File
@@ -29,6 +29,7 @@ using UVtools.Core.FileFormats;
using UVtools.Core.Operations;
using UVtools.Core.PixelEditor;
using UVtools.GUI.Controls;
using UVtools.GUI.Controls.Tools;
using UVtools.GUI.Extensions;
using UVtools.GUI.Forms;
using UVtools.GUI.Properties;
@@ -1159,7 +1160,7 @@ namespace UVtools.GUI
if (ReferenceEquals(sender, btnLayerImageActionImport))
{
using (var frm = new FrmToolWindow("Test", "Ok", ActualLayer))
using (var frm = new FrmToolWindow(new CtrlToolLayerImport(), ActualLayer))
{
frm.ShowDialog();
}
+18 -9
View File
@@ -164,11 +164,23 @@
<Compile Include="Controls\CtrlKernel.Designer.cs">
<DependentUpon>CtrlKernel.cs</DependentUpon>
</Compile>
<Compile Include="Controls\CtrlToolWindowContent.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\CtrlToolWindowContent.Designer.cs">
<DependentUpon>CtrlToolWindowContent.cs</DependentUpon>
</Compile>
<Compile Include="Controls\LogItem.cs" />
<Compile Include="Controls\SlicerPropertyItem.cs" />
<Compile Include="Controls\SplitButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\Tools\CtrlToolLayerImport.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\Tools\CtrlToolLayerImport.Designer.cs">
<DependentUpon>CtrlToolLayerImport.cs</DependentUpon>
</Compile>
<Compile Include="Controls\TrackBarEx.cs">
<SubType>Component</SubType>
</Compile>
@@ -221,12 +233,6 @@
<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>
@@ -327,6 +333,12 @@
<EmbeddedResource Include="Controls\CtrlKernel.resx">
<DependentUpon>CtrlKernel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\CtrlToolWindowContent.resx">
<DependentUpon>CtrlToolWindowContent.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\Tools\CtrlToolLayerImport.resx">
<DependentUpon>CtrlToolLayerImport.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\FrmAbout.resx">
<DependentUpon>FrmAbout.cs</DependentUpon>
</EmbeddedResource>
@@ -354,9 +366,6 @@
<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>