Did a bit more work to prove out the settings design.

This commit is contained in:
Lars Brubaker 2014-11-20 10:36:03 -08:00
parent 0c86ac0f70
commit b25feec0a7
3 changed files with 79 additions and 15 deletions

View file

@ -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(',');

View file

@ -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

View file

@ -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",