diff --git a/src/select-context.cpp b/src/select-context.cpp
index fd4e132e1798cb054553f5e483a14b881916c90e..f58c034bdb9165a3d75bae9f78988fa6ad4ca0ab 100644 (file)
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
seltrans->ungrab();
sc->moved = FALSE;
sc->dragging = FALSE;
seltrans->ungrab();
sc->moved = FALSE;
sc->dragging = FALSE;
+ sp_event_context_snap_window_closed(event_context);
drag_escaped = 1;
if (sc->item) {
drag_escaped = 1;
if (sc->item) {
@@ -323,6 +324,7 @@ sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkE
// pass the event to root handler which will perform rubberband, shift-click, ctrl-click, ctrl-drag
} else {
sc->dragging = TRUE;
// pass the event to root handler which will perform rubberband, shift-click, ctrl-click, ctrl-drag
} else {
sc->dragging = TRUE;
+ sp_event_context_snap_window_open(event_context);
sc->moved = FALSE;
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
sc->moved = FALSE;
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
Inkscape::Selection *selection = sp_desktop_selection(desktop);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
Inkscape::Selection *selection = sp_desktop_selection(desktop);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- gdouble const nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000); // in px
- gdouble const offset = prefs->getDoubleLimited("/options/defaultscale/value", 2, 0, 1000);
- tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
- int const snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12);
-
// make sure we still have valid objects to move around
if (sc->item && SP_OBJECT_DOCUMENT( SP_OBJECT(sc->item))==NULL) {
sp_select_context_abort(event_context);
// make sure we still have valid objects to move around
if (sc->item && SP_OBJECT_DOCUMENT( SP_OBJECT(sc->item))==NULL) {
sp_select_context_abort(event_context);
@@ -427,10 +424,13 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
desktop->setCurrentLayer(reinterpret_cast<SPObject *>(clicked_item));
sp_desktop_selection(desktop)->clear();
sc->dragging = false;
desktop->setCurrentLayer(reinterpret_cast<SPObject *>(clicked_item));
sp_desktop_selection(desktop)->clear();
sc->dragging = false;
+ sp_event_context_snap_window_closed(event_context);
sp_canvas_end_forced_full_redraws(desktop->canvas);
} else { // switch tool
sp_canvas_end_forced_full_redraws(desktop->canvas);
} else { // switch tool
- tools_switch_by_item (desktop, clicked_item);
+ Geom::Point const button_pt(event->button.x, event->button.y);
+ Geom::Point const p(desktop->w2d(button_pt));
+ tools_switch_by_item (desktop, clicked_item, p);
}
} else {
sp_select_context_up_one_layer(desktop);
}
} else {
sp_select_context_up_one_layer(desktop);
break;
case GDK_MOTION_NOTIFY:
break;
case GDK_MOTION_NOTIFY:
- if (event->motion.state & GDK_BUTTON1_MASK && !event_context->space_panning) {
+ tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
+ if (event->motion.state & GDK_BUTTON1_MASK && !event_context->space_panning) {
Geom::Point const motion_pt(event->motion.x, event->motion.y);
Geom::Point const p(desktop->w2d(motion_pt));
Geom::Point const motion_pt(event->motion.x, event->motion.y);
Geom::Point const p(desktop->w2d(motion_pt));
if (sc->button_press_ctrl || (sc->button_press_alt && !sc->button_press_shift && !selection->isEmpty())) {
// if it's not click and ctrl or alt was pressed (the latter with some selection
// but not with shift) we want to drag rather than rubberband
if (sc->button_press_ctrl || (sc->button_press_alt && !sc->button_press_shift && !selection->isEmpty())) {
// if it's not click and ctrl or alt was pressed (the latter with some selection
// but not with shift) we want to drag rather than rubberband
- sc->dragging = TRUE;
+ if (sc->dragging == FALSE) {
+ sp_event_context_snap_window_open(event_context);
+ }
+ sc->dragging = TRUE;
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
}
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
}
if (!sc->moved) {
item_in_group = desktop->item_at_point(Geom::Point(event->button.x, event->button.y), TRUE);
group_at_point = desktop->group_at_point(Geom::Point(event->button.x, event->button.y));
if (!sc->moved) {
item_in_group = desktop->item_at_point(Geom::Point(event->button.x, event->button.y), TRUE);
group_at_point = desktop->group_at_point(Geom::Point(event->button.x, event->button.y));
+ if (SP_IS_LAYER(selection->single()))
+ group_at_point = SP_GROUP(selection->single());
// group-at-point is meant to be topmost item if it's a group,
// not topmost group of all items at point
// group-at-point is meant to be topmost item if it's a group,
// not topmost group of all items at point
ret = TRUE;
} else {
sc->dragging = FALSE;
ret = TRUE;
} else {
sc->dragging = FALSE;
-
+ sp_event_context_snap_window_closed(event_context);
sp_canvas_end_forced_full_redraws(desktop->canvas);
}
} else {
sp_canvas_end_forced_full_redraws(desktop->canvas);
}
} else {
seltrans->resetState();
selection->toggle(sc->item);
} else {
seltrans->resetState();
selection->toggle(sc->item);
} else {
+ SPObject* single = selection->single();
// without shift, increase state (i.e. toggle scale/rotation handles)
if (selection->includes(sc->item)) {
seltrans->increaseState();
// without shift, increase state (i.e. toggle scale/rotation handles)
if (selection->includes(sc->item)) {
seltrans->increaseState();
+ } else if (SP_IS_LAYER(single) && single->isAncestorOf(sc->item)) {
+ seltrans->increaseState();
} else {
seltrans->resetState();
selection->set(sc->item);
} else {
seltrans->resetState();
selection->set(sc->item);
}
}
sc->dragging = FALSE;
}
}
sc->dragging = FALSE;
-
+ sp_event_context_snap_window_closed(event_context);
sp_canvas_end_forced_full_redraws(desktop->canvas);
if (sc->item) {
sp_canvas_end_forced_full_redraws(desktop->canvas);
if (sc->item) {
case GDK_KEY_PRESS: // keybindings for select context
case GDK_KEY_PRESS: // keybindings for select context
- {
- guint keyval = get_group0_keyval(&event->key);
+ {
+ {
+ guint keyval = get_group0_keyval(&event->key);
bool alt = ( MOD__ALT
|| (keyval == GDK_Alt_L)
|| (keyval == GDK_Alt_R)
bool alt = ( MOD__ALT
|| (keyval == GDK_Alt_L)
|| (keyval == GDK_Alt_R)
//*/
break;
}
//*/
break;
}
- }
+ }
- switch (get_group0_keyval (&event->key)) {
+ gdouble const nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000); // in px
+ gdouble const offset = prefs->getDoubleLimited("/options/defaultscale/value", 2, 0, 1000);
+ int const snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12);
+
+ switch (get_group0_keyval (&event->key)) {
case GDK_Left: // move selection left
case GDK_KP_Left:
case GDK_KP_4:
case GDK_Left: // move selection left
case GDK_KP_Left:
case GDK_KP_4:
break;
}
break;
break;
}
break;
-
+ }
case GDK_KEY_RELEASE:
{
guint keyval = get_group0_keyval(&event->key);
case GDK_KEY_RELEASE:
{
guint keyval = get_group0_keyval(&event->key);