zoom-context.cpp revision 60d3de07a6473dd321c1d0016f49d13eb06c0884
#define __SP_ZOOM_CONTEXT_C__
/*
* 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 "desktop.h"
#include "pixmaps/cursor-zoom.xpm"
#include "pixmaps/cursor-zoom-out.xpm"
#include "prefs-utils.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;
}
{
double const zoom_inc = prefs_get_double_attribute_limited("options.zoomincrement", "value", M_SQRT2, 1.01, 10);
case GDK_BUTTON_PRESS:
// save drag origin
within_tolerance = true;
escaped = false;
}
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_Escape:
escaped = true;
break;
case GDK_Up:
case GDK_Down:
case GDK_KP_Up:
case GDK_KP_Down:
// prevent the zoom field from activation
if (!MOD__CTRL_ONLY)
break;
case GDK_Shift_L:
case GDK_Shift_R:
break;
default:
break;
}
break;
case GDK_KEY_RELEASE:
case GDK_Shift_L:
case GDK_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 :