summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1c87975)
raw | patch | inline | side by side (parent: 1c87975)
author | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Mon, 6 Aug 2007 18:40:50 +0000 (18:40 +0000) | ||
committer | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Mon, 6 Aug 2007 18:40:50 +0000 (18:40 +0000) |
diff --git a/src/attributes.cpp b/src/attributes.cpp
index 90f3e0280ee63df8adccc1b5a8c88d92aeba5676..3810cb0f7117969c03acb625948258ffbb347415 100644 (file)
--- a/src/attributes.cpp
+++ b/src/attributes.cpp
{SP_ATTR_INKSCAPE_WINDOW_Y, "inkscape:window-y"},
{SP_ATTR_INKSCAPE_SNAP_BBOX, "inkscape:snap-bbox"},
{SP_ATTR_INKSCAPE_SNAP_NODES, "inkscape:snap-nodes"},
+ {SP_ATTR_INKSCAPE_SNAP_CENTER, "inkscape:snap-center"},
{SP_ATTR_INKSCAPE_OBJECT_PATHS, "inkscape:object-paths"},
{SP_ATTR_INKSCAPE_OBJECT_NODES, "inkscape:object-nodes"},
{SP_ATTR_INKSCAPE_CURRENT_LAYER, "inkscape:current-layer"},
diff --git a/src/attributes.h b/src/attributes.h
index 9a969dc8cbdde73f7577bba1edf0a878597f60ba..752500e24e86d89f2f64fe79f71fbfb201a2856d 100644 (file)
--- a/src/attributes.h
+++ b/src/attributes.h
SP_ATTR_INKSCAPE_WINDOW_Y,
SP_ATTR_INKSCAPE_SNAP_BBOX,
SP_ATTR_INKSCAPE_SNAP_NODES,
+ SP_ATTR_INKSCAPE_SNAP_CENTER,
SP_ATTR_INKSCAPE_OBJECT_PATHS,
SP_ATTR_INKSCAPE_OBJECT_NODES,
SP_ATTR_INKSCAPE_CURRENT_LAYER,
diff --git a/src/snap.cpp b/src/snap.cpp
index f5c1c9589811f95bf88c4bc890afebcf4c9cd70c..651da788f67557e82cf2c822e353d6e08028849b 100644 (file)
--- a/src/snap.cpp
+++ b/src/snap.cpp
object.setSnapFrom(Inkscape::Snapper::SNAPPOINT_NODE, enabled);
//object.setSnapToItemNode(enabled); // On second thought, these should be controlled
//object.setSnapToItemPath(enabled); // separately by the snapping prefs dialog
- object.setStrictSnapping(true);
+ object.setStrictSnapping(true);
}
bool SnapManager::getSnapModeNode() const
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index af30b3ed170e8c328be361da9c36a006a560fe67..084e61b4724b63a35f9be534ebae6a66859ad38e 100644 (file)
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
@@ -155,6 +155,7 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape:
sp_object_read_attr(object, "inkscape:window-y");
sp_object_read_attr(object, "inkscape:snap-bbox");
sp_object_read_attr(object, "inkscape:snap-nodes");
+ sp_object_read_attr(object, "inkscape:snap-center");
sp_object_read_attr(object, "inkscape:object-paths");
sp_object_read_attr(object, "inkscape:object-nodes");
sp_object_read_attr(object, "inkscape:current-layer");
@@ -350,6 +351,10 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
nv->snap_manager.setSnapModeNode(value ? sp_str_to_bool(value) : TRUE);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
+ case SP_ATTR_INKSCAPE_SNAP_CENTER:
+ nv->snap_manager.setIncludeItemCenter(value ? sp_str_to_bool(value) : FALSE);
+ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ break;
case SP_ATTR_INKSCAPE_OBJECT_PATHS:
nv->snap_manager.object.setSnapToItemPath(value ? sp_str_to_bool(value) : TRUE);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
index 807d4129f869309b4d24bd31540a754620a0d156..062f838f993785337c09fe12e851714cb0f7e243 100644 (file)
_rcbsnn.init (_("Snap _nodes"),
_("Snap nodes to grid lines, to guides, to paths, and to other nodes"),
"inkscape:snap-nodes", _wr);
+ _rcbic.init (_("Include the object's center"),
+ _("Also snap the rotation center of an object when snapping nodes"),
+ "inkscape:snap-center", _wr);
//Options for snapping to objects
_rcbsnop.init (_("Snap to _paths"),
_rcbsnon.init (_("Snap to n_odes"),
_("Snap nodes to object nodes"),
"inkscape:object-nodes", _wr);
- _rsu_sno.init (_(" Snap _distance"), _("Snap at any dist_ance"),
+ _rsu_sno.init (_("Snap _distance"), _("Snap at any dist_ance"),
_("Snapping distance, in screen pixels, for snapping to objects"),
_("If set, objects snap to the nearest object, regardless of distance"),
"objecttolerance", _wr);
//Options for snapping to grids
- _rsu_sn.init (_(" Snap d_istance"), _("Snap at any distan_ce"),
+ _rsu_sn.init (_("Snap d_istance"), _("Snap at any distan_ce"),
_("Snapping distance, in screen pixels, for snapping to grid"),
_("If set, objects snap to the nearest grid line, regardless of distance"),
"gridtolerance", _wr);
//Options for snapping to guides
- _rsu_gusn.init (_(" Snap di_stance"), _("Snap at any distanc_e"),
+ _rsu_gusn.init (_("Snap di_stance"), _("Snap at any distanc_e"),
_("Snapping distance, in screen pixels, for snapping to guides"),
_("If set, objects snap to the nearest guide, regardless of distance"),
"guidetolerance", _wr);
+ std::list<Gtk::ToggleButton*> list;
+ list.push_back(_rcbic._button);
+ list.push_back(_rcbsnop._button);
+ list.push_back(_rcbsnon._button);
+ _rcbsnn.setSlaveButton(list);
+
+
Gtk::Label *label_g = manage (new Gtk::Label);
label_g->set_markup (_("<b>General</b>"));
Gtk::Label *label_o = manage (new Gtk::Label);
{
label_g, 0,
0, _rcbsnn._button,
+ 0, 0, //_rcbic._button will be inserted here
0, _rcbsnbb._button,
- 0, 0,
+ 0, 0,
label_o, 0,
0, _rcbsnop._button,
0, _rcbsnon._button,
0, _rsu_sno._vbox,
- 0, 0,
+ 0, 0,
label_gr, 0,
0, _rsu_sn._vbox,
- 0, 0,
+ 0, 0,
label_gu, 0,
0, _rsu_gusn._vbox,
};
attach_all(_page_snap.table(), array, G_N_ELEMENTS(array));
+
+ // add _rcbic manually to get some additional indenting
+ _page_snap.table().attach(*_rcbic._button, 1, 3, 2, 3, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 18, 0);
}
/**
_rcp_hgui.setRgba32 (nv->guidehicolor);
//-----------------------------------------------------------snap
+
_rcbsnbb.setActive (nv->snap_manager.getSnapModeBBox());
_rcbsnn.setActive (nv->snap_manager.getSnapModeNode());
+ _rcbic.setActive (nv->snap_manager.getIncludeItemCenter());
_rcbsnop.setActive(nv->snap_manager.object.getSnapToItemPath());
_rcbsnon.setActive(nv->snap_manager.object.getSnapToItemNode());
_rsu_sno.setValue (nv->objecttolerance);
index d2f8776e4a3154ab5d6cdb92e1e5114fbbe5a219..5db1c734fb83dff29c32ce1c34c68d902f3b25bf 100644 (file)
RegisteredUnitMenu _rum_gusn;
RegisteredColorPicker _rcp_gui, _rcp_hgui;
//---------------------------------------------------------------
- RegisteredCheckButton _rcbsnbb, _rcbsnn, _rcbsnop, _rcbsnon;
+ RegisteredCheckButton _rcbsnbb, _rcbsnn, _rcbic, _rcbsnop, _rcbsnon;
RegisteredUnitMenu _rumso;
ToleranceSlider _rsu_sno, _rsu_sn, _rsu_gusn;
RegisteredRadioButtonPair _rrb_pix;
index 86c76b2361fd230ca6aa5635d05357b6d25602a0..6ef264b0d13cffc1f9fb1f2235e41e95c360e3b1 100644 (file)
RegisteredCheckButton::setActive (bool b)
{
_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);
+ }
}
void
_wr->setUpdating (true);
+ //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(_button->get_active());
+ }
+
bool saved = sp_document_get_undo_sensitive (local_doc);
sp_document_set_undo_sensitive (local_doc, false);
sp_repr_set_boolean(local_repr, _key.c_str(), _button->get_active());
index 43588a8314c268ec13f6ba8a5d514d47caa7831e..8e54e1bbd6c19137127921d91dc03fbc03e6d83d 100644 (file)
void setActive (bool);
Gtk::ToggleButton *_button;
+ std::list<Gtk::ToggleButton*> _slavebuttons;
+
+ // a slave button is only sensitive when the master button is active
+ // i.e. a slave button is greyed-out when the master button is not checked
+
+ void setSlaveButton(std::list<Gtk::ToggleButton*> btns) {
+ _slavebuttons = btns;
+ }
+
protected:
Gtk::Tooltips _tt;
index 92a6f76bb2400a9224f552098209dfeb622840da..d89d4cf5c858299a47f1bcfe7afa7985060ae00a 100644 (file)
Gtk::Label *theLabel1 = manage (new Gtk::Label (label1));
theLabel1->set_use_underline();
theLabel1->set_alignment(0, 0.5);
- _hbox->add (*theLabel1);
+ // align the label with the checkbox text above by indenting 22 px.
+ _hbox->pack_start(*theLabel1, Gtk::PACK_EXPAND_WIDGET, 22);
_hscale = manage (new Gtk::HScale (1.0, 51, 1.0));
theLabel1->set_mnemonic_widget (*_hscale);
_hscale->set_draw_value (true);
_tt.set_tip (*_hscale, tip1);
_hbox->add (*_hscale);
+
Gtk::Label *theLabel2 = manage (new Gtk::Label (label2));
theLabel2->set_use_underline();
_button = manage (new Gtk::CheckButton);
_button->set_alignment (0.0, 0.5);
_vbox->add (*_button);
- _vbox->add (*_hbox);
+ // Here we need some extra pixels to get the vertical spacing right. Why?
+ _vbox->pack_end(*_hbox, true, true, 3); // add 3 px.
_key = key;
_scale_changed_connection = _hscale->signal_value_changed().connect (sigc::mem_fun (*this, &ToleranceSlider::on_scale_changed));
_btn_toggled_connection = _button->signal_toggled().connect (sigc::mem_fun (*this, &ToleranceSlider::on_toggled));