desktop-events.cpp revision 95a79e1608143335aec1e9d54415699343294039
#define __SP_DESKTOP_EVENTS_C__
/*
* Event handlers for SPDesktop
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
*
* Copyright (C) 1999-2002 Lauris Kaplinski
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "display/guideline.h"
#include "helper/unit-menu.h"
#include "desktop.h"
#include "document.h"
#include "sp-guide.h"
#include "sp-namedview.h"
#include "desktop-handles.h"
#include "event-context.h"
#include "widgets/desktop-widget.h"
#include "sp-metrics.h"
#include "dialogs/dialog-events.h"
#include "message-context.h"
#include "dialogs/guidelinedialog.h"
/* Root item handler */
{
}
{
static bool dragging = false;
case GDK_BUTTON_PRESS:
dragging = true;
// explicitly show guidelines; if I draw a guide, I want them on
? NR::Y
: NR::X ];
}
break;
case GDK_MOTION_NOTIFY:
if (dragging) {
? NR::Y
: NR::X ];
}
break;
case GDK_BUTTON_RELEASE:
dragging = false;
if ( ( horiz
? wy
: wx )
>= 0 )
{
? NR::Y
: NR::X ];
_("Create guide"));
}
}
default:
break;
}
return FALSE;
}
{
}
{
}
/* Guides */
{
static bool dragging = false;
static bool moved = false;
SPDesktop *desktop = static_cast<SPDesktop*>(gtk_object_get_data(GTK_OBJECT(item->canvas), "SPDesktop"));
case GDK_2BUTTON_PRESS:
dragging = false;
}
break;
case GDK_BUTTON_PRESS:
dragging = true;
NULL,
}
break;
case GDK_MOTION_NOTIFY:
if (dragging) {
moved = true;
}
break;
case GDK_BUTTON_RELEASE:
if (moved) {
_("Move guide"));
} else {
/* Undo movement of any attached shapes. */
_("Delete guide"));
}
moved = false;
}
dragging = false;
}
case GDK_ENTER_NOTIFY:
{
GString *position_string = SP_PX_TO_METRIC_STRING(guide->position, desktop->namedview->getDefaultMetric());
desktop->guidesMessageContext()->setF(Inkscape::NORMAL_MESSAGE, _("%s at %s"), guide_description, position_string->str);
break;
}
case GDK_LEAVE_NOTIFY:
break;
default:
break;
}
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:encoding=utf-8:textwidth=99 :