Restore Software Print Leveling options into Controls section
This commit is contained in:
parent
89ece98b16
commit
d264a9fc7c
3 changed files with 62 additions and 63 deletions
|
|
@ -48,13 +48,14 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
|
||||
private FlowLayoutWidget GetAutoLevelControl()
|
||||
{
|
||||
FlowLayoutWidget buttonRow = new FlowLayoutWidget();
|
||||
buttonRow.Name = "AutoLevelRowItem";
|
||||
buttonRow.HAnchor = HAnchor.ParentLeftRight;
|
||||
buttonRow.Margin = new BorderDouble(0, 4);
|
||||
var buttonRow = new FlowLayoutWidget()
|
||||
{
|
||||
Name = "AutoLevelRowItem",
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
Margin = new BorderDouble(0, 4),
|
||||
};
|
||||
|
||||
ImageBuffer levelingImage = StaticData.Instance.LoadIcon("leveling_32x32.png", 24, 24).InvertLightness();
|
||||
|
||||
if (!ActiveTheme.Instance.IsDarkTheme)
|
||||
{
|
||||
levelingImage.InvertLightness();
|
||||
|
|
@ -73,14 +74,12 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
VAnchor = VAnchor.ParentCenter,
|
||||
Text = "Software Print Leveling".Localize()
|
||||
};
|
||||
|
||||
buttonRow.AddChild(printLevelingStatusLabel);
|
||||
|
||||
// edit button
|
||||
Button editButton = TextImageButtonFactory.GetThemedEditButton();
|
||||
editButton.Margin = new BorderDouble(2, 2, 2, 0);
|
||||
editButton.VAnchor = Agg.UI.VAnchor.ParentTop;
|
||||
|
||||
editButton.VAnchor = VAnchor.ParentTop;
|
||||
editButton.VAnchor = VAnchor.ParentCenter;
|
||||
editButton.Click += (sender, e) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Kevin Pope
|
||||
Copyright (c) 2017, Kevin Pope, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -27,6 +27,8 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.ImageProcessing;
|
||||
|
|
@ -38,11 +40,6 @@ using MatterHackers.MatterControl.PrinterCommunication;
|
|||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.MatterControl.Utilities;
|
||||
using MatterHackers.VectorMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrinterControls
|
||||
{
|
||||
|
|
@ -109,7 +106,14 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
public MovementControls()
|
||||
{
|
||||
Button editButton;
|
||||
movementControlsGroupBox = new AltGroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit(new TextWidget("Movement".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor), out editButton));
|
||||
movementControlsGroupBox = new AltGroupBox(textImageButtonFactory.GenerateGroupBoxLabelWithEdit(new TextWidget("Movement".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor), out editButton))
|
||||
{
|
||||
Margin = new BorderDouble(0),
|
||||
TextColor = ActiveTheme.Instance.PrimaryTextColor,
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
VAnchor = VAnchor.FitToChildren
|
||||
};
|
||||
|
||||
editButton.Click += (sender, e) =>
|
||||
{
|
||||
if (editManualMovementSettingsWindow == null)
|
||||
|
|
@ -126,32 +130,26 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
}
|
||||
};
|
||||
|
||||
movementControlsGroupBox.Margin = new BorderDouble(0);
|
||||
movementControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
movementControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
|
||||
movementControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren;
|
||||
|
||||
jogControls = new JogControls(new XYZColors());
|
||||
jogControls.Margin = new BorderDouble(0);
|
||||
|
||||
manualControlsLayout = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||
{
|
||||
manualControlsLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
manualControlsLayout.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
manualControlsLayout.VAnchor = Agg.UI.VAnchor.FitToChildren;
|
||||
manualControlsLayout.Padding = new BorderDouble(3, 5, 3, 0);
|
||||
{
|
||||
FlowLayoutWidget leftToRightContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
VAnchor = VAnchor.FitToChildren,
|
||||
Padding = new BorderDouble(3, 5, 3, 0)
|
||||
};
|
||||
|
||||
manualControlsLayout.AddChild(CreateDisableableContainer(GetHomeButtonBar()));
|
||||
manualControlsLayout.AddChild(CreateDisableableContainer(CreateSeparatorLine()));
|
||||
manualControlsLayout.AddChild(jogControls);
|
||||
////manualControlsLayout.AddChild(leftToRightContainer);
|
||||
manualControlsLayout.AddChild(CreateDisableableContainer(CreateSeparatorLine()));
|
||||
manualControlsLayout.AddChild(CreateDisableableContainer(GetHWDestinationBar()));
|
||||
manualControlsLayout.AddChild(CreateDisableableContainer(CreateSeparatorLine()));
|
||||
}
|
||||
manualControlsLayout.AddChild(CreateDisableableContainer(GetHomeButtonBar()));
|
||||
manualControlsLayout.AddChild(CreateSeparatorLine());
|
||||
manualControlsLayout.AddChild(jogControls);
|
||||
|
||||
movementControlsGroupBox.AddChild(manualControlsLayout);
|
||||
}
|
||||
manualControlsLayout.AddChild(CreateSeparatorLine());
|
||||
manualControlsLayout.AddChild(CreateDisableableContainer(GetHWDestinationBar()));
|
||||
manualControlsLayout.AddChild(CreateSeparatorLine());
|
||||
|
||||
movementControlsGroupBox.AddChild(manualControlsLayout);
|
||||
|
||||
this.AddChild(movementControlsGroupBox);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2017, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -27,15 +27,16 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.ConfigurationPage;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using MatterHackers.MatterControl.PrinterCommunication;
|
||||
using MatterHackers.MatterControl.PrinterControls;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MatterHackers.Localizations;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
@ -86,30 +87,40 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private DisableableWidget tuningAdjustmentControlsContainer;
|
||||
|
||||
private EventHandler unregisterEvents;
|
||||
|
||||
public ManualPrinterControlsDesktop()
|
||||
{
|
||||
ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
|
||||
ScrollArea.HAnchor |= HAnchor.ParentLeftRight;
|
||||
AnchorAll();
|
||||
AutoScroll = true;
|
||||
|
||||
HAnchor = HAnchor.Max_FitToChildren_ParentWidth;
|
||||
VAnchor = VAnchor.ParentBottomTop;
|
||||
|
||||
FlowLayoutWidget controlsTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
controlsTopToBottomLayout.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
|
||||
controlsTopToBottomLayout.VAnchor = Agg.UI.VAnchor.FitToChildren;
|
||||
controlsTopToBottomLayout.Name = "ManualPrinterControls.ControlsContainer";
|
||||
controlsTopToBottomLayout.Margin = new BorderDouble(0);
|
||||
|
||||
var controlsTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||
{
|
||||
HAnchor = HAnchor.Max_FitToChildren_ParentWidth,
|
||||
VAnchor = VAnchor.FitToChildren,
|
||||
Name = "ManualPrinterControls.ControlsContainer",
|
||||
Margin = new BorderDouble(0)
|
||||
};
|
||||
AddActionControls(controlsTopToBottomLayout);
|
||||
|
||||
AddTemperatureControls(controlsTopToBottomLayout);
|
||||
AddMovementControls(controlsTopToBottomLayout);
|
||||
|
||||
if (!ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_hardware_leveling))
|
||||
{
|
||||
controlsTopToBottomLayout.AddChild(new CalibrationSettingsWidget(ApplicationController.Instance.Theme.BreadCrumbButtonFactory));
|
||||
}
|
||||
|
||||
AddMacroControls(controlsTopToBottomLayout);
|
||||
|
||||
FlowLayoutWidget linearPanel = new FlowLayoutWidget();
|
||||
linearPanel.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
var linearPanel = new FlowLayoutWidget()
|
||||
{
|
||||
HAnchor = HAnchor.ParentLeftRight
|
||||
};
|
||||
controlsTopToBottomLayout.AddChild(linearPanel);
|
||||
|
||||
AddFanControls(linearPanel);
|
||||
|
|
@ -118,12 +129,13 @@ namespace MatterHackers.MatterControl
|
|||
AddAdjustmentControls(controlsTopToBottomLayout);
|
||||
|
||||
AddChild(controlsTopToBottomLayout);
|
||||
AddHandlers();
|
||||
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
|
||||
SetVisibleControls();
|
||||
}
|
||||
|
||||
private EventHandler unregisterEvents;
|
||||
|
||||
public override void OnClosed(ClosedEventArgs e)
|
||||
{
|
||||
unregisterEvents?.Invoke(this, null);
|
||||
|
|
@ -155,12 +167,6 @@ namespace MatterHackers.MatterControl
|
|||
#endif
|
||||
}
|
||||
|
||||
private void AddHandlers()
|
||||
{
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
}
|
||||
|
||||
private void AddActionControls(FlowLayoutWidget controlsTopToBottomLayout)
|
||||
{
|
||||
actionControlsContainer = new ActionControls();
|
||||
|
|
@ -184,15 +190,11 @@ namespace MatterHackers.MatterControl
|
|||
temperatureControlsContainer = new TemperatureControls();
|
||||
controlsTopToBottomLayout.AddChild(temperatureControlsContainer);
|
||||
}
|
||||
private void invalidateWidget()
|
||||
{
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
|
||||
private void onPrinterStatusChanged(object sender, EventArgs e)
|
||||
{
|
||||
SetVisibleControls();
|
||||
UiThread.RunOnIdle(invalidateWidget);
|
||||
UiThread.RunOnIdle(this.Invalidate);
|
||||
}
|
||||
|
||||
private void SetVisibleControls()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue