some fixes on setting layout

This commit is contained in:
supermerill 2020-11-23 23:27:10 +01:00
parent 7a10e8220c
commit e0d6a95bab
5 changed files with 35 additions and 12 deletions

View File

@ -35,19 +35,20 @@ each parameter is separated by ':'
* EVENT can be extruders_count_event (TabPrinter only), silent_mode_event (TabPrinter only), material_density_event. * 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. * nolabel is used to remove the left column, where labels are draw.
* Line: * Line:
line:STR line:STR*
* setting: * setting:
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 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. * 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$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. * label_width$INT: change the width of the label. Only works if it's in a line. Override the group one. -1 for auto.
* full_label: to override the label by the "full one". * full_label: to override the label by the "full one".
* full_width: to tell to create a field that span the full width. * 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$STR: the suffix at the right of the widget (like 'mm').
* sidetext_width$INT: the suffix label length (override the group one). -& for auto. * sidetext_width$INT: the suffix label length (override the group one). -1 for auto.
* simple|advanced|expert: add one of these to modify the mode in which this setting appear. * 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. * 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. * height$INT: change the height of the field. Don't works with every type of setting.
* url$STR: the url to call when clicking on it.
* id $INT: for setting only a single value of a setting array. * id $INT: for setting only a single value of a setting array.
* idx: for setting only a single value of a setting array, with the index of the page (for extruder ui page) * idx: for setting only a single value of a setting array, with the index of the page (for extruder ui page)
* recommended_thin_wall_thickness_description: create a text widget to explain recommended thin wall thickness (only in a fff print tab). * recommended_thin_wall_thickness_description: create a text widget to explain recommended thin wall thickness (only in a fff print tab).

View File

@ -372,6 +372,9 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
for (auto el : { "thin_walls_min_width", "thin_walls_overlap" }) for (auto el : { "thin_walls_min_width", "thin_walls_overlap" })
toggle_field(el, config->opt_bool("thin_walls")); toggle_field(el, config->opt_bool("thin_walls"));
for (auto el : { "seam_angle_cost", "seam_travel_cost" })
toggle_field(el, config->option<ConfigOptionEnum<SeamPosition>>("seam_position")->value == SeamPosition::spNearest);
toggle_field("perimeter_loop_seam", config->opt_bool("perimeter_loop")); toggle_field("perimeter_loop_seam", config->opt_bool("perimeter_loop"));
toggle_field("gap_fill_min_area", config->opt_bool("gap_fill")); toggle_field("gap_fill_min_area", config->opt_bool("gap_fill"));

View File

@ -191,7 +191,8 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
config.set_key_value(opt_key, new ConfigOptionEnum<GCodeFlavor>(boost::any_cast<GCodeFlavor>(value))); config.set_key_value(opt_key, new ConfigOptionEnum<GCodeFlavor>(boost::any_cast<GCodeFlavor>(value)));
else if (opt_key.compare("host_type") == 0) else if (opt_key.compare("host_type") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<PrintHostType>(boost::any_cast<PrintHostType>(value))); config.set_key_value(opt_key, new ConfigOptionEnum<PrintHostType>(boost::any_cast<PrintHostType>(value)));
else if (opt_key.compare("infill_connection") == 0) else if (opt_key =="infill_connection" || opt_key =="infill_connection_solid"
|| opt_key =="infill_connection_top" || opt_key =="infill_connection_bottom")
config.set_key_value(opt_key, new ConfigOptionEnum<InfillConnection>(boost::any_cast<InfillConnection>(value))); config.set_key_value(opt_key, new ConfigOptionEnum<InfillConnection>(boost::any_cast<InfillConnection>(value)));
else if (opt_key.compare("infill_dense_algo") == 0) else if (opt_key.compare("infill_dense_algo") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<DenseInfillAlgo>(boost::any_cast<DenseInfillAlgo>(value))); config.set_key_value(opt_key, new ConfigOptionEnum<DenseInfillAlgo>(boost::any_cast<DenseInfillAlgo>(value)));

View File

@ -150,6 +150,9 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
break; 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);
// If we have a single option with no sidetext // If we have a single option with no sidetext
const std::vector<Option>& option_set = line.get_options(); const std::vector<Option>& option_set = line.get_options();
if (option_set.size() == 1 && option_set.front().opt.sidetext.size() == 0 && if (option_set.size() == 1 && option_set.front().opt.sidetext.size() == 0 &&
@ -180,7 +183,7 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
if (!no_dots) if (!no_dots)
label += ":"; label += ":";
if (!label.empty()) { if (!label.empty() || option.label_width > 0) {
wxCoord label_w, label_h; wxCoord label_w, label_h;
#ifdef __WXMSW__ #ifdef __WXMSW__
// when we use 2 monitors with different DPIs, GetTextExtent() return value for the primary display // when we use 2 monitors with different DPIs, GetTextExtent() return value for the primary display
@ -222,6 +225,11 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
h_pos += m_h_gap; h_pos += m_h_gap;
} }
} }
//round it to next m_em_unit
h_pos += (h_pos % m_em_unit == 0) ? 0 : m_em_unit - (h_pos % m_em_unit);
// size of little widget before the real one
h_pos += 2 * blinking_button_width; h_pos += 2 * blinking_button_width;
if (field == field_in) if (field == field_in)
@ -236,7 +244,7 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
} }
} }
} else } else
h_pos += field->getWindow()->GetSize().x; h_pos += field->getWindow()->GetSize().x + m_h_gap;
if (option_set.size() == 1 && option_set.front().opt.full_width) if (option_set.size() == 1 && option_set.front().opt.full_width)
break; break;
@ -557,6 +565,9 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos)
return; return;
} }
//round it to next m_em_unit
h_pos += (h_pos % ctrl->m_em_unit == 0) ? 0 : ctrl->m_em_unit - (h_pos % ctrl->m_em_unit);
// If we're here, we have more than one option or a single option with sidetext // If we're here, we have more than one option or a single option with sidetext
// so we need a horizontal sizer to arrange these things // so we need a horizontal sizer to arrange these things
@ -589,7 +600,7 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos)
bool no_dots = label.empty() || option.label.back() == '_'; bool no_dots = label.empty() || option.label.back() == '_';
if (!no_dots) if (!no_dots)
label += ":"; label += ":";
if (!label.empty()) { if (!label.empty() || option.label_width > 0) {
int width = ctrl->opt_group->sublabel_width * ctrl->m_em_unit; int width = ctrl->opt_group->sublabel_width * ctrl->m_em_unit;
if (option.label_width >= 0) { if (option.label_width >= 0) {
if (option.label_width != 0) { if (option.label_width != 0) {
@ -609,6 +620,9 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos)
} }
} }
//round it to next m_em_unit
h_pos += (h_pos % ctrl->m_em_unit == 0 ) ? 0 : ctrl->m_em_unit - (h_pos % ctrl->m_em_unit);
if (field && field->undo_to_sys_bitmap()) { if (field && field->undo_to_sys_bitmap()) {
h_pos = draw_act_bmps(dc, wxPoint(h_pos, v_pos), field->undo_to_sys_bitmap()->bmp(), field->undo_bitmap()->bmp(), field->blink(), bmp_rect_id++); h_pos = draw_act_bmps(dc, wxPoint(h_pos, v_pos), field->undo_to_sys_bitmap()->bmp(), field->undo_bitmap()->bmp(), field->blink(), bmp_rect_id++);
if (field->getSizer()) if (field->getSizer())

View File

@ -1698,6 +1698,10 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page)
} }
Option option = current_group->get_option(setting_id, id); Option option = current_group->get_option(setting_id, id);
if (current_group->label_width >= 0)
option.opt.label_width = current_group->label_width;
if (current_group->sidetext_width >= 0)
option.opt.sidetext_width = current_group->sidetext_width;
bool colored = false; bool colored = false;
wxString label_path; wxString label_path;