Merge pull request #3136 from jlewin/design_tools

Use ancestor background color
This commit is contained in:
johnlewin 2018-04-04 16:11:45 -07:00 committed by GitHub
commit db6044720d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 44 additions and 45 deletions

View file

@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl.PrinterControls
{
UiThread.RunOnIdle(() =>
{
LevelWizardBase.ShowPrintLevelWizard(printer, LevelWizardBase.RuningState.UserRequestedCalibration);
LevelWizardBase.ShowPrintLevelWizard(printer, LevelWizardBase.RunningState.UserRequestedCalibration);
});
};

View file

@ -36,7 +36,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class LevelWizard13PointRadial : LevelWizardBase
{
public LevelWizard13PointRadial(PrinterConfig printer, LevelWizardBase.RuningState runningState)
public LevelWizard13PointRadial(PrinterConfig printer, LevelWizardBase.RunningState runningState)
: base(printer, runningState)
{
}

View file

@ -40,7 +40,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class LevelWizard3Point : LevelWizardBase
{
public LevelWizard3Point(PrinterConfig printer, LevelWizardBase.RuningState runningState)
public LevelWizard3Point(PrinterConfig printer, LevelWizardBase.RunningState runningState)
: base(printer, runningState)
{
}

View file

@ -37,7 +37,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class LevelWizard3x3Mesh : LevelWizardBase
{
public LevelWizard3x3Mesh(PrinterConfig printer, LevelWizardBase.RuningState runningState)
public LevelWizard3x3Mesh(PrinterConfig printer, LevelWizardBase.RunningState runningState)
: base(printer, runningState)
{
}

View file

@ -37,7 +37,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class LevelWizard5x5Mesh : LevelWizardBase
{
public LevelWizard5x5Mesh(PrinterConfig printer, LevelWizardBase.RuningState runningState)
public LevelWizard5x5Mesh(PrinterConfig printer, LevelWizardBase.RunningState runningState)
: base(printer, runningState)
{
}

View file

@ -36,7 +36,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class LevelWizard7PointRadial : LevelWizardBase
{
public LevelWizard7PointRadial(PrinterConfig printer, LevelWizardBase.RuningState runningState)
public LevelWizard7PointRadial(PrinterConfig printer, LevelWizardBase.RunningState runningState)
: base(printer, runningState)
{
}

View file

@ -45,7 +45,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
private static SystemWindow printLevelWizardWindow;
private LevelingStrings levelingStrings;
public LevelWizardBase(PrinterConfig printer, RuningState runningState)
public LevelWizardBase(PrinterConfig printer, RunningState runningState)
: base(500, 370)
{
levelingStrings = new LevelingStrings(printer.Settings);
@ -65,7 +65,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
printLevelWizard = new WizardControl();
AddChild(printLevelWizard);
if (runningState == LevelWizardBase.RuningState.InitialStartupCalibration)
if (runningState == LevelWizardBase.RunningState.InitialStartupCalibration)
{
string part1 = "Congratulations on connecting to your new printer. Before starting your first print we need to run a simple calibration procedure.".Localize();
string part2 = "The next few screens will walk your through the print leveling wizard.".Localize();
@ -82,8 +82,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
var secondsPerAutomaticSpot = 3 * zProbeSamples;
var secondsToCompleteWizard = ProbeCount * (useZProbe ? secondsPerAutomaticSpot : secondsPerManualSpot);
secondsToCompleteWizard += (hasHeatedBed ? 60 * 3 : 0);
printLevelWizard.AddPage(new FirstPageInstructions(printer,
"Print Leveling Overview".Localize(),
printLevelWizard.AddPage(new FirstPageInstructions(printer,
"Print Leveling Overview".Localize(),
levelingStrings.WelcomeText(ProbeCount, (int)Math.Round(secondsToCompleteWizard / 60.0))));
if (!useZProbe)
@ -99,7 +99,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
printLevelWizard.AddPage(new HomePrinterPage(printer, printLevelWizard,
levelingStrings.HomingPageStepText,
levelingStrings.HomingPageInstructions(useZProbe, hasHeatedBed),
levelingStrings.HomingPageInstructions(useZProbe, hasHeatedBed),
useZProbe));
if (hasHeatedBed)
@ -138,37 +138,37 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
printLevelWizard.AddPage(new LastPagelInstructions(printer, printLevelWizard, "Done".Localize(), levelingStrings.DoneInstructions, probePositions));
}
public enum RuningState { InitialStartupCalibration, UserRequestedCalibration }
public enum RunningState { InitialStartupCalibration, UserRequestedCalibration }
public abstract int ProbeCount { get; }
public int TotalSteps => ProbeCount * 3;
public static void ShowPrintLevelWizard(PrinterConfig printer)
{
LevelWizardBase.RuningState runningState = LevelWizardBase.RuningState.UserRequestedCalibration;
LevelWizardBase.RunningState runningState = LevelWizardBase.RunningState.UserRequestedCalibration;
if (printer.Settings.GetValue<bool>(SettingsKey.print_leveling_required_to_print))
{
// run in the first run state
runningState = LevelWizardBase.RuningState.InitialStartupCalibration;
runningState = LevelWizardBase.RunningState.InitialStartupCalibration;
}
ShowPrintLevelWizard(printer, runningState);
}
public static void ShowPrintLevelWizard(PrinterConfig printer, LevelWizardBase.RuningState runningState)
public static void ShowPrintLevelWizard(PrinterConfig printer, LevelWizardBase.RunningState runningState)
{
if (printLevelWizardWindow == null)
{
// turn off print leveling
PrintLevelingStream.AlowLeveling = false;
PrintLevelingStream.AllowLeveling = false;
printLevelWizardWindow = LevelWizardBase.CreateAndShowWizard(printer, runningState);
printLevelWizardWindow.Closed += (sender, e) =>
{
// If leveling was on when we started, make sure it is on when we are done.
PrintLevelingStream.AlowLeveling = true;
PrintLevelingStream.AllowLeveling = true;
printLevelWizardWindow = null;
@ -191,7 +191,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
public abstract IEnumerable<Vector2> GetPrintLevelPositionToSample();
private static LevelWizardBase CreateAndShowWizard(PrinterConfig printer, LevelWizardBase.RuningState runningState)
private static LevelWizardBase CreateAndShowWizard(PrinterConfig printer, LevelWizardBase.RunningState runningState)
{
// clear any data that we are going to be acquiring (sampled positions, after z home offset)
PrintLevelingData levelingData = new PrintLevelingData()
@ -239,15 +239,15 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
var probeOffset = printer.Settings.GetValue<Vector2>(SettingsKey.z_probe_xy_offset);
var actualNozzlePosition = probePosition - probeOffset;
// clamp this to the bed bounds
Vector2 bedSize = printer.Settings.GetValue<Vector2>(SettingsKey.bed_size);
Vector2 printCenter = printer.Settings.GetValue<Vector2>(SettingsKey.print_center);
RectangleDouble bedBounds = new RectangleDouble(printCenter - bedSize/2, printCenter + bedSize/2);
Vector2 adjustedPostion = bedBounds.Clamp(actualNozzlePosition);
Vector2 adjustedPosition = bedBounds.Clamp(actualNozzlePosition);
// and push it back into the probePosition
probePosition = adjustedPostion + probeOffset;
probePosition = adjustedPosition + probeOffset;
}
return probePosition;

View file

@ -226,7 +226,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
// Invoke setter forcing persistence of leveling data
printer.Settings.Helpers.SetPrintLevelingData(levelingData, true);
PrintLevelingStream.AlowLeveling = true;
PrintLevelingStream.AllowLeveling = true;
printer.Settings.Helpers.DoPrintLeveling(true);
if (printer.Settings.GetValue<bool>(SettingsKey.z_homes_to_max))
@ -451,7 +451,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
public override void PageIsBecomingActive()
{
// always make sure we don't have print leveling turned on
PrintLevelingStream.AlowLeveling = false;
PrintLevelingStream.AllowLeveling = false;
base.PageIsBecomingActive();
this.Parents<SystemWindow>().First().KeyDown += TopWindowKeyDown;
@ -563,7 +563,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
probePositions[probePositionsBeingEditedIndex].position.X = probeStartPosition.X;
probePositions[probePositionsBeingEditedIndex].position.Y = probeStartPosition.Y;
// smoothie returns the position relative to the start postion
// smoothie returns the position relative to the start position
double reportedProbeZ = 0;
GCodeFile.GetFirstNumberAfter("Z:", currentEvent.Data, ref reportedProbeZ);
sampleRead = probeStartPosition.Z - reportedProbeZ;
@ -602,7 +602,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
public override void PageIsBecomingActive()
{
// always make sure we don't have print leveling turned on
PrintLevelingStream.AlowLeveling = false;
PrintLevelingStream.AllowLeveling = false;
base.PageIsBecomingActive();

View file

@ -121,7 +121,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
if (probeCalibrationWizardWindow == null)
{
// turn off print leveling
PrintLevelingStream.AlowLeveling = false;
PrintLevelingStream.AllowLeveling = false;
probeCalibrationWizardWindow = new ProbeCalibrationWizard(printer);
@ -130,7 +130,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
probeCalibrationWizardWindow.Closed += (s, e) =>
{
// If leveling was on when we started, make sure it is on when we are done.
PrintLevelingStream.AlowLeveling = true;
PrintLevelingStream.AllowLeveling = true;
probeCalibrationWizardWindow = null;

View file

@ -180,11 +180,11 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
return ApplyAtPosition(currentTransform, transformToApply, boundsToApplyTo.Center);
}
public static Matrix4X4 ApplyAtPosition(Matrix4X4 currentTransform, Matrix4X4 transformToApply, Vector3 postionToApplyAt)
public static Matrix4X4 ApplyAtPosition(Matrix4X4 currentTransform, Matrix4X4 transformToApply, Vector3 positionToApplyAt)
{
currentTransform *= Matrix4X4.CreateTranslation(-postionToApplyAt);
currentTransform *= Matrix4X4.CreateTranslation(-positionToApplyAt);
currentTransform *= transformToApply;
currentTransform *= Matrix4X4.CreateTranslation(postionToApplyAt);
currentTransform *= Matrix4X4.CreateTranslation(positionToApplyAt);
return currentTransform;
}

View file

@ -325,7 +325,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
layerRenderRatioSlider.TotalWidthInPixels = view3DWidget.InteractionLayer.Width - 32;
}
private double lastPostion = 0;
private double lastPosition = 0;
private TumbleCubeControl tumbleCubeControl;
private bool SetAnimationPosition()
@ -335,10 +335,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
double currentPosition = printer.Connection.RatioIntoCurrentLayer;
layerRenderRatioSlider.FirstValue = 0;
if (lastPostion != currentPosition)
if (lastPosition != currentPosition)
{
layerRenderRatioSlider.SecondValue = currentPosition;
lastPostion = currentPosition;
lastPosition = currentPosition;
return true;
}
@ -467,7 +467,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
"Printer".Localize(),
new ConfigurePrinterWidget(sliceSettingsWidget.settingsContext, printer, theme)
{
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor,
HAnchor = HAnchor.Stretch,
VAnchor = VAnchor.Stretch,
});

View file

@ -471,7 +471,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
&& this.DragDropObject != null)
{
// Move the DropDropObject the target item
DragSelectedObject(localMousePostion: this.TransformFromParentSpace(topMostParent, screenSpaceMousePosition));
DragSelectedObject(localMousePosition: this.TransformFromParentSpace(topMostParent, screenSpaceMousePosition));
}
}
@ -925,9 +925,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
return CurrentSelectInfo.HitPlane.GetClosestIntersection(ray);
}
public void DragSelectedObject(Vector2 localMousePostion)
public void DragSelectedObject(Vector2 localMousePosition)
{
Vector2 meshViewerWidgetScreenPosition = meshViewerWidget.TransformFromParentSpace(this, localMousePostion);
Vector2 meshViewerWidgetScreenPosition = meshViewerWidget.TransformFromParentSpace(this, localMousePosition);
Ray ray = this.World.GetRayForLocalBounds(meshViewerWidgetScreenPosition);
IntersectInfo info = CurrentSelectInfo.HitPlane.GetClosestIntersection(ray);

View file

@ -44,12 +44,12 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
: base(internalStream)
{
// always reset this when we construct
AlowLeveling = true;
AllowLeveling = true;
this.printerSettings = printerSettings;
this.activePrinting = activePrinting;
}
public static bool AlowLeveling { get; set; }
public static bool AllowLeveling { get; set; }
public PrinterMove LastDestination { get { return lastDestination; } }
@ -57,7 +57,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
{
get
{
return AlowLeveling
return AllowLeveling
&& printerSettings.GetValue<bool>(SettingsKey.print_leveling_enabled)
&& !printerSettings.GetValue<bool>(SettingsKey.has_hardware_leveling);
}

View file

@ -118,7 +118,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
// remove it from the part
case RecoveryState.Raising:
// We don't know where the printer is for sure (it make have been turned off). Disable leveling until we know where it is.
PrintLevelingStream.AlowLeveling = false;
PrintLevelingStream.AllowLeveling = false;
queuedCommands.Add("M114 ; get current position");
queuedCommands.Add("G91 ; move relative");
queuedCommands.Add("G1 Z10 F{0}".FormatWith(printer.Settings.ZSpeed()));
@ -145,7 +145,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
queuedCommands.Add("G28 Z0");
}
// We now know where the printer is re-enable print leveling
PrintLevelingStream.AlowLeveling = true;
PrintLevelingStream.AllowLeveling = true;
RecoveryState = RecoveryState.FindingRecoveryLayer;
return "";

View file

@ -2072,7 +2072,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
PrintingCanContinue(this, null);
}
private void KeepTrackOfAbsolutePostionAndDestination(string lineBeingSent)
private void KeepTrackOfAbsolutePositionAndDestination(string lineBeingSent)
{
if (lineBeingSent.StartsWith("G0 ")
|| lineBeingSent.StartsWith("G1 ")
@ -2494,7 +2494,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
// remove the comment if any
lineToWrite = RemoveCommentIfAny(lineToWrite);
KeepTrackOfAbsolutePostionAndDestination(lineToWrite);
KeepTrackOfAbsolutePositionAndDestination(lineToWrite);
if (this.SendWithChecksum && sendLineWithChecksum)
{

View file

@ -20,7 +20,7 @@ namespace MatterControl.Tests.MatterControl
{
AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData"));
MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));
LevelWizard3Point levelingSolution = new LevelWizard3Point(ActiveSliceSettings.Instance.printer, LevelWizardBase.RuningState.InitialStartupCalibration);
LevelWizard3Point levelingSolution = new LevelWizard3Point(ActiveSliceSettings.Instance.printer, LevelWizardBase.RunningState.InitialStartupCalibration);
var printerSettings = ActiveSliceSettings.Instance;
{