From 65582c827f971cf4941c3f43ac993d32f9e34e8d Mon Sep 17 00:00:00 2001 From: John Lewin Date: Sun, 15 Apr 2018 17:55:12 -0700 Subject: [PATCH 1/3] Rename file to match type --- MatterControl.csproj | 2 +- PrinterControls/{XYZJogControls.cs => JogControls.cs} | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) rename PrinterControls/{XYZJogControls.cs => JogControls.cs} (99%) diff --git a/MatterControl.csproj b/MatterControl.csproj index af938f30d..240bafe73 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -222,6 +222,7 @@ + @@ -452,7 +453,6 @@ - diff --git a/PrinterControls/XYZJogControls.cs b/PrinterControls/JogControls.cs similarity index 99% rename from PrinterControls/XYZJogControls.cs rename to PrinterControls/JogControls.cs index 06fa84fe9..a31b03078 100644 --- a/PrinterControls/XYZJogControls.cs +++ b/PrinterControls/JogControls.cs @@ -1,5 +1,5 @@ /* -Copyright (c) 2012, Lars Brubaker +Copyright (c) 2018, Lars Brubaker, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without @@ -29,12 +29,10 @@ either expressed or implied, of the FreeBSD Project. using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Linq; using MatterHackers.Agg; using MatterHackers.Agg.Platform; using MatterHackers.Agg.UI; -using MatterHackers.Agg.VertexSource; using MatterHackers.Localizations; using MatterHackers.MatterControl.CustomWidgets; using MatterHackers.MatterControl.PrinterCommunication; From 7e8f437adde5e577fc1969b5c8f4ccbd45f218a9 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Sun, 15 Apr 2018 17:56:37 -0700 Subject: [PATCH 2/3] Remove anonymous block --- PrinterControls/JogControls.cs | 234 ++++++++++++++++----------------- 1 file changed, 116 insertions(+), 118 deletions(-) diff --git a/PrinterControls/JogControls.cs b/PrinterControls/JogControls.cs index a31b03078..db1ffd008 100644 --- a/PrinterControls/JogControls.cs +++ b/PrinterControls/JogControls.cs @@ -71,134 +71,132 @@ namespace MatterHackers.MatterControl allControlsTopToBottom.HAnchor |= HAnchor.Stretch; + FlowLayoutWidget allControlsLeftToRight = new FlowLayoutWidget(); + + FlowLayoutWidget xYZWithDistance = new FlowLayoutWidget(FlowDirection.TopToBottom); { - FlowLayoutWidget allControlsLeftToRight = new FlowLayoutWidget(); - - FlowLayoutWidget xYZWithDistance = new FlowLayoutWidget(FlowDirection.TopToBottom); + FlowLayoutWidget xYZControls = new FlowLayoutWidget(); { - FlowLayoutWidget xYZControls = new FlowLayoutWidget(); - { - GuiWidget xyGrid = CreateXYGridControl(colors, distanceBetweenControls, buttonSeparationDistance); - xYZControls.AddChild(xyGrid); + GuiWidget xyGrid = CreateXYGridControl(colors, distanceBetweenControls, buttonSeparationDistance); + xYZControls.AddChild(xyGrid); - FlowLayoutWidget zButtons = JogControls.CreateZButtons(printer, buttonSeparationDistance, out zPlusControl, out zMinusControl, colors, theme); - zButtons.VAnchor = VAnchor.Bottom; - xYZControls.AddChild(zButtons); - xYZWithDistance.AddChild(xYZControls); - } - - // add in some movement radio buttons - FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget(); - TextWidget buttonsLabel = new TextWidget("Distance:", textColor: Color.White); - buttonsLabel.VAnchor = VAnchor.Center; - //setMoveDistanceControl.AddChild(buttonsLabel); - - { - var moveRadioButtons = new FlowLayoutWidget(); - var radioList = new List(); - - movePointZeroTwoMmButton = theme.CreateMicroRadioButton("0.02", radioList); - movePointZeroTwoMmButton.CheckedStateChanged += (s, e) => - { - if (movePointZeroTwoMmButton.Checked) - { - SetXYZMoveAmount(.02); - } - }; - moveRadioButtons.AddChild(movePointZeroTwoMmButton); - - var pointOneButton = theme.CreateMicroRadioButton("0.1", radioList); - pointOneButton.CheckedStateChanged += (s, e) => - { - if (pointOneButton.Checked) - { - SetXYZMoveAmount(.1); - } - }; - moveRadioButtons.AddChild(pointOneButton); - - moveOneMmButton = theme.CreateMicroRadioButton("1", radioList); - moveOneMmButton.CheckedStateChanged += (s, e) => - { - if (moveOneMmButton.Checked) - { - SetXYZMoveAmount(1); - } - }; - moveRadioButtons.AddChild(moveOneMmButton); - - tooBigForBabyStepping = new DisableableWidget() - { - VAnchor = VAnchor.Fit, - HAnchor = HAnchor.Fit - }; - - var tooBigFlowLayout = new FlowLayoutWidget(); - tooBigForBabyStepping.AddChild(tooBigFlowLayout); - - tenButton = theme.CreateMicroRadioButton("10", radioList); - tenButton.CheckedStateChanged += (s, e) => - { - if (tenButton.Checked) - { - SetXYZMoveAmount(10); - } - }; - tooBigFlowLayout.AddChild(tenButton); - - oneHundredButton = theme.CreateMicroRadioButton("100", radioList); - oneHundredButton.CheckedStateChanged += (s, e) => - { - if (oneHundredButton.Checked) - { - SetXYZMoveAmount(100); - } - }; - tooBigFlowLayout.AddChild(oneHundredButton); - - moveRadioButtons.AddChild(tooBigForBabyStepping); - - tenButton.Checked = true; - moveRadioButtons.Margin = new BorderDouble(0, 3); - - setMoveDistanceControl.AddChild(moveRadioButtons); - - tooBigFlowLayout.AddChild(new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8) - { - Margin = new BorderDouble(left: 10), - VAnchor = VAnchor.Center - }); - } - - setMoveDistanceControl.HAnchor = HAnchor.Left; - xYZWithDistance.AddChild(setMoveDistanceControl); + FlowLayoutWidget zButtons = JogControls.CreateZButtons(printer, buttonSeparationDistance, out zPlusControl, out zMinusControl, colors, theme); + zButtons.VAnchor = VAnchor.Bottom; + xYZControls.AddChild(zButtons); + xYZWithDistance.AddChild(xYZControls); } - allControlsLeftToRight.AddChild(xYZWithDistance); + // add in some movement radio buttons + FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget(); + TextWidget buttonsLabel = new TextWidget("Distance:", textColor: Color.White); + buttonsLabel.VAnchor = VAnchor.Center; + //setMoveDistanceControl.AddChild(buttonsLabel); + + { + var moveRadioButtons = new FlowLayoutWidget(); + var radioList = new List(); + + movePointZeroTwoMmButton = theme.CreateMicroRadioButton("0.02", radioList); + movePointZeroTwoMmButton.CheckedStateChanged += (s, e) => + { + if (movePointZeroTwoMmButton.Checked) + { + SetXYZMoveAmount(.02); + } + }; + moveRadioButtons.AddChild(movePointZeroTwoMmButton); + + var pointOneButton = theme.CreateMicroRadioButton("0.1", radioList); + pointOneButton.CheckedStateChanged += (s, e) => + { + if (pointOneButton.Checked) + { + SetXYZMoveAmount(.1); + } + }; + moveRadioButtons.AddChild(pointOneButton); + + moveOneMmButton = theme.CreateMicroRadioButton("1", radioList); + moveOneMmButton.CheckedStateChanged += (s, e) => + { + if (moveOneMmButton.Checked) + { + SetXYZMoveAmount(1); + } + }; + moveRadioButtons.AddChild(moveOneMmButton); + + tooBigForBabyStepping = new DisableableWidget() + { + VAnchor = VAnchor.Fit, + HAnchor = HAnchor.Fit + }; + + var tooBigFlowLayout = new FlowLayoutWidget(); + tooBigForBabyStepping.AddChild(tooBigFlowLayout); + + tenButton = theme.CreateMicroRadioButton("10", radioList); + tenButton.CheckedStateChanged += (s, e) => + { + if (tenButton.Checked) + { + SetXYZMoveAmount(10); + } + }; + tooBigFlowLayout.AddChild(tenButton); + + oneHundredButton = theme.CreateMicroRadioButton("100", radioList); + oneHundredButton.CheckedStateChanged += (s, e) => + { + if (oneHundredButton.Checked) + { + SetXYZMoveAmount(100); + } + }; + tooBigFlowLayout.AddChild(oneHundredButton); + + moveRadioButtons.AddChild(tooBigForBabyStepping); + + tenButton.Checked = true; + moveRadioButtons.Margin = new BorderDouble(0, 3); + + setMoveDistanceControl.AddChild(moveRadioButtons); + + tooBigFlowLayout.AddChild(new TextWidget("mm", textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 8) + { + Margin = new BorderDouble(left: 10), + VAnchor = VAnchor.Center + }); + } + + setMoveDistanceControl.HAnchor = HAnchor.Left; + xYZWithDistance.AddChild(setMoveDistanceControl); + } + + allControlsLeftToRight.AddChild(xYZWithDistance); #if !__ANDROID__ - allControlsLeftToRight.AddChild(GetHotkeyControlContainer()); + allControlsLeftToRight.AddChild(GetHotkeyControlContainer()); #endif - var barBetweenZAndE = new GuiWidget(1, 1) - { - VAnchor = VAnchor.Stretch, - BackgroundColor = colors.ZColor, - Margin = new BorderDouble(distanceBetweenControls, 5) - }; - allControlsLeftToRight.AddChild(barBetweenZAndE); + var barBetweenZAndE = new GuiWidget(1, 1) + { + VAnchor = VAnchor.Stretch, + BackgroundColor = colors.ZColor, + Margin = new BorderDouble(distanceBetweenControls, 5) + }; + allControlsLeftToRight.AddChild(barBetweenZAndE); - FlowLayoutWidget eButtons = CreateEButtons(buttonSeparationDistance, colors); - disableableEButtons = new DisableableWidget() - { - Name = "disableableEButtons", - HAnchor = HAnchor.Fit, - VAnchor = VAnchor.Fit | VAnchor.Top, - }; - disableableEButtons.AddChild(eButtons); + FlowLayoutWidget eButtons = CreateEButtons(buttonSeparationDistance, colors); + disableableEButtons = new DisableableWidget() + { + Name = "disableableEButtons", + HAnchor = HAnchor.Fit, + VAnchor = VAnchor.Fit | VAnchor.Top, + }; + disableableEButtons.AddChild(eButtons); - allControlsLeftToRight.AddChild(disableableEButtons); - allControlsTopToBottom.AddChild(allControlsLeftToRight); - } + allControlsLeftToRight.AddChild(disableableEButtons); + allControlsTopToBottom.AddChild(allControlsLeftToRight); this.AddChild(allControlsTopToBottom); this.HAnchor = HAnchor.Fit; From 515418a8a99656f570ed4e26aae5c2ec621ec608 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Sun, 15 Apr 2018 18:00:02 -0700 Subject: [PATCH 3/3] Remove dead code --- PrinterControls/JogControls.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/PrinterControls/JogControls.cs b/PrinterControls/JogControls.cs index db1ffd008..57b85c22b 100644 --- a/PrinterControls/JogControls.cs +++ b/PrinterControls/JogControls.cs @@ -88,9 +88,6 @@ namespace MatterHackers.MatterControl // add in some movement radio buttons FlowLayoutWidget setMoveDistanceControl = new FlowLayoutWidget(); - TextWidget buttonsLabel = new TextWidget("Distance:", textColor: Color.White); - buttonsLabel.VAnchor = VAnchor.Center; - //setMoveDistanceControl.AddChild(buttonsLabel); { var moveRadioButtons = new FlowLayoutWidget();