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-04-22 05:01:29 +0300
committerTiago Conceição <Tiago_caza@hotmail.com>2020-04-22 05:01:29 +0300
commit054d55b45242b1cfa33a272c1e0271c834a3698e (patch)
tree5f5213a7ae3a0e7d3cdc74a334a9b8a5f4b1ffa7
parentef3bef5073e130460513c5bd3adf5577834aa05d (diff)
v0.2.2v0.2.2
-rw-r--r--CHANGELOG.md9
-rw-r--r--PrusaSL1Reader/CbddlpFile.cs135
-rw-r--r--PrusaSL1Reader/FileFormat.cs61
-rw-r--r--PrusaSL1Reader/IFileFormat.cs19
-rw-r--r--PrusaSL1Reader/PrusaSL1Reader.csproj1
-rw-r--r--PrusaSL1Reader/SL1File.cs78
-rw-r--r--PrusaSL1Viewer/FrmAbout.cs2
-rw-r--r--PrusaSL1Viewer/FrmMain.Designer.cs445
-rw-r--r--PrusaSL1Viewer/FrmMain.cs118
-rw-r--r--PrusaSL1Viewer/FrmMain.resx3
-rw-r--r--PrusaSL1Viewer/Images/Screenshots/PrusaSL1Viewer_GUI.pngbin288262 -> 258396 bytes
-rw-r--r--PrusaSL1Viewer/Program.cs9
-rw-r--r--PrusaSL1Viewer/Properties/AssemblyInfo.cs2
13 files changed, 593 insertions, 289 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1cc16ba..6c0e6ff 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,14 +1,19 @@
# Changelog
-## ?? - v0.2.2 - Beta
+## 22/04/2020 - v0.2.2 - Beta
* (Add) File -> Reload
* (Add) File -> Save
* (Add) File -> Save As
-* (Add) Can now edit some print properties
+* (Add) Can now ajust some print properties
* (Add) 'Initial Layer Count' to status bar
+* (Add) Allow cbbdlp format to extract 'File -> Extract'
+* (Add) Thumbnail resolution label
+* (Add) Layer resolution label
+* (Add) Allow save current layer image
* (Change) Rearrange menu edit items to file
* (Change) Edit some shortcuts
+* (Change) Strict use dot (.) for real numbers instead of comma (,)
## 15/04/2020 - v0.2.1 - Beta
diff --git a/PrusaSL1Reader/CbddlpFile.cs b/PrusaSL1Reader/CbddlpFile.cs
index 332a0fd..441f4e5 100644
--- a/PrusaSL1Reader/CbddlpFile.cs
+++ b/PrusaSL1Reader/CbddlpFile.cs
@@ -203,7 +203,7 @@ namespace PrusaSL1Reader
public override string FileFullPath { get; set; }
- public override FileExtension[] ValidFiles { get; } = {
+ public override FileExtension[] FileExtensions { get; } = {
new FileExtension("cbddlp", "Chitubox DLP Files"),
new FileExtension("photon", "Photon Files"),
};
@@ -219,8 +219,8 @@ namespace PrusaSL1Reader
public override PrintParameterModifier[] PrintParameterModifiers => new[]
{
PrintParameterModifier.InitialLayerCount,
- PrintParameterModifier.InitialExposureTime,
- PrintParameterModifier.ExposureTime,
+ PrintParameterModifier.InitialExposureSeconds,
+ PrintParameterModifier.ExposureSeconds,
PrintParameterModifier.BottomLayerOffTime,
PrintParameterModifier.LayerOffTime,
@@ -272,7 +272,91 @@ namespace PrusaSL1Reader
public override bool SetValueFromPrintParameterModifier(PrintParameterModifier modifier, string value)
{
- throw new NotImplementedException();
+ void updateLayers()
+ {
+ for (byte aaIndex = 0; aaIndex < HeaderSettings.AntiAliasLevel; aaIndex++)
+ {
+ for (uint layerIndex = 0; layerIndex < HeaderSettings.LayerCount; layerIndex++)
+ {
+ // Bottom : others
+ Layers[layerIndex, aaIndex].LayerExposure = layerIndex < HeaderSettings.BottomLayersCount ? HeaderSettings.BottomExposureSeconds : HeaderSettings.LayerExposureSeconds;
+ Layers[layerIndex, aaIndex].LayerOffTimeSeconds = layerIndex < HeaderSettings.BottomLayersCount ? PrintParametersSettings.BottomLightOffDelay : PrintParametersSettings.LightOffDelay;
+ }
+ }
+ }
+
+ if (ReferenceEquals(modifier, PrintParameterModifier.InitialLayerCount))
+ {
+ HeaderSettings.BottomLayersCount =
+ PrintParametersSettings.BottomLayerCount = value.Convert<uint>();
+ updateLayers();
+ return true;
+ }
+ if (ReferenceEquals(modifier, PrintParameterModifier.InitialExposureSeconds))
+ {
+ HeaderSettings.BottomExposureSeconds = value.Convert<float>();
+ updateLayers();
+ return true;
+ }
+
+ if (ReferenceEquals(modifier, PrintParameterModifier.ExposureSeconds))
+ {
+ HeaderSettings.LayerExposureSeconds = value.Convert<float>();
+ updateLayers();
+ return true;
+ }
+
+ if (ReferenceEquals(modifier, PrintParameterModifier.BottomLayerOffTime))
+ {
+ PrintParametersSettings.BottomLightOffDelay = value.Convert<float>();
+ updateLayers();
+ return true;
+ }
+ if (ReferenceEquals(modifier, PrintParameterModifier.LayerOffTime))
+ {
+ HeaderSettings.LayerOffTime =
+ PrintParametersSettings.LightOffDelay = value.Convert<float>();
+ updateLayers();
+ return true;
+ }
+ if (ReferenceEquals(modifier, PrintParameterModifier.BottomLiftHeight))
+ {
+ PrintParametersSettings.BottomLiftHeight = value.Convert<float>();
+ return true;
+ }
+ if (ReferenceEquals(modifier, PrintParameterModifier.BottomLiftSpeed))
+ {
+ PrintParametersSettings.BottomLiftSpeed = value.Convert<float>();
+ return true;
+ }
+ if (ReferenceEquals(modifier, PrintParameterModifier.LiftHeight))
+ {
+ PrintParametersSettings.LiftHeight = value.Convert<float>();
+ return true;
+ }
+ if (ReferenceEquals(modifier, PrintParameterModifier.LiftingSpeed))
+ {
+ PrintParametersSettings.LiftingSpeed = value.Convert<float>();
+ return true;
+ }
+ if (ReferenceEquals(modifier, PrintParameterModifier.RetractSpeed))
+ {
+ PrintParametersSettings.RetractSpeed = value.Convert<float>();
+ return true;
+ }
+
+ if (ReferenceEquals(modifier, PrintParameterModifier.BottomLightPWM))
+ {
+ HeaderSettings.BottomLightPWM = value.Convert<ushort>();
+ return true;
+ }
+ if (ReferenceEquals(modifier, PrintParameterModifier.LightPWM))
+ {
+ HeaderSettings.LightPWM = value.Convert<ushort>();
+ return true;
+ }
+
+ return false;
}
public override void BeginEncode(string fileFullPath)
@@ -550,7 +634,7 @@ namespace PrusaSL1Reader
Image<Gray8> image = new Image<Gray8>((int)HeaderSettings.BedSizeX, (int)HeaderSettings.BedSizeY);
- for (uint aaIndex = 0; aaIndex < HeaderSettings.AntiAliasLevel; aaIndex++)
+ for (byte aaIndex = 0; aaIndex < HeaderSettings.AntiAliasLevel; aaIndex++)
{
Debug.WriteLine($"-Image GROUP {aaIndex}-");
for (uint layerIndex = 0; layerIndex < HeaderSettings.LayerCount; layerIndex++)
@@ -567,14 +651,49 @@ namespace PrusaSL1Reader
}
}
- public override void Extract(string path, bool emptyFirst = true)
+ public override void Extract(string path, bool emptyFirst = true, bool genericConfigExtract = false,
+ bool genericLayersExtract = false)
{
- throw new NotImplementedException();
+ base.Extract(path, emptyFirst, true, true);
}
public override void SaveAs(string filePath = null)
{
- throw new NotImplementedException();
+ InputFile.Dispose();
+ if (!string.IsNullOrEmpty(filePath))
+ {
+ File.Copy(FileFullPath, filePath, true);
+ FileFullPath = filePath;
+
+ }
+
+ using (InputFile = new FileStream(FileFullPath, FileMode.Open, FileAccess.Write))
+ {
+
+ InputFile.Seek(0, SeekOrigin.Begin);
+ Helpers.SerializeWriteFileStream(InputFile, HeaderSettings);
+
+ if (HeaderSettings.Version == 2 && HeaderSettings.PrintParametersOffsetAddress > 0)
+ {
+ InputFile.Seek(HeaderSettings.PrintParametersOffsetAddress, SeekOrigin.Begin);
+ Helpers.SerializeWriteFileStream(InputFile, PrintParametersSettings);
+ Helpers.SerializeWriteFileStream(InputFile, MachineInfoSettings);
+ }
+
+ uint layerOffset = HeaderSettings.LayersDefinitionOffsetAddress;
+ for (byte aaIndex = 0; aaIndex < HeaderSettings.AntiAliasLevel; aaIndex++)
+ {
+ for (uint layerIndex = 0; layerIndex < HeaderSettings.LayerCount; layerIndex++)
+ {
+ InputFile.Seek(layerOffset, SeekOrigin.Begin);
+ Helpers.SerializeWriteFileStream(InputFile, Layers[layerIndex, aaIndex]);
+ layerOffset += (uint) Helpers.Serializer.SizeOf(Layers[layerIndex, aaIndex]);
+ }
+ }
+ InputFile.Close();
+ }
+
+ Decode(FileFullPath);
}
public override Image<Gray8> GetLayerImage(uint layerIndex)
diff --git a/PrusaSL1Reader/FileFormat.cs b/PrusaSL1Reader/FileFormat.cs
index f41d78a..dca480b 100644
--- a/PrusaSL1Reader/FileFormat.cs
+++ b/PrusaSL1Reader/FileFormat.cs
@@ -8,7 +8,9 @@
using System;
using System.IO;
using System.Linq;
+using System.Runtime.CompilerServices;
using SixLabors.ImageSharp;
+using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
namespace PrusaSL1Reader
@@ -26,8 +28,8 @@ namespace PrusaSL1Reader
public class PrintParameterModifier
{
public static PrintParameterModifier InitialLayerCount { get; } = new PrintParameterModifier("Initial Layer Count", @"Modify 'Initial Layer Count' value", null,0, ushort.MaxValue);
- public static PrintParameterModifier InitialExposureTime { get; } = new PrintParameterModifier("Initial Exposure Time", @"Modify 'Initial Exposure Time' seconds", "s", 0.1M, byte.MaxValue);
- public static PrintParameterModifier ExposureTime { get; } = new PrintParameterModifier("Exposure Time", @"Modify 'Exposure Time' seconds", "s", 0.1M, byte.MaxValue);
+ public static PrintParameterModifier InitialExposureSeconds { get; } = new PrintParameterModifier("Initial Exposure Time", @"Modify 'Initial Exposure Time' seconds", "s", 0.1M, byte.MaxValue);
+ public static PrintParameterModifier ExposureSeconds { get; } = new PrintParameterModifier("Exposure Time", @"Modify 'Exposure Time' seconds", "s", 0.1M, byte.MaxValue);
public static PrintParameterModifier BottomLayerOffTime { get; } = new PrintParameterModifier("Bottom Layer Off Time", @"Modify 'Bottom Layer Off Time' seconds", "s");
public static PrintParameterModifier LayerOffTime { get; } = new PrintParameterModifier("Layer Off Time", @"Modify 'Layer Off Time' seconds", "s");
@@ -65,6 +67,11 @@ namespace PrusaSL1Reader
}
#endregion
+ #region Constants
+ private const string ExtractConfigFileName = "Configuration";
+ private const string ExtractConfigFileExtension = "ini";
+ #endregion
+
public static FileFormat[] AvaliableFormats { get; } =
{
new SL1File(),
@@ -93,7 +100,7 @@ namespace PrusaSL1Reader
/// <summary>
/// Gets the valid file extensions for this <see cref="FileFormat"/>
/// </summary>
- public abstract FileExtension[] ValidFiles { get; }
+ public abstract FileExtension[] FileExtensions { get; }
public abstract uint ResolutionX { get; }
public abstract uint ResolutionY { get; }
@@ -157,9 +164,9 @@ namespace PrusaSL1Reader
{
if (ReferenceEquals(modifier, PrintParameterModifier.InitialLayerCount))
return InitialLayerCount;
- if (ReferenceEquals(modifier, PrintParameterModifier.InitialExposureTime))
+ if (ReferenceEquals(modifier, PrintParameterModifier.InitialExposureSeconds))
return InitialExposureTime;
- if (ReferenceEquals(modifier, PrintParameterModifier.ExposureTime))
+ if (ReferenceEquals(modifier, PrintParameterModifier.ExposureSeconds))
return LayerExposureTime;
@@ -189,7 +196,7 @@ namespace PrusaSL1Reader
FileFullPath = fileFullPath;
}
- public virtual void Extract(string path, bool emptyFirst = true)
+ public virtual void Extract(string path, bool emptyFirst = true, bool genericConfigExtract = false, bool genericLayersExtract = false)
{
if (emptyFirst)
{
@@ -207,6 +214,44 @@ namespace PrusaSL1Reader
}
}
}
+
+ if (genericConfigExtract)
+ {
+ using (TextWriter tw = new StreamWriter(Path.Combine(path, $"{ExtractConfigFileName}.{ExtractConfigFileExtension}")))
+ {
+ foreach (var config in Configs)
+ {
+ var type = config.GetType();
+ tw.WriteLine($"[{type.Name}]");
+ foreach (var property in type.GetProperties())
+ {
+ tw.WriteLine($"{property.Name} = {property.GetValue(config)}");
+ }
+ tw.WriteLine();
+ }
+ tw.Close();
+ }
+ }
+
+ if (genericLayersExtract)
+ {
+ var encoder = new PngEncoder();
+ uint i = 0;
+ foreach (var thumbnail in Thumbnails)
+ {
+ if (ReferenceEquals(thumbnail, null))
+ {
+ continue;
+ }
+ thumbnail.Save(Path.Combine(path, $"Thumbnail{i}.png"), encoder);
+ i++;
+ }
+ for (i = 0; i < LayerCount; i++)
+ {
+
+ GetLayerImage(i).Save(Path.Combine(path, $"Layer{i}.png"), encoder);
+ }
+ }
}
public void Save()
@@ -254,14 +299,14 @@ namespace PrusaSL1Reader
public bool IsExtensionValid(string extension, bool isFilePath = false)
{
extension = isFilePath ? Path.GetExtension(extension)?.Remove(0, 1) : extension;
- return ValidFiles.Any(fileExtension => fileExtension.Extension.Equals(extension));
+ return FileExtensions.Any(fileExtension => fileExtension.Extension.Equals(extension));
}
public string GetFileFilter()
{
string result = string.Empty;
- foreach (var fileExt in ValidFiles)
+ foreach (var fileExt in FileExtensions)
{
if (!ReferenceEquals(result, string.Empty))
{
diff --git a/PrusaSL1Reader/IFileFormat.cs b/PrusaSL1Reader/IFileFormat.cs
index 0f27a59..a972b56 100644
--- a/PrusaSL1Reader/IFileFormat.cs
+++ b/PrusaSL1Reader/IFileFormat.cs
@@ -7,7 +7,6 @@
*/
using System;
-using System.Collections.Generic;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
@@ -19,16 +18,23 @@ namespace PrusaSL1Reader
public interface IFileFormat
{
/// <summary>
+ /// Gets the valid file extensions for this <see cref="FileFormat"/>
+ /// </summary>
+ FileExtension[] FileExtensions { get; }
+
+ /// <summary>
/// Gets the input file path loaded into this <see cref="FileFormat"/>
/// </summary>
string FileFullPath { get; set; }
/// <summary>
- /// Gets the valid file extensions for this <see cref="FileFormat"/>
+ /// Gets the image width resolution
/// </summary>
- FileExtension[] ValidFiles { get; }
-
uint ResolutionX { get; }
+
+ /// <summary>
+ /// Gets the image height resolution
+ /// </summary>
uint ResolutionY { get; }
/// <summary>
@@ -106,7 +112,10 @@ namespace PrusaSL1Reader
/// </summary>
/// <param name="path">Path to folder where content will be extracted</param>
/// <param name="emptyFirst">Empty target folder first</param>
- void Extract(string path, bool emptyFirst = true);
+ /// <param name="genericConfigExtract"></param>
+ /// <param name="genericLayersExtract"></param>
+ void Extract(string path, bool emptyFirst = true, bool genericConfigExtract = false,
+ bool genericLayersExtract = false);
/// <summary>
/// Saves current configuration on input file
diff --git a/PrusaSL1Reader/PrusaSL1Reader.csproj b/PrusaSL1Reader/PrusaSL1Reader.csproj
index 8189359..cb5757a 100644
--- a/PrusaSL1Reader/PrusaSL1Reader.csproj
+++ b/PrusaSL1Reader/PrusaSL1Reader.csproj
@@ -10,6 +10,7 @@
<AssemblyVersion>0.2.2.0</AssemblyVersion>
<FileVersion>0.2.2.0</FileVersion>
<Version>0.2.2</Version>
+ <Description>Open, view, edit, extract and convert DLP/SLA files generated from Slicers</Description>
</PropertyGroup>
<ItemGroup>
diff --git a/PrusaSL1Reader/SL1File.cs b/PrusaSL1Reader/SL1File.cs
index 4cc1a51..31762c3 100644
--- a/PrusaSL1Reader/SL1File.cs
+++ b/PrusaSL1Reader/SL1File.cs
@@ -284,8 +284,8 @@ namespace PrusaSL1Reader
public override PrintParameterModifier[] PrintParameterModifiers => new[]
{
PrintParameterModifier.InitialLayerCount,
- PrintParameterModifier.InitialExposureTime,
- PrintParameterModifier.ExposureTime,
+ PrintParameterModifier.InitialExposureSeconds,
+ PrintParameterModifier.ExposureSeconds,
};
public override uint LayerCount => OutputConfigSettings.NumFast;
@@ -316,13 +316,13 @@ namespace PrusaSL1Reader
OutputConfigSettings.NumFade = value.Convert<byte>();
return true;
}
- if (ReferenceEquals(modifier, PrintParameterModifier.InitialExposureTime))
+ if (ReferenceEquals(modifier, PrintParameterModifier.InitialExposureSeconds))
{
MaterialSettings.InitialExposureTime =
OutputConfigSettings.ExpTimeFirst = value.Convert<ushort>();
return true;
}
- if (ReferenceEquals(modifier, PrintParameterModifier.ExposureTime))
+ if (ReferenceEquals(modifier, PrintParameterModifier.ExposureSeconds))
{
MaterialSettings.ExposureTime =
OutputConfigSettings.ExpTime = value.Convert<byte>();
@@ -332,7 +332,7 @@ namespace PrusaSL1Reader
return false;
}
- public override FileExtension[] ValidFiles { get; } = {
+ public override FileExtension[] FileExtensions { get; } = {
new FileExtension("sl1", "Prusa SL1 Files")
};
@@ -407,7 +407,7 @@ namespace PrusaSL1Reader
PrintSettings,
OutputConfigSettings,
};
- InputFile = ZipFile.Open(FileFullPath, ZipArchiveMode.Update);
+ InputFile = ZipFile.Open(FileFullPath, ZipArchiveMode.Read);
byte thumbnailIndex = 0;
foreach (ZipArchiveEntry entity in InputFile.Entries)
{
@@ -419,7 +419,7 @@ namespace PrusaSL1Reader
while ((line = streamReader.ReadLine()) != null)
{
string[] keyValue = line.Split(new []{'='}, 2);
- if (keyValue.Length < 1) continue;
+ if (keyValue.Length < 2) continue;
keyValue[0] = keyValue[0].Trim();
keyValue[1] = keyValue[1].Trim();
@@ -469,60 +469,64 @@ namespace PrusaSL1Reader
Debug.WriteLine(Statistics);
}
- public override void Extract(string path, bool emptyFirst = true)
+ public override void Extract(string path, bool emptyFirst = true, bool genericConfigExtract = false,
+ bool genericLayersExtract = false)
{
- base.Extract(path, emptyFirst);
+ base.Extract(path, emptyFirst, genericConfigExtract);
InputFile.ExtractToDirectory(path);
}
public override void SaveAs(string filePath = null)
{
+ InputFile.Dispose();
if (!string.IsNullOrEmpty(filePath))
{
- InputFile.Dispose();
-
File.Copy(FileFullPath, filePath, true);
-
FileFullPath = filePath;
- InputFile = ZipFile.Open(FileFullPath, ZipArchiveMode.Update);
+
}
- //InputFile.CreateEntry("Modified");
- InputFile.GetEntry("config.ini")?.Delete();
- var entry = InputFile.CreateEntry("config.ini");
- using (TextWriter tw = new StreamWriter(entry.Open()))
+ using (InputFile = ZipFile.Open(FileFullPath, ZipArchiveMode.Update))
{
- var properties = OutputConfigSettings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
- foreach (var property in properties)
+ //InputFile.CreateEntry("Modified");
+ InputFile.GetEntry("config.ini")?.Delete();
+ var entry = InputFile.CreateEntry("config.ini");
+ using (TextWriter tw = new StreamWriter(entry.Open()))
{
- var name = char.ToLowerInvariant(property.Name[0]) + property.Name.Substring(1);
- tw.WriteLine($"{name} = {property.GetValue(OutputConfigSettings)}");
+ var properties = OutputConfigSettings.GetType()
+ .GetProperties(BindingFlags.Public | BindingFlags.Instance);
+
+ foreach (var property in properties)
+ {
+ var name = char.ToLowerInvariant(property.Name[0]) + property.Name.Substring(1);
+ tw.WriteLine($"{name} = {property.GetValue(OutputConfigSettings)}");
+ }
+
+ tw.Close();
}
- tw.Close();
- }
- InputFile.GetEntry("prusaslicer.ini")?.Delete();
- entry = InputFile.CreateEntry("prusaslicer.ini");
- using (TextWriter tw = new StreamWriter(entry.Open()))
- {
- foreach (var config in Configs)
+ InputFile.GetEntry("prusaslicer.ini")?.Delete();
+ entry = InputFile.CreateEntry("prusaslicer.ini");
+ using (TextWriter tw = new StreamWriter(entry.Open()))
{
- if (ReferenceEquals(config, OutputConfigSettings))
- continue;
+ foreach (var config in Configs)
+ {
+ if (ReferenceEquals(config, OutputConfigSettings))
+ continue;
- var properties = config.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
+ var properties = config.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
- foreach (var property in properties)
- {
- tw.WriteLine($"{MemberNameToIniKey(property.Name)} = {property.GetValue(config)}");
+ foreach (var property in properties)
+ {
+ tw.WriteLine($"{MemberNameToIniKey(property.Name)} = {property.GetValue(config)}");
+ }
}
- }
- tw.Close();
+ tw.Close();
+ }
}
- InputFile.Dispose();
Decode(FileFullPath);
}
diff --git a/PrusaSL1Viewer/FrmAbout.cs b/PrusaSL1Viewer/FrmAbout.cs
index f308d50..a3297ed 100644
--- a/PrusaSL1Viewer/FrmAbout.cs
+++ b/PrusaSL1Viewer/FrmAbout.cs
@@ -65,7 +65,7 @@ namespace PrusaSL1Viewer
string description = ((AssemblyDescriptionAttribute) attributes[0]).Description + $"{Environment.NewLine}{Environment.NewLine}Available File Formats:";
- return FileFormat.AvaliableFormats.SelectMany(fileFormat => fileFormat.ValidFiles).Aggregate(description, (current, fileExtension) => current + $"{Environment.NewLine}- {fileExtension.Description} (.{fileExtension.Extension})");
+ return FileFormat.AvaliableFormats.SelectMany(fileFormat => fileFormat.FileExtensions).Aggregate(description, (current, fileExtension) => current + $"{Environment.NewLine}- {fileExtension.Description} (.{fileExtension.Extension})");
}
}
diff --git a/PrusaSL1Viewer/FrmMain.Designer.cs b/PrusaSL1Viewer/FrmMain.Designer.cs
index 7625512..69b71a2 100644
--- a/PrusaSL1Viewer/FrmMain.Designer.cs
+++ b/PrusaSL1Viewer/FrmMain.Designer.cs
@@ -31,41 +31,45 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
this.menu = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuFileOpen = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuFileReload = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuFileSave = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuFileSaveAs = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuFileClose = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.menuFileExtract = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuFileConvert = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
+ this.menuFileExit = new System.Windows.Forms.ToolStripMenuItem();
this.menuEdit = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuViewRotateImage = new System.Windows.Forms.ToolStripMenuItem();
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuAboutWebsite = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuAboutDonate = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuAboutAbout = new System.Windows.Forms.ToolStripMenuItem();
this.statusBar = new System.Windows.Forms.StatusStrip();
this.sbLayers = new System.Windows.Forms.VScrollBar();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.lbLayers = new System.Windows.Forms.Label();
this.scLeft = new System.Windows.Forms.SplitContainer();
+ this.pbThumbnail = new System.Windows.Forms.PictureBox();
this.tsThumbnails = new System.Windows.Forms.ToolStrip();
+ this.tsThumbnailsPrevious = new System.Windows.Forms.ToolStripButton();
this.tsThumbnailsCount = new System.Windows.Forms.ToolStripLabel();
+ this.tsThumbnailsNext = new System.Windows.Forms.ToolStripButton();
+ this.tsThumbnailsExport = new System.Windows.Forms.ToolStripButton();
+ this.tsThumbnailsResolution = new System.Windows.Forms.ToolStripLabel();
this.lvProperties = new System.Windows.Forms.ListView();
this.lvChKey = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lvChValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.scCenter = new System.Windows.Forms.SplitContainer();
- this.pbLayers = new System.Windows.Forms.ProgressBar();
- this.pbThumbnail = new System.Windows.Forms.PictureBox();
- this.tsThumbnailsPrevious = new System.Windows.Forms.ToolStripButton();
- this.tsThumbnailsNext = new System.Windows.Forms.ToolStripButton();
- this.tsThumbnailsExport = new System.Windows.Forms.ToolStripButton();
this.pbLayer = new System.Windows.Forms.PictureBox();
- this.menuFileOpen = new System.Windows.Forms.ToolStripMenuItem();
- this.menuFileReload = new System.Windows.Forms.ToolStripMenuItem();
- this.menuFileSave = new System.Windows.Forms.ToolStripMenuItem();
- this.menuFileSaveAs = new System.Windows.Forms.ToolStripMenuItem();
- this.menuFileClose = new System.Windows.Forms.ToolStripMenuItem();
- this.menuFileExtract = new System.Windows.Forms.ToolStripMenuItem();
- this.menuFileConvert = new System.Windows.Forms.ToolStripMenuItem();
- this.menuFileExit = new System.Windows.Forms.ToolStripMenuItem();
- this.menuViewRotateImage = new System.Windows.Forms.ToolStripMenuItem();
- this.menuAboutWebsite = new System.Windows.Forms.ToolStripMenuItem();
- this.menuAboutDonate = new System.Windows.Forms.ToolStripMenuItem();
- this.menuAboutAbout = new System.Windows.Forms.ToolStripMenuItem();
+ this.pbLayers = new System.Windows.Forms.ProgressBar();
+ this.tsLayer = new System.Windows.Forms.ToolStrip();
+ this.tsLayerImageExport = new System.Windows.Forms.ToolStripButton();
+ this.tsLayerResolution = new System.Windows.Forms.ToolStripLabel();
this.menu.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
@@ -76,13 +80,14 @@
this.scLeft.Panel1.SuspendLayout();
this.scLeft.Panel2.SuspendLayout();
this.scLeft.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pbThumbnail)).BeginInit();
this.tsThumbnails.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.scCenter)).BeginInit();
this.scCenter.Panel1.SuspendLayout();
this.scCenter.Panel2.SuspendLayout();
this.scCenter.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.pbThumbnail)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbLayer)).BeginInit();
+ this.tsLayer.SuspendLayout();
this.SuspendLayout();
//
// menu
@@ -115,16 +120,93 @@
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "&File";
//
+ // menuFileOpen
+ //
+ this.menuFileOpen.Image = global::PrusaSL1Viewer.Properties.Resources.Open_16x16;
+ this.menuFileOpen.Name = "menuFileOpen";
+ this.menuFileOpen.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
+ this.menuFileOpen.Size = new System.Drawing.Size(186, 22);
+ this.menuFileOpen.Text = "&Open";
+ this.menuFileOpen.Click += new System.EventHandler(this.ItemClicked);
+ //
+ // menuFileReload
+ //
+ this.menuFileReload.Image = global::PrusaSL1Viewer.Properties.Resources.File_Refresh_16x16;
+ this.menuFileReload.Name = "menuFileReload";
+ this.menuFileReload.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F5)));
+ this.menuFileReload.Size = new System.Drawing.Size(186, 22);
+ this.menuFileReload.Text = "&Reload";
+ this.menuFileReload.Click += new System.EventHandler(this.ItemClicked);
+ //
+ // menuFileSave
+ //
+ this.menuFileSave.Enabled = false;
+ this.menuFileSave.Image = global::PrusaSL1Viewer.Properties.Resources.Save_16x16;
+ this.menuFileSave.Name = "menuFileSave";
+ this.menuFileSave.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
+ this.menuFileSave.Size = new System.Drawing.Size(186, 22);
+ this.menuFileSave.Text = "&Save";
+ this.menuFileSave.Click += new System.EventHandler(this.ItemClicked);
+ //
+ // menuFileSaveAs
+ //
+ this.menuFileSaveAs.Enabled = false;
+ this.menuFileSaveAs.Image = global::PrusaSL1Viewer.Properties.Resources.SaveAs_16x16;
+ this.menuFileSaveAs.Name = "menuFileSaveAs";
+ this.menuFileSaveAs.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
+ | System.Windows.Forms.Keys.S)));
+ this.menuFileSaveAs.Size = new System.Drawing.Size(186, 22);
+ this.menuFileSaveAs.Text = "Save As";
+ this.menuFileSaveAs.Click += new System.EventHandler(this.ItemClicked);
+ //
+ // menuFileClose
+ //
+ this.menuFileClose.Enabled = false;
+ this.menuFileClose.Image = global::PrusaSL1Viewer.Properties.Resources.File_Close_16x16;
+ this.menuFileClose.Name = "menuFileClose";
+ this.menuFileClose.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.W)));
+ this.menuFileClose.Size = new System.Drawing.Size(186, 22);
+ this.menuFileClose.Text = "&Close";
+ this.menuFileClose.Click += new System.EventHandler(this.ItemClicked);
+ //
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(183, 6);
//
+ // menuFileExtract
+ //
+ this.menuFileExtract.Enabled = false;
+ this.menuFileExtract.Image = global::PrusaSL1Viewer.Properties.Resources.Extract_object_16x16;
+ this.menuFileExtract.Name = "menuFileExtract";
+ this.menuFileExtract.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt)
+ | System.Windows.Forms.Keys.E)));
+ this.menuFileExtract.Size = new System.Drawing.Size(186, 22);
+ this.menuFileExtract.Text = "&Extract";
+ this.menuFileExtract.Click += new System.EventHandler(this.ItemClicked);
+ //
+ // menuFileConvert
+ //
+ this.menuFileConvert.Enabled = false;
+ this.menuFileConvert.Image = global::PrusaSL1Viewer.Properties.Resources.Convert_16x16;
+ this.menuFileConvert.Name = "menuFileConvert";
+ this.menuFileConvert.Size = new System.Drawing.Size(186, 22);
+ this.menuFileConvert.Text = "&Convert To";
+ //
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(183, 6);
//
+ // menuFileExit
+ //
+ this.menuFileExit.Image = global::PrusaSL1Viewer.Properties.Resources.Exit_16x16;
+ this.menuFileExit.Name = "menuFileExit";
+ this.menuFileExit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
+ this.menuFileExit.Size = new System.Drawing.Size(186, 22);
+ this.menuFileExit.Text = "&Exit";
+ this.menuFileExit.Click += new System.EventHandler(this.ItemClicked);
+ //
// menuEdit
//
this.menuEdit.Enabled = false;
@@ -140,6 +222,19 @@
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "&View";
//
+ // menuViewRotateImage
+ //
+ this.menuViewRotateImage.Checked = true;
+ this.menuViewRotateImage.CheckOnClick = true;
+ this.menuViewRotateImage.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.menuViewRotateImage.Image = global::PrusaSL1Viewer.Properties.Resources.Rotate_16x16;
+ this.menuViewRotateImage.Name = "menuViewRotateImage";
+ this.menuViewRotateImage.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R)));
+ this.menuViewRotateImage.Size = new System.Drawing.Size(205, 22);
+ this.menuViewRotateImage.Text = "&Rotate Image 90º";
+ this.menuViewRotateImage.ToolTipText = "Auto rotate layer preview image at 90º (This can slow down the layer preview)";
+ this.menuViewRotateImage.Click += new System.EventHandler(this.ItemClicked);
+ //
// helpToolStripMenuItem
//
this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -150,6 +245,34 @@
this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.helpToolStripMenuItem.Text = "&Help";
//
+ // menuAboutWebsite
+ //
+ this.menuAboutWebsite.Image = global::PrusaSL1Viewer.Properties.Resources.Global_Network_icon_16x16;
+ this.menuAboutWebsite.Name = "menuAboutWebsite";
+ this.menuAboutWebsite.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
+ | System.Windows.Forms.Keys.W)));
+ this.menuAboutWebsite.Size = new System.Drawing.Size(193, 22);
+ this.menuAboutWebsite.Text = "&Website";
+ this.menuAboutWebsite.Click += new System.EventHandler(this.ItemClicked);
+ //
+ // menuAboutDonate
+ //
+ this.menuAboutDonate.Image = global::PrusaSL1Viewer.Properties.Resources.Donate_16x16;
+ this.menuAboutDonate.Name = "menuAboutDonate";
+ this.menuAboutDonate.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
+ this.menuAboutDonate.Size = new System.Drawing.Size(193, 22);
+ this.menuAboutDonate.Text = "&Donate";
+ this.menuAboutDonate.Click += new System.EventHandler(this.ItemClicked);
+ //
+ // menuAboutAbout
+ //
+ this.menuAboutAbout.Image = global::PrusaSL1Viewer.Properties.Resources.Button_Info_16x16;
+ this.menuAboutAbout.Name = "menuAboutAbout";
+ this.menuAboutAbout.ShortcutKeys = System.Windows.Forms.Keys.F1;
+ this.menuAboutAbout.Size = new System.Drawing.Size(193, 22);
+ this.menuAboutAbout.Text = "&About";
+ this.menuAboutAbout.Click += new System.EventHandler(this.ItemClicked);
+ //
// statusBar
//
this.statusBar.Location = new System.Drawing.Point(0, 761);
@@ -240,6 +363,17 @@
this.scLeft.SplitterDistance = 425;
this.scLeft.TabIndex = 3;
//
+ // pbThumbnail
+ //
+ this.pbThumbnail.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.pbThumbnail.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pbThumbnail.Location = new System.Drawing.Point(0, 25);
+ this.pbThumbnail.Name = "pbThumbnail";
+ this.pbThumbnail.Size = new System.Drawing.Size(394, 400);
+ this.pbThumbnail.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+ this.pbThumbnail.TabIndex = 4;
+ this.pbThumbnail.TabStop = false;
+ //
// tsThumbnails
//
this.tsThumbnails.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
@@ -247,12 +381,25 @@
this.tsThumbnailsPrevious,
this.tsThumbnailsCount,
this.tsThumbnailsNext,
- this.tsThumbnailsExport});
+ this.tsThumbnailsExport,
+ this.tsThumbnailsResolution});
this.tsThumbnails.Location = new System.Drawing.Point(0, 0);
this.tsThumbnails.Name = "tsThumbnails";
this.tsThumbnails.Size = new System.Drawing.Size(394, 25);
this.tsThumbnails.TabIndex = 5;
- this.tsThumbnails.Text = "tsThumbnails";
+ this.tsThumbnails.Text = "Thumbnail Menu";
+ //
+ // tsThumbnailsPrevious
+ //
+ this.tsThumbnailsPrevious.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ this.tsThumbnailsPrevious.Enabled = false;
+ this.tsThumbnailsPrevious.Image = global::PrusaSL1Viewer.Properties.Resources.Back_16x16;
+ this.tsThumbnailsPrevious.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.tsThumbnailsPrevious.Name = "tsThumbnailsPrevious";
+ this.tsThumbnailsPrevious.Size = new System.Drawing.Size(23, 22);
+ this.tsThumbnailsPrevious.Text = "toolStripButton1";
+ this.tsThumbnailsPrevious.ToolTipText = "Show previous thumbnail";
+ this.tsThumbnailsPrevious.Click += new System.EventHandler(this.ItemClicked);
//
// tsThumbnailsCount
//
@@ -261,6 +408,39 @@
this.tsThumbnailsCount.Size = new System.Drawing.Size(24, 22);
this.tsThumbnailsCount.Text = "0/0";
//
+ // tsThumbnailsNext
+ //
+ this.tsThumbnailsNext.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ this.tsThumbnailsNext.Enabled = false;
+ this.tsThumbnailsNext.Image = global::PrusaSL1Viewer.Properties.Resources.Next_16x16;
+ this.tsThumbnailsNext.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.tsThumbnailsNext.Name = "tsThumbnailsNext";
+ this.tsThumbnailsNext.Size = new System.Drawing.Size(23, 22);
+ this.tsThumbnailsNext.Text = "toolStripButton2";
+ this.tsThumbnailsNext.ToolTipText = "Show next thumbnail";
+ this.tsThumbnailsNext.Click += new System.EventHandler(this.ItemClicked);
+ //
+ // tsThumbnailsExport
+ //
+ this.tsThumbnailsExport.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
+ this.tsThumbnailsExport.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ this.tsThumbnailsExport.Enabled = false;
+ this.tsThumbnailsExport.Image = global::PrusaSL1Viewer.Properties.Resources.Save_16x16;
+ this.tsThumbnailsExport.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.tsThumbnailsExport.Name = "tsThumbnailsExport";
+ this.tsThumbnailsExport.Size = new System.Drawing.Size(23, 22);
+ this.tsThumbnailsExport.Text = "Save Thumbnail";
+ this.tsThumbnailsExport.ToolTipText = "Save thumbnail to file";
+ this.tsThumbnailsExport.Click += new System.EventHandler(this.ItemClicked);
+ //
+ // tsThumbnailsResolution
+ //
+ this.tsThumbnailsResolution.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
+ this.tsThumbnailsResolution.Name = "tsThumbnailsResolution";
+ this.tsThumbnailsResolution.Size = new System.Drawing.Size(63, 22);
+ this.tsThumbnailsResolution.Text = "Resolution";
+ this.tsThumbnailsResolution.ToolTipText = "Thumbnail Resolution";
+ //
// lvProperties
//
this.lvProperties.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
@@ -299,6 +479,7 @@
// scCenter.Panel1
//
this.scCenter.Panel1.Controls.Add(this.pbLayer);
+ this.scCenter.Panel1.Controls.Add(this.tsLayer);
//
// scCenter.Panel2
//
@@ -308,191 +489,58 @@
this.scCenter.SplitterDistance = 702;
this.scCenter.TabIndex = 4;
//
- // pbLayers
- //
- this.pbLayers.Dock = System.Windows.Forms.DockStyle.Fill;
- this.pbLayers.Location = new System.Drawing.Point(0, 0);
- this.pbLayers.Name = "pbLayers";
- this.pbLayers.Size = new System.Drawing.Size(1125, 25);
- this.pbLayers.Step = 1;
- this.pbLayers.TabIndex = 6;
- //
- // pbThumbnail
- //
- this.pbThumbnail.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.pbThumbnail.Dock = System.Windows.Forms.DockStyle.Fill;
- this.pbThumbnail.Location = new System.Drawing.Point(0, 25);
- this.pbThumbnail.Name = "pbThumbnail";
- this.pbThumbnail.Size = new System.Drawing.Size(394, 400);
- this.pbThumbnail.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
- this.pbThumbnail.TabIndex = 4;
- this.pbThumbnail.TabStop = false;
- //
- // tsThumbnailsPrevious
- //
- this.tsThumbnailsPrevious.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
- this.tsThumbnailsPrevious.Enabled = false;
- this.tsThumbnailsPrevious.Image = global::PrusaSL1Viewer.Properties.Resources.Back_16x16;
- this.tsThumbnailsPrevious.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.tsThumbnailsPrevious.Name = "tsThumbnailsPrevious";
- this.tsThumbnailsPrevious.Size = new System.Drawing.Size(23, 22);
- this.tsThumbnailsPrevious.Text = "toolStripButton1";
- this.tsThumbnailsPrevious.ToolTipText = "Show previous thumbnail";
- this.tsThumbnailsPrevious.Click += new System.EventHandler(this.ItemClicked);
- //
- // tsThumbnailsNext
- //
- this.tsThumbnailsNext.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
- this.tsThumbnailsNext.Enabled = false;
- this.tsThumbnailsNext.Image = global::PrusaSL1Viewer.Properties.Resources.Next_16x16;
- this.tsThumbnailsNext.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.tsThumbnailsNext.Name = "tsThumbnailsNext";
- this.tsThumbnailsNext.Size = new System.Drawing.Size(23, 22);
- this.tsThumbnailsNext.Text = "toolStripButton2";
- this.tsThumbnailsNext.ToolTipText = "Show next thumbnail";
- this.tsThumbnailsNext.Click += new System.EventHandler(this.ItemClicked);
- //
- // tsThumbnailsExport
- //
- this.tsThumbnailsExport.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
- this.tsThumbnailsExport.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
- this.tsThumbnailsExport.Enabled = false;
- this.tsThumbnailsExport.Image = global::PrusaSL1Viewer.Properties.Resources.Save_16x16;
- this.tsThumbnailsExport.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.tsThumbnailsExport.Name = "tsThumbnailsExport";
- this.tsThumbnailsExport.Size = new System.Drawing.Size(23, 22);
- this.tsThumbnailsExport.Text = "toolStripButton3";
- this.tsThumbnailsExport.ToolTipText = "Save thumbnail to file";
- this.tsThumbnailsExport.Click += new System.EventHandler(this.ItemClicked);
- //
// pbLayer
//
this.pbLayer.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.pbLayer.Dock = System.Windows.Forms.DockStyle.Fill;
- this.pbLayer.Location = new System.Drawing.Point(0, 0);
+ this.pbLayer.Location = new System.Drawing.Point(0, 25);
this.pbLayer.Name = "pbLayer";
- this.pbLayer.Size = new System.Drawing.Size(1125, 702);
+ this.pbLayer.Size = new System.Drawing.Size(1125, 677);
this.pbLayer.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pbLayer.TabIndex = 5;
this.pbLayer.TabStop = false;
//
- // menuFileOpen
- //
- this.menuFileOpen.Image = global::PrusaSL1Viewer.Properties.Resources.Open_16x16;
- this.menuFileOpen.Name = "menuFileOpen";
- this.menuFileOpen.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
- this.menuFileOpen.Size = new System.Drawing.Size(186, 22);
- this.menuFileOpen.Text = "&Open";
- this.menuFileOpen.Click += new System.EventHandler(this.ItemClicked);
- //
- // menuFileReload
- //
- this.menuFileReload.Image = global::PrusaSL1Viewer.Properties.Resources.File_Refresh_16x16;
- this.menuFileReload.Name = "menuFileReload";
- this.menuFileReload.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F5)));
- this.menuFileReload.Size = new System.Drawing.Size(186, 22);
- this.menuFileReload.Text = "&Reload";
- this.menuFileReload.Click += new System.EventHandler(this.ItemClicked);
- //
- // menuFileSave
- //
- this.menuFileSave.Enabled = false;
- this.menuFileSave.Image = global::PrusaSL1Viewer.Properties.Resources.Save_16x16;
- this.menuFileSave.Name = "menuFileSave";
- this.menuFileSave.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
- this.menuFileSave.Size = new System.Drawing.Size(186, 22);
- this.menuFileSave.Text = "&Save";
- this.menuFileSave.Click += new System.EventHandler(this.ItemClicked);
- //
- // menuFileSaveAs
- //
- this.menuFileSaveAs.Enabled = false;
- this.menuFileSaveAs.Image = global::PrusaSL1Viewer.Properties.Resources.SaveAs_16x16;
- this.menuFileSaveAs.Name = "menuFileSaveAs";
- this.menuFileSaveAs.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
- | System.Windows.Forms.Keys.S)));
- this.menuFileSaveAs.Size = new System.Drawing.Size(186, 22);
- this.menuFileSaveAs.Text = "Save As";
- this.menuFileSaveAs.Click += new System.EventHandler(this.ItemClicked);
- //
- // menuFileClose
- //
- this.menuFileClose.Enabled = false;
- this.menuFileClose.Image = global::PrusaSL1Viewer.Properties.Resources.File_Close_16x16;
- this.menuFileClose.Name = "menuFileClose";
- this.menuFileClose.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.W)));
- this.menuFileClose.Size = new System.Drawing.Size(186, 22);
- this.menuFileClose.Text = "&Close";
- this.menuFileClose.Click += new System.EventHandler(this.ItemClicked);
- //
- // menuFileExtract
- //
- this.menuFileExtract.Enabled = false;
- this.menuFileExtract.Image = global::PrusaSL1Viewer.Properties.Resources.Extract_object_16x16;
- this.menuFileExtract.Name = "menuFileExtract";
- this.menuFileExtract.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt)
- | System.Windows.Forms.Keys.E)));
- this.menuFileExtract.Size = new System.Drawing.Size(186, 22);
- this.menuFileExtract.Text = "&Extract";
- this.menuFileExtract.Click += new System.EventHandler(this.ItemClicked);
- //
- // menuFileConvert
- //
- this.menuFileConvert.Enabled = false;
- this.menuFileConvert.Image = global::PrusaSL1Viewer.Properties.Resources.Convert_16x16;
- this.menuFileConvert.Name = "menuFileConvert";
- this.menuFileConvert.Size = new System.Drawing.Size(186, 22);
- this.menuFileConvert.Text = "&Convert To";
- //
- // menuFileExit
- //
- this.menuFileExit.Image = global::PrusaSL1Viewer.Properties.Resources.Exit_16x16;
- this.menuFileExit.Name = "menuFileExit";
- this.menuFileExit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
- this.menuFileExit.Size = new System.Drawing.Size(186, 22);
- this.menuFileExit.Text = "&Exit";
- this.menuFileExit.Click += new System.EventHandler(this.ItemClicked);
- //
- // menuViewRotateImage
- //
- this.menuViewRotateImage.Checked = true;
- this.menuViewRotateImage.CheckOnClick = true;
- this.menuViewRotateImage.CheckState = System.Windows.Forms.CheckState.Checked;
- this.menuViewRotateImage.Image = global::PrusaSL1Viewer.Properties.Resources.Rotate_16x16;
- this.menuViewRotateImage.Name = "menuViewRotateImage";
- this.menuViewRotateImage.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R)));
- this.menuViewRotateImage.Size = new System.Drawing.Size(205, 22);
- this.menuViewRotateImage.Text = "&Rotate Image 90º";
- this.menuViewRotateImage.ToolTipText = "Auto rotate layer preview image at 90º (This can slow down the layer preview)";
- this.menuViewRotateImage.Click += new System.EventHandler(this.ItemClicked);
- //
- // menuAboutWebsite
- //
- this.menuAboutWebsite.Image = global::PrusaSL1Viewer.Properties.Resources.Global_Network_icon_16x16;
- this.menuAboutWebsite.Name = "menuAboutWebsite";
- this.menuAboutWebsite.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
- | System.Windows.Forms.Keys.W)));
- this.menuAboutWebsite.Size = new System.Drawing.Size(193, 22);
- this.menuAboutWebsite.Text = "&Website";
- this.menuAboutWebsite.Click += new System.EventHandler(this.ItemClicked);
- //
- // menuAboutDonate
- //
- this.menuAboutDonate.Image = global::PrusaSL1Viewer.Properties.Resources.Donate_16x16;
- this.menuAboutDonate.Name = "menuAboutDonate";
- this.menuAboutDonate.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
- this.menuAboutDonate.Size = new System.Drawing.Size(193, 22);
- this.menuAboutDonate.Text = "&Donate";
- this.menuAboutDonate.Click += new System.EventHandler(this.ItemClicked);
+ // pbLayers
//
- // menuAboutAbout
+ this.pbLayers.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pbLayers.Location = new System.Drawing.Point(0, 0);
+ this.pbLayers.Name = "pbLayers";
+ this.pbLayers.Size = new System.Drawing.Size(1125, 25);
+ this.pbLayers.Step = 1;
+ this.pbLayers.TabIndex = 6;
//
- this.menuAboutAbout.Image = global::PrusaSL1Viewer.Properties.Resources.Button_Info_16x16;
- this.menuAboutAbout.Name = "menuAboutAbout";
- this.menuAboutAbout.ShortcutKeys = System.Windows.Forms.Keys.F1;
- this.menuAboutAbout.Size = new System.Drawing.Size(193, 22);
- this.menuAboutAbout.Text = "&About";
- this.menuAboutAbout.Click += new System.EventHandler(this.ItemClicked);
+ // tsLayer
+ //
+ this.tsLayer.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
+ this.tsLayer.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.tsLayerImageExport,
+ this.tsLayerResolution});
+ this.tsLayer.Location = new System.Drawing.Point(0, 0);
+ this.tsLayer.Name = "tsLayer";
+ this.tsLayer.Size = new System.Drawing.Size(1125, 25);
+ this.tsLayer.TabIndex = 6;
+ this.tsLayer.Text = "Layer Menu";
+ //
+ // tsLayerImageExport
+ //
+ this.tsLayerImageExport.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
+ this.tsLayerImageExport.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+ this.tsLayerImageExport.Enabled = false;
+ this.tsLayerImageExport.Image = global::PrusaSL1Viewer.Properties.Resources.Save_16x16;
+ this.tsLayerImageExport.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.tsLayerImageExport.Name = "tsLayerImageExport";
+ this.tsLayerImageExport.Size = new System.Drawing.Size(23, 22);
+ this.tsLayerImageExport.Text = "Save Layer";
+ this.tsLayerImageExport.ToolTipText = "Save layer image to file";
+ this.tsLayerImageExport.Click += new System.EventHandler(this.ItemClicked);
+ //
+ // tsLayerResolution
+ //
+ this.tsLayerResolution.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
+ this.tsLayerResolution.Name = "tsLayerResolution";
+ this.tsLayerResolution.Size = new System.Drawing.Size(63, 22);
+ this.tsLayerResolution.Text = "Resolution";
+ this.tsLayerResolution.ToolTipText = "Layer Resolution";
//
// FrmMain
//
@@ -520,14 +568,17 @@
this.scLeft.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.scLeft)).EndInit();
this.scLeft.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.pbThumbnail)).EndInit();
this.tsThumbnails.ResumeLayout(false);
this.tsThumbnails.PerformLayout();
this.scCenter.Panel1.ResumeLayout(false);
+ this.scCenter.Panel1.PerformLayout();
this.scCenter.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.scCenter)).EndInit();
this.scCenter.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.pbThumbnail)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbLayer)).EndInit();
+ this.tsLayer.ResumeLayout(false);
+ this.tsLayer.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -572,6 +623,10 @@
private System.Windows.Forms.ToolStripMenuItem menuFileReload;
private System.Windows.Forms.ToolStripMenuItem menuFileSave;
private System.Windows.Forms.ToolStripMenuItem menuFileSaveAs;
+ private System.Windows.Forms.ToolStripLabel tsThumbnailsResolution;
+ private System.Windows.Forms.ToolStrip tsLayer;
+ private System.Windows.Forms.ToolStripButton tsLayerImageExport;
+ private System.Windows.Forms.ToolStripLabel tsLayerResolution;
}
}
diff --git a/PrusaSL1Viewer/FrmMain.cs b/PrusaSL1Viewer/FrmMain.cs
index 058574f..c914b7e 100644
--- a/PrusaSL1Viewer/FrmMain.cs
+++ b/PrusaSL1Viewer/FrmMain.cs
@@ -7,11 +7,14 @@
*/
using System;
using System.Diagnostics;
+using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using PrusaSL1Reader;
using SixLabors.ImageSharp;
+using SixLabors.ImageSharp.Formats.Png;
+using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
namespace PrusaSL1Viewer
@@ -24,6 +27,8 @@ namespace PrusaSL1Viewer
set => Program.SlicerFile = value;
}
+ public uint ActualLayer => (uint)(sbLayers.Maximum - sbLayers.Value);
+
#region Constructors
public FrmMain()
{
@@ -256,6 +261,8 @@ namespace PrusaSL1Viewer
tsThumbnailsCount.Text = $"{i+1}/{SlicerFile.CreatedThumbnailsCount}";
tsThumbnailsNext.Enabled = true;
+
+ tsThumbnailsResolution.Text = pbThumbnail.Image.PhysicalDimension.ToString();
return;
}
@@ -280,6 +287,8 @@ namespace PrusaSL1Viewer
tsThumbnailsCount.Text = $"{i+1}/{SlicerFile.CreatedThumbnailsCount}";
tsThumbnailsPrevious.Enabled = true;
+
+ tsThumbnailsResolution.Text = pbThumbnail.Image.PhysicalDimension.ToString();
return;
}
@@ -310,12 +319,43 @@ namespace PrusaSL1Viewer
}
}
+
+ /************************
+ * Layer Menu *
+ ***********************/
+ if (ReferenceEquals(sender, tsLayerImageExport))
+ {
+ using (SaveFileDialog dialog = new SaveFileDialog())
+ {
+ if (ReferenceEquals(pbLayer, null))
+ {
+ return; // This should never happen!
+ }
+
+ dialog.Filter = "Image Files|.*png";
+ dialog.AddExtension = true;
+ dialog.FileName = $"{Path.GetFileNameWithoutExtension(SlicerFile.FileFullPath)}_layer{ActualLayer}.png";
+
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ using (var stream = dialog.OpenFile())
+ {
+ Image<Gray8> image = (Image<Gray8>)pbLayer.Image.Tag;
+ image.Save(stream, new PngEncoder());
+ stream.Close();
+ }
+ }
+
+ return;
+
+ }
+ }
}
private void sbLayers_ValueChanged(object sender, EventArgs e)
{
if (ReferenceEquals(SlicerFile, null)) return;
- ShowLayer((uint)(sbLayers.Maximum - sbLayers.Value));
+ ShowLayer(ActualLayer);
}
private void ConvertToItemOnClick(object sender, EventArgs e)
@@ -378,8 +418,14 @@ namespace PrusaSL1Viewer
{
item.Enabled = false;
}
+ foreach (ToolStripItem item in tsLayer.Items)
+ {
+ item.Enabled = false;
+ }
+
+ tsThumbnailsResolution.Text =
+ tsLayerResolution.Text = string.Empty;
-
menuFileReload.Enabled =
menuFileSave.Enabled =
@@ -428,6 +474,18 @@ namespace PrusaSL1Viewer
if (ReferenceEquals(SlicerFile, null)) return;
SlicerFile.Decode(fileName);
+ if (SlicerFile.LayerCount == 0)
+ {
+ MessageBox.Show("It seens the file don't have any layer, the causes can be:\n" +
+ "- Empty\n" +
+ "- Corrupted\n" +
+ "- Lacking a sliced model\n" +
+ "- A programing internal error\n\n" +
+ "Please check your file and retry", "Error reading the file - Lacking of layers", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ Clear();
+ return;
+ }
+
foreach (var fileFormat in FileFormat.AvaliableFormats)
{
if (fileFormat.GetType() == SlicerFile.GetType()) continue;
@@ -445,13 +503,17 @@ namespace PrusaSL1Viewer
tsThumbnailsCount.Tag = 0;
tsThumbnailsCount.Text = $"1/{SlicerFile.CreatedThumbnailsCount}";
pbThumbnail.Image = SlicerFile.Thumbnails[0]?.ToBitmap();
+ tsThumbnailsResolution.Text = pbThumbnail.Image.PhysicalDimension.ToString();
for (var i = 1; i < tsThumbnails.Items.Count; i++)
{
tsThumbnails.Items[i].Enabled = true;
}
}
-
+ foreach (ToolStripItem item in tsLayer.Items)
+ {
+ item.Enabled = true;
+ }
menuFileReload.Enabled =
menuFileClose.Enabled =
@@ -472,6 +534,8 @@ namespace PrusaSL1Viewer
RefreshInfo();
+ tsLayerResolution.Text = pbLayer.Image.PhysicalDimension.ToString();
+
Text = $"{FrmAbout.AssemblyTitle} Version: {FrmAbout.AssemblyVersion} File: {Path.GetFileName(fileName)}";
}
@@ -522,33 +586,41 @@ namespace PrusaSL1Viewer
void ShowLayer(uint layerNum)
{
- //if(!ReferenceEquals(pbLayer.Image, null))
- // pbLayer.Image.Dispose(); SLOW! LET GC DO IT
- //pbLayer.Image = Image.FromStream(SlicerFile.LayerEntries[layerNum].Open());
- //pbLayer.Image.RotateFlip(RotateFlipType.Rotate90FlipNone);
- //Stopwatch watch = Stopwatch.StartNew();
- var image = SlicerFile.GetLayerImage(layerNum);
- //Debug.Write(watch.ElapsedMilliseconds.ToString());
- if (menuViewRotateImage.Checked)
+ try
{
- //watch.Restart();
- image.Mutate(x => x.Rotate(RotateMode.Rotate90));
- //Debug.Write($"/{watch.ElapsedMilliseconds}");
- }
+ //if(!ReferenceEquals(pbLayer.Image, null))
+ //pbLayer.Image?.Dispose(); // SLOW! LET GC DO IT
+ //pbLayer.Image = Image.FromStream(SlicerFile.LayerEntries[layerNum].Open());
+ //pbLayer.Image.RotateFlip(RotateFlipType.Rotate90FlipNone);
+ //Stopwatch watch = Stopwatch.StartNew();
+ var image = SlicerFile.GetLayerImage(layerNum);
+ //Debug.Write(watch.ElapsedMilliseconds.ToString());
+ if (menuViewRotateImage.Checked)
+ {
+ //watch.Restart();
+ image.Mutate(x => x.Rotate(RotateMode.Rotate90));
+ //Debug.Write($"/{watch.ElapsedMilliseconds}");
+ }
- //watch.Restart();
- pbLayer.Image = image.ToBitmap();
- //Debug.WriteLine($"/{watch.ElapsedMilliseconds}");
+ //watch.Restart();
+ pbLayer.Image = image.ToBitmap();
+ pbLayer.Image.Tag = image;
+ //Debug.WriteLine($"/{watch.ElapsedMilliseconds}");
- //UniversalLayer layer = new UniversalLayer(image);
- //pbLayer.Image = layer.ToBitmap(image.Width, image.Height);
+ //UniversalLayer layer = new UniversalLayer(image);
+ //pbLayer.Image = layer.ToBitmap(image.Width, image.Height);
- byte percent = (byte)((layerNum + 1) * 100 / SlicerFile.LayerCount);
+ byte percent = (byte)((layerNum + 1) * 100 / SlicerFile.LayerCount);
- lbLayers.Text = $"{SlicerFile.TotalHeight}mm\n{layerNum+1} / {SlicerFile.LayerCount}\n{SlicerFile.GetHeightFromLayer((uint)layerNum+1)}mm\n{percent}%";
- pbLayers.Value = percent;
+ lbLayers.Text = $"{SlicerFile.TotalHeight}mm\n{layerNum + 1} / {SlicerFile.LayerCount}\n{SlicerFile.GetHeightFromLayer((uint)layerNum + 1)}mm\n{percent}%";
+ pbLayers.Value = percent;
+ }
+ catch (Exception e)
+ {
+ Debug.WriteLine(e);
+ }
}
diff --git a/PrusaSL1Viewer/FrmMain.resx b/PrusaSL1Viewer/FrmMain.resx
index 2bb9532..d68375e 100644
--- a/PrusaSL1Viewer/FrmMain.resx
+++ b/PrusaSL1Viewer/FrmMain.resx
@@ -126,6 +126,9 @@
<metadata name="tsThumbnails.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>233, 17</value>
</metadata>
+ <metadata name="tsLayer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>357, 17</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>
diff --git a/PrusaSL1Viewer/Images/Screenshots/PrusaSL1Viewer_GUI.png b/PrusaSL1Viewer/Images/Screenshots/PrusaSL1Viewer_GUI.png
index f99a531..5e50c21 100644
--- a/PrusaSL1Viewer/Images/Screenshots/PrusaSL1Viewer_GUI.png
+++ b/PrusaSL1Viewer/Images/Screenshots/PrusaSL1Viewer_GUI.png
Binary files differ
diff --git a/PrusaSL1Viewer/Program.cs b/PrusaSL1Viewer/Program.cs
index 27858f5..0bfbe42 100644
--- a/PrusaSL1Viewer/Program.cs
+++ b/PrusaSL1Viewer/Program.cs
@@ -32,15 +32,6 @@ namespace PrusaSL1Viewer
FrmMain = new FrmMain();
FrmAbout = new FrmAbout();
Application.Run(FrmMain);
-
- //CbddlpFile file = new CbddlpFile();
-
- //file.Decode(@"D:\Tiago\Desktop\_Coronavirus-v6-HIRES-Supports_NOAA.cbddlp");
- /*file.Decode(@"D:\Tiago\Desktop\coronanew11.cbddlp");
- file.GetLayerImage(0).Save(@"D:\img-new-0.png");
- file.GetLayerImage(10).Save(@"D:\img-new-10.png");
- file.GetLayerImage(20).Save(@"D:\img-new-20.png");
- file.GetLayerImage(50).Save(@"D:\img-new-50.png");*/
}
}
}
diff --git a/PrusaSL1Viewer/Properties/AssemblyInfo.cs b/PrusaSL1Viewer/Properties/AssemblyInfo.cs
index 468037c..eec0d42 100644
--- a/PrusaSL1Viewer/Properties/AssemblyInfo.cs
+++ b/PrusaSL1Viewer/Properties/AssemblyInfo.cs
@@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PrusaSL1Viewer")]
-[assembly: AssemblyDescription("Open, view, extract and convert SL1 files generated from PrusaSlicer")]
+[assembly: AssemblyDescription("Open, view, edit, extract and convert SL1 files generated from PrusaSlicer")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("PTRTECH")]
[assembly: AssemblyProduct("PrusaSL1Viewer")]