Code

Add user-selectable paint bucket path offset size
authorjohncoswell <johncoswell@users.sourceforge.net>
Sat, 3 Mar 2007 00:37:56 +0000 (00:37 +0000)
committerjohncoswell <johncoswell@users.sourceforge.net>
Sat, 3 Mar 2007 00:37:56 +0000 (00:37 +0000)
src/flood-context.cpp
src/widgets/toolbox.cpp

index f58f70940e79d2e03f4aeb9566356bf5f3579c30..e909d446a33d04c1ff212760a91ee44d47ca1ef5 100644 (file)
@@ -266,6 +266,8 @@ static void do_trace(GdkPixbuf *px, SPDesktop *desktop, NR::Matrix transform) {
 
     long totalNodeCount = 0L;
 
+    double offset = prefs_get_double_attribute_limited("tools.paintbucket", "offset", 1.5, 0.0, 2.0);
+
     for (unsigned int i=0 ; i<results.size() ; i++) {
         Inkscape::Trace::TracingEngineResult result = results[i];
         totalNodeCount += result.getNodeCount();
@@ -287,7 +289,7 @@ static void do_trace(GdkPixbuf *px, SPDesktop *desktop, NR::Matrix transform) {
         Shape *expanded_path_shape = new Shape();
         
         expanded_path_shape->ConvertToShape(path_shape, fill_nonZero);
-        path_shape->MakeOffset(expanded_path_shape, 1.5, join_round, 4);
+        path_shape->MakeOffset(expanded_path_shape, offset, join_round, 4);
         expanded_path_shape->ConvertToShape(path_shape, fill_positive);
 
         Path *expanded_path = new Path();
index 70f70efad94ec7f82b231b11d14cb5b2df5de809..2d77a41507f519b479bb2c7ad75055fa86279b83 100644 (file)
@@ -4438,6 +4438,12 @@ static void paintbucket_tolerance_changed(GtkAdjustment *adj, GtkWidget *tbl)
     spinbutton_defocus(GTK_OBJECT(tbl));
 }
 
+static void paintbucket_offset_changed(GtkAdjustment *adj, GtkWidget *tbl)
+{
+    prefs_set_double_attribute("tools.paintbucket", "offset", (gint)adj->value);
+    spinbutton_defocus(GTK_OBJECT(tbl));
+}
+
 static GtkWidget *
 sp_paintbucket_toolbox_new(SPDesktop *desktop)
 {
@@ -4455,6 +4461,21 @@ sp_paintbucket_toolbox_new(SPDesktop *desktop)
                 AUX_SPACING);
     }
     
+    //  interval
+    gtk_box_pack_start(GTK_BOX(tbl), gtk_hbox_new(FALSE, 0), FALSE, FALSE, AUX_BETWEEN_BUTTON_GROUPS);
+
+    // Offset spinbox
+    {
+        GtkWidget *offset = sp_tb_spinbutton(_("Offset:"),
+                _("The amount to grow the path after it has been traced"),
+                "tools.paintbucket", "offset", 5, NULL, tbl, TRUE,
+                "inkscape:paintbucket-offset", 0.0, 2.0, 0.1, 0.5,
+                paintbucket_offset_changed, 1, 2);
+
+        gtk_box_pack_start(GTK_BOX(tbl), offset, FALSE, FALSE,
+                AUX_SPACING);
+    }
+    
     Inkscape::UI::Widget::StyleSwatch *swatch = new Inkscape::UI::Widget::StyleSwatch(NULL, _("Style of Paint Bucket fill objects"));
     swatch->setDesktop (desktop);
     swatch->setClickVerb (SP_VERB_CONTEXT_PAINTBUCKET_PREFS);