From: cilix42 Date: Mon, 18 Aug 2008 00:38:15 +0000 (+0000) Subject: Really call sp_lpetool_context_selection_changed() when selection changed (had forgot... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b1798264b507f9635439865f6cfaa4cbf3a049e1;p=inkscape.git Really call sp_lpetool_context_selection_changed() when selection changed (had forgotten to connect to signal before) --- diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp index 631207b10..d8d3fb6ec 100644 --- a/src/lpe-tool-context.cpp +++ b/src/lpe-tool-context.cpp @@ -73,6 +73,8 @@ static void sp_lpetool_context_setup(SPEventContext *ec); static void sp_lpetool_context_set(SPEventContext *ec, gchar const *key, gchar const *val); static gint sp_lpetool_context_root_handler(SPEventContext *ec, GdkEvent *event); +void sp_lpetool_context_selection_changed(Inkscape::Selection *selection, gpointer data); + const int num_subtools = 4; Inkscape::LivePathEffect::EffectType lpesubtools[] = { @@ -132,6 +134,8 @@ sp_lpetool_context_init(SPLPEToolContext *lc) lc->hot_x = 4; lc->hot_y = 4; + new (&lc->sel_changed_connection) sigc::connection(); + //lc->tool_state = LPETOOL_STATE_NODE; } @@ -141,6 +145,9 @@ sp_lpetool_context_dispose(GObject *object) SPLPEToolContext *lc = SP_LPETOOL_CONTEXT(object); delete lc->shape_editor; + lc->sel_changed_connection.disconnect(); + lc->sel_changed_connection.~connection(); + G_OBJECT_CLASS(lpetool_parent_class)->dispose(object); } @@ -155,6 +162,10 @@ sp_lpetool_context_setup(SPEventContext *ec) Inkscape::Selection *selection = sp_desktop_selection (ec->desktop); SPItem *item = selection->singleItem(); + lc->sel_changed_connection.disconnect(); + lc->sel_changed_connection = + selection->connectChanged(sigc::bind(sigc::ptr_fun(&sp_lpetool_context_selection_changed), (gpointer)lc)); + //lc->my_nc = new NodeContextCpp(lc->desktop, lc->prefs_repr, lc->key); lc->shape_editor = new ShapeEditor(ec->desktop); @@ -220,7 +231,8 @@ gint sp_lpetool_context_root_handler(SPEventContext *event_context, GdkEvent *event) { SPLPEToolContext *lc = SP_LPETOOL_CONTEXT(event_context); - //SPDesktop *desktop = event_context->desktop; + SPDesktop *desktop = event_context->desktop; + Inkscape::Selection *selection = sp_desktop_selection (desktop); //gint ret = FALSE; bool ret = false; @@ -228,7 +240,7 @@ sp_lpetool_context_root_handler(SPEventContext *event_context, GdkEvent *event) if (sp_pen_context_has_waiting_LPE(lc)) { // quit when we are waiting for a LPE to be applied g_print ("LPETool has waiting LPE. We call the pen tool parent context and return\n"); - + if (((SPEventContextClass *) lpetool_parent_class)->root_handler) { ret = ((SPEventContextClass *) lpetool_parent_class)->root_handler(event_context, event); } @@ -263,8 +275,8 @@ sp_lpetool_context_root_handler(SPEventContext *event_context, GdkEvent *event) } ret = true; - break; + break; /** SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc); diff --git a/src/lpe-tool-context.h b/src/lpe-tool-context.h index 032d89b68..dc609ac27 100644 --- a/src/lpe-tool-context.h +++ b/src/lpe-tool-context.h @@ -42,6 +42,8 @@ struct SPLPEToolContext : public SPPenContext { //int tool_state; ShapeEditor* shape_editor; + + sigc::connection sel_changed_connection; }; struct SPLPEToolContextClass : public SPEventContextClass{};