From 541b6de3586eb45417e5c392d042316f66254860 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Mon, 24 Nov 2014 12:25:40 -0800 Subject: [PATCH 01/10] Getting the up arrow to know its own state. --- PartPreviewWindow/View3D/View3DWidget.cs | 40 +++++++++++++++++------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index 2d05f55bf..4882d6b2a 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -71,23 +71,32 @@ namespace MatterHackers.MatterControl.PartPreviewWindow upArrow = loadedMeshGroups[0].Meshes[0]; } + public void SetPosition() + { + Matrix4X4 transform = meshViewerToDrawWith.SelectedMeshGroupTransform.TotalTransform; + AxisAlignedBoundingBox selectedBounds = meshViewerToDrawWith.SelectedMeshGroup.GetAxisAlignedBoundingBox(); + Vector3 boundsCenter = selectedBounds.Center; + Vector3 centerTop = new Vector3(boundsCenter.x, boundsCenter.y, selectedBounds.maxXYZ.z); + + Vector2 centerTopScreenPosition = meshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(centerTop); + //centerTopScreenPosition = meshViewerToDrawWith.TransformToParentSpace(this, centerTopScreenPosition); + + double distBetweenPixelsWorldSpace = meshViewerToDrawWith.TrackballTumbleWidget.GetWorldUnitsPerScreenPixelAtPosition(centerTop); + + transform = Matrix4X4.CreateTranslation(new Vector3(centerTop.x, centerTop.y, centerTop.z + 20 * distBetweenPixelsWorldSpace)) * transform; + transform = Matrix4X4.CreateScale(distBetweenPixelsWorldSpace) * transform; + + TotalTransform = transform; + } + public override void DrawGlContent(EventArgs e) { if (meshViewerToDrawWith.SelectedMeshGroup != null) { - AxisAlignedBoundingBox selectedBounds = meshViewerToDrawWith.SelectedMeshGroup.GetAxisAlignedBoundingBox(meshViewerToDrawWith.SelectedMeshGroupTransform.TotalTransform); - Vector3 boundsCenter = selectedBounds.Center; - Vector3 centerTop = new Vector3(boundsCenter.x, boundsCenter.y, selectedBounds.maxXYZ.z); - - Vector2 centerTopScreenPosition = meshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(centerTop); - //centerTopScreenPosition = meshViewerToDrawWith.TransformToParentSpace(this, centerTopScreenPosition); - - double scalling = meshViewerToDrawWith.TrackballTumbleWidget.GetWorldUnitsPerScreenPixelAtPosition(centerTop); GL.MatrixMode(MatrixMode.Modelview); GL.PushMatrix(); - GL.Translate(new Vector3(centerTop.x, centerTop.y, centerTop.z + 20 * scalling)); - GL.Scale(scalling, scalling, scalling); + GL.MultMatrix(TotalTransform.GetAsDoubleArray()); RenderMeshToGl.Render(upArrow, RGBA_Bytes.Black, RenderTypes.Shaded); @@ -103,6 +112,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow public WindowType windowType { get; set; } EventHandler SelectionChanged; + UpArrow3D upArrow; FlowLayoutWidget viewOptionContainer; FlowLayoutWidget rotateOptionContainer; @@ -276,6 +286,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow public override void OnDraw(Graphics2D graphics2D) { + if (HaveSelection) + { + upArrow.SetPosition(); + } + hasDrawn = true; base.OnDraw(graphics2D); DrawStuffForSelectedPart(graphics2D); @@ -636,13 +651,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow }); } - meshViewerWidget.InteractionVolumes.Add(new UpArrow3D(meshViewerWidget)); + upArrow = new UpArrow3D(meshViewerWidget); + meshViewerWidget.interactionVolumes.Add(upArrow); // make sure the colors are set correctl ThemeChanged(this, null); } - private void OpenExportWindow() + private void OpenExportWindow() { if (exportingWindow == null) { From 42ce0dab95ffacf56d343adcb98003466670f7f7 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Mon, 24 Nov 2014 14:34:59 -0800 Subject: [PATCH 02/10] Make it easier to get a tranable from a mesh. Make the z arrow show hover state. --- PartPreviewWindow/PlatingHelper.cs | 78 +++++++++++++++--------- PartPreviewWindow/View3D/View3DWidget.cs | 59 ++++++++++-------- 2 files changed, 82 insertions(+), 55 deletions(-) diff --git a/PartPreviewWindow/PlatingHelper.cs b/PartPreviewWindow/PlatingHelper.cs index 6b8d46288..d5cf7245d 100644 --- a/PartPreviewWindow/PlatingHelper.cs +++ b/PartPreviewWindow/PlatingHelper.cs @@ -258,40 +258,12 @@ namespace MatterHackers.MatterControl for(int i=0; i allPolys = new List(); - List positions = new List(); - bool continueProcessing; - foreach (Face face in mesh.Faces) - { - positions.Clear(); - foreach (Vertex vertex in face.Vertices()) - { - positions.Add(vertex.Position); - } - - // We should use the teselator for this if it is greater than 3. - Vector3 next = positions[1]; - for (int positionIndex = 2; positionIndex < positions.Count; positionIndex++) - { - TriangleShape triangel = new TriangleShape(positions[0], next, positions[positionIndex], null); - allPolys.Add(triangel); - next = positions[positionIndex]; - } - - if (reportProgress != null) - { - if((currentAction % 256) == 0 || needUpdateTitle) - { - reportProgress(currentAction / (double)totalActionCount, "Creating Trace Polygons", out continueProcessing); - needUpdateTitle = false; - } - currentAction++; - } - } + List allPolys = AddTraceDataForMesh(mesh, totalActionCount, ref currentAction, ref needUpdateTitle, reportProgress); needUpdateTitle = true; if (reportProgress != null) { + bool continueProcessing; reportProgress(currentAction / (double)totalActionCount, "Creating Trace Group", out continueProcessing); } @@ -311,5 +283,51 @@ namespace MatterHackers.MatterControl } } } + + public static IRayTraceable CreateTraceDataForMesh(Mesh mesh) + { + int unusedInt = 0; + bool unusedBool = false; + List allPolys = AddTraceDataForMesh(mesh, 0, ref unusedInt, ref unusedBool, null); + return BoundingVolumeHierarchy.CreateNewHierachy(allPolys); + } + + private static List AddTraceDataForMesh(Mesh mesh, int totalActionCount, ref int currentAction, ref bool needToUpdateProgressReport, ReportProgressRatio reportProgress) + { + bool continueProcessing; + + List allPolys = new List(); + List positions = new List(); + + foreach (Face face in mesh.Faces) + { + positions.Clear(); + foreach (Vertex vertex in face.Vertices()) + { + positions.Add(vertex.Position); + } + + // We should use the teselator for this if it is greater than 3. + Vector3 next = positions[1]; + for (int positionIndex = 2; positionIndex < positions.Count; positionIndex++) + { + TriangleShape triangel = new TriangleShape(positions[0], next, positions[positionIndex], null); + allPolys.Add(triangel); + next = positions[positionIndex]; + } + + if (reportProgress != null) + { + if ((currentAction % 256) == 0 || needToUpdateProgressReport) + { + reportProgress(currentAction / (double)totalActionCount, "Creating Trace Polygons", out continueProcessing); + needToUpdateProgressReport = false; + } + currentAction++; + } + } + + return allPolys; + } } } diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index 4882d6b2a..dcf17e246 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -60,28 +60,27 @@ namespace MatterHackers.MatterControl.PartPreviewWindow public class UpArrow3D : InteractionVolume { Mesh upArrow; - MeshViewerWidget meshViewerToDrawWith; public UpArrow3D(MeshViewerWidget meshViewerToDrawWith) - : base(new CylinderShape(3, 12, new SolidMaterial(RGBA_Floats.Red, .5, 0, .4))) + : base(new CylinderShape(6, 15, new SolidMaterial(RGBA_Floats.Red, .5, 0, .4)), meshViewerToDrawWith) { - this.meshViewerToDrawWith = meshViewerToDrawWith; string arrowFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "3D Icons", "up_pointer.stl"); List loadedMeshGroups = MeshFileIo.Load(arrowFile); upArrow = loadedMeshGroups[0].Meshes[0]; + //CollisionVolume = PlatingHelper.CreateTraceDataForMesh(upArrow); } public void SetPosition() { - Matrix4X4 transform = meshViewerToDrawWith.SelectedMeshGroupTransform.TotalTransform; - AxisAlignedBoundingBox selectedBounds = meshViewerToDrawWith.SelectedMeshGroup.GetAxisAlignedBoundingBox(); + Matrix4X4 transform = MeshViewerToDrawWith.SelectedMeshGroupTransform.TotalTransform; + AxisAlignedBoundingBox selectedBounds = MeshViewerToDrawWith.SelectedMeshGroup.GetAxisAlignedBoundingBox(); Vector3 boundsCenter = selectedBounds.Center; Vector3 centerTop = new Vector3(boundsCenter.x, boundsCenter.y, selectedBounds.maxXYZ.z); - Vector2 centerTopScreenPosition = meshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(centerTop); + Vector2 centerTopScreenPosition = MeshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(centerTop); //centerTopScreenPosition = meshViewerToDrawWith.TransformToParentSpace(this, centerTopScreenPosition); - double distBetweenPixelsWorldSpace = meshViewerToDrawWith.TrackballTumbleWidget.GetWorldUnitsPerScreenPixelAtPosition(centerTop); + double distBetweenPixelsWorldSpace = MeshViewerToDrawWith.TrackballTumbleWidget.GetWorldUnitsPerScreenPixelAtPosition(centerTop); transform = Matrix4X4.CreateTranslation(new Vector3(centerTop.x, centerTop.y, centerTop.z + 20 * distBetweenPixelsWorldSpace)) * transform; transform = Matrix4X4.CreateScale(distBetweenPixelsWorldSpace) * transform; @@ -91,14 +90,21 @@ namespace MatterHackers.MatterControl.PartPreviewWindow public override void DrawGlContent(EventArgs e) { - if (meshViewerToDrawWith.SelectedMeshGroup != null) + if (MeshViewerToDrawWith.SelectedMeshGroup != null) { GL.MatrixMode(MatrixMode.Modelview); GL.PushMatrix(); GL.MultMatrix(TotalTransform.GetAsDoubleArray()); - RenderMeshToGl.Render(upArrow, RGBA_Bytes.Black, RenderTypes.Shaded); + if (MouseOver) + { + RenderMeshToGl.Render(upArrow, RGBA_Bytes.Red, RenderTypes.Shaded); + } + else + { + RenderMeshToGl.Render(upArrow, RGBA_Bytes.Black, RenderTypes.Shaded); + } GL.PopMatrix(); } @@ -260,25 +266,28 @@ namespace MatterHackers.MatterControl.PartPreviewWindow && ModifierKeys != Keys.Control && ModifierKeys != Keys.Alt) { - int meshGroupHitIndex; - if (FindMeshGroupHitPosition(mouseEvent.Position, out meshGroupHitIndex)) + if (!meshViewerWidget.MouseDownOnInteractionVolume) { - meshSelectInfo.hitPlane = new PlaneShape(Vector3.UnitZ, meshSelectInfo.planeDownHitPos.z, null); - SelectedMeshGroupIndex = meshGroupHitIndex; - - transformOnMouseDown = SelectedMeshGroupTransform.translation; - - Invalidate(); - meshSelectInfo.downOnPart = true; - - if (SelectionChanged != null) + int meshGroupHitIndex; + if (FindMeshGroupHitPosition(mouseEvent.Position, out meshGroupHitIndex)) { - SelectionChanged(this, null); + meshSelectInfo.hitPlane = new PlaneShape(Vector3.UnitZ, meshSelectInfo.planeDownHitPos.z, null); + SelectedMeshGroupIndex = meshGroupHitIndex; + + transformOnMouseDown = SelectedMeshGroupTransform.translation; + + Invalidate(); + meshSelectInfo.downOnPart = true; + + if (SelectionChanged != null) + { + SelectionChanged(this, null); + } + } + else + { + SelectedMeshGroupIndex = -1; } - } - else - { - SelectedMeshGroupIndex = -1; } } } From b618e5c2b393bcb275f37caa7d64a82b8d5e28d4 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Mon, 24 Nov 2014 14:51:05 -0800 Subject: [PATCH 03/10] turn off the up arrow for now. --- PartPreviewWindow/View3D/View3DWidget.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index dcf17e246..ff96a4a69 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -65,9 +65,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow : base(new CylinderShape(6, 15, new SolidMaterial(RGBA_Floats.Red, .5, 0, .4)), meshViewerToDrawWith) { string arrowFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "3D Icons", "up_pointer.stl"); - List loadedMeshGroups = MeshFileIo.Load(arrowFile); - upArrow = loadedMeshGroups[0].Meshes[0]; - //CollisionVolume = PlatingHelper.CreateTraceDataForMesh(upArrow); + if (File.Exists(arrowFile)) + { + List loadedMeshGroups = MeshFileIo.Load(arrowFile); + upArrow = loadedMeshGroups[0].Meshes[0]; + //CollisionVolume = PlatingHelper.CreateTraceDataForMesh(upArrow); + } } public void SetPosition() @@ -660,8 +663,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow }); } - upArrow = new UpArrow3D(meshViewerWidget); - meshViewerWidget.interactionVolumes.Add(upArrow); + //upArrow = new UpArrow3D(meshViewerWidget); + //meshViewerWidget.interactionVolumes.Add(upArrow); // make sure the colors are set correctl ThemeChanged(this, null); From 15b5654a400fbdea6833c2ebca9695787bfff9cf Mon Sep 17 00:00:00 2001 From: larsbrubaker Date: Mon, 24 Nov 2014 22:24:30 -0800 Subject: [PATCH 04/10] Cleaned up the drop down settings menus to work well. Got rid of some crash problems with no selection. --- .../View3D/View3DCreateSelecitonData.cs | 2 + PartPreviewWindow/View3D/View3DWidget.cs | 60 +++++++++++-------- SlicerConfiguration/SliceSettingsWidget.cs | 40 +++++++++---- StaticData/SliceSettings/Properties.json | 4 +- 4 files changed, 70 insertions(+), 36 deletions(-) diff --git a/PartPreviewWindow/View3D/View3DCreateSelecitonData.cs b/PartPreviewWindow/View3D/View3DCreateSelecitonData.cs index b6eda0c0a..929003e58 100644 --- a/PartPreviewWindow/View3D/View3DCreateSelecitonData.cs +++ b/PartPreviewWindow/View3D/View3DCreateSelecitonData.cs @@ -64,6 +64,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow createSelectionDataBackgroundWorker.RunWorkerAsync(); } + + SelectedMeshGroupIndex = 0; } void createSelectionDataBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index ff96a4a69..3fa8219b1 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -663,8 +663,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow }); } - //upArrow = new UpArrow3D(meshViewerWidget); - //meshViewerWidget.interactionVolumes.Add(upArrow); + upArrow = new UpArrow3D(meshViewerWidget); + meshViewerWidget.interactionVolumes.Add(upArrow); // make sure the colors are set correctl ThemeChanged(this, null); @@ -1290,25 +1290,28 @@ namespace MatterHackers.MatterControl.PartPreviewWindow void SetNewModelSize(double sizeInMm, int axis) { - // because we remove any current scale before we change to a new one we only get the size of the base mesh data - AxisAlignedBoundingBox originalMeshBounds = SelectedMeshGroup.GetAxisAlignedBoundingBox(); + if (HaveSelection) + { + // because we remove any current scale before we change to a new one we only get the size of the base mesh data + AxisAlignedBoundingBox originalMeshBounds = SelectedMeshGroup.GetAxisAlignedBoundingBox(); - double currentSize = originalMeshBounds.Size[axis]; - double desiredSize = sizeDisplay[axis].GetValue(); - double scaleFactor = 1; - if (currentSize != 0) - { - scaleFactor = desiredSize / currentSize; - } + double currentSize = originalMeshBounds.Size[axis]; + double desiredSize = sizeDisplay[axis].GetValue(); + double scaleFactor = 1; + if (currentSize != 0) + { + scaleFactor = desiredSize / currentSize; + } - if (uniformScale.Checked) - { - scaleRatioControl.ActuallNumberEdit.Value = scaleFactor; - ApplyScaleFromEditField(); - } - else - { - ScaleAxis(scaleFactor, axis); + if (uniformScale.Checked) + { + scaleRatioControl.ActuallNumberEdit.Value = scaleFactor; + ApplyScaleFromEditField(); + } + else + { + ScaleAxis(scaleFactor, axis); + } } } @@ -1322,6 +1325,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow sizeDisplay[1].SetDisplayString("{0:0.00}".FormatWith(bounds.Size[1])); sizeDisplay[2].SetDisplayString("{0:0.00}".FormatWith(bounds.Size[2])); } + else + { + sizeDisplay[0].SetDisplayString("---"); + sizeDisplay[1].SetDisplayString("---"); + sizeDisplay[2].SetDisplayString("---"); + } } private void SetApplyScaleVisability(Object sender, EventArgs e) @@ -1464,12 +1473,15 @@ namespace MatterHackers.MatterControl.PartPreviewWindow private void ApplyScaleFromEditField() { - double scale = scaleRatioControl.ActuallNumberEdit.Value; - if (scale > 0) + if (HaveSelection) { - ScaleAxis(scale, 0); - ScaleAxis(scale, 1); - ScaleAxis(scale, 2); + double scale = scaleRatioControl.ActuallNumberEdit.Value; + if (scale > 0) + { + ScaleAxis(scale, 0); + ScaleAxis(scale, 1); + ScaleAxis(scale, 2); + } } } diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index ef06733fb..c00cfdf1f 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -63,7 +63,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public SliceSettingsWidget(SliceSettingsWidgetUiState uiState) { - int minSettingNameWidth = 220; + int minSettingNameWidth = 190; buttonFactory.FixedHeight = 20; buttonFactory.fontSize = 10; buttonFactory.normalFillColor = RGBA_Bytes.White; @@ -524,6 +524,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { int intEditWidth = 60; int doubleEditWidth = 60; + if (settingData.QuickMenuSettings.Count > 0) + { + doubleEditWidth = 35; + } int vectorXYEditWidth = 60; int multiLineEditHeight = 60; @@ -605,7 +609,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration if (settingData.QuickMenuSettings.Count > 0) { - leftToRightLayout.AddChild(CreateQuickMenu(settingData, content)); + leftToRightLayout.AddChild(CreateQuickMenu(settingData, content, doubleEditWidget.ActuallNumberEdit.InternalTextEditWidget)); } else { @@ -661,7 +665,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration if (settingData.QuickMenuSettings.Count > 0) { - leftToRightLayout.AddChild(CreateQuickMenu(settingData, content)); + leftToRightLayout.AddChild(CreateQuickMenu(settingData, content, stringEdit.ActualTextEditWidget.InternalTextEditWidget)); } else { @@ -930,7 +934,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return container; } - private GuiWidget CreateQuickMenu(OrganizerSettingsData settingData, GuiWidget content) + private GuiWidget CreateQuickMenu(OrganizerSettingsData settingData, GuiWidget content, InternalTextEditWidget internalTextWidget) { string sliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(settingData.SlicerConfigName); FlowLayoutWidget totalContent = new FlowLayoutWidget(); @@ -946,28 +950,44 @@ namespace MatterHackers.MatterControl.SlicerConfiguration if (sliceSettingValue == valueLocal) { selectableOptions.SelectedLabel = nameValue.MenuName; - content.Visible = false; } newItem.Selected += (sender, e) => { SaveSetting(settingData.SlicerConfigName, valueLocal); CallEventsOnSettingsChange(settingData); - content.Visible = false; + internalTextWidget.Text = valueLocal; }; } // put in the custom menu to allow direct editing MenuItem customMenueItem = selectableOptions.AddItem("Custom"); - customMenueItem.Selected += (sender, e) => - { - content.Visible = true; - }; totalContent.AddChild(selectableOptions); content.VAnchor = VAnchor.ParentCenter; totalContent.AddChild(content); + internalTextWidget.EditComplete += (sender, e) => + { + bool foundSetting = false; + foreach (QuickMenuNameValue nameValue in settingData.QuickMenuSettings) + { + string localName = nameValue.MenuName; + string newSliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(settingData.SlicerConfigName); + if (newSliceSettingValue == nameValue.Value) + { + selectableOptions.SelectedLabel = localName; + foundSetting = true; + break; + } + } + + if (!foundSetting) + { + selectableOptions.SelectedLabel = "Custom"; + } + }; + return totalContent; } diff --git a/StaticData/SliceSettings/Properties.json b/StaticData/SliceSettings/Properties.json index b4b5b1dec..2e72a429e 100644 --- a/StaticData/SliceSettings/Properties.json +++ b/StaticData/SliceSettings/Properties.json @@ -284,7 +284,7 @@ "PresentationName": "Fill Density", "HelpText": "The ratio of material to empty space ranged 0 to 1. Zero would be no infill; 1 is solid infill.", "DataEditType": "DOUBLE_OR_PERCENT", - "ExtraSettings": "Ratio (0 to 1)", + "ExtraSettings": "Ratio\n(0 to 1)", "QuickMenuSettings": [{"MenuName" : "Light", "Value": "10%"},{"MenuName" : "Standard", "Value": "30%"},{"MenuName" : "Heavy", "Value": "90%"}] }, { @@ -475,7 +475,7 @@ "HelpText": "Sets the height of each layer of the print. A smaller number will create more layers and more vertical accuracy but also a slower print.", "DataEditType": "POSITIVE_DOUBLE", "ExtraSettings": "mm", - "QuickMenuSettings": [{"MenuName" : "Coarse", "Value": ".3"},{"MenuName" : "Standard", "Value": ".2"},{"MenuName" : "Fine", "Value": ".1"}] + "QuickMenuSettings": [{"MenuName" : "Fine", "Value": "0.1"},{"MenuName" : "Standard", "Value": "0.2"},{"MenuName" : "Coarse", "Value": "0.3"}] }, { "SlicerConfigName": "max_fan_speed", From 08a051c6d2a2c5664b3c0486e083ec964953999a Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Tue, 25 Nov 2014 09:58:30 -0800 Subject: [PATCH 05/10] Make sure we don't crash when nothing is selected in any of the edit tools. --- PartPreviewWindow/View3D/View3DWidget.cs | 119 ++++++++++++++--------- 1 file changed, 71 insertions(+), 48 deletions(-) diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index 3fa8219b1..c6412a1c4 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -291,6 +291,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { SelectedMeshGroupIndex = -1; } + + UpdateSizeInfo(); } } } @@ -1597,15 +1599,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow rotateControls.Add(rotateXButton); rotateXButton.Click += (object sender, EventArgs mouseEvent) => { - double radians = MathHelper.DegreesToRadians(degreesControl.ActuallNumberEdit.Value); - // rotate it - ScaleRotateTranslate rotated = SelectedMeshGroupTransform; - rotated.rotation *= Matrix4X4.CreateRotationX(radians); - SelectedMeshGroupTransform = rotated; + if (SelectedMeshGroupIndex != -1) + { + double radians = MathHelper.DegreesToRadians(degreesControl.ActuallNumberEdit.Value); + // rotate it + ScaleRotateTranslate rotated = SelectedMeshGroupTransform; + rotated.rotation *= Matrix4X4.CreateRotationX(radians); + SelectedMeshGroupTransform = rotated; - PlatingHelper.PlaceMeshGroupOnBed(MeshGroups, MeshGroupTransforms, SelectedMeshGroupIndex, false); - saveButtons.Visible = true; - Invalidate(); + PlatingHelper.PlaceMeshGroupOnBed(MeshGroups, MeshGroupTransforms, SelectedMeshGroupIndex, false); + saveButtons.Visible = true; + Invalidate(); + } }; Button rotateYButton = textImageButtonFactory.Generate("", "icon_rotate_32x32.png"); @@ -1614,14 +1619,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow rotateControls.Add(rotateYButton); rotateYButton.Click += (object sender, EventArgs mouseEvent) => { - double radians = MathHelper.DegreesToRadians(degreesControl.ActuallNumberEdit.Value); - // rotate it - ScaleRotateTranslate rotated = SelectedMeshGroupTransform; - rotated.rotation *= Matrix4X4.CreateRotationY(radians); - SelectedMeshGroupTransform = rotated; - PlatingHelper.PlaceMeshGroupOnBed(MeshGroups, MeshGroupTransforms, SelectedMeshGroupIndex, false); - saveButtons.Visible = true; - Invalidate(); + if (SelectedMeshGroupIndex != -1) + { + double radians = MathHelper.DegreesToRadians(degreesControl.ActuallNumberEdit.Value); + // rotate it + ScaleRotateTranslate rotated = SelectedMeshGroupTransform; + rotated.rotation *= Matrix4X4.CreateRotationY(radians); + SelectedMeshGroupTransform = rotated; + PlatingHelper.PlaceMeshGroupOnBed(MeshGroups, MeshGroupTransforms, SelectedMeshGroupIndex, false); + saveButtons.Visible = true; + Invalidate(); + } }; Button rotateZButton = textImageButtonFactory.Generate("", "icon_rotate_32x32.png"); @@ -1630,15 +1638,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow rotateControls.Add(rotateZButton); rotateZButton.Click += (object sender, EventArgs mouseEvent) => { - double radians = MathHelper.DegreesToRadians(degreesControl.ActuallNumberEdit.Value); - // rotate it - ScaleRotateTranslate rotated = SelectedMeshGroupTransform; - rotated.rotation *= Matrix4X4.CreateRotationZ(radians); - SelectedMeshGroupTransform = rotated; + if (SelectedMeshGroupIndex != -1) + { + double radians = MathHelper.DegreesToRadians(degreesControl.ActuallNumberEdit.Value); + // rotate it + ScaleRotateTranslate rotated = SelectedMeshGroupTransform; + rotated.rotation *= Matrix4X4.CreateRotationZ(radians); + SelectedMeshGroupTransform = rotated; - PlatingHelper.PlaceMeshGroupOnBed(MeshGroups, MeshGroupTransforms, SelectedMeshGroupIndex, false); - saveButtons.Visible = true; - Invalidate(); + PlatingHelper.PlaceMeshGroupOnBed(MeshGroups, MeshGroupTransforms, SelectedMeshGroupIndex, false); + saveButtons.Visible = true; + Invalidate(); + } }; buttonPanel.AddChild(rotateButtonContainer); @@ -1649,10 +1660,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow layFlatButton.Click += (object sender, EventArgs mouseEvent) => { - MakeLowestFaceFlat(SelectedMeshGroupIndex); + if (SelectedMeshGroupIndex != -1) + { + MakeLowestFaceFlat(SelectedMeshGroupIndex); - saveButtons.Visible = true; - Invalidate(); + saveButtons.Visible = true; + Invalidate(); + } }; buttonPanel.AddChild(generateHorizontalRule()); @@ -1674,16 +1688,19 @@ namespace MatterHackers.MatterControl.PartPreviewWindow mirrorControls.Add(mirrorXButton); mirrorXButton.Click += (object sender, EventArgs mouseEvent) => { - SelectedMeshGroup.ReverseFaceEdges(); + if (SelectedMeshGroupIndex != -1) + { + SelectedMeshGroup.ReverseFaceEdges(); - ScaleRotateTranslate scale = SelectedMeshGroupTransform; - scale.scale *= Matrix4X4.CreateScale(-1, 1, 1); - SelectedMeshGroupTransform = scale; + ScaleRotateTranslate scale = SelectedMeshGroupTransform; + scale.scale *= Matrix4X4.CreateScale(-1, 1, 1); + SelectedMeshGroupTransform = scale; - PlatingHelper.PlaceMeshGroupOnBed(MeshGroups, MeshGroupTransforms, SelectedMeshGroupIndex, false); + PlatingHelper.PlaceMeshGroupOnBed(MeshGroups, MeshGroupTransforms, SelectedMeshGroupIndex, false); - saveButtons.Visible = true; - Invalidate(); + saveButtons.Visible = true; + Invalidate(); + } }; Button mirrorYButton = textImageButtonFactory.Generate("Y", centerText: true); @@ -1691,16 +1708,19 @@ namespace MatterHackers.MatterControl.PartPreviewWindow mirrorControls.Add(mirrorYButton); mirrorYButton.Click += (object sender, EventArgs mouseEvent) => { - SelectedMeshGroup.ReverseFaceEdges(); + if (SelectedMeshGroupIndex != -1) + { + SelectedMeshGroup.ReverseFaceEdges(); - ScaleRotateTranslate scale = SelectedMeshGroupTransform; - scale.scale *= Matrix4X4.CreateScale(1, -1, 1); - SelectedMeshGroupTransform = scale; + ScaleRotateTranslate scale = SelectedMeshGroupTransform; + scale.scale *= Matrix4X4.CreateScale(1, -1, 1); + SelectedMeshGroupTransform = scale; - PlatingHelper.PlaceMeshGroupOnBed(MeshGroups, MeshGroupTransforms, SelectedMeshGroupIndex, false); + PlatingHelper.PlaceMeshGroupOnBed(MeshGroups, MeshGroupTransforms, SelectedMeshGroupIndex, false); - saveButtons.Visible = true; - Invalidate(); + saveButtons.Visible = true; + Invalidate(); + } }; Button mirrorZButton = textImageButtonFactory.Generate("Z", centerText: true); @@ -1708,16 +1728,19 @@ namespace MatterHackers.MatterControl.PartPreviewWindow mirrorControls.Add(mirrorZButton); mirrorZButton.Click += (object sender, EventArgs mouseEvent) => { - SelectedMeshGroup.ReverseFaceEdges(); + if (SelectedMeshGroupIndex != -1) + { + SelectedMeshGroup.ReverseFaceEdges(); - ScaleRotateTranslate scale = SelectedMeshGroupTransform; - scale.scale *= Matrix4X4.CreateScale(1, 1, -1); - SelectedMeshGroupTransform = scale; + ScaleRotateTranslate scale = SelectedMeshGroupTransform; + scale.scale *= Matrix4X4.CreateScale(1, 1, -1); + SelectedMeshGroupTransform = scale; - PlatingHelper.PlaceMeshGroupOnBed(MeshGroups, MeshGroupTransforms, SelectedMeshGroupIndex, false); + PlatingHelper.PlaceMeshGroupOnBed(MeshGroups, MeshGroupTransforms, SelectedMeshGroupIndex, false); - saveButtons.Visible = true; - Invalidate(); + saveButtons.Visible = true; + Invalidate(); + } }; buttonPanel.AddChild(buttonContainer); buttonPanel.AddChild(generateHorizontalRule()); From abc6305702fe817e6242b847bdb97a3029c42cbb Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Tue, 25 Nov 2014 11:42:22 -0800 Subject: [PATCH 06/10] more work on interaction volumes --- PartPreviewWindow/View3D/View3DWidget.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index c6412a1c4..b71569756 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -73,6 +73,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow } } + public override void OnMouseDown(MouseEvent3DArgs mouseEvent3D) + { + base.OnMouseDown(mouseEvent3D); + } + + public override void OnMouseMove(MouseEvent3DArgs mouseEvent3D) + { + base.OnMouseMove(mouseEvent3D); + } + public void SetPosition() { Matrix4X4 transform = MeshViewerToDrawWith.SelectedMeshGroupTransform.TotalTransform; From e1fc6838a3abf377a8804c5dfe1ea27451ff3a0d Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Tue, 25 Nov 2014 12:19:37 -0800 Subject: [PATCH 07/10] Upgrading to .net 4.5. --- .gitignore | 2 ++ App.config | 6 +++--- .../Community.CsharpSqlite.csproj | 14 ++++++++++++++ Community.CsharpSqlite/app.config | 2 +- .../ApplicationSettings/ApplicationSettingsView.cs | 1 - ConfigurationPage/PrinterConfigurationPage.cs | 10 ---------- CustomWidgets/AltGroupBox.cs | 1 - CustomWidgets/PartThumbnailWidget.cs | 2 +- Launcher/Launcher.csproj | 11 +++++++++++ MatterControl.csproj | 5 +++++ MatterControlApplication.cs | 1 - PartPreviewWindow/View3D/View3DAlign.cs | 1 - PartPreviewWindow/View3D/View3DWidget.cs | 1 - PluginSystem/MatterControlPluginSystem.csproj | 10 ++++++++++ PrintHistory/PrintHistoryWidget.cs | 1 - PrintLibrary/LibraryDataView.cs | 1 - PrintQueue/QueueDataWidget.cs | 1 - .../PrinterConnections/ChooseConnectionWidget.cs | 2 -- PrinterDriverInstaller/InfInstaller.csproj | 13 +++++++++++++ .../SlicePresetsWindow/SlicePresetDetailWidget.cs | 6 +----- .../SlicePresetsWindow/SlicePresetListWidget.cs | 2 +- SlicerConfiguration/SliceSettingsWidget.cs | 2 +- 22 files changed, 63 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index 516dc9143..4a0850308 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,5 @@ _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML MatterControl.userprefs +Launcher/app.config +PrinterDriverInstaller/app.config diff --git a/App.config b/App.config index ebd31843c..287959adb 100644 --- a/App.config +++ b/App.config @@ -1,9 +1,9 @@ - + - + - \ No newline at end of file + diff --git a/Community.CsharpSqlite/Community.CsharpSqlite.csproj b/Community.CsharpSqlite/Community.CsharpSqlite.csproj index 6e5052ed7..656579c7b 100644 --- a/Community.CsharpSqlite/Community.CsharpSqlite.csproj +++ b/Community.CsharpSqlite/Community.CsharpSqlite.csproj @@ -31,6 +31,8 @@ false true 1.1.4 + v4.5 + True @@ -42,6 +44,7 @@ 4 AllRules.ruleset x86 + false True @@ -51,6 +54,7 @@ 4 AllRules.ruleset x86 + false True @@ -62,6 +66,7 @@ AllRules.ruleset 4 False + false bin\x86\Release\ @@ -71,6 +76,7 @@ prompt AllRules.ruleset 4 + false bin\Release64\ @@ -86,6 +92,7 @@ false ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules 4 + false bin\x86\Release64\ @@ -103,6 +110,7 @@ false false 4 + false true @@ -117,6 +125,7 @@ false 4 false + false true @@ -131,6 +140,7 @@ false 4 false + false true @@ -144,6 +154,7 @@ false 4 false + false bin\x64\Release\ @@ -155,6 +166,7 @@ false false 4 + false bin\x64\Release64\ @@ -171,6 +183,7 @@ ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules false 4 + false true @@ -184,6 +197,7 @@ false 4 false + false diff --git a/Community.CsharpSqlite/app.config b/Community.CsharpSqlite/app.config index 0df7832f9..a80813afe 100644 --- a/Community.CsharpSqlite/app.config +++ b/Community.CsharpSqlite/app.config @@ -1,3 +1,3 @@ - + diff --git a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs index 1f698adcb..f58f2eac9 100644 --- a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs +++ b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs @@ -20,7 +20,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage { Button languageRestartButton; Button configureUpdateFeedButton; - Button configureLanguageButton; Button displayControlRestartButton; public ApplicationSettingsWidget() diff --git a/ConfigurationPage/PrinterConfigurationPage.cs b/ConfigurationPage/PrinterConfigurationPage.cs index a2746f9c7..5675dbef8 100644 --- a/ConfigurationPage/PrinterConfigurationPage.cs +++ b/ConfigurationPage/PrinterConfigurationPage.cs @@ -64,7 +64,6 @@ namespace MatterHackers.MatterControl Button disablePrintLevelingButton; DisableableWidget eePromControlsContainer; - DisableableWidget terminalCommunicationsContainer; DisableableWidget printLevelingContainer; @@ -135,8 +134,6 @@ namespace MatterHackers.MatterControl controlsTopToBottomLayout.AddChild(container); } - Button restartButton; - private void RestartApplication() { UiThread.RunOnIdle((state) => @@ -159,7 +156,6 @@ namespace MatterHackers.MatterControl if (languageCode != UserSettings.Instance.get("Language")) { UserSettings.Instance.set("Language", languageCode); - restartButton.Visible = true; } } @@ -459,7 +455,6 @@ namespace MatterHackers.MatterControl { // no printer selected eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); //cloudMonitorContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); } @@ -475,20 +470,17 @@ namespace MatterHackers.MatterControl case PrinterConnectionAndCommunication.CommunicationStates.FailedToConnect: eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); - terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); break; case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint: case PrinterConnectionAndCommunication.CommunicationStates.Connected: eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); - terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); break; case PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd: eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); break; case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint: @@ -503,7 +495,6 @@ namespace MatterHackers.MatterControl case PrinterConnectionAndCommunication.DetailedPrintingState.Printing: eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); break; default: @@ -514,7 +505,6 @@ namespace MatterHackers.MatterControl case PrinterConnectionAndCommunication.CommunicationStates.Paused: eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); break; default: diff --git a/CustomWidgets/AltGroupBox.cs b/CustomWidgets/AltGroupBox.cs index f9e2fe8e1..34758e427 100644 --- a/CustomWidgets/AltGroupBox.cs +++ b/CustomWidgets/AltGroupBox.cs @@ -13,7 +13,6 @@ namespace MatterHackers.MatterControl public class AltGroupBox : FlowLayoutWidget { GuiWidget groupBoxLabel; - double lineInset = 8.5; RGBA_Bytes borderColor = RGBA_Bytes.Black; GuiWidget clientArea; diff --git a/CustomWidgets/PartThumbnailWidget.cs b/CustomWidgets/PartThumbnailWidget.cs index 2c612f32b..7c9b1b2d6 100644 --- a/CustomWidgets/PartThumbnailWidget.cs +++ b/CustomWidgets/PartThumbnailWidget.cs @@ -75,7 +75,7 @@ namespace MatterHackers.MatterControl ImageBuffer thumbnailImage = new Agg.Image.ImageBuffer(); // all the color stuff - public double BorderWidth = 0; //Don't delete this - required for OnDraw + new public double BorderWidth = 0; //Don't delete this - required for OnDraw protected double borderRadius = 0; protected RGBA_Bytes HoverBorderColor = new RGBA_Bytes(); diff --git a/Launcher/Launcher.csproj b/Launcher/Launcher.csproj index b20a2a243..70d1eb78f 100644 --- a/Launcher/Launcher.csproj +++ b/Launcher/Launcher.csproj @@ -17,6 +17,8 @@ 2.0 0.8.2 + v4.5 + True @@ -28,6 +30,7 @@ 4 True x86 + false pdbonly @@ -37,6 +40,7 @@ 4 True x86 + false bin\Release64\ @@ -55,6 +59,7 @@ ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules false false + false true @@ -67,6 +72,7 @@ false false false + false true @@ -78,6 +84,7 @@ prompt false false + false bin\x64\Release\ @@ -89,6 +96,7 @@ prompt false false + false bin\x64\Release64\ @@ -106,6 +114,7 @@ false ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules false + false true @@ -117,11 +126,13 @@ prompt false false + false + diff --git a/MatterControl.csproj b/MatterControl.csproj index 0120a1213..feb051f1c 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -38,6 +38,8 @@ true 8.0.30703 2.0 + v4.5 + True @@ -49,6 +51,7 @@ 4 x86 SHOW_MEMORY + false none @@ -59,6 +62,7 @@ 4 x86 true + false application.ico @@ -78,6 +82,7 @@ false ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules 4 + false diff --git a/MatterControlApplication.cs b/MatterControlApplication.cs index 1d12fd2bb..abc23bef8 100644 --- a/MatterControlApplication.cs +++ b/MatterControlApplication.cs @@ -387,7 +387,6 @@ namespace MatterHackers.MatterControl } } - bool cancelClose; void onConfirmExit(bool messageBoxResponse) { bool CancelClose; diff --git a/PartPreviewWindow/View3D/View3DAlign.cs b/PartPreviewWindow/View3D/View3DAlign.cs index d661b9601..23b001ecc 100644 --- a/PartPreviewWindow/View3D/View3DAlign.cs +++ b/PartPreviewWindow/View3D/View3DAlign.cs @@ -35,7 +35,6 @@ using MatterHackers.Localizations; using MatterHackers.MeshVisualizer; using MatterHackers.VectorMath; using MatterHackers.PolygonMesh; -using MatterHackers.MeshVisualizer; namespace MatterHackers.MatterControl.PartPreviewWindow { diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index b71569756..859e0541b 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -1831,7 +1831,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow } } - int nextColor = 0; RGBA_Bytes[] SelectionColors = new RGBA_Bytes[] { new RGBA_Bytes(131, 4, 66), new RGBA_Bytes(227, 31, 61), new RGBA_Bytes(255, 148, 1), new RGBA_Bytes(247, 224, 23), new RGBA_Bytes(143, 212, 1) }; private void AddHandlers() diff --git a/PluginSystem/MatterControlPluginSystem.csproj b/PluginSystem/MatterControlPluginSystem.csproj index a4eb9d3d2..4ec25232b 100644 --- a/PluginSystem/MatterControlPluginSystem.csproj +++ b/PluginSystem/MatterControlPluginSystem.csproj @@ -16,6 +16,8 @@ 2.0 1.1.4 + v4.5 + True @@ -27,6 +29,7 @@ 4 True x86 + false pdbonly @@ -37,6 +40,7 @@ 4 True x86 + false bin\Release64\ @@ -56,6 +60,7 @@ false false 4 + false true @@ -69,6 +74,7 @@ false 4 false + false true @@ -82,6 +88,7 @@ false 4 false + false bin\x64\Release\ @@ -94,6 +101,7 @@ false false 4 + false bin\x64\Release64\ @@ -111,6 +119,7 @@ false ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules 4 + false true @@ -125,6 +134,7 @@ false 4 false + false diff --git a/PrintHistory/PrintHistoryWidget.cs b/PrintHistory/PrintHistoryWidget.cs index 3dc79c553..880db8610 100644 --- a/PrintHistory/PrintHistoryWidget.cs +++ b/PrintHistory/PrintHistoryWidget.cs @@ -51,7 +51,6 @@ namespace MatterHackers.MatterControl.PrintHistory public class PrintHistoryWidget : GuiWidget { TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory(); - Button deleteFromLibraryButton; CheckBox showOnlyCompletedCheckbox; CheckBox showTimestampCheckbox; PrintHistoryDataView historyView; diff --git a/PrintLibrary/LibraryDataView.cs b/PrintLibrary/LibraryDataView.cs index 424320d7d..ab89b4fcb 100644 --- a/PrintLibrary/LibraryDataView.cs +++ b/PrintLibrary/LibraryDataView.cs @@ -123,7 +123,6 @@ namespace MatterHackers.MatterControl.PrintLibrary public SelectedListItems SelectedItems = new SelectedListItems(); int selectedIndex = -1; int hoverIndex = -1; - int dragIndex = -1; int Count { diff --git a/PrintQueue/QueueDataWidget.cs b/PrintQueue/QueueDataWidget.cs index 768e2b5e6..6a53e99c4 100644 --- a/PrintQueue/QueueDataWidget.cs +++ b/PrintQueue/QueueDataWidget.cs @@ -56,7 +56,6 @@ namespace MatterHackers.MatterControl.PrintQueue Button removeItemButton; Button enterEditModeButton; Button leaveEditModeButton; - QueueRowItem queueRowItem; Button addToQueueButton; Button createButton; diff --git a/PrinterControls/PrinterConnections/ChooseConnectionWidget.cs b/PrinterControls/PrinterConnections/ChooseConnectionWidget.cs index b056c22c9..3c4939d21 100644 --- a/PrinterControls/PrinterConnections/ChooseConnectionWidget.cs +++ b/PrinterControls/PrinterConnections/ChooseConnectionWidget.cs @@ -44,8 +44,6 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory(); TextImageButtonFactory editButtonFactory = new TextImageButtonFactory(); Button closeButton; - Button enterEditModeButton; - Button leaveEditModeButton; bool editMode; diff --git a/PrinterDriverInstaller/InfInstaller.csproj b/PrinterDriverInstaller/InfInstaller.csproj index 64a0b0ccc..4d82e6582 100644 --- a/PrinterDriverInstaller/InfInstaller.csproj +++ b/PrinterDriverInstaller/InfInstaller.csproj @@ -17,6 +17,8 @@ 2.0 1.1.4 + v4.5 + True @@ -28,6 +30,7 @@ 4 True x86 + false pdbonly @@ -37,6 +40,7 @@ 4 True x86 + false bin\Release64\ @@ -55,6 +59,7 @@ ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules false 4 + false true @@ -68,6 +73,7 @@ false 4 false + false true @@ -81,6 +87,7 @@ false 4 false + false bin\x64\Release\ @@ -93,6 +100,7 @@ false false 4 + false bin\x64\Release64\ @@ -110,6 +118,7 @@ false ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules 4 + false true @@ -123,6 +132,7 @@ false 4 false + false @@ -160,5 +170,8 @@ + + + \ No newline at end of file diff --git a/SlicerConfiguration/SlicePresetsWindow/SlicePresetDetailWidget.cs b/SlicerConfiguration/SlicePresetsWindow/SlicePresetDetailWidget.cs index 9ce8db97a..67305e4a7 100644 --- a/SlicerConfiguration/SlicePresetsWindow/SlicePresetDetailWidget.cs +++ b/SlicerConfiguration/SlicePresetsWindow/SlicePresetDetailWidget.cs @@ -429,7 +429,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration this.windowController.ActivePresetLayer.settingsDictionary[addRowSettingData.SlicerConfigName] = sliceSetting; OnSettingsChanged(); - HasUncommittedChanges = true; } addRowSettingData = null; PopulateAddSettingRow(-1, -1, "-1"); @@ -475,7 +474,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration }); } - bool HasUncommittedChanges; public RootedObjectEventHandler CommitStatusChanged = new RootedObjectEventHandler(); public RootedObjectEventHandler SettingsChanged = new RootedObjectEventHandler(); @@ -487,7 +485,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration this.windowController.ActivePresetLayer.settingsDictionary[keyName].Value = keyValue; OnSettingsChanged(); - HasUncommittedChanges = true; } else { @@ -499,7 +496,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration this.windowController.ActivePresetLayer.settingsDictionary[keyName] = sliceSetting; OnSettingsChanged(); - HasUncommittedChanges = true; } } @@ -927,7 +923,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration LoadSettingsRows(); } } - catch (Exception e) + catch (Exception) { // Error loading configuration } diff --git a/SlicerConfiguration/SlicePresetsWindow/SlicePresetListWidget.cs b/SlicerConfiguration/SlicePresetsWindow/SlicePresetListWidget.cs index bf93ae81e..cad7be9e9 100644 --- a/SlicerConfiguration/SlicePresetsWindow/SlicePresetListWidget.cs +++ b/SlicerConfiguration/SlicePresetsWindow/SlicePresetListWidget.cs @@ -207,7 +207,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration windowController.ChangeToSlicePresetList(); } } - catch (Exception e) + catch (Exception) { // Error loading configuration } diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index c00cfdf1f..528cd9f3a 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -200,7 +200,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration } return "Minimal"; - return "Beginner"; + //return "Beginner"; } } From c4290f0a3ee51192feaa86f92f5b3da54a3e5ceb Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Tue, 25 Nov 2014 14:14:37 -0800 Subject: [PATCH 08/10] Took out some dead code. Fixed the printer looses temp after starting a print. --- ConfigurationPage/PrinterConfigurationPage.cs | 68 +------------------ .../PrinterConnectionAndCommunication.cs | 1 + 2 files changed, 2 insertions(+), 67 deletions(-) diff --git a/ConfigurationPage/PrinterConfigurationPage.cs b/ConfigurationPage/PrinterConfigurationPage.cs index 5675dbef8..e9df4d432 100644 --- a/ConfigurationPage/PrinterConfigurationPage.cs +++ b/ConfigurationPage/PrinterConfigurationPage.cs @@ -446,73 +446,8 @@ namespace MatterHackers.MatterControl this.textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; this.linkButtonFactory.fontSize = 11; - } + } - private void SetVisibleControls() - { - return; - if (ActivePrinterProfile.Instance.ActivePrinter == null) - { - // no printer selected - eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - //cloudMonitorContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - } - else // we at least have a printer selected - { - //cloudMonitorContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); - switch (PrinterConnectionAndCommunication.Instance.CommunicationState) - { - case PrinterConnectionAndCommunication.CommunicationStates.Disconnecting: - case PrinterConnectionAndCommunication.CommunicationStates.ConnectionLost: - case PrinterConnectionAndCommunication.CommunicationStates.Disconnected: - case PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect: - case PrinterConnectionAndCommunication.CommunicationStates.FailedToConnect: - eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); - break; - - case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint: - case PrinterConnectionAndCommunication.CommunicationStates.Connected: - eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); - printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); - break; - - case PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd: - eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - break; - - case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint: - case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrintToSd: - case PrinterConnectionAndCommunication.CommunicationStates.PrintingToSd: - case PrinterConnectionAndCommunication.CommunicationStates.Printing: - switch (PrinterConnectionAndCommunication.Instance.PrintingState) - { - case PrinterConnectionAndCommunication.DetailedPrintingState.HomingAxis: - case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingBed: - case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingExtruder: - case PrinterConnectionAndCommunication.DetailedPrintingState.Printing: - eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - break; - - default: - throw new NotImplementedException(); - } - break; - - case PrinterConnectionAndCommunication.CommunicationStates.Paused: - eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); - printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - break; - - default: - throw new NotImplementedException(); - } - } - } - event EventHandler unregisterEvents; private void AddHandlers() { @@ -522,7 +457,6 @@ namespace MatterHackers.MatterControl private void onPrinterStatusChanged(object sender, EventArgs e) { - SetVisibleControls(); this.Invalidate(); } diff --git a/PrinterCommunication/PrinterConnectionAndCommunication.cs b/PrinterCommunication/PrinterConnectionAndCommunication.cs index 989b16747..f1f56a41a 100644 --- a/PrinterCommunication/PrinterConnectionAndCommunication.cs +++ b/PrinterCommunication/PrinterConnectionAndCommunication.cs @@ -2405,6 +2405,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication ExtrusionRatio = 1; FeedRateRatio = 1; + LinesToWriteQueue.Clear(); ClearQueuedGCode(); loadedGCode = GCodeFile.ParseGCodeString(string.Join("\n", printableGCode.ToArray())); From 56191e3d34ece94710d33077265b36c2ddd8a08f Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Tue, 25 Nov 2014 15:58:37 -0800 Subject: [PATCH 09/10] Guard against bad eeprom return values. --- EeProm/EePromRepetierParameter.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/EeProm/EePromRepetierParameter.cs b/EeProm/EePromRepetierParameter.cs index 333906829..b73f79bad 100644 --- a/EeProm/EePromRepetierParameter.cs +++ b/EeProm/EePromRepetierParameter.cs @@ -50,12 +50,18 @@ namespace MatterHackers.MatterControl.EeProm public void update(string line) { - string[] lines = line.Substring(4).Split(' '); - int.TryParse(lines[0], out type); - int.TryParse(lines[1], out position); - val = lines[2]; - description = line.Substring(7 + lines[0].Length + lines[1].Length + lines[2].Length); - changed = false; + if (line.Length > 4) + { + string[] lines = line.Substring(4).Split(' '); + if (lines.Length > 2) + { + int.TryParse(lines[0], out type); + int.TryParse(lines[1], out position); + val = lines[2]; + description = line.Substring(7 + lines[0].Length + lines[1].Length + lines[2].Length); + changed = false; + } + } } public void save() From 0aacb8b71dc1d68fc2f93ddfa0dde6a05d616696 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Tue, 25 Nov 2014 16:09:46 -0800 Subject: [PATCH 10/10] We need the app.config s --- .gitignore | 2 -- Launcher/app.config | 3 +++ PrinterDriverInstaller/app.config | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 Launcher/app.config create mode 100644 PrinterDriverInstaller/app.config diff --git a/.gitignore b/.gitignore index 4a0850308..516dc9143 100644 --- a/.gitignore +++ b/.gitignore @@ -107,5 +107,3 @@ _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML MatterControl.userprefs -Launcher/app.config -PrinterDriverInstaller/app.config diff --git a/Launcher/app.config b/Launcher/app.config new file mode 100644 index 000000000..51278a456 --- /dev/null +++ b/Launcher/app.config @@ -0,0 +1,3 @@ + + + diff --git a/PrinterDriverInstaller/app.config b/PrinterDriverInstaller/app.config new file mode 100644 index 000000000..51278a456 --- /dev/null +++ b/PrinterDriverInstaller/app.config @@ -0,0 +1,3 @@ + + +