From 181ea3f20484d8679358ac966c3bce2a5036a420 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Tue, 2 Jan 2018 16:45:02 -0800 Subject: [PATCH] Removed Lock and Unlock edit controls --- PartPreviewWindow/View3D/SceneActions.cs | 12 --- PartPreviewWindow/View3D/View3DWidget.cs | 85 ++----------------- Submodules/agg-sharp | 2 +- .../PrintingTests.cs | 2 + TextCreator/Braille/BrailleEditor.cs | 8 -- TextCreator/Text/TextEditor.cs | 4 - 6 files changed, 8 insertions(+), 105 deletions(-) diff --git a/PartPreviewWindow/View3D/SceneActions.cs b/PartPreviewWindow/View3D/SceneActions.cs index c0c13705b..09ed55eed 100644 --- a/PartPreviewWindow/View3D/SceneActions.cs +++ b/PartPreviewWindow/View3D/SceneActions.cs @@ -48,8 +48,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { if (Scene.HasSelection) { - view3DWidget.StartProgress("Ungroup"); - await Task.Run(() => { var selectedItem = Scene.SelectedItem; @@ -104,8 +102,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // leave no selection Scene.SelectedItem = null; - - view3DWidget.EndProgress(); } } @@ -113,8 +109,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { if (Scene.HasChildren()) { - view3DWidget.StartProgress("Group Selection"); - var selectedItem = Scene.SelectedItem; await Task.Run(() => @@ -130,8 +124,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { return; } - - view3DWidget.EndProgress(); } } @@ -147,8 +139,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { if (Scene.HasSelection) { - view3DWidget.StartProgress("Making Copy".Localize() + ":"); - // Copy selected item IObject3D newItem = await Task.Run(() => { @@ -201,8 +191,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { Scene.InsertNewItem(view3DWidget, newItem); } - - view3DWidget.EndProgress(); } } diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index f584966de..c2eabd121 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -63,7 +63,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow private bool DoBooleanTest = false; private bool deferEditorTillMouseUp = false; - public DisableablePanel bottomActionPanel; + public GuiWidget bottomActionPanel; public readonly int EditButtonHeight = 44; @@ -76,8 +76,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow private Matrix4X4 transformOnMouseDown = Matrix4X4.Identity; private EventHandler unregisterEvents; - private bool wasInSelectMode = false; - private ThemeConfig theme; public Vector3 BedCenter @@ -352,8 +350,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow selectionActionBar.AddChild(materialsButton); } - LockEditControls(); - mainContainerTopToBottom.AddChild(bottomActionPanel); this.AddChild(mainContainerTopToBottom); @@ -390,43 +386,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow UiThread.RunOnIdle(AutoSpin); - // Wire up CommunicationStateChanged to lock footer bar when SyncToPrint is enabled - if (sceneContext.Printer != null) - { - sceneContext.Printer.Connection.CommunicationStateChanged.RegisterEvent((s, e) => - { - if (sceneContext.RendererOptions.SyncToPrint - && sceneContext.Printer != null) - { - switch (sceneContext.Printer.Connection.CommunicationState) - { - case CommunicationStates.Printing: - case CommunicationStates.Paused: - LockEditControls(); - break; - - default: - UnlockEditControls(); - break; - } - } - }, - ref unregisterEvents); - - // make sure we lock the controls if we are printing or paused - switch (sceneContext.Printer.Connection.CommunicationState) - { - case CommunicationStates.Printing: - case CommunicationStates.Paused: - if (sceneContext.RendererOptions.SyncToPrint) - { - LockEditControls(); - } - - break; - } - } - var interactionVolumes = this.InteractionLayer.InteractionVolumes; interactionVolumes.Add(new MoveInZControl(this.InteractionLayer)); interactionVolumes.Add(new SelectionShadow(this.InteractionLayer)); @@ -1777,31 +1736,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow zArrow.LineTo(6, -2); zArrow.LineTo(0, 12); zArrow.LineTo(-6, -2); - - VertexSourceApplyTransform translate = new VertexSourceApplyTransform(zArrow, Affine.NewTranslation(centerTopScreenPosition)); - - //graphics2D.Render(translate, Color.Black); } } - public void StartProgress(string rootTask) - { - this.LockEditControls(); - } - - public void EndProgress() - { - this.UnlockEditControls(); - Scene.Invalidate(); - this.Invalidate(); - } - private async void LoadAndAddPartsToPlate(string[] filesToLoad) { if (filesToLoad != null && filesToLoad.Length > 0) { - this.StartProgress("Loading Parts".Localize() + ":"); - await Task.Run(() => loadAndAddPartsToPlate(filesToLoad)); if (HasBeenClosed) @@ -1820,7 +1761,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow } } - this.EndProgress(); + Scene.Invalidate(); + this.Invalidate(); } } @@ -2050,8 +1992,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { viewControls3D.ActiveButton = ViewControls3DButtons.PartSelect; - this.StartProgress("Preparing Meshes".Localize() + ":"); - if (Scene.HasChildren()) { // This should be very fast (only building up a trace data for non-meshes, mesh should happen as background task). @@ -2074,27 +2014,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow Scene.SelectFirstChild(); } - this.EndProgress(); + this.Invalidate(); + Scene.Invalidate(); viewControls3D.ActiveButton = ViewControls3DButtons.PartSelect; } - public void LockEditControls() - { - bottomActionPanel.Enabled = false; - } - - public void UnlockEditControls() - { - bottomActionPanel.Enabled = true; - - if (wasInSelectMode) - { - viewControls3D.ActiveButton = ViewControls3DButtons.PartSelect; - wasInSelectMode = false; - } - } - internal GuiWidget ShowOverflowMenu() { var popupMenu = new PopupMenu(theme); diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 5830ebcef..d429ef11b 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 5830ebcefef7040b6186a43299bd4310c63dd5fc +Subproject commit d429ef11ba2e4cdaf939912702b0132cabb077cf diff --git a/Tests/MatterControl.AutomationTests/PrintingTests.cs b/Tests/MatterControl.AutomationTests/PrintingTests.cs index cc0986c6f..eaf7e57f4 100644 --- a/Tests/MatterControl.AutomationTests/PrintingTests.cs +++ b/Tests/MatterControl.AutomationTests/PrintingTests.cs @@ -48,6 +48,8 @@ namespace MatterHackers.MatterControl.Tests.Automation // Wait for expected temp testRunner.WaitFor(() => ApplicationController.Instance.ActivePrinter.Connection.ActualBedTemperature <= 10); Assert.Less(ApplicationController.Instance.ActivePrinter.Connection.ActualBedTemperature, 10); + + // Validate that the bottom controls have been re-enabled } return Task.CompletedTask; diff --git a/TextCreator/Braille/BrailleEditor.cs b/TextCreator/Braille/BrailleEditor.cs index 7061a5a32..a1a3026b9 100644 --- a/TextCreator/Braille/BrailleEditor.cs +++ b/TextCreator/Braille/BrailleEditor.cs @@ -137,8 +137,6 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder brailleGenerator.ResetSettings(); - view3DWidget.LockEditControls(); - var generatedItem = await Task.Run(() => { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; @@ -163,12 +161,6 @@ namespace MatterHackers.MatterControl.Plugins.BrailleBuilder childList.AddRange(generatedItem.Children); }); }); - - //PlatingHelper.MoveToOpenPosition(injectedItem, view3DWidget.Scene); - - //view3DWidget.InsertNewItem(injectedItem); - - view3DWidget.UnlockEditControls(); } private void RebuildBase() diff --git a/TextCreator/Text/TextEditor.cs b/TextCreator/Text/TextEditor.cs index f8214e47e..2a58086b7 100644 --- a/TextCreator/Text/TextEditor.cs +++ b/TextCreator/Text/TextEditor.cs @@ -137,8 +137,6 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator return; } - view3DWidget.LockEditControls(); - var generatedItem = await Task.Run(() => { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; @@ -157,8 +155,6 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator childList.AddRange(generatedItem.Children); }); }); - - view3DWidget.UnlockEditControls(); } } } \ No newline at end of file