Code

* src/connector-context.cpp: Allow canceling of Connector Endpoint
authormjwybrow <mjwybrow@users.sourceforge.net>
Thu, 1 Feb 2007 05:40:58 +0000 (05:40 +0000)
committermjwybrow <mjwybrow@users.sourceforge.net>
Thu, 1 Feb 2007 05:40:58 +0000 (05:40 +0000)
      dragging when the user hits Escape.  This is now more consistent
      with the rest of Inkscape's tools.

src/connector-context.cpp

index 9d15ce10a3a4367821580c977640f674c27e8a19..644aa05777bf979690454604dad5c22b17a5ce85 100644 (file)
@@ -742,7 +742,26 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval)
             }
             break;
         case GDK_Escape:
-            if (cc->npoints != 0) {
+            if (cc->state == SP_CONNECTOR_CONTEXT_REROUTING) {
+                SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
+                SPDocument *doc = sp_desktop_document(desktop);
+                // Clear the temporary path:
+                sp_curve_reset(cc->red_curve);
+                sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), NULL);
+
+                cc->clickeditem->setHidden(false);
+                sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, 
+                                 _("Reroute connector"));
+                cc_set_active_conn(cc, cc->clickeditem);
+                
+                cc->state = SP_CONNECTOR_CONTEXT_IDLE;
+                sp_document_undo(doc);
+                desktop->messageStack()->flash( Inkscape::NORMAL_MESSAGE,
+                        _("Connector endpoint drag canceled."));
+                ret = TRUE;
+            }
+            else if (cc->npoints != 0) {
                 // if drawing, cancel, otherwise pass it up for deselecting
                 cc->state = SP_CONNECTOR_CONTEXT_STOP;
                 spcc_reset_colors(cc);