zoom-context.cpp revision 3f2f2d9a36c8132d316033e29bb2bc116292dc9a
/*
* Handy zooming tool
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Frank Felfe <innerspace@iname.com>
* bulia byak <buliabyak@users.sf.net>
*
* Copyright (C) 1999-2002 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <gdk/gdkkeysyms.h>
#include "macros.h"
#include "rubberband.h"
#include "display/sp-canvas-item.h"
#include "display/sp-canvas-util.h"
#include "desktop.h"
#include "pixmaps/cursor-zoom.xpm"
#include "pixmaps/cursor-zoom-out.xpm"
#include "preferences.h"
#include "selection-chemistry.h"
#include "zoom-context.h"
static gint sp_zoom_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event);
static SPEventContextClass *parent_class;
static bool within_tolerance = false;
static bool escaped;
{
if (!type) {
sizeof(SPZoomContextClass),
sizeof(SPZoomContext),
4,
NULL, /* value_table */
};
}
return type;
}
{
}
{
}
static void
{
ec->enableGrDrag(false);
}
}
{
ec->enableSelectionCue();
}
ec->enableGrDrag();
}
}
}
static gint sp_zoom_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event)
{
}
return ret;
}
{
case GDK_BUTTON_PRESS:
{
// save drag origin
within_tolerance = true;
escaped = false;
? zoom_inc
: 1 / zoom_inc );
}
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,
break;
}
case GDK_MOTION_NOTIFY:
if ( within_tolerance
break; // do not drag if we're within tolerance from origin
}
// Once the user has moved farther than tolerance from the original location
// (indicating they intend to move the object, not click), then always process the
// motion notify coordinates as given (no snapping back to origin)
within_tolerance = false;
}
break;
case GDK_BUTTON_RELEASE:
{
if (b && !within_tolerance) {
} else if (!escaped) {
? 1 / zoom_inc
: zoom_inc );
}
}
}
escaped = false;
break;
}
case GDK_KEY_PRESS:
case GDK_KEY_Escape:
}
escaped = true;
break;
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
case GDK_KEY_KP_Down:
// prevent the zoom field from activation
if (!MOD__CTRL_ONLY)
break;
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
break;
case GDK_KEY_Delete:
case GDK_KEY_KP_Delete:
case GDK_KEY_BackSpace:
break;
default:
break;
}
break;
case GDK_KEY_RELEASE:
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
break;
default:
break;
}
break;
default:
break;
}
if (!ret) {
}
}
return ret;
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :