mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-08 17:42:31 +02:00
WPF progress
This commit is contained in:
@@ -35,8 +35,8 @@ namespace UVtools.GUI.Controls.Tools
|
||||
{
|
||||
uint extraLayers = (uint)Math.Max(0, (ParentToolWindow.nmLayerRangeEnd.Value - ParentToolWindow.nmLayerRangeStart.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)";
|
||||
lbLayersCount.Text = $"Result layers: {Program.SlicerFile.LayerCount} → {Program.SlicerFile.LayerCount + extraLayers} (+ {extraLayers})";
|
||||
lbHeights.Text = $"Result heights: {Program.SlicerFile.TotalHeight}mm → {Program.SlicerFile.TotalHeight + extraHeight}mm (+ {extraHeight}mm)";
|
||||
}
|
||||
|
||||
public override bool UpdateOperation()
|
||||
|
||||
@@ -10,8 +10,6 @@ using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using UVtools.Core.Objects;
|
||||
using UVtools.Core.Operations;
|
||||
@@ -55,7 +53,7 @@ namespace UVtools.GUI.Controls.Tools
|
||||
message.Content += "\nDo you want to remove all invalid files from list?";
|
||||
if (MessageBoxError(message.ToString(), MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
ConcurrentBag<string> result = (ConcurrentBag<string>)message.Tag;
|
||||
ConcurrentBag<StringTag> result = (ConcurrentBag<StringTag>)message.Tag;
|
||||
foreach (var file in result)
|
||||
{
|
||||
Operation.Files.Remove(file);
|
||||
@@ -104,7 +102,10 @@ namespace UVtools.GUI.Controls.Tools
|
||||
{
|
||||
if (fileOpen.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
Operation.Files.AddRange(fileOpen.FileNames);
|
||||
foreach (var filename in fileOpen.FileNames)
|
||||
{
|
||||
Operation.AddFile(filename);
|
||||
}
|
||||
|
||||
if (cbAutoSort.Checked)
|
||||
{
|
||||
@@ -121,7 +122,7 @@ namespace UVtools.GUI.Controls.Tools
|
||||
{
|
||||
foreach (StringTag selectedItem in lbFiles.SelectedItems)
|
||||
{
|
||||
Operation.Files.Remove(selectedItem.TagString);
|
||||
Operation.Files.Remove(selectedItem);
|
||||
}
|
||||
UpdateListBox();
|
||||
|
||||
@@ -189,8 +190,7 @@ namespace UVtools.GUI.Controls.Tools
|
||||
|
||||
foreach (var file in Operation.Files)
|
||||
{
|
||||
var stringTag = new StringTag(Path.GetFileNameWithoutExtension(file), file);
|
||||
lbFiles.Items.Add(stringTag);
|
||||
lbFiles.Items.Add(file);
|
||||
}
|
||||
|
||||
ButtonOkEnabled = btnRemove.Enabled = btnSort.Enabled = btnClear.Enabled = Operation.Files.Count > 0;
|
||||
|
||||
@@ -131,6 +131,6 @@ Enable the "Fade in/out" to fade the iteration over layers, you can use a start
|
||||
WARNING: Using high iteration values can destroy your model depending on the mutator being used, please use low values or with caution!</value>
|
||||
</data>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>25</value>
|
||||
<value>121</value>
|
||||
</metadata>
|
||||
</root>
|
||||
+42
-43
@@ -2806,57 +2806,56 @@ namespace UVtools.GUI
|
||||
// the cross cursor is displayed even before the pblayer control has focus.
|
||||
// This ensures the user is aware that even in this case, a click in the layer
|
||||
// preview will draw a pixel.
|
||||
if (ReferenceEquals(sender, this) && !ReferenceEquals(SlicerFile, null))
|
||||
if (!ReferenceEquals(sender, this) || ReferenceEquals(SlicerFile, null)) return;
|
||||
|
||||
// This event repeats for as long as the key is pressed, so if we've
|
||||
// already set the cursor from a previous key down event, just return.
|
||||
if (!ReferenceEquals(pbLayer.Cursor.Tag, null) || pbLayer.Cursor == pixelEditCursor || pbLayer.Cursor == Cursors.Cross
|
||||
|| pbLayer.Cursor == Cursors.Hand || pbLayer.SelectionMode == ImageBoxSelectionMode.Rectangle) return;
|
||||
|
||||
// Pixel Edit is active, Shift is down, and the cursor is over the image region.
|
||||
if (pbLayer.ClientRectangle.Contains(pbLayer.PointToClient(MousePosition)))
|
||||
{
|
||||
// This event repeats for as long as the key is pressed, so if we've
|
||||
// already set the cursor from a previous key down event, just return.
|
||||
if (!ReferenceEquals(pbLayer.Cursor.Tag, null) || pbLayer.Cursor == pixelEditCursor || pbLayer.Cursor == Cursors.Cross
|
||||
|| pbLayer.Cursor == Cursors.Hand || pbLayer.SelectionMode == ImageBoxSelectionMode.Rectangle) return;
|
||||
|
||||
// Pixel Edit is active, Shift is down, and the cursor is over the image region.
|
||||
if (pbLayer.ClientRectangle.Contains(pbLayer.PointToClient(MousePosition)))
|
||||
if (e.Modifiers == Keys.Shift)
|
||||
{
|
||||
if (e.Modifiers == Keys.Shift)
|
||||
if (btnLayerImagePixelEdit.Checked)
|
||||
{
|
||||
if (btnLayerImagePixelEdit.Checked)
|
||||
{
|
||||
pbLayer.PanMode = ImageBoxPanMode.None;
|
||||
lbLayerImageTooltipOverlay.Text = "Pixel editing is on:\n" +
|
||||
"» Click over a pixel to draw\n" +
|
||||
"» Hold CTRL to clear pixels";
|
||||
|
||||
UpdatePixelEditorCursor();
|
||||
}
|
||||
else
|
||||
{
|
||||
pbLayer.Cursor = Cursors.Cross;
|
||||
pbLayer.SelectionMode = ImageBoxSelectionMode.Rectangle;
|
||||
lbLayerImageTooltipOverlay.Text = "ROI selection mode:\n" +
|
||||
"» Left-click drag to select a fixed region\n" +
|
||||
"» Left-click + ALT drag to select specific objects\n" +
|
||||
"» Right click on a specific object to select it\n" +
|
||||
"Press Esc to clear the ROI";
|
||||
}
|
||||
|
||||
lbLayerImageTooltipOverlay.Visible = Settings.Default.LayerTooltipOverlay;
|
||||
|
||||
return;
|
||||
}
|
||||
if (e.Modifiers == Keys.Control)
|
||||
{
|
||||
pbLayer.Cursor = Cursors.Hand;
|
||||
pbLayer.PanMode = ImageBoxPanMode.None;
|
||||
lbLayerImageTooltipOverlay.Text = "Issue selection mode:\n" +
|
||||
"» Click over an issue to select it";
|
||||
lbLayerImageTooltipOverlay.Text = "Pixel editing is on:\n" +
|
||||
"» Click over a pixel to draw\n" +
|
||||
"» Hold CTRL to clear pixels";
|
||||
|
||||
lbLayerImageTooltipOverlay.Visible = Settings.Default.LayerTooltipOverlay;
|
||||
|
||||
return;
|
||||
UpdatePixelEditorCursor();
|
||||
}
|
||||
else
|
||||
{
|
||||
pbLayer.Cursor = Cursors.Cross;
|
||||
pbLayer.SelectionMode = ImageBoxSelectionMode.Rectangle;
|
||||
lbLayerImageTooltipOverlay.Text = "ROI selection mode:\n" +
|
||||
"» Left-click drag to select a fixed region\n" +
|
||||
"» Left-click + ALT drag to select specific objects\n" +
|
||||
"» Right click on a specific object to select it\n" +
|
||||
"Press Esc to clear the ROI";
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
lbLayerImageTooltipOverlay.Visible = Settings.Default.LayerTooltipOverlay;
|
||||
|
||||
return;
|
||||
}
|
||||
if (e.Modifiers == Keys.Control)
|
||||
{
|
||||
pbLayer.Cursor = Cursors.Hand;
|
||||
pbLayer.PanMode = ImageBoxPanMode.None;
|
||||
lbLayerImageTooltipOverlay.Text = "Issue selection mode:\n" +
|
||||
"» Click over an issue to select it";
|
||||
|
||||
lbLayerImageTooltipOverlay.Visible = Settings.Default.LayerTooltipOverlay;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private void EventKeyUp(object sender, KeyEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user