Implemented a support of the coFloatsOrPercents values on settings tabs

This commit is contained in:
YuSanka 2022-12-12 17:12:48 +01:00 committed by Pavel Mikuš
parent f730fd21d4
commit f04545f1e6
10 changed files with 95 additions and 38 deletions

View file

@ -54,6 +54,7 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
default:
switch (opt.type) {
case coFloatOrPercent:
case coFloatsOrPercents:
case coFloat:
case coFloats:
case coPercent:
@ -867,6 +868,14 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
ret = text_value;
break;
}
case coFloatsOrPercents:{
const auto& val = config.option<ConfigOptionFloatsOrPercents>(opt_key)->get_at(idx);
text_value = double_to_string(val.value);
if (val.percent)
text_value += "%";
ret = text_value;
break;
}
case coPercent:{
double val = config.option<ConfigOptionPercent>(opt_key)->value;
text_value = wxString::Format(_T("%i"), int(val));