Convert public property editor to use SettingsRow

- Ensure consistent styling across panels
This commit is contained in:
John Lewin 2019-05-24 09:17:02 -07:00 committed by jlewin
parent c02909b604
commit 8c3de11a9f
3 changed files with 18 additions and 19 deletions

View file

@ -524,9 +524,15 @@ namespace MatterHackers.MatterControl
return solidSlider;
}
// ApplySquareBoxStyle
public SectionWidget ApplyBoxStyle(SectionWidget sectionWidget, BorderDouble margin)
{
return ApplyBoxStyle(sectionWidget, this.SectionBackgroundColor, margin);
sectionWidget.BackgroundColor = this.SectionBackgroundColor;
sectionWidget.Margin = 0;
sectionWidget.Border = new BorderDouble(bottom: 1);
sectionWidget.BorderColor = this.RowBorder;
return sectionWidget;
}
public SectionWidget ApplyBoxStyle(SectionWidget sectionWidget, Color backgroundColor, BorderDouble margin)

View file

@ -206,24 +206,15 @@ namespace MatterHackers.MatterControl.DesignTools
public static GuiWidget CreateSettingsRow(string labelText, string toolTipText, GuiWidget guiWidget, ThemeConfig theme)
{
var rowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight)
guiWidget.VAnchor |= VAnchor.Center;
var row = new SettingsRow(labelText, toolTipText, theme)
{
HAnchor = HAnchor.Stretch,
Padding = new BorderDouble(5),
ToolTipText = toolTipText
Padding = new BorderDouble(right: theme.DefaultContainerPadding)
};
row.AddChild(guiWidget);
rowContainer.AddChild(new TextWidget(labelText + ":", pointSize: 11, textColor: theme.TextColor)
{
Margin = new BorderDouble(0, 0, 3, 0),
VAnchor = VAnchor.Center,
});
rowContainer.AddChild(new HorizontalSpacer());
rowContainer.AddChild(guiWidget);
return rowContainer;
return row;
}
private static FlowLayoutWidget CreateSettingsColumn(EditableProperty property, UIField field)

View file

@ -144,7 +144,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
HAnchor = HAnchor.Stretch,
VAnchor = VAnchor.Fit,
Name = "editorPanel",
Padding = new BorderDouble(right: theme.DefaultContainerPadding + 1)
};
// Wrap editorPanel with scrollable container
@ -163,7 +162,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.AddChild(editorSectionWidget);
this.ContentPanel = editorPanel;
editorPanel.Padding = new BorderDouble(theme.DefaultContainerPadding, 0);
// Register listeners
scene.SelectionChanged += Scene_SelectionChanged;
@ -261,6 +259,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// color row
var row = PublicPropertyEditor.CreateSettingsRow("Color".Localize(), null, colorField.Content, theme);
// Special top border style for first item in editor
row.Border = new BorderDouble(0, 1);
editorPanel.AddChild(row);
// put in a material edit field
@ -337,7 +339,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// Enforce panel padding
foreach (var sectionWidget in editorPanel.Descendants<SectionWidget>())
{
sectionWidget.Margin = new BorderDouble(0, theme.DefaultContainerPadding / 2);
sectionWidget.Margin = 0;
}
}
else