Code

disable helperpath flashing for texts but enable it for grouped paths
authorbuliabyak <buliabyak@users.sourceforge.net>
Wed, 10 Jun 2009 22:32:57 +0000 (22:32 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Wed, 10 Jun 2009 22:32:57 +0000 (22:32 +0000)
src/node-context.cpp
src/nodepath.cpp

index a28e0d6bcf4d4ee6591950d3a544cd6c0ce5bbef..6ad7b85d429b8762cee096ba267a233608b12cc6 100644 (file)
@@ -230,27 +230,46 @@ sp_node_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
 {
     gint ret = FALSE;
     Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+    SPDesktop *desktop = event_context->desktop;
 
-    if (prefs->getBool("/tools/nodes/pathflash_enabled")) {
-        if (prefs->getBool("/tools/nodes/pathflash_unselected")) {
-            SPDesktop *desktop = event_context->desktop;
-            ShapeEditor* se = event_context->shape_editor;
-            Inkscape::Selection *selection = sp_desktop_selection (desktop);
-            if (se->has_nodepath() && selection->singleItem()) {
-                return ret;
-            }
-        }
-        if (SP_IS_LPE_ITEM(item)) {
-            Inkscape::LivePathEffect::Effect *lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item));
-            if (lpe && (lpe->providesOwnFlashPaths() ||
-                        lpe->pathFlashType() == Inkscape::LivePathEffect::SUPPRESS_FLASH)) {
-                // path should be suppressed or permanent; this is handled in
-                // sp_node_context_selection_changed()
-                return ret;
+    switch (event->type) {
+        case GDK_MOTION_NOTIFY:
+        {
+            // find out actual item we're over, disregarding groups
+            SPItem *actual_item = sp_event_context_find_item (desktop,
+                                                              Geom::Point(event->button.x, event->button.y), FALSE, TRUE);
+            if (!actual_item)
+                break;
+
+
+            if (prefs->getBool("/tools/nodes/pathflash_enabled")) {
+                if (prefs->getBool("/tools/nodes/pathflash_unselected")) {
+                    // do not flash if we have some path selected and a single item in selection (i.e. it
+                    // is the same path that we're editing)
+                    SPDesktop *desktop = event_context->desktop;
+                    ShapeEditor* se = event_context->shape_editor;
+                    Inkscape::Selection *selection = sp_desktop_selection (desktop);
+                    if (se->has_nodepath() && selection->singleItem()) {
+                        break;
+                    }
+                }
+                if (SP_IS_LPE_ITEM(actual_item)) {
+                    Inkscape::LivePathEffect::Effect *lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(actual_item));
+                    if (lpe && (lpe->providesOwnFlashPaths() ||
+                                lpe->pathFlashType() == Inkscape::LivePathEffect::SUPPRESS_FLASH)) {
+                        // path should be suppressed or permanent; this is handled in
+                        // sp_node_context_selection_changed()
+                        break;
+                    }
+                }
+                guint timeout = prefs->getInt("/tools/nodes/pathflash_timeout", 500);
+                sp_node_context_flash_path(event_context, actual_item, timeout);
             }
         }
-        guint timeout = prefs->getInt("/tools/nodes/pathflash_timeout", 500);
-        sp_node_context_flash_path(event_context, item, timeout);
+        break;
+
+        default:
+            break;
     }
 
     if (((SPEventContextClass *) parent_class)->item_handler)
index ad230df75645ee1934933a75418cb3d5798a059f..8a47b658bffa08ef31f77500baa2ecb18e260f38 100644 (file)
@@ -5067,7 +5067,9 @@ sp_nodepath_generate_helperpath(SPDesktop *desktop, SPItem *item) {
     } else if ( SP_IS_SHAPE(item) && SP_SHAPE(item)->curve ) {
         curve = sp_shape_get_curve (SP_SHAPE(item));
     } else if ( SP_IS_TEXT(item) ) {
-        curve = SP_TEXT(item)->getNormalizedBpath();
+        // do not display helperpath for text - we cannot do anything with it in Node tool anyway
+        // curve = SP_TEXT(item)->getNormalizedBpath();
+        return NULL;
     } else {
         g_warning ("-----> sp_nodepath_generate_helperpath(SPDesktop *desktop, SPItem *item): TODO: generate the helper path for this item type!\n");
         return NULL;