Partially ported ff195fc9(Add max_literal to setting def, to set the threshold for popup warning for float% fields) from @SuperSlicer

(related to https://github.com/prusa3d/PrusaSlicer/issues/2829#issuecomment-955606863)
This commit is contained in:
YuSanka 2021-11-16 13:44:31 +01:00
parent cb44542377
commit 1aaa4845c5
3 changed files with 16 additions and 2 deletions
src/slic3r/GUI

View file

@ -315,7 +315,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
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)) &&
(m_opt.sidetext.rfind("mm ") != std::string::npos && val > /*1*/m_opt.max_literal)) &&
(m_value.empty() || std::string(str.ToUTF8().data()) != boost::any_cast<std::string>(m_value)))
{
if (!check_value) {
@ -330,7 +330,6 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
const wxString msg_text = from_u8((boost::format(_utf8(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).str());
// wxMessageDialog dialog(m_parent, msg_text, _(L("Parameter validation")) + ": " + m_opt_id , wxICON_WARNING | wxYES | wxNO);
WarningDialog dialog(m_parent, msg_text, _L("Parameter validation") + ": " + m_opt_id, wxYES | wxNO);
if ((!infill_anchors || val > 100) && dialog.ShowModal() == wxID_YES) {
set_value(from_u8((boost::format("%s%%") % stVal).str()), false/*true*/);