summaryrefslogtreecommitdiffstats
path: root/src/select-context.cpp
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-03-29 23:52:42 +0000
committerMarkus Engel <markus.engel@tum.de>2013-03-29 23:52:42 +0000
commita168040d5a452544328a1e6ad35aaac351f94d44 (patch)
treefae1ba829f543a473da281bd5fa6e4deabbf6912 /src/select-context.cpp
parentRemoved function pointers from SPObject and subclasses. (diff)
parentDutch translation update (diff)
downloadinkscape-a168040d5a452544328a1e6ad35aaac351f94d44.tar.gz
inkscape-a168040d5a452544328a1e6ad35aaac351f94d44.zip
merged from trunk
(bzr r11608.1.56)
Diffstat (limited to 'src/select-context.cpp')
-rw-r--r--src/select-context.cpp54
1 files changed, 15 insertions, 39 deletions
diff --git a/src/select-context.cpp b/src/select-context.cpp
index 4555e51aa..2684cbc1e 100644
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
@@ -51,9 +51,6 @@
using Inkscape::DocumentUndo;
-
-static void sp_select_context_class_init(SPSelectContextClass *klass);
-static void sp_select_context_init(SPSelectContext *select_context);
static void sp_select_context_dispose(GObject *object);
static void sp_select_context_setup(SPEventContext *ec);
@@ -61,8 +58,6 @@ static void sp_select_context_set(SPEventContext *ec, Inkscape::Preferences::Ent
static gint sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event);
static gint sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event);
-static SPEventContextClass *parent_class;
-
static GdkCursor *CursorSelectMouseover = NULL;
static GdkCursor *CursorSelectDragging = NULL;
GdkPixbuf *handles[13];
@@ -74,33 +69,13 @@ static gint xp = 0, yp = 0; // where drag started
static gint tolerance = 0;
static bool within_tolerance = false;
-GType
-sp_select_context_get_type(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPSelectContextClass),
- NULL, NULL,
- (GClassInitFunc) sp_select_context_class_init,
- NULL, NULL,
- sizeof(SPSelectContext),
- 4,
- (GInstanceInitFunc) sp_select_context_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPSelectContext", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPSelectContext, sp_select_context, SP_TYPE_EVENT_CONTEXT);
static void
sp_select_context_class_init(SPSelectContextClass *klass)
{
- GObjectClass *object_class = (GObjectClass *) klass;
- SPEventContextClass *event_context_class = (SPEventContextClass *) klass;
-
- parent_class = (SPEventContextClass*)g_type_class_peek_parent(klass);
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ SPEventContextClass *event_context_class = SP_EVENT_CONTEXT_CLASS(klass);
object_class->dispose = sp_select_context_dispose;
@@ -180,7 +155,7 @@ sp_select_context_dispose(GObject *object)
CursorSelectMouseover = NULL;
}
- G_OBJECT_CLASS(parent_class)->dispose(object);
+ G_OBJECT_CLASS(sp_select_context_parent_class)->dispose(object);
}
static void
@@ -188,8 +163,8 @@ sp_select_context_setup(SPEventContext *ec)
{
SPSelectContext *select_context = SP_SELECT_CONTEXT(ec);
- if (((SPEventContextClass *) parent_class)->setup) {
- ((SPEventContextClass *) parent_class)->setup(ec);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_select_context_parent_class))->setup) {
+ (SP_EVENT_CONTEXT_CLASS(sp_select_context_parent_class))->setup(ec);
}
SPDesktop *desktop = ec->desktop;
@@ -272,7 +247,7 @@ sp_select_context_abort(SPEventContext *event_context)
return false;
}
-bool
+static bool
key_is_a_modifier (guint key) {
return (key == GDK_KEY_Alt_L ||
key == GDK_KEY_Alt_R ||
@@ -284,7 +259,7 @@ key_is_a_modifier (guint key) {
key == GDK_KEY_Meta_R);
}
-void
+static void
sp_select_context_up_one_layer(SPDesktop *desktop)
{
/* Click in empty place, go up one level -- but don't leave a layer to root.
@@ -432,8 +407,8 @@ sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkE
}
if (!ret) {
- if (((SPEventContextClass *) parent_class)->item_handler)
- ret = ((SPEventContextClass *) parent_class)->item_handler(event_context, item, event);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_select_context_parent_class))->item_handler)
+ ret = (SP_EVENT_CONTEXT_CLASS(sp_select_context_parent_class))->item_handler(event_context, item, event);
}
return ret;
@@ -1140,8 +1115,9 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
}
// set cursor to default.
if (!desktop->isWaitingCursor()) {
- GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (sp_desktop_canvas(desktop)));
- gdk_window_set_cursor(window, event_context->cursor);
+ // Do we need to reset the cursor here on key release ?
+ //GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (sp_desktop_canvas(desktop)));
+ //gdk_window_set_cursor(window, event_context->cursor);
}
break;
default:
@@ -1149,8 +1125,8 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
}
if (!ret) {
- if (((SPEventContextClass *) parent_class)->root_handler)
- ret = ((SPEventContextClass *) parent_class)->root_handler(event_context, event);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_select_context_parent_class))->root_handler)
+ ret = (SP_EVENT_CONTEXT_CLASS(sp_select_context_parent_class))->root_handler(event_context, event);
}
return ret;