Fix double undo/redo snapshot when using SpinCtrl

This commit is contained in:
Lukas Matena 2022-06-08 14:38:23 +02:00
parent 60894a26dd
commit 48e1919ff1
2 changed files with 2 additions and 4 deletions

View file

@ -877,10 +877,10 @@ void SpinCtrl::BUILD() {
void SpinCtrl::propagate_value()
{
if (suppress_propagation)
// check if value was really changed
if (boost::any_cast<int>(m_value) == tmp_value)
return;
suppress_propagation = true;
if (tmp_value == UNDEF_VALUE) {
on_kill_focus();
} else {
@ -894,7 +894,6 @@ void SpinCtrl::propagate_value()
#endif
on_change_field();
}
suppress_propagation = false;
}
void SpinCtrl::msw_rescale()

View file

@ -302,7 +302,6 @@ class SpinCtrl : public Field {
private:
static const int UNDEF_VALUE = INT_MIN;
bool suppress_propagation {false};
public:
SpinCtrl(const ConfigOptionDef& opt, const t_config_option_key& id) : Field(opt, id), tmp_value(UNDEF_VALUE) {}
SpinCtrl(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : Field(parent, opt, id), tmp_value(UNDEF_VALUE) {}