From 65ba6ad9a82f8f47974eb10665478fd783692bb5 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Sat, 20 Apr 2013 23:19:46 +0200 Subject: Merging of EventContext classes complete. (bzr r11608.1.98) --- src/common-context.cpp | 89 +++----------------------------------------------- 1 file changed, 5 insertions(+), 84 deletions(-) (limited to 'src/common-context.cpp') diff --git a/src/common-context.cpp b/src/common-context.cpp index fb0ddb720..4d2125f91 100644 --- a/src/common-context.cpp +++ b/src/common-context.cpp @@ -18,41 +18,9 @@ #define DRAG_DEFAULT 1.0 #define DRAG_MAX 1.0 - -static void sp_common_context_dispose(GObject *object); - -static void sp_common_context_setup(SPEventContext *ec); -static void sp_common_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val); - -static gint sp_common_context_root_handler(SPEventContext *event_context, GdkEvent *event); - -G_DEFINE_TYPE(SPCommonContext, sp_common_context, SP_TYPE_EVENT_CONTEXT); - -static void sp_common_context_class_init(SPCommonContextClass *klass) -{ - GObjectClass *object_class = (GObjectClass *) klass; - SPEventContextClass *event_context_class = SP_EVENT_CONTEXT_CLASS(klass); - - object_class->dispose = sp_common_context_dispose; - -// event_context_class->setup = sp_common_context_setup; -// event_context_class->set = sp_common_context_set; -// event_context_class->root_handler = sp_common_context_root_handler; -} - -CCommonContext::CCommonContext(SPCommonContext* commoncontext) : CEventContext(commoncontext) { - this->spcommoncontext = commoncontext; -} - SPCommonContext::SPCommonContext() : SPEventContext() { SPCommonContext* ctx = this; - //ctx->ccommoncontext = new CCommonContext(ctx); - //delete ctx->ceventcontext; - //ctx->ceventcontext = ctx->ccommoncontext; - ctx->ccommoncontext = 0; - types.insert(typeid(SPCommonContext)); - ctx->_message_context = 0; ctx->tremor = 0; ctx->usetilt = 0; @@ -99,14 +67,8 @@ SPCommonContext::SPCommonContext() : SPEventContext() { ctx->abs_width = false; } -static void sp_common_context_init(SPCommonContext *ctx) -{ - new (ctx) SPCommonContext(); -} - -static void sp_common_context_dispose(GObject *object) -{ - SPCommonContext *ctx = SP_COMMON_CONTEXT(object); +SPCommonContext::~SPCommonContext() { + SPCommonContext *ctx = SP_COMMON_CONTEXT(this); if (ctx->accumulated) { ctx->accumulated = ctx->accumulated->unref(); @@ -141,29 +103,11 @@ static void sp_common_context_dispose(GObject *object) ctx->_message_context = 0; } - G_OBJECT_CLASS(sp_common_context_parent_class)->dispose(object); + //G_OBJECT_CLASS(sp_common_context_parent_class)->dispose(object); } - -static void sp_common_context_setup(SPEventContext *ec) -{ - ec->ceventcontext->setup(); -} - -void CCommonContext::setup() { -// if ( SP_EVENT_CONTEXT_CLASS(sp_common_context_parent_class)->setup ) { -// SP_EVENT_CONTEXT_CLASS(sp_common_context_parent_class)->setup(ec); -// } - CEventContext::setup(); -} - -static void sp_common_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *value) -{ - ec->ceventcontext->set(value); -} - -void CCommonContext::set(Inkscape::Preferences::Entry* value) { - SPEventContext* ec = this->speventcontext; +void SPCommonContext::set(Inkscape::Preferences::Entry* value) { + SPEventContext* ec = this; SPCommonContext *ctx = SP_COMMON_CONTEXT(ec); Glib::ustring path = value->getEntryName(); @@ -199,29 +143,6 @@ void CCommonContext::set(Inkscape::Preferences::Entry* value) { } } -static gint sp_common_context_root_handler(SPEventContext *event_context, GdkEvent *event) -{ - return event_context->ceventcontext->root_handler(event); -} - -gint CCommonContext::root_handler(GdkEvent* event) { - SPEventContext* event_context = this->speventcontext; - - gint ret = FALSE; - - // TODO add common hanlding - - - if ( !ret ) { -// if ( SP_EVENT_CONTEXT_CLASS(sp_common_context_parent_class)->root_handler ) { -// ret = SP_EVENT_CONTEXT_CLASS(sp_common_context_parent_class)->root_handler(event_context, event); -// } - ret = CEventContext::root_handler(event); - } - - return ret; -} - /* Local Variables: mode:c++ -- cgit v1.2.3