summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1b71241)
raw | patch | inline | side by side (parent: 1b71241)
author | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Mon, 5 Nov 2007 21:15:27 +0000 (21:15 +0000) | ||
committer | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Mon, 5 Nov 2007 21:15:27 +0000 (21:15 +0000) |
diff --git a/src/attributes.cpp b/src/attributes.cpp
index 5fb4a87a050f95e74970882bad9db95fd8be7d56..f09e9cc36e88a31dfd1580ff39850541fcab8fe7 100644 (file)
--- a/src/attributes.cpp
+++ b/src/attributes.cpp
{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_BBOX_PATHS, "inkscape:bbox-paths"},
+ {SP_ATTR_INKSCAPE_BBOX_NODES, "inkscape:bbox-nodes"},
{SP_ATTR_INKSCAPE_CURRENT_LAYER, "inkscape:current-layer"},
{SP_ATTR_INKSCAPE_DOCUMENT_UNITS, "inkscape:document-units"},
{SP_ATTR_INKSCAPE_CONNECTOR_SPACING, "inkscape:connector-spacing"},
diff --git a/src/attributes.h b/src/attributes.h
index 6d05361f2b991b38b0b069c27d2147415f765766..768fd000302022f03182f3cbedc623d207868c70 100644 (file)
--- a/src/attributes.h
+++ b/src/attributes.h
SP_ATTR_INKSCAPE_SNAP_CENTER,
SP_ATTR_INKSCAPE_OBJECT_PATHS,
SP_ATTR_INKSCAPE_OBJECT_NODES,
+ SP_ATTR_INKSCAPE_BBOX_PATHS,
+ SP_ATTR_INKSCAPE_BBOX_NODES,
SP_ATTR_INKSCAPE_CURRENT_LAYER,
SP_ATTR_INKSCAPE_DOCUMENT_UNITS,
SP_ATTR_INKSCAPE_CONNECTOR_SPACING,
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index 10e0c43d4bef3f6529b7a9d2f38eb0c53c464be4..67b465d034f60787cfe2cc08665bfb6530bbdce3 100644 (file)
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
if (first_point) {
_points_to_snap_to->clear();
for (std::vector<SPItem*>::const_iterator i = _candidates->begin(); i != _candidates->end(); i++) {
-
//NR::Matrix i2doc(NR::identity());
SPItem *root_item = *i;
if (SP_IS_USE(*i)) {
diff --git a/src/object-snapper.h b/src/object-snapper.h
index d1a2c94ce30277772600d96544c359697c02f29b..4785ca431b9de6f1d707b86dbb072a9bd0dc4dc7 100644 (file)
--- a/src/object-snapper.h
+++ b/src/object-snapper.h
Inkscape::Snapper::PointType const &t,
NR::Point const &p,
bool const &first_point,
- std::vector<NR::Point> &points_to_snap,
- std::list<SPItem const *> const &it) const;
+ std::vector<NR::Point> &points_to_snap,
+ std::list<SPItem const *> const &it) const;
void _doConstrainedSnap(SnappedConstraints &sc,
Inkscape::Snapper::PointType const &t,
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index b95e70c4ae001285589e9870f7e64c9251c99590..3650b18b66c46d011f7a00acdc9342e3deca4b3e 100644 (file)
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -1057,7 +1057,7 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, NR::
NR::Coord const bd = bb.second ? fabs(bb.first - s[axis]) : NR_HUGE;
NR::Coord const sd = sn.second ? fabs(sn.first - s[axis]) : NR_HUGE;
NR::Coord const ratio = (bd < sd) ? bb.first : sn.first;
-
+
s[axis] = fabs(ratio) * sign(s[axis]);
s[perp] = fabs(s[axis]);
} else {
@@ -1084,6 +1084,7 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, NR::
NR::Coord const bd = bb.second ? fabs(bb.first - s[axis]) : NR_HUGE;
NR::Coord const sd = sn.second ? fabs(sn.first - s[axis]) : NR_HUGE;
s[axis] = (bd < sd) ? bb.first : sn.first;
+
s[perp] = 1;
}
diff --git a/src/snap.cpp b/src/snap.cpp
index 1a05bdaacf6234079fb148059900136c80e08c0c..d5ec91f863819e14ad0e20e1786d9e432ff49ccb 100644 (file)
--- a/src/snap.cpp
+++ b/src/snap.cpp
}
object.setSnapFrom(Inkscape::Snapper::SNAPPOINT_BBOX, enabled);
- object.setSnapToBBoxNode(enabled);
- object.setSnapToBBoxPath(enabled);
+ //object.setSnapToBBoxNode(enabled); // On second thought, these should be controlled
+ //object.setSnapToBBoxPath(enabled); // separately by the snapping prefs dialog
object.setStrictSnapping(true); //don't snap bboxes to nodes/paths and vice versa
}
std::vector<NR::Point>::const_iterator j = transformed_points.begin();
+ // std::cout << std::endl;
+
for (std::vector<NR::Point>::const_iterator i = points.begin(); i != points.end(); i++) {
/* Snap it */
Inkscape::SnappedPoint const snapped = constrained ?
constrainedSnap(type, *j, i == points.begin(), transformed_points, constraint, ignore) : freeSnap(type, *j, i == points.begin(), transformed_points, ignore);
+ NR::Point result;
+ NR::Coord metric;
+
if (snapped.getDistance() < NR_HUGE) {
/* We snapped. Find the transformation that describes where the snapped point has
** ended up, and also the metric for this transformation.
*/
- NR::Point result;
- NR::Coord metric;
switch (transformation_type) {
case TRANSLATION:
result = snapped.getPoint() - *i;
if ((metric < best_metric) || ((metric == best_metric) && snapped.getAtIntersection() == true)) {
best_transformation = result;
best_metric = metric;
- }
+ // std::cout << "SEL ";;
+ } //else { std::cout << " ";}
}
+ // std::cout << "P_orig = " << (*i) << " | metric = " << metric << " | distance = " << snapped.getDistance() << " | P_snap = " << snapped.getPoint() << std::endl;
j++;
}
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index aeaa8dc14640e8a426c0065a2e50b5be3591cab8..8b9bc008ec30895d3dd1a7d7831eb4ecd99b916a 100644 (file)
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
@@ -160,6 +160,8 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape:
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:bbox-paths");
+ sp_object_read_attr(object, "inkscape:bbox-nodes");
sp_object_read_attr(object, "inkscape:current-layer");
sp_object_read_attr(object, "inkscape:connector-spacing");
@@ -377,6 +379,14 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
nv->snap_manager.object.setSnapToItemNode(value ? sp_str_to_bool(value) : FALSE);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
+ case SP_ATTR_INKSCAPE_BBOX_PATHS:
+ nv->snap_manager.object.setSnapToBBoxPath(value ? sp_str_to_bool(value) : FALSE);
+ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ break;
+ case SP_ATTR_INKSCAPE_BBOX_NODES:
+ nv->snap_manager.object.setSnapToBBoxNode(value ? sp_str_to_bool(value) : FALSE);
+ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ break;
case SP_ATTR_INKSCAPE_CURRENT_LAYER:
nv->default_layer_id = value ? g_quark_from_string(value) : 0;
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
index e2dc2c0b9156ad6fb403c462d699bff94b10ca26..4f8db942d41e707bdbc6dc263ba26d7505d9ff91 100644 (file)
DocumentProperties::DocumentProperties(Behavior::BehaviorFactory behavior_factory)
: Dialog (behavior_factory, "dialogs.documentoptions", SP_VERB_DIALOG_NAMEDVIEW),
_page_page(1, 1), _page_guides(1, 1),
- _page_snap(1, 1), _page_grids(1, 1),
+ _page_snap(1, 1), _page_grids(1, 1), _page_snap_dtls(1, 1),
_grids_button_new(_("_New"), _("Create new grid.")),
_grids_button_remove(_("_Remove"), _("Remove selected grid.")),
_prefs_path("dialogs.documentoptions")
@@ -106,12 +106,14 @@ DocumentProperties::DocumentProperties(Behavior::BehaviorFactory behavior_factor
_notebook.append_page(_page_page, _("Page"));
_notebook.append_page(_page_guides, _("Guides"));
_notebook.append_page(_page_grids, _("Grids"));
- _notebook.append_page(_page_snap, _("Snapping"));
+ _notebook.append_page(_page_snap, _("Snap"));
+ _notebook.append_page(_page_snap_dtls, _("Snap details"));
build_page();
build_guides();
build_gridspage();
build_snap();
+ build_snap_dtls();
_grids_button_new.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::onNewGrid));
_grids_button_remove.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::onRemoveGrid));
{
_page_snap.show();
//General options
- _rcbsnbb.init (_("Bounding _box corners"),
- _("Snap bounding box corners to grid lines, to guides, and to other bounding boxes (only applicable to the selector tool)"),
+ _rcbsnbb.init (_("_Bounding box corners"),
+ _("Snap bounding box corners to grid lines, to guides, and to other bounding boxes (Snapping of bounding boxes is only available in the selector tool)"),
"inkscape:snap-bbox", _wr);
_rcbsnn.init (_("_Nodes"),
_("Snap nodes to grid lines, to guides, to paths, and to other nodes"),
"inkscape:snap-nodes", _wr);
- _rcbsng.init (_("_Guides"),
- _("While dragging a guide, snap to object nodes. (In 'Snapping to objects', 'Snap to nodes' must also be enabled)"),
- "inkscape:snap-guide", _wr);
//Options for snapping to objects
- _rcbsnop.init (_("Snap to p_aths"),
+ _rcbsnop.init (_("Snap to pat_hs"),
_("Snap nodes to object paths"),
"inkscape:object-paths", _wr);
_rcbsnon.init (_("Snap to n_odes"),
- _("Snap nodes or guides to object nodes"),
- "inkscape:object-nodes", _wr);
- _rsu_sno.init (_("Snap _distance"), _("Snap at any dist_ance"),
+ _("Snap nodes and guides to object nodes"),
+ "inkscape:object-nodes", _wr);
+ _rcbsnbbn.init (_("Snap to bounding box co_rners"),
+ _("Snap bounding box corners to other bounding box corners"),
+ "inkscape:bbox-nodes", _wr);
+ _rcbsnbbp.init (_("Snap to bounding box _edges"),
+ _("Snap bounding box corners and guides to bounding box edges"),
+ "inkscape:bbox-paths", _wr);
+
+ _rsu_sno.init (_("Snap _distance"), _("Snap at any d_istance"),
_("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 di_stance"), _("Snap at any dis_tance"),
_("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 dist_ance"), _("Snap at any distan_ce"),
_("Snapping distance, in screen pixels, for snapping to guides"),
_("If set, objects snap to the nearest guide, regardless of distance"),
"guidetolerance", _wr);
- //Some other options
- _rcbic.init (_("_Include the object's rotation center"),
- _("Also snap the rotation center of an object when snapping nodes or guides"),
- "inkscape:snap-center", _wr);
- //Applies to both nodes and guides, but not to bboxes, that's why its located here
//Other options to locate here: e.g. visual snapping indicators on/off
+ std::list<Gtk::ToggleButton*> slaves;
+ slaves.push_back(_rcbsnop._button);
+ slaves.push_back(_rcbsnon._button);
+ _rcbsnn.setSlaveButton(slaves);
+
+ slaves.clear();
+ slaves.push_back(_rcbsnbbp._button);
+ slaves.push_back(_rcbsnbbn._button);
+ _rcbsnbb.setSlaveButton(slaves);
+
Gtk::Label *label_g = manage (new Gtk::Label);
label_g->set_markup (_("<b>Snapping of</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, _rcbsng._button,
- 0, 0,
+ 0, 0,
+ 0, 0,
0, 0,
0, 0,
label_o, 0,
0, _rcbsnop._button,
0, _rcbsnon._button,
+ 0, _rcbsnbbp._button,
+ 0, _rcbsnbbn._button,
0, _rsu_sno._vbox,
0, 0,
label_gr, 0,
0, _rsu_sn._vbox,
0, 0,
label_gu, 0,
- 0, _rsu_gusn._vbox,
- 0, 0,
- 0, 0,
- 0, 0,
- label_m, 0,
- 0, _rcbic._button
+ 0, _rsu_gusn._vbox
};
attach_all(_page_snap.table(), array, G_N_ELEMENTS(array));
}
+
+void
+DocumentProperties::build_snap_dtls()
+{
+ _page_snap_dtls.show();
+
+ _rcbsng.init (_("_Snap guides while dragging"),
+ _("While dragging a guide, snap to object nodes or bounding box corners ('snap to nodes' or 'snap to bounding box corners', both on the previous tab, must be enabled)"),
+ "inkscape:snap-guide", _wr);
+
+ _rcbic.init (_("_Include the object's rotation center"),
+ _("Also snap the rotation center of an object when snapping nodes or guides"),
+ "inkscape:snap-center", _wr);
+ //Applies to both nodes and guides, but not to bboxes, that's why its located here
+
+ //Other options to locate here: e.g. visual snapping indicators on/off
+
+ Gtk::Label *label_i= manage (new Gtk::Label);
+ label_i->set_markup (_("<b>Snapping to intersections</b>"));
+ Gtk::Label *label_m = manage (new Gtk::Label);
+ label_m->set_markup (_("<b>Miscellaneous</b>"));
+
+ Gtk::Widget *const array[] =
+ {
+ label_i, 0,
+ 0, 0,
+ 0, 0,
+ label_m, 0,
+ 0, _rcbsng._button,
+ 0, _rcbic._button,
+ };
+
+ attach_all(_page_snap_dtls.table(), array, G_N_ELEMENTS(array));
+}
/**
* Called for _updating_ the dialog (e.g. when a new grid was manually added in XML)
_rcbic.setActive (nv->snap_manager.getIncludeItemCenter());
_rcbsnop.setActive(nv->snap_manager.object.getSnapToItemPath());
_rcbsnon.setActive(nv->snap_manager.object.getSnapToItemNode());
+ _rcbsnbbp.setActive(nv->snap_manager.object.getSnapToBBoxPath());
+ _rcbsnbbn.setActive(nv->snap_manager.object.getSnapToBBoxNode());
_rsu_sno.setValue (nv->objecttolerance);
_rsu_sn.setValue (nv->gridtolerance);
index 192e2f732077ba509934df41524fce2f305fddab..ae8237e3e65cb2d2f0f89d9e8964b1d9ba4692f8 100644 (file)
void build_grid();
void build_guides();
void build_snap();
+ void build_snap_dtls();
void build_gridspage();
void init();
virtual void on_response (int);
Gtk::Notebook _notebook;
NotebookPage _page_page, _page_guides;
- NotebookPage _page_snap;
+ NotebookPage _page_snap, _page_snap_dtls;
NotebookPage _page_grids;
//---------------------------------------------------------------
RegisteredUnitMenu _rum_gusn;
RegisteredColorPicker _rcp_gui, _rcp_hgui;
//---------------------------------------------------------------
- RegisteredCheckButton _rcbsnbb, _rcbsng, _rcbsnn, _rcbic, _rcbsnop, _rcbsnon;
+ RegisteredCheckButton _rcbsnbb, _rcbsng, _rcbsnn, _rcbic, _rcbsnop;
+ RegisteredCheckButton _rcbsnon, _rcbsnbbp, _rcbsnbbn;
RegisteredUnitMenu _rumso;
ToleranceSlider _rsu_sno, _rsu_sn, _rsu_gusn;
RegisteredRadioButtonPair _rrb_pix;