index c2c7e593c22d3289a0da6ad69d07d70af39628bb..46532d35848aa15bf60b058aefef51e511c8dac4 100644 (file)
bool saved = sp_document_get_undo_sensitive (local_doc);
sp_document_set_undo_sensitive (local_doc, false);
+
if (!write_undo) local_repr->setAttribute(_key.c_str(), svgstr);
local_doc->rroot->setAttribute("sodipodi:modified", "true");
+
sp_document_set_undo_sensitive (local_doc, saved);
if (write_undo) {
local_repr->setAttribute(_key.c_str(), svgstr);
//====================================================
RegisteredCheckButton::RegisteredCheckButton()
-: _button(0)
+: _button(0),
+ setProgrammatically(false)
{
}
@@ -107,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;
(*i)->set_sensitive(_button->get_active());
}
- write_to_xml(_button->get_active() ? "true" : "false");
-
_wr->setUpdating (false);
}
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;
}
}
gchar c[32];
- sp_svg_write_color(c, 32, rgba);
+ sp_svg_write_color(c, sizeof(c), rgba);
bool saved = sp_document_get_undo_sensitive (local_doc);
sp_document_set_undo_sensitive (local_doc, false);
local_repr->setAttribute(_ckey.c_str(), c);
}
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);