index 4db4363caf76ca7389de0fcfade9975ff0acdcb5..4b1c2a5f80397a196800f6c627ae74322fbe7a11 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,19 +110,25 @@ RegisteredCheckButton::init (const Glib::ustring& label, const Glib::ustring& ti
void
RegisteredCheckButton::setActive (bool b)
{
+ 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);
+ }
+ setProgrammatically = false;
}
void
RegisteredCheckButton::on_toggled()
{
- if (_wr->isUpdating())
+ if (setProgrammatically) {
+ setProgrammatically = false;
return;
+ }
+ if (_wr->isUpdating())
+ return;
_wr->setUpdating (true);
write_to_xml(_button->get_active() ? "true" : "false");
(*i)->set_sensitive(_button->get_active());
}
- write_to_xml(_button->get_active() ? "true" : "false");
-
_wr->setUpdating (false);
}
void
RegisteredScalarUnit::setValue (double val)
{
- _widget->setValue (val);
- on_value_changed();
+ if (_widget)
+ _widget->setValue (val);
}
void
RegisteredScalarUnit::on_value_changed()
{
+ if (_widget->setProgrammatically) {
+ _widget->setProgrammatically = false;
+ return;
+ }
+
if (_wr->isUpdating())
return;
void
RegisteredScalar::setValue (double val)
{
- _widget->setValue (val);
- on_value_changed();
+ if (_widget)
+ _widget->setValue (val);
}
void
RegisteredScalar::on_value_changed()
{
- if (_wr->isUpdating())
+ if (_widget->setProgrammatically) {
+ _widget->setProgrammatically = false;
return;
- _wr->setUpdating (true);
+ }
- // FIXME: gtk bug?
- // disable interruptibility: see http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/ui/widget/selected-style.cpp?r1=13149&r2=13257&sortby=date
- SPDesktop* dt = SP_ACTIVE_DESKTOP;
- sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(dt), 0);
+ if (_wr->isUpdating()) {
+ return;
+ }
+ _wr->setUpdating (true);
Inkscape::SVGOStringStream os;
os << _widget->getValue();
+ _widget->set_sensitive(false);
write_to_xml(os.str().c_str());
-
- // resume interruptibility
- sp_canvas_end_forced_full_redraws(sp_desktop_canvas(dt));
+ _widget->set_sensitive(true);
_wr->setUpdating (false);
}
}
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)
{
@@ -398,6 +412,7 @@ RegisteredSuffixedInteger::init (const Glib::ustring& label, const Glib::ustring
_label->set_alignment (1.0, 0.5);
_label->set_use_underline();
_sb = new Gtk::SpinButton (_adj, 1.0, 0);
+ _sb->set_numeric();
_label->set_mnemonic_widget (*_sb);
_suffix = new Gtk::Label (suffix);
_hbox.pack_start (*_sb, true, true, 0);
@@ -409,12 +424,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)
{
}
@@ -463,13 +485,25 @@ const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument
void
RegisteredRadioButtonPair::setValue (bool second)
{
- if (second) _rb2->set_active();
- else _rb1->set_active();
+ if (!_rb1 || !_rb2)
+ return;
+
+ 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;
void
RegisteredPoint::setValue (double xval, double yval)
{
- _widget->setValue(xval, yval);
- on_value_changed();
+ if (_widget)
+ _widget->setValue(xval, yval);
}
void
RegisteredPoint::on_value_changed()
{
+ if (_widget->setProgrammatically()) {
+ _widget->clearProgrammatically();
+ return;
+ }
+
if (_wr->isUpdating())
return;
void
RegisteredRandom::setValue (double val, long startseed)
{
+ if (!_widget)
+ return;
+
_widget->setValue (val);
_widget->setStartSeed(startseed);
- on_value_changed();
}
void
RegisteredRandom::on_value_changed()
{
- if (_wr->isUpdating())
+ if (_widget->setProgrammatically) {
+ _widget->setProgrammatically = false;
return;
- _wr->setUpdating (true);
+ }
- // FIXME: gtk bug?
- // disable interruptibility: see http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/ui/widget/selected-style.cpp?r1=13149&r2=13257&sortby=date
- SPDesktop* dt = SP_ACTIVE_DESKTOP;
- sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(dt), 0);
+ if (_wr->isUpdating()) {
+ return;
+ }
+ _wr->setUpdating (true);
Inkscape::SVGOStringStream os;
os << _widget->getValue() << ';' << _widget->getStartSeed();
+ _widget->set_sensitive(false);
write_to_xml(os.str().c_str());
-
- // resume interruptibility
- sp_canvas_end_forced_full_redraws(sp_desktop_canvas(dt));
+ _widget->set_sensitive(true);
_wr->setUpdating (false);
}