X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fconnector-context.cpp;h=3e04883b7853a9a335007261d9afc69e05d42626;hb=7097e7ab2174df684754192f96a2319ad1f67235;hp=476b87bc633acea8dda52cbd0c523d5ea6536991;hpb=55ab52968b881ccf64a82c33e2139ff7025383e3;p=inkscape.git diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 476b87bc6..3e04883b7 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -388,19 +388,19 @@ conn_pt_handle_test(SPConnectorContext *cc, NR::Point& p) static gint -sp_connector_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event) +sp_connector_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event) { gint ret = FALSE; - SPDesktop *desktop = ec->desktop; + SPDesktop *desktop = event_context->desktop; - SPConnectorContext *cc = SP_CONNECTOR_CONTEXT(ec); + SPConnectorContext *cc = SP_CONNECTOR_CONTEXT(event_context); NR::Point p(event->button.x, event->button.y); switch (event->type) { case GDK_BUTTON_RELEASE: - if (event->button.button == 1) { + if (event->button.button == 1 && !event_context->space_panning) { if ((cc->state == SP_CONNECTOR_CONTEXT_DRAGGING) && (connector_within_tolerance)) { @@ -489,9 +489,10 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const NR::Point const event_w(bevent.x, bevent.y); /* Find desktop coordinates */ NR::Point p = cc->desktop->w2d(event_w); + SPEventContext *event_context = SP_EVENT_CONTEXT(cc); gint ret = FALSE; - if ( bevent.button == 1 ) { + if ( bevent.button == 1 && !event_context->space_panning ) { SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); @@ -528,7 +529,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const // This is the first point, so just snap it to the grid // as there's no other points to go off. SnapManager const &m = cc->desktop->namedview->snap_manager; - p = m.freeSnap(Inkscape::Snapper::SNAP_POINT | Inkscape::Snapper::BBOX_POINT, + p = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p, NULL).getPoint(); } spcc_connector_set_initial_point(cc, p); @@ -586,8 +587,9 @@ static gint connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion const &mevent) { gint ret = FALSE; + SPEventContext *event_context = SP_EVENT_CONTEXT(cc); - if (mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) { + if (event_context->space_panning || mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) { // allow middle-button scrolling return FALSE; } @@ -665,7 +667,8 @@ static gint connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton const &revent) { gint ret = FALSE; - if ( revent.button == 1 ) { + SPEventContext *event_context = SP_EVENT_CONTEXT(cc); + if ( revent.button == 1 && !event_context->space_panning ) { SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); SPDocument *doc = sp_desktop_document(desktop); @@ -743,7 +746,7 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval) cc->state = SP_CONNECTOR_CONTEXT_IDLE; desktop->messageStack()->flash( Inkscape::NORMAL_MESSAGE, - _("Connector endpoint drag canceled.")); + _("Connector endpoint drag cancelled.")); ret = TRUE; } else if (cc->npoints != 0) { @@ -962,7 +965,7 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc) static void -spcc_connector_finish_segment(SPConnectorContext *const cc, NR::Point const p) +spcc_connector_finish_segment(SPConnectorContext *const cc, NR::Point const /*p*/) { if (!sp_curve_empty(cc->red_curve)) { sp_curve_append_continuous(cc->green_curve, cc->red_curve, 0.0625); @@ -1044,7 +1047,7 @@ cc_generic_knot_handler(SPCanvasItem *, GdkEvent *event, SPKnot *knot) static gboolean -endpt_handler(SPKnot *knot, GdkEvent *event, SPConnectorContext *cc) +endpt_handler(SPKnot */*knot*/, GdkEvent *event, SPConnectorContext *cc) { g_assert( SP_IS_CONNECTOR_CONTEXT(cc) ); @@ -1145,12 +1148,14 @@ static void cc_set_active_shape(SPConnectorContext *cc, SPItem *item) } - NR::Rect bbox = sp_item_bbox_desktop(cc->active_shape); - NR::Point center = bbox.midpoint(); - sp_knot_set_position(cc->connpthandle, ¢er, 0); - - sp_knot_show(cc->connpthandle); - + NR::Maybe bbox = sp_item_bbox_desktop(cc->active_shape); + if (bbox) { + NR::Point center = bbox->midpoint(); + sp_knot_set_position(cc->connpthandle, ¢er, 0); + sp_knot_show(cc->connpthandle); + } else { + sp_knot_hide(cc->connpthandle); + } } @@ -1343,8 +1348,8 @@ cc_selection_changed(Inkscape::Selection *selection, gpointer data) static void -shape_event_attr_deleted(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, - Inkscape::XML::Node *ref, gpointer data) +shape_event_attr_deleted(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node *child, + Inkscape::XML::Node */*ref*/, gpointer data) { g_assert(data); SPConnectorContext *cc = SP_CONNECTOR_CONTEXT(data); @@ -1358,8 +1363,8 @@ shape_event_attr_deleted(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, static void shape_event_attr_changed(Inkscape::XML::Node *repr, gchar const *name, - gchar const *old_value, gchar const *new_value, - bool is_interactive, gpointer data) + gchar const */*old_value*/, gchar const */*new_value*/, + bool /*is_interactive*/, gpointer data) { g_assert(data); SPConnectorContext *cc = SP_CONNECTOR_CONTEXT(data);