From 7e8f437adde5e577fc1969b5c8f4ccbd45f218a9 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Sun, 15 Apr 2018 17:56:37 -0700 Subject: [PATCH] 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;