From 2a763f6b5670b18dd1dedee9a45b7c7f35db016d Mon Sep 17 00:00:00 2001 From: buliabyak Date: Wed, 10 Jun 2009 22:32:57 +0000 Subject: [PATCH] disable helperpath flashing for texts but enable it for grouped paths --- src/node-context.cpp | 55 +++++++++++++++++++++++++++++--------------- src/nodepath.cpp | 4 +++- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/src/node-context.cpp b/src/node-context.cpp index a28e0d6bc..6ad7b85d4 100644 --- a/src/node-context.cpp +++ b/src/node-context.cpp @@ -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) diff --git a/src/nodepath.cpp b/src/nodepath.cpp index ad230df75..8a47b658b 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -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; -- 2.30.2