select-context.cpp revision 719c6eac5e52a8c67c78f97f4d930ef20f5c1c2e
0N/A#define __SP_SELECT_CONTEXT_C__
0N/A#ifdef HAVE_CONFIG_H
0N/A#include "rubberband.h"
0N/A#include "document.h"
1879N/A#include "selection.h"
1879N/A#include "seltrans-handles.h"
1879N/A#include "sp-cursor.h"
1879N/A#include "pixmaps/cursor-select-m.xpm"
1879N/A#include "pixmaps/cursor-select-d.xpm"
1879N/A#include "pixmaps/handles.xpm"
1879N/A#include "select-context.h"
1879N/A#include "selection-chemistry.h"
1879N/A#include "desktop-handles.h"
2796N/A#include "preferences.h"
2796N/A#include "tools-switch.h"
2796N/A#include "message-stack.h"
1879N/A#include "selection-describer.h"
0N/A#include "seltrans.h"
0N/Astatic gint sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event);
0N/Astatic gint rb_escaped = 0; // if non-zero, rubberband was canceled by esc, so the next button release should not deselect
0N/Astatic bool within_tolerance = false;
0N/A sizeof(SPSelectContextClass),
0N/A sizeof(SPSelectContext),
if (CursorSelectDragging) {
if (CursorSelectMouseover) {
SP_EVENT_CONTEXT(sc)->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Move canceled."));
SP_EVENT_CONTEXT(sc)->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Selection canceled."));
if (current_layer) {
if ( parent
static gint
case GDK_BUTTON_PRESS:
within_tolerance = true;
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
case GDK_KEY_PRESS:
if (!ret) {
return ret;
static gint
case GDK_2BUTTON_PRESS:
case GDK_BUTTON_PRESS:
within_tolerance = true;
GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK,
case GDK_MOTION_NOTIFY:
if ( within_tolerance
within_tolerance = false;
if (sc->button_press_ctrl || (sc->button_press_alt && !sc->button_press_shift && !selection->isEmpty())) {
// if neither a group nor an item (possibly in a group) at point are selected, set selection to the item at point
} // otherwise, do not change selection so that dragging selected-within-group items, as well as alt-dragging, is possible
event_context->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Draw over</b> objects to select them; release <b>Alt</b> to switch to rubberband selection"));
event_context->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag around</b> objects to select them; press <b>Alt</b> to switch to touch selection"));
case GDK_BUTTON_RELEASE:
r->stop();
r->stop();
if (item) {
} else if ((sc->button_press_ctrl || sc->button_press_alt) && !rb_escaped && !drag_escaped) { // ctrl+click, alt+click
if (item) {
rb_escaped = 0;
if (alt) {
case GDK_KP_Left:
case GDK_KP_4:
case GDK_KP_Up:
case GDK_KP_8:
case GDK_KP_Right:
case GDK_KP_6:
case GDK_KP_Down:
case GDK_KP_2:
case GDK_Escape:
case GDK_a:
case GDK_A:
if (MOD__CTRL_ONLY) {
case GDK_space:
case GDK_x:
case GDK_X:
if (MOD__ALT_ONLY) {
case GDK_bracketleft:
if (MOD__ALT) {
} else if (MOD__CTRL) {
} else if (snaps) {
case GDK_bracketright:
if (MOD__ALT) {
} else if (MOD__CTRL) {
} else if (snaps) {
case GDK_less:
case GDK_comma:
if (MOD__ALT) {
} else if (MOD__CTRL) {
case GDK_greater:
case GDK_period:
if (MOD__ALT) {
} else if (MOD__CTRL) {
case GDK_Return:
if (MOD__CTRL_ONLY) {
SP_EVENT_CONTEXT(sc)->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Selected object is not a group. Cannot enter."));
case GDK_BackSpace:
if (MOD__CTRL_ONLY) {
case GDK_s:
case GDK_S:
if (MOD__SHIFT_ONLY) {
case GDK_g:
case GDK_G:
if (MOD__SHIFT_ONLY) {
ret = true;
case GDK_KEY_RELEASE:
if (alt) {
if (!ret) {
return ret;