From acae310d49358ac8de885fa8692caf5e4067574c Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 2 Mar 2008 13:38:15 +0000 Subject: NEW: temporary on-canvas indicators (bzr r4918) --- src/live_effects/parameter/point.cpp | 37 +++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'src/live_effects/parameter/point.cpp') diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 1859a0a09..38bf4be57 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -14,22 +14,23 @@ #include "ui/widget/point.h" #include "widgets/icon.h" #include "ui/widget/registered-widget.h" -#include "knot.h" #include "inkscape.h" #include "verbs.h" // needed for on-canvas editting: #include "tools-switch.h" -#include "shape-editor.h" #include "node-context.h" -#include "desktop-handles.h" -#include "selection.h" +#include "shape-editor.h" #include "desktop.h" +#include "selection.h" -#define LPEPOINTPARAM_DEBUG // undefine to disable all on-canvas editing code for PointParam +// temporarily needed for tempitem tryout +#include "desktop-handles.h" +#include "display/sodipodi-ctrl.h" +#include "knot.h" +#include "display/canvas-temporary-item-list.h" -#define PRM_KNOT_COLOR_NORMAL 0xffffff00 -#define PRM_KNOT_COLOR_SELECTED 0x0000ff00 +#define LPEPOINTPARAM_DEBUG // undefine to disable all on-canvas editing code for PointParam namespace Inkscape { @@ -93,6 +94,7 @@ PointParam::param_newWidget(Gtk::Tooltips * tooltips) param_effect->getRepr(), param_effect->getSPDoc() ) ); pointwdg->setValue( (*this)[0], (*this)[1] ); + pointwdg->clearProgrammatically(); pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter")); Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "draw_node", Inkscape::ICON_SIZE_BUTTON) ); @@ -142,6 +144,22 @@ PointParam::param_editOncanvas(SPItem * item, SPDesktop * dt) ShapeEditor * shape_editor = SP_NODE_CONTEXT( dt->event_context )->shape_editor; shape_editor->set_item_lpe_point_parameter(item, SP_OBJECT(param_effect->getLPEObj()), param_key.c_str()); + + + /* TEMPORARY CODE TO TEST TEMPORARY CANVAS ITEMS */ + SPDesktop *desktop = SP_ACTIVE_DESKTOP; + SPCanvasItem * canvasitem = sp_canvas_item_new( sp_desktop_tempgroup (desktop), + SP_TYPE_CTRL, + "anchor", GTK_ANCHOR_CENTER, + "size", 8.0, + "stroked", TRUE, + "stroke_color", 0xf000f0ff, + "mode", SP_KNOT_MODE_XOR, + "shape", SP_KNOT_SHAPE_CROSS, + NULL ); + SP_CTRL(canvasitem)->moveto ( static_cast (*this) ); + desktop->add_temporary_canvasitem(canvasitem, 2000); + /* END ---- TEMPORARY CODE TO TEST TEMPORARY CANVAS ITEMS */ } @@ -158,9 +176,10 @@ PointParam::param_transform_multiply(Geom::Matrix const& postmul, bool /*set*/) void PointParam::on_button_click() { - SPItem * item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem(); + SPDesktop *desktop = SP_ACTIVE_DESKTOP; + SPItem * item = sp_desktop_selection(desktop)->singleItem(); if (item != NULL) { - param_editOncanvas(item, SP_ACTIVE_DESKTOP); + param_editOncanvas(item, desktop); } } -- cgit v1.2.3