diff --git a/MatterControlLib/CustomWidgets/LibrarySelector/FolderBreadCrumbWidget.cs b/MatterControlLib/CustomWidgets/LibrarySelector/FolderBreadCrumbWidget.cs index de463c708..4846b36fe 100644 --- a/MatterControlLib/CustomWidgets/LibrarySelector/FolderBreadCrumbWidget.cs +++ b/MatterControlLib/CustomWidgets/LibrarySelector/FolderBreadCrumbWidget.cs @@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl.CustomWidgets { this.CloseChildren(); - var upbutton = new IconButton(StaticData.Instance.LoadIcon(Path.Combine("Library", "upfolder_20.png"), 20, 20, theme.InvertIcons), theme) + var upbutton = new IconButton(StaticData.Instance.LoadIcon(Path.Combine("Library", "back.png"), 20, 20, theme.InvertIcons), theme) { VAnchor = VAnchor.Fit | VAnchor.Center, Enabled = currentContainer.Parent != null, diff --git a/MatterControlLib/DesignTools/Operations/AlignObject3D.cs b/MatterControlLib/DesignTools/Operations/AlignObject3D.cs index 057d39e28..d5e6d123e 100644 --- a/MatterControlLib/DesignTools/Operations/AlignObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/AlignObject3D.cs @@ -175,6 +175,10 @@ namespace MatterHackers.MatterControl.DesignTools.Operations public bool Advanced { get; set; } = false; + [ReadOnly(true)] + [DisplayName("")] // clear the display name so this text will be the full width of the editor + public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more align options."; + [SectionStart("X Axis"), DisplayName("Align")] [EnumDisplay(IconPaths = new string[] { "424.png", "align_left.png", "align_center_x.png", "align_right.png", "align_origin.png" }, InvertIcons = true)] public Align XAlign { get; set; } = Align.None; @@ -401,6 +405,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations change.SetRowVisible(nameof(YOffset), () => Advanced); change.SetRowVisible(nameof(ZAlignTo), () => Advanced); change.SetRowVisible(nameof(ZOffset), () => Advanced); + change.SetRowVisible(nameof(EasyModeMessage), () => !Advanced); } private static bool IsSet(FaceAlign variableToCheck, FaceAlign faceToCheckFor, FaceAlign faceToAssertNot) diff --git a/MatterControlLib/DesignTools/Operations/ScaleObject3D_2.cs b/MatterControlLib/DesignTools/Operations/ScaleObject3D_2.cs index e3e9cb038..797a3a60f 100644 --- a/MatterControlLib/DesignTools/Operations/ScaleObject3D_2.cs +++ b/MatterControlLib/DesignTools/Operations/ScaleObject3D_2.cs @@ -205,7 +205,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations } } - public bool ScaleLocked => LockProportions && ScaleType == ScaleTypes.Custom; + public bool ScaleLocked => LockProportions; private void FixIfLockedProportions(int index, double newScale) { @@ -214,8 +214,11 @@ namespace MatterHackers.MatterControl.DesignTools.Operations ScaleRatio[index] = newScale; if (ScaleType != ScaleTypes.Custom) { - ScaleType = ScaleTypes.Custom; - Invalidate(new InvalidateArgs(null, InvalidateType.DisplayValues)); + // WIP: switch back to custom scaling (as we are no longer on a fixed scaling) + // needs to: + // - create an undo point for the switch + // - update the properties control to show the right drop down + // - show all the settings } if (LockProportions) @@ -224,6 +227,8 @@ namespace MatterHackers.MatterControl.DesignTools.Operations ScaleRatio[(index + 2) % 3] = ScaleRatio[index]; Invalidate(new InvalidateArgs(null, InvalidateType.DisplayValues)); } + + Rebuild(); } } @@ -299,11 +304,13 @@ namespace MatterHackers.MatterControl.DesignTools.Operations case ScaleTypes.Ultrafuse_316L: ScaleRatio = new Vector3(1.1982, 1.1982, 1.261); Rebuild(); + Invalidate(new InvalidateArgs(null, InvalidateType.DisplayValues)); return; } ScaleRatio = new Vector3(scale, scale, scale); Rebuild(); + Invalidate(new InvalidateArgs(null, InvalidateType.DisplayValues)); } else if (change.Changed == nameof(LockProportions)) { diff --git a/MatterControlLib/DesignTools/Operations/TwistObject3D.cs b/MatterControlLib/DesignTools/Operations/TwistObject3D.cs index 774095017..2393371a1 100644 --- a/MatterControlLib/DesignTools/Operations/TwistObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/TwistObject3D.cs @@ -92,6 +92,7 @@ namespace MatterHackers.MatterControl.DesignTools public bool Advanced { get; set; } = false; [ReadOnly(true)] + [DisplayName("")] // clear the display name so this text will be the full width of the editor public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more twist options."; [Description("Allows for the repositioning of the rotation origin")] diff --git a/MatterControlLib/DesignTools/Primitives/CylinderObject3D.cs b/MatterControlLib/DesignTools/Primitives/CylinderObject3D.cs index aa192f5d1..c915e3c70 100644 --- a/MatterControlLib/DesignTools/Primitives/CylinderObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/CylinderObject3D.cs @@ -130,6 +130,10 @@ namespace MatterHackers.MatterControl.DesignTools public bool Advanced { get; set; } = false; + [ReadOnly(true)] + [DisplayName("")] // clear the display name so this text will be the full width of the editor + public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more cylinder options."; + [MaxDecimalPlaces(2)] public double StartingAngle { get; set; } = 0; @@ -215,6 +219,8 @@ namespace MatterHackers.MatterControl.DesignTools { endingAngleWidget.Visible = Advanced; } + + change.SetRowVisible(nameof(EasyModeMessage), () => !Advanced); } public void AddObject3DControls(Object3DControlsLayer object3DControlsLayer) diff --git a/MatterControlLib/DesignTools/Primitives/RingObject3D.cs b/MatterControlLib/DesignTools/Primitives/RingObject3D.cs index faa245384..530373d9d 100644 --- a/MatterControlLib/DesignTools/Primitives/RingObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/RingObject3D.cs @@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project. using System; using System.Collections.Generic; +using System.ComponentModel; using System.Threading.Tasks; using MatterHackers.Agg; using MatterHackers.Agg.VertexSource; @@ -82,6 +83,10 @@ namespace MatterHackers.MatterControl.DesignTools public bool Advanced { get; set; } = false; + [ReadOnly(true)] + [DisplayName("")] // clear the display name so this text will be the full width of the editor + public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more ring options."; + [MaxDecimalPlaces(2)] public double StartingAngle { get; set; } = 0; @@ -150,6 +155,7 @@ namespace MatterHackers.MatterControl.DesignTools { change.SetRowVisible(nameof(StartingAngle), () => Advanced); change.SetRowVisible(nameof(EndingAngle), () => Advanced); + change.SetRowVisible(nameof(EasyModeMessage), () => !Advanced); } public void AddObject3DControls(Object3DControlsLayer object3DControlsLayer) diff --git a/MatterControlLib/DesignTools/Primitives/SphereObject3D.cs b/MatterControlLib/DesignTools/Primitives/SphereObject3D.cs index 251749d93..02f353552 100644 --- a/MatterControlLib/DesignTools/Primitives/SphereObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/SphereObject3D.cs @@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project. using System; using System.Collections.Generic; +using System.ComponentModel; using System.Threading.Tasks; using MatterHackers.Agg; using MatterHackers.Agg.VertexSource; @@ -81,6 +82,10 @@ namespace MatterHackers.MatterControl.DesignTools public bool Advanced { get; set; } = false; + [ReadOnly(true)] + [DisplayName("")] // clear the display name so this text will be the full width of the editor + public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more sphere options."; + [MaxDecimalPlaces(2)] public double StartingAngle { get; set; } = 0; @@ -178,6 +183,7 @@ namespace MatterHackers.MatterControl.DesignTools change.SetRowVisible(nameof(StartingAngle), () => Advanced); change.SetRowVisible(nameof(EndingAngle), () => Advanced); change.SetRowVisible(nameof(LatitudeSides), () => Advanced); + change.SetRowVisible(nameof(EasyModeMessage), () => !Advanced); } public void AddObject3DControls(Object3DControlsLayer object3DControlsLayer) diff --git a/MatterControlLib/DesignTools/Primitives/TorusObject3D.cs b/MatterControlLib/DesignTools/Primitives/TorusObject3D.cs index 35460f69c..5c5d1b0b1 100644 --- a/MatterControlLib/DesignTools/Primitives/TorusObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/TorusObject3D.cs @@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project. using System; using System.Collections.Generic; +using System.ComponentModel; using System.Threading.Tasks; using MatterHackers.Agg; using MatterHackers.Agg.VertexSource; @@ -67,6 +68,10 @@ namespace MatterHackers.MatterControl.DesignTools public bool Advanced { get; set; } = false; + [ReadOnly(true)] + [DisplayName("")] // clear the display name so this text will be the full width of the editor + public string EasyModeMessage { get; set; } = "You can switch to Advanced mode to get more torus options."; + [MaxDecimalPlaces(2)] public double StartingAngle { get; set; } = 0; @@ -157,6 +162,7 @@ namespace MatterHackers.MatterControl.DesignTools change.SetRowVisible(nameof(EndingAngle), () => Advanced); change.SetRowVisible(nameof(RingSides), () => Advanced); change.SetRowVisible(nameof(RingPhaseAngle), () => Advanced); + change.SetRowVisible(nameof(EasyModeMessage), () => !Advanced); } public void AddObject3DControls(Object3DControlsLayer object3DControlsLayer) diff --git a/MatterControlLib/DesignTools/PublicPropertyEditor.cs b/MatterControlLib/DesignTools/PublicPropertyEditor.cs index 3e2b976ed..5bc519589 100644 --- a/MatterControlLib/DesignTools/PublicPropertyEditor.cs +++ b/MatterControlLib/DesignTools/PublicPropertyEditor.cs @@ -670,12 +670,57 @@ namespace MatterHackers.MatterControl.DesignTools { if (readOnly) { - rowContainer = new WrappedTextWidget(stringValue, - textColor: theme.TextColor, - pointSize: 10) + WrappedTextWidget wrappedTextWidget = null; + if (!string.IsNullOrEmpty(property.DisplayName)) { - Margin = 5 - }; + rowContainer = new GuiWidget() + { + HAnchor = HAnchor.Stretch, + VAnchor = VAnchor.Fit, + Margin = 9 + }; + + var displayName = rowContainer.AddChild(new TextWidget(property.DisplayName, + textColor: theme.TextColor, + pointSize: 10) + { + VAnchor = VAnchor.Center, + }); + + var wrapContainer = new GuiWidget() + { + Margin = new BorderDouble(displayName.Width + displayName.Margin.Width + 15, 9, 9, 9), + HAnchor = HAnchor.Stretch, + VAnchor = VAnchor.Fit + }; + wrappedTextWidget = new WrappedTextWidget(stringValue, textColor: theme.TextColor, pointSize: 10) + { + HAnchor = HAnchor.Stretch + }; + wrappedTextWidget.TextWidget.HAnchor = HAnchor.Right; + wrapContainer.AddChild(wrappedTextWidget); + rowContainer.AddChild(wrapContainer); + } + else + { + rowContainer = wrappedTextWidget = new WrappedTextWidget(stringValue, + textColor: theme.TextColor, + pointSize: 10) + { + Margin = 9 + }; + } + + void RefreshField(object s, InvalidateArgs e) + { + if (e.InvalidateType.HasFlag(InvalidateType.DisplayValues)) + { + wrappedTextWidget.Text = property.Value.ToString(); + } + } + + object3D.Invalidated += RefreshField; + wrappedTextWidget.Closed += (s, e) => object3D.Invalidated -= RefreshField; } else // normal edit row { @@ -776,18 +821,6 @@ namespace MatterHackers.MatterControl.DesignTools } }; - void RefreshField(object s, InvalidateArgs e) - { - if (e.InvalidateType.HasFlag(InvalidateType.DisplayValues) - && field.Content is MHDropDownList list - && list.SelectedValue != property.Value.ToString()) - { - propertyGridModifier?.UpdateControls(new PublicPropertyChange(context, property.PropertyInfo.Name)); - } - } - - object3D.Invalidated += RefreshField; - if (addToSettingsRow) { rowContainer = CreateSettingsRow(property, field, theme); diff --git a/MatterControlLib/Library/Widgets/LibraryWidget.cs b/MatterControlLib/Library/Widgets/LibraryWidget.cs index 8fbcaa065..2d8b5c355 100644 --- a/MatterControlLib/Library/Widgets/LibraryWidget.cs +++ b/MatterControlLib/Library/Widgets/LibraryWidget.cs @@ -50,7 +50,6 @@ namespace MatterHackers.MatterControl.PrintLibrary { public class LibraryWidget : GuiWidget { - private readonly FlowLayoutWidget buttonPanel; private readonly ILibraryContext libraryContext; private readonly LibraryListView libraryView; diff --git a/StaticData/Icons/Library/back.png b/StaticData/Icons/Library/back.png new file mode 100644 index 000000000..b985c8621 Binary files /dev/null and b/StaticData/Icons/Library/back.png differ diff --git a/StaticData/Icons/Library/upfolder_20.png b/StaticData/Icons/Library/upfolder_20.png deleted file mode 100644 index e56acb18f..000000000 Binary files a/StaticData/Icons/Library/upfolder_20.png and /dev/null differ