diff --git a/ActionBar/TemperatureWidgetBase.cs b/ActionBar/TemperatureWidgetBase.cs
index 504d03f54..7fda28547 100644
--- a/ActionBar/TemperatureWidgetBase.cs
+++ b/ActionBar/TemperatureWidgetBase.cs
@@ -34,10 +34,11 @@ using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
using MatterHackers.MatterControl.PartPreviewWindow;
using MatterHackers.MatterControl.PrinterCommunication;
+using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl.ActionBar
{
- internal class TemperatureWidgetBase : PopupButton
+ internal abstract class TemperatureWidgetBase : PopupButton
{
protected TextWidget CurrentTempIndicator;
private TextWidget goalTempIndicator;
@@ -55,6 +56,8 @@ namespace MatterHackers.MatterControl.ActionBar
protected virtual int ActualTemperature { get; }
protected virtual int TargetTemperature { get; }
+ private DisableablePanel disableablePanel;
+
public TemperatureWidgetBase(PrinterConfig printer, string textValue)
{
this.printer = printer;
@@ -105,6 +108,12 @@ namespace MatterHackers.MatterControl.ActionBar
Margin = new BorderDouble(left: 5)
};
container.AddChild(DirectionIndicator);
+
+ printer.Connection.CommunicationStateChanged.RegisterEvent((s, e) =>
+ {
+ disableablePanel.Enabled = printer.Connection.PrinterIsConnected;
+
+ }, ref unregisterEvents);
}
protected void DisplayCurrentTemperature()
@@ -131,7 +140,18 @@ namespace MatterHackers.MatterControl.ActionBar
protected virtual void SetTargetTemperature(double targetTemp) { }
- protected virtual GuiWidget GetPopupContent() { return null; }
+ protected abstract GuiWidget GetPopupContent();
+
+ public override void OnLoad(EventArgs args)
+ {
+ // Wrap popup content in a DisableablePanel
+ disableablePanel = new DisableablePanel(this.GetPopupContent(), printer.Connection.PrinterIsConnected, alpha: 140);
+
+ // Set as popup
+ this.PopupContent = disableablePanel;
+
+ base.OnLoad(args);
+ }
public override void OnClosed(ClosedEventArgs e)
{
diff --git a/ActionBar/TemperatureWidgetBed.cs b/ActionBar/TemperatureWidgetBed.cs
index 647f2de4f..2e8240dc6 100644
--- a/ActionBar/TemperatureWidgetBed.cs
+++ b/ActionBar/TemperatureWidgetBed.cs
@@ -62,8 +62,6 @@ namespace MatterHackers.MatterControl.ActionBar
this.ImageWidget.Image = icon;
- this.PopupContent = this.GetPopupContent();
-
printer.Connection.BedTemperatureRead.RegisterEvent((s, e) => DisplayCurrentTemperature(), ref unregisterEvents);
}
diff --git a/ActionBar/TemperatureWidgetExtruder.cs b/ActionBar/TemperatureWidgetExtruder.cs
index 021e4cdcc..4d7d5c18b 100644
--- a/ActionBar/TemperatureWidgetExtruder.cs
+++ b/ActionBar/TemperatureWidgetExtruder.cs
@@ -185,8 +185,6 @@ namespace MatterHackers.MatterControl.ActionBar
this.DisplayCurrentTemperature();
this.ToolTipText = "Current extruder temperature".Localize();
- this.PopupContent = this.GetPopupContent();
-
printer.Connection.HotendTemperatureRead.RegisterEvent((s, e) => DisplayCurrentTemperature(), ref unregisterEvents);
}
diff --git a/CustomWidgets/DisableablePanel.cs b/CustomWidgets/DisableablePanel.cs
new file mode 100644
index 000000000..6e518cc5e
--- /dev/null
+++ b/CustomWidgets/DisableablePanel.cs
@@ -0,0 +1,63 @@
+/*
+Copyright (c) 2017, 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 System;
+using MatterHackers.Agg;
+using MatterHackers.Agg.UI;
+
+namespace MatterHackers.MatterControl.SlicerConfiguration
+{
+ public class DisableablePanel : GuiWidget
+ {
+ private GuiWidget disableOverlay;
+
+ public DisableablePanel(GuiWidget widgetToWrap, bool enabled = false, int alpha = 200)
+ {
+ this.VAnchor = VAnchor.Fit;
+ this.HAnchor = HAnchor.Stretch;
+
+ this.AddChild(widgetToWrap);
+
+ disableOverlay = new GuiWidget()
+ {
+ VAnchor = VAnchor.Stretch,
+ HAnchor = HAnchor.Stretch,
+ Visible = !enabled,
+ BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.TertiaryBackgroundColor, alpha)
+ };
+ this.AddChild(disableOverlay);
+ }
+
+ public override bool Enabled
+ {
+ get => !disableOverlay.Visible;
+ set => disableOverlay.Visible = !value;
+ }
+ }
+}
diff --git a/MatterControl.csproj b/MatterControl.csproj
index 813dddeb6..df2b09d0b 100644
--- a/MatterControl.csproj
+++ b/MatterControl.csproj
@@ -143,6 +143,7 @@
+
Form
diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs
index 263a62242..9b3c43419 100644
--- a/SlicerConfiguration/SliceSettingsWidget.cs
+++ b/SlicerConfiguration/SliceSettingsWidget.cs
@@ -40,7 +40,7 @@ using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.SlicerConfiguration
{
- public class SliceSettingsWidget : FlowLayoutWidget
+ public partial class SliceSettingsWidget : FlowLayoutWidget
{
private TabControl primaryTabControl;
internal PresetsToolbar settingsControlBar;
@@ -720,7 +720,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
}
else
{
- return new DisabledOverlay(settingsRow);
+ return new DisableablePanel(settingsRow);
}
}
@@ -735,29 +735,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
};
}
- private class DisabledOverlay : GuiWidget
- {
- private GuiWidget disableOverlay;
-
- public DisabledOverlay(GuiWidget widgetToWrap)
- {
- this.VAnchor = VAnchor.Fit;
- this.HAnchor = HAnchor.Stretch;
-
- this.AddChild(widgetToWrap);
-
- disableOverlay = new GuiWidget()
- {
- VAnchor = VAnchor.Stretch,
- HAnchor = HAnchor.Stretch,
- BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.TertiaryBackgroundColor, 200)
- };
- this.AddChild(disableOverlay);
- }
-
- public override bool Enabled { get => !disableOverlay.Visible; set => disableOverlay.Visible = value; }
- }
-
public static GuiWidget CreateQuickMenu(SliceSettingData settingData, SettingsContext settingsContext, GuiWidget content, InternalTextEditWidget internalTextWidget)
{
string sliceSettingValue =settingsContext.GetValue(settingData.SlicerConfigName);
diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp
index b8d0bb508..a5eec3a53 160000
--- a/Submodules/agg-sharp
+++ b/Submodules/agg-sharp
@@ -1 +1 @@
-Subproject commit b8d0bb50813391957d437a5f5f868c3e1ea0651b
+Subproject commit a5eec3a5312cf09bee903113628cc8a63ec62a27