/*
* SPKnot implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Abhishek Sharma
*
* Copyright (C) 1999-2005 authors
* Copyright (C) 2001-2002 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gdk/gdkkeysyms.h>
#include "display/sodipodi-ctrl.h"
#include "desktop.h"
#include "knot.h"
#include "knot-ptr.h"
#include "document.h"
#include "document-undo.h"
#include "preferences.h"
#include "message-stack.h"
#include "message-context.h"
#include "ui/tools-switch.h"
#include "ui/tools/tool-base.h"
#include "ui/tools/node-tool.h"
using Inkscape::DocumentUndo;
static bool grabbed = false;
static bool moved = false;
static bool within_tolerance = false;
}
delete knot;
}
}
: ref_count(1)
{
this->flags = 0;
this->size = 8;
this->anchor = SP_ANCHOR_CENTER;
this->shape = SP_KNOT_SHAPE_SQUARE;
this->mode = SP_KNOT_MODE_XOR;
this->_event_handler_id = 0;
this->pressure = 0;
this->saved_cursor = NULL;
this->flags = SP_KNOT_VISIBLE;
if (tip) {
}
"anchor", SP_ANCHOR_CENTER,
"size", 8.0,
"filled", TRUE,
"fill_color", 0xffffff00,
"stroked", TRUE,
"stroke_color", 0x01000000,
"mode", SP_KNOT_MODE_XOR,
NULL);
G_CALLBACK(sp_knot_handler), this);
knot_created_callback(this);
}
#if GTK_CHECK_VERSION(3,0,0)
// This happens e.g. when deleting a node in node tool while dragging it
}
#else
// This happens e.g. when deleting a node in node tool while dragging it
}
#endif
if (this->_event_handler_id > 0) {
this->_event_handler_id = 0;
}
if (this->item) {
sp_canvas_item_destroy(this->item);
}
for (gint i = 0; i < SP_KNOT_VISIBLE_STATES; i++) {
if (this->cursor[i]) {
#if GTK_CHECK_VERSION(3,0,0)
g_object_unref(this->cursor[i]);
#else
gdk_cursor_unref(this->cursor[i]);
#endif
}
}
if (this->tip) {
}
// FIXME: cannot snap to destroyed knot (lp:1309050)
//sp_event_context_discard_delayed_snap_event(this->desktop->event_context);
knot_deleted_callback(this);
}
// save drag origin
xp = x;
yp = y;
within_tolerance = true;
this->grabbed_rel_pos = p - this->pos;
this->drag_origin = this->pos;
if (!nograb) {
}
}
/**
* Called to handle events on knots.
*/
{
/* Run client universal event handler, if present */
if (consumed) {
return true;
}
case GDK_2BUTTON_PRESS:
}
break;
case GDK_BUTTON_PRESS:
if ((event->button.button == 1) && knot->desktop && knot->desktop->event_context && !knot->desktop->event_context->space_panning) {
}
break;
case GDK_BUTTON_RELEASE:
if (event->button.button == 1 && knot->desktop && knot->desktop->event_context && !knot->desktop->event_context->space_panning) {
// If we have any pending snap event, then invoke it now
}
if (transform_escaped) {
transform_escaped = false;
} else {
if (!nograb) {
}
if (moved) {
} else {
}
}
}
Inkscape::UI::Tools::NodeTool *nt = static_cast<Inkscape::UI::Tools::NodeTool*>(knot->desktop->event_context);
nt->update_helperpath();
}
break;
case GDK_MOTION_NOTIFY:
if (grabbed && knot->desktop && knot->desktop->event_context && !knot->desktop->event_context->space_panning) {
if ( within_tolerance
break; // do not drag if we're within tolerance from origin
}
// Once the user has moved farther than tolerance from the original location
// (indicating they intend to move the object, not click), then always process the
// motion notify coordinates as given (no snapping back to origin)
within_tolerance = false;
} else {
}
if (!moved) {
}
sp_event_context_snap_delay_handler(knot->desktop->event_context, NULL, knot, (GdkEventMotion *)event, Inkscape::UI::Tools::DelayedSnapEvent::KNOT_HANDLER);
}
Inkscape::UI::Tools::NodeTool *nt = static_cast<Inkscape::UI::Tools::NodeTool*>(knot->desktop->event_context);
nt->update_helperpath();
}
break;
case GDK_ENTER_NOTIFY:
}
break;
case GDK_LEAVE_NOTIFY:
}
break;
case GDK_KEY_PRESS: // keybindings for knot
case GDK_KEY_Escape:
if (!nograb) {
}
if (moved) {
transform_escaped = true;
}
break;
default:
break;
}
break;
default:
break;
}
if (key_press_event_unconsumed) {
return false; // e.g. in case "%" was pressed to toggle snapping, or Q for quick zoom (while dragging a handle)
} else {
}
}
knot->desktop->set_coordinate_status(knot->pos); // display the coordinate of knot, not cursor - they may be different!
}
}
}
}
/* If user did not complete, we simply move knot to new position */
if (!done) {
this->setPosition(p, state);
}
}
this->pos = p;
if (this->item) {
}
}
this->pos = p;
if (this->item) {
}
}
return this->pos;
}
if (set) {
} else {
}
switch (flag) {
case SP_KNOT_VISIBLE:
if (set) {
sp_canvas_item_show(this->item);
} else {
sp_canvas_item_hide(this->item);
}
break;
case SP_KNOT_MOUSEOVER:
case SP_KNOT_DRAGGING:
this->_setCtrlState();
break;
case SP_KNOT_GRABBED:
break;
default:
break;
}
}
if (!this->item) {
return;
}
if (this->pixbuf) {
}
this->_setCtrlState();
}
if (this->flags & SP_KNOT_DRAGGING) {
} else if (this->flags & SP_KNOT_MOUSEOVER) {
}
}
size = i;
}
shape = (SPKnotShapeType) i;
}
anchor = (SPAnchorType) i;
}
mode = (SPKnotModeType) i;
}
pixbuf = p;
}
}
}
}
if (cursor[SP_KNOT_STATE_NORMAL]) {
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
}
if (normal) {
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
}
if (cursor[SP_KNOT_STATE_MOUSEOVER]) {
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
}
if (mouseover) {
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
}
if (cursor[SP_KNOT_STATE_DRAGGING]) {
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
}
if (dragging) {
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
}
}
/*
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 :