Code

verbify esc to deselect; enable esc and ctrl-z to cancel drawing in calligraphic
authorbuliabyak <buliabyak@users.sourceforge.net>
Sat, 3 Mar 2007 22:04:04 +0000 (22:04 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sat, 3 Mar 2007 22:04:04 +0000 (22:04 +0000)
share/keys/default.xml
share/keys/inkscape.xml
src/draw-context.cpp
src/dyna-draw-context.cpp
src/flood-context.cpp

index 39737a82aadc1c90ddb4836505a4451cdb01554e..077742e4c3af18de119268de4673979415fc799c 100644 (file)
@@ -299,7 +299,7 @@ override) the bindings in the main default.xml.
   <bind key="Tab" modifiers="Shift" action="EditSelectPrev" display="true"/>
   <bind key="ISO_Left_Tab" modifiers="Shift" action="EditSelectPrev" />
 
-  <bind action="EditDeselect" /> <!-- FIXME: currently deselecting is bypassing the verb, so it's not bound to Esc as it should be -->
+  <bind key="Escape" action="EditDeselect" /> 
 
 <!-- Objects/selection -->
 
index 39737a82aadc1c90ddb4836505a4451cdb01554e..077742e4c3af18de119268de4673979415fc799c 100644 (file)
@@ -299,7 +299,7 @@ override) the bindings in the main default.xml.
   <bind key="Tab" modifiers="Shift" action="EditSelectPrev" display="true"/>
   <bind key="ISO_Left_Tab" modifiers="Shift" action="EditSelectPrev" />
 
-  <bind action="EditDeselect" /> <!-- FIXME: currently deselecting is bypassing the verb, so it's not bound to Esc as it should be -->
+  <bind key="Escape" action="EditDeselect" /> 
 
 <!-- Objects/selection -->
 
index 028d889d9ad503f56a3b44dcdf11a01f27b68656..9390834d133041e3aef00e4f151211b8de40a861 100644 (file)
@@ -217,10 +217,6 @@ sp_draw_context_root_handler(SPEventContext *ec, GdkEvent *event)
     switch (event->type) {
         case GDK_KEY_PRESS:
             switch (get_group0_keyval (&event->key)) {
-                case GDK_Escape:
-                    sp_desktop_selection(desktop)->clear();
-                    ret = TRUE;
-                    break;
                 case GDK_Up:
                 case GDK_Down:
                 case GDK_KP_Up:
index 1ec0d7fde64e5919f21b7bd6a54f20bb31474d99..ba44df3ce784e05ebcc0a9a18a4598277cc7463c 100644 (file)
@@ -487,6 +487,27 @@ sp_ddc_update_toolbox (SPDesktop *desktop, const gchar *id, double value)
     desktop->setToolboxAdjustmentValue (id, value);
 }
 
+static void
+calligraphic_cancel(SPDynaDrawContext *dc)
+{
+    SPDesktop *desktop = SP_EVENT_CONTEXT(dc)->desktop;
+    dc->dragging = FALSE;
+    dc->is_drawing = false;
+    sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0);
+            /* Remove all temporary line segments */
+            while (dc->segments) {
+                gtk_object_destroy(GTK_OBJECT(dc->segments->data));
+                dc->segments = g_slist_remove(dc->segments, dc->segments->data);
+            }
+            /* reset accumulated curve */
+            sp_curve_reset(dc->accumulated);
+            clear_current(dc);
+            if (dc->repr) {
+                dc->repr = NULL;
+            }
+}
+
+
 gint
 sp_dyna_draw_context_root_handler(SPEventContext *event_context,
                                   GdkEvent *event)
@@ -635,9 +656,20 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context,
             }
             break;
         case GDK_Escape:
-            sp_desktop_selection(desktop)->clear();
+            if (dc->is_drawing) {
+                // if drawing, cancel, otherwise pass it up for deselecting
+                calligraphic_cancel (dc);
+                ret = TRUE;
+            }
+            break;
+        case GDK_z:
+        case GDK_Z:
+            if (MOD__CTRL_ONLY && dc->is_drawing) {
+                // if drawing, cancel, otherwise pass it up for undo
+                calligraphic_cancel (dc);
+                ret = TRUE;
+            }
             break;
-
         default:
             break;
         }
index 4c9406e67f0164d63b26f0095c0c01e0a9e0fd4e..6c90dff264eb333e52cd010a6d843b5130cfbf0b 100644 (file)
@@ -643,8 +643,6 @@ static gint sp_flood_context_root_handler(SPEventContext *event_context, GdkEven
             if (!MOD__CTRL_ONLY)
                 ret = TRUE;
             break;
-        case GDK_Escape:
-            sp_desktop_selection(desktop)->clear();
         default:
             break;
         }