summaryrefslogtreecommitdiffstats
path: root/src/widgets/toolbox.cpp
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-06-04 13:16:28 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-06-04 13:16:28 +0000
commit29728afc0a65272f0415402b6391defbbf8a1f6e (patch)
tree12e9055f805f0b2dbfce2215a70f08a3ddaa5330 /src/widgets/toolbox.cpp
parentGroundwork to allow automatic application of an LPE to a newly drawn path (diff)
downloadinkscape-29728afc0a65272f0415402b6391defbbf8a1f6e.tar.gz
inkscape-29728afc0a65272f0415402b6391defbbf8a1f6e.zip
New 'spiro spline mode' in pen/pencil tool which automatically adds the spiro spline LPE to newly drawn paths
(bzr r5800)
Diffstat (limited to 'src/widgets/toolbox.cpp')
-rw-r--r--src/widgets/toolbox.cpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index e01d16875..a72ae49fd 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -54,6 +54,7 @@
#include <glibmm/i18n.h>
#include "helper/unit-menu.h"
#include "helper/units.h"
+#include "live_effects/effect.h"
#include "inkscape.h"
#include "conn-avoid-ref.h"
@@ -64,6 +65,7 @@
#include "connector-context.h"
#include "node-context.h"
+#include "draw-context.h"
#include "shape-editor.h"
#include "tweak-context.h"
#include "sp-rect.h"
@@ -360,9 +362,11 @@ static gchar const * ui_descr =
" </toolbar>"
" <toolbar name='PenToolbar'>"
+ " <toolitem action='SpiroSplineModeActionPen' />"
" </toolbar>"
" <toolbar name='PencilToolbar'>"
+ " <toolitem action='SpiroSplineModeActionPencil' />"
" </toolbar>"
" <toolbar name='CalligraphyToolbar'>"
@@ -3078,15 +3082,35 @@ static void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio
//## Pen/Pencil ##
//########################
+static void sp_pc_spiro_spline_mode_changed(GtkToggleAction *act, GObject* /*tbl*/)
+{
+ prefs_set_int_attribute("tools.freehand", "spiro-spline-mode", gtk_toggle_action_get_active(act) ? 1 : 0);
+}
-static void sp_pen_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* /*mainActions*/, GObject* /*holder*/)
+static void sp_add_spiro_toggle(GtkActionGroup* mainActions, GObject* holder, const char* action_name)
{
- // Put stuff here
+ /* Spiro Spline Mode toggle button */
+ {
+ InkToggleAction* act = ink_toggle_action_new(action_name,
+ _("Spiro Spline Mode"),
+ _("Automatically apply the 'Spiro Spline' live path effect to newly drawn paths"),
+ "spiro_splines_mode",
+ Inkscape::ICON_SIZE_DECORATION );
+ gtk_action_group_add_action(mainActions, GTK_ACTION(act));
+ g_signal_connect_after(G_OBJECT(act), "toggled", G_CALLBACK(sp_pc_spiro_spline_mode_changed), holder);
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act), prefs_get_int_attribute("tools.freehand", "spiro-spline-mode", 0));
+ g_object_set_data( holder, "spiro_spline_mode", act );
+ }
}
-static void sp_pencil_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* /*mainActions*/, GObject* /*holder*/)
+static void sp_pen_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* mainActions, GObject* holder)
{
- // Put stuff here
+ sp_add_spiro_toggle(mainActions, holder, "SpiroSplineModeActionPen");
+}
+
+static void sp_pencil_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* mainActions, GObject* holder)
+{
+ sp_add_spiro_toggle(mainActions, holder, "SpiroSplineModeActionPencil");
}
//########################
@@ -3783,7 +3807,7 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
gtk_action_set_sensitive( act, TRUE );
g_object_set_data( holder, "profile_save_delete", act );
}
- }
+ }
}