summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6a639d0)
raw | patch | inline | side by side (parent: 6a639d0)
author | Diederik van Lierop <mailat-signdiedenrezidotnl> | |
Mon, 16 Aug 2010 20:59:42 +0000 (22:59 +0200) | ||
committer | Diederik van Lierop <mailat-signdiedenrezidotnl> | |
Mon, 16 Aug 2010 20:59:42 +0000 (22:59 +0200) |
src/connector-context.cpp | patch | blob | history |
index f862abac4231bf8c6d451c423538048b7bf84858..a1159e17d875dded908e9ed148db340574c141ad 100644 (file)
@@ -768,7 +768,6 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
Geom::Point const event_dt = cc->desktop->w2d(event_w);
SnapManager &m = cc->desktop->namedview->snap_manager;
- m.setup(cc->desktop);
switch (cc->state) {
case SP_CONNECTOR_CONTEXT_STOP:
@@ -790,7 +789,9 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
if (!found) {
// This is the first point, so just snap it to the grid
// as there's no other points to go off.
+ m.setup(cc->desktop);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
+ m.unSetup();
}
spcc_connector_set_initial_point(cc, p);
@@ -802,7 +803,9 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
case SP_CONNECTOR_CONTEXT_DRAGGING:
{
// This is the second click of a connector creation.
+ m.setup(cc->desktop);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
+ m.unSetup();
spcc_connector_set_subsequent_point(cc, p);
spcc_connector_finish_segment(cc, p);
@@ -824,7 +827,6 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
default:
break;
}
- m.unSetup();
} else if (bevent.button == 3) {
if (cc->state == SP_CONNECTOR_CONTEXT_REROUTING) {
// A context menu is going to be triggered here,
@@ -943,7 +945,6 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
if ( cc->mode == SP_CONNECTOR_CONTEXT_DRAWING_MODE )
{
SnapManager &m = dt->namedview->snap_manager;
- m.setup(dt);
switch (cc->state) {
case SP_CONNECTOR_CONTEXT_DRAGGING:
@@ -951,7 +952,9 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
gobble_motion_events(mevent.state);
// This is movement during a connector creation.
if ( cc->npoints > 0 ) {
+ m.setup(dt);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
+ m.unSetup();
cc->selection->clear();
spcc_connector_set_subsequent_point(cc, p);
ret = TRUE;
@@ -963,7 +966,9 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
gobble_motion_events(GDK_BUTTON1_MASK);
g_assert( SP_IS_PATH(cc->clickeditem));
+ m.setup(dt);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
+ m.unSetup();
// Update the hidden path
Geom::Matrix i2d = sp_item_i2d_affine(cc->clickeditem);
@@ -994,11 +999,12 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
break;
default:
if (!sp_event_context_knot_mouseover(cc)) {
+ m.setup(dt);
m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_OTHER_HANDLE));
+ m.unSetup();
}
break;
}
- m.unSetup();
}
else if ( cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE )
{
@@ -1030,7 +1036,6 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
SPDocument *doc = sp_desktop_document(desktop);
SnapManager &m = desktop->namedview->snap_manager;
- m.setup(desktop);
Geom::Point const event_w(revent.x, revent.y);
@@ -1042,7 +1047,9 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
//case SP_CONNECTOR_CONTEXT_POINT:
case SP_CONNECTOR_CONTEXT_DRAGGING:
{
+ m.setup(desktop);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
+ m.unSetup();
if (cc->within_tolerance)
{
@@ -1063,7 +1070,9 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
}
case SP_CONNECTOR_CONTEXT_REROUTING:
{
+ m.setup(desktop);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
+ m.unSetup();
cc_connector_rerouting_finish(cc, &p);
sp_document_ensure_up_to_date(doc);
@@ -1087,7 +1096,9 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
if (!cc->within_tolerance)
{
+ m.setup(desktop);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
+ m.unSetup();
sp_knot_set_position(cc->selected_handle, p, 0);
ConnectionPoint& cp = cc->connpthandles[cc->selected_handle];
cp.pos = p * sp_item_dt2i_affine(cc->active_shape);
@@ -1100,7 +1111,9 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
case SP_CONNECTOR_CONTEXT_NEWCONNPOINT:
+ m.setup(desktop);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
+ m.unSetup();
sp_knot_set_position(cc->selected_handle, p, 0);
@@ -1123,7 +1136,6 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
break;
}
}
- m.unSetup();
}
@@ -1196,21 +1208,20 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval)
{
// Put connection point at current position
- SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
- SnapManager &m = desktop->namedview->snap_manager;
- m.setup(desktop);
Geom::Point p = cc->selected_handle->pos;
-// SPEventContext* event_context = SP_EVENT_CONTEXT( cc );
if (!cc->within_tolerance)
{
+ SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
+ SnapManager &m = desktop->namedview->snap_manager;
+ m.setup(desktop);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
+ m.unSetup();
sp_knot_set_position(cc->selected_handle, p, 0);
ConnectionPoint& cp = cc->connpthandles[cc->selected_handle];
cp.pos = p * sp_item_dt2i_affine(cc->active_shape);
cc->active_shape->avoidRef->updateConnectionPoint(cp);
}
- m.unSetup();
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
ret = TRUE;
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
Geom::Point p = cc->selected_handle->pos;
-
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
m.unSetup();
sp_knot_set_position(cc->selected_handle, p, 0);