diff --git a/MatterControl.csproj b/MatterControl.csproj
index f4f6b8afd..82443365f 100644
--- a/MatterControl.csproj
+++ b/MatterControl.csproj
@@ -211,7 +211,6 @@
-
diff --git a/PrinterCommunication/Io/BabyStepsStream.cs b/PrinterCommunication/Io/BabyStepsStream.cs
index 4df72bf88..30df66b7e 100644
--- a/PrinterCommunication/Io/BabyStepsStream.cs
+++ b/PrinterCommunication/Io/BabyStepsStream.cs
@@ -41,11 +41,11 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
MaxLengthStream maxLengthStream;
int layerCount = -1;
- public double Offset
+ public Vector3 Offset
{
get
{
- return offsetStream.Offset.z;
+ return offsetStream.Offset;
}
}
@@ -55,14 +55,12 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
maxLengthStream.Dispose();
}
- public void MoveDown()
+ public void OffsetAxis(PrinterConnectionAndCommunication.Axis moveAxis, double moveAmount)
{
- offsetStream.Offset = offsetStream.Offset - new Vector3(0, 0, .02);
- }
-
- public void MoveUp()
- {
- offsetStream.Offset = offsetStream.Offset + new Vector3(0, 0, .02);
+ offsetStream.Offset = offsetStream.Offset + new Vector3(
+ (moveAxis == PrinterConnectionAndCommunication.Axis.X) ? moveAmount : 0,
+ (moveAxis == PrinterConnectionAndCommunication.Axis.Y) ? moveAmount : 0,
+ (moveAxis == PrinterConnectionAndCommunication.Axis.Z) ? moveAmount : 0);
}
public BabyStepsStream(GCodeStream internalStream)
diff --git a/PrinterCommunication/PrinterConnectionAndCommunication.cs b/PrinterCommunication/PrinterConnectionAndCommunication.cs
index 7a2e3cccc..9ff382260 100644
--- a/PrinterCommunication/PrinterConnectionAndCommunication.cs
+++ b/PrinterCommunication/PrinterConnectionAndCommunication.cs
@@ -62,6 +62,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication
///
public class PrinterConnectionAndCommunication
{
+ public event ErrorEventHandler OffsetStreamChanged;
+
public RootedObjectEventHandler ActivePrintItemChanged = new RootedObjectEventHandler();
public RootedObjectEventHandler BedTemperatureRead = new RootedObjectEventHandler();
@@ -302,25 +304,13 @@ namespace MatterHackers.MatterControl.PrinterCommunication
}
- public void BabyStepsMoveUp()
+ public void AddToBabyStepOffset(Axis moveAxis, double moveAmount)
{
- babyStepsStream5.MoveUp();
- }
+ babyStepsStream5.OffsetAxis(moveAxis, moveAmount);
+ OffsetStreamChanged?.Invoke(null, null);
+ }
- public void BabyStepsMoveDown()
- {
- babyStepsStream5.MoveDown();
- }
-
- public double CurrentBabyStepsOffset()
- {
- if (babyStepsStream5 != null)
- {
- return babyStepsStream5.Offset;
- }
-
- return 0;
- }
+ public Vector3 CurrentBabyStepsOffset => babyStepsStream5?.Offset ?? Vector3.Zero;
[Flags]
public enum Axis { X = 1, Y = 2, Z = 4, E = 8, XYZ = (X | Y | Z) }
diff --git a/PrinterControls/ControlWidgets/AdjustmentControls.cs b/PrinterControls/ControlWidgets/AdjustmentControls.cs
deleted file mode 100644
index c13613523..000000000
--- a/PrinterControls/ControlWidgets/AdjustmentControls.cs
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
-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 MatterHackers.Agg;
-using MatterHackers.Agg.Image;
-using MatterHackers.Agg.ImageProcessing;
-using MatterHackers.Agg.PlatformAbstract;
-using MatterHackers.Agg.Transform;
-using MatterHackers.Agg.UI;
-using MatterHackers.Agg.VertexSource;
-using MatterHackers.Localizations;
-using MatterHackers.MatterControl.CustomWidgets;
-using MatterHackers.MatterControl.PrinterCommunication;
-using MatterHackers.VectorMath;
-using System;
-using System.IO;
-
-namespace MatterHackers.MatterControl.PrinterControls
-{
- public class AdjustmentControls : ControlWidgetBase
- {
- private NumberEdit feedRateValue;
- private SolidSlider feedRateRatioSlider;
- private SolidSlider extrusionRatioSlider;
- private NumberEdit extrusionValue;
-
- private readonly double minExtrutionRatio = .5;
- private readonly double maxExtrusionRatio = 3;
- private readonly double minFeedRateRatio = .5;
- private readonly double maxFeedRateRatio = 2;
-
- private event EventHandler unregisterEvents;
-
- protected override void AddChildElements()
- {
- AltGroupBox adjustmentControlsGroupBox = new AltGroupBox(new TextWidget("Tuning Adjustment".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor));
- adjustmentControlsGroupBox.Margin = new BorderDouble(0);
- adjustmentControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
- adjustmentControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
-
- {
- FlowLayoutWidget tuningRatiosLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
- tuningRatiosLayout.Margin = new BorderDouble(0, 0, 0, 0) * TextWidget.GlobalPointSizeScaleRatio;
- tuningRatiosLayout.HAnchor = HAnchor.ParentLeftRight;
- tuningRatiosLayout.Padding = new BorderDouble(3, 0, 3, 0) * TextWidget.GlobalPointSizeScaleRatio;
-
- double sliderWidth = 300;
- double sliderThumbWidth = 10;
- if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen)
- {
- sliderWidth = 280;
- sliderThumbWidth = 20;
- }
-
- TextWidget subheader = new TextWidget("Fine-tune adjustment while actively printing", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryTextColor);
- subheader.Margin = new BorderDouble(bottom: 6);
- tuningRatiosLayout.AddChild(subheader);
- TextWidget feedRateDescription;
- {
- FlowLayoutWidget feedRateLeftToRight;
- {
- feedRateValue = new NumberEdit(0, allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40 * TextWidget.GlobalPointSizeScaleRatio);
- feedRateValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.FeedRateRatio * 100 + .5)) / 100.0;
-
- feedRateLeftToRight = new FlowLayoutWidget();
- feedRateLeftToRight.HAnchor = HAnchor.ParentLeftRight;
-
- feedRateDescription = new TextWidget(LocalizedString.Get("Speed Multiplier"));
- feedRateDescription.MinimumSize = new Vector2(140, 0) * TextWidget.GlobalPointSizeScaleRatio;
- feedRateDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor;
- feedRateDescription.VAnchor = VAnchor.ParentCenter;
- feedRateLeftToRight.AddChild(feedRateDescription);
- feedRateRatioSlider = new SolidSlider(new Vector2(), sliderThumbWidth, minFeedRateRatio, maxFeedRateRatio);
- feedRateRatioSlider.Margin = new BorderDouble(5, 0);
- feedRateRatioSlider.Value = PrinterConnectionAndCommunication.Instance.FeedRateRatio;
- feedRateRatioSlider.TotalWidthInPixels = sliderWidth;
- feedRateRatioSlider.View.BackgroundColor = new RGBA_Bytes();
- feedRateRatioSlider.ValueChanged += (sender, e) =>
- {
- PrinterConnectionAndCommunication.Instance.FeedRateRatio = feedRateRatioSlider.Value;
- };
- PrinterConnectionAndCommunication.Instance.FeedRateRatioChanged.RegisterEvent(FeedRateRatioChanged_Event, ref unregisterEvents);
- feedRateValue.EditComplete += (sender, e) =>
- {
- feedRateRatioSlider.Value = feedRateValue.Value;
- };
- feedRateLeftToRight.AddChild(feedRateRatioSlider);
- tuningRatiosLayout.AddChild(feedRateLeftToRight);
-
- feedRateLeftToRight.AddChild(feedRateValue);
- feedRateValue.Margin = new BorderDouble(0, 0, 5, 0);
- feedRateValue.VAnchor = VAnchor.ParentCenter;
- textImageButtonFactory.FixedHeight = (int)feedRateValue.Height + 1;
- textImageButtonFactory.borderWidth = 1;
- textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);
- textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);
-
- Button setFeedRateButton = textImageButtonFactory.Generate(LocalizedString.Get("Set"));
- setFeedRateButton.VAnchor = VAnchor.ParentCenter;
-
- feedRateLeftToRight.AddChild(setFeedRateButton);
- }
-
- TextWidget extrusionDescription;
- {
- extrusionValue = new NumberEdit(0, allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40 * TextWidget.GlobalPointSizeScaleRatio);
- extrusionValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.ExtrusionRatio * 100 + .5)) / 100.0;
-
- FlowLayoutWidget leftToRight = new FlowLayoutWidget();
- leftToRight.HAnchor = HAnchor.ParentLeftRight;
- leftToRight.Margin = new BorderDouble(top: 10) * TextWidget.GlobalPointSizeScaleRatio;
-
- extrusionDescription = new TextWidget(LocalizedString.Get("Extrusion Multiplier"));
- extrusionDescription.MinimumSize = new Vector2(140, 0) * TextWidget.GlobalPointSizeScaleRatio;
- extrusionDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor;
- extrusionDescription.VAnchor = VAnchor.ParentCenter;
- leftToRight.AddChild(extrusionDescription);
- extrusionRatioSlider = new SolidSlider(new Vector2(), sliderThumbWidth, minExtrutionRatio, maxExtrusionRatio, Orientation.Horizontal);
- extrusionRatioSlider.TotalWidthInPixels = sliderWidth;
- extrusionRatioSlider.Margin = new BorderDouble(5, 0);
- extrusionRatioSlider.Value = PrinterConnectionAndCommunication.Instance.ExtrusionRatio;
- extrusionRatioSlider.View.BackgroundColor = new RGBA_Bytes();
- extrusionRatioSlider.ValueChanged += (sender, e) =>
- {
- PrinterConnectionAndCommunication.Instance.ExtrusionRatio = extrusionRatioSlider.Value;
- };
- PrinterConnectionAndCommunication.Instance.ExtrusionRatioChanged.RegisterEvent(ExtrusionRatioChanged_Event, ref unregisterEvents);
- extrusionValue.EditComplete += (sender, e) =>
- {
- extrusionRatioSlider.Value = extrusionValue.Value;
- };
- leftToRight.AddChild(extrusionRatioSlider);
- tuningRatiosLayout.AddChild(leftToRight);
- leftToRight.AddChild(extrusionValue);
- extrusionValue.Margin = new BorderDouble(0, 0, 5, 0);
- extrusionValue.VAnchor = VAnchor.ParentCenter;
- textImageButtonFactory.FixedHeight = (int)extrusionValue.Height + 1;
- Button setExtrusionButton = textImageButtonFactory.Generate(LocalizedString.Get("Set"));
- setExtrusionButton.VAnchor = VAnchor.ParentCenter;
- leftToRight.AddChild(setExtrusionButton);
- }
- feedRateLeftToRight.VAnchor = VAnchor.FitToChildren;
- }
-
- adjustmentControlsGroupBox.AddChild(tuningRatiosLayout);
-
- // put in the baby step controls
- {
- HorizontalLine line = new HorizontalLine();
- line.Margin = new BorderDouble(0, 10);
- tuningRatiosLayout.AddChild(line);
- TextWidget subheader2 = new TextWidget("Fine-tune z-height, while actively printing", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryTextColor);
- subheader2.Margin = new BorderDouble(bottom: 6);
- tuningRatiosLayout.AddChild(subheader2);
-
- ImageBuffer moveUpImage = StaticData.Instance.LoadIcon("MicroUp.png");
- moveUpImage = ImageBuffer.CreateScaledImage(moveUpImage, 32, 32);
-
- ImageBuffer moveDownImage = StaticData.Instance.LoadIcon("MicroDown.png");
- moveDownImage = ImageBuffer.CreateScaledImage(moveDownImage, 32, 32);
- InvertLightness.DoInvertLightness(moveUpImage);
- InvertLightness.DoInvertLightness(moveDownImage);
-
- textImageButtonFactory.FixedHeight = 0;
- textImageButtonFactory.AllowThemeToAdjustImage = false;
- Button moveDownButton = textImageButtonFactory.GenerateFromImages("", moveDownImage);
- moveDownButton.Margin = new BorderDouble(0, 3, 3, 3);
- Button moveUpButton = textImageButtonFactory.GenerateFromImages("", moveUpImage);
- moveUpButton.Margin = new BorderDouble(3);
-
- TextWidget currentOffset = new TextWidget(("Offset:".Localize() + " 0.00"), textColor: ActiveTheme.Instance.PrimaryTextColor)
- {
- AutoExpandBoundsToText = true,
- VAnchor = VAnchor.ParentCenter,
- Margin = new BorderDouble(3),
- };
-
- moveDownButton.Click += (sender, e) =>
- {
- PrinterConnectionAndCommunication.Instance.BabyStepsMoveDown();
- currentOffset.Text = ("Offset:".Localize() + " {0:0.00}").FormatWith(PrinterConnectionAndCommunication.Instance.CurrentBabyStepsOffset());
- };
-
- PrinterConnectionAndCommunication.Instance.PrintingStateChanged.RegisterEvent((sender, e) =>
- {
- currentOffset.Text = ("Offset:".Localize() + " {0:0.00}").FormatWith(PrinterConnectionAndCommunication.Instance.CurrentBabyStepsOffset());
- }, ref unregisterEvents);
-
- moveUpButton.Click += (sender, e) =>
- {
- PrinterConnectionAndCommunication.Instance.BabyStepsMoveUp();
- currentOffset.Text = ("Offset:".Localize() + " {0:0.00}").FormatWith(PrinterConnectionAndCommunication.Instance.CurrentBabyStepsOffset());
- };
-
- FlowLayoutWidget leftToRight = new FlowLayoutWidget();
- leftToRight.AddChild(moveDownButton);
- leftToRight.AddChild(moveUpButton);
- leftToRight.AddChild(currentOffset);
-
- tuningRatiosLayout.AddChild(leftToRight);
- }
- }
-
- this.AddChild(adjustmentControlsGroupBox);
- }
-
- public override void OnClosed(EventArgs e)
- {
- if (unregisterEvents != null)
- {
- unregisterEvents(this, null);
- }
- base.OnClosed(e);
- }
-
- private void ExtrusionRatioChanged_Event(object sender, EventArgs e)
- {
- extrusionRatioSlider.Value = PrinterConnectionAndCommunication.Instance.ExtrusionRatio;
- extrusionValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.ExtrusionRatio * 100 + .5)) / 100.0;
- }
-
- private void FeedRateRatioChanged_Event(object sender, EventArgs e)
- {
- feedRateRatioSlider.Value = PrinterConnectionAndCommunication.Instance.FeedRateRatio;
- feedRateValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.FeedRateRatio * 100 + .5)) / 100.0;
- }
- }
-}
\ No newline at end of file
diff --git a/PrinterControls/ControlWidgets/MovementControls.cs b/PrinterControls/ControlWidgets/MovementControls.cs
index 543373008..6af48bd7d 100644
--- a/PrinterControls/ControlWidgets/MovementControls.cs
+++ b/PrinterControls/ControlWidgets/MovementControls.cs
@@ -32,6 +32,7 @@ using MatterHackers.Agg.Image;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.MatterControl.Utilities;
using MatterHackers.VectorMath;
@@ -55,9 +56,15 @@ namespace MatterHackers.MatterControl.PrinterControls
private Button homeYButton;
private Button homeZButton;
private TextImageButtonFactory hotKeyButtonFactory = new TextImageButtonFactory();
- private JogControls jogControls;
+ internal JogControls jogControls;
private AltGroupBox movementControlsGroupBox;
+ // Provides a list of DisableableWidgets controls that can be toggled on/off at runtime
+ internal List DisableableWidgets = new List();
+
+ // Displays the current baby step offset stream values
+ private TextWidget offsetStreamLabel;
+
private LimitCallingFrequency reportDestinationChanged = null;
private event EventHandler unregisterEvents;
@@ -80,6 +87,8 @@ namespace MatterHackers.MatterControl.PrinterControls
public override void OnClosed(EventArgs e)
{
+ PrinterConnectionAndCommunication.Instance.OffsetStreamChanged -= OffsetStreamChanged;
+
if (unregisterEvents != null)
{
unregisterEvents(this, null);
@@ -87,6 +96,19 @@ namespace MatterHackers.MatterControl.PrinterControls
base.OnClosed(e);
}
+ ///
+ /// Helper method to create DisableableWidget containers and populate the DisableableWidgets local property.
+ ///
+ /// The widget to wrap.
+ private DisableableWidget CreateDisableableContainer(GuiWidget widget)
+ {
+ var container = new DisableableWidget();
+ container.AddChild(widget);
+ DisableableWidgets.Add(container);
+
+ return container;
+ }
+
protected override void AddChildElements()
{
Button editButton;
@@ -119,13 +141,13 @@ namespace MatterHackers.MatterControl.PrinterControls
{
FlowLayoutWidget leftToRightContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
- manualControlsLayout.AddChild(GetHomeButtonBar());
- manualControlsLayout.AddChild(CreateSeparatorLine());
+ manualControlsLayout.AddChild(CreateDisableableContainer(GetHomeButtonBar()));
+ manualControlsLayout.AddChild(CreateDisableableContainer(CreateSeparatorLine()));
manualControlsLayout.AddChild(jogControls);
- //manualControlsLayout.AddChild(leftToRightContainer);
- manualControlsLayout.AddChild(CreateSeparatorLine());
- manualControlsLayout.AddChild(GetHWDestinationBar());
- manualControlsLayout.AddChild(CreateSeparatorLine());
+ ////manualControlsLayout.AddChild(leftToRightContainer);
+ manualControlsLayout.AddChild(CreateDisableableContainer(CreateSeparatorLine()));
+ manualControlsLayout.AddChild(CreateDisableableContainer(GetHWDestinationBar()));
+ manualControlsLayout.AddChild(CreateDisableableContainer(CreateSeparatorLine()));
}
movementControlsGroupBox.AddChild(manualControlsLayout);
@@ -226,7 +248,6 @@ namespace MatterHackers.MatterControl.PrinterControls
disableMotors = textImageButtonFactory.Generate("Release".Localize().ToUpper());
disableMotors.Margin = new BorderDouble(0);
disableMotors.Click += new EventHandler(disableMotors_Click);
-
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
GuiWidget spacerReleaseShow = new GuiWidget(10 * TextWidget.GlobalPointSizeScaleRatio, 0);
@@ -236,13 +257,39 @@ namespace MatterHackers.MatterControl.PrinterControls
homeButtonBar.AddChild(homeXButton);
homeButtonBar.AddChild(homeYButton);
homeButtonBar.AddChild(homeZButton);
+
+ offsetStreamLabel = new TextWidget("", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8);
+ offsetStreamLabel.AutoExpandBoundsToText = true;
+ offsetStreamLabel.VAnchor = VAnchor.ParentCenter;
+ homeButtonBar.AddChild(offsetStreamLabel);
+
homeButtonBar.AddChild(spacer);
homeButtonBar.AddChild(disableMotors);
homeButtonBar.AddChild(spacerReleaseShow);
+ PrinterConnectionAndCommunication.Instance.OffsetStreamChanged += OffsetStreamChanged;
+
return homeButtonBar;
}
+ internal void OffsetStreamChanged(object sender, System.IO.ErrorEventArgs e)
+ {
+ if(PrinterConnectionAndCommunication.Instance.PrinterIsPrinting || PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
+ {
+ Vector3 offset = PrinterConnectionAndCommunication.Instance.CurrentBabyStepsOffset;
+
+ offsetStreamLabel.Text = ("{0} ({1:0.##}, {2:0.##}, {3:0.##})").FormatWith(
+ "Offset: ".Localize(),
+ offset.x,
+ offset.y,
+ offset.z);
+ }
+ else
+ {
+ offsetStreamLabel.Text = "";
+ }
+ }
+
private FlowLayoutWidget GetHWDestinationBar()
{
FlowLayoutWidget hwDestinationBar = new FlowLayoutWidget();
diff --git a/PrinterControls/ManualPrinterControls.cs b/PrinterControls/ManualPrinterControls.cs
index ac3e7db4c..428b1a375 100644
--- a/PrinterControls/ManualPrinterControls.cs
+++ b/PrinterControls/ManualPrinterControls.cs
@@ -59,14 +59,12 @@ namespace MatterHackers.MatterControl
private DisableableWidget macroControls;
- private DisableableWidget movementControlsContainer;
+ private MovementControls movementControlsContainer;
private TemperatureControls temperatureControlsContainer;
private TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
- private DisableableWidget tuningAdjustmentControlsContainer;
-
public ManualPrinterControls()
{
SetDisplayAttributes();
@@ -88,7 +86,6 @@ namespace MatterHackers.MatterControl
AddAtxPowerControls(linearPanel);
AddMacroControls(controlsTopToBottomLayout);
- AddAdjustmentControls(controlsTopToBottomLayout);
AddChild(controlsTopToBottomLayout);
AddHandlers();
@@ -118,12 +115,6 @@ namespace MatterHackers.MatterControl
base.OnClosed(e);
}
- private void AddAdjustmentControls(FlowLayoutWidget controlsTopToBottomLayout)
- {
- tuningAdjustmentControlsContainer = new AdjustmentControls();
- controlsTopToBottomLayout.AddChild(tuningAdjustmentControlsContainer);
- }
-
private void AddFanControls(FlowLayoutWidget controlsTopToBottomLayout)
{
fanControlsContainer = new FanControls();
@@ -190,7 +181,6 @@ namespace MatterHackers.MatterControl
temperatureControlsContainer.BedTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
fanControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
- tuningAdjustmentControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
macroControls.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
}
@@ -210,8 +200,15 @@ namespace MatterHackers.MatterControl
temperatureControlsContainer.BedTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
fanControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
- tuningAdjustmentControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
macroControls.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
+
+ foreach (var widget in movementControlsContainer.DisableableWidgets)
+ {
+ widget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
+ }
+ movementControlsContainer.jogControls.EnableBabystepping(false);
+ movementControlsContainer.OffsetStreamChanged(null, null);
+
break;
case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint:
@@ -224,7 +221,14 @@ namespace MatterHackers.MatterControl
movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
fanControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
macroControls.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
- tuningAdjustmentControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
+
+ foreach (var widget in movementControlsContainer.DisableableWidgets)
+ {
+ widget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
+ }
+ movementControlsContainer.jogControls.EnableBabystepping(false);
+ movementControlsContainer.OffsetStreamChanged(null, null);
+
break;
case PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd:
@@ -236,7 +240,6 @@ namespace MatterHackers.MatterControl
movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
fanControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
macroControls.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
- tuningAdjustmentControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
break;
case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
@@ -252,9 +255,17 @@ namespace MatterHackers.MatterControl
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
}
temperatureControlsContainer.BedTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
- movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
+ //movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
fanControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
- tuningAdjustmentControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
+
+ foreach(var widget in movementControlsContainer.DisableableWidgets)
+ {
+ widget.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
+ }
+
+ movementControlsContainer.jogControls.EnableBabystepping(true);
+ movementControlsContainer.OffsetStreamChanged(null, null);
+
macroControls.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
break;
@@ -271,8 +282,15 @@ namespace MatterHackers.MatterControl
temperatureControlsContainer.BedTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
fanControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
- tuningAdjustmentControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
macroControls.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
+
+ foreach (var widget in movementControlsContainer.DisableableWidgets)
+ {
+ widget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
+ }
+ movementControlsContainer.jogControls.EnableBabystepping(false);
+ movementControlsContainer.OffsetStreamChanged(null, null);
+
break;
default:
diff --git a/PrinterControls/XYZJogControls.cs b/PrinterControls/XYZJogControls.cs
index 304e452ed..69cb41261 100644
--- a/PrinterControls/XYZJogControls.cs
+++ b/PrinterControls/XYZJogControls.cs
@@ -37,6 +37,8 @@ using MatterHackers.MatterControl.SlicerConfiguration;
using System;
using System.Collections.Generic;
using MatterHackers.Agg.PlatformAbstract;
+using MatterHackers.MatterControl.CustomWidgets;
+using System.Collections.ObjectModel;
namespace MatterHackers.MatterControl
{
@@ -58,6 +60,8 @@ namespace MatterHackers.MatterControl
private MoveButtonFactory moveButtonFactory = new MoveButtonFactory();
+ private event EventHandler unregisterEvents;
+
public JogControls(XYZColors colors)
{
moveButtonFactory.normalTextColor = RGBA_Bytes.Black;
@@ -145,59 +149,59 @@ namespace MatterHackers.MatterControl
PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountNegative, MovementControls.EFeedRate(0));
}
}
- else if(OsInformation.OperatingSystem == OSType.Mac)
+ else if (OsInformation.OperatingSystem == OSType.Mac)
{
- if (e.KeyCode == Keys.LButton && hotKeysEnabled)
- {
- PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ);
- }
- else if (e.KeyCode == Keys.Z && hotKeysEnabled)
- {
- PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Z);
- }
- else if (e.KeyCode == Keys.Y && hotKeysEnabled)
- {
- PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Y);
- }
- else if (e.KeyCode == Keys.X && hotKeysEnabled)
- {
- PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.X);
- }
- else if (e.KeyCode == Keys.Left && hotKeysEnabled)
- {
- PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountNegative, MovementControls.XSpeed);
- }
- else if (e.KeyCode == Keys.Right && hotKeysEnabled)
- {
- PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountPositive, MovementControls.XSpeed);
- }
- else if (e.KeyCode == Keys.Up && hotKeysEnabled)
- {
- PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountPositive, MovementControls.YSpeed);
- }
- else if (e.KeyCode == Keys.Down && hotKeysEnabled)
- {
- PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountNegative, MovementControls.YSpeed);
- }
- else if (e.KeyCode == (Keys.Back | Keys.Cancel) && hotKeysEnabled)
- {
- PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountPositive, MovementControls.ZSpeed);
- }
- else if (e.KeyCode == Keys.Clear && hotKeysEnabled)
- {
- PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountNegative, MovementControls.ZSpeed);
- }
- else if (e.KeyCode == Keys.E && hotKeysEnabled)
- {
- PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountPositive, MovementControls.EFeedRate(0));
+ if (e.KeyCode == Keys.LButton && hotKeysEnabled)
+ {
+ PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ);
+ }
+ else if (e.KeyCode == Keys.Z && hotKeysEnabled)
+ {
+ PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Z);
+ }
+ else if (e.KeyCode == Keys.Y && hotKeysEnabled)
+ {
+ PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Y);
+ }
+ else if (e.KeyCode == Keys.X && hotKeysEnabled)
+ {
+ PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.X);
+ }
+ else if (e.KeyCode == Keys.Left && hotKeysEnabled)
+ {
+ PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountNegative, MovementControls.XSpeed);
+ }
+ else if (e.KeyCode == Keys.Right && hotKeysEnabled)
+ {
+ PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountPositive, MovementControls.XSpeed);
+ }
+ else if (e.KeyCode == Keys.Up && hotKeysEnabled)
+ {
+ PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountPositive, MovementControls.YSpeed);
+ }
+ else if (e.KeyCode == Keys.Down && hotKeysEnabled)
+ {
+ PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountNegative, MovementControls.YSpeed);
+ }
+ else if (e.KeyCode == (Keys.Back | Keys.Cancel) && hotKeysEnabled)
+ {
+ PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountPositive, MovementControls.ZSpeed);
+ }
+ else if (e.KeyCode == Keys.Clear && hotKeysEnabled)
+ {
+ PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountNegative, MovementControls.ZSpeed);
+ }
+ else if (e.KeyCode == Keys.E && hotKeysEnabled)
+ {
+ PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountPositive, MovementControls.EFeedRate(0));
- }
- else if (e.KeyCode == Keys.R && hotKeysEnabled)
- {
- PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountNegative, MovementControls.EFeedRate(0));
- }
+ }
+ else if (e.KeyCode == Keys.R && hotKeysEnabled)
+ {
+ PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountNegative, MovementControls.EFeedRate(0));
+ }
}
-
+
};
// add in some movement radio buttons
@@ -216,38 +220,64 @@ namespace MatterHackers.MatterControl
FlowLayoutWidget moveRadioButtons = new FlowLayoutWidget();
+ var radioList = new ObservableCollection();
+
+ pointZeroOneButton = buttonFactory.GenerateRadioButton("0.02");
+ pointZeroOneButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
+ pointZeroOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(.02); };
+ pointZeroOneButton.SiblingRadioButtonList = radioList;
+ moveRadioButtons.AddChild(pointZeroOneButton);
+
RadioButton pointOneButton = buttonFactory.GenerateRadioButton("0.1");
pointOneButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
pointOneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(.1); };
+ pointOneButton.SiblingRadioButtonList = radioList;
moveRadioButtons.AddChild(pointOneButton);
RadioButton oneButton = buttonFactory.GenerateRadioButton("1");
oneButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
oneButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(1); };
+ oneButton.SiblingRadioButtonList = radioList;
moveRadioButtons.AddChild(oneButton);
- RadioButton tenButton = buttonFactory.GenerateRadioButton("10");
+ tooBigForBabyStepping = new DisableableWidget()
+ {
+ VAnchor = VAnchor.FitToChildren,
+ HAnchor = HAnchor.FitToChildren
+ };
+
+ var tooBigFlowLayout = new FlowLayoutWidget();
+ tooBigForBabyStepping.AddChild(tooBigFlowLayout);
+
+ tenButton = buttonFactory.GenerateRadioButton("10");
tenButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
tenButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(10); };
- moveRadioButtons.AddChild(tenButton);
-
- RadioButton oneHundredButton = buttonFactory.GenerateRadioButton("100");
+ tenButton.SiblingRadioButtonList = radioList;
+ tooBigFlowLayout.AddChild(tenButton);
+
+ oneHundredButton = buttonFactory.GenerateRadioButton("100");
oneHundredButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
oneHundredButton.CheckedStateChanged += (sender, e) => { if (((RadioButton)sender).Checked) SetXYZMoveAmount(100); };
- moveRadioButtons.AddChild(oneHundredButton);
+ oneHundredButton.SiblingRadioButtonList = radioList;
+ tooBigFlowLayout.AddChild(oneHundredButton);
+
+ moveRadioButtons.AddChild(tooBigForBabyStepping);
tenButton.Checked = true;
moveRadioButtons.Margin = new BorderDouble(0, 3);
+
setMoveDistanceControl.AddChild(moveRadioButtons);
+
+ TextWidget mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8);
+ mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
+
+ tooBigFlowLayout.AddChild(mmLabel);
}
- TextWidget mmLabel = new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8);
- mmLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
- setMoveDistanceControl.AddChild(mmLabel);
setMoveDistanceControl.HAnchor = Agg.UI.HAnchor.ParentLeft;
xYZWithDistance.AddChild(setMoveDistanceControl);
}
-
+
allControlsLeftToRight.AddChild(xYZWithDistance);
#if !__ANDROID__
@@ -261,15 +291,16 @@ namespace MatterHackers.MatterControl
barBetweenZAndE.Margin = new BorderDouble(distanceBetweenControls, 5);
allControlsLeftToRight.AddChild(barBetweenZAndE);
- //moveButtonFactory.normalFillColor = XYZColors.eColor;
-
FlowLayoutWidget eButtons = CreateEButtons(buttonSeparationDistance);
- eButtons.VAnchor |= Agg.UI.VAnchor.ParentTop;
- allControlsLeftToRight.AddChild(eButtons);
+ disableableEButtons = new DisableableWidget()
+ {
+ HAnchor = HAnchor.FitToChildren,
+ VAnchor = VAnchor.FitToChildren | VAnchor.ParentTop,
+ };
+ disableableEButtons.AddChild(eButtons);
-
+ allControlsLeftToRight.AddChild(disableableEButtons);
allControlsTopToBottom.AddChild(allControlsLeftToRight);
-
}
this.AddChild(allControlsTopToBottom);
@@ -282,6 +313,26 @@ namespace MatterHackers.MatterControl
}
+ public override void OnClosed(EventArgs e)
+ {
+ unregisterEvents?.Invoke(this, null);
+ base.OnClosed(e);
+ }
+
+ internal void EnableBabystepping(bool enableBabysteppingMode)
+ {
+ if (enableBabysteppingMode)
+ {
+ pointZeroOneButton.Checked = true;
+ }
+
+ tenButton.Enabled = !enableBabysteppingMode;
+ oneHundredButton.Enabled = !enableBabysteppingMode;
+
+ disableableEButtons.SetEnableLevel(enableBabysteppingMode ? DisableableWidget.EnableLevel.Disabled : DisableableWidget.EnableLevel.Enabled);
+ tooBigForBabyStepping.SetEnableLevel(enableBabysteppingMode ? DisableableWidget.EnableLevel.Disabled : DisableableWidget.EnableLevel.Enabled);
+ }
+
private void SetEMoveAmount(int moveAmount)
{
foreach (ExtrudeButton extrudeButton in eMinusButtons)
@@ -313,10 +364,14 @@ namespace MatterHackers.MatterControl
private List eMinusButtons = new List();
private List ePlusButtons = new List();
+ private RadioButton oneHundredButton;
+ private RadioButton tenButton;
+ private DisableableWidget disableableEButtons;
+ private DisableableWidget tooBigForBabyStepping;
+ private RadioButton pointZeroOneButton;
private FlowLayoutWidget GetHotkeyControlContainer()
{
-
TextImageButtonFactory hotKeyButtonFactory = new TextImageButtonFactory();
hotKeyButtonFactory.FixedHeight = 20 * TextWidget.GlobalPointSizeScaleRatio;
hotKeyButtonFactory.FixedWidth = 30 * TextWidget.GlobalPointSizeScaleRatio;
@@ -579,8 +634,14 @@ namespace MatterHackers.MatterControl
{
MoveButton moveButton = (MoveButton)sender;
- //Add more fancy movement here
- PrinterConnectionAndCommunication.Instance.MoveRelative(this.moveAxis, this.MoveAmount, movementFeedRate);
+ if (PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Printing)
+ {
+ PrinterConnectionAndCommunication.Instance.AddToBabyStepOffset(this.moveAxis, this.MoveAmount);
+ }
+ else
+ {
+ PrinterConnectionAndCommunication.Instance.MoveRelative(this.moveAxis, this.MoveAmount, movementFeedRate);
+ }
}
}
diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt
index bbe98b68e..c3e7c4ea7 100644
--- a/StaticData/Translations/Master.txt
+++ b/StaticData/Translations/Master.txt
@@ -4033,3 +4033,6 @@ Translated:Are you sure you want to abort the current print and close MatterCont
English:Abort Print
Translated:Abort Print
+English:mm / minute
+Translated:mm / minute
+
diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp
index 83e068bb1..ca3226b18 160000
--- a/Submodules/agg-sharp
+++ b/Submodules/agg-sharp
@@ -1 +1 @@
-Subproject commit 83e068bb1f5305287eff979fbaf67863e82d1132
+Subproject commit ca3226b1817748f4141cee0a99ee96b80081d35e