X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fvanishing-point.cpp;h=5ee1582342f6950ab89e294352e3e11f26e82d32;hb=66beae9e01de14ec79be8cf45ffb23c47ef7caf4;hp=c57232c74859f06aea965e7dc3e0d34c03f3e590;hpb=e9b6af083e34e2397a8ddbe9781920733d09d151;p=inkscape.git diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp index c57232c74..5ee158234 100644 --- a/src/vanishing-point.cpp +++ b/src/vanishing-point.cpp @@ -21,8 +21,9 @@ #include "event-context.h" #include "xml/repr.h" #include "perspective-line.h" - -#include "knotholder.h" // FIXME: can we avoid direct access to KnotHolder::update_knots? +#include "shape-editor.h" +#include "snap.h" +#include "sp-namedview.h" namespace Box3D { @@ -77,7 +78,7 @@ have_VPs_of_same_perspective (VPDragger *dr1, VPDragger *dr2) } static void -vp_knot_moved_handler (SPKnot */*knot*/, Geom::Point const *ppointer, guint state, gpointer data) +vp_knot_moved_handler (SPKnot *knot, Geom::Point const *ppointer, guint state, gpointer data) { VPDragger *dragger = (VPDragger *) data; VPDrag *drag = dragger->parent; @@ -104,7 +105,7 @@ vp_knot_moved_handler (SPKnot */*knot*/, Geom::Point const *ppointer, guint stat sel_boxes = (*vp)->selectedBoxes(sp_desktop_selection(inkscape_active_desktop())); // we create a new perspective ... - Persp3D *new_persp = persp3d_create_xml_element (dragger->parent->document, old_persp); + Persp3D *new_persp = persp3d_create_xml_element (dragger->parent->document, old_persp->perspective_impl); /* ... unlink the boxes from the old one and FIXME: We need to unlink the _un_selected boxes of each VP so that @@ -171,10 +172,20 @@ vp_knot_moved_handler (SPKnot */*knot*/, Geom::Point const *ppointer, guint stat return; } } - } + // We didn't snap to another dragger, so we'll try a regular snap + SPDesktop *desktop = inkscape_active_desktop(); + SnapManager &m = desktop->namedview->snap_manager; + m.setup(desktop); + Inkscape::SnappedPoint s = m.freeSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_OTHER_HANDLE)); + m.unSetup(); + if (s.getSnapped()) { + p = s.getPoint(); + sp_knot_moveto(knot, p); + } + } - dragger->point = p; // FIXME: Brauchen wir dragger->point überhaupt? + dragger->point = p; // FIXME: Is dragger->point being used at all? dragger->updateVPs(p); dragger->updateBoxDisplays(); @@ -231,7 +242,7 @@ unsigned int VanishingPoint::global_counter = 0; void VanishingPoint::set_pos(Proj::Pt2 const &pt) { g_return_if_fail (_persp); - _persp->tmat.set_image_pt (_axis, pt); + _persp->perspective_impl->tmat.set_image_pt (_axis, pt); } std::list @@ -614,8 +625,8 @@ VPDrag::updateBoxHandles () SPEventContext *ec = inkscape_active_event_context(); g_assert (ec != NULL); - if (ec->shape_knot_holder != NULL) { - ec->shape_knot_holder->update_knots(); + if (ec->shape_editor != NULL) { + ec->shape_editor->update_knotholder(); } }