summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f67bf41)
raw | patch | inline | side by side (parent: f67bf41)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 19 Dec 2007 23:30:04 +0000 (23:30 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 19 Dec 2007 23:30:04 +0000 (23:30 +0000) |
src/display/guideline.cpp | patch | blob | history | |
src/display/guideline.h | patch | blob | history | |
src/sp-guide.cpp | patch | blob | history | |
src/sp-guide.h | patch | blob | history |
index 32d0e0c1eaae3602679ce327eace236095f52201..1f1d996ffd03d129e553488bb1b32f01aa9a4d87 100644 (file)
NR::Matrix(NR::translate(point_on_line)));
}
+void sp_guideline_set_normal(SPGuideLine *gl, Geom::Point normal_to_line)
+{
+ gl->normal_to_line = normal_to_line;
+ sp_canvas_item_request_update(SP_CANVAS_ITEM (gl));
+}
+
void sp_guideline_set_color(SPGuideLine *gl, unsigned int rgba)
{
gl->rgba = rgba;
index b3d9bb56b4bf616d0431f382e692c7270f70000a..24353af0aa8f632215b0d77dcedbb5574c01827b 100644 (file)
--- a/src/display/guideline.h
+++ b/src/display/guideline.h
SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, Geom::Point point_on_line, Geom::Point normal);
void sp_guideline_set_position(SPGuideLine *gl, Geom::Point point_on_line);
+void sp_guideline_set_normal(SPGuideLine *gl, Geom::Point normal_to_line);
void sp_guideline_set_color(SPGuideLine *gl, unsigned int rgba);
void sp_guideline_set_sensitive(SPGuideLine *gl, int sensitive);
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp
index 94f937ff95c304fe9c8f6b2335885abc5e12f7d9..bd5823e16732bda24911d25fef6cc4f7e6f3ffd5 100644 (file)
--- 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);
@@ -318,6 +319,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.
*
diff --git a/src/sp-guide.h b/src/sp-guide.h
index 48583bbe60411d2d6aed13eac6e011e282c6cf87..4364284749eb1f1aab5e11535253673ccb0fb74a 100644 (file)
--- a/src/sp-guide.h
+++ b/src/sp-guide.h
Geom::Point sp_guide_position_from_pt(SPGuide const *guide, NR::Point const &pt);
double sp_guide_distance_from_pt(SPGuide const *guide, Geom::Point const &pt);
void sp_guide_moveto(SPGuide const &guide, Geom::Point const point_on_line, bool const commit);
+void sp_guide_set_normal(SPGuide const &guide, Geom::Point const normal_to_line, bool const commit);
void sp_guide_remove(SPGuide *guide);
char *sp_guide_description(SPGuide const *guide);