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..e9df4d432 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; } } @@ -450,79 +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); - terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); - 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); - 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: - 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); - terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); - break; - - default: - throw new NotImplementedException(); - } - break; - - case PrinterConnectionAndCommunication.CommunicationStates.Paused: - eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); - printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled); - terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled); - break; - - default: - throw new NotImplementedException(); - } - } - } - event EventHandler unregisterEvents; private void AddHandlers() { @@ -532,7 +457,6 @@ namespace MatterHackers.MatterControl private void onPrinterStatusChanged(object sender, EventArgs e) { - SetVisibleControls(); this.Invalidate(); } 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/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() 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/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/MatterControl.csproj b/MatterControl.csproj index 54dc199bf..6c75af402 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -36,6 +36,10 @@ 1.0.0.%2a false true + 8.0.30703 + 2.0 + v4.5 + True @@ -47,6 +51,7 @@ 4 x86 SHOW_MEMORY + false none @@ -57,6 +62,7 @@ 4 x86 true + false application.ico @@ -76,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/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/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/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 67d7a982d..8a4995f94 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -60,36 +60,64 @@ 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]; + if (File.Exists(arrowFile)) + { + List loadedMeshGroups = MeshFileIo.Load(arrowFile); + upArrow = loadedMeshGroups[0].Meshes[0]; + //CollisionVolume = PlatingHelper.CreateTraceDataForMesh(upArrow); + } + } + + 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; + 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) + 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); + if (MouseOver) + { + RenderMeshToGl.Render(upArrow, RGBA_Bytes.Red, RenderTypes.Shaded); + } + else + { + RenderMeshToGl.Render(upArrow, RGBA_Bytes.Black, RenderTypes.Shaded); + } GL.PopMatrix(); } @@ -103,6 +131,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow public WindowType windowType { get; set; } EventHandler SelectionChanged; + UpArrow3D upArrow; FlowLayoutWidget viewOptionContainer; FlowLayoutWidget rotateOptionContainer; @@ -250,25 +279,30 @@ 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; + } + + UpdateSizeInfo(); } } } @@ -276,6 +310,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow public override void OnDraw(Graphics2D graphics2D) { + if (HaveSelection) + { + upArrow.SetPosition(); + } + hasDrawn = true; base.OnDraw(graphics2D); DrawStuffForSelectedPart(graphics2D); @@ -636,13 +675,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) { @@ -1289,25 +1329,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); + } } } @@ -1321,6 +1364,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) @@ -1463,12 +1512,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); + } } } @@ -1584,15 +1636,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"); @@ -1601,14 +1656,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"); @@ -1617,15 +1675,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); @@ -1636,10 +1697,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()); @@ -1661,16 +1725,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); @@ -1678,16 +1745,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); @@ -1695,16 +1765,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()); @@ -1785,7 +1858,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/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())); 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/PrinterDriverInstaller/app.config b/PrinterDriverInstaller/app.config new file mode 100644 index 000000000..51278a456 --- /dev/null +++ b/PrinterDriverInstaller/app.config @@ -0,0 +1,3 @@ + + + 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 ef06733fb..528cd9f3a 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; @@ -200,7 +200,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration } return "Minimal"; - return "Beginner"; + //return "Beginner"; } } @@ -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",