diff options
author | YuSanka <yusanka@gmail.com> | 2019-07-28 23:00:39 +0300 |
---|---|---|
committer | YuSanka <yusanka@gmail.com> | 2019-07-28 23:00:39 +0300 |
commit | 40a576a8adb73e755fcdb0a4a8d6331e1ffa098a (patch) | |
tree | 6449c71bc4c2bc2efc66b45c90d758ae01cbb5f9 /src/slic3r/GUI/Field.hpp | |
parent | ab2519cde43cb5de6547c1b43eff0894daaad5a2 (diff) |
Implemented update of the override filaments options from/to config
Diffstat (limited to 'src/slic3r/GUI/Field.hpp')
-rw-r--r-- | src/slic3r/GUI/Field.hpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/slic3r/GUI/Field.hpp b/src/slic3r/GUI/Field.hpp index 990c40e6f..6dbf4af06 100644 --- a/src/slic3r/GUI/Field.hpp +++ b/src/slic3r/GUI/Field.hpp @@ -123,6 +123,8 @@ public: /// subclasses should overload with a specific version /// Postcondition: Method does not fire the on_change event. virtual void set_value(const boost::any& value, bool change_event) = 0; + virtual void set_last_meaningful_value() {} + virtual void set_na_value() {} /// Gets a boost::any representing this control. /// subclasses should overload with a specific version @@ -247,6 +249,8 @@ protected: // current value boost::any m_value; + // last maeningful value + boost::any m_last_meaningful_value; int m_em_unit; @@ -289,9 +293,14 @@ public: virtual void set_value(const boost::any& value, bool change_event = false) { m_disable_change_event = !change_event; dynamic_cast<wxTextCtrl*>(window)->SetValue(boost::any_cast<wxString>(value)); + if (boost::any_cast<wxString>(value) != "nan") + m_last_meaningful_value = value; m_disable_change_event = false; } + virtual void set_last_meaningful_value() override; + virtual void set_na_value() override; + boost::any& get_value() override; void msw_rescale() override; @@ -303,6 +312,7 @@ public: class CheckBox : public Field { using Field::Field; + bool m_is_na_val {false}; public: CheckBox(const ConfigOptionDef& opt, const t_config_option_key& id) : Field(opt, id) {} CheckBox(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : Field(parent, opt, id) {} @@ -316,11 +326,9 @@ public: dynamic_cast<wxCheckBox*>(window)->SetValue(value); m_disable_change_event = false; } - void set_value(const boost::any& value, bool change_event = false) { - m_disable_change_event = !change_event; - dynamic_cast<wxCheckBox*>(window)->SetValue(boost::any_cast<bool>(value)); - m_disable_change_event = false; - } + void set_value(const boost::any& value, bool change_event = false) override; + void set_last_meaningful_value() override; + void set_na_value() override; boost::any& get_value() override; void msw_rescale() override; |