Ran code maid against this code.
This commit is contained in:
parent
1445945d9c
commit
591528ee91
309 changed files with 139399 additions and 140129 deletions
|
|
@ -3,13 +3,13 @@ Copyright (c) 2014, Lars Brubaker
|
|||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
|
|
@ -23,64 +23,64 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.PlatformAbstract;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.MeshVisualizer;
|
||||
using MatterHackers.VectorMath;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
public class Cover : GuiWidget
|
||||
{
|
||||
public Cover(HAnchor hAnchor = HAnchor.None, VAnchor vAnchor = VAnchor.None)
|
||||
: base(hAnchor, vAnchor)
|
||||
{
|
||||
}
|
||||
}
|
||||
public class Cover : GuiWidget
|
||||
{
|
||||
public Cover(HAnchor hAnchor = HAnchor.None, VAnchor vAnchor = VAnchor.None)
|
||||
: base(hAnchor, vAnchor)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class PartPreview3DWidget : PartPreviewWidget
|
||||
{
|
||||
protected static readonly int DefaultScrollBarWidth = 120;
|
||||
public class PartPreview3DWidget : PartPreviewWidget
|
||||
{
|
||||
protected static readonly int DefaultScrollBarWidth = 120;
|
||||
|
||||
protected bool autoRotating = false;
|
||||
protected bool allowAutoRotate = false;
|
||||
public MeshViewerWidget meshViewerWidget;
|
||||
event EventHandler unregisterEvents;
|
||||
protected bool autoRotating = false;
|
||||
protected bool allowAutoRotate = false;
|
||||
public MeshViewerWidget meshViewerWidget;
|
||||
|
||||
protected ViewControls3D viewControls3D;
|
||||
private event EventHandler unregisterEvents;
|
||||
|
||||
bool needToRecretaeBed = false;
|
||||
protected ViewControls3D viewControls3D;
|
||||
|
||||
public PartPreview3DWidget()
|
||||
{
|
||||
SliceSettingsWidget.RegisterForSettingsChange("bed_size", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
|
||||
SliceSettingsWidget.RegisterForSettingsChange("print_center", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
|
||||
SliceSettingsWidget.RegisterForSettingsChange("build_height", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
|
||||
SliceSettingsWidget.RegisterForSettingsChange("bed_shape", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
|
||||
SliceSettingsWidget.RegisterForSettingsChange("center_part_on_bed", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
|
||||
private bool needToRecretaeBed = false;
|
||||
|
||||
public PartPreview3DWidget()
|
||||
{
|
||||
SliceSettingsWidget.RegisterForSettingsChange("bed_size", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
|
||||
SliceSettingsWidget.RegisterForSettingsChange("print_center", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
|
||||
SliceSettingsWidget.RegisterForSettingsChange("build_height", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
|
||||
SliceSettingsWidget.RegisterForSettingsChange("bed_shape", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
|
||||
SliceSettingsWidget.RegisterForSettingsChange("center_part_on_bed", SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
|
||||
#if false
|
||||
"extruder_offset",
|
||||
#endif
|
||||
|
||||
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
|
||||
}
|
||||
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(SetFlagToRecreateBedAndPartPosition, ref unregisterEvents);
|
||||
}
|
||||
|
||||
void SetFlagToRecreateBedAndPartPosition(object sender, EventArgs e)
|
||||
{
|
||||
private void SetFlagToRecreateBedAndPartPosition(object sender, EventArgs e)
|
||||
{
|
||||
needToRecretaeBed = true;
|
||||
}
|
||||
}
|
||||
|
||||
void RecreateBed()
|
||||
private void RecreateBed()
|
||||
{
|
||||
double buildHeight = ActiveSliceSettings.Instance.BuildHeight;
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
if(needToRecretaeBed)
|
||||
if (needToRecretaeBed)
|
||||
{
|
||||
needToRecretaeBed = false;
|
||||
RecreateBed();
|
||||
|
|
@ -104,52 +104,52 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
base.OnDraw(graphics2D);
|
||||
}
|
||||
|
||||
protected void PutOemImageOnBed()
|
||||
{
|
||||
// this is to add an image to the bed
|
||||
string imagePathAndFile = Path.Combine("OEMSettings", "bedimage.png");
|
||||
if (allowAutoRotate && StaticData.Instance.FileExists(imagePathAndFile))
|
||||
{
|
||||
ImageBuffer wattermarkImage = StaticData.Instance.LoadImage(imagePathAndFile);
|
||||
protected void PutOemImageOnBed()
|
||||
{
|
||||
// this is to add an image to the bed
|
||||
string imagePathAndFile = Path.Combine("OEMSettings", "bedimage.png");
|
||||
if (allowAutoRotate && StaticData.Instance.FileExists(imagePathAndFile))
|
||||
{
|
||||
ImageBuffer wattermarkImage = StaticData.Instance.LoadImage(imagePathAndFile);
|
||||
|
||||
ImageBuffer bedImage = meshViewerWidget.BedImage;
|
||||
Graphics2D bedGraphics = bedImage.NewGraphics2D();
|
||||
bedGraphics.Render(wattermarkImage,
|
||||
new Vector2((bedImage.Width - wattermarkImage.Width) / 2, (bedImage.Height - wattermarkImage.Height) / 2));
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
{
|
||||
unregisterEvents(this, null);
|
||||
}
|
||||
base.OnClosed(e);
|
||||
}
|
||||
ImageBuffer bedImage = meshViewerWidget.BedImage;
|
||||
Graphics2D bedGraphics = bedImage.NewGraphics2D();
|
||||
bedGraphics.Render(wattermarkImage,
|
||||
new Vector2((bedImage.Width - wattermarkImage.Width) / 2, (bedImage.Height - wattermarkImage.Height) / 2));
|
||||
}
|
||||
}
|
||||
|
||||
protected static SolidSlider InsertUiForSlider(FlowLayoutWidget wordOptionContainer, string header, double min = 0, double max = .5)
|
||||
{
|
||||
public override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (unregisterEvents != null)
|
||||
{
|
||||
unregisterEvents(this, null);
|
||||
}
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
protected static SolidSlider InsertUiForSlider(FlowLayoutWidget wordOptionContainer, string header, double min = 0, double max = .5)
|
||||
{
|
||||
double scrollBarWidth = 10;
|
||||
if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen)
|
||||
{
|
||||
scrollBarWidth = 20;
|
||||
}
|
||||
|
||||
TextWidget spacingText = new TextWidget(header, textColor: ActiveTheme.Instance.PrimaryTextColor);
|
||||
spacingText.Margin = new BorderDouble(10, 3, 3, 5);
|
||||
spacingText.HAnchor = HAnchor.ParentLeft;
|
||||
wordOptionContainer.AddChild(spacingText);
|
||||
SolidSlider namedSlider = new SolidSlider(new Vector2(), scrollBarWidth, 0, 1);
|
||||
namedSlider.TotalWidthInPixels = DefaultScrollBarWidth;
|
||||
namedSlider.Minimum = min;
|
||||
namedSlider.Maximum = max;
|
||||
namedSlider.Margin = new BorderDouble(3, 5, 3, 3);
|
||||
namedSlider.HAnchor = HAnchor.ParentCenter;
|
||||
namedSlider.View.BackgroundColor = new RGBA_Bytes();
|
||||
wordOptionContainer.AddChild(namedSlider);
|
||||
|
||||
return namedSlider;
|
||||
}
|
||||
}
|
||||
}
|
||||
TextWidget spacingText = new TextWidget(header, textColor: ActiveTheme.Instance.PrimaryTextColor);
|
||||
spacingText.Margin = new BorderDouble(10, 3, 3, 5);
|
||||
spacingText.HAnchor = HAnchor.ParentLeft;
|
||||
wordOptionContainer.AddChild(spacingText);
|
||||
SolidSlider namedSlider = new SolidSlider(new Vector2(), scrollBarWidth, 0, 1);
|
||||
namedSlider.TotalWidthInPixels = DefaultScrollBarWidth;
|
||||
namedSlider.Minimum = min;
|
||||
namedSlider.Maximum = max;
|
||||
namedSlider.Margin = new BorderDouble(3, 5, 3, 3);
|
||||
namedSlider.HAnchor = HAnchor.ParentCenter;
|
||||
namedSlider.View.BackgroundColor = new RGBA_Bytes();
|
||||
wordOptionContainer.AddChild(namedSlider);
|
||||
|
||||
return namedSlider;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue