Merge pull request #5319 from larsbrubaker/may_release

May release
This commit is contained in:
Lars Brubaker 2022-05-07 20:25:24 -07:00 committed by GitHub
commit 05026d4e6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 143 additions and 28 deletions

View file

@ -306,9 +306,67 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
};
var colorButton = colorField.Content.Descendants<ColorButton>().FirstOrDefault();
colorButton.Parent.MouseDown += (s, e) =>
ColorButton holeButton = null;
var solidButton = colorField.Content.Descendants<ColorButton>().FirstOrDefault();
GuiWidget otherContainer = null;
TextWidget otherText = null;
TextWidget holeText = null;
TextWidget solidText = null;
void SetOtherOutputSelection(string text)
{
otherText.Text = text;
otherContainer.Visible = true;
holeText.Underline = false;
holeButton.BackgroundOutlineWidth = 1;
solidText.Underline = false;
solidButton.BackgroundOutlineWidth = 1;
}
var scaledButtonSize = 24 * GuiWidget.DeviceScale;
void SetButtonStates()
{
switch (selectedItem.WorldOutputType())
{
case PrintOutputTypes.Hole:
holeText.Underline = true;
holeButton.BackgroundOutlineWidth = 2;
holeButton.BackgroundRadius = scaledButtonSize / 2 - 1;
solidText.Underline = false;
solidButton.BackgroundOutlineWidth = 1;
solidButton.BackgroundRadius = scaledButtonSize / 2;
otherContainer.Visible = false;
break;
case PrintOutputTypes.Default:
case PrintOutputTypes.Solid:
holeText.Underline = false;
holeButton.BackgroundOutlineWidth = 1;
holeButton.BackgroundRadius = scaledButtonSize / 2;
solidText.Underline = true;
solidButton.BackgroundOutlineWidth = 2;
solidButton.BackgroundRadius = scaledButtonSize / 2 - 1;
otherContainer.Visible = false;
break;
case PrintOutputTypes.Support:
SetOtherOutputSelection("Support".Localize());
break;
case PrintOutputTypes.WipeTower:
SetOtherOutputSelection("Wipe Tower".Localize());
break;
case PrintOutputTypes.Fuzzy:
SetOtherOutputSelection("Fuzzy".Localize());
break;
}
}
void SetToSolid()
{
// make sure the render mode is set to shaded or outline
if (sceneContext.ViewState.RenderType != RenderOpenGl.RenderTypes.Shaded
&& sceneContext.ViewState.RenderType != RenderOpenGl.RenderTypes.Outlines)
@ -322,9 +380,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
undoBuffer.AddAndDo(new ChangeColor(selectedItem, colorField.Color));
}
};
var colorRow = new SettingsRow("Result".Localize(), null, colorField.Content, theme)
SetButtonStates();
}
solidButton.Parent.MouseDown += (s, e) => SetToSolid();
var colorRow = new SettingsRow("Output".Localize(), null, colorField.Content, theme)
{
// Special top border style for first item in editor
Border = new BorderDouble(0, 1)
@ -332,8 +394,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
editorPanel.AddChild(colorRow);
// put in a hole button
var scaledButtonSize = 24 * GuiWidget.DeviceScale;
var holeButton = new ColorButton(Color.DarkGray)
holeButton = new ColorButton(Color.DarkGray)
{
Margin = new BorderDouble(5, 0, 11, 0),
Width = scaledButtonSize,
@ -346,26 +407,61 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
ToolTipText = "Convert to Hole".Localize(),
};
var buttonRow = colorButton.Parents<FlowLayoutWidget>().FirstOrDefault();
buttonRow.AddChild(new TextWidget("Solid".Localize(), pointSize: theme.FontSize10, textColor: theme.TextColor)
{
var buttonRow = solidButton.Parents<FlowLayoutWidget>().FirstOrDefault();
solidText = new TextWidget("Solid".Localize(), pointSize: theme.FontSize10, textColor: theme.TextColor)
{
VAnchor = VAnchor.Center,
Margin = new BorderDouble(3, 0),
}, 0);
Selectable = true,
};
buttonRow.AddChild(solidText, 0);
buttonRow.AddChild(holeButton, 0);
buttonRow.AddChild(new TextWidget("Hole".Localize(), pointSize: theme.FontSize10, textColor: theme.TextColor)
holeText = new TextWidget("Hole".Localize(), pointSize: theme.FontSize10, textColor: theme.TextColor)
{
VAnchor = VAnchor.Center,
Margin = new BorderDouble(3, 0),
}, 0);
holeButton.Click += (s, e) =>
Selectable = true,
};
buttonRow.AddChild(holeText, 0);
otherContainer = new GuiWidget()
{
Margin = new BorderDouble(5, 0),
VAnchor = VAnchor.Fit | VAnchor.Center,
HAnchor = HAnchor.Fit,
BackgroundRadius = 3,
BackgroundOutlineWidth = 1,
BorderColor = theme.PrimaryAccentColor,
};
buttonRow.AddChild(otherContainer, 0);
otherText = new TextWidget("".Localize(), pointSize: theme.FontSize10, textColor: theme.TextColor)
{
Margin = new BorderDouble(5, 5),
AutoExpandBoundsToText = true,
};
otherContainer.AddChild(otherText);
void SetToHole()
{
if (selectedItem.WorldOutputType() != PrintOutputTypes.Hole)
{
undoBuffer.AddAndDo(new MakeHole(selectedItem));
}
};
SetButtonStates();
}
holeButton.Click += (s, e) => SetToHole();
holeText.Click += (s, e) => SetToHole();
solidText.Click += (s, e) => SetToSolid();
SetButtonStates();
void SelectedItemOutputChanged(object sender, EventArgs e)
{
SetButtonStates();
}
selectedItem.Invalidated += SelectedItemOutputChanged;
Closed += (s, e) => selectedItem.Invalidated -= SelectedItemOutputChanged;
// put in a material edit field
var materialField = new MaterialIndexField(sceneContext.Printer, theme, selectedItem.MaterialIndex);
@ -389,9 +485,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// material row
editorPanel.AddChild(new SettingsRow("Material".Localize(), null, materialField.Content, theme));
}
}
var rows = new SafeList<SettingsRow>();
var rows = new SafeList<SettingsRow>();
// put in the normal editor
if (selectedItem is ComponentObject3D componentObject
@ -407,7 +503,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
ShowObjectEditor((editor, item, item.Name), selectedItem);
}
}
}
}
private void AddComponentEditor(IObject3D selectedItem, UndoBuffer undoBuffer, SafeList<SettingsRow> rows, ComponentObject3D componentObject)
{

View file

@ -133,7 +133,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
printer.Settings.ActiveMaterialKey = "";
printer.Settings.MaterialLayers.Remove(layerToEdit);
printer.Settings.Save();
RebuildDropDownList();
RebuildDropDownList(true);
}
};
@ -180,7 +180,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
// Clear QualityKey after removing layer to ensure listeners see update
printer.Settings.ActiveQualityKey = "";
RebuildDropDownList();
RebuildDropDownList(true);
}
};
@ -236,7 +236,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|| (layerType == NamedSettingsLayers.Quality && stringEvent.Data == SettingsKey.active_quality_key)
|| stringEvent.Data == SettingsKey.layer_name))
{
RebuildDropDownList();
RebuildDropDownList(false);
}
}
@ -291,7 +291,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
printer.Settings.MaterialLayers.Add(newMaterial);
printer.Settings.ActiveMaterialKey = newMaterial.LayerID;
RebuildDropDownList();
RebuildDropDownList(true);
},
() =>
{
@ -300,7 +300,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
printer.Settings.MaterialLayers.Add(newMaterial);
printer.Settings.ActiveMaterialKey = newMaterial.LayerID;
RebuildDropDownList();
RebuildDropDownList(true);
editButton.InvokeClick();
}));
@ -320,7 +320,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
printer.Settings.QualityLayers.Add(newQuality);
printer.Settings.ActiveQualityKey = newQuality.LayerID;
RebuildDropDownList();
RebuildDropDownList(true);
editButton.InvokeClick();
}
@ -505,7 +505,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
editButton.Enabled = item.Text != defaultMenuItemText;
}
private void RebuildDropDownList()
private void RebuildDropDownList(bool updateAllSettings)
{
pullDownContainer.CloseChildren();
pullDownContainer.AddChild(this.NewPulldownContainer());
@ -513,13 +513,20 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
var sliceSettingsWidget = this.Parents<SliceSettingsWidget>().FirstOrDefault();
if (sliceSettingsWidget != null)
{
sliceSettingsWidget.UpdateAllStyles();
if (updateAllSettings)
{
ApplicationController.Instance.ReloadSettings(printer);
}
else
{
sliceSettingsWidget.UpdateAllStyles();
}
}
}
private void SettingsLayers_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
RebuildDropDownList();
RebuildDropDownList(false);
}
}
}

View file

@ -1156,6 +1156,9 @@ Translated:Creation Data
English:Ctrl + A = Select Alll, 'Space' = Clear Selection, 'ESC' = Cancel Drag
Translated:Ctrl + A = Select Alll, 'Space' = Clear Selection, 'ESC' = Cancel Drag
English:Ctrl + P
Translated:Ctrl + P
English:Ctrl + Y | Ctrl + Shift + Z
Translated:Ctrl + Y | Ctrl + Shift + Z
@ -1945,6 +1948,9 @@ Translated:Found a line that is {0} characters long.\n{1}...
English:Furthest Back
Translated:Furthest Back
English:Fuzzy
Translated:Fuzzy
English:Fuzzy Frequency
Translated:Fuzzy Frequency
@ -3340,6 +3346,9 @@ Translated:Outline Width
English:Outlines (default)
Translated:Outlines (default)
English:Output
Translated:Output
English:Output only the first layer of the print. Especially useful for outputting gcode data for applications like engraving or cutting.
Translated:Output only the first layer of the print. Especially useful for outputting gcode data for applications like engraving or cutting.
@ -6238,6 +6247,9 @@ Translated:Will be updated to:
English:Wipe Shield Distance
Translated:Wipe Shield Distance
English:Wipe Tower
Translated:Wipe Tower
English:Wipe Tower Size
Translated:Wipe Tower Size

@ -1 +1 @@
Subproject commit e83b5b6e0f0030b24513124d84649e6d05417d2b
Subproject commit 180be9e945fdc3361b737fac2b73bd01cce6987a