Collapse subgroup helper method into caller, fix first/last borders

- Issue MatterHackers/MCCentral#3127
Missing slice setting row borders after first/last row modifications
This commit is contained in:
John Lewin 2018-04-14 10:21:47 -07:00
parent 34fcf9e7f7
commit 18147ea5a6

View file

@ -449,28 +449,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
var sectionWidget = new SectionWidget(group.Name.Localize(), groupPanel, theme, serializationKey: userSettingsKey).ApplyBoxStyle();
bool firstRow = true;
GuiWidget settingsRow = null;
foreach (var subGroup in group.SubGroups)
{
var subGroupPanel = this.AddSettingRowsForSubgroup(subGroup, ref firstRow);
if (subGroupPanel != null)
{
groupPanel.AddChild(subGroupPanel);
}
}
return sectionWidget;
}
private GuiWidget AddSettingRowsForSubgroup(SettingsOrganizer.SubGroup subGroup, ref bool firstRow)
{
var topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
HAnchor = HAnchor.Stretch,
};
GuiWidget settingsRow = null;
// Add SettingRows for subgroup
foreach (SliceSettingData settingData in subGroup.Settings)
{
// Note: tab sections may disappear if / when they are empty, as controlled by:
@ -492,7 +476,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
this.settingsRows.Add((settingsRow, settingData));
topToBottomSettings.AddChild(settingsRow);
groupPanel.AddChild(settingsRow);
}
}
}
@ -502,7 +487,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
settingsRow.BorderColor = Color.Transparent;
}
return (topToBottomSettings.Children.Any()) ? topToBottomSettings : null;
return sectionWidget;
}
private static bool CheckIfShouldBeShown(SliceSettingData settingData, SettingsContext settingsContext)