diff --git a/ConfigurationPage/CloudSettings/CloudSettingsView.cs b/ConfigurationPage/CloudSettings/CloudSettingsView.cs
index 8011819c3..58c6aa4dd 100644
--- a/ConfigurationPage/CloudSettings/CloudSettingsView.cs
+++ b/ConfigurationPage/CloudSettings/CloudSettingsView.cs
@@ -217,11 +217,13 @@ namespace MatterHackers.MatterControl.ConfigurationPage
levelingSwitchContainer.VAnchor = VAnchor.ParentCenter;
levelingSwitchContainer.Margin = new BorderDouble(left: 16);
- ToggleSwitch enablePrintNotificationsSwitch = GenerateToggleSwitch(levelingSwitchContainer, UserSettings.Instance.get("PrintNotificationsEnabled") == "true");
- enablePrintNotificationsSwitch.SwitchStateChanged += (sender, e) =>
+ CheckBox enablePrintNotificationsSwitch = ImageButtonFactory.CreateToggleSwitch(UserSettings.Instance.get("PrintNotificationsEnabled") == "true");
+ enablePrintNotificationsSwitch.VAnchor = VAnchor.ParentCenter;
+ enablePrintNotificationsSwitch.CheckedStateChanged += (sender, e) =>
{
- UserSettings.Instance.set("PrintNotificationsEnabled", enablePrintNotificationsSwitch.SwitchState ? "true" : "false");
+ UserSettings.Instance.set("PrintNotificationsEnabled", enablePrintNotificationsSwitch.Checked ? "true" : "false");
};
+ levelingSwitchContainer.AddChild(enablePrintNotificationsSwitch);
levelingSwitchContainer.SetBoundsToEncloseChildren();
buttonRow.AddChild(levelingIcon);
diff --git a/ConfigurationPage/PrinterSettings/PrinterSettingsView.cs b/ConfigurationPage/PrinterSettings/PrinterSettingsView.cs
index c3b115ae1..4c0bf5aa4 100644
--- a/ConfigurationPage/PrinterSettings/PrinterSettingsView.cs
+++ b/ConfigurationPage/PrinterSettings/PrinterSettingsView.cs
@@ -69,11 +69,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage
buttonRow.HAnchor = HAnchor.ParentLeftRight;
buttonRow.Margin = new BorderDouble(0, 4);
- Button configureAutoLevelButton = textImageButtonFactory.Generate("Configure".Localize().ToUpper());
- configureAutoLevelButton.Margin = new BorderDouble(left: 6);
- configureAutoLevelButton.VAnchor = VAnchor.ParentCenter;
- configureAutoLevelButton.Click += new EventHandler(configureAutoLevelButton_Click);
-
TextWidget notificationSettingsLabel = new TextWidget("Automatic Print Leveling");
notificationSettingsLabel.AutoExpandBoundsToText = true;
notificationSettingsLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
@@ -120,17 +115,13 @@ namespace MatterHackers.MatterControl.ConfigurationPage
ImageWidget levelingIcon = new ImageWidget(levelingImage);
levelingIcon.Margin = new BorderDouble(right: 6);
- GuiWidget levelingSwitchContainer = new FlowLayoutWidget();
- levelingSwitchContainer.VAnchor = VAnchor.ParentCenter;
- levelingSwitchContainer.Margin = new BorderDouble(left: 16);
-
- ToggleSwitch printLevelingSwitch = GenerateToggleSwitch(levelingSwitchContainer, PrinterSettings.Instance.get("PublishBedImage") == "true");
- printLevelingSwitch.SwitchState = ActivePrinterProfile.Instance.DoPrintLeveling;
- printLevelingSwitch.SwitchStateChanged += (sender, e) =>
+ CheckBox printLevelingSwitch = ImageButtonFactory.CreateToggleSwitch(ActivePrinterProfile.Instance.DoPrintLeveling);
+ printLevelingSwitch.VAnchor = VAnchor.ParentCenter;
+ printLevelingSwitch.Margin = new BorderDouble(left: 16);
+ printLevelingSwitch.CheckedStateChanged += (sender, e) =>
{
- ActivePrinterProfile.Instance.DoPrintLeveling = printLevelingSwitch.SwitchState;
+ ActivePrinterProfile.Instance.DoPrintLeveling = printLevelingSwitch.Checked;
};
- levelingSwitchContainer.SetBoundsToEncloseChildren();
printLevelingStatusLabel = new TextWidget("");
printLevelingStatusLabel.AutoExpandBoundsToText = true;
@@ -143,6 +134,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
ActivePrinterProfile.Instance.DoPrintLevelingChanged.RegisterEvent((sender, e) =>
{
SetPrintLevelButtonVisiblity();
+ printLevelingSwitch.Checked = ActivePrinterProfile.Instance.DoPrintLeveling;
}, ref unregisterEvents);
buttonRow.AddChild(levelingIcon);
@@ -150,7 +142,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
buttonRow.AddChild(editButton);
buttonRow.AddChild(new HorizontalSpacer());
buttonRow.AddChild(runPrintLevelingButton);
- buttonRow.AddChild(levelingSwitchContainer);
+ buttonRow.AddChild(printLevelingSwitch);
SetPrintLevelButtonVisiblity();
return buttonRow;
@@ -199,11 +191,11 @@ namespace MatterHackers.MatterControl.ConfigurationPage
publishImageSwitchContainer.VAnchor = VAnchor.ParentCenter;
publishImageSwitchContainer.Margin = new BorderDouble(left: 16);
- ToggleSwitch toggleSwitch = GenerateToggleSwitch(publishImageSwitchContainer, PrinterSettings.Instance.get("PublishBedImage") == "true");
- toggleSwitch.SwitchStateChanged += (sender, e) =>
+ CheckBox toggleSwitch = ImageButtonFactory.CreateToggleSwitch(PrinterSettings.Instance.get("PublishBedImage") == "true");
+ toggleSwitch.CheckedStateChanged += (sender, e) =>
{
- ToggleSwitch thisControl = sender as ToggleSwitch;
- PrinterSettings.Instance.set("PublishBedImage", thisControl.SwitchState ? "true" : "false");
+ CheckBox thisControl = sender as CheckBox;
+ PrinterSettings.Instance.set("PublishBedImage", thisControl.Checked ? "true" : "false");
};
publishImageSwitchContainer.SetBoundsToEncloseChildren();
@@ -338,14 +330,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage
});
}
- private void configureAutoLevelButton_Click(object sender, EventArgs mouseEvent)
- {
- UiThread.RunOnIdle((state) =>
- {
- //Do stuff
- });
- }
-
private void openGcodeTerminalButton_Click(object sender, EventArgs mouseEvent)
{
UiThread.RunOnIdle((state) =>
diff --git a/ConfigurationPage/SettingsViewBase.cs b/ConfigurationPage/SettingsViewBase.cs
index 5a9dec5a5..034c56bb4 100644
--- a/ConfigurationPage/SettingsViewBase.cs
+++ b/ConfigurationPage/SettingsViewBase.cs
@@ -11,8 +11,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage
protected RGBA_Bytes separatorLineColor;
protected FlowLayoutWidget mainContainer;
- protected ToggleSwitchFactory toggleSwitchFactory = new ToggleSwitchFactory();
-
public SettingsViewBase(string title)
: base(new TextWidget(title, pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor))
{
@@ -43,21 +41,5 @@ namespace MatterHackers.MatterControl.ConfigurationPage
this.linkButtonFactory.fontSize = 11;
}
-
- protected ToggleSwitch GenerateToggleSwitch(GuiWidget parentContainer, bool initiallyChecked)
- {
- TextWidget toggleLabel = new TextWidget(initiallyChecked ? "On" : "Off", pointSize: 10, textColor: ActiveTheme.Instance.PrimaryTextColor);
- toggleLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
- toggleLabel.Margin = new BorderDouble(right: 4);
-
- ToggleSwitch toggleSwitch = toggleSwitchFactory.GenerateGivenTextWidget(toggleLabel, "On", "Off", initiallyChecked);
- toggleSwitch.VAnchor = Agg.UI.VAnchor.ParentCenter;
- toggleSwitch.SwitchState = initiallyChecked;
-
- parentContainer.AddChild(toggleLabel);
- parentContainer.AddChild(toggleSwitch);
-
- return toggleSwitch;
- }
}
}
\ No newline at end of file
diff --git a/ControlElements/ImageButtonFactory.cs b/ControlElements/ImageButtonFactory.cs
index fa593f349..c2ffa5787 100644
--- a/ControlElements/ImageButtonFactory.cs
+++ b/ControlElements/ImageButtonFactory.cs
@@ -32,6 +32,7 @@ using MatterHackers.Agg.ImageProcessing;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.VertexSource;
+using MatterHackers.Localizations;
namespace MatterHackers.MatterControl
{
@@ -39,6 +40,19 @@ namespace MatterHackers.MatterControl
{
public bool invertImageColor = true;
+ public static CheckBox CreateToggleSwitch(bool initialState)
+ {
+ ToggleSwitchView toggleView = new ToggleSwitchView("On".Localize(), "Off".Localize(),
+ 60, 24,
+ ActiveTheme.Instance.PrimaryBackgroundColor,
+ new RGBA_Bytes(220, 220, 220),
+ ActiveTheme.Instance.PrimaryAccentColor,
+ ActiveTheme.Instance.PrimaryTextColor);
+ CheckBox toggleBox = new CheckBox(toggleView);
+ toggleBox.Checked = initialState;
+ return toggleBox;
+ }
+
public Button Generate(string normalImageName, string hoverImageName, string pressedImageName = null, string disabledImageName = null)
{
if (pressedImageName == null)
diff --git a/ControlElements/ToggleSwitchFactory.cs b/ControlElements/ToggleSwitchFactory.cs
deleted file mode 100644
index 3a8c2f584..000000000
--- a/ControlElements/ToggleSwitchFactory.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using MatterHackers.Agg;
-using MatterHackers.Agg.UI;
-
-namespace MatterHackers.MatterControl
-{
- public class ToggleSwitchFactory
- {
- public RGBA_Bytes defaultBackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
- public RGBA_Bytes defaultInteriorColor = new RGBA_Bytes(220, 220, 220);
- public RGBA_Bytes defaultThumbColor = ActiveTheme.Instance.PrimaryAccentColor;
- public RGBA_Bytes defaultExteriorColor = ActiveTheme.Instance.PrimaryTextColor;
-
- public double defaultSwitchHeight = 24;
- public double defaultSwitchWidth = 60;
-
- public const string defaultTrueText = "On";
- public const string defaultFalseText = "Off";
-
- public ToggleSwitchFactory()
- {
- }
-
- public ToggleSwitch Generate(bool value = false)
- {
- ToggleSwitch toggleSwitch = new ToggleSwitch(defaultSwitchWidth, defaultSwitchHeight, value, defaultBackgroundColor, defaultInteriorColor, defaultThumbColor, defaultExteriorColor);
- return toggleSwitch;
- }
-
- public ToggleSwitch GenerateGivenTextWidget(TextWidget assocTextWidget, string trueText = defaultTrueText, string falseText = defaultFalseText, bool value = false)
- {
- ToggleSwitch toggleSwitch = new ToggleSwitch(assocTextWidget, trueText, falseText, defaultSwitchWidth, defaultSwitchHeight, value, defaultBackgroundColor, defaultInteriorColor, defaultThumbColor, defaultExteriorColor);
- return toggleSwitch;
- }
-
- public FlowLayoutWidget GenerateToggleSwitchAndTextWidget(string trueText = defaultTrueText, string falseText = defaultFalseText, bool value = false)
- {
- FlowLayoutWidget leftToRight = new FlowLayoutWidget();
- // leftToRight.Padding = new BorderDouble(3, 0, 0, 5) * TextWidget.GlobalPointSizeScaleRatio;
-
- TextWidget textWidget = new TextWidget(defaultFalseText, pointSize: 10, textColor: ActiveTheme.Instance.PrimaryTextColor);
- textWidget.VAnchor = VAnchor.ParentCenter;
-
- ToggleSwitch toggleSwitch = new ToggleSwitch(textWidget, trueText, falseText, defaultSwitchWidth, defaultSwitchHeight, value, defaultBackgroundColor, defaultInteriorColor, defaultThumbColor, defaultExteriorColor);
- toggleSwitch.VAnchor = VAnchor.ParentCenter;
- setToggleSwitchColors(toggleSwitch);
-
- leftToRight.AddChild(toggleSwitch);
- leftToRight.AddChild(textWidget);
-
- return leftToRight;
- }
-
- private void setToggleSwitchColors(ToggleSwitch toggleSwitch)
- {
- toggleSwitch.BackgroundColor = defaultBackgroundColor;
- toggleSwitch.InteriorColor = defaultInteriorColor;
- toggleSwitch.ThumbColor = defaultThumbColor;
- toggleSwitch.ExteriorColor = defaultExteriorColor;
- }
- }
-}
\ No newline at end of file
diff --git a/MatterControl.csproj b/MatterControl.csproj
index 39b55a74d..54d5bea8e 100644
--- a/MatterControl.csproj
+++ b/MatterControl.csproj
@@ -335,7 +335,6 @@
-
diff --git a/PartPreviewWindow/ViewGcodeBasic.cs b/PartPreviewWindow/ViewGcodeBasic.cs
index 6373bac7f..43f8d653d 100644
--- a/PartPreviewWindow/ViewGcodeBasic.cs
+++ b/PartPreviewWindow/ViewGcodeBasic.cs
@@ -982,8 +982,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private void AddHandlers()
{
- expandModelOptions.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(expandModelOptions_CheckedStateChanged);
- expandDisplayOptions.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(expandDisplayOptions_CheckedStateChanged);
+ expandModelOptions.CheckedStateChanged += expandModelOptions_CheckedStateChanged;
+ expandDisplayOptions.CheckedStateChanged += expandDisplayOptions_CheckedStateChanged;
}
private void expandModelOptions_CheckedStateChanged(object sender, EventArgs e)
diff --git a/PrintHistory/PrintHistoryWidget.cs b/PrintHistory/PrintHistoryWidget.cs
index 6aafed784..2e8c3a4ba 100644
--- a/PrintHistory/PrintHistoryWidget.cs
+++ b/PrintHistory/PrintHistoryWidget.cs
@@ -132,8 +132,8 @@ namespace MatterHackers.MatterControl.PrintHistory
private void AddHandlers()
{
- showOnlyCompletedCheckbox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(UpdateHistoryFilterShowCompleted);
- showTimestampCheckbox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(UpdateHistoryFilterShowTimestamp);
+ showOnlyCompletedCheckbox.CheckedStateChanged += UpdateHistoryFilterShowCompleted;
+ showTimestampCheckbox.CheckedStateChanged += UpdateHistoryFilterShowTimestamp;
}
private void UpdateHistoryFilterShowCompleted(object sender, EventArgs e)
diff --git a/PrinterControls/ControlWidgets/ControlWidgetBase.cs b/PrinterControls/ControlWidgets/ControlWidgetBase.cs
index 9bcc24502..700eca6d0 100644
--- a/PrinterControls/ControlWidgets/ControlWidgetBase.cs
+++ b/PrinterControls/ControlWidgets/ControlWidgetBase.cs
@@ -41,7 +41,6 @@ namespace MatterHackers.MatterControl.PrinterControls
}
protected TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
- protected ToggleSwitchFactory toggleSwitchFactory = new ToggleSwitchFactory();
private readonly double TallButtonHeight = 25 * TextWidget.GlobalPointSizeScaleRatio;
diff --git a/PrinterControls/ControlWidgets/FanControls.cs b/PrinterControls/ControlWidgets/FanControls.cs
index 2c275c10d..99c9179d1 100644
--- a/PrinterControls/ControlWidgets/FanControls.cs
+++ b/PrinterControls/ControlWidgets/FanControls.cs
@@ -41,8 +41,7 @@ namespace MatterHackers.MatterControl.PrinterControls
private EditableNumberDisplay fanSpeedDisplay;
- private TextWidget fanToggleSwitchText;
- private ToggleSwitch toggleSwitch;
+ private CheckBox toggleSwitch;
protected override void AddChildElements()
{
@@ -115,15 +114,11 @@ namespace MatterHackers.MatterControl.PrinterControls
//Matt's test editing to add a on/off toggle switch
bool fanActive = PrinterConnectionAndCommunication.Instance.FanSpeed0To255 != 0;
- fanToggleSwitchText = new TextWidget(fanActive ? "On" : "Off", pointSize: 10, textColor: ActiveTheme.Instance.PrimaryTextColor);
- fanToggleSwitchText.VAnchor = Agg.UI.VAnchor.ParentCenter;
-
- toggleSwitch = toggleSwitchFactory.GenerateGivenTextWidget(fanToggleSwitchText, "On", "Off", fanActive);
- toggleSwitch.VAnchor = Agg.UI.VAnchor.ParentCenter;
- toggleSwitch.SwitchStateChanged += new EventHandler(ToggleSwitch_Click);
+ toggleSwitch = ImageButtonFactory.CreateToggleSwitch(fanActive);
+ toggleSwitch.VAnchor = VAnchor.ParentCenter;
+ toggleSwitch.CheckedStateChanged += new EventHandler(ToggleSwitch_Click);
toggleSwitch.Margin = new BorderDouble(5, 0);
- leftToRight.AddChild(fanToggleSwitchText);
leftToRight.AddChild(toggleSwitch);
return leftToRight;
@@ -141,11 +136,11 @@ namespace MatterHackers.MatterControl.PrinterControls
if (printerFanSpeed > 0)
{
- toggleSwitch.SwitchState = true;
+ toggleSwitch.Checked = true;
}
else
{
- toggleSwitch.SwitchState = false;
+ toggleSwitch.Checked = false;
}
doingDisplayUpdateFromPrinter = false;
@@ -155,8 +150,8 @@ namespace MatterHackers.MatterControl.PrinterControls
{
if (!doingDisplayUpdateFromPrinter)
{
- ToggleSwitch toggleSwitch = (ToggleSwitch)sender;
- if (toggleSwitch.SwitchState)
+ CheckBox toggleSwitch = (CheckBox)sender;
+ if (toggleSwitch.Checked)
{
PrinterConnectionAndCommunication.Instance.FanSpeed0To255 = 255;
}
diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs
index 6de85dacb..63ed903d9 100644
--- a/SlicerConfiguration/SliceSettingsWidget.cs
+++ b/SlicerConfiguration/SliceSettingsWidget.cs
@@ -131,7 +131,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
showHelpBox.Margin = new BorderDouble(right: 3);
showHelpBox.VAnchor = VAnchor.ParentCenter;
showHelpBox.Cursor = Cursors.Hand;
- showHelpBox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(RebuildSlicerSettings);
+ showHelpBox.CheckedStateChanged += RebuildSlicerSettings;
this.AddChild(showHelpBox);
}
diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt
index 390d4b7b8..f9d5d5aa9 100644
--- a/StaticData/Translations/Master.txt
+++ b/StaticData/Translations/Master.txt
@@ -3167,3 +3167,9 @@ Translated:Reset
English:Console
Translated:Console
+English:On
+Translated:On
+
+English:Off
+Translated:Off
+
diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice
index 94025eb8d..79b23e380 160000
--- a/Submodules/MatterSlice
+++ b/Submodules/MatterSlice
@@ -1 +1 @@
-Subproject commit 94025eb8da33a2c60caf6ccd28e072b1fdb8d465
+Subproject commit 79b23e380ea3c2b178713bd32d6d309f84e0506a
diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp
index 99575fe8b..1956e1296 160000
--- a/Submodules/agg-sharp
+++ b/Submodules/agg-sharp
@@ -1 +1 @@
-Subproject commit 99575fe8b9afea9906135d3ba1235b30b536c092
+Subproject commit 1956e129608bb7dd5c0c942ca35791c2f50f411e