diff --git a/src/zoom-context.cpp b/src/zoom-context.cpp
index 70582678f0d4fd003f155e81c20cf4272600e7e0..71dca484642ac044c8accc0ee64899b4a60450be 100644 (file)
--- a/src/zoom-context.cpp
+++ b/src/zoom-context.cpp
#include "desktop.h"
#include "pixmaps/cursor-zoom.xpm"
#include "pixmaps/cursor-zoom-out.xpm"
-#include "pixmaps/cursor-zoom.pixbuf"
-#include "pixmaps/cursor-zoom-out.pixbuf"
#include "prefs-utils.h"
#include "zoom-context.h"
SPEventContext *event_context = SP_EVENT_CONTEXT(zoom_context);
event_context->cursor_shape = cursor_zoom_xpm;
- event_context->cursor_pixbuf = gdk_pixbuf_new_from_inline(
- -1,
- cursor_zoom_pixbuf,
- FALSE,
- NULL);
- event_context->hot_x = 9;
- event_context->hot_y = 9;
+ event_context->hot_x = 6;
+ event_context->hot_y = 6;
}
static void
@@ -131,24 +124,32 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
switch (event->type) {
case GDK_BUTTON_PRESS:
- if (event->button.button == 1) {
+ {
+ NR::Point const button_w(event->button.x, event->button.y);
+ NR::Point const button_dt(desktop->w2d(button_w));
+ if (event->button.button == 1 && !event_context->space_panning) {
// save drag origin
xp = (gint) event->button.x;
yp = (gint) event->button.y;
within_tolerance = true;
- NR::Point const button_w(event->button.x, event->button.y);
- NR::Point const button_dt(desktop->w2d(button_w));
Inkscape::Rubberband::get()->start(desktop, button_dt);
escaped = false;
+ ret = TRUE;
+ } else if (event->button.button == 3) {
+ double const zoom_rel( (event->button.state & GDK_SHIFT_MASK)
+ ? zoom_inc
+ : 1 / zoom_inc );
+ desktop->zoom_relative_keep_point(button_dt, zoom_rel);
ret = TRUE;
}
break;
+ }
case GDK_MOTION_NOTIFY:
- if (event->motion.state & GDK_BUTTON1_MASK) {
+ if (event->motion.state & GDK_BUTTON1_MASK && !event_context->space_panning) {
ret = TRUE;
if ( within_tolerance
@@ -164,29 +165,31 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
NR::Point const motion_w(event->motion.x, event->motion.y);
NR::Point const motion_dt(desktop->w2d(motion_w));
Inkscape::Rubberband::get()->move(motion_dt);
+ gobble_motion_events(GDK_BUTTON1_MASK);
}
break;
- case GDK_BUTTON_RELEASE:
- if ( event->button.button == 1 ) {
+ case GDK_BUTTON_RELEASE:
+ {
+ NR::Point const button_w(event->button.x, event->button.y);
+ NR::Point const button_dt(desktop->w2d(button_w));
+ if ( event->button.button == 1 && !event_context->space_panning) {
NR::Maybe<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
- if (b != NR::Nothing() && !within_tolerance) {
- desktop->set_display_area(b.assume(), 10);
+ if (b && !within_tolerance) {
+ desktop->set_display_area(*b, 10);
} else if (!escaped) {
- NR::Point const button_w(event->button.x, event->button.y);
- NR::Point const button_dt(desktop->w2d(button_w));
double const zoom_rel( (event->button.state & GDK_SHIFT_MASK)
? 1 / zoom_inc
: zoom_inc );
desktop->zoom_relative_keep_point(button_dt, zoom_rel);
}
ret = TRUE;
- }
+ }
Inkscape::Rubberband::get()->stop();
xp = yp = 0;
escaped = false;
break;
-
+ }
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
case GDK_Escape:
@@ -206,34 +209,24 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
case GDK_Shift_L:
case GDK_Shift_R:
event_context->cursor_shape = cursor_zoom_out_xpm;
- event_context->cursor_pixbuf = gdk_pixbuf_new_from_inline(
- -1,
- cursor_zoom_out_pixbuf,
- FALSE,
- NULL);
sp_event_context_update_cursor(event_context);
break;
default:
- break;
- }
- break;
- case GDK_KEY_RELEASE:
+ break;
+ }
+ break;
+ case GDK_KEY_RELEASE:
switch (get_group0_keyval (&event->key)) {
- case GDK_Shift_L:
- case GDK_Shift_R:
+ case GDK_Shift_L:
+ case GDK_Shift_R:
event_context->cursor_shape = cursor_zoom_xpm;
- event_context->cursor_pixbuf = gdk_pixbuf_new_from_inline(
- -1,
- cursor_zoom_pixbuf,
- FALSE,
- NULL);
sp_event_context_update_cursor(event_context);
break;
- default:
+ default:
break;
- }
+ }
break;
- default:
+ default:
break;
}