Merge pull request #2834 from larsbrubaker/design_tools

Removed Lock and Unlock edit controls
This commit is contained in:
Lars Brubaker 2018-01-02 16:56:30 -08:00 committed by GitHub
commit 376c3e17eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 105 deletions

View file

@ -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();
}
}

View file

@ -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);

@ -1 +1 @@
Subproject commit 5830ebcefef7040b6186a43299bd4310c63dd5fc
Subproject commit d429ef11ba2e4cdaf939912702b0132cabb077cf

View file

@ -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;

View file

@ -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()

View file

@ -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();
}
}
}