Skip to content

Commit

Permalink
Expended option for settings ui files: widths, sidetext, simple/advan…
Browse files Browse the repository at this point in the history
…ced/export mode support for lines.
  • Loading branch information
supermerill authored and supermerill committed Jan 15, 2020
1 parent 885330d commit 433bd46
Show file tree
Hide file tree
Showing 13 changed files with 216 additions and 121 deletions.
46 changes: 26 additions & 20 deletions resources/ui_layout/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,39 @@ each parameter is separated by ':'
page:STR:STR
* first STR is for the label and the second for the icon, with or without the .svg / .png
* Group:
group[:nolabel][:label_width$INT][:EVENT]:STR
group[:nolabel][:title_width$INT][:label_width$INT][:sidetext_width$INT][:EVENT]:STR
* EVENT can be extruders_count_event if the group contains extruders_count and is a printer tab ; silent_mode_event if the group contains silent_mode and is a printer tab ; material_density_event if the group contains material_density.
* label_width$INT is used to set the size of the left column, where labels are draw.
* title_width$INT is used to set the size of the left column, where labels are draw.
* label_width$INT is used to set the size of the labels on lines.
* sidetext_width$INT is used to set the size of the suffix label (see sidetext in setting).
* EVENT can be extruders_count_event (TabPrinter only), silent_mode_event (TabPrinter only), material_density_event.
* nolabel is used to remove the left column, where labels are draw.
* Line:
line:STR
* setting:
setting[label$STR][:full_label][:full_width][:simple|advanced|expert][:width$INT][:width$INT][:id$INT]:STR
setting[label$STR][label_width$INT][:full_label][:full_width][:sidetext$STR][sidetext_width$INT][:simple|advanced|expert][:width$INT][:height$INT][:id$INT]:STR
* STR, the last parameter: the id name of the setting.
* label$STR : to override the label by this new one
* full_label: to override the label by the "full one"
* full_width: to tell to create a field that span the full width
* simple|advanced|expert: add one of these to modify the mode in which this setting appear. If it's inside a lien, the first setting of the line decide for all the line.
* width$INT: change the width of the field. Don't works (yet) with every type of setting.
* height$INT: change the height of the field. Don't works (yet) with every type of setting.
* label$STR : to override the label by this new one (if it ends with '_' it won't have a ':' ; if empty it won't have a length).
* label_width$INT: change the width of the label. Only works if it's in a line. Override the group one. 0 for auto.
* full_label: to override the label by the "full one".
* full_width: to tell to create a field that span the full width.
* sidetext$STR: the suffix at the right of the widget (like 'mm').
* sidetext_width$INT: the suffix label length (override the group one). 0 for auto.
* simple|advanced|expert: add one of these to modify the mode in which this setting appear.
* width$INT: change the width of the field. Shouod work on most type of settings.
* height$INT: change the height of the field. Don't works with every type of setting.
* id $INT : for setting only a single value of a setting array.
* recommended_thin_wall_thickness_description: create a text widget to explain recommended thin wall thickness (only in a fff print tab)
* parent_preset_description: create a text widget to explain parent preset
* cooling_description: create a text widget to explain cooling (only in a filament tab)
* volumetric_speed_description: create a text widget to explain volumetric speed (only in a filament tab)
* filament_ramming_parameters: create a widget for filament ramming
* filament_overrides_page: create a page for overrides (only in a filament tab)
* unregular_pages: create needed special pages for a fff printer tab
* printhost: create printhost settings for the group (only in a printer tab)
* bed_shape: create bed shape widget (only in a printer tab)
* extruders_count: create extruders_count setting (only in a fff printer tab)
* logs: activated logs
* recommended_thin_wall_thickness_description: create a text widget to explain recommended thin wall thickness (only in a fff print tab).
* parent_preset_description: create a text widget to explain parent preset.
* cooling_description: create a text widget to explain cooling (only in a filament tab).
* volumetric_speed_description: create a text widget to explain volumetric speed (only in a filament tab).
* filament_ramming_parameters: create a widget for filament ramming.
* filament_overrides_page: create a page for overrides (only in a filament tab).
* unregular_pages: create needed special pages for a fff printer tab.
* printhost: create printhost settings for the group (only in a printer tab).
* bed_shape: create bed shape widget (only in a printer tab).
* extruders_count: create extruders_count setting (only in a fff printer tab).
* logs: activated logs.
### ui file syntax
trailing & leading tabs & spaces are removed, so you can indent as you want.
If the first character is '#', then this line is ignored
Expand Down
74 changes: 42 additions & 32 deletions resources/ui_layout/print.ui
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#logs
page:Perimeters & Shell:shell
group:Vertical shells
setting:label$perimeters:perimeters
setting:width$6:perimeters
setting:spiral_vase
recommended_thin_wall_thickness_description
group:Horizontal shells
Expand Down Expand Up @@ -55,56 +55,62 @@ group:Filtering
setting:resolution
setting:model_precision
setting:slice_closing_radius
group:Modifying slices
group:label_width$8:Modifying slices
line:Curve smoothing
setting:width$6:curve_smoothing_precision
setting:width$6:curve_smoothing_angle_convex
setting:width$6:curve_smoothing_angle_concave
setting:width$6:curve_smoothing_cutoff_dist
end_line
setting:hole_to_polyhole
line:XY compensation
setting:width$6:xy_size_compensation
setting:width$6:elefant_foot_compensation
setting:width$6:hole_size_compensation
end_line
setting:hole_to_polyhole
group:Other
setting:clip_multipart_objects

page:Infill:infill
group:Infill
setting:fill_density
setting:fill_pattern
line:Fill density
setting:label_width$5:label$_:fill_density
end_line
line:Pattern
setting:label_width$5:label$_:fill_pattern
setting:label$don't connect:infill_not_connected
end_line
line:External patterns
setting:top_fill_pattern
setting:bottom_fill_pattern
setting:label_width$5:top_fill_pattern
setting:label_width$5:bottom_fill_pattern
end_line
line:Solid pattern
setting:label_width$5:label$_:solid_fill_pattern
end_line
setting:solid_fill_pattern
setting:infill_not_connected
group:Reducing printing time
setting:infill_every_layers
setting:infill_only_where_needed
line:Supporting dense layer
setting:infill_dense
setting:infill_dense_algo
end_line
group:Advanced
group:sidetext_width$3:Advanced
setting:solid_infill_every_layers
setting:solid_infill_below_area
line:Angle
setting:fill_angle
setting:bridge_angle
setting:label_width$6:width$5:fill_angle
setting:label_width$6:width$5:bridge_angle
end_line
line:Anchor solid infill by X mm
setting:external_infill_margin
setting:bridged_infill_margin
setting:label_width$6:width$5:external_infill_margin
setting:label_width$6:width$5:bridged_infill_margin
end_line
setting:only_retract_when_crossing_perimeters
setting:infill_first
group:Advanced Infill
line:Ironing tuning
setting:fill_smooth_width
setting:fill_smooth_distribution
setting:label_width$6:width$5:fill_smooth_width
setting:label_width$9:width$5:fill_smooth_distribution
end_line

page:Skirt & Brim:skirt+brim
Expand All @@ -119,7 +125,7 @@ group:Brim
setting:brim_width_interior
line:Brim ears
setting:brim_ears
setting:brim_ears_max_angle
setting:width$3:brim_ears_max_angle
end_line

page:Support material:support
Expand Down Expand Up @@ -152,29 +158,33 @@ group:Options for support material interface
setting:support_material_interface_contact_loops

page:Speed:time
group:Speed for print moves
group:label_width$8:Speed for print moves
line:Perimeter speed
setting:perimeter_speed
setting:external_perimeter_speed
setting:small_perimeter_speed
setting:width$4:perimeter_speed
setting:width$4:external_perimeter_speed
setting:width$4:small_perimeter_speed
end_line
line:Infill speed
setting:infill_speed
setting:solid_infill_speed
setting:top_solid_infill_speed
setting:width$4:infill_speed
setting:width$4:solid_infill_speed
setting:width$4:top_solid_infill_speed
end_line
line:Support speed
setting:support_material_speed
setting:support_material_interface_speed
setting:width$4:support_material_speed
setting:width$4:support_material_interface_speed
end_line
line:Bridge speed
setting:label$_:width$4:bridge_speed
end_line
line:Gap fill speed
setting:label$_:width$4:gap_fill_speed
end_line
setting:bridge_speed
setting:gap_fill_speed
group:Speed for non-print moves
setting:travel_speed
group:Modifiers
line:First layer speed
setting:first_layer_speed
setting:first_layer_infill_speed
setting:label_width$8:width$4:first_layer_speed
setting:label_width$8:width$4:first_layer_infill_speed
end_line
group:Acceleration control (advanced)
setting:perimeter_acceleration
Expand Down Expand Up @@ -219,8 +229,8 @@ group:Ooze prevention
group:Wipe tower
setting:wipe_tower
line:Wipe tower position
setting:wipe_tower_x
setting:wipe_tower_y
setting:label_width$3:width$5:sidetext$mm:wipe_tower_x
setting:label_width$3:width$5:sidetext$mm:wipe_tower_y
end_line
setting:wipe_tower_width
setting:wipe_tower_rotation_angle
Expand Down
4 changes: 3 additions & 1 deletion src/libslic3r/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1475,8 +1475,10 @@ class ConfigOptionDef
int height = -1;
// Optional width of an input field.
int width = -1;
// Optional label width of an input field (if in a line).
// Optional label width of the label (if in a line).
int label_width = -1;
// Optional label width of the sidetext (if in a line).
int sidetext_width = -1;
// <min, max> limit of a numeric input.
// If not set, the <min, max> is set to <INT_MIN, INT_MAX>
// By setting min=0, only nonnegative input is allowed.
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloat(0));

def = this->add("brim_ears", coBool);
def->label = L(" ");
def->label = L("");
def->full_label = L("Brim ears");
def->category = OptionCategory::skirtBrim;
def->tooltip = L("Only draw brim over the sharp edges of the model.");
Expand Down Expand Up @@ -669,7 +669,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionBool(false));

def = this->add("perimeter_loop", coBool);
def->label = L(" ");
def->label = L("");
def->full_label = L("Perimeters loop");
def->category = OptionCategory::perimeter;
def->tooltip = L("Join the perimeters to create only one continuous extrusion without any z-hop."
Expand Down
6 changes: 3 additions & 3 deletions src/slic3r/GUI/BedShapeDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ ConfigOptionsGroupShp BedShapePanel::init_shape_options_page(const wxString& tit
wxPanel* panel = new wxPanel(m_shape_options_book);
ConfigOptionsGroupShp optgroup = std::make_shared<ConfigOptionsGroup>(panel, _(L("Settings")));

optgroup->label_width = 10;
optgroup->title_width = 10;
optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
update_shape();
};
Expand All @@ -171,7 +171,7 @@ wxPanel* BedShapePanel::init_texture_panel()
wxPanel* panel = new wxPanel(this);
ConfigOptionsGroupShp optgroup = std::make_shared<ConfigOptionsGroup>(panel, _(L("Texture")));

optgroup->label_width = 10;
optgroup->title_width = 10;
optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
update_shape();
};
Expand Down Expand Up @@ -250,7 +250,7 @@ wxPanel* BedShapePanel::init_model_panel()
wxPanel* panel = new wxPanel(this);
ConfigOptionsGroupShp optgroup = std::make_shared<ConfigOptionsGroup>(panel, _(L("Model")));

optgroup->label_width = 10;
optgroup->title_width = 10;
optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
update_shape();
};
Expand Down
3 changes: 3 additions & 0 deletions src/slic3r/GUI/Field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,9 @@ void SpinCtrl::propagate_value()
void SpinCtrl::msw_rescale()
{
Field::msw_rescale();
auto size = wxSize(wxDefaultSize);
if (m_opt.height >= 0) size.SetHeight(m_opt.height * m_em_unit);
if (m_opt.width >= 0) size.SetWidth(m_opt.width * m_em_unit);

wxSpinCtrl* field = dynamic_cast<wxSpinCtrl*>(window);
field->SetMinSize(wxSize(-1, int(1.9f*field->GetFont().GetPixelSize().y)));
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/GUI_ObjectSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ bool ObjectSettings::update_settings_list()
categories.push_back(cat.first);

auto optgroup = std::make_shared<ConfigOptionsGroup>(m_og->ctrl_parent(), _(toString(cat.first)), config, false, extra_column);
optgroup->label_width = 15;
optgroup->title_width = 15;
optgroup->sidetext_width = 5;

optgroup->m_on_change = [this, config](const t_config_option_key& opt_id, const boost::any& value) {
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/LambdaObjectDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ ConfigOptionsGroupShp LambdaObjectDialog::init_modificator_options_page(const wx

ConfigOptionsGroupShp optgroup;
optgroup = std::make_shared<ConfigOptionsGroup>(panel, _(L("Add")) + " " +title + " " +dots);
optgroup->label_width = 100;
optgroup->title_width = 100;

m_optgroups.push_back(optgroup);

Expand Down
Loading

0 comments on commit 433bd46

Please sign in to comment.