snap-indicator.cpp revision abac96a58638236025e60f4dca3848bb294c6672
/** \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
* Diederik van Lierop
*
* Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>
* Copyright (C) Diederik van Lierop 2008 <mail@diedenrezi.nl>
*
* 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"
#include "preferences.h"
namespace Inkscape {
namespace Display {
: _snaptarget(NULL),
{
}
{
// remove item that might be present
}
void
{
/* Commented out for now, because this might hide any snapping bug!
if (!p.getSnapped()) {
return; // If we haven't snapped, then it is of no use to draw a snapindicator
}
*/
if (value) {
switch (p.getTarget()) {
/// @todo add the different kinds of snapindicator visuals
case SNAPTARGET_GRID:
case SNAPTARGET_GUIDE:
case SNAPTARGET_NODE:
case SNAPTARGET_PATH:
case SNAPTARGET_BBOX_CORNER:
case SNAPTARGET_BBOX_EDGE:
case SNAPTARGET_GRADIENT:
case SNAPTARGET_UNDEFINED:
default:
"anchor", GTK_ANCHOR_CENTER,
"size", 10.0,
"stroked", TRUE,
"stroke_color", 0xf000f0ff,
"mode", SP_KNOT_MODE_XOR,
"shape", SP_KNOT_SHAPE_CROSS,
NULL );
break;
}
remove_snapsource(); // Don't set both the source and target indicators, as these will overlap
_snaptarget = _desktop->add_temporary_canvasitem(canvasitem, 1000); // TODO add preference for snap indicator timeout
}
}
void
{
if (_snaptarget) {
_snaptarget = NULL;
}
}
void
{
if (value) {
"anchor", GTK_ANCHOR_CENTER,
"size", 10.0,
"stroked", TRUE,
"stroke_color", 0xf000f0ff,
"mode", SP_KNOT_MODE_XOR,
"shape", SP_KNOT_SHAPE_DIAMOND,
NULL );
}
}
void
{
if (_snapsource) {
_snapsource = 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 :