desktop-events.cpp revision 6129af7cc5b723223e9617614c931936e5190421
#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 <gtk/gtkdialog.h>
#include <gtk/gtkspinbutton.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkstock.h>
#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"
/* Root item handler */
{
}
/*
* fixme: this conatins a hack, to deal with deleting a view, which is
* completely on another view, in which case active_desktop will not be updated
*
*/
{
}
{
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 ];
}
}
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) {
} else {
/* Undo movement of any attached shapes. */
}
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;
}
/*
* simple guideline dialog
*/
static GtkWidget *e;
static GtkWidget *u;
static GtkWidget *m;
static bool mode;
static gpointer g;
{
if (mode) {
// TRANSLATORS: This string appears when double-clicking on a guide.
// This is the distance by which the guide is to be moved.
mode = false;
} else {
// TRANSLATORS: This string appears when double-clicking on a guide.
// This is the target location where the guide is to be moved.
mode = true;
}
}
{
}
{
? points
}
{
}
{
}
{
switch (response) {
case GTK_RESPONSE_OK:
break;
case -12:
break;
case GTK_RESPONSE_CLOSE:
break;
break;
/* case GTK_RESPONSE_APPLY:
guide_dialog_apply(widget, data);
break;
*/
default:
}
}
{
if (!GTK_IS_WIDGET(d)) {
// create dialog
d = gtk_dialog_new_with_buttons(_("Guideline"),
NULL,
-12, /* DELETE */
NULL);
sp_transientize(d);
gtk_widget_hide(d);
//labels
// mode button
gtk_signal_connect_while_alive(GTK_OBJECT(but), "clicked", GTK_SIGNAL_FUNC(guide_dialog_mode_changed),
m = gtk_label_new(_(" absolute to "));
mode = true;
gtk_widget_show(m);
// unitmenu
/* fixme: We should allow percents here too, as percents of the canvas size */
// spinbutton
GtkObject *a = gtk_adjustment_new(0.0, -SP_DESKTOP_SCROLL_LIMIT, SP_DESKTOP_SCROLL_LIMIT, 1.0, 10.0, 10.0);
gtk_widget_show(e);
GTK_OBJECT(d));
/* gnome_dialog_editable_enters(GNOME_DIALOG(d), GTK_EDITABLE(e)); */
gtk_widget_show(u);
// dialog
gtk_signal_connect(GTK_OBJECT(d), "delete_event", GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), GTK_WIDGET(d));
}
// initialize dialog
g = guide;
{
}
gtk_widget_show(d);
}
/*
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 :