From 7bad550c83c744316930560c05212351a96a4bb6 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 29 Jul 2019 18:02:48 +0200 Subject: [PATCH] Fix of #2326 (Annoying warning dialog when set extrusions > 1mm) --- src/slic3r/GUI/Field.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index e84e9637f..db935cc05 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -193,17 +193,18 @@ void Field::get_value_by_opt_type(wxString& str) show_error(m_parent, _(L("Invalid numeric input."))); set_value(double_to_string(val), true); } - else if (m_opt.sidetext.rfind("mm/s") != std::string::npos && val > m_opt.max || - m_opt.sidetext.rfind("mm ") != std::string::npos && val > 1) + else if ((m_opt.sidetext.rfind("mm/s") != std::string::npos && val > m_opt.max || + m_opt.sidetext.rfind("mm ") != std::string::npos && val > 1) && + (m_value.empty() || std::string(str.ToUTF8().data()) != boost::any_cast(m_value))) { - std::string sidetext = m_opt.sidetext.rfind("mm/s") != std::string::npos ? "mm/s" : "mm"; - const int nVal = int(val); - wxString msg_text = wxString::Format(_(L("Do you mean %d%% instead of %d %s?\n" - "Select YES if you want to change this value to %d%%, \n" - "or NO if you are sure that %d %s is a correct value.")), nVal, nVal, sidetext, nVal, nVal, sidetext); + const std::string sidetext = m_opt.sidetext.rfind("mm/s") != std::string::npos ? "mm/s" : "mm"; + const wxString stVal = double_to_string(val, 2); + const wxString msg_text = wxString::Format(_(L("Do you mean %s%% instead of %s %s?\n" + "Select YES if you want to change this value to %s%%, \n" + "or NO if you are sure that %s %s is a correct value.")), stVal, stVal, sidetext, stVal, stVal, sidetext); auto dialog = new wxMessageDialog(m_parent, msg_text, _(L("Parameter validation")), wxICON_WARNING | wxYES | wxNO); if (dialog->ShowModal() == wxID_YES) { - set_value(wxString::Format("%s%%", str), true); + set_value(wxString::Format("%s%%", stVal), false/*true*/); str += "%%"; } }