Merge pull request #2844 from jlewin/design_tools

Revise slice settings
This commit is contained in:
johnlewin 2018-01-04 18:31:15 -08:00 committed by GitHub
commit 09d79e00f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 109 additions and 147 deletions

View file

@ -64,7 +64,7 @@ namespace MatterHackers.MatterControl
{
var tabPage = new TabPage(section.Name.Localize())
{
Padding = new BorderDouble(10, 4)
Padding = new BorderDouble(1, 4)
};
primaryTabControl.AddTab(new TextTab(
@ -88,7 +88,7 @@ namespace MatterHackers.MatterControl
section.GroupsList.FirstOrDefault(),
sliceSettingsWidget.settingsContext,
sliceSettingsWidget.ShowHelpControls,
ActiveTheme.Instance.PrimaryTextColor));
ActiveTheme.Instance.PrimaryTextColor, scrollable.ScrollArea));
tabPage.AddChild(scrollable);
}

View file

@ -5,7 +5,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
{
public class SectionWidget : FlowLayoutWidget
{
public SectionWidget(string sectionTitle, Color textColor, GuiWidget sectionContent, GuiWidget rightAlignedContent = null)
public SectionWidget(string sectionTitle, Color textColor, GuiWidget sectionContent, GuiWidget rightAlignedContent = null, int headingPointSize = -1)
: base (FlowDirection.TopToBottom)
{
this.HAnchor = HAnchor.Stretch;
@ -13,36 +13,39 @@ namespace MatterHackers.MatterControl.CustomWidgets
var theme = ApplicationController.Instance.Theme;
// Add heading
var textWidget = new TextWidget(sectionTitle, pointSize: theme.H1PointSize, textColor: textColor, bold: false)
if (!string.IsNullOrEmpty(sectionTitle))
{
Margin = new BorderDouble(0, 3, 0, 6)
};
if (rightAlignedContent == null)
{
this.AddChild(textWidget);
}
else
{
var headingRow = new FlowLayoutWidget()
// Add heading
var pointSize = (headingPointSize) == -1 ? theme.H1PointSize : headingPointSize;
var textWidget = new TextWidget(sectionTitle, pointSize: pointSize, textColor: textColor, bold: false)
{
HAnchor = HAnchor.Stretch
Margin = new BorderDouble(0, 3, 0, 6)
};
headingRow.AddChild(textWidget);
headingRow.AddChild(new HorizontalSpacer());
headingRow.AddChild(rightAlignedContent);
this.AddChild(headingRow);
}
// Add heading separator
this.AddChild(new HorizontalLine(25)
{
Margin = new BorderDouble(0)
});
if (rightAlignedContent == null)
{
this.AddChild(textWidget);
}
else
{
var headingRow = new FlowLayoutWidget()
{
HAnchor = HAnchor.Stretch
};
headingRow.AddChild(textWidget);
headingRow.AddChild(new HorizontalSpacer());
headingRow.AddChild(rightAlignedContent);
this.AddChild(headingRow);
}
// Add heading separator
this.AddChild(new HorizontalLine(25)
{
Margin = new BorderDouble(0)
});
}
// Force padding and add content widget
sectionContent.Padding = 8;
sectionContent.HAnchor = HAnchor.Stretch;
sectionContent.BackgroundColor = ApplicationController.Instance.Theme.MinimalShade;
this.AddChild(sectionContent);

View file

@ -106,7 +106,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
primaryTabControl.Margin = new BorderDouble(top: 8);
primaryTabControl.AnchorAll();
var sideTabBarsListForLayout = new List<TabBar>();
for (int topCategoryIndex = 0; topCategoryIndex < SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList.Count; topCategoryIndex++)
{
@ -130,23 +129,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
ActiveTheme.Instance.TabLabelUnselected,
new Color(),
useUnderlineStyling: true));
var column = new FlowLayoutWidget(FlowDirection.TopToBottom);
column.AnchorAll();
var hline = new HorizontalLine()
{
BackgroundColor = ApplicationController.Instance.Theme.SlightShade,
Height = 4
};
column.AddChild(hline);
TabControl sideTabs = CreateSideTabsAndPages(category, this.ShowHelpControls);
sideTabBarsListForLayout.Add(sideTabs.TabBar);
column.AddChild(sideTabs);
categoryPage.AddChild(column);
var sideTabs = CreateSideTabsAndPages(category, this.ShowHelpControls);
sideTabs.MinimumSize = new Vector2(200, 200);
categoryPage.AddChild(sideTabs);
}
primaryTabControl.TabBar.AddChild(new HorizontalSpacer());
@ -160,18 +146,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
});
}
FindWidestTabAndSetAllMinimumSize(sideTabBarsListForLayout);
// check if there is only one left side tab. If so hide the left tabs and expand the content.
foreach (var tabList in sideTabBarsListForLayout)
{
if (tabList.CountVisibleChildren() == 1)
{
tabList.MinimumSize = new Vector2(0, 0);
tabList.Width = 0;
}
}
this.AddChild(primaryTabControl);
// Restore the last selected tab
@ -229,115 +203,97 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
set => UserSettings.Instance.set(UserSettingsKey.SliceSettingsShowHelp, value.ToString().ToLower());
}
private TabControl CreateSideTabsAndPages(OrganizerCategory category, bool showHelpControls)
private GuiWidget CreateSideTabsAndPages(OrganizerCategory category, bool showHelpControls)
{
var oemAndUserContext = new SettingsContext(
printer,
null,
NamedSettingsLayers.MHBaseSettings | NamedSettingsLayers.OEMSettings | NamedSettingsLayers.User);
this.HAnchor = HAnchor.Stretch;
var secondaryTabControl = new TabControl(Orientation.Vertical);
secondaryTabControl.TabBar.HAnchor = HAnchor.Fit;
secondaryTabControl.TabBar.BorderColor = Color.Transparent;
secondaryTabControl.TabBar.BackgroundColor = ApplicationController.Instance.Theme.SlightShade;
var column = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
VAnchor = VAnchor.Fit,
HAnchor = HAnchor.Stretch,
Padding = new BorderDouble(10, 10, 13, 6),
};
foreach (OrganizerGroup group in category.GroupsList)
{
tabIndexForItem = 0;
var groupTabPage = new TabPage(group.Name.Localize())
{
HAnchor = HAnchor.Stretch
};
//Side Tabs
var groupTabWidget = new TextTab(
groupTabPage,
group.Name + " Tab",
theme.DefaultFontSize,
ActiveTheme.Instance.TabLabelSelected,
ActiveTheme.Instance.TertiaryBackgroundColor,
ActiveTheme.Instance.TabLabelUnselected,
Color.Transparent,
32);
groupTabWidget.HAnchor = HAnchor.MaxFitOrStretch;
foreach(var child in groupTabWidget.Children)
{
child.HAnchor = HAnchor.MaxFitOrStretch;
child.Padding = new BorderDouble(10);
}
FlowLayoutWidget subgroupPanel = CreateGroupContent(group, oemAndUserContext, showHelpControls, textColor);
if (subgroupPanel.Children.Count > 0)
{
var scrollableWidget = new ScrollableWidget()
{
AutoScroll = true,
};
scrollableWidget.ScrollArea.HAnchor = HAnchor.Stretch;
scrollableWidget.AnchorAll();
scrollableWidget.AddChild(subgroupPanel);
groupTabPage.AddChild(scrollableWidget);
secondaryTabControl.AddTab(groupTabWidget);
}
if (group.Name == "Connection")
{
subgroupPanel.AddChild(SliceSettingsWidget.CreateOemProfileInfoRow(settingsContext, isPrimarySettingsView: true));
column.AddChild(
SliceSettingsWidget.CreateOemProfileInfoRow(settingsContext, isPrimarySettingsView: true));
}
column.AddChild(
CreateGroupContent(group, oemAndUserContext, showHelpControls, textColor, column));
}
// Make sure we are on the right tab when we create this view
string settingsTypeName = $"SliceSettingsWidget_{category.Name}_CurrentTab";
string selectedTab = UserSettings.Instance.get(settingsTypeName);
secondaryTabControl.SelectTab(selectedTab);
var scrollable = new ScrollableWidget(true);
scrollable.AnchorAll();
scrollable.ScrollArea.HAnchor = HAnchor.Stretch;
scrollable.AddChild(column);
secondaryTabControl.TabBar.TabIndexChanged += (object sender, EventArgs e) =>
{
string selectedTabName = secondaryTabControl.TabBar.SelectedTabName;
if (!string.IsNullOrEmpty(selectedTabName)
&& settingsContext.IsPrimarySettingsView)
{
UserSettings.Instance.set(settingsTypeName, selectedTabName);
}
};
return secondaryTabControl;
return scrollable;
}
public FlowLayoutWidget CreateGroupContent(OrganizerGroup group, SettingsContext oemAndUserContext, bool showHelpControls, Color textColor)
public FlowLayoutWidget CreateGroupContent(OrganizerGroup group, SettingsContext oemAndUserContext, bool showHelpControls, Color textColor, GuiWidget parent)
{
var groupPanel = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
VAnchor = VAnchor.Fit,
HAnchor = HAnchor.Stretch
HAnchor = HAnchor.Stretch,
};
string groupName = (group.Name.Contains("!hidden")) ? "" : group.Name;
var sectionWidget = new SectionWidget(groupName, ActiveTheme.Instance.PrimaryTextColor, groupPanel, headingPointSize: theme.FontSize12)
{
Margin = new BorderDouble(bottom: 8),
};
if (string.IsNullOrEmpty(groupName))
{
// If not title will be display, sync the left and top padding values
parent.Padding = parent.Padding.Clone(top: parent.Padding.Left);
}
groupPanel.Padding = 0;
var zebraColor = theme.MinimalShade;
var headingColor = textColor.AdjustLightness(ActiveTheme.Instance.IsDarkTheme ? 0.5 : 2.8).ToColor();
foreach (OrganizerSubGroup subGroup in group.SubGroupsList)
{
var section = AddSettingRowsForSubgroup(subGroup, oemAndUserContext, showHelpControls);
if (section != null)
{
var groupBox = new AltGroupBox(subGroup.Name.Localize())
zebraColor = (zebraColor == Color.Transparent) ? zebraColor = theme.MinimalShade : Color.Transparent;
var column = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
TextColor = textColor,
BorderColor = textColor,
HAnchor = HAnchor.Stretch,
Margin = new BorderDouble(bottom: 8, top: 8),
BackgroundColor = zebraColor,
Padding = new BorderDouble(left: 4),
};
groupBox.AddChild(section);
groupPanel.AddChild(groupBox);
if (!subGroup.Name.Contains("!hidden"))
{
// Section heading
column.AddChild(new TextWidget(" " + subGroup.Name.Localize(), textColor: headingColor, pointSize: theme.FontSize10)
{
Margin = new BorderDouble(left: 8, top: 6, bottom: 4),
});
}
column.AddChild(section);
groupPanel.AddChild(column);
}
}
return groupPanel;
return sectionWidget;
}
private GuiWidget AddSettingRowsForSubgroup(OrganizerSubGroup subGroup, SettingsContext oemAndUserContext, bool showHelpControls)
@ -349,7 +305,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
topToBottomSettings.AddChild(new HorizontalLine(20)
{
Margin = new BorderDouble(top: 5),
});
foreach (SliceSettingData settingData in subGroup.SettingDataList)

View file

@ -15,22 +15,28 @@ Advanced
top_solid_layers
bottom_solid_layers
Infill
Infill
Infill!hidden
fill_density
infill_type
Advanced
fill_angle
infill_overlap_perimeter
fill_thin_gaps
Speed
Extruder Change
Extruder Change!hidden
wipe_shield_distance
wipe_tower_size
Speed
Speed!hidden
Printing Speed
laser_speed_025
laser_speed_100
Speed for Infill
Speed for Infill!hidden
infill_speed
top_solid_infill_speed
raft_print_speed
Speed for Perimeters
Speed for Perimeters!hidden
perimeter_speed
external_perimeter_speed
Other
@ -47,7 +53,8 @@ Advanced
Cooling Thresholds
slowdown_below_layer_time
min_print_speed
Raft / Skirt / Brim
Adhesion
Raft / Skirt / Brim!hidden
Raft
create_raft
raft_extra_distance_around_part
@ -60,12 +67,13 @@ Advanced
min_skirt_length
Brim
brims
Support Material
Support Material
Support
Support!hidden
Support!hidden
support_material
support_type
support_material_percent
Support Options
Support Options!hidden
support_material_spacing
support_material_infill_angle
support_material_interface_layers
@ -76,12 +84,8 @@ Advanced
Extruders
support_material_extruder
support_material_interface_extruder
Extruder Change
wipe_shield_distance
wipe_tower_size
Ooze Prevention
Filament
General
General!hidden
Material
filament_diameter
filament_density
@ -98,7 +102,7 @@ Advanced
external_perimeter_extrusion_width
support_material_extrusion_width
Retraction
After Move
After Move!hidden
enable_retractions
retract_length
retract_restart_extra
@ -114,7 +118,7 @@ Advanced
retract_restart_extra_toolchange
Printer
General
Common
Common!hidden
Settings
auto_connect
baud_rate
@ -134,7 +138,7 @@ Printer
extruders_share_temperature
extruder_offset
Features
Features
Features!hidden
Interface
sla_printer
show_reset_connection
@ -177,7 +181,7 @@ Printer
output_only_first_layer
g0
G-Code
Custom G-Code
Custom G-Code!hidden
Custom G-Code
start_gcode
end_gcode