diff --git a/AboutPage/AboutPage.cs b/AboutPage/AboutPage.cs index e9d8f7327..55a6c76a6 100644 --- a/AboutPage/AboutPage.cs +++ b/AboutPage/AboutPage.cs @@ -41,6 +41,7 @@ using MatterHackers.Localizations; using MatterHackers.MatterControl.ContactForm; using MatterHackers.MatterControl.VersionManagement; using MatterHackers.MatterControl.CustomWidgets; +using MatterHackers.MatterControl.DataStorage; namespace MatterHackers.MatterControl { @@ -181,7 +182,6 @@ namespace MatterHackers.MatterControl { return "exe"; } - } } @@ -239,8 +239,6 @@ namespace MatterHackers.MatterControl System.IO.File.Delete(friendlyFileName); } } - - } public void DownloadUpdate(object sender, MouseEventArgs e) @@ -497,7 +495,10 @@ namespace MatterHackers.MatterControl Button learnMoreLink = linkButtonFactory.Generate("www.matterhackers.com"); learnMoreLink.Margin = new BorderDouble(right: 12); - learnMoreLink.Click += (sender, mouseEvent) => { System.Diagnostics.Process.Start("http://www.matterhackers.com?clk=mc"); }; + learnMoreLink.Click += (sender, mouseEvent) => { + //openBrowser(new Uri("http://www.matterhackers.com")); + System.Diagnostics.Process.Start("http://www.matterhackers.com?clk=mc"); + }; learnMoreLink.HAnchor = HAnchor.ParentCenter; learnMoreLink.Margin = new BorderDouble(0, 5); topToBottom.AddChild(learnMoreLink); @@ -533,6 +534,37 @@ namespace MatterHackers.MatterControl return matterControlDonateLink; } + System.Windows.Forms.WebBrowser browser; + private void openBrowser(Uri url) + { + //SystemWindow browser = new SystemWindow(600,600); + + System.Windows.Forms.Form test = new System.Windows.Forms.Form(); + test.Icon = new System.Drawing.Icon(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "application.ico")); + test.Height = 480; + test.Width = 640; + test.Text = "MatterControl"; + + browser = new System.Windows.Forms.WebBrowser(); + browser.DocumentCompleted += browser_DocumentCompleted; + browser.Navigate(url); + browser.Dock = System.Windows.Forms.DockStyle.Fill; + + test.Controls.Add(browser); + test.Show(); + //browser.AddChild(br); + //browser.ShowAsSystemWindow(); + } + + void browser_DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) + { + if (browser.Url == e.Url) + { + Console.WriteLine("Navigated to {0}", e.Url); + } + browser.Show(); + } + public static void InsertAttributionText(GuiWidget topToBottom, LinkButtonFactory linkButtonFactory) { // slicer credit diff --git a/ActionBar/PrintActionRow.cs b/ActionBar/PrintActionRow.cs index 8cdf3fef8..662caca2f 100644 --- a/ActionBar/PrintActionRow.cs +++ b/ActionBar/PrintActionRow.cs @@ -187,7 +187,7 @@ namespace MatterHackers.MatterControl.ActionBar PrintItemWrapper partToPrint = sender as PrintItemWrapper; if (partToPrint != null) { - partToPrint.Done -= new EventHandler(partToPrint_SliceDone); + partToPrint.SlicingDone -= new EventHandler(partToPrint_SliceDone); string gcodePathAndFileName = partToPrint.GetGCodePathAndFileName(); if (gcodePathAndFileName != "") { @@ -254,7 +254,7 @@ namespace MatterHackers.MatterControl.ActionBar PrinterCommunication.Instance.CommunicationState = PrinterCommunication.CommunicationStates.PreparingToPrint; PrintItemWrapper partToPrint = PrinterCommunication.Instance.ActivePrintItem; SlicingQueue.Instance.QueuePartForSlicing(partToPrint); - partToPrint.Done += new EventHandler(partToPrint_SliceDone); + partToPrint.SlicingDone += new EventHandler(partToPrint_SliceDone); } else diff --git a/ActionBar/PrintStatusRow.cs b/ActionBar/PrintStatusRow.cs index ebb630839..129874d0a 100644 --- a/ActionBar/PrintStatusRow.cs +++ b/ActionBar/PrintStatusRow.cs @@ -40,7 +40,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.ActionBar { - class PrintStatusRow : ActionRowBase + public class PrintStatusRow : FlowLayoutWidget { Stopwatch timeSinceLastDrawTime = new Stopwatch(); event EventHandler unregisterEvents; @@ -53,10 +53,20 @@ namespace MatterHackers.MatterControl.ActionBar TextWidget activePrintStatus; QueueDataView queueDataView; + PartThumbnailWidget activePrintPreviewImage; public PrintStatusRow(QueueDataView queueDataView) { + Initialize(); + + this.HAnchor = HAnchor.ParentLeftRight; + + AddChildElements(); + AddHandlers(); + this.queueDataView = queueDataView; + + onActivePrintItemChanged(null, null); } string ActivePrintStatusText @@ -70,13 +80,12 @@ namespace MatterHackers.MatterControl.ActionBar } } - protected override void Initialize() + protected void Initialize() { UiThread.RunOnIdle(OnIdle); this.Margin = new BorderDouble(6, 3, 6, 6); } - PartThumbnailWidget activePrintPreviewImage; void onActivePrintItemChanged(object sender, EventArgs e) { // first we have to remove any link to an old part (the part currently in the view) @@ -102,7 +111,19 @@ namespace MatterHackers.MatterControl.ActionBar ActivePrintStatusText = message.Data; } - override protected void AddChildElements() + static FlowLayoutWidget iconContainer; + public delegate void OpenNotificationsWindow(); + public static OpenNotificationsWindow openNotificationsWindowFunction = null; + public static OpenNotificationsWindow OpenNotificationsWindowFunction + { + get { return openNotificationsWindowFunction; } + set + { + openNotificationsWindowFunction = value; + AddNotificationButton(iconContainer); + } + } + void AddChildElements() { activePrintPreviewImage = new PartThumbnailWidget(null, "part_icon_transparent_100x100.png", "building_thumbnail_100x100.png", new Vector2(115, 115)); activePrintPreviewImage.VAnchor = VAnchor.ParentTop; @@ -112,8 +133,8 @@ namespace MatterHackers.MatterControl.ActionBar FlowLayoutWidget temperatureWidgets = new FlowLayoutWidget(FlowDirection.TopToBottom); { - IndicatorWidget extruderTemperatureWidget = new ExtruderTemperatureWidget(); - IndicatorWidget bedTemperatureWidget = new BedTemperatureWidget(); + TemperatureWidgetBase extruderTemperatureWidget = new TemperatureWidgetExtruder(); + TemperatureWidgetBase bedTemperatureWidget = new TemperatureWidgetBed(); temperatureWidgets.AddChild(extruderTemperatureWidget); temperatureWidgets.AddChild(bedTemperatureWidget); @@ -124,10 +145,14 @@ namespace MatterHackers.MatterControl.ActionBar FlowLayoutWidget printStatusContainer = CreateActivePrinterInfoWidget(); printStatusContainer.VAnchor |= VAnchor.ParentTop; - FlowLayoutWidget iconContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); + iconContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); iconContainer.Name = "PrintStatusRow.IconContainer"; iconContainer.VAnchor |= VAnchor.ParentTop; iconContainer.Margin = new BorderDouble(top: 3); + if (OpenNotificationsWindowFunction != null) + { + AddNotificationButton(iconContainer); + } iconContainer.AddChild(GetAutoLevelIndicator()); this.AddChild(activePrintPreviewImage); @@ -139,6 +164,22 @@ namespace MatterHackers.MatterControl.ActionBar UpdatePrintItemName(); } + private static void AddNotificationButton(FlowLayoutWidget iconContainer) + { + ImageButtonFactory imageButtonFactory = new ImageButtonFactory(); + imageButtonFactory.invertImageColor = false; + string notifyIconPath = Path.Combine("Icons", "PrintStatusControls", "notify.png"); + string notifyHoverIconPath = Path.Combine("Icons", "PrintStatusControls", "notify-hover.png"); + Button notifyButton = imageButtonFactory.Generate(notifyIconPath, notifyHoverIconPath); + notifyButton.Cursor = Cursors.Hand; + notifyButton.Margin = new Agg.BorderDouble(top: 3); + notifyButton.Click += (sender, mouseEvent) => { OpenNotificationsWindowFunction(); }; + notifyButton.MouseEnterBounds += (sender, mouseEvent) => { HelpTextWidget.Instance.ShowHoverText("Edit notification settings"); }; + notifyButton.MouseLeaveBounds += (sender, mouseEvent) => { HelpTextWidget.Instance.HideHoverText(); }; + + iconContainer.AddChild(notifyButton); + } + private Button GetAutoLevelIndicator() { ImageButtonFactory imageButtonFactory = new ImageButtonFactory(); @@ -206,7 +247,7 @@ namespace MatterHackers.MatterControl.ActionBar return container; } - protected override void AddHandlers() + protected void AddHandlers() { PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onPrintItemChanged, ref unregisterEvents); PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onStateChanged, ref unregisterEvents); @@ -388,176 +429,4 @@ namespace MatterHackers.MatterControl.ActionBar return widget; } } - - class ExtruderTemperatureWidget : IndicatorWidget - { - public ExtruderTemperatureWidget() - : base("150.3°") - { - AddHandlers(); - setToCurrentTemperature(); - - - } - - event EventHandler unregisterEvents; - void AddHandlers() - { - PrinterCommunication.Instance.ExtruderTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents); - this.MouseEnterBounds += onMouseEnterBounds; - this.MouseLeaveBounds += onMouseLeaveBounds; - } - - public override void OnClosed(EventArgs e) - { - if (unregisterEvents != null) - { - unregisterEvents(this, null); - } - base.OnClosed(e); - } - - void onMouseEnterBounds(Object sender, EventArgs e) - { - HelpTextWidget.Instance.ShowHoverText(LocalizedString.Get("Extruder Temperature")); - } - - void onMouseLeaveBounds(Object sender, EventArgs e) - { - HelpTextWidget.Instance.HideHoverText(); - } - - void setToCurrentTemperature() - { - string tempDirectionIndicator = ""; - if (PrinterCommunication.Instance.TargetExtruderTemperature > 0) - { - if ((int)(PrinterCommunication.Instance.TargetExtruderTemperature + 0.5) < (int)(PrinterCommunication.Instance.ActualExtruderTemperature + 0.5)) - { - tempDirectionIndicator = "↓"; - } - else if ((int)(PrinterCommunication.Instance.TargetExtruderTemperature + 0.5) > (int)(PrinterCommunication.Instance.ActualExtruderTemperature + 0.5)) - { - tempDirectionIndicator = "↑"; - } - } - this.IndicatorValue = string.Format("{0:0.#}°{1}", PrinterCommunication.Instance.ActualExtruderTemperature, tempDirectionIndicator); - } - - void onTemperatureRead(Object sender, EventArgs e) - { - setToCurrentTemperature(); - } - } - - class BedTemperatureWidget : IndicatorWidget - { - //Not currently hooked up to anything - public BedTemperatureWidget() - : base("150.3°") - { - AddHandlers(); - setToCurrentTemperature(); - } - - event EventHandler unregisterEvents; - void AddHandlers() - { - PrinterCommunication.Instance.BedTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents); - this.MouseEnterBounds += onMouseEnterBounds; - this.MouseLeaveBounds += onMouseLeaveBounds; - } - - public override void OnClosed(EventArgs e) - { - if (unregisterEvents != null) - { - unregisterEvents(this, null); - } - base.OnClosed(e); - } - - void onMouseEnterBounds(Object sender, EventArgs e) - { - HelpTextWidget.Instance.ShowHoverText(LocalizedString.Get("Bed Temperature")); - } - - void onMouseLeaveBounds(Object sender, EventArgs e) - { - HelpTextWidget.Instance.HideHoverText(); - - } - - void setToCurrentTemperature() - { - this.IndicatorValue = string.Format("{0:0.#}°", PrinterCommunication.Instance.ActualBedTemperature); - } - - void onTemperatureRead(Object sender, EventArgs e) - { - setToCurrentTemperature(); - } - } - - class IndicatorWidget : GuiWidget - { - TextWidget indicatorTextWidget; - RGBA_Bytes borderColor = new RGBA_Bytes(255, 255, 255); - int borderWidth = 2; - - public string IndicatorValue - { - get - { - return indicatorTextWidget.Text; - } - set - { - if (indicatorTextWidget.Text != value) - { - indicatorTextWidget.Text = value; - } - } - } - - event EventHandler unregisterEvents; - public IndicatorWidget(string textValue) - : base(52, 52) - { - this.BackgroundColor = new RGBA_Bytes(255, 255, 255, 200); - indicatorTextWidget = new TextWidget(textValue, pointSize: 11); - indicatorTextWidget.TextColor = ActiveTheme.Instance.PrimaryAccentColor; - indicatorTextWidget.HAnchor = HAnchor.ParentCenter; - indicatorTextWidget.VAnchor = VAnchor.ParentCenter; - indicatorTextWidget.AutoExpandBoundsToText = true; - this.Margin = new BorderDouble(0, 2); - this.AddChild(indicatorTextWidget); - ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents); - } - - public override void OnClosed(EventArgs e) - { - if (unregisterEvents != null) - { - unregisterEvents(this, null); - } - base.OnClosed(e); - } - - private void onThemeChanged(object sender, EventArgs e) - { - this.indicatorTextWidget.TextColor = ActiveTheme.Instance.PrimaryAccentColor; - this.Invalidate(); - } - - public override void OnDraw(Graphics2D graphics2D) - { - base.OnDraw(graphics2D); - - RectangleDouble Bounds = LocalBounds; - RoundedRect borderRect = new RoundedRect(this.LocalBounds, 0); - Stroke strokeRect = new Stroke(borderRect, borderWidth); - graphics2D.Render(strokeRect, borderColor); - } - } } diff --git a/ActionBar/TemperatureWidgetBase.cs b/ActionBar/TemperatureWidgetBase.cs new file mode 100644 index 000000000..dc097588f --- /dev/null +++ b/ActionBar/TemperatureWidgetBase.cs @@ -0,0 +1,104 @@ +/* +Copyright (c) 2014, 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 System; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using MatterHackers.Agg; +using MatterHackers.Agg.UI; +using MatterHackers.Agg.VertexSource; +using MatterHackers.Localizations; +using MatterHackers.MatterControl.PrintQueue; +using MatterHackers.VectorMath; + +namespace MatterHackers.MatterControl.ActionBar +{ + class TemperatureWidgetBase : GuiWidget + { + TextWidget indicatorTextWidget; + RGBA_Bytes borderColor = new RGBA_Bytes(255, 255, 255); + int borderWidth = 2; + + public string IndicatorValue + { + get + { + return indicatorTextWidget.Text; + } + set + { + if (indicatorTextWidget.Text != value) + { + indicatorTextWidget.Text = value; + } + } + } + + event EventHandler unregisterEvents; + public TemperatureWidgetBase(string textValue) + : base(52, 52) + { + this.BackgroundColor = new RGBA_Bytes(255, 255, 255, 200); + indicatorTextWidget = new TextWidget(textValue, pointSize: 11); + indicatorTextWidget.TextColor = ActiveTheme.Instance.PrimaryAccentColor; + indicatorTextWidget.HAnchor = HAnchor.ParentCenter; + indicatorTextWidget.VAnchor = VAnchor.ParentCenter; + indicatorTextWidget.AutoExpandBoundsToText = true; + this.Margin = new BorderDouble(0, 2); + this.AddChild(indicatorTextWidget); + ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents); + } + + public override void OnClosed(EventArgs e) + { + if (unregisterEvents != null) + { + unregisterEvents(this, null); + } + base.OnClosed(e); + } + + private void onThemeChanged(object sender, EventArgs e) + { + this.indicatorTextWidget.TextColor = ActiveTheme.Instance.PrimaryAccentColor; + this.Invalidate(); + } + + public override void OnDraw(Graphics2D graphics2D) + { + base.OnDraw(graphics2D); + + RectangleDouble Bounds = LocalBounds; + RoundedRect borderRect = new RoundedRect(this.LocalBounds, 0); + Stroke strokeRect = new Stroke(borderRect, borderWidth); + graphics2D.Render(strokeRect, borderColor); + } + } +} diff --git a/ActionBar/TemperatureWidgetBed.cs b/ActionBar/TemperatureWidgetBed.cs new file mode 100644 index 000000000..2137cd626 --- /dev/null +++ b/ActionBar/TemperatureWidgetBed.cs @@ -0,0 +1,91 @@ +/* +Copyright (c) 2014, 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 System; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using MatterHackers.Agg; +using MatterHackers.Agg.UI; +using MatterHackers.Agg.VertexSource; +using MatterHackers.Localizations; +using MatterHackers.MatterControl.PrintQueue; +using MatterHackers.VectorMath; + +namespace MatterHackers.MatterControl.ActionBar +{ + class TemperatureWidgetBed : TemperatureWidgetBase + { + //Not currently hooked up to anything + public TemperatureWidgetBed() + : base("150.3°") + { + AddHandlers(); + setToCurrentTemperature(); + } + + event EventHandler unregisterEvents; + void AddHandlers() + { + PrinterCommunication.Instance.BedTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents); + this.MouseEnterBounds += onMouseEnterBounds; + this.MouseLeaveBounds += onMouseLeaveBounds; + } + + public override void OnClosed(EventArgs e) + { + if (unregisterEvents != null) + { + unregisterEvents(this, null); + } + base.OnClosed(e); + } + + void onMouseEnterBounds(Object sender, EventArgs e) + { + HelpTextWidget.Instance.ShowHoverText(LocalizedString.Get("Bed Temperature")); + } + + void onMouseLeaveBounds(Object sender, EventArgs e) + { + HelpTextWidget.Instance.HideHoverText(); + + } + + void setToCurrentTemperature() + { + this.IndicatorValue = string.Format("{0:0.#}°", PrinterCommunication.Instance.ActualBedTemperature); + } + + void onTemperatureRead(Object sender, EventArgs e) + { + setToCurrentTemperature(); + } + } +} diff --git a/ActionBar/TemperatureWidgetExtruder.cs b/ActionBar/TemperatureWidgetExtruder.cs new file mode 100644 index 000000000..7daf8e639 --- /dev/null +++ b/ActionBar/TemperatureWidgetExtruder.cs @@ -0,0 +1,101 @@ +/* +Copyright (c) 2014, 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 System; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using MatterHackers.Agg; +using MatterHackers.Agg.UI; +using MatterHackers.Agg.VertexSource; +using MatterHackers.Localizations; +using MatterHackers.MatterControl.PrintQueue; +using MatterHackers.VectorMath; + +namespace MatterHackers.MatterControl.ActionBar +{ + class TemperatureWidgetExtruder : TemperatureWidgetBase + { + public TemperatureWidgetExtruder() + : base("150.3°") + { + AddHandlers(); + setToCurrentTemperature(); + } + + event EventHandler unregisterEvents; + void AddHandlers() + { + PrinterCommunication.Instance.ExtruderTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents); + this.MouseEnterBounds += onMouseEnterBounds; + this.MouseLeaveBounds += onMouseLeaveBounds; + } + + public override void OnClosed(EventArgs e) + { + if (unregisterEvents != null) + { + unregisterEvents(this, null); + } + base.OnClosed(e); + } + + void onMouseEnterBounds(Object sender, EventArgs e) + { + HelpTextWidget.Instance.ShowHoverText(LocalizedString.Get("Extruder Temperature")); + } + + void onMouseLeaveBounds(Object sender, EventArgs e) + { + HelpTextWidget.Instance.HideHoverText(); + } + + void setToCurrentTemperature() + { + string tempDirectionIndicator = ""; + if (PrinterCommunication.Instance.TargetExtruderTemperature > 0) + { + if ((int)(PrinterCommunication.Instance.TargetExtruderTemperature + 0.5) < (int)(PrinterCommunication.Instance.ActualExtruderTemperature + 0.5)) + { + tempDirectionIndicator = "↓"; + } + else if ((int)(PrinterCommunication.Instance.TargetExtruderTemperature + 0.5) > (int)(PrinterCommunication.Instance.ActualExtruderTemperature + 0.5)) + { + tempDirectionIndicator = "↑"; + } + } + this.IndicatorValue = string.Format("{0:0.#}°{1}", PrinterCommunication.Instance.ActualExtruderTemperature, tempDirectionIndicator); + } + + void onTemperatureRead(Object sender, EventArgs e) + { + setToCurrentTemperature(); + } + } +} diff --git a/ApplicationView/WidescreenPanel.cs b/ApplicationView/WidescreenPanel.cs index 60029ba8f..b866c8f51 100644 --- a/ApplicationView/WidescreenPanel.cs +++ b/ApplicationView/WidescreenPanel.cs @@ -232,7 +232,7 @@ namespace MatterHackers.MatterControl void onActivePrintItemChanged(object sender, EventArgs e) { - LoadColumnTwo(); + UiThread.RunOnIdle(LoadColumnTwo); } int lastSelectedIndex = -1; @@ -283,7 +283,7 @@ namespace MatterHackers.MatterControl RestoreQueueIndex(); } - void LoadColumnTwo() + void LoadColumnTwo(object state = null) { ColumnTwo.RemoveAllChildren(); diff --git a/Community.CsharpSqlite/Community.CsharpSqlite.csproj b/Community.CsharpSqlite/Community.CsharpSqlite.csproj index 8e78452f8..05fe56a6b 100644 --- a/Community.CsharpSqlite/Community.CsharpSqlite.csproj +++ b/Community.CsharpSqlite/Community.CsharpSqlite.csproj @@ -41,6 +41,7 @@ prompt 4 AllRules.ruleset + x86 True @@ -49,6 +50,7 @@ prompt 4 AllRules.ruleset + x86 True diff --git a/CustomWidgets/ExportQueueItemWindow.cs b/CustomWidgets/ExportQueueItemWindow.cs index a9d720144..0d4da5b8c 100644 --- a/CustomWidgets/ExportQueueItemWindow.cs +++ b/CustomWidgets/ExportQueueItemWindow.cs @@ -163,7 +163,7 @@ namespace MatterHackers.MatterControl { Close(); SlicingQueue.Instance.QueuePartForSlicing(printQueueItem.PrintItemWrapper); - printQueueItem.PrintItemWrapper.Done += new EventHandler(sliceItem_Done); + printQueueItem.PrintItemWrapper.SlicingDone += new EventHandler(sliceItem_Done); } else if (partIsGCode) { @@ -254,7 +254,7 @@ namespace MatterHackers.MatterControl { PrintItemWrapper sliceItem = (PrintItemWrapper)sender; - sliceItem.Done -= new EventHandler(sliceItem_Done); + sliceItem.SlicingDone -= new EventHandler(sliceItem_Done); SaveGCodeToNewLocation(sliceItem.GCodePathAndFileName, pathAndFilenameToSave); } diff --git a/Launcher/Launcher.csproj b/Launcher/Launcher.csproj index cc7380825..f50028424 100644 --- a/Launcher/Launcher.csproj +++ b/Launcher/Launcher.csproj @@ -27,7 +27,7 @@ prompt 4 True - AnyCPU + x86 pdbonly @@ -36,7 +36,7 @@ prompt 4 True - AnyCPU + x86 diff --git a/Localizations/Localizations.csproj b/Localizations/Localizations.csproj index 1c8ecc458..d7a57a863 100644 --- a/Localizations/Localizations.csproj +++ b/Localizations/Localizations.csproj @@ -47,6 +47,7 @@ prompt 4 True + x86 none @@ -56,6 +57,7 @@ prompt 4 True + x86 diff --git a/MatterControl.csproj b/MatterControl.csproj index efce3eead..8b7c33e8e 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -57,7 +57,7 @@ TRACE prompt 4 - AnyCPU + x86 true @@ -67,10 +67,13 @@ + + + diff --git a/PartPreviewWindow/GcodeViewBasic.cs b/PartPreviewWindow/GcodeViewBasic.cs index d998e7dd6..5d1ea1abd 100644 --- a/PartPreviewWindow/GcodeViewBasic.cs +++ b/PartPreviewWindow/GcodeViewBasic.cs @@ -119,11 +119,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow gcodeDispalyWidget = new GuiWidget(HAnchor.ParentLeftRight, Agg.UI.VAnchor.ParentBottomTop); - string startingMessage = "Press 'Add' to select an item."; + SetProcessingMessage("Press 'Add' to select an item.".Localize()); if (printItem != null) { - startingMessage = LocalizedString.Get("No GCode Available..."); - startingMessage = LocalizedString.Get("Loading GCode..."); + SetProcessingMessage(LocalizedString.Get("Loading GCode...")); if (Path.GetExtension(printItem.FileLocation).ToUpper() == ".GCODE") { gcodeDispalyWidget.AddChild(CreateGCodeViewWidget(printItem.FileLocation)); @@ -135,13 +134,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow string gcodePathAndFileName = printItem.GCodePathAndFileName; bool gcodeFileIsComplete = printItem.IsGCodeFileComplete(gcodePathAndFileName); - if (gcodeProcessingStateInfoText != null && gcodeProcessingStateInfoText.Text == "Slicing Error") + if (gcodeProcessingStateInfoText.Text == "Slicing Error") { - startingMessage = LocalizedString.Get("Slicing Error. Please review your slice settings."); + SetProcessingMessage(LocalizedString.Get("Slicing Error. Please review your slice settings.")); } else { - startingMessage = LocalizedString.Get("Press 'generate' to view layers"); + SetProcessingMessage(LocalizedString.Get("Press 'generate' to view layers")); } if (File.Exists(gcodePathAndFileName) && gcodeFileIsComplete) @@ -151,11 +150,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // we only hook these up to make sure we can regenerate the gcode when we want printItem.SlicingOutputMessage += sliceItem_SlicingOutputMessage; - printItem.Done += new EventHandler(sliceItem_Done); + printItem.SlicingDone += new EventHandler(sliceItem_Done); } else { - startingMessage = string.Format("{0}\n'{1}'", LocalizedString.Get("File not found on disk."), printItem.Name); + SetProcessingMessage(string.Format("{0}\n'{1}'", LocalizedString.Get("File not found on disk."), printItem.Name)); } } } @@ -177,8 +176,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow mainContainerTopToBottom.AddChild(buttonBottomPanel); this.AddChild(mainContainerTopToBottom); - AddProcessingMessage(startingMessage); - Add2DViewControls(); translateButton.Click += (sender, e) => { @@ -458,29 +455,43 @@ namespace MatterHackers.MatterControl.PartPreviewWindow } } - private void AddProcessingMessage(string message) + private void SetProcessingMessage(string message) { - gcodeProcessingStateInfoText = new TextWidget(message); - gcodeProcessingStateInfoText.HAnchor = HAnchor.ParentCenter; - gcodeProcessingStateInfoText.VAnchor = VAnchor.ParentCenter; - gcodeProcessingStateInfoText.AutoExpandBoundsToText = true; + if (gcodeProcessingStateInfoText == null) + { + gcodeProcessingStateInfoText = new TextWidget(message); + gcodeProcessingStateInfoText.HAnchor = HAnchor.ParentCenter; + gcodeProcessingStateInfoText.VAnchor = VAnchor.ParentCenter; + gcodeProcessingStateInfoText.AutoExpandBoundsToText = true; - GuiWidget labelContainer = new GuiWidget(); - labelContainer.AnchorAll(); - labelContainer.AddChild(gcodeProcessingStateInfoText); - labelContainer.Selectable = false; + GuiWidget labelContainer = new GuiWidget(); + labelContainer.AnchorAll(); + labelContainer.AddChild(gcodeProcessingStateInfoText); + labelContainer.Selectable = false; - gcodeDispalyWidget.AddChild(labelContainer); + gcodeDispalyWidget.AddChild(labelContainer); + } + + if (message == "") + { + gcodeProcessingStateInfoText.BackgroundColor = new RGBA_Bytes(); + } + else + { + gcodeProcessingStateInfoText.BackgroundColor = RGBA_Bytes.White; + } + + gcodeProcessingStateInfoText.Text = message; } void LoadingProgressChanged(object sender, ProgressChangedEventArgs e) { - gcodeProcessingStateInfoText.Text = string.Format("Loading GCode {0}%...", e.ProgressPercentage); + SetProcessingMessage(string.Format("Loading GCode {0}%...", e.ProgressPercentage)); } void DoneLoadingGCode(object sender, EventArgs e) { - gcodeProcessingStateInfoText.Text = ""; + SetProcessingMessage(""); if (gcodeViewWidget != null && gcodeViewWidget.LoadedGCode != null && gcodeViewWidget.LoadedGCode.GCodeCommandQueue.Count > 0 @@ -603,7 +614,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow if (printItem != null) { printItem.SlicingOutputMessage -= sliceItem_SlicingOutputMessage; - printItem.Done -= new EventHandler(sliceItem_Done); + printItem.SlicingDone -= new EventHandler(sliceItem_Done); if (startedSliceFromGenerateButton && printItem.CurrentlySlicing) { SlicingQueue.Instance.CancelCurrentSlicing(); @@ -632,11 +643,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow StringEventArgs message = e as StringEventArgs; if (message != null && message.Data != null) { - gcodeProcessingStateInfoText.Text = message.Data; + SetProcessingMessage(message.Data); } else { - gcodeProcessingStateInfoText.Text = ""; + SetProcessingMessage(""); } } @@ -646,7 +657,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // So we need to make sure we only have it added once. This will be ok to run when // not added or when added and will ensure we only have one hook. printItem.SlicingOutputMessage -= sliceItem_SlicingOutputMessage; - printItem.Done -= sliceItem_Done; + printItem.SlicingDone -= sliceItem_Done; UiThread.RunOnIdle(CreateAndAddChildren); startedSliceFromGenerateButton = false; diff --git a/PartPreviewWindow/View3DTransfromPart.cs b/PartPreviewWindow/View3DTransfromPart.cs index 966c1a0f6..1db280b4d 100644 --- a/PartPreviewWindow/View3DTransfromPart.cs +++ b/PartPreviewWindow/View3DTransfromPart.cs @@ -252,7 +252,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow GuiWidget viewArea = new GuiWidget(); viewArea.AnchorAll(); { - meshViewerWidget = new MeshViewerWidget(viewerVolume, 1, bedShape); + meshViewerWidget = new MeshViewerWidget(viewerVolume, 1, bedShape, "Press 'Add' to select an item.".Localize()); SetMeshViewerDisplayTheme(); meshViewerWidget.AnchorAll(); } diff --git a/PluginSystem/MatterControlPluginSystem.csproj b/PluginSystem/MatterControlPluginSystem.csproj index a800b225c..7b867c260 100644 --- a/PluginSystem/MatterControlPluginSystem.csproj +++ b/PluginSystem/MatterControlPluginSystem.csproj @@ -25,7 +25,7 @@ prompt 4 True - AnyCPU + x86 pdbonly @@ -35,7 +35,7 @@ prompt 4 True - AnyCPU + x86 diff --git a/PrintLibrary/ExportLibraryItemWindow.cs b/PrintLibrary/ExportLibraryItemWindow.cs index ba9199a69..059f8fb29 100644 --- a/PrintLibrary/ExportLibraryItemWindow.cs +++ b/PrintLibrary/ExportLibraryItemWindow.cs @@ -184,7 +184,7 @@ namespace MatterHackers.MatterControl.PrintLibrary pathAndFilenameToSave = saveParams.FileName; Close(); SlicingQueue.Instance.QueuePartForSlicing(printQueueItem.printItem); - printQueueItem.printItem.Done += new EventHandler(sliceItem_Done); + printQueueItem.printItem.SlicingDone += new EventHandler(sliceItem_Done); } else if (partIsGCode) { @@ -289,7 +289,7 @@ namespace MatterHackers.MatterControl.PrintLibrary { PrintItemWrapper sliceItem = (PrintItemWrapper)sender; - sliceItem.Done -= new EventHandler(sliceItem_Done); + sliceItem.SlicingDone -= new EventHandler(sliceItem_Done); SaveGCodeToNewLocation(sliceItem.GCodePathAndFileName, pathAndFilenameToSave); } diff --git a/PrintQueue/BottomToolbar.cs b/PrintQueue/BottomToolbar.cs index cdf83f8ff..c731d7c8e 100644 --- a/PrintQueue/BottomToolbar.cs +++ b/PrintQueue/BottomToolbar.cs @@ -1,20 +1,12 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Collections; using System.IO; -using System.Diagnostics; -using System.Threading; - -using MatterHackers.Agg.Image; -using MatterHackers.Agg.VertexSource; using MatterHackers.Agg; using MatterHackers.Agg.UI; -using MatterHackers.VectorMath; -using MatterHackers.MatterControl.DataStorage; using MatterHackers.Localizations; using MatterHackers.MatterControl.CreatorPlugins; +using MatterHackers.MatterControl.DataStorage; +using MatterHackers.MatterControl.SlicerConfiguration; namespace MatterHackers.MatterControl.PrintQueue { @@ -51,23 +43,47 @@ namespace MatterHackers.MatterControl.PrintQueue buttonPanel1.Padding = new BorderDouble(0, 3); { - Button addToQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png"); + Button addToQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png"); buttonPanel1.AddChild(addToQueueButton); addToQueueButton.Margin = new BorderDouble(0, 0, 3, 0); addToQueueButton.Click += new ButtonBase.ButtonEventHandler(addToQueueButton_Click); - Button runCreator = textImageButtonFactory.Generate(LocalizedString.Get("Create"), "icon_creator_white_32x32.png"); - buttonPanel1.AddChild(runCreator); - runCreator.Margin = new BorderDouble(0, 0, 3, 0); - runCreator.Click += (sender, e) => + // put in the creator button { - OpenPluginChooserWindow(); - }; + Button runCreator = textImageButtonFactory.Generate(LocalizedString.Get("Create"), "icon_creator_white_32x32.png"); + buttonPanel1.AddChild(runCreator); + runCreator.Margin = new BorderDouble(0, 0, 3, 0); + runCreator.Click += (sender, e) => + { + OpenPluginChooserWindow(); + }; + } - Button deleteAllFromQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Remove All")); + // hack: put in a store button + { + Button runStore = textImageButtonFactory.Generate(LocalizedString.Get("Shop"), "icon_shopping_cart_32x32.png"); + buttonPanel1.AddChild(runStore); + runStore.Margin = new BorderDouble(0, 0, 3, 0); + runStore.Click += (sender, e) => + { + double activeFilamentDiameter = 0; + if(ActivePrinterProfile.Instance.ActivePrinter != null) + { + activeFilamentDiameter = 3; + if (ActiveSliceSettings.Instance.FilamentDiameter < 2) + { + activeFilamentDiameter = 1.75; + } + } + + System.Diagnostics.Process.Start("http://www.matterhackers.com/mc/store/redirect?d={0}".FormatWith(activeFilamentDiameter)); + }; + } + + Button deleteAllFromQueueButton = textImageButtonFactory.Generate(LocalizedString.Get("Remove All")); deleteAllFromQueueButton.Margin = new BorderDouble(3, 0); deleteAllFromQueueButton.Click += new ButtonBase.ButtonEventHandler(deleteAllFromQueueButton_Click); - //buttonPanel1.AddChild(deleteAllFromQueueButton); + //buttonPanel1.AddChild(deleteAllFromQueueButton); GuiWidget spacer1 = new GuiWidget(); spacer1.HAnchor = HAnchor.ParentLeftRight; diff --git a/PrintQueue/ExportToFolderProcess.cs b/PrintQueue/ExportToFolderProcess.cs index 1b8e6260b..0ed09dd27 100644 --- a/PrintQueue/ExportToFolderProcess.cs +++ b/PrintQueue/ExportToFolderProcess.cs @@ -76,7 +76,7 @@ namespace MatterHackers.MatterControl.PrintQueue if (Path.GetExtension(part.FileLocation).ToUpper() == ".STL") { SlicingQueue.Instance.QueuePartForSlicing(printItemWrapper); - printItemWrapper.Done += new EventHandler(sliceItem_Done); + printItemWrapper.SlicingDone += new EventHandler(sliceItem_Done); printItemWrapper.SlicingOutputMessage += printItemWrapper_SlicingOutputMessage; } else if (Path.GetExtension(part.FileLocation).ToUpper() == ".GCODE") @@ -100,7 +100,7 @@ namespace MatterHackers.MatterControl.PrintQueue { PrintItemWrapper sliceItem = (PrintItemWrapper)sender; - sliceItem.Done -= new EventHandler(sliceItem_Done); + sliceItem.SlicingDone -= new EventHandler(sliceItem_Done); sliceItem.SlicingOutputMessage -= printItemWrapper_SlicingOutputMessage; if (File.Exists(sliceItem.FileLocation)) { diff --git a/PrintQueue/PrintItemWrapper.cs b/PrintQueue/PrintItemWrapper.cs index 90195d7e6..2e3dcfa6b 100644 --- a/PrintQueue/PrintItemWrapper.cs +++ b/PrintQueue/PrintItemWrapper.cs @@ -46,8 +46,7 @@ namespace MatterHackers.MatterControl.PrintQueue public class PrintItemWrapper { public event EventHandler SlicingOutputMessage; - public event EventHandler Done; - + public event EventHandler SlicingDone; public event EventHandler FileHasChanged; public PrintItem PrintItem { get; set; } @@ -116,9 +115,9 @@ namespace MatterHackers.MatterControl.PrintQueue OnSlicingOutputMessage(new StringEventArgs(message)); - if (Done != null) + if (SlicingDone != null) { - Done(this, null); + SlicingDone(this, null); } } } diff --git a/PrintQueue/QueueData.cs b/PrintQueue/QueueData.cs index 6b3dd572d..68c24c2c8 100644 --- a/PrintQueue/QueueData.cs +++ b/PrintQueue/QueueData.cs @@ -195,6 +195,7 @@ namespace MatterHackers.MatterControl.PrintQueue } PrintItems.Insert(indexToInsert, item); OnItemAdded(new IndexArgs(indexToInsert)); + SaveDefaultQueue(); } public void LoadDefaultQueue() diff --git a/PrintQueue/QueueDataView.cs b/PrintQueue/QueueDataView.cs index 958920363..ce1a22063 100644 --- a/PrintQueue/QueueDataView.cs +++ b/PrintQueue/QueueDataView.cs @@ -202,10 +202,14 @@ namespace MatterHackers.MatterControl.PrintQueue ((RowItem)child.Children[0]).isSelectedItem = true; if (!PrinterCommunication.Instance.PrinterIsPrinting && !PrinterCommunication.Instance.PrinterIsPaused) { - ((RowItem)child.Children[0]).isActivePrint = true; PrinterCommunication.Instance.ActivePrintItem = ((RowItem)child.Children[0]).PrintItemWrapper; } + else if (((RowItem)child.Children[0]).PrintItemWrapper == PrinterCommunication.Instance.ActivePrintItem) + { + // the selection must be the active print item + ((RowItem)child.Children[0]).isActivePrint = true; + } } else { diff --git a/PrinterDriverInstaller/InfInstaller.csproj b/PrinterDriverInstaller/InfInstaller.csproj index a96c5a201..df65cc36c 100644 --- a/PrinterDriverInstaller/InfInstaller.csproj +++ b/PrinterDriverInstaller/InfInstaller.csproj @@ -27,7 +27,7 @@ prompt 4 True - AnyCPU + x86 pdbonly @@ -36,7 +36,7 @@ prompt 4 True - AnyCPU + x86 diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index fc2524f98..f91467e14 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -1974,3 +1974,12 @@ Translated:Release Options English:No items to select. Press 'Add' to select a file to print. Translated:No items to select. Press 'Add' to select a file to print. +English:Unknown +Translated:Unknown + +English:Press 'Add' to select an item. +Translated:Press 'Add' to select an item. + +English:Shop +Translated:Shop + diff --git a/StaticData/application.ico b/StaticData/application.ico new file mode 100644 index 000000000..37da81d47 Binary files /dev/null and b/StaticData/application.ico differ diff --git a/StaticData/icon_shopping_cart_32x32.png b/StaticData/icon_shopping_cart_32x32.png new file mode 100644 index 000000000..4edcdd33a Binary files /dev/null and b/StaticData/icon_shopping_cart_32x32.png differ diff --git a/VersionManagement/WebRequestHandler.cs b/VersionManagement/WebRequestHandler.cs index 72ca2c592..f2e463ab8 100644 --- a/VersionManagement/WebRequestHandler.cs +++ b/VersionManagement/WebRequestHandler.cs @@ -270,11 +270,11 @@ namespace MatterHackers.MatterControl.VersionManagement { public RequestLatestVersion() { - string feedType = ApplicationSettings.Instance.get("UpdateFeedType"); + string feedType = UserSettings.Instance.get("UpdateFeedType"); if (feedType == null) { feedType = "release"; - ApplicationSettings.Instance.set("UpdateFeedType", feedType); + UserSettings.Instance.set("UpdateFeedType", feedType); } requestValues["ProjectToken"] = VersionInfo.Instance.ProjectToken; requestValues["UpdateFeedType"] = feedType;