mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-08 17:42:31 +02:00
Convert resize to toolwindow
This commit is contained in:
@@ -468,7 +468,7 @@ namespace UVtools.Core
|
||||
}
|
||||
|
||||
|
||||
public void MutateResize(double xScale, double yScale)
|
||||
public void Resize(double xScale, double yScale)
|
||||
{
|
||||
using (var mat = LayerMat)
|
||||
{
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace UVtools.Core
|
||||
return Layers[index];
|
||||
}
|
||||
|
||||
public void MoveModel(OperationMove move, OperationProgress progress = null)
|
||||
public void Move(OperationMove move, OperationProgress progress = null)
|
||||
{
|
||||
if (ReferenceEquals(progress, null)) progress = new OperationProgress();
|
||||
progress.Reset("Moving model", move.LayerRangeCount);
|
||||
@@ -297,49 +297,44 @@ namespace UVtools.Core
|
||||
/// <summary>
|
||||
/// Resizes layer images in x and y factor, starting at 1 = 100%
|
||||
/// </summary>
|
||||
/// <param name="startLayerIndex">Layer index to start</param>
|
||||
/// <param name="endLayerIndex">Layer index to end</param>
|
||||
/// <param name="x">X factor, starts at 1</param>
|
||||
/// <param name="y">Y factor, starts at 1</param>
|
||||
/// <param name="isFade">Fade X/Y towards 100%</param>
|
||||
public void MutateResize(uint startLayerIndex, uint endLayerIndex, double x, double y, bool isFade, OperationProgress progress = null)
|
||||
public void Resize(OperationResize operation, OperationProgress progress = null)
|
||||
{
|
||||
if (x == 1.0 && y == 1.0) return;
|
||||
if (operation.X == 1m && operation.Y == 1m) return;
|
||||
|
||||
if(ReferenceEquals(progress, null)) progress = new OperationProgress();
|
||||
progress.Reset("Resizing", endLayerIndex - startLayerIndex + 1);
|
||||
progress.Reset("Resizing", operation.LayerRangeCount);
|
||||
|
||||
double xSteps = Math.Abs(x - 1.0) / (endLayerIndex - startLayerIndex);
|
||||
double ySteps = Math.Abs(y - 1.0) / (endLayerIndex - startLayerIndex);
|
||||
decimal xSteps = Math.Abs(operation.X - 1m) / (operation.LayerIndexEnd - operation.LayerIndexStart);
|
||||
decimal ySteps = Math.Abs(operation.Y - 1m) / (operation.LayerIndexEnd - operation.LayerIndexStart);
|
||||
|
||||
Parallel.For(startLayerIndex, endLayerIndex + 1, layerIndex =>
|
||||
Parallel.For(operation.LayerIndexStart, operation.LayerIndexEnd + 1, layerIndex =>
|
||||
{
|
||||
if (progress.Token.IsCancellationRequested) return;
|
||||
var newX = x;
|
||||
var newY = y;
|
||||
if (isFade)
|
||||
var newX = operation.X;
|
||||
var newY = operation.Y;
|
||||
if (operation.IsFade)
|
||||
{
|
||||
if (newX != 1.0)
|
||||
if (newX != 1m)
|
||||
{
|
||||
|
||||
//maxIteration = Math.Max(iterationsStart, iterationsEnd);
|
||||
|
||||
newX = (float)(newX < 1.0
|
||||
? newX + (layerIndex - startLayerIndex) * xSteps
|
||||
: newX - (layerIndex - startLayerIndex) * xSteps);
|
||||
newX = newX < 1m
|
||||
? newX + (layerIndex - operation.LayerIndexStart) * xSteps
|
||||
: newX - (layerIndex - operation.LayerIndexStart) * xSteps;
|
||||
|
||||
// constrain
|
||||
//iterations = Math.Min(Math.Max(1, iterations), maxIteration);
|
||||
}
|
||||
|
||||
if (y != 1.0)
|
||||
if (newY != 1m)
|
||||
{
|
||||
|
||||
//maxIteration = Math.Max(iterationsStart, iterationsEnd);
|
||||
|
||||
newY = (float)(newY < 1.0
|
||||
? newY + (layerIndex - startLayerIndex) * ySteps
|
||||
: newY - (layerIndex - startLayerIndex) * ySteps);
|
||||
newY = (newY < 1m
|
||||
? newY + (layerIndex - operation.LayerIndexStart) * ySteps
|
||||
: newY - (layerIndex - operation.LayerIndexStart) * ySteps);
|
||||
|
||||
// constrain
|
||||
//iterations = Math.Min(Math.Max(1, iterations), maxIteration);
|
||||
@@ -351,9 +346,9 @@ namespace UVtools.Core
|
||||
progress++;
|
||||
}
|
||||
|
||||
if (newX == 1.0 && newY == 1.0) return;
|
||||
if (newX == 1.0m && newY == 1.0m) return;
|
||||
|
||||
this[layerIndex].MutateResize(newX, newY);
|
||||
this[layerIndex].Resize((double) (newX / 100m), (double) (newY / 100m));
|
||||
});
|
||||
progress.Token.ThrowIfCancellationRequested();
|
||||
}
|
||||
@@ -1670,7 +1665,7 @@ namespace UVtools.Core
|
||||
{
|
||||
LayerIndexStart = operation.LayerIndexStart, LayerIndexEnd = operation.LayerIndexEnd
|
||||
};
|
||||
MoveModel(operationMove, progress);
|
||||
Move(operationMove, progress);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* of this license document, but changing it is not allowed.
|
||||
*/
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
using UVtools.Core.Objects;
|
||||
|
||||
namespace UVtools.Core.Operations
|
||||
@@ -55,6 +56,12 @@ namespace UVtools.Core.Operations
|
||||
/// <returns>null or empty if validates, or else, return a string with error message</returns>
|
||||
public virtual StringTag Validate(params object[] parameters) => null;
|
||||
|
||||
public bool CanValidate(params object[] parameters)
|
||||
{
|
||||
var result = Validate(parameters);
|
||||
return result is null || string.IsNullOrEmpty(result.Content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the start layer index where operation will starts in
|
||||
/// </summary>
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace UVtools.Core.Operations
|
||||
"Note: Margins are in pixel values.";
|
||||
|
||||
public override string ConfirmationText =>
|
||||
"move model?\n" +
|
||||
$"move model from layers {LayerIndexStart} to {LayerIndexEnd}?\n" +
|
||||
$"From: X:{SrcRoi.X} Y:{SrcRoi.Y}\n" +
|
||||
$"To: X:{DstRoi.X} Y:{DstRoi.Y}";
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.Text;
|
||||
using UVtools.Core.Objects;
|
||||
|
||||
namespace UVtools.Core.Operations
|
||||
{
|
||||
public class OperationResize : Operation
|
||||
{
|
||||
public override string Title => "Resize";
|
||||
public override string Description =>
|
||||
"Resizes layer images in a X and/or Y factor, starting from 100% value.\n" +
|
||||
"NOTE 1: Build volume bounds are not validated after operation, please ensure scaling stays inside your limits.\n" +
|
||||
"NOTE 2: X and Y are applied to original image, not to the rotated preview (If enabled).";
|
||||
|
||||
public override string ConfirmationText =>
|
||||
$"resize model from layers {LayerIndexStart} to {LayerIndexEnd}?\n" +
|
||||
$"X:{X}% Y:{Y}%";
|
||||
|
||||
public override string ProgressTitle =>
|
||||
$"Resizing from layers {LayerIndexStart} to {LayerIndexEnd} at X:{X}% Y:{Y}% ";
|
||||
|
||||
public override StringTag Validate(params object[] parameters)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
if (X == 100m && Y == 100m)
|
||||
{
|
||||
sb.AppendLine("X and Y can't be 100% together.");
|
||||
}
|
||||
|
||||
return new StringTag(sb.ToString());
|
||||
}
|
||||
|
||||
|
||||
public decimal X { get; set; }
|
||||
public decimal Y { get; set; }
|
||||
|
||||
public bool ConstrainXY { get; set; }
|
||||
public bool IsFade { get; set; }
|
||||
|
||||
|
||||
public OperationResize()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+197
@@ -0,0 +1,197 @@
|
||||
namespace UVtools.GUI.Controls.Tools
|
||||
{
|
||||
partial class CtrlToolResize
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CtrlToolResize));
|
||||
this.cbFade = new System.Windows.Forms.CheckBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.cbConstrainXY = new System.Windows.Forms.CheckBox();
|
||||
this.nmY = new System.Windows.Forms.NumericUpDown();
|
||||
this.lbY = new System.Windows.Forms.Label();
|
||||
this.nmX = new System.Windows.Forms.NumericUpDown();
|
||||
this.lbX = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nmY)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nmX)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cbFade
|
||||
//
|
||||
this.cbFade.AutoSize = true;
|
||||
this.cbFade.Location = new System.Drawing.Point(8, 41);
|
||||
this.cbFade.Name = "cbFade";
|
||||
this.cbFade.Size = new System.Drawing.Size(170, 24);
|
||||
this.cbFade.TabIndex = 26;
|
||||
this.cbFade.Text = "Fade towards 100%";
|
||||
this.cbFade.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(360, 10);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(23, 20);
|
||||
this.label2.TabIndex = 25;
|
||||
this.label2.Text = "%";
|
||||
this.toolTip.SetToolTip(this.label2, resources.GetString("label2.ToolTip"));
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(164, 10);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(23, 20);
|
||||
this.label1.TabIndex = 24;
|
||||
this.label1.Text = "%";
|
||||
this.toolTip.SetToolTip(this.label1, resources.GetString("label1.ToolTip"));
|
||||
//
|
||||
// cbConstrainXY
|
||||
//
|
||||
this.cbConstrainXY.AutoSize = true;
|
||||
this.cbConstrainXY.Checked = true;
|
||||
this.cbConstrainXY.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.cbConstrainXY.Location = new System.Drawing.Point(388, 8);
|
||||
this.cbConstrainXY.Name = "cbConstrainXY";
|
||||
this.cbConstrainXY.Size = new System.Drawing.Size(126, 24);
|
||||
this.cbConstrainXY.TabIndex = 23;
|
||||
this.cbConstrainXY.Text = "Constrain X/Y";
|
||||
this.cbConstrainXY.CheckedChanged += new System.EventHandler(this.EventValueChanged);
|
||||
//
|
||||
// nmY
|
||||
//
|
||||
this.nmY.DecimalPlaces = 2;
|
||||
this.nmY.Enabled = false;
|
||||
this.nmY.Location = new System.Drawing.Point(232, 7);
|
||||
this.nmY.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.nmY.Maximum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nmY.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nmY.Name = "nmY";
|
||||
this.nmY.Size = new System.Drawing.Size(120, 26);
|
||||
this.nmY.TabIndex = 22;
|
||||
this.nmY.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nmY.ValueChanged += new System.EventHandler(this.EventValueChanged);
|
||||
//
|
||||
// lbY
|
||||
//
|
||||
this.lbY.AutoSize = true;
|
||||
this.lbY.Enabled = false;
|
||||
this.lbY.Location = new System.Drawing.Point(200, 10);
|
||||
this.lbY.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lbY.Name = "lbY";
|
||||
this.lbY.Size = new System.Drawing.Size(24, 20);
|
||||
this.lbY.TabIndex = 21;
|
||||
this.lbY.Text = "Y:";
|
||||
//
|
||||
// nmX
|
||||
//
|
||||
this.nmX.DecimalPlaces = 2;
|
||||
this.nmX.Location = new System.Drawing.Point(36, 7);
|
||||
this.nmX.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.nmX.Maximum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nmX.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nmX.Name = "nmX";
|
||||
this.nmX.Size = new System.Drawing.Size(120, 26);
|
||||
this.nmX.TabIndex = 19;
|
||||
this.nmX.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nmX.ValueChanged += new System.EventHandler(this.EventValueChanged);
|
||||
//
|
||||
// lbX
|
||||
//
|
||||
this.lbX.AutoSize = true;
|
||||
this.lbX.Location = new System.Drawing.Point(4, 10);
|
||||
this.lbX.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lbX.Name = "lbX";
|
||||
this.lbX.Size = new System.Drawing.Size(24, 20);
|
||||
this.lbX.TabIndex = 20;
|
||||
this.lbX.Text = "X:";
|
||||
this.toolTip.SetToolTip(this.lbX, resources.GetString("lbX.ToolTip"));
|
||||
//
|
||||
// CtrlToolResize
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.ButtonOkEnabled = false;
|
||||
this.Controls.Add(this.cbFade);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.cbConstrainXY);
|
||||
this.Controls.Add(this.nmY);
|
||||
this.Controls.Add(this.lbY);
|
||||
this.Controls.Add(this.nmX);
|
||||
this.Controls.Add(this.lbX);
|
||||
this.Description = "";
|
||||
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Name = "CtrlToolResize";
|
||||
this.Size = new System.Drawing.Size(540, 77);
|
||||
((System.ComponentModel.ISupportInitialize)(this.nmY)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nmX)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.CheckBox cbFade;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.CheckBox cbConstrainXY;
|
||||
private System.Windows.Forms.NumericUpDown nmY;
|
||||
private System.Windows.Forms.Label lbY;
|
||||
private System.Windows.Forms.NumericUpDown nmX;
|
||||
private System.Windows.Forms.Label lbX;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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 UVtools.Core.Operations;
|
||||
|
||||
namespace UVtools.GUI.Controls.Tools
|
||||
{
|
||||
public partial class CtrlToolResize : CtrlToolWindowContent
|
||||
{
|
||||
public OperationResize Operation { get; }
|
||||
|
||||
|
||||
public CtrlToolResize()
|
||||
{
|
||||
InitializeComponent();
|
||||
Operation = new OperationResize();
|
||||
SetOperation(Operation);
|
||||
}
|
||||
|
||||
private void EventValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (ReferenceEquals(sender, nmX))
|
||||
{
|
||||
if (cbConstrainXY.Checked)
|
||||
{
|
||||
nmY.Value = nmX.Value;
|
||||
}
|
||||
}
|
||||
|
||||
else if (ReferenceEquals(sender, cbConstrainXY))
|
||||
{
|
||||
lbY.Enabled = nmY.Enabled = !cbConstrainXY.Checked;
|
||||
EventValueChanged(nmX, null);
|
||||
}
|
||||
|
||||
UpdateOperation();
|
||||
ButtonOkEnabled = Operation.CanValidate();
|
||||
}
|
||||
|
||||
public override void UpdateOperation()
|
||||
{
|
||||
base.UpdateOperation();
|
||||
Operation.X = nmX.Value;
|
||||
Operation.Y = nmY.Value;
|
||||
Operation.ConstrainXY = cbConstrainXY.Checked;
|
||||
Operation.IsFade = cbFade.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
<?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>
|
||||
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="label2.ToolTip" xml:space="preserve">
|
||||
<value>Selects the number of iterations/passes to perform on each layer using this mutator.
|
||||
Enable the "Fade in/out" to fade the iteration over layers, you can use a start iteration higher than end to perform a inverse fade.
|
||||
WARNING: Using high iteration values can destroy your model depending on the mutator being used, please use low values or with caution!</value>
|
||||
</data>
|
||||
<data name="label1.ToolTip" xml:space="preserve">
|
||||
<value>Selects the number of iterations/passes to perform on each layer using this mutator.
|
||||
Enable the "Fade in/out" to fade the iteration over layers, you can use a start iteration higher than end to perform a inverse fade.
|
||||
WARNING: Using high iteration values can destroy your model depending on the mutator being used, please use low values or with caution!</value>
|
||||
</data>
|
||||
<data name="lbX.ToolTip" xml:space="preserve">
|
||||
<value>Selects the number of iterations/passes to perform on each layer using this mutator.
|
||||
Enable the "Fade in/out" to fade the iteration over layers, you can use a start iteration higher than end to perform a inverse fade.
|
||||
WARNING: Using high iteration values can destroy your model depending on the mutator being used, please use low values or with caution!</value>
|
||||
</data>
|
||||
</root>
|
||||
-6
@@ -148,7 +148,6 @@ namespace UVtools.GUI.Forms
|
||||
| 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.ItemClicked);
|
||||
//
|
||||
// btnLayerRangeCurrentLayer
|
||||
//
|
||||
@@ -157,7 +156,6 @@ namespace UVtools.GUI.Forms
|
||||
| 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.ItemClicked);
|
||||
//
|
||||
// btnLayerRangeBottomLayers
|
||||
//
|
||||
@@ -166,7 +164,6 @@ namespace UVtools.GUI.Forms
|
||||
| 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.ItemClicked);
|
||||
//
|
||||
// btnLayerRangeNormalLayers
|
||||
//
|
||||
@@ -175,7 +172,6 @@ namespace UVtools.GUI.Forms
|
||||
| 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.ItemClicked);
|
||||
//
|
||||
// toolTip
|
||||
//
|
||||
@@ -232,7 +228,6 @@ namespace UVtools.GUI.Forms
|
||||
this.btnCancel.Text = "&Cancel";
|
||||
this.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
this.btnCancel.Click += new System.EventHandler(this.ItemClicked);
|
||||
//
|
||||
// btnMutate
|
||||
//
|
||||
@@ -247,7 +242,6 @@ namespace UVtools.GUI.Forms
|
||||
this.btnMutate.Text = "&Resize";
|
||||
this.btnMutate.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.btnMutate.UseVisualStyleBackColor = true;
|
||||
this.btnMutate.Click += new System.EventHandler(this.ItemClicked);
|
||||
//
|
||||
// nmX
|
||||
//
|
||||
|
||||
@@ -117,72 +117,6 @@ namespace UVtools.GUI.Forms
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
private void ItemClicked(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, btnMutate))
|
||||
{
|
||||
if (!btnMutate.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 (X == 100 && Y == 100)
|
||||
{
|
||||
MessageBox.Show($"X and Y cant be 100% together.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show($"Are you sure you want to {Mutation.Mutate}?\nX={X}% Y={Y}%", Text, MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
if (X <= 0 || Y <= 0) // Should never happen!
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
Close();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ReferenceEquals(sender, btnCancel))
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void EventCheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
+10
-6
@@ -46,6 +46,7 @@ namespace UVtools.GUI
|
||||
|
||||
public static readonly OperationMenuItem[] MenuTools = {
|
||||
new OperationMenuItem(new OperationMove(), Resources.move_16x16),
|
||||
new OperationMenuItem(new OperationResize(), Resources.crop_16x16),
|
||||
new OperationMenuItem(new OperationSolidify(), Resources.square_solid_16x16),
|
||||
new OperationMenuItem(new OperationMorph(), Resources.Geometry_16x16),
|
||||
new OperationMenuItem(new OperationChangeResolution(), Resources.resize_16x16),
|
||||
@@ -69,14 +70,14 @@ namespace UVtools.GUI
|
||||
"Move"
|
||||
)
|
||||
},*/
|
||||
{
|
||||
/*{
|
||||
LayerManager.Mutate.Resize, new Mutation(LayerManager.Mutate.Resize, null, Resources.crop_16x16,
|
||||
"Resizes layer images in a X and/or Y factor, starting from 100% value.\n" +
|
||||
"NOTE 1: Build volume bounds are not validated after operation, please ensure scaling stays inside your limits.\n" +
|
||||
"NOTE 2: X and Y are applied to original image, not to the rotated preview (If enabled).",
|
||||
"Resize"
|
||||
)
|
||||
},
|
||||
},*/
|
||||
{
|
||||
LayerManager.Mutate.Flip, new Mutation(LayerManager.Mutate.Flip, null, Resources.flip_16x16,
|
||||
"Flips layer images vertically and/or horizontally.",
|
||||
@@ -3801,10 +3802,10 @@ namespace UVtools.GUI
|
||||
/* case LayerManager.Mutate.Move:
|
||||
SlicerFile.LayerManager.MoveModel(layerStart, layerEnd, operationMoveModel, progress);
|
||||
break;*/
|
||||
case LayerManager.Mutate.Resize:
|
||||
SlicerFile.LayerManager.MutateResize(layerStart, layerEnd, x / 100.0, y / 100.0, fade,
|
||||
/*case LayerManager.Mutate.Resize:
|
||||
SlicerFile.LayerManager.Resize(layerStart, layerEnd, x / 100.0, y / 100.0, fade,
|
||||
progress);
|
||||
break;
|
||||
break;*/
|
||||
case LayerManager.Mutate.Flip:
|
||||
FlipType flipType = FlipType.Horizontal;
|
||||
switch (iterationsStart)
|
||||
@@ -4548,7 +4549,10 @@ namespace UVtools.GUI
|
||||
{
|
||||
// Tools
|
||||
case OperationMove operation:
|
||||
SlicerFile.LayerManager.MoveModel(operation, FrmLoading.RestartProgress());
|
||||
SlicerFile.LayerManager.Move(operation, FrmLoading.RestartProgress());
|
||||
break;
|
||||
case OperationResize operation:
|
||||
SlicerFile.LayerManager.Resize(operation, FrmLoading.RestartProgress());
|
||||
break;
|
||||
case OperationSolidify operation:
|
||||
SlicerFile.LayerManager.Solidify(operation, FrmLoading.RestartProgress());
|
||||
|
||||
@@ -170,6 +170,12 @@
|
||||
<Compile Include="Controls\SplitButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Tools\CtrlToolResize.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Tools\CtrlToolResize.Designer.cs">
|
||||
<DependentUpon>CtrlToolResize.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Tools\CtrlToolMove.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
@@ -330,6 +336,9 @@
|
||||
<EmbeddedResource Include="Controls\CtrlToolWindowContent.resx">
|
||||
<DependentUpon>CtrlToolWindowContent.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\Tools\CtrlToolResize.resx">
|
||||
<DependentUpon>CtrlToolResize.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\Tools\CtrlToolMove.resx">
|
||||
<DependentUpon>CtrlToolMove.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Reference in New Issue
Block a user