From 96b65f32d922a989131ae91798801ea54c4e8b10 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 28 Oct 2007 16:03:07 +0000 Subject: LPE: implement 'edit next LPE parameter'. Accessible through key '7'. (bzr r3968) --- src/live_effects/parameter/path.cpp | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'src/live_effects/parameter/path.cpp') diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index db1064511..2b558d2dd 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -46,6 +46,7 @@ PathParam::PathParam( const Glib::ustring& label, const Glib::ustring& tip, edit_button = NULL; defvalue = g_strdup(default_value); param_readSVGValue(defvalue); + oncanvas_editable = true; } PathParam::~PathParam() @@ -128,17 +129,34 @@ PathParam::param_getWidget() } void -PathParam::on_edit_button_click() +PathParam::param_editOncanvas(SPItem * item, SPDesktop * dt) { - // Switch to node edit tool: - tools_switch_current(TOOLS_NODES); + // If not already in nodecontext, goto it! + if (!tools_isactive(dt, TOOLS_NODES)) { + tools_switch_current(TOOLS_NODES); + } - // set this parameter to edit: - ShapeEditor * shape_editor = SP_NODE_CONTEXT( SP_ACTIVE_DESKTOP->event_context )->shape_editor; - SPItem * item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem(); + ShapeEditor * shape_editor = SP_NODE_CONTEXT( dt->event_context )->shape_editor; shape_editor->set_item_livepatheffect_parameter(item, SP_OBJECT(param_effect->getLPEObj()), param_key.c_str()); } +void +PathParam::param_write_to_repr(const char * svgd) +{ + param_effect->getRepr()->setAttribute(param_key.c_str(), svgd); +} + + +/* CALLBACK FUNCTIONS FOR THE BUTTONS */ +void +PathParam::on_edit_button_click() +{ + SPItem * item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem(); + if (item != NULL) { + param_editOncanvas(item, SP_ACTIVE_DESKTOP); + } +} + void PathParam::on_paste_button_click() { @@ -170,12 +188,6 @@ PathParam::on_paste_button_click() } } -void -PathParam::param_write_to_repr(const char * svgd) -{ - param_effect->getRepr()->setAttribute(param_key.c_str(), svgd); -} - } /* namespace LivePathEffect */ -- cgit v1.2.3