From 19117c36082531a00df461260f917d1207edde1f Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Wed, 11 Aug 2010 08:43:24 +0200 Subject: Clear pointers in the snapmanager if they're no longer needed. (bzr r9697) --- src/connector-context.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/connector-context.cpp') diff --git a/src/connector-context.cpp b/src/connector-context.cpp index b0e192190..3791034d6 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -824,6 +824,7 @@ 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, @@ -997,6 +998,7 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons } break; } + m.unSetup(); } else if ( cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE ) { @@ -1121,6 +1123,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con break; } } + m.unSetup(); } @@ -1207,6 +1210,7 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval) 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; @@ -1230,7 +1234,7 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval) 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); ConnectionPoint cp; -- cgit v1.2.3 From 2d242cc16fd1a6d47559e0cb91d66520c840a092 Mon Sep 17 00:00:00 2001 From: Michael Wybrow Date: Fri, 13 Aug 2010 15:22:17 +1000 Subject: Fix bug #612756 where connectors with zero length (due to being clipped to the perimeter of two overlapping objects) could crash the connector context. Fixed bugs: - https://launchpad.net/bugs/612756 (bzr r9705.1.1) --- src/connector-context.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src/connector-context.cpp') diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 3791034d6..1263a9215 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -1760,12 +1760,22 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item) if (cc->active_conn == item) { - // Just adjust handle positions. - Geom::Point startpt = *(curve->first_point()) * i2d; - sp_knot_set_position(cc->endpt_handle[0], startpt, 0); + if (curve->is_empty()) + { + // Connector is invisible because it is clipped to the boundary of + // two overlpapping shapes. + sp_knot_hide(cc->endpt_handle[0]); + sp_knot_hide(cc->endpt_handle[1]); + } + else + { + // Just adjust handle positions. + Geom::Point startpt = *(curve->first_point()) * i2d; + sp_knot_set_position(cc->endpt_handle[0], startpt, 0); - Geom::Point endpt = *(curve->last_point()) * i2d; - sp_knot_set_position(cc->endpt_handle[1], endpt, 0); + Geom::Point endpt = *(curve->last_point()) * i2d; + sp_knot_set_position(cc->endpt_handle[1], endpt, 0); + } return; } @@ -1828,6 +1838,13 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item) G_CALLBACK(endpt_handler), cc); } + if (curve->is_empty()) + { + // Connector is invisible because it is clipped to the boundary + // of two overlpapping shapes. So, it doesn't need endpoints. + return; + } + Geom::Point startpt = *(curve->first_point()) * i2d; sp_knot_set_position(cc->endpt_handle[0], startpt, 0); -- cgit v1.2.3 From b40042fdedbe369317c253b0bb232b3291d24b9a Mon Sep 17 00:00:00 2001 From: Michael Wybrow Date: Fri, 13 Aug 2010 17:39:25 +1000 Subject: Fixes bug #478597 where the connector context crash due to asserting that paths marked as connectors were always open. Now it just treats them as connectors if they are open, or normal objects otherwise. Fixed bugs: - https://launchpad.net/bugs/478597 (bzr r9707.1.1) --- src/connector-context.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/connector-context.cpp') diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 1263a9215..f862abac4 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -1908,8 +1908,10 @@ static bool cc_item_is_shape(SPItem *item) bool cc_item_is_connector(SPItem *item) { if (SP_IS_PATH(item)) { - if (SP_PATH(item)->connEndPair.isAutoRoutingConn()) { - g_assert( SP_PATH(item)->original_curve ? !(SP_PATH(item)->original_curve->is_closed()) : !(SP_PATH(item)->curve->is_closed()) ); + bool closed = SP_PATH(item)->original_curve ? SP_PATH(item)->original_curve->is_closed() : SP_PATH(item)->curve->is_closed(); + if (SP_PATH(item)->connEndPair.isAutoRoutingConn() && !closed) { + // To be considered a connector, an object must be a non-closed + // path that is marked with a "inkscape:connector-type" attribute. return true; } } -- cgit v1.2.3 From fe28a839fbc995e2718afaffa852ae88909fd6cf Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Mon, 16 Aug 2010 22:59:42 +0200 Subject: Connector tool: pointers should be nulled after snapping (bzr r9716) --- src/connector-context.cpp | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'src/connector-context.cpp') diff --git a/src/connector-context.cpp b/src/connector-context.cpp index f862abac4..a1159e17d 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -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; @@ -1232,7 +1243,6 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval) 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); -- cgit v1.2.3 From 144819c918dc761641c3cb5a490205fb73194ee3 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Wed, 17 Nov 2010 13:12:56 +1100 Subject: Super duper mega (fun!) commit: replaced encoding=utf-8 with fileencoding=utf-8 in all 1074 Vim modelines. The reason for this is that (a) setting the encoding isn't nice, and (b) Vim 7.3 (with modeline enabled) disallows it and pops up an error whenever you open any file with it ("invalid modeline"). Also corrected five deviant modestrings: * src/ui/widget/dock.cpp and src/ui/widget/dock.h: missing colon at the end * src/ui/dialog/tile.cpp: removed gratuitous second colon at the end * src/helper/units-test.h: removed gratuitous space before a colon * share/extensions/export_gimp_palette.py: missing textwidth=99 That's my geekiest commit yet. (bzr r9900) --- src/connector-context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/connector-context.cpp') diff --git a/src/connector-context.cpp b/src/connector-context.cpp index a1159e17d..adc54a1ae 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -2052,4 +2052,4 @@ shape_event_attr_changed(Inkscape::XML::Node *repr, gchar const *name, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : -- cgit v1.2.3