diff --git a/MatterControlLib/ApplicationView/ApplicationController.cs b/MatterControlLib/ApplicationView/ApplicationController.cs
index 490713212..c5466ca76 100644
--- a/MatterControlLib/ApplicationView/ApplicationController.cs
+++ b/MatterControlLib/ApplicationView/ApplicationController.cs
@@ -2606,6 +2606,8 @@ namespace MatterHackers.MatterControl
// Slice
bool slicingSucceeded = false;
+ printer.ViewState.SlicingItem = true;
+
await this.Tasks.Execute("Slicing".Localize(), printer, async (reporter, cancellationToken) =>
{
slicingSucceeded = await Slicer.SliceItem(
@@ -2616,6 +2618,8 @@ namespace MatterHackers.MatterControl
cancellationToken);
});
+ printer.ViewState.SlicingItem = false;
+
// Skip loading GCode output if slicing failed
if (!slicingSucceeded)
{
diff --git a/MatterControlLib/ApplicationView/BedConfig.cs b/MatterControlLib/ApplicationView/BedConfig.cs
index 99d0a508b..f24aa54bf 100644
--- a/MatterControlLib/ApplicationView/BedConfig.cs
+++ b/MatterControlLib/ApplicationView/BedConfig.cs
@@ -42,7 +42,6 @@ namespace MatterHackers.MatterControl
using System.Linq;
using System.Threading;
using MatterHackers.Agg;
- using MatterHackers.Agg.Image;
using MatterHackers.DataConverters3D;
using MatterHackers.GCodeVisualizer;
using MatterHackers.Localizations;
@@ -73,7 +72,7 @@ namespace MatterHackers.MatterControl
public SceneContextViewState ViewState { get; }
- private HistoryContainerBase historyContainer;
+ private readonly HistoryContainerBase historyContainer;
public BedConfig(HistoryContainerBase historyContainer, PrinterConfig printer = null)
{
@@ -267,11 +266,10 @@ namespace MatterHackers.MatterControl
foreach (string loadedFileName in filesToLoadIncludingZips)
{
string extension = Path.GetExtension(loadedFileName).ToUpper();
- if ((extension != ""
+ if (extension != ""
&& extension != ".ZIP"
&& extension != ".GCODE"
&& ApplicationController.Instance.Library.IsContentFileType(loadedFileName))
- )
{
filesToLoad.Add(loadedFileName);
}
@@ -300,12 +298,9 @@ namespace MatterHackers.MatterControl
}
}
-
///
/// Loads content to the bed and prepares edit/persistence context for use
///
- ///
- ///
public async Task LoadPlateFromHistory()
{
await this.LoadContent(new EditContext()
@@ -374,6 +369,7 @@ namespace MatterHackers.MatterControl
internal void EnsureGCodeLoaded()
{
if (this.LoadedGCode == null
+ && !this.Printer.ViewState.SlicingItem
&& File.Exists(this.EditContext?.GCodeFilePath(this.Printer)))
{
UiThread.RunOnIdle(async () =>
@@ -389,14 +385,18 @@ namespace MatterHackers.MatterControl
public WorldView World { get; } = new WorldView(0, 0);
public double BuildHeight { get; internal set; }
+
public Vector3 ViewerVolume { get; internal set; }
+
public Vector2 BedCenter { get; internal set; } = Vector2.Zero;
+
public BedShape BedShape { get; internal set; }
// TODO: Make assignment private, wire up post slicing initialization here
public GCodeRenderer GCodeRenderer { get; set; }
private int _activeLayerIndex;
+
public int ActiveLayerIndex
{
get => _activeLayerIndex;
@@ -505,7 +505,6 @@ namespace MatterHackers.MatterControl
public string ContentType { get; private set; }
-
///
/// Return the axis aligned bounding box of the bed
///
@@ -567,6 +566,7 @@ namespace MatterHackers.MatterControl
{
renderType |= RenderType.Moves;
}
+
if (options.RenderRetractions)
{
renderType |= RenderType.Retractions;
@@ -585,6 +585,7 @@ namespace MatterHackers.MatterControl
{
renderType |= RenderType.SimulateExtrusion;
}
+
if (options.TransparentExtrusion)
{
renderType |= RenderType.TransparentExtrusion;
diff --git a/MatterControlLib/ApplicationView/PrinterViewState.cs b/MatterControlLib/ApplicationView/PrinterViewState.cs
index a6d26ea43..1a9f8af86 100644
--- a/MatterControlLib/ApplicationView/PrinterViewState.cs
+++ b/MatterControlLib/ApplicationView/PrinterViewState.cs
@@ -28,13 +28,23 @@ either expressed or implied, of the FreeBSD Project.
*/
using System;
+using MatterHackers.MatterControl.PartPreviewWindow;
namespace MatterHackers.MatterControl
{
- using MatterHackers.MatterControl.PartPreviewWindow;
-
public class PrinterViewState
{
+ private const double DefaultSliceSettingsWidth = 450;
+
+ // visibility defaults
+ private bool _configurePrinterVisible = UserSettings.Instance.get(UserSettingsKey.ConfigurePrinterTabVisible) == "true";
+
+ private bool _controlsVisible = UserSettings.Instance.get(UserSettingsKey.ControlsTabVisible) != "false";
+
+ private bool _terminalVisible = UserSettings.Instance.get(UserSettingsKey.TerminalTabVisible) == "true";
+
+ private PartViewMode _viewMode = PartViewMode.Model;
+
public event EventHandler ViewModeChanged;
public event EventHandler VisibilityChanged;
@@ -53,51 +63,47 @@ namespace MatterHackers.MatterControl
public bool DockWindowFloating { get; internal set; }
- double DefaultSliceSettingsWidth => 450;
public double SliceSettingsWidth
{
get
{
double.TryParse(UserSettings.Instance.get(UserSettingsKey.SliceSettingsWidth), out double controlWidth);
- if(controlWidth == 0)
+
+ if (controlWidth == 0)
{
controlWidth = DefaultSliceSettingsWidth;
}
+
return controlWidth;
}
+
set
{
UserSettings.Instance.set(UserSettingsKey.SliceSettingsWidth, value.ToString());
}
}
- private PartViewMode viewMode = PartViewMode.Model;
public PartViewMode ViewMode
{
- get => viewMode;
+ get => _viewMode;
set
{
- if (viewMode != value)
+ if (_viewMode != value)
{
// Capture before/after state
var eventArgs = new ViewModeChangedEventArgs()
{
ViewMode = value,
- PreviousMode = viewMode
+ PreviousMode = _viewMode
};
- viewMode = value;
+ _viewMode = value;
this.ViewModeChanged?.Invoke(this, eventArgs);
}
}
}
- public bool _configurePrinterVisible = UserSettings.Instance.get(UserSettingsKey.ConfigurePrinterTabVisible) == "true";
- // set the controls to default to visible
- public bool _controlsVisible = UserSettings.Instance.get(UserSettingsKey.ControlsTabVisible) != "false";
- public bool _terminalVisible = UserSettings.Instance.get(UserSettingsKey.TerminalTabVisible) == "true";
-
public bool ConfigurePrinterVisible
{
get => _configurePrinterVisible;
@@ -172,11 +178,14 @@ namespace MatterHackers.MatterControl
return 200;
}
+
set
{
var minimumValue = Math.Max(value, 150);
UserSettings.Instance.set(UserSettingsKey.SelectedObjectPanelWidth, minimumValue.ToString());
}
}
+
+ public bool SlicingItem { get; set; }
}
}
\ No newline at end of file
diff --git a/MatterControlLib/PartPreviewWindow/RenderOptionsButton.cs b/MatterControlLib/PartPreviewWindow/RenderOptionsButton.cs
index 413a472c3..b23709edc 100644
--- a/MatterControlLib/PartPreviewWindow/RenderOptionsButton.cs
+++ b/MatterControlLib/PartPreviewWindow/RenderOptionsButton.cs
@@ -41,7 +41,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
this.HAnchor = HAnchor.Fit;
this.VAnchor = VAnchor.Fit;
-
+
this.AddChild(new IconButton(AggContext.StaticData.LoadIcon("web.png", theme.InvertIcons), theme)
{
Selectable = false
diff --git a/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs b/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs
index f22b41cfe..e1075f116 100644
--- a/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs
+++ b/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs
@@ -315,6 +315,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
homeButton.Click += (s, e) => viewControls3D.NotifyResetView();
viewOptionsBar.AddChild(homeButton);
+#if DEBUG
var renderOptionsButton = new RenderOptionsButton(theme, this.InteractionLayer)
{
ToolTipText = "Model View Style".Localize(),
@@ -328,6 +329,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
};
viewOptionsBar.AddChild(renderOptionsButton);
+#endif
modelViewStyleButton = new ViewStyleButton(sceneContext, theme)
{
diff --git a/MatterControlLib/PrinterControls/PrinterConnections/SerialPortIndexRadioButton.cs b/MatterControlLib/PrinterControls/PrinterConnections/SerialPortIndexRadioButton.cs
new file mode 100644
index 000000000..5eb77aa88
--- /dev/null
+++ b/MatterControlLib/PrinterControls/PrinterConnections/SerialPortIndexRadioButton.cs
@@ -0,0 +1,44 @@
+/*
+Copyright (c) 2019, Lars Brubaker, John Lewin
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+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.
+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.
+
+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
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+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,
+either expressed or implied, of the FreeBSD Project.
+*/
+
+using MatterHackers.Agg.UI;
+
+namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
+{
+ public class SerialPortIndexRadioButton : RadioButton
+ {
+ public string PortValue { get; }
+
+ public SerialPortIndexRadioButton(string label, string value)
+ : base(label)
+ {
+ PortValue = value;
+ }
+ }
+}
\ No newline at end of file
diff --git a/MatterControlLib/PrinterControls/PrinterConnections/SetupStepComPortManual.cs b/MatterControlLib/PrinterControls/PrinterConnections/SetupStepComPortManual.cs
index 5f9017c55..908c53a65 100644
--- a/MatterControlLib/PrinterControls/PrinterConnections/SetupStepComPortManual.cs
+++ b/MatterControlLib/PrinterControls/PrinterConnections/SetupStepComPortManual.cs
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2018, Lars Brubaker, John Lewin
+Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -33,22 +33,10 @@ using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.PrinterCommunication;
-using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.SerialPortCommunication.FrostedSerial;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
- public class SerialPortIndexRadioButton : RadioButton
- {
- public string PortValue;
-
- public SerialPortIndexRadioButton(string label, string value)
- : base(label)
- {
- PortValue = value;
- }
- }
-
public class SetupStepComPortManual : DialogPage
{
private GuiWidget nextButton;
@@ -61,17 +49,18 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
private TextWidget printerComPortHelpMessage;
private TextWidget printerComPortError;
- protected List SerialPortButtonsList = new List();
+ private List serialPortButtonsList = new List();
+
private PrinterConfig printer;
public SetupStepComPortManual(PrinterConfig printer)
{
this.printer = printer;
- FlowLayoutWidget printerComPortContainer = createComPortContainer();
+ FlowLayoutWidget printerComPortContainer = CreateComPortContainer();
contentRow.AddChild(printerComPortContainer);
- //Construct buttons
+ // Construct buttons
nextButton = theme.CreateDialogButton("Done".Localize());
nextButton.Click += (s, e) => UiThread.RunOnIdle(Parent.Close);
nextButton.Visible = false;
@@ -87,6 +76,9 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
printerComPortError.Text = "Attempting to connect".Localize() + "...";
printerComPortError.TextColor = theme.TextColor;
+ printer.Connection.ConnectionFailed += Connection_CommunicationStateChanged;
+ printer.Connection.ConnectionSucceeded += Connection_CommunicationStateChanged;
+
printer.Settings.Helpers.SetComPort(GetSelectedSerialPort());
printer.Connection.Connect();
@@ -125,11 +117,13 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
// Unregister listeners
printer.Connection.CommunicationStateChanged -= Connection_CommunicationStateChanged;
+ printer.Connection.ConnectionFailed -= Connection_CommunicationStateChanged;
+ printer.Connection.ConnectionSucceeded -= Connection_CommunicationStateChanged;
base.OnClosed(e);
}
- private FlowLayoutWidget createComPortContainer()
+ private FlowLayoutWidget CreateComPortContainer()
{
var container = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
@@ -216,13 +210,13 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
// Add a radio button for each filtered port
foreach (string portName in FrostedSerialPort.GetPortNames())
{
- SerialPortIndexRadioButton comPortOption = createComPortOption(portName, activePrinterSerialPort == portName);
+ SerialPortIndexRadioButton comPortOption = CreateComPortOption(portName, activePrinterSerialPort == portName);
if (comPortOption.Checked)
{
printerComPortIsAvailable = true;
}
- SerialPortButtonsList.Add(comPortOption);
+ serialPortButtonsList.Add(comPortOption);
comPortContainer.AddChild(comPortOption);
portIndex++;
@@ -231,15 +225,15 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
// Add a virtual entry for serial ports that were previously configured but are not currently connected
if (!printerComPortIsAvailable && activePrinterSerialPort != null)
{
- SerialPortIndexRadioButton comPortOption = createComPortOption(activePrinterSerialPort, true);
+ SerialPortIndexRadioButton comPortOption = CreateComPortOption(activePrinterSerialPort, true);
comPortOption.Enabled = false;
comPortContainer.AddChild(comPortOption);
- SerialPortButtonsList.Add(comPortOption);
+ serialPortButtonsList.Add(comPortOption);
portIndex++;
}
- //If there are still no com ports show a message to that effect
+ // If there are still no com ports show a message to that effect
if (portIndex == 0)
{
var comPortOption = new TextWidget("No COM ports available".Localize())
@@ -251,7 +245,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
}
}
- private SerialPortIndexRadioButton createComPortOption(string portName, bool isActivePrinterPort)
+ private SerialPortIndexRadioButton CreateComPortOption(string portName, bool isActivePrinterPort)
{
return new SerialPortIndexRadioButton(portName, portName)
{
@@ -264,7 +258,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
private string GetSelectedSerialPort()
{
- foreach (SerialPortIndexRadioButton button in SerialPortButtonsList)
+ foreach (SerialPortIndexRadioButton button in serialPortButtonsList)
{
if (button.Checked)
{
@@ -274,6 +268,5 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
throw new Exception("Could not find a selected button.".Localize());
}
-
}
}
\ No newline at end of file
diff --git a/MatterControlLib/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs b/MatterControlLib/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs
index 0b1be6272..f7ddc028f 100644
--- a/MatterControlLib/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs
+++ b/MatterControlLib/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2018, Lars Brubaker, John Lewin
+Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -31,16 +31,14 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MatterHackers.Agg;
-using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
-using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.SettingsManagement;
using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
- //Normally step one of the setup process
+ // Normally step one of the setup process
public class SetupStepMakeModelName : DialogPage
{
private FlowLayoutWidget printerModelContainer;
@@ -59,9 +57,9 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
private BoundDropList printerManufacturerSelector;
private BoundDropList printerModelSelector;
- string activeMake;
- string activeModel;
- string activeName;
+ private string activeMake;
+ private string activeModel;
+ private string activeName;
private RadioButton createPrinterRadioButton = null;
@@ -107,10 +105,10 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
"Select the printer model".Localize(),
printerModelSelector);
- //Add inputs to main container
+ // Add inputs to main container
addPrinterColumn.AddChild(printerMakeContainer);
addPrinterColumn.AddChild(printerModelContainer);
- addPrinterColumn.AddChild(createPrinterNameContainer());
+ addPrinterColumn.AddChild(CreatePrinterNameContainer());
RadioButton signInRadioButton = null;
@@ -208,7 +206,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|| (createPrinterRadioButton.Checked && (activeModel != null && this.activeMake != null));
}
- private FlowLayoutWidget createPrinterNameContainer()
+ private FlowLayoutWidget CreatePrinterNameContainer()
{
TextWidget printerNameLabel = new TextWidget("Name".Localize() + ":", 0, 0, 12)
{
@@ -305,7 +303,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
UiThread.RunOnIdle(() =>
{
- DropDownList dropList = (DropDownList) sender;
+ DropDownList dropList = (DropDownList)sender;
activeModel = dropList.SelectedLabel;
SetElementVisibility();
diff --git a/MatterControlLib/SettingsManagement/OemSettings.cs b/MatterControlLib/SettingsManagement/OemSettings.cs
index c83bb437a..488857f18 100644
--- a/MatterControlLib/SettingsManagement/OemSettings.cs
+++ b/MatterControlLib/SettingsManagement/OemSettings.cs
@@ -154,6 +154,7 @@ namespace MatterHackers.MatterControl.SettingsManagement
public OemProfileDictionary OemProfiles { get; set; }
public Dictionary OemUrls { get; }
+
public Dictionary OemPrinters { get; }
[OnDeserialized]
@@ -176,7 +177,7 @@ namespace MatterHackers.MatterControl.SettingsManagement
return JsonConvert.DeserializeObject(json);
}
- public async Task ReloadOemProfiles(IProgress syncReport = null)
+ public async Task ReloadOemProfiles()
{
// In public builds this won't be assigned to and we should exit
if (ApplicationController.GetPublicProfileList == null)
@@ -201,10 +202,10 @@ namespace MatterHackers.MatterControl.SettingsManagement
return result;
});
- await DownloadMissingProfiles(syncReport);
+ await DownloadMissingProfiles();
}
- private async Task DownloadMissingProfiles(IProgress syncReport)
+ private async Task DownloadMissingProfiles()
{
ProgressStatus reportValue = new ProgressStatus();
int index = 0;
@@ -226,13 +227,6 @@ namespace MatterHackers.MatterControl.SettingsManagement
{
return;
}
-
- if (syncReport != null)
- {
- reportValue.Status = string.Format("Downloading public profiles for {0}...", oem);
- reportValue.Progress0To1 = (double)index / OemProfiles.Count;
- syncReport.Report(reportValue);
- }
}
}
}