diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2008-09-05 18:54:49 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2008-09-05 18:54:49 +0000 |
| commit | 0c6ca648a25305e9097dc8f8e9191285d4f7766c (patch) | |
| tree | 14b385c842eb8ccb068521e495c607c6113d6fe1 /src/lpe-tool-context.cpp | |
| parent | Select landscape by default for certain page formats (diff) | |
| download | inkscape-0c6ca648a25305e9097dc8f8e9191285d4f7766c.tar.gz inkscape-0c6ca648a25305e9097dc8f8e9191285d4f7766c.zip | |
Make click-select work in geometry tool
(bzr r6764)
Diffstat (limited to 'src/lpe-tool-context.cpp')
| -rw-r--r-- | src/lpe-tool-context.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp index 9b0a8380b..ec4cd0689 100644 --- a/src/lpe-tool-context.cpp +++ b/src/lpe-tool-context.cpp @@ -46,6 +46,7 @@ static void sp_lpetool_context_dispose(GObject *object); static void sp_lpetool_context_setup(SPEventContext *ec); static void sp_lpetool_context_set(SPEventContext *ec, gchar const *key, gchar const *val); +static gint sp_lpetool_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event); static gint sp_lpetool_context_root_handler(SPEventContext *ec, GdkEvent *event); void sp_lpetool_context_selection_changed(Inkscape::Selection *selection, gpointer data); @@ -99,6 +100,7 @@ sp_lpetool_context_class_init(SPLPEToolContextClass *klass) 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->item_handler = sp_lpetool_context_item_handler; } static void @@ -211,6 +213,37 @@ sp_lpetool_context_set(SPEventContext *ec, gchar const *key, gchar const *val) **/ } +static gint +sp_lpetool_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event) +{ + gint ret = FALSE; + + switch (event->type) { + case GDK_BUTTON_PRESS: + { + // select the clicked item but do nothing else + Inkscape::Selection * const selection = sp_desktop_selection(ec->desktop); + selection->clear(); + selection->add(item); + ret = TRUE; + break; + } + case GDK_BUTTON_RELEASE: + // TODO: do we need to catch this or can we pass it on to the parent handler? + ret = TRUE; + break; + default: + break; + } + + if (!ret) { + if (((SPEventContextClass *) lpetool_parent_class)->item_handler) + ret = ((SPEventContextClass *) lpetool_parent_class)->item_handler(ec, item, event); + } + + return ret; +} + gint sp_lpetool_context_root_handler(SPEventContext *event_context, GdkEvent *event) { |
