Change resolution toolwindow convertion

This commit is contained in:
Tiago Conceição
2020-09-08 03:27:25 +01:00
parent b855e0dcbc
commit 018fa885f7
27 changed files with 904 additions and 5485 deletions
-253
View File
@@ -1,253 +0,0 @@
namespace UVtools.GUI.Forms
{
partial class FrmToolChangeResolution
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmToolChangeResolution));
this.lbDescription = new System.Windows.Forms.Label();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
this.lbCurrent = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.cbPreset = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.nmNewX = new System.Windows.Forms.NumericUpDown();
this.label3 = new System.Windows.Forms.Label();
this.nmNewY = new System.Windows.Forms.NumericUpDown();
this.lbObjectVolume = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.nmNewX)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nmNewY)).BeginInit();
this.SuspendLayout();
//
// lbDescription
//
this.lbDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lbDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbDescription.Location = new System.Drawing.Point(13, 14);
this.lbDescription.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbDescription.Name = "lbDescription";
this.lbDescription.Size = new System.Drawing.Size(630, 98);
this.lbDescription.TabIndex = 0;
this.lbDescription.Text = resources.GetString("lbDescription.Text");
//
// 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(491, 226);
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.Right)));
this.btnOk.Enabled = false;
this.btnOk.Image = global::UVtools.GUI.Properties.Resources.Ok_24x24;
this.btnOk.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnOk.Location = new System.Drawing.Point(293, 226);
this.btnOk.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(190, 48);
this.btnOk.TabIndex = 5;
this.btnOk.Text = "Change Resolution";
this.btnOk.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.EventClick);
//
// lbCurrent
//
this.lbCurrent.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lbCurrent.AutoSize = true;
this.lbCurrent.Location = new System.Drawing.Point(12, 112);
this.lbCurrent.Name = "lbCurrent";
this.lbCurrent.Size = new System.Drawing.Size(139, 20);
this.lbCurrent.TabIndex = 7;
this.lbCurrent.Text = "Current resolution:";
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(287, 177);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(59, 20);
this.label2.TabIndex = 8;
this.label2.Text = "Preset:";
//
// cbPreset
//
this.cbPreset.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cbPreset.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbPreset.FormattingEnabled = true;
this.cbPreset.Location = new System.Drawing.Point(352, 173);
this.cbPreset.Name = "cbPreset";
this.cbPreset.Size = new System.Drawing.Size(289, 28);
this.cbPreset.TabIndex = 9;
this.cbPreset.SelectedIndexChanged += new System.EventHandler(this.EventValueChanged);
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 176);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(74, 20);
this.label1.TabIndex = 11;
this.label1.Text = "New X/Y:";
//
// nmNewX
//
this.nmNewX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.nmNewX.Location = new System.Drawing.Point(93, 174);
this.nmNewX.Maximum = new decimal(new int[] {
20000,
0,
0,
0});
this.nmNewX.Minimum = new decimal(new int[] {
100,
0,
0,
0});
this.nmNewX.Name = "nmNewX";
this.nmNewX.Size = new System.Drawing.Size(80, 26);
this.nmNewX.TabIndex = 12;
this.nmNewX.Value = new decimal(new int[] {
100,
0,
0,
0});
this.nmNewX.ValueChanged += new System.EventHandler(this.EventValueChanged);
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(179, 177);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(16, 20);
this.label3.TabIndex = 13;
this.label3.Text = "x";
//
// nmNewY
//
this.nmNewY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.nmNewY.Location = new System.Drawing.Point(201, 174);
this.nmNewY.Maximum = new decimal(new int[] {
20000,
0,
0,
0});
this.nmNewY.Minimum = new decimal(new int[] {
100,
0,
0,
0});
this.nmNewY.Name = "nmNewY";
this.nmNewY.Size = new System.Drawing.Size(80, 26);
this.nmNewY.TabIndex = 14;
this.nmNewY.Value = new decimal(new int[] {
100,
0,
0,
0});
this.nmNewY.ValueChanged += new System.EventHandler(this.EventValueChanged);
//
// lbObjectVolume
//
this.lbObjectVolume.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lbObjectVolume.AutoSize = true;
this.lbObjectVolume.Location = new System.Drawing.Point(13, 144);
this.lbObjectVolume.Name = "lbObjectVolume";
this.lbObjectVolume.Size = new System.Drawing.Size(113, 20);
this.lbObjectVolume.TabIndex = 15;
this.lbObjectVolume.Text = "Object volume:";
//
// FrmToolChangeResolution
//
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(656, 288);
this.Controls.Add(this.lbObjectVolume);
this.Controls.Add(this.nmNewY);
this.Controls.Add(this.label3);
this.Controls.Add(this.nmNewX);
this.Controls.Add(this.label1);
this.Controls.Add(this.cbPreset);
this.Controls.Add(this.label2);
this.Controls.Add(this.lbCurrent);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.btnCancel);
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.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 = "FrmToolChangeResolution";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Change Resolution";
this.TopMost = true;
((System.ComponentModel.ISupportInitialize)(this.nmNewX)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nmNewY)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lbDescription;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Label lbCurrent;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox cbPreset;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.NumericUpDown nmNewX;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.NumericUpDown nmNewY;
private System.Windows.Forms.Label lbObjectVolume;
}
}
@@ -1,179 +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.Drawing;
using System.Globalization;
using System.Windows.Forms;
using UVtools.Core.Operations;
namespace UVtools.GUI.Forms
{
public partial class FrmToolChangeResolution : Form
{
readonly struct ResolutionItem
{
public uint ResolutionX { get; }
public uint ResolutionY { get; }
public string Name { get; }
public ResolutionItem(uint resolutionX, uint resolutionY, string name = null)
{
ResolutionX = resolutionX;
ResolutionY = resolutionY;
Name = name;
}
public override string ToString()
{
var str = $"{ResolutionX} x {ResolutionY}";
if (!string.IsNullOrEmpty(Name))
{
str += $" ({Name})";
}
return str;
}
}
public uint OldResolutionX { get; }
public uint OldResolutionY { get; }
public Rectangle VolumeBonds { get; }
public uint NewResolutionX => (uint) nmNewX.Value;
public uint NewResolutionY => (uint)nmNewY.Value;
#region Constructors
public FrmToolChangeResolution(uint oldResolutionX, uint oldResolutionY, Rectangle volumeBonds)
{
InitializeComponent();
DialogResult = DialogResult.Cancel;
OldResolutionX = oldResolutionX;
OldResolutionY = oldResolutionY;
VolumeBonds = volumeBonds;
lbCurrent.Text = $"Current resolution (X/Y): {oldResolutionX} x {oldResolutionY}";
lbObjectVolume.Text = $"Object volume (X/Y): {volumeBonds.Width} x {volumeBonds.Height}";
nmNewX.Value = oldResolutionX;
nmNewY.Value = oldResolutionY;
ResolutionItem[] resolutions = {
new ResolutionItem(854, 480, "FWVGA"),
new ResolutionItem(960, 1708),
new ResolutionItem(1080, 1920, "FHD"),
new ResolutionItem(1440, 2560, "QHD"),
new ResolutionItem(1600, 2560, "WQXGA"),
new ResolutionItem(1620, 2560, "WQXGA"),
new ResolutionItem(1920, 1080, "FHD"),
new ResolutionItem(2160, 3840, "4K UHD"),
new ResolutionItem(2531, 1410, "QHD"),
new ResolutionItem(2560, 1440, "QHD"),
new ResolutionItem(2560, 1600, "WQXGA"),
new ResolutionItem(2560, 1620, "WQXGA"),
new ResolutionItem(3840, 2160, "4K UHD"),
new ResolutionItem(3840, 2400, "WQUXGA"),
};
foreach (var resolution in resolutions)
{
cbPreset.Items.Add(resolution);
}
}
#endregion
#region Overrides
protected override void OnKeyUp(KeyEventArgs e)
{
base.OnKeyUp(e);
if (e.KeyCode == Keys.Enter)
{
btnOk.PerformClick();
e.Handled = true;
return;
}
}
#endregion
#region Events
private void EventClick(object sender, EventArgs e)
{
if (ReferenceEquals(sender, btnOk))
{
if (!btnOk.Enabled) return;
if (OldResolutionX == NewResolutionX && OldResolutionY == NewResolutionY)
{
MessageBox.Show("The new resolution must be different from current resolution.", Text, MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}
if (NewResolutionX < VolumeBonds.Width || NewResolutionY < VolumeBonds.Height)
{
MessageBox.Show("The new resolution is not enough to accommodate the object volume, continue with operation will cut the object.\n" +
"Please fix this before, try to rotate object and/or resize to fit on new resolution.", Text, MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}
if (MessageBox.Show("Are you sure you want change change layer height?\n" +
$"X/Y = {nmNewX.Value} x {nmNewY.Value}", 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, nmNewX) || ReferenceEquals(sender, nmNewY))
{
btnOk.Enabled = OldResolutionX != NewResolutionX || OldResolutionY != NewResolutionY;
return;
}
if (ReferenceEquals(sender, cbPreset))
{
if (cbPreset.SelectedIndex >= 0)
{
ResolutionItem resolution = (ResolutionItem)cbPreset.SelectedItem;
nmNewX.Value = resolution.ResolutionX;
nmNewY.Value = resolution.ResolutionY;
cbPreset.SelectedIndex = -1;
}
return;
}
}
#endregion
#region Methods
#endregion
}
}
File diff suppressed because it is too large Load Diff
-245
View File
@@ -1,245 +0,0 @@
namespace UVtools.GUI.Forms
{
partial class FrmToolEmpty
{
/// <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(FrmToolEmpty));
this.lbDescription = new System.Windows.Forms.Label();
this.lbLayerRange = new System.Windows.Forms.Label();
this.nmLayerRangeStart = new System.Windows.Forms.NumericUpDown();
this.nmLayerRangeEnd = new System.Windows.Forms.NumericUpDown();
this.lbLayerRangeTo = new System.Windows.Forms.Label();
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.btnCancel = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
this.btnLayerRangeSelect = new UVtools.GUI.Controls.SplitButton();
((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeStart)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeEnd)).BeginInit();
this.cmLayerRange.SuspendLayout();
this.SuspendLayout();
//
// lbDescription
//
this.lbDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbDescription.Location = new System.Drawing.Point(13, 14);
this.lbDescription.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbDescription.Name = "lbDescription";
this.lbDescription.Size = new System.Drawing.Size(584, 39);
this.lbDescription.TabIndex = 0;
this.lbDescription.Text = "Description";
//
// lbLayerRange
//
this.lbLayerRange.AutoSize = true;
this.lbLayerRange.Location = new System.Drawing.Point(13, 62);
this.lbLayerRange.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbLayerRange.Name = "lbLayerRange";
this.lbLayerRange.Size = new System.Drawing.Size(97, 20);
this.lbLayerRange.TabIndex = 9;
this.lbLayerRange.Text = "Layer range:";
//
// nmLayerRangeStart
//
this.nmLayerRangeStart.Location = new System.Drawing.Point(118, 59);
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 = 0;
//
// nmLayerRangeEnd
//
this.nmLayerRangeEnd.Location = new System.Drawing.Point(314, 59);
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 = 1;
//
// lbLayerRangeTo
//
this.lbLayerRangeTo.AutoSize = true;
this.lbLayerRangeTo.Location = new System.Drawing.Point(275, 62);
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 = 12;
this.lbLayerRangeTo.Text = "To:";
//
// 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);
//
// 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, 102);
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, 102);
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 = "Ok";
this.btnOk.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.EventClick);
//
// btnLayerRangeSelect
//
this.btnLayerRangeSelect.Location = new System.Drawing.Point(446, 58);
this.btnLayerRangeSelect.Menu = this.cmLayerRange;
this.btnLayerRangeSelect.Name = "btnLayerRangeSelect";
this.btnLayerRangeSelect.Size = new System.Drawing.Size(138, 26);
this.btnLayerRangeSelect.TabIndex = 2;
this.btnLayerRangeSelect.Text = "Select";
this.btnLayerRangeSelect.UseVisualStyleBackColor = true;
//
// FrmToolEmpty
//
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, 164);
this.Controls.Add(this.btnLayerRangeSelect);
this.Controls.Add(this.lbLayerRangeTo);
this.Controls.Add(this.nmLayerRangeEnd);
this.Controls.Add(this.nmLayerRangeStart);
this.Controls.Add(this.lbLayerRange);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.btnCancel);
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.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 = "FrmToolEmpty";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Pattern";
this.TopMost = true;
((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeStart)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeEnd)).EndInit();
this.cmLayerRange.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lbDescription;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Label lbLayerRange;
private System.Windows.Forms.NumericUpDown nmLayerRangeStart;
private System.Windows.Forms.NumericUpDown nmLayerRangeEnd;
private System.Windows.Forms.Label lbLayerRangeTo;
private Controls.SplitButton btnLayerRangeSelect;
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;
}
}
-174
View File
@@ -1,174 +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.Drawing;
using System.Windows.Forms;
using UVtools.Core;
using UVtools.Core.Operations;
namespace UVtools.GUI.Forms
{
public partial class FrmToolEmpty : Form
{
#region Properties
public uint LayerRangeStart
{
get => (uint) nmLayerRangeStart.Value;
set => nmLayerRangeStart.Value = value;
}
public uint LayerRangeEnd
{
get => (uint)Math.Min(nmLayerRangeEnd.Value, Program.SlicerFile.LayerCount-1);
set => nmLayerRangeEnd.Value = value;
}
#endregion
#region Constructors
public FrmToolEmpty()
{
InitializeComponent();
}
public FrmToolEmpty(Mutation mutation) : this()
{
btnOk.Text = "Mutate";
Text = $"Mutate: {mutation.MenuName}";
lbDescription.Text = mutation.Description;
nmLayerRangeEnd.Value = Program.SlicerFile.LayerCount - 1;
}
public FrmToolEmpty(uint layerIndex, string text, string description, string btnOkText) : this()
{
nmLayerRangeStart.Value = layerIndex;
nmLayerRangeEnd.Value = layerIndex;
lbDescription.Text = description;
btnOk.Text = btnOkText;
Text = text;
}
#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 (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;
}
if (MessageBox.Show($"Are you sure you want to {Text}?", Text, MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == DialogResult.Yes)
{
DialogResult = DialogResult.OK;
Close();
}
return;
}
if (ReferenceEquals(sender, btnCancel))
{
DialogResult = DialogResult.Cancel;
return;
}
}
#endregion
#region Methods
#endregion
}
}
File diff suppressed because it is too large Load Diff
+111 -78
View File
@@ -34,9 +34,6 @@ namespace UVtools.GUI.Forms
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.pnActions = new System.Windows.Forms.Panel();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
this.pnContent = new System.Windows.Forms.Panel();
this.pnLayerRange = new System.Windows.Forms.Panel();
this.gbLayerRange = new System.Windows.Forms.GroupBox();
@@ -44,6 +41,7 @@ namespace UVtools.GUI.Forms
this.lbLayerRangeFromMM = new System.Windows.Forms.Label();
this.lbLayerRangeToMM = new System.Windows.Forms.Label();
this.nmLayerRangeEnd = new System.Windows.Forms.NumericUpDown();
this.btnLayerRangeSelect = new UVtools.GUI.Controls.SplitButton();
this.cmLayerRange = new System.Windows.Forms.ContextMenuStrip(this.components);
this.btnLayerRangeAllLayers = new System.Windows.Forms.ToolStripMenuItem();
this.btnLayerRangeCurrentLayer = new System.Windows.Forms.ToolStripMenuItem();
@@ -52,14 +50,18 @@ namespace UVtools.GUI.Forms
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.table = new System.Windows.Forms.TableLayoutPanel();
this.pnActions = new System.Windows.Forms.Panel();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
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.table.SuspendLayout();
this.pnActions.SuspendLayout();
this.SuspendLayout();
//
// pnDescription
@@ -69,10 +71,10 @@ namespace UVtools.GUI.Forms
this.pnDescription.BackColor = System.Drawing.SystemColors.Control;
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.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnDescription.Location = new System.Drawing.Point(3, 3);
this.pnDescription.Name = "pnDescription";
this.pnDescription.Size = new System.Drawing.Size(547, 62);
this.pnDescription.Size = new System.Drawing.Size(548, 62);
this.pnDescription.TabIndex = 7;
//
// lbDescription
@@ -87,75 +89,35 @@ namespace UVtools.GUI.Forms
this.lbDescription.Text = "Description";
this.lbDescription.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pnActions
//
this.pnActions.BackColor = System.Drawing.SystemColors.Control;
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, 182);
this.pnActions.Name = "pnActions";
this.pnActions.Size = new System.Drawing.Size(547, 78);
this.pnActions.TabIndex = 8;
//
// 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, 14);
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, 14);
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);
//
// pnContent
//
this.pnContent.AutoSize = true;
this.pnContent.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.pnContent.BackColor = System.Drawing.Color.White;
this.pnContent.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pnContent.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnContent.Location = new System.Drawing.Point(0, 170);
this.pnContent.Location = new System.Drawing.Point(3, 191);
this.pnContent.Name = "pnContent";
this.pnContent.Size = new System.Drawing.Size(547, 12);
this.pnContent.Size = new System.Drawing.Size(548, 2);
this.pnContent.TabIndex = 9;
//
// pnLayerRange
//
this.pnLayerRange.AutoSize = true;
this.pnLayerRange.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.pnLayerRange.BackColor = System.Drawing.Color.White;
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.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnLayerRange.Location = new System.Drawing.Point(3, 71);
this.pnLayerRange.Name = "pnLayerRange";
this.pnLayerRange.Padding = new System.Windows.Forms.Padding(0, 10, 0, 0);
this.pnLayerRange.Size = new System.Drawing.Size(547, 108);
this.pnLayerRange.Size = new System.Drawing.Size(548, 114);
this.pnLayerRange.TabIndex = 0;
//
// gbLayerRange
//
this.gbLayerRange.AutoSize = true;
this.gbLayerRange.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.gbLayerRange.BackColor = System.Drawing.Color.White;
this.gbLayerRange.Controls.Add(this.lbLayerRangeCount);
this.gbLayerRange.Controls.Add(this.lbLayerRangeFromMM);
@@ -168,7 +130,7 @@ namespace UVtools.GUI.Forms
this.gbLayerRange.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbLayerRange.Location = new System.Drawing.Point(0, 10);
this.gbLayerRange.Name = "gbLayerRange";
this.gbLayerRange.Size = new System.Drawing.Size(547, 98);
this.gbLayerRange.Size = new System.Drawing.Size(548, 104);
this.gbLayerRange.TabIndex = 19;
this.gbLayerRange.TabStop = false;
this.gbLayerRange.Text = "Layer Range Selector";
@@ -217,6 +179,16 @@ namespace UVtools.GUI.Forms
this.nmLayerRangeEnd.TabIndex = 14;
this.nmLayerRangeEnd.ValueChanged += new System.EventHandler(this.EventValueChanged);
//
// btnLayerRangeSelect
//
this.btnLayerRangeSelect.Location = new System.Drawing.Point(359, 31);
this.btnLayerRangeSelect.Menu = this.cmLayerRange;
this.btnLayerRangeSelect.Name = "btnLayerRangeSelect";
this.btnLayerRangeSelect.Size = new System.Drawing.Size(180, 26);
this.btnLayerRangeSelect.TabIndex = 18;
this.btnLayerRangeSelect.Text = "Select";
this.btnLayerRangeSelect.UseVisualStyleBackColor = true;
//
// cmLayerRange
//
this.cmLayerRange.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -297,27 +269,84 @@ namespace UVtools.GUI.Forms
this.nmLayerRangeStart.TabIndex = 13;
this.nmLayerRangeStart.ValueChanged += new System.EventHandler(this.EventValueChanged);
//
// btnLayerRangeSelect
// table
//
this.btnLayerRangeSelect.Location = new System.Drawing.Point(359, 31);
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;
this.table.AutoSize = true;
this.table.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.table.ColumnCount = 1;
this.table.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.table.Controls.Add(this.pnDescription, 0, 0);
this.table.Controls.Add(this.pnActions, 0, 3);
this.table.Controls.Add(this.pnContent, 0, 2);
this.table.Controls.Add(this.pnLayerRange, 0, 1);
this.table.Dock = System.Windows.Forms.DockStyle.Fill;
this.table.Location = new System.Drawing.Point(0, 0);
this.table.Name = "table";
this.table.RowCount = 4;
this.table.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.table.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.table.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.table.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.table.Size = new System.Drawing.Size(554, 281);
this.table.TabIndex = 10;
//
// pnActions
//
this.pnActions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.pnActions.BackColor = System.Drawing.SystemColors.Control;
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.Fill;
this.pnActions.Location = new System.Drawing.Point(3, 199);
this.pnActions.Name = "pnActions";
this.pnActions.Size = new System.Drawing.Size(548, 85);
this.pnActions.TabIndex = 8;
//
// 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(430, 19);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(10, 0, 10, 0);
this.btnCancel.Size = new System.Drawing.Size(112, 48);
this.btnCancel.TabIndex = 6;
this.btnCancel.Text = "&Cancel";
this.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnCancel.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
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.AutoSize = true;
this.btnOk.Image = global::UVtools.GUI.Properties.Resources.Ok_24x24;
this.btnOk.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnOk.Location = new System.Drawing.Point(330, 19);
this.btnOk.Name = "btnOk";
this.btnOk.Padding = new System.Windows.Forms.Padding(10, 0, 10, 0);
this.btnOk.Size = new System.Drawing.Size(93, 48);
this.btnOk.TabIndex = 5;
this.btnOk.Text = "&Ok";
this.btnOk.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnOk.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.btnOk.Click += new System.EventHandler(this.EventClick);
//
// FrmToolWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.BackColor = System.Drawing.Color.White;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(547, 260);
this.Controls.Add(this.pnContent);
this.Controls.Add(this.pnLayerRange);
this.Controls.Add(this.pnActions);
this.Controls.Add(this.pnDescription);
this.ClientSize = new System.Drawing.Size(554, 281);
this.Controls.Add(this.table);
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")));
@@ -325,7 +354,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, 39);
this.MinimumSize = new System.Drawing.Size(570, 39);
this.Name = "FrmToolWindow";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
@@ -333,23 +362,23 @@ namespace UVtools.GUI.Forms
this.TopMost = true;
this.pnDescription.ResumeLayout(false);
this.pnDescription.PerformLayout();
this.pnActions.ResumeLayout(false);
this.pnLayerRange.ResumeLayout(false);
this.pnLayerRange.PerformLayout();
this.gbLayerRange.ResumeLayout(false);
this.gbLayerRange.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeEnd)).EndInit();
this.cmLayerRange.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.nmLayerRangeStart)).EndInit();
this.table.ResumeLayout(false);
this.table.PerformLayout();
this.pnActions.ResumeLayout(false);
this.pnActions.PerformLayout();
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 pnLayerRange;
@@ -368,5 +397,9 @@ namespace UVtools.GUI.Forms
public System.Windows.Forms.Label lbLayerRangeFromMM;
public System.Windows.Forms.Label lbLayerRangeCount;
public System.Windows.Forms.Panel pnContent;
private System.Windows.Forms.TableLayoutPanel table;
public System.Windows.Forms.Panel pnActions;
public System.Windows.Forms.Button btnCancel;
public System.Windows.Forms.Button btnOk;
}
}
+21 -17
View File
@@ -96,12 +96,8 @@ namespace UVtools.GUI.Forms
public FrmToolWindow(string title, string description, string buttonOkText, bool layerRangeVisible = true, bool layerRangeEndVisible = true, bool hideContent = false) : this()
{
if (!layerRangeVisible)
{
Height -= pnLayerRange.Height;
}
if (!ReferenceEquals(title, null)) Text = title;
lbDescription.MaximumSize = new Size(Width - 20, 0);
Description = description;
ButtonOkText = buttonOkText;
LayerRangeVisible = layerRangeVisible;
@@ -110,7 +106,6 @@ namespace UVtools.GUI.Forms
if (hideContent)
{
Height -= pnContent.Height;
pnContent.Visible = false;
}
@@ -133,27 +128,27 @@ namespace UVtools.GUI.Forms
{
pnContent.Controls.Add(content);
Width = Math.Max(MinimumSize.Width, content.Width);
Height += content.Height;
content.Dock = DockStyle.Fill;
//content.Dock = DockStyle.Fill;
btnOk.Enabled = content.ButtonOkEnabled;
Content = content;
content.PropertyChanged += ContentOnPropertyChanged;
}
private void ContentOnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(Content.ButtonOkEnabled))
{
btnOk.Enabled = Content.ButtonOkEnabled;
return;
}
}
public FrmToolWindow(CtrlToolWindowContent content, uint layerIndex) : this(content)
{
LayerRangeStart = LayerRangeEnd = layerIndex;
}
public FrmToolWindow(Mutation mutation) : this($"Mutate: {mutation.MenuName}", mutation.Description, mutation.ButtonOkText, true, true, true)
{
}
public FrmToolWindow(Mutation mutation, uint layerIndex) : this(mutation)
{
LayerRangeStart = LayerRangeEnd = layerIndex;
}
#endregion
#region Overrides
@@ -213,6 +208,15 @@ namespace UVtools.GUI.Forms
#endregion
#region Events
private void ContentOnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(Content.ButtonOkEnabled))
{
btnOk.Enabled = Content.ButtonOkEnabled;
return;
}
}
private void EventClick(object sender, EventArgs e)
{
if (ReferenceEquals(sender, btnLayerRangeAllLayers))
-48
View File
@@ -117,57 +117,9 @@
<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="pnActions.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="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>