summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8de35ad)
raw | patch | inline | side by side (parent: 8de35ad)
author | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Fri, 16 May 2008 21:53:27 +0000 (21:53 +0000) | ||
committer | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Fri, 16 May 2008 21:53:27 +0000 (21:53 +0000) |
14 files changed:
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index 6169d000fec26d75ebe5806dd6e0273f024c9093..b06b5fb86d879e0b23f31209c653d62c3c34a696 100644 (file)
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, ac->item);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, ac->center);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, ac->center);
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, ac->item);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt);
sp_arc_drag(ac, motion_dt, event->motion.state);
diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp
index a7cead93e4a2a00d8629c069a9aa4535e142be5f..c1af593d4f617b4ca437c85e23633a2d1bd26a44 100644 (file)
--- a/src/box3d-context.cpp
+++ b/src/box3d-context.cpp
@@ -317,7 +317,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
dragging = true;
/* */
- NR::Point const button_dt(desktop->w2d(button_w));
+ NR::Point button_dt(desktop->w2d(button_w));
bc->drag_origin = button_dt;
bc->drag_ptB = button_dt;
bc->drag_ptC = button_dt;
@@ -332,7 +332,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
/* Snap center */
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, bc->item);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, button_dt);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, button_dt);
bc->center = button_dt;
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
@@ -364,7 +364,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, bc->item);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt);
bc->ctrl_dragged = event->motion.state & GDK_CONTROL_MASK;
@@ -397,7 +397,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
bc->drag_ptB_proj.normalize();
bc->drag_ptC_proj = cur_persp->tmat.preimage (motion_dt, bc->drag_ptB_proj[Proj::X], Proj::X);
}
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, bc->drag_ptC);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, bc->drag_ptC);
}
sp_box3d_drag(*bc, event->motion.state);
index e33b11e640fde32fdcb664c743835c19e5a16bf4..028467b44dc60d85e9fb967734cb6e296d50a180 100644 (file)
@@ -532,7 +532,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
// as there's no other points to go off.
SnapManager &m = cc->desktop->namedview->snap_manager;
m.setup(cc->desktop);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, p);
}
spcc_connector_set_initial_point(cc, p);
diff --git a/src/context-fns.cpp b/src/context-fns.cpp
index 2ae4c3901b8dd41968f9cdff67a959d1c867b06a..28725c64ff2c8d86aa9c1ca85fce6b08f49ab379 100644 (file)
--- a/src/context-fns.cpp
+++ b/src/context-fns.cpp
@@ -197,11 +197,8 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item,
/* There's no constraint on the corner point, so just snap it to anything */
p[0] = center;
p[1] = pt;
- //std::cout << "pt = " << pt << std::endl;
snappoint = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, pt);
- //std::cout << "snappoint.getPoint() = " << snappoint.getPoint() << std::endl;
if (snappoint.getSnapped()) {
- //std::cout << "we snapped here ..." << std::endl;
p[1] = snappoint.getPoint();
}
}
p[0] = sp_desktop_dt2root_xy_point(desktop, p[0]);
p[1] = sp_desktop_dt2root_xy_point(desktop, p[1]);
- //std::cout << "after: p[0] vs. p[1] = " << p[0] << " | " << p[1] << std::endl;
-
return NR::Rect(NR::Point(MIN(p[0][NR::X], p[1][NR::X]), MIN(p[0][NR::Y], p[1][NR::Y])),
NR::Point(MAX(p[0][NR::X], p[1][NR::X]), MAX(p[0][NR::Y], p[1][NR::Y])));
}
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index f4d7a856959c76f7c160f60d91904855a59bc805..9a2c1215c0f3bf2692dccd970db816e3fcc28a07 100644 (file)
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -356,7 +356,7 @@ void spdc_endpoint_snap_rotation(SPEventContext const *const ec, NR::Point &p, N
/* Snap it along best vector */
SnapManager &m = SP_EVENT_CONTEXT_DESKTOP(ec)->namedview->snap_manager;
m.setup(SP_EVENT_CONTEXT_DESKTOP(ec), NULL);
- m.constrainedSnap( Inkscape::Snapper::SNAPPOINT_NODE, p, Inkscape::Snapper::ConstraintLine(best));
+ m.constrainedSnapReturnByRef( Inkscape::Snapper::SNAPPOINT_NODE, p, Inkscape::Snapper::ConstraintLine(best));
}
}
@@ -370,7 +370,7 @@ void spdc_endpoint_snap_free(SPEventContext const * const ec, NR::Point& p, guin
SnapManager &m = SP_EVENT_CONTEXT_DESKTOP(ec)->namedview->snap_manager;
m.setup(SP_EVENT_CONTEXT_DESKTOP(ec), NULL);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, p);
}
static SPCurve *
index e4cdd707fe10a1c41ed77922d86be327576f6af9..01964b8e7794444c7967ed3d017eab37db17633d 100644 (file)
--- a/src/gradient-context.cpp
+++ b/src/gradient-context.cpp
@@ -533,7 +533,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
break;
case GDK_BUTTON_PRESS:
if ( event->button.button == 1 && !event_context->space_panning ) {
- NR::Point const button_w(event->button.x, event->button.y);
+ NR::Point button_w(event->button.x, event->button.y);
// save drag origin
event_context->xp = (gint) button_w[NR::X];
@@ -542,7 +542,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
dragging = true;
- NR::Point const button_dt = desktop->w2d(button_w);
+ NR::Point button_dt = desktop->w2d(button_w);
if (event->button.state & GDK_SHIFT_MASK) {
Inkscape::Rubberband::get()->start(desktop, button_dt);
} else {
@@ -554,7 +554,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
/* Snap center to nearest magnetic point */
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, button_dt);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, button_dt);
rc->origin = button_dt;
}
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index 0abf84a1ff5371e58a4a222f6579d3b3cbbcdd86..65b256b340394870e5497a34ab6bb86e09ef79fd 100644 (file)
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
NR::Point s = p * i2d;
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, item);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, s);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, s);
return s * i2d.inverse();
}
diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp
index 87cbb8d12879c5bb00ba5da9b0bbe57084a93f1c..6af9f7956c768412f9ab31c705f6ba59712e0e17 100644 (file)
--- a/src/pencil-context.cpp
+++ b/src/pencil-context.cpp
@@ -248,7 +248,7 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating new path"));
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, p);
} else if (selection->singleItem() && SP_IS_PATH(selection->singleItem())) {
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Appending to selected path"));
}
@@ -325,7 +325,7 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev
} else if ((mevent.state & GDK_SHIFT_MASK) == 0) {
SnapManager &m = dt->namedview->snap_manager;
m.setup(dt, NULL);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, p);
}
if ( pc->npoints != 0 ) { // buttonpress may have happened before we entered draw context!
spdc_add_freehand_point(pc, p, mevent.state);
diff --git a/src/rect-context.cpp b/src/rect-context.cpp
index b8047b201eae2544285c0d83dfa4b732dc878df1..3ecd89113724f9a81fdfb2cf6115b2e26117ecbd 100644 (file)
--- a/src/rect-context.cpp
+++ b/src/rect-context.cpp
@@ -302,11 +302,6 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
/* Position center */
NR::Point const button_dt(desktop->w2d(button_w));
-
- /* Snap center */
- SnapManager &m = desktop->namedview->snap_manager;
- m.setup(desktop, rc->item);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, button_dt);
rc->center = button_dt;
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
@@ -315,6 +310,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_PRESS_MASK ),
NULL, event->button.time);
+
ret = TRUE;
}
break;
@@ -336,11 +332,11 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
event->motion.y);
NR::Point motion_dt(desktop->w2d(motion_w));
- SnapManager &m = desktop->namedview->snap_manager;
- m.setup(desktop, rc->item);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt);
+ //SnapManager &m = desktop->namedview->snap_manager;
+ //m.setup(desktop, rc->item);
+ //m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt);
- sp_rect_drag(*rc, motion_dt, event->motion.state);
+ sp_rect_drag(*rc, motion_dt, event->motion.state); // this will also handle the snapping
gobble_motion_events(GDK_BUTTON1_MASK);
ret = TRUE;
}
rc.item->updateRepr();
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
+
+ /* Snap center */
+ SnapManager &m = desktop->namedview->snap_manager;
+ m.setup(desktop, rc.item);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, rc.center);
}
NR::Rect const r = Inkscape::snap_rectangular_box(desktop, rc.item, pt, rc.center, state);
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 432b1e67067b15dbdc4931a747608d901e0990df..94baf12d709bb5337873996da0840ad23bd1e941 100644 (file)
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
{
SnapManager &m = _desktop->namedview->snap_manager;
m.setup(_desktop);
- m.freeSnap(Snapper::SNAPPOINT_NODE, pt);
+ m.freeSnapReturnByRef(Snapper::SNAPPOINT_NODE, pt);
if (state & GDK_CONTROL_MASK) {
if ( fabs(_point[NR::X] - pt[NR::X]) > fabs(_point[NR::Y] - pt[NR::Y]) ) {
** FIXME: this will snap to more than just the grid, nowadays.
*/
- m.freeSnap(Snapper::SNAPPOINT_NODE, dxy);
+ m.freeSnapReturnByRef(Snapper::SNAPPOINT_NODE, dxy);
} else if (!shift) {
}
}
- if (control) {
- /* Ensure that the horizontal and vertical constraint has been applied */
- if (fabs(dxy[NR::X]) > fabs(dxy[NR::Y])) {
- dxy[NR::Y] = 0;
- } else {
- dxy[NR::X] = 0;
- }
- }
+ //if (control) {
+ // /* Ensure that the horizontal and vertical constraint has been applied */
+ // if (fabs(dxy[NR::X]) > fabs(dxy[NR::Y])) {
+ // dxy[NR::Y] = 0;
+ // } else {
+ // dxy[NR::X] = 0;
+ // }
+ //}
NR::Matrix const move((NR::translate(dxy)));
NR::Point const norm(0, 0);
diff --git a/src/snap.cpp b/src/snap.cpp
index bc81bdf3ad589d2b5918156af7cd257865527c19..46d043ec17e46b681b755268dd1a6e1883e602bc 100644 (file)
--- a/src/snap.cpp
+++ b/src/snap.cpp
* \return Snapped point.
*/
-void SnapManager::freeSnapVoid(Inkscape::Snapper::PointType point_type,
+void SnapManager::freeSnapReturnByRef(Inkscape::Snapper::PointType point_type,
NR::Point &p,
bool first_point,
NR::Maybe<NR::Rect> const &bbox_to_snap) const
@@ -244,7 +244,7 @@ Inkscape::SnappedPoint SnapManager::freeSnap(Inkscape::Snapper::PointType point_
* \return Snapped point.
*/
-void SnapManager::constrainedSnapVoid(Inkscape::Snapper::PointType point_type,
+void SnapManager::constrainedSnapReturnByRef(Inkscape::Snapper::PointType point_type,
NR::Point &p,
Inkscape::Snapper::ConstraintLine const &constraint,
bool first_point,
diff --git a/src/snap.h b/src/snap.h
index 900f548cef9bd049c04c2a83864c4215293caf94..4c5e57b73c2987a6372d38ebf3e90c93cb6924e9 100644 (file)
--- a/src/snap.h
+++ b/src/snap.h
void setup(SPDesktop const *desktop_for_snapindicator = NULL, SPItem const *item_to_ignore = NULL, std::vector<NR::Point> *unselected_nodes = NULL);
void setup(SPDesktop const *desktop_for_snapindicator, std::vector<SPItem const *> &items_to_ignore, std::vector<NR::Point> *unselected_nodes = NULL);
- // freeSnapVoid() is preferred over freeSnap(), because it only returns a
- // point, by overwriting p, if snapping has occured; otherwise p is untouched
- void freeSnapVoid(Inkscape::Snapper::PointType point_type,
+ // freeSnapReturnByRef() is preferred over freeSnap(), because it only returns a
+ // point if snapping has occured (by overwriting p); otherwise p is untouched
+ void freeSnapReturnByRef(Inkscape::Snapper::PointType point_type,
NR::Point &p,
bool first_point = true,
NR::Maybe<NR::Rect> const &bbox_to_snap = NR::Nothing()) const;
bool first_point = true,
NR::Maybe<NR::Rect> const &bbox_to_snap = NR::Nothing()) const;
- // constrainedSnapVoid() is preferred over constrainedSnap(), because it only returns a
+ // constrainedSnapReturnByRef() is preferred over constrainedSnap(), because it only returns a
// point, by overwriting p, if snapping has occured; otherwise p is untouched
- void constrainedSnapVoid(Inkscape::Snapper::PointType point_type,
+ void constrainedSnapReturnByRef(Inkscape::Snapper::PointType point_type,
NR::Point &p,
Inkscape::Snapper::ConstraintLine const &constraint,
bool first_point = true,
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index 57c06e4a315730da08c08880ec9e2dc87a1a62af..31ec40d5033eb357536740029678d56ba298dc92 100644 (file)
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, sc->item);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, sc->center);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, sc->center);
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
( GDK_KEY_PRESS_MASK |
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, sc->item);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt);
sp_spiral_drag(sc, motion_dt, event->motion.state);
gobble_motion_events(GDK_BUTTON1_MASK);
NR::Point p1 = sp_desktop_dt2root_xy_point(desktop, p);
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, sc->item);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p1);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, p1);
SPSpiral *spiral = SP_SPIRAL(sc->item);
diff --git a/src/star-context.cpp b/src/star-context.cpp
index afdb14a0c84e6171948d29ed25f0684dcb9a8155..b6b3c340e01a15286b10676eaf518861eb808478 100644 (file)
--- a/src/star-context.cpp
+++ b/src/star-context.cpp
@@ -282,7 +282,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, sc->item);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, sc->center);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, sc->center);
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
@@ -309,7 +309,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, sc->item);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt);
sp_star_drag (sc, motion_dt, event->motion.state);
/* Snap corner point with no constraints */
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, sc->item);
- m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p1);
+ m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, p1);
SPStar *star = SP_STAR(sc->item);