From 6537271c188e0675c2592f657d038fe09ea70bf1 Mon Sep 17 00:00:00 2001 From: cilix42 Date: Tue, 22 Jul 2008 14:52:42 +0000 Subject: [PATCH] Separate spiro modes for pen and pencil tool --- src/draw-context.cpp | 18 +++++++++--------- src/widgets/toolbox.cpp | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/draw-context.cpp b/src/draw-context.cpp index 19551dd6a..6a9e63436 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -247,6 +247,14 @@ sp_draw_context_root_handler(SPEventContext *ec, GdkEvent *event) return ret; } +static char const * +tool_name(SPDrawContext *dc) +{ + return ( SP_IS_PEN_CONTEXT(dc) + ? "tools.freehand.pen" + : "tools.freehand.pencil" ); +} + static void spdc_paste_curve_as_freehand_shape(const SPCurve *c, SPDrawContext *dc, SPItem *item) { @@ -270,7 +278,7 @@ spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item) using namespace Inkscape::LivePathEffect; if (item && SP_IS_LPE_ITEM(item)) { - if (prefs_get_int_attribute("tools.freehand", "spiro-spline-mode", 0)) { + if (prefs_get_int_attribute(tool_name(dc), "spiro-spline-mode", 0)) { Effect::createAndApply(SPIRO, dc->desktop->doc(), item); } @@ -572,14 +580,6 @@ spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed) c->unref(); } -static char const * -tool_name(SPDrawContext *dc) -{ - return ( SP_IS_PEN_CONTEXT(dc) - ? "tools.freehand.pen" - : "tools.freehand.pencil" ); -} - /* * Flushes white curve(s) and additional curve into object * diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 052a8f061..16e2f3f68 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -80,6 +80,7 @@ #include "sp-clippath.h" #include "sp-mask.h" #include "style.h" +#include "tools-switch.h" #include "selection.h" #include "selection-chemistry.h" #include "document-private.h" @@ -3267,9 +3268,18 @@ static void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio //## Pen/Pencil ## //######################## -static void sp_pc_spiro_spline_mode_changed(EgeSelectOneAction* act, GObject* /*tbl*/) +static char const * +freehand_tool_name(GObject *dataKludge) { - prefs_set_int_attribute("tools.freehand", "spiro-spline-mode", ege_select_one_action_get_active(act)); + SPDesktop *desktop = (SPDesktop *) g_object_get_data(dataKludge, "desktop"); + return ( tools_isactive(desktop, TOOLS_FREEHAND_PENCIL) + ? "tools.freehand.pencil" + : "tools.freehand.pen" ); +} + +static void sp_pc_spiro_spline_mode_changed(EgeSelectOneAction* act, GObject* tbl) +{ + prefs_set_int_attribute(freehand_tool_name(tbl), "spiro-spline-mode", ege_select_one_action_get_active(act)); } static void sp_add_spiro_toggle(GtkActionGroup* mainActions, GObject* holder, bool tool_is_pencil) @@ -3278,7 +3288,7 @@ static void sp_add_spiro_toggle(GtkActionGroup* mainActions, GObject* holder, bo { //gchar const *flatsidedstr = prefs_get_string_attribute( "tools.shapes.star", "isflatsided" ); //bool isSpiroMode = flatsidedstr ? (strcmp(flatsidedstr, "false") != 0) : true; - guint spiroMode = prefs_get_int_attribute("tools.freehand", "spiro-spline-mode", 0); + guint spiroMode = prefs_get_int_attribute(freehand_tool_name(holder), "spiro-spline-mode", 0); Inkscape::IconSize secondarySize = prefToSize("toolbox", "secondary", 1); { -- 2.30.2