summaryrefslogtreecommitdiffstats
path: root/src/spiral-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/spiral-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/spiral-context.cpp')
-rw-r--r--src/spiral-context.cpp61
1 files changed, 21 insertions, 40 deletions
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index 0c25c9d47..459a56161 100644
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
@@ -46,8 +46,6 @@
using Inkscape::DocumentUndo;
-static void sp_spiral_context_class_init(SPSpiralContextClass * klass);
-static void sp_spiral_context_init(SPSpiralContext *spiral_context);
static void sp_spiral_context_dispose(GObject *object);
static void sp_spiral_context_setup(SPEventContext *ec);
static void sp_spiral_context_finish(SPEventContext *ec);
@@ -59,35 +57,13 @@ static void sp_spiral_drag(SPSpiralContext *sc, Geom::Point const &p, guint stat
static void sp_spiral_finish(SPSpiralContext *sc);
static void sp_spiral_cancel(SPSpiralContext *sc);
-static SPEventContextClass *parent_class;
-
-GType
-sp_spiral_context_get_type()
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPSpiralContextClass),
- NULL, NULL,
- (GClassInitFunc) sp_spiral_context_class_init,
- NULL, NULL,
- sizeof(SPSpiralContext),
- 4,
- (GInstanceInitFunc) sp_spiral_context_init,
- NULL, /* value_table */
- };
- type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPSpiralContext", &info, (GTypeFlags)0);
- }
- return type;
-}
+G_DEFINE_TYPE(SPSpiralContext, sp_spiral_context, SP_TYPE_EVENT_CONTEXT);
static void
sp_spiral_context_class_init(SPSpiralContextClass *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_spiral_context_dispose;
@@ -123,15 +99,15 @@ sp_spiral_context_init(SPSpiralContext *spiral_context)
static void sp_spiral_context_finish(SPEventContext *ec)
{
SPSpiralContext *sc = SP_SPIRAL_CONTEXT(ec);
- SPDesktop *desktop = ec->desktop;
+ SPDesktop *desktop = ec->desktop;
- sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME);
- sp_spiral_finish(sc);
+ sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME);
+ sp_spiral_finish(sc);
sc->sel_changed_connection.disconnect();
- if (((SPEventContextClass *) parent_class)->finish) {
- ((SPEventContextClass *) parent_class)->finish(ec);
- }
+ if ((SP_EVENT_CONTEXT_CLASS(sp_spiral_context_parent_class))->finish) {
+ (SP_EVENT_CONTEXT_CLASS(sp_spiral_context_parent_class))->finish(ec);
+ }
}
static void
@@ -155,14 +131,14 @@ sp_spiral_context_dispose(GObject *object)
delete sc->_message_context;
}
- G_OBJECT_CLASS(parent_class)->dispose(object);
+ G_OBJECT_CLASS(sp_spiral_context_parent_class)->dispose(object);
}
/**
* Callback that processes the "changed" signal on the selection;
* destroys old and creates new knotholder.
*/
-void sp_spiral_context_selection_changed(Inkscape::Selection *selection, gpointer data)
+static void sp_spiral_context_selection_changed(Inkscape::Selection *selection, gpointer data)
{
SPSpiralContext *sc = SP_SPIRAL_CONTEXT(data);
SPEventContext *ec = SP_EVENT_CONTEXT(sc);
@@ -177,8 +153,8 @@ sp_spiral_context_setup(SPEventContext *ec)
{
SPSpiralContext *sc = SP_SPIRAL_CONTEXT(ec);
- if (((SPEventContextClass *) parent_class)->setup)
- ((SPEventContextClass *) parent_class)->setup(ec);
+ if ((SP_EVENT_CONTEXT_CLASS(sp_spiral_context_parent_class))->setup)
+ (SP_EVENT_CONTEXT_CLASS(sp_spiral_context_parent_class))->setup(ec);
sp_event_context_read(ec, "expansion");
sp_event_context_read(ec, "revolution");
@@ -367,6 +343,11 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event)
// do not return true, so that space would work switching to selector
}
break;
+ case GDK_KEY_Delete:
+ case GDK_KEY_KP_Delete:
+ case GDK_KEY_BackSpace:
+ ret = event_context->deleteSelectedDrag(MOD__CTRL_ONLY);
+ break;
default:
break;
@@ -393,8 +374,8 @@ sp_spiral_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_spiral_context_parent_class))->root_handler)
+ ret = (SP_EVENT_CONTEXT_CLASS(sp_spiral_context_parent_class))->root_handler(event_context, event);
}
return ret;
@@ -421,7 +402,7 @@ static void sp_spiral_drag(SPSpiralContext *sc, Geom::Point const &p, guint stat
// Set style
sp_desktop_apply_style_tool(desktop, repr, "/tools/shapes/spiral", false);
- sc->item = (SPItem *) desktop->currentLayer()->appendChildRepr(repr);
+ sc->item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
Inkscape::GC::release(repr);
sc->item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse();
sc->item->updateRepr();