diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2008-08-18 00:43:46 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2008-08-18 00:43:46 +0000 |
| commit | f3a792d6a397bcc21c283b117dc3bb5d99e39b6c (patch) | |
| tree | 9bb3579f3d429c6ae24efb57b240599edd870b60 /src | |
| parent | Switch back to all_inactive mode after applying a geometric LPE (diff) | |
| download | inkscape-f3a792d6a397bcc21c283b117dc3bb5d99e39b6c.tar.gz inkscape-f3a792d6a397bcc21c283b117dc3bb5d99e39b6c.zip | |
Absorb all mouse clicks (and flash a warning on the status bar) when no subtool is activated
(bzr r6675)
Diffstat (limited to 'src')
| -rw-r--r-- | src/lpe-tool-context.cpp | 9 | ||||
| -rw-r--r-- | src/widgets/toolbox.cpp | 29 |
2 files changed, 19 insertions, 19 deletions
diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp index 6902d1bd3..dd305116b 100644 --- a/src/lpe-tool-context.cpp +++ b/src/lpe-tool-context.cpp @@ -30,6 +30,7 @@ #include "document.h" #include "display/curve.h" #include "display/canvas-bpath.h" +#include "message-stack.h" #include "lpe-tool-context.h" @@ -212,6 +213,14 @@ sp_lpetool_context_root_handler(SPEventContext *event_context, GdkEvent *event) switch (event->type) { case GDK_BUTTON_PRESS: g_print ("GDK_BUTTON_PRESS\n"); + if (lc->mode == Inkscape::LivePathEffect::INVALID_LPE) { + // don't do anything for now if we are inactive + desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Choose a subtool from the toolbar to perform a geometric construction.")); + g_print ("Flash statusbar\n"); + ret = true; + break; + } + if (event->button.button == 1 && !event_context->space_panning) { g_print (" ... (passed if construct)\n"); // save drag origin diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 5ed6feb2e..2644d70a3 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -4795,30 +4795,21 @@ static void sp_lpetool_mode_changed(EgeSelectOneAction *act, GObject *tbl) SPDesktop *desktop = (SPDesktop *) g_object_get_data(tbl, "desktop"); - // TODO: how can we set *all* actions inactive (such that no sutool is activated?) - gint lpeToolMode = ege_select_one_action_get_active(act); - if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { - prefs_set_int_attribute( "tools.lpetool", "mode", lpeToolMode ); - } - //EffectType type = lpesubtools[lpeToolMode]; - //SPPenContext *pc = SP_PEN_CONTEXT(desktop->event_context); - // only take action if run by the attr_changed listener - if (!g_object_get_data( tbl, "freeze" )) { + if (!g_object_get_data(tbl, "freeze")) { // in turn, prevent listener from responding - g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE) ); + g_object_set_data(tbl, "freeze", GINT_TO_POINTER(TRUE)); - // this is now done in sp_lpetool_context_root_handler() - /** - // activate the LPE corresponding to the chosen subtool - if (type != INVALID_LPE) { - //lc->tool_state = LPETOOL_STATE_PEN; - sp_pen_context_wait_for_LPE_mouse_clicks(pc, type, Effect::acceptsNumClicks(type)); + // TODO: how can we set *all* actions inactive (such that no sutool is activated?) + gint lpeToolMode = ege_select_one_action_get_active(act); + if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { + prefs_set_int_attribute( "tools.lpetool", "mode", lpeToolMode ); } - // TODO: how can we take LPEs into account that don't expect any 'pre-clicks'? - **/ - g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); + EffectType type = lpesubtools[lpeToolMode]; + SP_LPETOOL_CONTEXT(desktop->event_context)->mode = type; + + g_object_set_data(tbl, "freeze", GINT_TO_POINTER(FALSE)); } } |
