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:
parent
34fcf9e7f7
commit
18147ea5a6
1 changed files with 22 additions and 37 deletions
|
|
@ -449,50 +449,35 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
var sectionWidget = new SectionWidget(group.Name.Localize(), groupPanel, theme, serializationKey: userSettingsKey).ApplyBoxStyle();
|
var sectionWidget = new SectionWidget(group.Name.Localize(), groupPanel, theme, serializationKey: userSettingsKey).ApplyBoxStyle();
|
||||||
|
|
||||||
bool firstRow = true;
|
bool firstRow = true;
|
||||||
|
GuiWidget settingsRow = null;
|
||||||
|
|
||||||
foreach (var subGroup in group.SubGroups)
|
foreach (var subGroup in group.SubGroups)
|
||||||
{
|
{
|
||||||
var subGroupPanel = this.AddSettingRowsForSubgroup(subGroup, ref firstRow);
|
|
||||||
if (subGroupPanel != null)
|
// Add SettingRows for subgroup
|
||||||
|
foreach (SliceSettingData settingData in subGroup.Settings)
|
||||||
{
|
{
|
||||||
groupPanel.AddChild(subGroupPanel);
|
// Note: tab sections may disappear if / when they are empty, as controlled by:
|
||||||
}
|
// settingShouldBeShown / addedSettingToSubGroup / needToAddSubGroup
|
||||||
}
|
bool settingShouldBeShown = CheckIfShouldBeShown(settingData, settingsContext);
|
||||||
|
|
||||||
return sectionWidget;
|
if (EngineMappingsMatterSlice.Instance.MapContains(settingData.SlicerConfigName)
|
||||||
}
|
&& settingShouldBeShown)
|
||||||
|
|
||||||
private GuiWidget AddSettingRowsForSubgroup(SettingsOrganizer.SubGroup subGroup, ref bool firstRow)
|
|
||||||
{
|
|
||||||
var topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
|
||||||
{
|
|
||||||
HAnchor = HAnchor.Stretch,
|
|
||||||
};
|
|
||||||
|
|
||||||
GuiWidget settingsRow = null;
|
|
||||||
|
|
||||||
foreach (SliceSettingData settingData in subGroup.Settings)
|
|
||||||
{
|
|
||||||
// Note: tab sections may disappear if / when they are empty, as controlled by:
|
|
||||||
// settingShouldBeShown / addedSettingToSubGroup / needToAddSubGroup
|
|
||||||
bool settingShouldBeShown = CheckIfShouldBeShown(settingData, settingsContext);
|
|
||||||
|
|
||||||
if (EngineMappingsMatterSlice.Instance.MapContains(settingData.SlicerConfigName)
|
|
||||||
&& settingShouldBeShown)
|
|
||||||
{
|
|
||||||
settingsRow = CreateItemRow(settingData);
|
|
||||||
|
|
||||||
if (firstRow)
|
|
||||||
{
|
{
|
||||||
// First row needs top and bottom border
|
settingsRow = CreateItemRow(settingData);
|
||||||
settingsRow.Border = new BorderDouble(0, 1);
|
|
||||||
|
|
||||||
firstRow = false;
|
if (firstRow)
|
||||||
|
{
|
||||||
|
// First row needs top and bottom border
|
||||||
|
settingsRow.Border = new BorderDouble(0, 1);
|
||||||
|
|
||||||
|
firstRow = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.settingsRows.Add((settingsRow, settingData));
|
||||||
|
|
||||||
|
groupPanel.AddChild(settingsRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.settingsRows.Add((settingsRow, settingData));
|
|
||||||
|
|
||||||
topToBottomSettings.AddChild(settingsRow);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -502,7 +487,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
settingsRow.BorderColor = Color.Transparent;
|
settingsRow.BorderColor = Color.Transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (topToBottomSettings.Children.Any()) ? topToBottomSettings : null;
|
return sectionWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool CheckIfShouldBeShown(SliceSettingData settingData, SettingsContext settingsContext)
|
private static bool CheckIfShouldBeShown(SliceSettingData settingData, SettingsContext settingsContext)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue