summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e6024a2)
raw | patch | inline | side by side (parent: e6024a2)
author | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 18 Aug 2008 00:43:27 +0000 (00:43 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 18 Aug 2008 00:43:27 +0000 (00:43 +0000) |
src/draw-context.cpp | patch | blob | history | |
src/lpe-tool-context.cpp | patch | blob | history | |
src/lpe-tool-context.h | patch | blob | history | |
src/widgets/toolbox.cpp | patch | blob | history |
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index c8ce44872ad23caa4dddd34745f6e074effaa9bc..6e641196b9f6e49da3027bc4567496ca16403964 100644 (file)
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
#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"
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));
index 881aa47e94047a48eef173c3b676ac188e2d283c..6902d1bd31f4154f242d283db3db28f08e79e790 100644 (file)
--- a/src/lpe-tool-context.cpp
+++ b/src/lpe-tool-context.cpp
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 86976442f05d1b064653da0f1110bbe7474ce65a..54716cddf97a38ee06ddf60d2f92ac56539f9bcf 100644 (file)
--- a/src/lpe-tool-context.h
+++ b/src/lpe-tool-context.h
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);
index 71c797bffd1452e40dfc57393d94cf36dfcc6b99..5ed6feb2ef803df973ebefd93659ab06ca337970 100644 (file)
--- 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;