From 30c380c70f8107d82b812f4f178cafdc24faf8c4 Mon Sep 17 00:00:00 2001 From: supermerill Date: Sun, 26 Sep 2021 21:09:13 +0200 Subject: [PATCH] Add label_left option for setting ui to print the label aligned to the left instead of the right Better spacing for infill lines, allowing larger infill % field fix supermerill/SuperSlicer#1573 --- resources/ui_layout/Readme.md | 7 ++++--- resources/ui_layout/filament.ui | 4 ++-- resources/ui_layout/print.ui | 24 ++++++++++++------------ resources/ui_layout/print.ui.legacy | 2 +- resources/ui_layout/printer_fff.ui | 16 ++++++++-------- resources/ui_layout/printer_sla.ui | 2 +- resources/ui_layout/sla_material.ui | 2 +- src/libslic3r/Config.hpp | 2 ++ src/slic3r/GUI/OG_CustomCtrl.cpp | 13 +++++++++++-- src/slic3r/GUI/OptionsGroup.hpp | 3 ++- src/slic3r/GUI/Tab.cpp | 21 ++++++++++++++------- src/slic3r/GUI/Tab.hpp | 2 +- 12 files changed, 59 insertions(+), 39 deletions(-) diff --git a/resources/ui_layout/Readme.md b/resources/ui_layout/Readme.md index 16556604a..27a097fe0 100644 --- a/resources/ui_layout/Readme.md +++ b/resources/ui_layout/Readme.md @@ -27,13 +27,13 @@ each parameter is separated by ':' * first STR is for the label and the second for the icon, with or without the .svg / .png * idx: append the index of the page (for extruder ui) to the name * Group: - group[:nolabel][:title_width$INT][:label_width$INT][:sidetext_width$INT][:EVENT][:id$INT][:idx]:STR + group[:no_title][:title_width$INT][:label_width$INT][:sidetext_width$INT][:EVENT][:id$INT][:idx]: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. - * title_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 titles 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. + * no_title is used to remove the left column, where titles are draw. * Line: line:STR* * setting: @@ -41,6 +41,7 @@ each parameter is separated by ':' * STR, the last parameter: the id name of the 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. -1 for auto. + * label_left: Draw the label aligned to the left instead of the right. * full_label$STR: to override the full_label by this new one (full_label is used on modifiers). * full_label: to override the label by the "full one". * full_width: to tell to create a field that span the full width. diff --git a/resources/ui_layout/filament.ui b/resources/ui_layout/filament.ui index daed21468..f6fd8931d 100644 --- a/resources/ui_layout/filament.ui +++ b/resources/ui_layout/filament.ui @@ -86,9 +86,9 @@ group:Toolchange parameters with single extruder MM printers filament_overrides_page page:Custom G-code:cog -group:nolabel:Start G-code +group:no_title:Start G-code setting:full_width:height$35:start_filament_gcode -group:nolabel:End G-code +group:no_title:End G-code setting:full_width:height$35:end_filament_gcode page:Notes:note.png diff --git a/resources/ui_layout/print.ui b/resources/ui_layout/print.ui index ee297ffab..f4c7b943d 100644 --- a/resources/ui_layout/print.ui +++ b/resources/ui_layout/print.ui @@ -114,26 +114,26 @@ group:Other setting:allow_empty_layers page:Infill:infill -group:title_width$8:Infill - line:Sparse - setting:width$5:label$_:sidetext_width$1:fill_density - setting:label_width$1:label$_:fill_pattern +group:title_width$0:Infill + line:_ + setting:label_left:label_width$6:label$Sparse:width$8:sidetext_width$1:fill_density + setting:label_width$0:label$_:fill_pattern setting:label$_:width$18:infill_connection end_line line:_ - setting:label$Connection length:label_width$20:sidetext_width$7:width$12:infill_anchor_max + setting:label$Connection length:label_width$25:sidetext_width$7:width$12:infill_anchor_max setting:label$Perimeter anchor:sidetext_width$7:width$12:infill_anchor end_line - line:Solid - setting:label_width$11:label$_:solid_fill_pattern + line:_ + setting:label_left:label_width$20:label$Solid:solid_fill_pattern setting:label$_:width$18:infill_connection_solid end_line - line:Top - setting:label_width$11:label$_:top_fill_pattern + line:_ + setting:label_left:label_width$20:label$Top:top_fill_pattern setting:label$_:width$18:infill_connection_top end_line - line:Bottom - setting:label_width$11:label$_:bottom_fill_pattern + line:_ + setting:label_left:label_width$20:label$Bottom:bottom_fill_pattern setting:label$_:width$18:infill_connection_bottom end_line group:Reducing printing time @@ -382,7 +382,7 @@ group:Post-processing script setting:full_width:height$5:post_process page:Notes:note -group:nolabel:Notes +group:no_title:Notes setting:full_width:height$25:notes page:Dependencies:wrench diff --git a/resources/ui_layout/print.ui.legacy b/resources/ui_layout/print.ui.legacy index c314efb93..f1bff6060 100644 --- a/resources/ui_layout/print.ui.legacy +++ b/resources/ui_layout/print.ui.legacy @@ -226,7 +226,7 @@ group:Post-processing scripts setting:full_width:height$5:post_process page:Notes:note -group:nolabel:Notes +group:no_title:Notes setting:full_width:height$25:notes page:Dependencies:wrench diff --git a/resources/ui_layout/printer_fff.ui b/resources/ui_layout/printer_fff.ui index 4cba9879d..40e4ddcc2 100644 --- a/resources/ui_layout/printer_fff.ui +++ b/resources/ui_layout/printer_fff.ui @@ -51,24 +51,24 @@ page:Custom G-code:cog group: setting:start_gcode_manual height:15 -group:nolabel:Start G-code +group:no_title:Start G-code setting:full_width:start_gcode -group:nolabel:End G-code +group:no_title:End G-code setting:full_width:end_gcode -group:nolabel:Before layer change G-code +group:no_title:Before layer change G-code setting:full_width:before_layer_gcode -group:nolabel:After layer change G-code +group:no_title:After layer change G-code setting:full_width:layer_gcode -group:nolabel:Tool change G-code +group:no_title:Tool change G-code setting:full_width:toolchange_gcode -group:nolabel:Between objects G-code (for sequential printing) +group:no_title:Between objects G-code (for sequential printing) setting:full_width:between_objects_gcode -group:nolabel:Between extrusion role change G-code +group:no_title:Between extrusion role change G-code setting:full_width:feature_gcode height:0 page:Notes:note.png -group:nolabel:Notes +group:no_title:Notes setting:full_width:height$25:printer_notes page:Dependencies:wrench.png diff --git a/resources/ui_layout/printer_sla.ui b/resources/ui_layout/printer_sla.ui index 26337655c..a8c4d0ac6 100644 --- a/resources/ui_layout/printer_sla.ui +++ b/resources/ui_layout/printer_sla.ui @@ -55,7 +55,7 @@ group:Print Host upload build_printhost page:Notes:note.png -group:nolabel:Notes +group:no_title:Notes setting:full_width:height$25:printer_notes page:Dependencies:wrench.png diff --git a/resources/ui_layout/sla_material.ui b/resources/ui_layout/sla_material.ui index 2322768f6..29ef5bad3 100644 --- a/resources/ui_layout/sla_material.ui +++ b/resources/ui_layout/sla_material.ui @@ -20,7 +20,7 @@ group:label_width$19:Corrections end_line page:Notes:note -group:label_width$0:nolabel:Notes +group:label_width$0:no_title:Notes setting:full_width:height$25:material_notes page:Dependencies:wrench diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index e257b4ade..e9c6b7a67 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -1828,6 +1828,8 @@ public: int width = -1; // Optional label width of the label (if in a line). int label_width = -1; + // Optional label alignement to the left instead of the right + bool aligned_label_left = false; // Optional label width of the sidetext (if in a line). int sidetext_width = -1; // limit of a numeric input. diff --git a/src/slic3r/GUI/OG_CustomCtrl.cpp b/src/slic3r/GUI/OG_CustomCtrl.cpp index b989c8661..4562f6b92 100644 --- a/src/slic3r/GUI/OG_CustomCtrl.cpp +++ b/src/slic3r/GUI/OG_CustomCtrl.cpp @@ -98,7 +98,10 @@ void OG_CustomCtrl::init_ctrl_lines() ctrl_lines.emplace_back(CtrlLine(height, this, line, false, opt_group->staticbox)); } else - int i = 0; + { + height = m_bmp_blinking_sz.GetHeight() + m_v_gap; + ctrl_lines.emplace_back(CtrlLine(height, this, line, opt_group->no_title, opt_group->staticbox)); + } } } @@ -135,6 +138,9 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/) break; } + //round it to next m_em_unit + h_pos += (h_pos % m_em_unit == 0) ? 0 : m_em_unit - (h_pos % m_em_unit); + wxString label = line.label; if (opt_group->title_width != 0) h_pos += opt_group->title_width * m_em_unit + m_h_gap; @@ -556,6 +562,9 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos) const std::vector