From 3eb63c93e1626348876dee23cab570d0e6964f1d Mon Sep 17 00:00:00 2001 From: YuSanka <yusanka@gmail.com> Date: Wed, 16 Dec 2020 13:07:27 +0100 Subject: [PATCH] Follow-up to https://github.com/prusa3d/PrusaSlicer/commit/f37b9c4d515d7f50e91ea499be59315231e90cb4: Fix for issues: Issue 1: 1. Change "Extrusion multiplier" parameter, 2. Save edited preset. 3. Change "Extrusion multiplier" parameter -> preset wasn't marked as "modified" Issue 2: 1. Change "Extrusion multiplier" parameter with out of range value 2. Push ENTER for the message dialog 3. Answer "Yes" 4. Same message dialog appears again --- src/slic3r/GUI/Field.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 85c043c3b..1575096ba 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -265,11 +265,13 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true set_value(double_to_string(val), true); }; if (m_opt_id == "extrusion_multiplier") { - wxString msg_text = format_wxstr(_L("Input value is out of range\n" - "Are you sure that %s is a correct value and 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 (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 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); + } } else { show_error(m_parent, _L("Input value is out of range")); @@ -573,13 +575,8 @@ void TextCtrl::propagate_value() // on_kill_focus() cause a call of OptionsGroup::reload_config(), // Thus, do it only when it's really needed (when undefined value was input) on_kill_focus(); - else if (value_was_changed() && m_on_change != nullptr && !m_disable_change_event) { - // For this moment m_value is already updated in value_was_changed() - // so instead of call on_change_field() { m_on_change(m_opt_id, get_value()); } - // just do next: - m_on_change(m_opt_id, m_value); -// on_change_field(); // #ysFIXME delete after testing - } + else if (value_was_changed()) + on_change_field(); } void TextCtrl::set_value(const boost::any& value, bool change_event/* = false*/) {