Cleaned up the drop down settings menus to work well.
Got rid of some crash problems with no selection.
This commit is contained in:
parent
b618e5c2b3
commit
15b5654a40
4 changed files with 70 additions and 36 deletions
|
|
@ -64,6 +64,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
createSelectionDataBackgroundWorker.RunWorkerAsync();
|
||||
}
|
||||
|
||||
SelectedMeshGroupIndex = 0;
|
||||
}
|
||||
|
||||
void createSelectionDataBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue