From 017e93e3dae0be363c6b9caf71d68dc4d1055bc9 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 2 Mar 2008 22:01:12 +0000 Subject: remove flashing test indicator on pointparam. remove some leftover code from point param code remove test pointparam from LPEKnot added SnapIndicator added SnapIndicator to SPDesktop, and a call from guidesnapping to display a snapindicator when a guide is snapped. fix canvas-temporary-item-list.cpp (bzr r4931) --- src/display/snap-indicator.cpp | 76 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/display/snap-indicator.cpp (limited to 'src/display/snap-indicator.cpp') diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp new file mode 100644 index 000000000..1d005ceb8 --- /dev/null +++ b/src/display/snap-indicator.cpp @@ -0,0 +1,76 @@ +/** \file + * Provides a class that shows a temporary indicator on the canvas of where the snap was, and what kind of snap + * + * Authors: + * Johan Engelen + * + * Copyright (C) Johan Engelen 2008 + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "display/snap-indicator.h" + +#include "desktop.h" +#include "desktop-handles.h" +#include "display/sodipodi-ctrl.h" +#include "knot.h" + +namespace Inkscape { +namespace Display { + +/** lifetime is measured in milliseconds + */ +SnapIndicator::SnapIndicator(SPDesktop * desktop) + : tempitem(NULL), + desktop(desktop) +{ +} + +SnapIndicator::~SnapIndicator() +{ + // remove item that might be present + remove_snappoint(); +} + +void +SnapIndicator::set_new_snappoint(Geom::Point p) +{ + remove_snappoint(); + + SPCanvasItem * canvasitem = sp_canvas_item_new( sp_desktop_tempgroup (desktop), + SP_TYPE_CTRL, + "anchor", GTK_ANCHOR_CENTER, + "size", 6.0, + "stroked", TRUE, + "stroke_color", 0xf000f0ff, + "mode", SP_KNOT_MODE_XOR, + "shape", SP_KNOT_SHAPE_CROSS, + NULL ); + SP_CTRL(canvasitem)->moveto ( p ); + tempitem = desktop->add_temporary_canvasitem(canvasitem, 2000); +} + +void +SnapIndicator::remove_snappoint() +{ + if (tempitem) { + desktop->remove_temporary_canvasitem(tempitem); + tempitem = NULL; + } +} + + +} //namespace Display +} /* namespace Inkscape */ + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : -- cgit v1.2.3