From b1a5f4200c3fff102cd82070dab1fb3f5a1a9f89 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 20 May 2015 10:55:14 -0700 Subject: [PATCH 1/4] Made the about window always on top made an update notification in the menu bar area took the "about' tab off the main page Cleaned up the checking of touchscreen Made a new Features section for the printer settings --- AboutPage/AboutWindow.cs | 1 + ActionBar/PrintActionRow.cs | 6 +- ApplicationView/FirstPanelTabView.cs | 40 ------ ApplicationView/MenuRow/ApplicationMenuRow.cs | 116 +++++++++++++++++- .../ApplicationSettingsView.cs | 6 +- ControlElements/ImageButtonFactory.cs | 2 +- ControlElements/ThemeFactory.cs | 8 ++ CustomWidgets/PrintProgressBarWidget.cs | 2 +- PrintQueue/QueueDataWidget.cs | 2 +- StaticData/SliceSettings/Layouts.txt | 21 ++-- StaticData/Translations/Master.txt | 9 ++ 11 files changed, 152 insertions(+), 61 deletions(-) diff --git a/AboutPage/AboutWindow.cs b/AboutPage/AboutWindow.cs index ed9f91bdb..0e02623ca 100644 --- a/AboutPage/AboutWindow.cs +++ b/AboutPage/AboutWindow.cs @@ -68,6 +68,7 @@ namespace MatterHackers.MatterControl buttonRowContainer.AddChild(cancelButton); this.Title = LocalizedString.Get("About MatterControl"); + this.AlwaysOnTopOfMain = true; this.ShowAsSystemWindow(); } diff --git a/ActionBar/PrintActionRow.cs b/ActionBar/PrintActionRow.cs index d164d7987..0126b78c6 100644 --- a/ActionBar/PrintActionRow.cs +++ b/ActionBar/PrintActionRow.cs @@ -222,7 +222,7 @@ namespace MatterHackers.MatterControl.ActionBar if (!PrinterConnectionAndCommunication.Instance.PrinterIsConnected && PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect) { - if (UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen") + if (ActiveTheme.Instance.IsTouchScreen) { this.activePrintButtons.Add(connectButton); } @@ -274,7 +274,7 @@ namespace MatterHackers.MatterControl.ActionBar this.activePrintButtons.Add(pauseButton); this.activePrintButtons.Add(cancelButton); } - else if (UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen") + else if (ActiveTheme.Instance.IsTouchScreen) { this.activePrintButtons.Add(resetConnectionButton); } @@ -302,7 +302,7 @@ namespace MatterHackers.MatterControl.ActionBar if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected && ActiveSliceSettings.Instance.ShowResetConnection() - && UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen") + && ActiveTheme.Instance.IsTouchScreen) { this.activePrintButtons.Add(resetConnectionButton); ShowActiveButtons(); diff --git a/ApplicationView/FirstPanelTabView.cs b/ApplicationView/FirstPanelTabView.cs index 48c91b2cc..8b36b61b4 100644 --- a/ApplicationView/FirstPanelTabView.cs +++ b/ApplicationView/FirstPanelTabView.cs @@ -45,10 +45,7 @@ namespace MatterHackers.MatterControl private TabPage QueueTabPage; private TabPage LibraryTabPage; private TabPage HistoryTabPage; - private TabPage AboutTabPage; - private SimpleTextTabWidget AboutTabView; private RGBA_Bytes unselectedTextColor = ActiveTheme.Instance.TabLabelUnselected; - private GuiWidget addedUpdateMark = null; private QueueDataView queueDataView; private event EventHandler unregisterEvents; @@ -75,17 +72,10 @@ namespace MatterHackers.MatterControl this.AddTab(new SimpleTextTabWidget(HistoryTabPage, "History Tab", 15, ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes())); - AboutTabPage = new TabPage(new AboutWidget(), LocalizedString.Get("About").ToUpper()); - AboutTabView = new SimpleTextTabWidget(AboutTabPage, "About Tab", 15, - ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()); - this.AddTab(AboutTabView); - NumQueueItemsChanged(this, null); - SetUpdateNotification(this, null); QueueData.Instance.ItemAdded.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents); QueueData.Instance.ItemRemoved.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents); - UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents); WidescreenPanel.PreChangePanels.RegisterEvent(SaveCurrentTab, ref unregisterEvents); @@ -111,35 +101,5 @@ namespace MatterHackers.MatterControl unregisterEvents(this, null); } } - - public void SetUpdateNotification(object sender, EventArgs widgetEvent) - { - switch (UpdateControlData.Instance.UpdateStatus) - { - case UpdateControlData.UpdateStatusStates.MayBeAvailable: - case UpdateControlData.UpdateStatusStates.ReadyToInstall: - case UpdateControlData.UpdateStatusStates.UpdateAvailable: - case UpdateControlData.UpdateStatusStates.UpdateDownloading: - if (addedUpdateMark == null) - { - addedUpdateMark = new NotificationWidget(); - addedUpdateMark.OriginRelativeParent = new Vector2(AboutTabView.Width - 25, 7); - AboutTabView.AddChild(addedUpdateMark); - } - addedUpdateMark.Visible = true; - break; - - case UpdateControlData.UpdateStatusStates.UpToDate: - case UpdateControlData.UpdateStatusStates.CheckingForUpdate: - if (addedUpdateMark != null) - { - addedUpdateMark.Visible = false; - } - break; - - default: - throw new NotImplementedException(); - } - } } } \ No newline at end of file diff --git a/ApplicationView/MenuRow/ApplicationMenuRow.cs b/ApplicationView/MenuRow/ApplicationMenuRow.cs index e822fa691..76f443821 100644 --- a/ApplicationView/MenuRow/ApplicationMenuRow.cs +++ b/ApplicationView/MenuRow/ApplicationMenuRow.cs @@ -1,17 +1,51 @@ -using MatterHackers.Agg; +/* +Copyright (c) 2015, Kevin Pope +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; using MatterHackers.Agg.UI; using MatterHackers.MatterControl.CustomWidgets; +using System; +using MatterHackers.Localizations; namespace MatterHackers.MatterControl { public class ApplicationMenuRow : FlowLayoutWidget { private static FlowLayoutWidget rightElement; + private event EventHandler unregisterEvents; + LinkButtonFactory linkButtonFactory = new LinkButtonFactory(); + + GuiWidget popUpAboutPage; public ApplicationMenuRow() : base(FlowDirection.LeftToRight) { - LinkButtonFactory linkButtonFactory = new LinkButtonFactory(); linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor; linkButtonFactory.fontSize = 8; @@ -38,6 +72,26 @@ namespace MatterHackers.MatterControl MenuOptionHelp menuOptionHelp = new MenuOptionHelp(); this.AddChild(menuOptionHelp); + linkButtonFactory.textColor = RGBA_Bytes.Red; + linkButtonFactory.fontSize = 10; + + Button updateStatusMessage = linkButtonFactory.Generate("Update Available"); + UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents); + popUpAboutPage = new GuiWidget(); + popUpAboutPage.Margin = new BorderDouble(30, 0, 0, 0); + popUpAboutPage.HAnchor = HAnchor.FitToChildren; + popUpAboutPage.VAnchor = VAnchor.FitToChildren | VAnchor.ParentCenter; + popUpAboutPage.AddChild(updateStatusMessage); + updateStatusMessage.Click += (sender, e) => + { + UiThread.RunOnIdle((state) => + { + AboutWindow.Show(); + }); + }; + this.AddChild(popUpAboutPage); + SetUpdateNotification(this, null); + // put in a spacer this.AddChild(new HorizontalSpacer()); @@ -55,6 +109,64 @@ namespace MatterHackers.MatterControl } } + public override void OnClosed(EventArgs e) + { + if (unregisterEvents != null) + { + unregisterEvents(this, null); + } + + base.OnClosed(e); + } + + public void SetUpdateNotification(object sender, EventArgs widgetEvent) + { + switch (UpdateControlData.Instance.UpdateStatus) + { + case UpdateControlData.UpdateStatusStates.MayBeAvailable: + { + popUpAboutPage.RemoveAllChildren(); + Button updateStatusMessage = linkButtonFactory.Generate("Check For Update".Localize()); + updateStatusMessage.Click += (sender2, e) => + { + UiThread.RunOnIdle((state) => + { + AboutWindow.Show(); + }); + }; + popUpAboutPage.AddChild(updateStatusMessage); + popUpAboutPage.Visible = true; + } + break; + + case UpdateControlData.UpdateStatusStates.ReadyToInstall: + case UpdateControlData.UpdateStatusStates.UpdateAvailable: + case UpdateControlData.UpdateStatusStates.UpdateDownloading: + { + popUpAboutPage.RemoveAllChildren(); + Button updateStatusMessage = linkButtonFactory.Generate("Update Available".Localize()); + updateStatusMessage.Click += (sender2, e) => + { + UiThread.RunOnIdle((state) => + { + AboutWindow.Show(); + }); + }; + popUpAboutPage.AddChild(updateStatusMessage); + popUpAboutPage.Visible = true; + } + break; + + case UpdateControlData.UpdateStatusStates.UpToDate: + case UpdateControlData.UpdateStatusStates.CheckingForUpdate: + popUpAboutPage.Visible = false; + break; + + default: + throw new NotImplementedException(); + } + } + public delegate void AddRightElementDelegate(GuiWidget iconContainer); private static event AddRightElementDelegate privateAddRightElement; diff --git a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs index 0464ea6ef..71a15faf4 100644 --- a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs +++ b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs @@ -63,7 +63,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage mainContainer.AddChild(new HorizontalLine(separatorLineColor)); #endif - if (UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen") + if (ActiveTheme.Instance.IsTouchScreen) { mainContainer.AddChild(GetModeControl()); mainContainer.AddChild(new HorizontalLine(separatorLineColor)); @@ -201,9 +201,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage MenuItem touchscreenOptionsDropDownItem = interfaceOptionsDropList.AddItem(LocalizedString.Get("Touchscreen"), "touchscreen"); List acceptableUpdateFeedTypeValues = new List() { "responsive", "touchscreen" }; - string currentUpdateFeedType = UserSettings.Instance.get("ApplicationDisplayMode"); + string currentDisplayModeType = UserSettings.Instance.get("ApplicationDisplayMode"); - if (acceptableUpdateFeedTypeValues.IndexOf(currentUpdateFeedType) == -1) + if (acceptableUpdateFeedTypeValues.IndexOf(currentDisplayModeType) == -1) { UserSettings.Instance.set("ApplicationDisplayMode", "responsive"); } diff --git a/ControlElements/ImageButtonFactory.cs b/ControlElements/ImageButtonFactory.cs index c2ffa5787..0a296f552 100644 --- a/ControlElements/ImageButtonFactory.cs +++ b/ControlElements/ImageButtonFactory.cs @@ -78,7 +78,7 @@ namespace MatterHackers.MatterControl InvertLightness.DoInvertLightness(disabledImage); } - if (UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen") + if (ActiveTheme.Instance.IsTouchScreen) { //normalImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet); RoundedRect rect = new RoundedRect(pressedImage.GetBounds(), 0); diff --git a/ControlElements/ThemeFactory.cs b/ControlElements/ThemeFactory.cs index 85f8382c8..70cef2d71 100644 --- a/ControlElements/ThemeFactory.cs +++ b/ControlElements/ThemeFactory.cs @@ -287,6 +287,14 @@ namespace MatterHackers.MatterControl return themeList; } + + public bool IsTouchScreen + { + get + { + return UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen"; + } + } } public class Theme diff --git a/CustomWidgets/PrintProgressBarWidget.cs b/CustomWidgets/PrintProgressBarWidget.cs index 8611426ff..19692d223 100644 --- a/CustomWidgets/PrintProgressBarWidget.cs +++ b/CustomWidgets/PrintProgressBarWidget.cs @@ -105,7 +105,7 @@ namespace MatterHackers.MatterControl AddChild(container); - if (UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen") + if (ActiveTheme.Instance.IsTouchScreen) { upImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_up_32x24.png"); downImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_down_32x24.png"); diff --git a/PrintQueue/QueueDataWidget.cs b/PrintQueue/QueueDataWidget.cs index 67264fb3a..cd54e66d0 100644 --- a/PrintQueue/QueueDataWidget.cs +++ b/PrintQueue/QueueDataWidget.cs @@ -181,7 +181,7 @@ namespace MatterHackers.MatterControl.PrintQueue removeItemButton.Visible = false; buttonPanel1.AddChild(removeItemButton); - bool touchScreenMode = UserSettings.Instance.get("ApplicationDisplayMode") == "touchscreen"; + bool touchScreenMode = ActiveTheme.Instance.IsTouchScreen; if (!touchScreenMode) { diff --git a/StaticData/SliceSettings/Layouts.txt b/StaticData/SliceSettings/Layouts.txt index 2253c30a3..7434e8f21 100644 --- a/StaticData/SliceSettings/Layouts.txt +++ b/StaticData/SliceSettings/Layouts.txt @@ -248,16 +248,6 @@ Advanced build_height z_offset bed_shape - Hardware - has_fan - has_hardware_leveling - has_heated_bed - has_sd_card_reader - has_power_control - show_reset_connection - extruder_count - heat_extruder_before_homing - extruders_share_temperature Firmware z_can_be_negative gcode_flavor @@ -268,6 +258,17 @@ Advanced Advanced use_firmware_retraction vibration_limit + Features + Hardware + has_fan + has_hardware_leveling + has_heated_bed + has_sd_card_reader + has_power_control + show_reset_connection + extruder_count + heat_extruder_before_homing + extruders_share_temperature Custom G-Code Start G-Code start_gcode diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 6feb173a5..73445e935 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -3244,3 +3244,12 @@ Translated:The speed to move while printing the first layer. If expressed as a p English:This gcode will sent to the printer immediately after connecting. It can be used to set settings specific to a given printer. Translated:This gcode will sent to the printer immediately after connecting. It can be used to set settings specific to a given printer. +English:Features +Translated:Features + +English:Update Available +Translated:Update Available + +English:Check For Update +Translated:Check For Update + From df21f25361e57762199398eb253ebcff9e91154a Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 20 May 2015 12:36:34 -0700 Subject: [PATCH 2/4] Fix for incorrect message when creating a gcode file that is too big to load. --- PartPreviewWindow/ViewGcodeBasic.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PartPreviewWindow/ViewGcodeBasic.cs b/PartPreviewWindow/ViewGcodeBasic.cs index 13774c139..62272f2f9 100644 --- a/PartPreviewWindow/ViewGcodeBasic.cs +++ b/PartPreviewWindow/ViewGcodeBasic.cs @@ -865,7 +865,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow if (gcodeViewWidget != null && gcodeViewWidget.LoadedGCode == null) { - if (GCodeFile.FileTooBigToLoad(printItem.FileLocation)) + // If we have finished loading the gcode and the source file exists but we don't have any loaded gcode it is because the loaded decided to not load it. + if (File.Exists(printItem.FileLocation)) { SetProcessingMessage(string.Format(fileTooBigToLoad, printItem.Name)); } From 4b3c06ca32133d851245df1bc1e6db859ddaa8b8 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 20 May 2015 12:43:01 -0700 Subject: [PATCH 3/4] Fixed the bug with the multi-line edit not getting the 'edit presets' overlay. --- SlicerConfiguration/SliceSettingsWidget.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index ea22c0d75..6e1a0308d 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -835,21 +835,20 @@ namespace MatterHackers.MatterControl.SlicerConfiguration } } #endif - - if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 3)) - { - addMaterialOverlay = true; - } - else if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 2)) - { - addQualityOverlay = true; - } - settingName.Width = minSettingNameWidth; //settingName.MinimumSize = new Vector2(minSettingNameWidth, settingName.MinimumSize.y); leftToRightLayout.AddChild(settingName); } + if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 3)) + { + addMaterialOverlay = true; + } + else if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 2)) + { + addQualityOverlay = true; + } + switch (settingData.DataEditType) { case OrganizerSettingsData.DataEditTypes.INT: From 2a6b48b02d6091dd00612c0f35deff3abf11a48a Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 20 May 2015 13:36:29 -0700 Subject: [PATCH 4/4] Make sure we pre-process our settings for all slicing engines. --- SlicerConfiguration/ActiveSliceSettings.cs | 1 + StaticData/Translations/Master.txt | 3 +++ 2 files changed, 4 insertions(+) diff --git a/SlicerConfiguration/ActiveSliceSettings.cs b/SlicerConfiguration/ActiveSliceSettings.cs index d5eb678dd..df27e5827 100644 --- a/SlicerConfiguration/ActiveSliceSettings.cs +++ b/SlicerConfiguration/ActiveSliceSettings.cs @@ -795,6 +795,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration foreach (KeyValuePair setting in this.DefaultSettings) { string activeValue = GetActiveValue(setting.Key); + activeValue = GCodeProcessing.ReplaceMacroValues(activeValue); string settingString = string.Format("{0} = {1}", setting.Key, activeValue); configFileAsList.Add(settingString); } diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 73445e935..e202fd0cf 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -3253,3 +3253,6 @@ Translated:Update Available English:Check For Update Translated:Check For Update +English:solid_shell +Translated:solid_shell +