diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index 157075829..ef06733fb 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -199,7 +199,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return "Advanced"; } - //return "Minimal"; + return "Minimal"; return "Beginner"; } } @@ -589,16 +589,28 @@ namespace MatterHackers.MatterControl.SlicerConfiguration case OrganizerSettingsData.DataEditTypes.POSITIVE_DOUBLE: { + FlowLayoutWidget content = new FlowLayoutWidget(); + double currentValue = 0; double.TryParse(sliceSettingValue, out currentValue); MHNumberEdit doubleEditWidget = new MHNumberEdit(currentValue, allowDecimals: true, pixelWidth: doubleEditWidth, tabIndex: tabIndexForItem++); doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) => - { - SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); - CallEventsOnSettingsChange(settingData); - }; - leftToRightLayout.AddChild(doubleEditWidget); - leftToRightLayout.AddChild(getSettingInfoData(settingData)); + { + SaveSetting(settingData.SlicerConfigName, ((NumberEdit)sender).Value.ToString()); + CallEventsOnSettingsChange(settingData); + }; + + content.AddChild(doubleEditWidget); + content.AddChild(getSettingInfoData(settingData)); + + if (settingData.QuickMenuSettings.Count > 0) + { + leftToRightLayout.AddChild(CreateQuickMenu(settingData, content)); + } + else + { + leftToRightLayout.AddChild(content); + } } break; @@ -619,7 +631,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration case OrganizerSettingsData.DataEditTypes.DOUBLE_OR_PERCENT: { - MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: doubleEditWidth-2, tabIndex: tabIndexForItem++); + FlowLayoutWidget content = new FlowLayoutWidget(); + + MHTextEditWidget stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: doubleEditWidth - 2, tabIndex: tabIndexForItem++); stringEdit.ActualTextEditWidget.EditComplete += (sender, e) => { TextEditWidget textEditWidget = (TextEditWidget)sender; @@ -642,8 +656,17 @@ namespace MatterHackers.MatterControl.SlicerConfiguration CallEventsOnSettingsChange(settingData); }; - leftToRightLayout.AddChild(stringEdit); - leftToRightLayout.AddChild(getSettingInfoData(settingData)); + content.AddChild(stringEdit); + content.AddChild(getSettingInfoData(settingData)); + + if (settingData.QuickMenuSettings.Count > 0) + { + leftToRightLayout.AddChild(CreateQuickMenu(settingData, content)); + } + else + { + leftToRightLayout.AddChild(content); + } } break; @@ -907,6 +930,47 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return container; } + private GuiWidget CreateQuickMenu(OrganizerSettingsData settingData, GuiWidget content) + { + string sliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(settingData.SlicerConfigName); + FlowLayoutWidget totalContent = new FlowLayoutWidget(); + + StyledDropDownList selectableOptions = new StyledDropDownList("Custom", maxHeight: 200); + selectableOptions.Margin = new BorderDouble(0, 0, 10, 0); + + foreach (QuickMenuNameValue nameValue in settingData.QuickMenuSettings) + { + string valueLocal = nameValue.Value; + + MenuItem newItem = selectableOptions.AddItem(nameValue.MenuName); + if (sliceSettingValue == valueLocal) + { + selectableOptions.SelectedLabel = nameValue.MenuName; + content.Visible = false; + } + + newItem.Selected += (sender, e) => + { + SaveSetting(settingData.SlicerConfigName, valueLocal); + CallEventsOnSettingsChange(settingData); + content.Visible = false; + }; + } + + // 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); + + return totalContent; + } + private void SaveCommaSeparatedIndexSetting(int extruderIndexLocal, string slicerConfigName, string newSingleValue) { string[] settings = ActiveSliceSettings.Instance.GetActiveValue(slicerConfigName).Split(','); diff --git a/StaticData/SliceSettings/Layouts.txt b/StaticData/SliceSettings/Layouts.txt index 640421c62..cdd18003e 100644 --- a/StaticData/SliceSettings/Layouts.txt +++ b/StaticData/SliceSettings/Layouts.txt @@ -1,12 +1,12 @@ Minimal Single Single - Infill - fill_density + Print layer_height - create_raft + fill_density + Support Material support_material - + create_raft Beginner Print Layers/Perimeters diff --git a/StaticData/SliceSettings/Properties.json b/StaticData/SliceSettings/Properties.json index 2346db1fb..183f29c4b 100644 --- a/StaticData/SliceSettings/Properties.json +++ b/StaticData/SliceSettings/Properties.json @@ -285,7 +285,7 @@ "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)", - "QuickMenuSettings": [{"MenuName" : "Sparse", "Value": "10%"},{"MenuName" : "Standard", "Value": "30%"},{"MenuName" : "Solid", "Value": "90%"}] + "QuickMenuSettings": [{"MenuName" : "Light", "Value": "10%"},{"MenuName" : "Standard", "Value": "30%"},{"MenuName" : "Heavy", "Value": "90%"}] }, { "SlicerConfigName": "fill_pattern",