From ac8a4808b357e86200b6471cd008fbbc26238dfc Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Thu, 23 Feb 2017 16:59:13 -0800 Subject: [PATCH] Show reset if enabled show hover effect code for making temp in right place --- CustomWidgets/PrintingWindow.cs | 34 ++++++++++++++++++++---- PrinterControls/ManualPrinterControls.cs | 2 +- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/CustomWidgets/PrintingWindow.cs b/CustomWidgets/PrintingWindow.cs index 3014c5a94..a6e7a1afc 100644 --- a/CustomWidgets/PrintingWindow.cs +++ b/CustomWidgets/PrintingWindow.cs @@ -177,7 +177,6 @@ namespace MatterHackers.MatterControl.CustomWidgets invertImageLocation = false, normalTextColor = ActiveTheme.Instance.PrimaryTextColor, hoverTextColor = ActiveTheme.Instance.PrimaryTextColor, - hoverFillColor = RGBA_Bytes.Transparent, disabledTextColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100), disabledFillColor = RGBA_Bytes.Transparent, pressedTextColor = ActiveTheme.Instance.PrimaryTextColor, @@ -237,9 +236,8 @@ namespace MatterHackers.MatterControl.CustomWidgets actionBar.AddChild(new HorizontalSpacer()); + // put in the pause button var pauseButton = CreateButton("Pause".Localize().ToUpper()); - var resumeButton = CreateButton("Resume".Localize().ToUpper()); - pauseButton.Click += (s, e) => { UiThread.RunOnIdle(() => @@ -252,6 +250,8 @@ namespace MatterHackers.MatterControl.CustomWidgets actionBar.AddChild(pauseButton); + // put in the resume button + var resumeButton = CreateButton("Resume".Localize().ToUpper()); resumeButton.Visible = false; resumeButton.Click += (s, e) => { @@ -267,6 +267,7 @@ namespace MatterHackers.MatterControl.CustomWidgets actionBar.AddChild(CreateVerticalLine()); + // put in cancel button var cancelButton = CreateButton("Cancel".Localize().ToUpper()); cancelButton.Click += (s, e) => { @@ -281,6 +282,21 @@ namespace MatterHackers.MatterControl.CustomWidgets actionBar.AddChild(CreateVerticalLine()); + // put in the reset button + var resetButton = CreateButton("Reset".Localize().ToUpper(), true, StaticData.Instance.LoadIcon("e_stop4.png", 32, 32)); + + resetButton.Visible = ActiveSliceSettings.Instance.GetValue(SettingsKey.show_reset_connection); + resetButton.Click += (s, e) => + { + UiThread.RunOnIdle(() => + { + UiThread.RunOnIdle(PrinterConnectionAndCommunication.Instance.RebootBoard); + }); + }; + actionBar.AddChild(resetButton); + + actionBar.AddChild(CreateVerticalLine()); + var advancedButton = CreateButton("Advanced".Localize().ToUpper()); actionBar.AddChild(advancedButton); advancedButton.Click += (s, e) => @@ -377,9 +393,17 @@ namespace MatterHackers.MatterControl.CustomWidgets base.OnClosed(e); } - private Button CreateButton(string localizedText, bool centerText = true) + private Button CreateButton(string localizedText, bool centerText = true, ImageBuffer icon = null) { - var button = buttonFactory.Generate(localizedText, centerText: centerText); + Button button = null; + if(icon == null) + { + button = buttonFactory.Generate(localizedText, centerText: centerText); + } + else + { + button = buttonFactory.GenerateTooltipButton(localizedText, icon); + } var bounds = button.LocalBounds; bounds.Inflate(new BorderDouble(40, 10)); button.LocalBounds = bounds; diff --git a/PrinterControls/ManualPrinterControls.cs b/PrinterControls/ManualPrinterControls.cs index 322cf7836..88da4451d 100644 --- a/PrinterControls/ManualPrinterControls.cs +++ b/PrinterControls/ManualPrinterControls.cs @@ -387,7 +387,7 @@ namespace MatterHackers.MatterControl temperatureContainerContainer.AnchorAll(); temperatureControlsContainer = new TemperatureControls(); - temperatureControlsContainer.VAnchor = VAnchor.ParentTop; + temperatureControlsContainer.VAnchor |= VAnchor.ParentTop; temperatureContainerContainer.AddChild(temperatureControlsContainer);