diff --git a/src/node-context.cpp b/src/node-context.cpp
index 88ea1667d24e40632208f8e9225dbb13073fc3c7..d8a1ec1d7deb953f20517561dfd35d78ff8b5d2b 100644 (file)
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
#include "shape-editor.h"
#include "live_effects/effect.h"
+#include "sp-lpe-item.h"
+
// needed for flash nodepath upon mouseover:
#include "display/canvas-bpath.h"
#include "display/curve.h"
Inkscape::Selection *selection = sp_desktop_selection (ec->desktop);
nc->sel_changed_connection.disconnect();
- nc->sel_modified_connection.disconnect();
nc->sel_changed_connection =
selection->connectChanged(sigc::bind(sigc::ptr_fun(&sp_node_context_selection_changed), (gpointer)nc));
- nc->sel_modified_connection =
- selection->connectModified(sigc::bind(sigc::ptr_fun(&sp_node_context_selection_modified), (gpointer)nc));
SPItem *item = selection->singleItem();
nc->current_state = SP_NODE_CONTEXT_INACTIVE;
if (item) {
- nc->shape_editor->set_item(item);
+ nc->shape_editor->set_item(item, SH_NODEPATH);
+ nc->shape_editor->set_item(item, SH_KNOTHOLDER);
}
if (prefs_get_int_attribute("tools.nodes", "selcue", 0) != 0) {
static void
sp_node_context_flash_path(SPEventContext *event_context, SPItem *item, guint timeout) {
+ g_print ("-----> sp_node_context_flash_path(): TODO: generate the helper path!!\n");
SPNodeContext *nc = SP_NODE_CONTEXT(event_context);
nc->remove_flash_counter = 3; // for some reason root_handler is called twice after each item_handler...
@@ -190,7 +191,7 @@ sp_node_context_flash_path(SPEventContext *event_context, SPItem *item, guint ti
}
if (SP_IS_PATH(item)) {
- SPCanvasItem *canvasitem = sp_nodepath_generate_helperpath(desktop, SP_PATH(item));
+ SPCanvasItem *canvasitem = sp_nodepath_helperpath_from_path(desktop, SP_PATH(item));
nc->flash_tempitem = desktop->add_temporary_canvasitem (canvasitem, timeout);
}
}
@@ -206,33 +207,14 @@ sp_node_context_selection_changed(Inkscape::Selection *selection, gpointer data)
SPNodeContext *nc = SP_NODE_CONTEXT(data);
// TODO: update ShapeEditorsCollective instead
- nc->shape_editor->unset_item();
+ nc->shape_editor->unset_item(SH_NODEPATH);
+ nc->shape_editor->unset_item(SH_KNOTHOLDER);
SPItem *item = selection->singleItem();
- nc->shape_editor->set_item(item);
+ nc->shape_editor->set_item(item, SH_NODEPATH);
+ nc->shape_editor->set_item(item, SH_KNOTHOLDER);
nc->shape_editor->update_statusbar();
}
-/**
-\brief Callback that processes the "modified" signal on the selection;
-updates temporary canvasitems associated to LPEItems in the selection
-*/
-void
-sp_node_context_selection_modified(Inkscape::Selection *selection, guint /*flags*/, gpointer /*data*/)
-{
- // TODO: do this for *all* items in the selection
- SPItem *item = selection->singleItem();
-
- // TODO: This is *very* inefficient! Can we avoid destroying and recreating the temporary
- // items? Also, we should only update those that actually need it!
- if (item && SP_IS_LPE_ITEM(item)) {
- SPLPEItem *lpeitem = SP_LPE_ITEM(item);
- SPDesktop *desktop = selection->desktop();
-
- sp_lpe_item_remove_temporary_canvasitems(lpeitem, desktop);
- sp_lpe_item_add_temporary_canvasitems(lpeitem, desktop);
- }
-}
-
void
sp_node_context_show_modifier_tip(SPEventContext *event_context, GdkEvent *event)
{
@@ -252,15 +234,11 @@ sp_node_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
guint timeout = prefs_get_int_attribute("tools.nodes", "pathflash_timeout", 500);
if (SP_IS_LPE_ITEM(item)) {
Inkscape::LivePathEffect::Effect *lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item));
- if (lpe) {
- if (lpe->pathFlashType() == Inkscape::LivePathEffect::SUPPRESS_FLASH) {
- // suppressed and permanent flashes for LPE items are handled in
- // sp_node_context_selection_changed()
- return ret;
- }
- if (lpe->pathFlashType() == Inkscape::LivePathEffect::PERMANENT_FLASH) {
- timeout = 0;
- }
+ 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;
}
}
sp_node_context_flash_path(event_context, item, timeout);
if (event->type == GDK_BUTTON_RELEASE) {
event_context->xp = event_context->yp = 0;
if (event->button.button == 1) {
- NR::Maybe<NR::Rect> b = Inkscape::Rubberband::get()->getRectangle();
+ boost::optional<NR::Rect> b = Inkscape::Rubberband::get()->getRectangle();
if (nc->shape_editor->hits_curve() && !event_context->within_tolerance) { //drag curve
nc->shape_editor->finish_drag();
break;
case GDK_Escape:
{
- NR::Maybe<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
+ boost::optional<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
if (b) {
Inkscape::Rubberband::get()->stop();
nc->current_state = SP_NODE_CONTEXT_INACTIVE;