Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Conceição <Tiago_caza@hotmail.com>2020-11-08 20:16:04 +0300
committerTiago Conceição <Tiago_caza@hotmail.com>2020-11-08 20:16:04 +0300
commit3455f09c24daa26c12346a7e0cd451e6d947e8a7 (patch)
treef069515accaf7e9d1190742f0041dfdf06bbd4fd
parent2e349328d6dea431325c8242fe915a402a806bb3 (diff)
v1.2.1v1.2.1
* (Add) IsModified property to current layer information, indicates if layer have unsaved changes * (Add) Splitter between preview image and properties to resize the vertical space between that two controls * (Fix) Unable to save file with made modifications, layer IsModified property were lost when entering on clipboard * (Fix) After made a modification clipboard tries to restores that same modification (Redundant) * (Fix) Current layer data doesn't refresh when refreshing current layer, made changes not to show in * (Fix) Hides not supported properties from current layer data given the file format
-rw-r--r--CHANGELOG.md9
-rw-r--r--UVtools.Core/Layer/Layer.cs29
-rw-r--r--UVtools.Core/Managers/ClipboardManager.cs17
-rw-r--r--UVtools.Core/UVtools.Core.csproj2
-rw-r--r--UVtools.WPF/MainWindow.Clipboard.cs4
-rw-r--r--UVtools.WPF/MainWindow.Information.cs28
-rw-r--r--UVtools.WPF/MainWindow.LayerPreview.cs20
-rw-r--r--UVtools.WPF/MainWindow.axaml19
-rw-r--r--UVtools.WPF/UVtools.WPF.csproj2
9 files changed, 80 insertions, 50 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 37fa92c..582fc37 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,14 @@
# Changelog
+## 07/11/2020 - v1.2.1
+
+* (Add) IsModified property to current layer information, indicates if layer have unsaved changes
+* (Add) Splitter between preview image and properties to resize the vertical space between that two controls
+* (Fix) Unable to save file with made modifications, layer IsModified property were lost when entering on clipboard
+* (Fix) After made a modification clipboard tries to restores that same modification (Redundant)
+* (Fix) Current layer data doesn't refresh when refreshing current layer, made changes not to show in
+* (Fix) Hides not supported properties from current layer data given the file format
+
## 07/11/2020 - v1.2.0
* (Add) RAM usage on title bar
diff --git a/UVtools.Core/Layer/Layer.cs b/UVtools.Core/Layer/Layer.cs
index 39f5551..cb5bf2b 100644
--- a/UVtools.Core/Layer/Layer.cs
+++ b/UVtools.Core/Layer/Layer.cs
@@ -134,25 +134,25 @@ namespace UVtools.Core
private byte[] _compressedBytes;
private uint _nonZeroPixelCount;
private Rectangle _boundingRectangle = Rectangle.Empty;
+ private bool _isModified;
private uint _index;
+ private float _positionZ;
private float _exposureTime;
private float _layerOffTime = FileFormat.DefaultLightOffDelay;
private float _liftHeight = FileFormat.DefaultLiftHeight;
private float _liftSpeed = FileFormat.DefaultLiftSpeed;
private float _retractSpeed = FileFormat.DefaultRetractSpeed;
private byte _lightPwm = FileFormat.DefaultLightPWM;
- private float _positionZ;
- private bool _isModified;
/// <summary>
/// Gets or sets layer image compressed data
/// </summary>
public byte[] CompressedBytes
{
- get => LayerManager.DecompressLayer(_compressedBytes);
+ get => _compressedBytes;
set
{
- _compressedBytes = LayerManager.CompressLayer(value);
+ _compressedBytes = value;
IsModified = true;
if (!ReferenceEquals(ParentLayerManager, null))
ParentLayerManager.BoundingRectangle = Rectangle.Empty;
@@ -1015,17 +1015,18 @@ namespace UVtools.Core
}
public Layer Clone()
{
- return new Layer(Index, CompressedBytes.ToArray(), ParentLayerManager)
+ return new Layer(_index, CompressedBytes.ToArray(), ParentLayerManager)
{
- PositionZ = PositionZ,
- ExposureTime = ExposureTime,
- LiftHeight = LiftHeight,
- LiftSpeed = LiftSpeed,
- RetractSpeed = RetractSpeed,
- LayerOffTime = LayerOffTime,
- LightPWM = LightPWM,
- BoundingRectangle = BoundingRectangle,
- NonZeroPixelCount = NonZeroPixelCount,
+ PositionZ = _positionZ,
+ ExposureTime = _exposureTime,
+ LiftHeight = _liftHeight,
+ LiftSpeed = _liftSpeed,
+ RetractSpeed = _retractSpeed,
+ LayerOffTime = _layerOffTime,
+ LightPWM = _lightPwm,
+ BoundingRectangle = _boundingRectangle,
+ NonZeroPixelCount = _nonZeroPixelCount,
+ IsModified = _isModified,
};
}
diff --git a/UVtools.Core/Managers/ClipboardManager.cs b/UVtools.Core/Managers/ClipboardManager.cs
index 0273217..6939bb6 100644
--- a/UVtools.Core/Managers/ClipboardManager.cs
+++ b/UVtools.Core/Managers/ClipboardManager.cs
@@ -85,7 +85,7 @@ namespace UVtools.Core.Managers
private int _currentIndex = -1;
private LayerManager _snapshotLayerManager;
private bool _reallocatedLayerCount;
- private bool _changedByClip;
+ private bool _suppressRestore;
/// <summary>
/// Gets the index of current item
@@ -94,13 +94,14 @@ namespace UVtools.Core.Managers
get => _currentIndex;
set
{
- if (value >= Count) value = Count-1;
if (_currentIndex == value) return;
+ if (value < -1) value = -1;
+ if (value >= Count) value = Count-1;
var oldIndex = _currentIndex;
_currentIndex = value;
//if (!RaiseAndSetIfChanged(ref _currentIndex, value)) return;
- if (value >= 0)
+ if (value >= 0 && !SuppressRestore)
{
int dir = oldIndex < _currentIndex ? 1 : -1;
@@ -136,10 +137,10 @@ namespace UVtools.Core.Managers
public string CurrentIndexCountStr => (CurrentIndex + 1).ToString().PadLeft(Count.ToString().Length, '0');
- public bool ChangedByClip
+ public bool SuppressRestore
{
- get => _changedByClip;
- set => RaiseAndSetIfChanged(ref _changedByClip, value);
+ get => _suppressRestore;
+ set => RaiseAndSetIfChanged(ref _suppressRestore, value);
}
public bool ReallocatedLayerCount
@@ -290,7 +291,7 @@ namespace UVtools.Core.Managers
return;
}
- ChangedByClip = true;
+ SuppressRestore = true;
var oldCurrentIndex = _currentIndex;
CurrentIndex = -1;
@@ -304,7 +305,7 @@ namespace UVtools.Core.Managers
Insert(0, clip);
CurrentIndex = 0;
- ChangedByClip = false;
+ SuppressRestore = false;
}
public void Undo()
diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj
index b4214c1..176522d 100644
--- a/UVtools.Core/UVtools.Core.csproj
+++ b/UVtools.Core/UVtools.Core.csproj
@@ -10,7 +10,7 @@
<RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl>
<PackageProjectUrl>https://github.com/sn4k3/UVtools</PackageProjectUrl>
<Description>MSLA/DLP, file analysis, repair, conversion and manipulation</Description>
- <Version>1.2.0</Version>
+ <Version>1.2.1</Version>
<Copyright>Copyright © 2020 PTRTECH</Copyright>
<PackageIcon>UVtools.png</PackageIcon>
<Platforms>AnyCPU;x64</Platforms>
diff --git a/UVtools.WPF/MainWindow.Clipboard.cs b/UVtools.WPF/MainWindow.Clipboard.cs
index e69c912..b2a4f11 100644
--- a/UVtools.WPF/MainWindow.Clipboard.cs
+++ b/UVtools.WPF/MainWindow.Clipboard.cs
@@ -30,7 +30,9 @@ namespace UVtools.WPF
{
if (e.PropertyName == nameof(Clipboard.CurrentIndex))
{
- if (Clipboard.CurrentIndex < 0 || Clipboard.ChangedByClip) return;
+ if (Clipboard.CurrentIndex < 0 || Clipboard.SuppressRestore) return;
+
+ AddLogVerbose($"Clipboard change: {Clipboard.CurrentIndex}");
if (Clipboard.ReallocatedLayerCount)
{
diff --git a/UVtools.WPF/MainWindow.Information.cs b/UVtools.WPF/MainWindow.Information.cs
index f5ee13d..8ffea82 100644
--- a/UVtools.WPF/MainWindow.Information.cs
+++ b/UVtools.WPF/MainWindow.Information.cs
@@ -10,6 +10,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
+using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
@@ -18,6 +19,7 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using MessageBox.Avalonia.Enums;
+using UVtools.Core.FileFormats;
using UVtools.Core.Objects;
using UVtools.WPF.Extensions;
using UVtools.WPF.Structures;
@@ -325,5 +327,31 @@ namespace UVtools.WPF
}
}
#endregion
+
+ #region Current Layer
+
+ public void AddCurrentLayerData()
+ {
+ var layer = LayerCache.Layer;
+ CurrentLayerProperties.Clear();
+ CurrentLayerProperties.Add(new StringTag(nameof(layer.Index), $"{layer.Index}"));
+ //CurrentLayerProperties.Add(new KeyValuePair<string, string>(nameof(layer.Filename), layer.Filename));
+ CurrentLayerProperties.Add(new StringTag(nameof(layer.PositionZ), $"{layer.PositionZ.ToString(CultureInfo.InvariantCulture)}mm"));
+ CurrentLayerProperties.Add(new StringTag(nameof(layer.IsBottomLayer), layer.IsBottomLayer.ToString()));
+ CurrentLayerProperties.Add(new StringTag(nameof(layer.IsModified), layer.IsModified.ToString()));
+ //CurrentLayerProperties.Add(new StringTag(nameof(layer.BoundingRectangle), layer.BoundingRectangle.ToString()));
+ //CurrentLayerProperties.Add(new StringTag(nameof(layer.NonZeroPixelCount), layer.NonZeroPixelCount.ToString()));
+ CurrentLayerProperties.Add(new StringTag(nameof(layer.ExposureTime), $"{layer.ExposureTime.ToString(CultureInfo.InvariantCulture)}s"));
+ if(SlicerFile.PrintParameterPerLayerModifiers.Contains(FileFormat.PrintParameterModifier.LiftHeight))
+ CurrentLayerProperties.Add(new StringTag(nameof(layer.LiftHeight), $"{layer.LiftHeight.ToString(CultureInfo.InvariantCulture)}mm @ {layer.LiftSpeed.ToString(CultureInfo.InvariantCulture)}mm/min"));
+ //CurrentLayerProperties.Adnew StringTagg>(nameof(layer.LiftSpeed), $"{layer.LiftSpeed.ToString(CultureInfo.InvariantCulture)}mm/min"));
+ if (SlicerFile.PrintParameterPerLayerModifiers.Contains(FileFormat.PrintParameterModifier.RetractSpeed))
+ CurrentLayerProperties.Add(new StringTag(nameof(layer.RetractSpeed), $"{layer.RetractSpeed.ToString(CultureInfo.InvariantCulture)}mm/min"));
+ if (SlicerFile.PrintParameterPerLayerModifiers.Contains(FileFormat.PrintParameterModifier.LayerOffTime))
+ CurrentLayerProperties.Add(new StringTag(nameof(layer.LayerOffTime), $"{layer.LayerOffTime.ToString(CultureInfo.InvariantCulture)}s"));
+ if (SlicerFile.PrintParameterPerLayerModifiers.Contains(FileFormat.PrintParameterModifier.LightPWM))
+ CurrentLayerProperties.Add(new StringTag(nameof(layer.LightPWM), layer.LightPWM.ToString()));
+ }
+ #endregion
}
}
diff --git a/UVtools.WPF/MainWindow.LayerPreview.cs b/UVtools.WPF/MainWindow.LayerPreview.cs
index d2b3872..0073f3c 100644
--- a/UVtools.WPF/MainWindow.LayerPreview.cs
+++ b/UVtools.WPF/MainWindow.LayerPreview.cs
@@ -119,14 +119,14 @@ namespace UVtools.WPF
{
if (IssuesGrid.SelectedItems.Count == 0 || !IssuesGrid.SelectedItems.Cast<LayerIssue>().Any(
issue => // Find a valid candidate to update layer preview, otherwise quit
- issue.LayerIndex == ActualLayer && issue.Type != LayerIssue.IssueType.EmptyLayer &&
+ issue.LayerIndex == _actualLayer && issue.Type != LayerIssue.IssueType.EmptyLayer &&
issue.Type != LayerIssue.IssueType.TouchingBound)) return;
}
else
{
if (!Issues.Any(
issue => // Find a valid candidate to update layer preview, otherwise quit
- issue.LayerIndex == ActualLayer && issue.Type != LayerIssue.IssueType.EmptyLayer &&
+ issue.LayerIndex == _actualLayer && issue.Type != LayerIssue.IssueType.EmptyLayer &&
issue.Type != LayerIssue.IssueType.TouchingBound)) return;
}
@@ -340,20 +340,6 @@ namespace UVtools.WPF
if (!RaiseAndSetIfChanged(ref _actualLayer, value)) return;
ShowLayer();
InvalidateLayerNavigation();
- var layer = LayerCache.Layer;
- CurrentLayerProperties.Clear();
- CurrentLayerProperties.Add(new StringTag(nameof(layer.Index), $"{layer.Index}"));
- //CurrentLayerProperties.Add(new KeyValuePair<string, string>(nameof(layer.Filename), layer.Filename));
- CurrentLayerProperties.Add(new StringTag(nameof(layer.PositionZ), $"{layer.PositionZ.ToString(CultureInfo.InvariantCulture)}mm"));
- CurrentLayerProperties.Add(new StringTag(nameof(layer.IsBottomLayer), layer.IsBottomLayer.ToString()));
- //CurrentLayerProperties.Add(new StringTag(nameof(layer.BoundingRectangle), layer.BoundingRectangle.ToString()));
- //CurrentLayerProperties.Add(new StringTag(nameof(layer.NonZeroPixelCount), layer.NonZeroPixelCount.ToString()));
- CurrentLayerProperties.Add(new StringTag(nameof(layer.ExposureTime), $"{layer.ExposureTime.ToString(CultureInfo.InvariantCulture)}s"));
- CurrentLayerProperties.Add(new StringTag(nameof(layer.LiftHeight), $"{layer.LiftHeight.ToString(CultureInfo.InvariantCulture)}mm @ {layer.LiftSpeed.ToString(CultureInfo.InvariantCulture)}mm/min"));
- //CurrentLayerProperties.Adnew StringTagg>(nameof(layer.LiftSpeed), $"{layer.LiftSpeed.ToString(CultureInfo.InvariantCulture)}mm/min"));
- CurrentLayerProperties.Add(new StringTag(nameof(layer.RetractSpeed), $"{layer.RetractSpeed.ToString(CultureInfo.InvariantCulture)}mm/min"));
- CurrentLayerProperties.Add(new StringTag(nameof(layer.LayerOffTime), $"{layer.LayerOffTime.ToString(CultureInfo.InvariantCulture)}s"));
- CurrentLayerProperties.Add(new StringTag(nameof(layer.LightPWM), layer.LightPWM.ToString()));
}
}
@@ -790,6 +776,8 @@ namespace UVtools.WPF
LayerImageBox.Image = LayerCache.Bitmap = LayerCache.ImageBgr.ToBitmap();
+ AddCurrentLayerData();
+
watch.Stop();
ShowLayerRenderMs = watch.ElapsedMilliseconds;
AddLogVerbose($"Show Layer: {_actualLayer}", watch.Elapsed.TotalSeconds);
diff --git a/UVtools.WPF/MainWindow.axaml b/UVtools.WPF/MainWindow.axaml
index 5fd1b26..7f2ac69 100644
--- a/UVtools.WPF/MainWindow.axaml
+++ b/UVtools.WPF/MainWindow.axaml
@@ -312,7 +312,7 @@
<Grid
IsVisible="{Binding IsFileLoaded}"
- RowDefinitions="Auto,Auto,Auto,*,Auto,Auto">
+ RowDefinitions="Auto,Auto,Auto,Auto,*,Auto,Auto">
<!-- Thumbnails -->
<StackPanel
IsVisible="{Binding SlicerFile.CreatedThumbnailsCount}"
@@ -375,12 +375,13 @@
IsVisible="{Binding SlicerFile.CreatedThumbnailsCount}"
Stretch="Uniform"
Grid.Row="1" Source="{Binding VisibleThumbnailImage}"/>
-
+
+ <GridSplitter Grid.Row="2" ResizeDirection="Rows" ResizeBehavior="PreviousAndNext" Background="Transparent" Height="5"/>
<!-- Properties -->
<StackPanel
IsVisible="{Binding SlicerProperties.Count}"
- Grid.Row="2"
+ Grid.Row="3"
Orientation="Horizontal"
Spacing="5"
VerticalAlignment="Center">
@@ -398,10 +399,10 @@
/>
</StackPanel>
-
+
<StackPanel
IsVisible="{Binding SlicerProperties.Count}"
- Grid.Row="2"
+ Grid.Row="3"
Orientation="Horizontal"
Spacing="2"
HorizontalAlignment="Right"
@@ -438,11 +439,11 @@
</Button>
</StackPanel>
-
+
<DataGrid
IsVisible="{Binding SlicerProperties.Count}"
Name="PropertiesGrid"
- Grid.Row="3"
+ Grid.Row="4"
CanUserReorderColumns="True"
CanUserResizeColumns="True"
CanUserSortColumns="True"
@@ -464,7 +465,7 @@
</DataGrid>
- <TextBlock Grid.Row="4"
+ <TextBlock Grid.Row="5"
Text="Layer data"
ToolTip.Tip="Shows the properties for the current selected layer"
FontWeight="Bold"
@@ -473,7 +474,7 @@
<DataGrid
IsVisible="{Binding IsFileLoaded}"
Name="CurrentLayerGrid"
- Grid.Row="5"
+ Grid.Row="6"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserSortColumns="False"
diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj
index f93061a..62df3bd 100644
--- a/UVtools.WPF/UVtools.WPF.csproj
+++ b/UVtools.WPF/UVtools.WPF.csproj
@@ -12,7 +12,7 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
- <Version>1.2.0</Version>
+ <Version>1.2.1</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">