Skip to content

Commit

Permalink
v0.4.1
Browse files Browse the repository at this point in the history
* (Add) Opening, Closing and Gradient Mutators
* (Add) Choose layer range when appling a mutator #1
* (Add) Choose iterations range/fading when appling a mutator (Thanks to Renos Makrosellis)
* (Add) Global and unhandled exceptions are now logged to be easier to report a bug
* (Change) Current layer and layer count text was reduced by 1 to match indexes on mutators
* (Improvement) Better mutator dialogs and explanation
* (Improvement) Compressed GUI images size
* (Fix) SlicerHeader was with wrong data size and affecting .photon, .cbddlp and .cbt (Thanks to Renos Makrosellis)
  • Loading branch information
sn4k3 committed Jun 1, 2020
1 parent 82f29a7 commit 15d9b3e
Show file tree
Hide file tree
Showing 57 changed files with 1,163 additions and 238 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 01/06/2020 - v0.4.1 - Beta

* (Add) Opening, Closing and Gradient Mutators
* (Add) Choose layer range when appling a mutator #1
* (Add) Choose iterations range/fading when appling a mutator (Thanks to Renos Makrosellis)
* (Add) Global and unhandled exceptions are now logged to be easier to report a bug
* (Change) Current layer and layer count text was reduced by 1 to match indexes on mutators
* (Improvement) Better mutator dialogs and explanation
* (Improvement) Compressed GUI images size
* (Fix) SlicerHeader was with wrong data size and affecting .photon, .cbddlp and .cbt (Thanks to Renos Makrosellis)


## 27/05/2020 - v0.4 - Beta

* (Add) CWS file format
Expand Down
6 changes: 2 additions & 4 deletions PrusaSL1Reader/ChituboxFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,9 @@ void rleRGB15()
currentOffset += Helpers.SerializeWriteFileStream(outputFile, PrintParametersSettings);

HeaderSettings.SlicerOffset = currentOffset;
HeaderSettings.SlicerSize = (uint) Helpers.Serializer.SizeOf(SlicerInfoSettings);
HeaderSettings.SlicerSize = (uint) Helpers.Serializer.SizeOf(SlicerInfoSettings) - SlicerInfoSettings.MachineNameSize;

SlicerInfoSettings.MachineNameAddress =
(uint) (currentOffset + Helpers.Serializer.SizeOf(SlicerInfoSettings) -
SlicerInfoSettings.MachineNameSize);
SlicerInfoSettings.MachineNameAddress = currentOffset + HeaderSettings.SlicerSize;


currentOffset += Helpers.SerializeWriteFileStream(outputFile, SlicerInfoSettings);
Expand Down
10 changes: 10 additions & 0 deletions PrusaSL1Reader/PHZFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,10 @@ void AddRep()
for (int x = 0; x < image.Width; x++)
{
var grey7 = (byte)((pixelRowSpan[x].PackedValue >> 1) & 0x7f);
if (grey7 > 0x7c)
{
grey7 = 0x7c;
}

if (color == byte.MaxValue)
{
Expand Down Expand Up @@ -882,6 +886,12 @@ private Image<L8> DecodePhzImage(uint layerIndex)
//lastColor = (byte) (code << 1);
// // Convert from 7bpp to 8bpp (extending the last bit)
lastColor = (byte) (((code & 0x7f) << 1) | (code & 1));
if (lastColor >= 0xfc) {
// Make 'white' actually white
lastColor = 0xff;

}

if (index < limit)
{
span[index].PackedValue = lastColor;
Expand Down
6 changes: 3 additions & 3 deletions PrusaSL1Reader/PrusaSL1Reader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<PackageProjectUrl>https://github.com/sn4k3/PrusaSL1Viewer</PackageProjectUrl>
<PackageIcon></PackageIcon>
<RepositoryUrl>https://github.com/sn4k3/PrusaSL1Viewer</RepositoryUrl>
<AssemblyVersion>0.4.0.0</AssemblyVersion>
<FileVersion>0.4.4.0</FileVersion>
<Version>0.4</Version>
<AssemblyVersion>0.4.1.0</AssemblyVersion>
<FileVersion>0.4.1.0</FileVersion>
<Version>0.4.1</Version>
<Description>Open, view, edit, extract and convert DLP/SLA files generated from Slicers</Description>
</PropertyGroup>

Expand Down
99 changes: 99 additions & 0 deletions PrusaSL1Viewer/Controls/SplitButton.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* 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.
*/
// https://stackoverflow.com/questions/10803184/windows-forms-button-with-drop-down-menu
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace PrusaSL1Viewer.Controls
{
public class SplitButton : Button
{
[DefaultValue(null), Browsable(true),
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public ContextMenuStrip Menu { get; set; }

[DefaultValue(20), Browsable(true),
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public int SplitWidth { get; set; } = 20;

[DefaultValue(false), Browsable(true),
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public bool OpenMenuOnlyOnArrow { get; set; } = false;

public SplitButton()
{
}

protected override void OnMouseClick(MouseEventArgs e)
{
if (Menu != null && e.Button == MouseButtons.Left)
{
if (OpenMenuOnlyOnArrow)
{
var splitRect = new Rectangle(this.Width - this.SplitWidth, 0, this.SplitWidth, this.Height);
if (!splitRect.Contains(e.Location))
{
base.OnMouseDown(e);
return;
}
}
Menu.Show(this, 0, this.Height); // Shows menu under button
//Menu.Show(this, mevent.Location); // Shows menu at click location
}
else
{
base.OnMouseDown(e);
}
}

/*protected override void OnMouseDown(MouseEventArgs mevent)
{
var splitRect = new Rectangle(this.Width - this.SplitWidth, 0, this.SplitWidth, this.Height);
// Figure out if the button click was on the button itself or the menu split
if (Menu != null &&
mevent.Button == MouseButtons.Left &&
splitRect.Contains(mevent.Location))
{
Menu.Show(this, 0, this.Height); // Shows menu under button
//Menu.Show(this, mevent.Location); // Shows menu at click location
}
else
{
base.OnMouseDown(mevent);
}
}*/

protected override void OnPaint(PaintEventArgs pevent)
{
base.OnPaint(pevent);

if (this.Menu != null && this.SplitWidth > 0)
{
// Draw the arrow glyph on the right side of the button
int arrowX = ClientRectangle.Width - 14;
int arrowY = ClientRectangle.Height / 2 - 1;

var arrowBrush = Enabled ? SystemBrushes.ControlText : SystemBrushes.ButtonShadow;
var arrows = new[] { new Point(arrowX, arrowY), new Point(arrowX + 7, arrowY), new Point(arrowX + 3, arrowY + 4) };
pevent.Graphics.FillPolygon(arrowBrush, arrows);

// Draw a dashed separator on the left of the arrow
int lineX = ClientRectangle.Width - this.SplitWidth;
int lineYFrom = arrowY - 4;
int lineYTo = arrowY + 8;
using (var separatorPen = new Pen(Brushes.DarkGray) { DashStyle = DashStyle.Dot })
{
pevent.Graphics.DrawLine(separatorPen, lineX, lineYFrom, lineX, lineYTo);
}
}
}
}
}
Loading

0 comments on commit 15d9b3e

Please sign in to comment.