From 50ec91ea2f592f26dbdaabab9507ff84aa7e3511 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Wed, 9 May 2018 07:35:42 -0700 Subject: [PATCH] Ensure drag-drop GCode is disallowed on part tabs - Issue MatterHackers/MCCentral#3318 Drag-drop GCode to part tab should not be allowed --- PartPreviewWindow/View3D/View3DWidget.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index 99f696635..2e834bc6a 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -805,7 +805,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // File system Drop validation mouseEvent.AcceptDrop = this.AllowDragDrop() && mouseEvent.DragFiles?.Count > 0 - && mouseEvent.DragFiles.TrueForAll(filePath => ApplicationController.Instance.IsLoadableFile(filePath)); + && mouseEvent.DragFiles.TrueForAll(filePath => + { + return ApplicationController.Instance.IsLoadableFile(filePath) + // Disallow GCode drop in part view + && (this.Printer != null || string.Equals(System.IO.Path.GetExtension(filePath), ".gcode", StringComparison.OrdinalIgnoreCase)); + }); // View3DWidgets Filesystem DropDrop handler if (mouseEvent.AcceptDrop