From 26288df8eb283c526aa8459e6779d780d8813a2e Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Thu, 31 Jul 2008 12:43:10 +0000 Subject: New 'zigzag' (polylines) mode in pen tool (bzr r6485) --- src/widgets/toolbox.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index b62ecb0b2..9dfb0c249 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -66,7 +66,7 @@ #include "connector-context.h" #include "node-context.h" -#include "draw-context.h" +#include "pen-context.h" #include "shape-editor.h" #include "tweak-context.h" #include "sp-rect.h" @@ -3279,7 +3279,15 @@ freehand_tool_name(GObject *dataKludge) static void sp_pc_freehand_mode_changed(EgeSelectOneAction* act, GObject* tbl) { - prefs_set_int_attribute(freehand_tool_name(tbl), "freehand-mode", ege_select_one_action_get_active(act)); + gint mode = ege_select_one_action_get_active(act); + + prefs_set_int_attribute(freehand_tool_name(tbl), "freehand-mode", mode); + + SPDesktop *desktop = (SPDesktop *) g_object_get_data(tbl, "desktop"); + if (SP_IS_PEN_CONTEXT(desktop->event_context)) { + SPPenContext *pc = SP_PEN_CONTEXT(desktop->event_context); + pc->polylines_only = (mode == 2); + } } static void sp_add_freehand_mode_toggle(GtkActionGroup* mainActions, GObject* holder, bool tool_is_pencil) @@ -3307,6 +3315,15 @@ static void sp_add_freehand_mode_toggle(GtkActionGroup* mainActions, GObject* ho 2, "spiro_splines_mode", -1 ); + if (!tool_is_pencil) { + gtk_list_store_append( model, &iter ); + gtk_list_store_set( model, &iter, + 0, _("Zigzag"), + 1, _("Create a sequence of straight line segments"), + 2, "polylines_mode", + -1 ); + } + EgeSelectOneAction* act = ege_select_one_action_new(tool_is_pencil ? "FreehandModeActionPencil" : "FreehandModeActionPen", -- cgit v1.2.3