Added a check that first layer height is not expressed as a percentage (related to https://github.com/prusa3d/PrusaSlicer/issues/7418)
first_layer_height cannot be changed to ConfigOptionFloat, that would break loading of old 3MFs. The relative values from 3MFs should already be converted to absolute in `Preset::normalize`, what is missing is the UI check. + Code refactoring for OptionsGroup::create_single_option_line(): Don't clear label value in an Option. This value is used in Field::get_value_by_opt_type() to show error "%s doesn't support percentage". => At functions OG_CustomCtrl::CtrlLine::render() and OG_CustomCtrl::CtrlLine::get_pos() added check if current line has more than one option. => Draw option's label only when line has several options.
This commit is contained in:
@@ -167,13 +167,14 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
|
||||
break;
|
||||
}
|
||||
|
||||
bool is_multioption_line = option_set.size() > 1;
|
||||
for (auto opt : option_set) {
|
||||
Field* field = opt_group->get_field(opt.opt_id);
|
||||
correct_line_height(ctrl_line.height, field->getWindow());
|
||||
|
||||
ConfigOptionDef option = opt.opt;
|
||||
// add label if any
|
||||
if (!option.label.empty()) {
|
||||
if (is_multioption_line && !option.label.empty()) {
|
||||
//! To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
|
||||
label = (option.label == L_CONTEXT("Top", "Layers") || option.label == L_CONTEXT("Bottom", "Layers")) ?
|
||||
_CTX(option.label, "Layers") : _(option.label);
|
||||
@@ -595,11 +596,12 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos)
|
||||
}
|
||||
|
||||
size_t bmp_rect_id = 0;
|
||||
bool is_multioption_line = option_set.size() > 1;
|
||||
for (const Option& opt : option_set) {
|
||||
field = ctrl->opt_group->get_field(opt.opt_id);
|
||||
ConfigOptionDef option = opt.opt;
|
||||
// add label if any
|
||||
if (!option.label.empty()) {
|
||||
if (is_multioption_line && !option.label.empty()) {
|
||||
//! To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
|
||||
label = (option.label == L_CONTEXT("Top", "Layers") || option.label == L_CONTEXT("Bottom", "Layers")) ?
|
||||
_CTX(option.label, "Layers") : _(option.label);
|
||||
|
||||
Reference in New Issue
Block a user