summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Smith <john.smith7545@yahoo.com>2012-12-14 03:17:13 +0000
committerJohn Smith <john.smith7545@yahoo.com>2012-12-14 03:17:13 +0000
commitcb1f232c390a1e0b96d140c2fdc52b526dc4573f (patch)
tree7521805e16d3d3d81a80e0aa9c870da45b64a8e2 /src
parentre-add Grayscale color mode (diff)
downloadinkscape-cb1f232c390a1e0b96d140c2fdc52b526dc4573f.tar.gz
inkscape-cb1f232c390a1e0b96d140c2fdc52b526dc4573f.zip
Fix for 383871 : Let space switch to selector tool even when used for panning
(bzr r11954)
Diffstat (limited to 'src')
-rw-r--r--src/event-context.cpp70
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp2
2 files changed, 50 insertions, 22 deletions
diff --git a/src/event-context.cpp b/src/event-context.cpp
index e9d0aa935..3c1609d97 100644
--- a/src/event-context.cpp
+++ b/src/event-context.cpp
@@ -464,10 +464,23 @@ static gint sp_event_context_private_root_handler(
break;
case GDK_MOTION_NOTIFY:
if (panning) {
+ if (panning == 4 && !xp && !yp ) {
+ // <Space> + mouse panning started, save location and grab canvas
+ xp = event->motion.x;
+ yp = event->motion.y;
+ button_w = Geom::Point(event->motion.x, event->motion.y);
+
+ sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
+ GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK
+ | GDK_POINTER_MOTION_MASK
+ | GDK_POINTER_MOTION_HINT_MASK, NULL,
+ event->motion.time - 1);
+
+
+ }
if ((panning == 2 && !(event->motion.state & GDK_BUTTON2_MASK))
- || (panning == 1 && !(event->motion.state
- & GDK_BUTTON1_MASK)) || (panning == 3
- && !(event->motion.state & GDK_BUTTON3_MASK))) {
+ || (panning == 1 && !(event->motion.state & GDK_BUTTON1_MASK))
+ || (panning == 3 && !(event->motion.state & GDK_BUTTON3_MASK))) {
/* Gdk seems to lose button release for us sometimes :-( */
panning = 0;
sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
@@ -570,6 +583,7 @@ static gint sp_event_context_private_root_handler(
}
ret = TRUE;
}
+
break;
case GDK_KEY_PRESS: {
double const acceleration = prefs->getDoubleLimited(
@@ -672,15 +686,13 @@ static gint sp_event_context_private_root_handler(
}
break;
case GDK_KEY_space:
- if (prefs->getBool("/options/spacepans/value")) {
- event_context->space_panning = true;
- event_context->_message_context->set(Inkscape::INFORMATION_MESSAGE,
- _("<b>Space+mouse drag</b> to pan canvas"));
- ret = TRUE;
- } else {
- sp_toggle_selector(desktop);
- ret = TRUE;
- }
+ xp = yp = 0;
+ within_tolerance = true;
+ panning = 4;
+ event_context->space_panning = true;
+ event_context->_message_context->set(Inkscape::INFORMATION_MESSAGE,
+ _("<b>Space+mouse move</b> to pan canvas"));
+ ret = TRUE;
break;
case GDK_KEY_z:
case GDK_KEY_Z:
@@ -695,18 +707,32 @@ static gint sp_event_context_private_root_handler(
}
break;
case GDK_KEY_RELEASE:
+
+ // Stop panning on any key release
+ if (event_context->space_panning) {
+ event_context->space_panning = false;
+ event_context->_message_context->clear();
+ }
+
+ if (panning) {
+ panning = 0;
+ xp = yp = 0;
+ sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
+ event->key.time);
+ desktop->updateNow();
+ }
+
+ if (panning_cursor == 1) {
+ panning_cursor = 0;
+ GtkWidget *w = GTK_WIDGET(sp_desktop_canvas(event_context->desktop));
+ gdk_window_set_cursor(gtk_widget_get_window (w), event_context->cursor);
+ }
+
switch (get_group0_keyval(&event->key)) {
case GDK_KEY_space:
- if (event_context->space_panning) {
- event_context->space_panning = false;
- event_context->_message_context->clear();
-
- if (panning == 1) {
- panning = 0;
- sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
- event->key.time);
- desktop->updateNow();
- }
+ if (within_tolerance == true) {
+ // Space was pressed, but not panned
+ sp_toggle_selector(desktop);
ret = TRUE;
}
break;
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index 291059999..cc145c16b 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -1162,9 +1162,11 @@ void InkscapePreferences::initPageBehavior()
_scroll_auto_thres.init ( "/options/autoscrolldistance/value", -600.0, 600.0, 1.0, 1.0, -10.0, true, false);
_page_scrolling.add_line( true, _("_Threshold:"), _scroll_auto_thres, _("pixels"),
_("How far (in screen pixels) you need to be from the canvas edge to trigger autoscroll; positive is outside the canvas, negative is within the canvas"), false);
+/*
_scroll_space.init ( _("Left mouse button pans when Space is pressed"), "/options/spacepans/value", false);
_page_scrolling.add_line( false, "", _scroll_space, "",
_("When on, pressing and holding Space and dragging with left mouse button pans canvas (as in Adobe Illustrator); when off, Space temporarily switches to Selector tool (default)"));
+*/
_wheel_zoom.init ( _("Mouse wheel zooms by default"), "/options/wheelzooms/value", false);
_page_scrolling.add_line( false, "", _wheel_zoom, "",
_("When on, mouse wheel zooms without Ctrl and scrolls canvas with Ctrl; when off, it zooms with Ctrl and scrolls without Ctrl"));