diff options
author | YuSanka <yusanka@gmail.com> | 2020-12-16 22:04:14 +0300 |
---|---|---|
committer | YuSanka <yusanka@gmail.com> | 2020-12-16 22:14:47 +0300 |
commit | 64e68f418b94e5f63226b78e553fc3e121ea9454 (patch) | |
tree | 16d5e45202d2937a943b8883d93156ee25aff2ab /src | |
parent | 642223dadcab132795c17ac53cd618bace2930b5 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/slic3r/GUI/Field.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
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<double>(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<double>(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); } } } |