summaryrefslogtreecommitdiffstats
path: root/src/sp-guide.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2007-12-19 23:30:04 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2007-12-19 23:30:04 +0000
commit302667a7160ef1d144e2fb5a284f6d845c76790f (patch)
tree90a450cabb9a173b7a7b362d188590b25dec3224 /src/sp-guide.cpp
parentfix guide dragging (diff)
downloadinkscape-302667a7160ef1d144e2fb5a284f6d845c76790f.tar.gz
inkscape-302667a7160ef1d144e2fb5a284f6d845c76790f.zip
correctly handle orientation changes of guidelines
(bzr r4261)
Diffstat (limited to 'src/sp-guide.cpp')
-rw-r--r--src/sp-guide.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp
index 94f937ff9..bd5823e16 100644
--- a/src/sp-guide.cpp
+++ b/src/sp-guide.cpp
@@ -199,6 +199,7 @@ static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value)
// default to vertical line for bad arguments
guide->normal_to_line = component_vectors[NR::X];
}
+ sp_guide_set_normal(*guide, guide->normal_to_line.to_2geom(), false);
}
break;
case SP_ATTR_POSITION:
@@ -301,7 +302,7 @@ void sp_guide_moveto(SPGuide const &guide, Geom::Point const point_on_line, bool
sp_guideline_set_position(SP_GUIDELINE(l->data), point_on_line);
}
- /* Calling sp_repr_set_svg_double must precede calling sp_item_notify_moveto in the commit
+ /* Calling sp_repr_set_svg_point must precede calling sp_item_notify_moveto in the commit
case, so that the guide's new position is available for sp_item_rm_unsatisfied_cns. */
if (commit) {
sp_repr_set_svg_point(SP_OBJECT(&guide)->repr, "position", point_on_line);
@@ -319,6 +320,36 @@ void sp_guide_moveto(SPGuide const &guide, Geom::Point const point_on_line, bool
}
/**
+ * \arg commit False indicates temporary moveto in response to motion event while dragging,
+ * true indicates a "committing" version: in response to button release event after
+ * dragging a guideline, or clicking OK in guide editing dialog.
+ */
+void sp_guide_set_normal(SPGuide const &guide, Geom::Point const normal_to_line, bool const commit)
+{
+ g_assert(SP_IS_GUIDE(&guide));
+
+ for (GSList *l = guide.views; l != NULL; l = l->next) {
+ sp_guideline_set_normal(SP_GUIDELINE(l->data), normal_to_line);
+ }
+
+ /* Calling sp_repr_set_svg_point must precede calling sp_item_notify_moveto in the commit
+ case, so that the guide's new position is available for sp_item_rm_unsatisfied_cns. */
+ if (commit) {
+ sp_repr_set_svg_point(SP_OBJECT(&guide)->repr, "orientation", normal_to_line);
+ }
+
+/* DISABLED CODE BECAUSE SPGuideAttachment IS NOT USE AT THE MOMENT (johan)
+ for (vector<SPGuideAttachment>::const_iterator i(guide.attached_items.begin()),
+ iEnd(guide.attached_items.end());
+ i != iEnd; ++i)
+ {
+ SPGuideAttachment const &att = *i;
+ sp_item_notify_moveto(*att.item, guide, att.snappoint_ix, position, commit);
+ }
+*/
+}
+
+/**
* Returns a human-readable description of the guideline for use in dialog boxes and status bar.
*
* The caller is responsible for freeing the string.