From 64e68f418b94e5f63226b78e553fc3e121ea9454 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 16 Dec 2020 20:04:14 +0100 Subject: Follow-up to https://github.com/prusa3d/PrusaSlicer/commit/3eb63c93e1626348876dee23cab570d0e6964f1d: If value for "Extrusion Multiplier" is out of range, and "NO" is selected in warning message dialog, then set previous value instead of max limit value --- src/slic3r/GUI/Field.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index d29579016..4eae3e36e 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -259,23 +259,27 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true m_value.clear(); break; } - auto set_val = [this](double& val) { - if (m_opt.min > val) val = m_opt.min; - if (val > m_opt.max) val = m_opt.max; - set_value(double_to_string(val), true); - }; if (m_opt_id == "extrusion_multiplier") { if (m_value.empty() || boost::any_cast(m_value) != val) { wxString msg_text = format_wxstr(_L("Input value is out of range\n" "Are you sure that %s is a correct value and that you want to continue?"), str); wxMessageDialog dialog(m_parent, msg_text, _L("Parameter validation") + ": " + m_opt_id, wxICON_WARNING | wxYES | wxNO); - if (dialog.ShowModal() == wxID_NO) - set_val(val); + if (dialog.ShowModal() == wxID_NO) { + if (m_value.empty()) { + if (m_opt.min > val) val = m_opt.min; + if (val > m_opt.max) val = m_opt.max; + } + else + val = boost::any_cast(m_value); + set_value(double_to_string(val), true); + } } } else { show_error(m_parent, _L("Input value is out of range")); - set_val(val); + if (m_opt.min > val) val = m_opt.min; + if (val > m_opt.max) val = m_opt.max; + set_value(double_to_string(val), true); } } } -- cgit v1.2.3