From: cilix42 Date: Mon, 18 Aug 2008 00:34:50 +0000 (+0000) Subject: Let LPEToolContext derive from PenContext so that we can use its LPE framework X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2838abd893dafa9313eb3638e6e902f836e6a12b;p=inkscape.git Let LPEToolContext derive from PenContext so that we can use its LPE framework --- diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp index a93176067..3df57027f 100644 --- a/src/lpe-tool-context.cpp +++ b/src/lpe-tool-context.cpp @@ -71,7 +71,7 @@ static void sp_lpetool_context_set(SPEventContext *ec, gchar const *key, gchar c static gint sp_lpetool_context_root_handler(SPEventContext *ec, GdkEvent *event); -static SPEventContextClass *lpetool_parent_class = 0; +static SPPenContextClass *lpetool_parent_class = 0; GType sp_lpetool_context_get_type(void) { @@ -89,7 +89,7 @@ GType sp_lpetool_context_get_type(void) (GInstanceInitFunc)sp_lpetool_context_init, 0 // value_table }; - type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPLPEToolContext", &info, static_cast(0)); + type = g_type_register_static(SP_TYPE_PEN_CONTEXT, "SPLPEToolContext", &info, static_cast(0)); } return type; } @@ -100,13 +100,13 @@ sp_lpetool_context_class_init(SPLPEToolContextClass *klass) GObjectClass *object_class = (GObjectClass *) klass; SPEventContextClass *event_context_class = (SPEventContextClass *) klass; - lpetool_parent_class = (SPEventContextClass*)g_type_class_peek_parent(klass); + lpetool_parent_class = (SPPenContextClass*)g_type_class_peek_parent(klass); object_class->dispose = sp_lpetool_context_dispose; event_context_class->setup = sp_lpetool_context_setup; event_context_class->set = sp_lpetool_context_set; - event_context_class->root_handler = sp_lpetool_context_root_handler; + //event_context_class->root_handler = sp_lpetool_context_root_handler; } static void @@ -145,10 +145,16 @@ sp_lpetool_context_setup(SPEventContext *ec) static void sp_lpetool_context_set(SPEventContext *ec, gchar const *key, gchar const *val) { + // FIXME: how to set this correcly? the value from preferences-skeleton.h doesn't seem to get + // read (it wants to set drag = 1) + lpetool_parent_class->set(ec, key, "drag"); + + /** //pass on up to parent class to handle common attributes. if ( lpetool_parent_class->set ) { lpetool_parent_class->set(ec, key, val); } + **/ } /** diff --git a/src/lpe-tool-context.h b/src/lpe-tool-context.h index 73002143e..a5f849c7a 100644 --- a/src/lpe-tool-context.h +++ b/src/lpe-tool-context.h @@ -16,7 +16,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "event-context.h" +//#include "event-context.h" +#include "pen-context.h" #define SP_TYPE_LPETOOL_CONTEXT (sp_lpetool_context_get_type()) #define SP_LPETOOL_CONTEXT(o) (GTK_CHECK_CAST((o), SP_TYPE_LPETOOL_CONTEXT, SPLPEToolContext)) @@ -27,7 +28,7 @@ class SPLPEToolContext; class SPLPEToolContextClass; -struct SPLPEToolContext : public SPEventContext { +struct SPLPEToolContext : public SPPenContext { }; struct SPLPEToolContextClass : public SPEventContextClass{}; diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index dfbbd61ee..6a14b044a 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -85,7 +85,7 @@ static char const preferences_skeleton[] = " mass=\"0.02\" drag=\"1\" angle=\"30\" width=\"0.15\" thinning=\"0.1\" flatness=\"0.9\" cap_rounding=\"0.0\" usecurrent=\"0\"\n" " tracebackground=\"0\" usepressure=\"1\" usetilt=\"0\" selcue=\"1\">\n" " \n" -" \n" +" \n" " \n" " event_context), Inkscape::LivePathEffect::CIRCLE_3PTS, 3); + //sp_pen_context_put_into_waiting_mode(desktop, Inkscape::LivePathEffect::CIRCLE_3PTS, 3); break; default: // don't do anything