summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-08-18 00:43:27 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-08-18 00:43:27 +0000
commit1909760cc90de210792a98e8ae7aee7964fc0198 (patch)
tree8a553eed21582ede3034e95219dc538ea7d22c49 /src
parentAdd button whether to display limiting bounding box; add 'all inactive' toggl... (diff)
downloadinkscape-1909760cc90de210792a98e8ae7aee7964fc0198.tar.gz
inkscape-1909760cc90de210792a98e8ae7aee7964fc0198.zip
Switch back to all_inactive mode after applying a geometric LPE
(bzr r6674)
Diffstat (limited to 'src')
-rw-r--r--src/draw-context.cpp6
-rw-r--r--src/lpe-tool-context.cpp25
-rw-r--r--src/lpe-tool-context.h3
-rw-r--r--src/widgets/toolbox.cpp1
4 files changed, 33 insertions, 2 deletions
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index c8ce44872..6e641196b 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -34,6 +34,7 @@
#include "macros.h"
#include "message-stack.h"
#include "pen-context.h"
+#include "lpe-tool-context.h"
#include "prefs-utils.h"
#include "selection.h"
#include "selection-chemistry.h"
@@ -381,6 +382,11 @@ spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item)
if (dc->waiting_LPE_type != INVALID_LPE) {
Effect::createAndApply(dc->waiting_LPE_type, dc->desktop->doc(), item);
dc->waiting_LPE_type = INVALID_LPE;
+
+ if (SP_IS_LPETOOL_CONTEXT(dc)) {
+ // since a geometric LPE was applied, we switch back to "inactive" mode
+ lpetool_context_switch_mode(SP_LPETOOL_CONTEXT(dc), Inkscape::LivePathEffect::INVALID_LPE);
+ }
}
if (SP_IS_PEN_CONTEXT(dc)) {
sp_pen_context_set_polyline_mode(SP_PEN_CONTEXT(dc));
diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp
index 881aa47e9..6902d1bd3 100644
--- a/src/lpe-tool-context.cpp
+++ b/src/lpe-tool-context.cpp
@@ -137,9 +137,9 @@ sp_lpetool_context_setup(SPEventContext *ec)
lc->sel_changed_connection =
selection->connectChanged(sigc::bind(sigc::ptr_fun(&sp_lpetool_context_selection_changed), (gpointer)lc));
- //lc->my_nc = new NodeContextCpp(lc->desktop, lc->prefs_repr, lc->key);
lc->shape_editor = new ShapeEditor(ec->desktop);
+ lpetool_context_switch_mode(lc, Inkscape::LivePathEffect::INVALID_LPE);
lpetool_context_reset_limiting_bbox(lc);
// TODO temp force:
@@ -299,6 +299,29 @@ sp_lpetool_context_root_handler(SPEventContext *event_context, GdkEvent *event)
return ret;
}
+static int
+lpetool_mode_to_index(Inkscape::LivePathEffect::EffectType const type) {
+ for (int i = 0; i < num_subtools; ++i) {
+ if (lpesubtools[i] == type) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+void
+lpetool_context_switch_mode(SPLPEToolContext *lc, Inkscape::LivePathEffect::EffectType const type)
+{
+ int index = lpetool_mode_to_index(type);
+ if (index != -1) {
+ lc->mode = type;
+ lc->desktop->setToolboxSelectOneValue ("lpetool_mode_action", index);
+ } else {
+ g_warning ("Invalid mode selected: %d", type);
+ return;
+ }
+}
+
/*
* Reads the limiting bounding box from preferences and draws it on the screen
*/
diff --git a/src/lpe-tool-context.h b/src/lpe-tool-context.h
index 86976442f..54716cddf 100644
--- a/src/lpe-tool-context.h
+++ b/src/lpe-tool-context.h
@@ -40,14 +40,15 @@ class ShapeEditor;
struct SPLPEToolContext : public SPPenContext {
ShapeEditor* shape_editor;
-
SPCanvasItem *canvas_bbox;
+ Inkscape::LivePathEffect::EffectType mode;
sigc::connection sel_changed_connection;
};
struct SPLPEToolContextClass : public SPEventContextClass{};
+void lpetool_context_switch_mode(SPLPEToolContext *lc, Inkscape::LivePathEffect::EffectType const type);
void lpetool_context_reset_limiting_bbox(SPLPEToolContext *lc);
GType sp_lpetool_context_get_type(void);
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 71c797bff..5ed6feb2e 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -4788,6 +4788,7 @@ static void sp_dropper_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* main
// the subtools from which the toolbar is built automatically are listed in lpe-tool-context.h
+// this is called when the mode is changed via the toolbar (i.e., one of the subtool buttons is pressed)
static void sp_lpetool_mode_changed(EgeSelectOneAction *act, GObject *tbl)
{
using namespace Inkscape::LivePathEffect;