summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c152a07)
raw | patch | inline | side by side (parent: c152a07)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 23 Dec 2007 23:08:39 +0000 (23:08 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 23 Dec 2007 23:08:39 +0000 (23:08 +0000) |
src/desktop-events.cpp | patch | blob | history |
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index bc2ffa530d208f3f518c285d86dc79358c6130b8..eeb0881603e9cd52341f4be49b1e27cda05d89e8 100644 (file)
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
{
static bool dragging = false;
static SPCanvasItem *guide = NULL;
+ static Geom::Point normal;
int wx, wy;
SPDesktop *desktop = dtw->desktop;
sp_repr_set_boolean(repr, "showguides", TRUE);
sp_repr_set_boolean(repr, "inkscape:guide-bbox", TRUE);
- guide = sp_guideline_new(desktop->guides, event_dt.to_2geom(), horiz ? Geom::Point(0.,1.) : Geom::Point(1.,0.));
+ normal = horiz ? Geom::Point(0.,1.) : Geom::Point(1.,0.);
+ guide = sp_guideline_new(desktop->guides, event_dt.to_2geom(), normal);
sp_guideline_set_color(SP_GUIDELINE(guide), desktop->namedview->guidehicolor);
gdk_pointer_grab(widget->window, FALSE,
(GdkEventMask)(GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK ),
NR::Point event_dt(desktop->w2d(event_w));
SnapManager const &m = desktop->namedview->snap_manager;
- event_dt = m.guideSnap(event_dt, component_vectors[horiz ? NR::Y : NR::X]).getPoint();
+ event_dt = m.guideSnap(event_dt, normal).getPoint();
sp_guideline_set_position(SP_GUIDELINE(guide), event_dt.to_2geom());
desktop->set_coordinate_status(event_dt);
NR::Point event_dt(desktop->w2d(event_w));
SnapManager const &m = desktop->namedview->snap_manager;
- event_dt = m.guideSnap(event_dt, component_vectors[horiz ? NR::Y : NR::X]).getPoint();
+ event_dt = m.guideSnap(event_dt, normal).getPoint();
dragging = false;
gtk_object_destroy(GTK_OBJECT(guide));
if ((horiz ? wy : wx) >= 0) {
Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide");
- repr->setAttribute("orientation", (horiz) ? "horizontal" : "vertical");
+ sp_repr_set_point(repr, "orientation", normal);
sp_repr_set_point(repr, "position", event_dt.to_2geom());
SP_OBJECT_REPR(desktop->namedview)->appendChild(repr);
Inkscape::GC::release(repr);