Implemented update of the override filaments options from/to config

This commit is contained in:
YuSanka 2019-07-28 22:00:39 +02:00
parent ab2519cde4
commit 40a576a8ad
7 changed files with 189 additions and 105 deletions

View file

@ -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;