index 5f59eff8fb89bf55dc49d0fa2b861faa155302c6..46532d35848aa15bf60b058aefef51e511c8dac4 100644 (file)
//====================================================
RegisteredCheckButton::RegisteredCheckButton()
-: _button(0)
+: _button(0),
+ setProgrammatically(false)
{
}
@@ -109,16 +110,23 @@ RegisteredCheckButton::init (const Glib::ustring& label, const Glib::ustring& ti
void
RegisteredCheckButton::setActive (bool b)
{
+// FIXME: for some reason, this function is also called when user clicks. then setProgrammatically should not be set!
+ setProgrammatically = true;
_button->set_active (b);
- //The slave button is greyed out if the master button is unchecked
- for (std::list<Gtk::ToggleButton*>::const_iterator i = _slavebuttons.begin(); i != _slavebuttons.end(); i++) {
- (*i)->set_sensitive(b);
- }
+ //The slave button is greyed out if the master button is unchecked
+ for (std::list<Gtk::ToggleButton*>::const_iterator i = _slavebuttons.begin(); i != _slavebuttons.end(); i++) {
+ (*i)->set_sensitive(b);
+ }
}
void
RegisteredCheckButton::on_toggled()
{
+ if (setProgrammatically) {
+ setProgrammatically = false;
+ return;
+ }
+
if (_wr->isUpdating())
return;
RegisteredScalarUnit::setValue (double val)
{
_widget->setValue (val);
- on_value_changed();
}
void
RegisteredScalarUnit::on_value_changed()
{
+ if (_widget->setProgrammatically) {
+ _widget->setProgrammatically = false;
+ return;
+ }
+
if (_wr->isUpdating())
return;
RegisteredScalar::setValue (double val)
{
_widget->setValue (val);
- on_value_changed();
}
void
RegisteredScalar::on_value_changed()
{
+ if (_widget->setProgrammatically) {
+ _widget->setProgrammatically = false;
+ return;
+ }
+
if (_wr->isUpdating()) {
return;
}
}
RegisteredSuffixedInteger::RegisteredSuffixedInteger()
-: _label(0), _sb(0),
+: _label(0),
+ setProgrammatically(false),
+ _sb(0),
_adj(0.0,0.0,100.0,1.0,1.0,1.0),
_suffix(0)
{
@@ -404,12 +422,18 @@ RegisteredSuffixedInteger::init (const Glib::ustring& label, const Glib::ustring
void
RegisteredSuffixedInteger::setValue (int i)
{
+ setProgrammatically = true;
_adj.set_value (i);
}
void
RegisteredSuffixedInteger::on_value_changed()
{
+ if (setProgrammatically) {
+ setProgrammatically = false;
+ return;
+ }
+
if (_wr->isUpdating())
return;
}
RegisteredRadioButtonPair::RegisteredRadioButtonPair()
-: _hbox(0)
+: _hbox(0),
+ setProgrammatically(false)
{
}
@@ -458,6 +483,7 @@ const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument
void
RegisteredRadioButtonPair::setValue (bool second)
{
+ setProgrammatically = true;
if (second) _rb2->set_active();
else _rb1->set_active();
}
void
RegisteredRadioButtonPair::on_value_changed()
{
+ if (setProgrammatically) {
+ setProgrammatically = false;
+ return;
+ }
+
if (_wr->isUpdating())
return;
RegisteredPoint::setValue (double xval, double yval)
{
_widget->setValue(xval, yval);
- on_value_changed();
}
void
RegisteredPoint::on_value_changed()
{
+ if (_widget->setProgrammatically()) {
+ _widget->clearProgrammatically();
+ return;
+ }
+
if (_wr->isUpdating())
return;
{
_widget->setValue (val);
_widget->setStartSeed(startseed);
- on_value_changed();
}
void
RegisteredRandom::on_value_changed()
{
+ if (_widget->setProgrammatically) {
+ _widget->setProgrammatically = false;
+ return;
+ }
+
if (_wr->isUpdating())
return;
_wr->setUpdating (true);