diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index e4e79328778..3eb8a474347 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -1200,7 +1200,7 @@ class ConfigOptionPercentsTempl : public ConfigOptionFloatsTempl if (&v != &this->values.front()) ss << ","; this->serialize_single_value(ss, v); - if (! (std::isnan(v) || v == NIL_VALUE())) + if (!(std::isnan(v) || v == ConfigOptionFloatsTempl::NIL_VALUE())) ss << "%"; } std::string str = ss.str(); @@ -1214,7 +1214,7 @@ class ConfigOptionPercentsTempl : public ConfigOptionFloatsTempl for (const double v : this->values) { std::ostringstream ss; this->serialize_single_value(ss, v); - if (! (std::isnan(v) || v == NIL_VALUE())) + if (!(std::isnan(v) || v == ConfigOptionFloatsTempl::NIL_VALUE())) ss << "%"; vv.push_back(ss.str()); } diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index e8af859eeb3..e86455ad91f 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -385,12 +385,13 @@ std::pair any_to_wxstring(const boost::any &value, const ConfigO }; // first, easy convert-to one-string switch (opt.type) { - case coFloats: + case coFloats: { if (opt_idx < 0) { deserialize(ConfigOptionFloats{}); break; } - case coPercents: + } + case coPercents: { if (opt_idx < 0) { deserialize(ConfigOptionPercents{}); break; @@ -400,23 +401,31 @@ std::pair any_to_wxstring(const boost::any &value, const ConfigO has_nil = true; break; } + } case coFloat: - case coPercent: text_value = double_to_string(boost::any_cast(value), opt.precision); break; - case coStrings: + case coPercent: { + text_value = double_to_string(boost::any_cast(value), opt.precision); + break; + } + case coStrings: { if (opt_idx < 0) { - //custom for strings, as we don't need the serialized form, the normal one with ';' in-between is enough + // custom for strings, as we don't need the serialized form, the normal one with ';' in-between is enough ConfigOptionStrings reader; reader.set_any(value, opt_idx); std::string good_str; for (std::string s : reader.values) good_str += s + ";"; - if(!good_str.empty()) + if (!good_str.empty()) good_str.pop_back(); text_value = good_str; break; } // can't be nullable - case coString: text_value = boost::any_cast(value); break; - case coFloatsOrPercents: + } + case coString: { + text_value = boost::any_cast(value); + break; + } + case coFloatsOrPercents: { if (opt_idx < 0) { deserialize(ConfigOptionFloatsOrPercents{}); break; @@ -427,13 +436,15 @@ std::pair any_to_wxstring(const boost::any &value, const ConfigO has_nil = true; break; } - case coFloatOrPercent: + } + case coFloatOrPercent: { FloatOrPercent fl_or_per = boost::any_cast(value); text_value = double_to_string(fl_or_per.value); if (fl_or_per.percent) text_value.append("%"); break; - case coBools: + } + case coBools: { if (opt_idx < 0) { deserialize(ConfigOptionBools{}); } else { @@ -445,12 +456,14 @@ std::pair any_to_wxstring(const boost::any &value, const ConfigO text_value = boost::any_cast(value) != 0 ? "true" : "false"; } break; - case coBool: + } + case coBool: { if (opt.is_script) text_value = boost::any_cast(value) != 0 ? "true" : "false"; else text_value = boost::any_cast(value) ? "true" : "false"; - case coInts: + } + case coInts: { if (opt_idx < 0) { deserialize(ConfigOptionInts{}); break; @@ -460,14 +473,21 @@ std::pair any_to_wxstring(const boost::any &value, const ConfigO has_nil = true; break; } - case coInt: text_value = wxString::Format(_T("%i"), int(boost::any_cast(value))); break; + } + case coInt: { + text_value = wxString::Format(_T("%i"), int(boost::any_cast(value))); + break; + } case coPoints: if (opt_idx < 0) { deserialize(ConfigOptionPoints{}); assert(text_value == get_points_string(boost::any_cast>(value))); break; } - case coPoint: text_value = get_points_string({boost::any_cast(value)}); + case coPoint: { + text_value = get_points_string({boost::any_cast(value)}); + break; + } } return {text_value, has_nil}; } @@ -2308,6 +2328,8 @@ boost::any &SliderCtrl::get_value() } else if (m_opt.type == coInt) { return m_value = int32_t(m_slider->GetValue() / m_scale); } + assert(false); + return m_value; } } // GUI