Merge branch 'development' of https://github.com/MatterHackers/MatterControl into development
This commit is contained in:
commit
efc7aa23dc
16 changed files with 445 additions and 200 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
104
ActionBar/TemperatureWidgetBase.cs
Normal file
104
ActionBar/TemperatureWidgetBase.cs
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
91
ActionBar/TemperatureWidgetBed.cs
Normal file
91
ActionBar/TemperatureWidgetBed.cs
Normal file
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
101
ActionBar/TemperatureWidgetExtruder.cs
Normal file
101
ActionBar/TemperatureWidgetExtruder.cs
Normal file
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -89,7 +89,6 @@ namespace MatterHackers.MatterControl
|
|||
AddEePromControls(terminalControls);
|
||||
AddTerminalControls(terminalControls);
|
||||
|
||||
|
||||
AddPrintLevelingControls(mainLayoutContainer);
|
||||
|
||||
FlowLayoutWidget settingsControls = new FlowLayoutWidget();
|
||||
|
|
@ -98,7 +97,15 @@ namespace MatterHackers.MatterControl
|
|||
AddThemeControls(settingsControls);
|
||||
AddLanguageControls(settingsControls);
|
||||
|
||||
FlowLayoutWidget releaseControls = new FlowLayoutWidget();
|
||||
releaseControls.Margin = new BorderDouble (right: 10);
|
||||
releaseControls.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
|
||||
|
||||
AddReleaseOptions (releaseControls);
|
||||
|
||||
mainLayoutContainer.AddChild(settingsControls);
|
||||
mainLayoutContainer.AddChild(releaseControls);
|
||||
|
||||
AddChild(mainLayoutContainer);
|
||||
|
||||
|
|
@ -120,8 +127,12 @@ namespace MatterHackers.MatterControl
|
|||
ThemeColorSelectorWidget themeSelector = new ThemeColorSelectorWidget();
|
||||
themeControlsGroupBox.AddChild(themeSelector);
|
||||
|
||||
container.AddChild(themeControlsGroupBox);
|
||||
FlowLayoutWidget colorSquare = new FlowLayoutWidget();
|
||||
colorSquare.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
colorSquare.BackgroundColor = RGBA_Bytes.White;
|
||||
|
||||
themeControlsGroupBox.AddChild (colorSquare);
|
||||
container.AddChild(themeControlsGroupBox);
|
||||
controlsTopToBottomLayout.AddChild(container);
|
||||
}
|
||||
|
||||
|
|
@ -199,6 +210,38 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
}
|
||||
|
||||
private void AddReleaseOptions(FlowLayoutWidget controlsTopToBottom)
|
||||
{
|
||||
GroupBox releaseOptionsGroupBox = new GroupBox(LocalizedString.Get ("Release Options"));
|
||||
|
||||
releaseOptionsGroupBox.Margin = new BorderDouble (0);
|
||||
releaseOptionsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
releaseOptionsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
releaseOptionsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
releaseOptionsGroupBox.Height = 78;
|
||||
|
||||
FlowLayoutWidget controlsContainer = new FlowLayoutWidget();
|
||||
controlsContainer.HAnchor = HAnchor.ParentLeftRight;
|
||||
|
||||
StyledDropDownList releaseOptionsDropList = new StyledDropDownList("Options");
|
||||
releaseOptionsDropList.Margin = new BorderDouble (0, 3);
|
||||
//releaseOptionsDropList.MinimumSize = new Vector2(dropDownList.LocalBounds.Width, dropDownList.LocalBounds.Height);
|
||||
MenuItem releaseOptionsDropDownItem = releaseOptionsDropList.AddItem ("Release");
|
||||
MenuItem preReleaseDropDownItem = releaseOptionsDropList.AddItem ("Pre-Release");
|
||||
MenuItem developmentDropDownItem = releaseOptionsDropList.AddItem ("Development");
|
||||
|
||||
GuiWidget hSpacer = new GuiWidget();
|
||||
hSpacer.HAnchor = HAnchor.ParentLeftRight;
|
||||
|
||||
|
||||
controlsContainer.AddChild(releaseOptionsDropList);
|
||||
releaseOptionsGroupBox.AddChild(controlsContainer);
|
||||
controlsTopToBottom.AddChild(releaseOptionsGroupBox);
|
||||
controlsTopToBottom.AddChild(hSpacer);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void AddTerminalControls(FlowLayoutWidget controlsTopToBottomLayout)
|
||||
{
|
||||
|
|
@ -586,4 +629,22 @@ namespace MatterHackers.MatterControl
|
|||
OpenPrintLevelWizard();
|
||||
}
|
||||
}
|
||||
|
||||
class RequestCurrentVersion
|
||||
{
|
||||
protected Dictionary<string, string> requestValues;
|
||||
protected string uri;
|
||||
public RequestCurrentVersion()
|
||||
{
|
||||
string feedType = ApplicationSettings.Instance.get ("Update");
|
||||
if(feedType == null)
|
||||
{
|
||||
feedType = "release";
|
||||
ApplicationSettings.Instance.set("Update", feedType);
|
||||
}
|
||||
requestValues["Request Token"] = "ekshdsd5d5ssss5kels";
|
||||
requestValues["UpdateFeedType"] = feedType;
|
||||
uri = "https://mattercontrol.appspot.com/api/1/get-current-release-version";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,10 +67,13 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="ActionBar\ActionBarBaseControls.cs" />
|
||||
<Compile Include="ActionBar\ActionBarPlus.cs" />
|
||||
<Compile Include="ActionBar\TemperatureWidgetBed.cs" />
|
||||
<Compile Include="ActionBar\HelpTextWidget.cs" />
|
||||
<Compile Include="ActionBar\PrintActionRow.cs" />
|
||||
<Compile Include="ActionBar\PrinterActionRow.cs" />
|
||||
<Compile Include="ActionBar\PrintStatusRow.cs" />
|
||||
<Compile Include="ActionBar\TemperatureWidgetBase.cs" />
|
||||
<Compile Include="ActionBar\TemperatureWidgetExtruder.cs" />
|
||||
<Compile Include="ApplicationView\CompactSlidePanel.cs" />
|
||||
<Compile Include="ApplicationView\QueueTabs.cs" />
|
||||
<Compile Include="ConfigurationPage\LanguageSelector.cs" />
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
gcodeDispalyWidget = new GuiWidget(HAnchor.ParentLeftRight, Agg.UI.VAnchor.ParentBottomTop);
|
||||
|
||||
string startingMessage = "Press 'Add' to select an item.";
|
||||
string startingMessage = "Press 'Add' to select an item.".Localize();
|
||||
if (printItem != null)
|
||||
{
|
||||
startingMessage = LocalizedString.Get("No GCode Available...");
|
||||
|
|
@ -151,7 +151,7 @@ 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
|
||||
{
|
||||
|
|
@ -603,7 +603,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();
|
||||
|
|
@ -646,7 +646,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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
}
|
||||
PrintItems.Insert(indexToInsert, item);
|
||||
OnItemAdded(new IndexArgs(indexToInsert));
|
||||
SaveDefaultQueue();
|
||||
}
|
||||
|
||||
public void LoadDefaultQueue()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1968,3 +1968,15 @@ Translated:The type of support to create inside of parts.
|
|||
English:Infill Type
|
||||
Translated:Infill Type
|
||||
|
||||
English:Release Options
|
||||
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.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue