Lines Matching defs:knot

23 #include "knot.h"
24 #include "knot-ptr.h"
54 void knot_ref(SPKnot* knot) {
55 knot->ref_count++;
58 void knot_unref(SPKnot* knot) {
59 if (--knot->ref_count < 1) {
60 delete knot;
65 static int sp_knot_handler(SPCanvasItem *item, GdkEvent *event, SPKnot *knot);
171 // FIXME: cannot snap to destroyed knot (lp:1309050)
197 static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot)
199 g_assert(knot != NULL);
200 g_assert(SP_IS_KNOT(knot));
203 bool consumed = knot->event_signal.emit(knot, event);
211 knot_ref(knot);
219 knot->doubleclicked_signal.emit(knot, event->button.state);
227 if ((event->button.button == 1) && knot->desktop && knot->desktop->event_context && !knot->desktop->event_context->space_panning) {
228 Geom::Point const p = knot->desktop->w2d(Geom::Point(event->button.x, event->button.y));
229 knot->startDragging(p, (gint) event->button.x, (gint) event->button.y, event->button.time);
235 if (event->button.button == 1 && knot->desktop && knot->desktop->event_context && !knot->desktop->event_context->space_panning) {
237 if (knot->desktop->event_context->_delayed_snap_event) {
238 sp_event_context_snap_watchdog_callback(knot->desktop->event_context->_delayed_snap_event);
241 sp_event_context_discard_delayed_snap_event(knot->desktop->event_context);
243 knot->pressure = 0;
249 knot->setFlag(SP_KNOT_GRABBED, FALSE);
252 sp_canvas_item_ungrab(knot->item, event->button.time);
256 knot->setFlag(SP_KNOT_DRAGGING, FALSE);
258 knot->ungrabbed_signal.emit(knot, event->button.state);
260 knot->click_signal.emit(knot, event->button.state);
268 if (tools_isactive(knot->desktop, TOOLS_NODES)) {
269 Inkscape::UI::Tools::NodeTool *nt = static_cast<Inkscape::UI::Tools::NodeTool*>(knot->desktop->event_context);
274 if (grabbed && knot->desktop && knot->desktop->event_context && !knot->desktop->event_context->space_panning) {
288 if (gdk_event_get_axis (event, GDK_AXIS_PRESSURE, &knot->pressure)) {
289 knot->pressure = CLAMP (knot->pressure, 0, 1);
291 knot->pressure = 0.5;
295 knot->grabbed_signal.emit(knot, event->motion.state);
297 knot->setFlag(SP_KNOT_DRAGGING, TRUE);
300 sp_event_context_snap_delay_handler(knot->desktop->event_context, NULL, knot, (GdkEventMotion *)event, Inkscape::UI::Tools::DelayedSnapEvent::KNOT_HANDLER);
301 sp_knot_handler_request_position(event, knot);
304 if (tools_isactive(knot->desktop, TOOLS_NODES)) {
305 Inkscape::UI::Tools::NodeTool *nt = static_cast<Inkscape::UI::Tools::NodeTool*>(knot->desktop->event_context);
310 knot->setFlag(SP_KNOT_MOUSEOVER, TRUE);
311 knot->setFlag(SP_KNOT_GRABBED, FALSE);
313 if (knot->tip && knot->desktop && knot->desktop->event_context) {
314 knot->desktop->event_context->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, knot->tip);
322 knot->setFlag(SP_KNOT_MOUSEOVER, FALSE);
323 knot->setFlag(SP_KNOT_GRABBED, FALSE);
325 if (knot->tip && knot->desktop && knot->desktop->event_context) {
326 knot->desktop->event_context->defaultMessageContext()->clear();
333 case GDK_KEY_PRESS: // keybindings for knot
336 knot->setFlag(SP_KNOT_GRABBED, FALSE);
339 sp_canvas_item_ungrab(knot->item, event->button.time);
343 knot->setFlag(SP_KNOT_DRAGGING, FALSE);
345 knot->ungrabbed_signal.emit(knot, event->button.state);
347 DocumentUndo::undo(knot->desktop->getDocument());
348 knot->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Node or handle drag canceled."));
356 sp_event_context_discard_delayed_snap_event(knot->desktop->event_context);
368 knot_unref(knot);
377 void sp_knot_handler_request_position(GdkEvent *event, SPKnot *knot) {
379 Geom::Point const motion_dt = knot->desktop->w2d(motion_w);
380 Geom::Point p = motion_dt - knot->grabbed_rel_pos;
382 knot->requestPosition(p, event->motion.state);
383 knot->desktop->scroll_to_point (motion_dt);
384 knot->desktop->set_coordinate_status(knot->pos); // display the coordinate of knot, not cursor - they may be different!
402 /* If user did not complete, we simply move knot to new position */