Code

trace background button/setting for calligraphy
authorbuliabyak <buliabyak@users.sourceforge.net>
Wed, 11 Apr 2007 03:19:06 +0000 (03:19 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Wed, 11 Apr 2007 03:19:06 +0000 (03:19 +0000)
src/preferences-skeleton.h
src/widgets/toolbox.cpp

index c40d0c7da324f8f8e7aae3c9067b1d6881a08f31..18df327efc6d55080fe35e7136d8f94bf0ff91de 100644 (file)
@@ -62,7 +62,7 @@ static char const preferences_skeleton[] =
 "    </group>\n"
 "    <eventcontext id=\"calligraphic\" style=\"fill:black;fill-opacity:1;fill-rule:nonzero;stroke:none;\"\n"
 "                       mass=\"0.02\" drag=\"1\" angle=\"30\" width=\"0.15\" thinning=\"0.1\" flatness=\"0.9\" cap_rounding=\"0.0\" usecurrent=\"1\"\n"
-"                       usepressure=\"0\" usetilt=\"0\" keep_selected=\"1\"/>\n"
+"                       tracebackground=\"0\" usepressure=\"0\" usetilt=\"0\" keep_selected=\"1\"/>\n"
 "    <eventcontext id=\"text\"  usecurrent=\"0\" gradientdrag=\"1\"\n" 
 "                       font_sample=\"AaBbCcIiPpQq12369$\342\202\254\302\242?.;/()\"\n"
 "                  style=\"fill:black;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;font-style:normal;font-weight:normal;font-size:12px;\" selcue=\"1\"/>\n"
index b630b3626f4d0ee9178d7165ca06cb5aeae7bae1..c3b124fd8cdce63949d9d2cf0620627df8f6ce70 100644 (file)
@@ -2178,6 +2178,11 @@ static void sp_ddc_pressure_state_changed( GtkToggleAction *act, gpointer data )
     prefs_set_int_attribute( "tools.calligraphic", "usepressure", gtk_toggle_action_get_active( act ) ? 1 : 0);
 }
 
+static void sp_ddc_trace_background_changed( GtkToggleAction *act, gpointer data )
+{
+    prefs_set_int_attribute( "tools.calligraphic", "tracebackground", gtk_toggle_action_get_active( act ) ? 1 : 0);
+}
+
 static void sp_ddc_tilt_state_changed( GtkToggleAction *act, GtkAction *calligraphy_angle )
 {
     prefs_set_int_attribute( "tools.calligraphic", "usetilt", gtk_toggle_action_get_active( act ) ? 1 : 0 );
@@ -2233,6 +2238,7 @@ sp_calligraphy_toolbox_new(SPDesktop *desktop)
         "    <toolitem action='WiggleAction' />"
         "    <toolitem action='MassAction' />"
         "    <separator />"
+        "    <toolitem action='TraceAction' />"
         "    <toolitem action='PressureAction' />"
         "    <toolitem action='TiltAction' />"
         "    <toolitem action='ResetAction' />"
@@ -2369,6 +2375,18 @@ sp_calligraphy_toolbox_new(SPDesktop *desktop)
         }
 
 
+        /* Trace Background button */
+        {
+            InkToggleAction* act = ink_toggle_action_new( "TraceAction",
+                                                          _("Trace Background"),
+                                                          _("Trace the lightness of the background by the width of the pen (white - minimum width, black - maximum width)"),
+                                                          "trace_background",
+                                                          Inkscape::ICON_SIZE_DECORATION );
+            gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+            g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_ddc_trace_background_changed), NULL);
+            gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs_get_int_attribute( "tools.calligraphic", "tracebackground", 0 ) );
+        }
+
         /* Use Pressure button */
         {
             InkToggleAction* act = ink_toggle_action_new( "PressureAction",