Code

Correctly read and write values for Spray Tool option on Tool Controls Bar.
authorJosh Andler <scislac@gmail.com>
Mon, 7 Dec 2009 19:59:14 +0000 (11:59 -0800)
committerJosh Andler <scislac@gmail.com>
Mon, 7 Dec 2009 19:59:14 +0000 (11:59 -0800)
src/spray-context.cpp
src/widgets/toolbox.cpp

index 71dc9648a7f7092be73209618afd409c705b517b..1c050ea06458cadc5a250f091800fc5ae38de1d1 100644 (file)
@@ -379,14 +379,14 @@ sp_spray_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val)
     Glib::ustring path = val->getEntryName();
 
     if (path == "width") {
-        tc->width = CLAMP(val->getDouble(0.1), -1000.0, 1000.0);
+        tc->width = 0.01 * CLAMP(val->getInt(10), 1, 100);
     } else if (path == "mode") {
         tc->mode = val->getInt();
         sp_spray_update_cursor(tc, false);
     } else if (path == "distribution") {
         tc->distrib = val->getInt(1);
     } else if (path == "population") {
-        tc->population = CLAMP(val->getDouble(), 0.0, 1.0);
+        tc->population = 0.01 * CLAMP(val->getInt(10), 1, 100);
      } else if (path == "tilt") {
         tc->tilt = CLAMP(val->getDouble(0.1), 0, 1000.0);
      } else if (path == "ratio") {
@@ -402,9 +402,9 @@ sp_spray_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val)
     } else if (path == "scale_max") {
         tc->scale_max = CLAMP(val->getDouble(1.0), 0, 10.0);
     } else if (path == "mean") {
-        tc->mean = CLAMP(val->getDouble(1.0), 0, 1.0);
+        tc->mean = 0.01 * CLAMP(val->getInt(10), 1, 100);
     } else if (path == "standard_deviation") {
-        tc->standard_deviation = CLAMP(val->getDouble(1.0), 0, 1.0);
+        tc->standard_deviation = 0.01 * CLAMP(val->getInt(10), 1, 100);
     } else if (path == "usepressure") {
         tc->usepressure = val->getBool();
     } else if (path == "doh") {
index b10c60c7916ca59fbf8c08f72b0bec6c69057bc2..f5f1094f01980fa400efac2814d600313564c0f1 100644 (file)
@@ -4469,15 +4469,15 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
 
     {
         /* Width */
-        gchar const* labels[] = {_("(pinch spray)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad spray)")};
+        gchar const* labels[] = {_("(narrow spray)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad spray)")};
         gdouble values[] = {1, 3, 5, 10, 15, 20, 30, 50, 75, 100};
         EgeAdjustmentAction *eact = create_adjustment_action( "SprayWidthAction",
                                                               _("Width"), _("Width:"), _("The width of the spray area (relative to the visible canvas area)"),
                                                               "/tools/spray/width", 15,
                                                               GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "altx-spray",
-                                                              1, 100, 1.0, 0.0,
+                                                              1, 100, 1.0, 10.0,
                                                               labels, values, G_N_ELEMENTS(labels),
-                                                              sp_spray_width_value_changed,  0.01, 0, 100 );
+                                                              sp_spray_width_value_changed,  1, 0 );
         ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
@@ -4491,9 +4491,9 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
                                                               _("Mean"), _("Mean:"), _("The mean of the spray action"),
                                                               "/tools/spray/mean", 20,
                                                               GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-mean",
-                                                              1, 100, 1.0, 0.0,
+                                                              1, 100, 1.0, 10.0,
                                                               labels, values, G_N_ELEMENTS(labels),
-                                                              sp_spray_mean_value_changed,  0.01, 0, 100 );
+                                                              sp_spray_mean_value_changed,  1, 0 );
         ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
@@ -4507,9 +4507,9 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
                                                               _("SD"), _("SD:"), _("The standard deviation of the spray action"),
                                                               "/tools/spray/standard_deviation", 20,
                                                               GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-standard_deviation",
-                                                              1, 100, 1.0, 0.0,
+                                                              1, 100, 1.0, 10.0,
                                                               labels, values, G_N_ELEMENTS(labels),
-                                                              sp_spray_standard_deviation_value_changed,  0.01, 0, 100 );
+                                                              sp_spray_standard_deviation_value_changed,  1, 0 );
         ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
@@ -4561,7 +4561,7 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
     }
 
     {   /* Population */
-        gchar const* labels[] = {_("(rough, simplified)"), 0, 0, _("(default)"), 0, 0, _("(fine, but many nodes)")};
+        gchar const* labels[] = {_("(low population)"), 0, 0, _("(default)"), 0, 0, _("(high population)")};
         gdouble values[] = {10, 25, 35, 50, 60, 80, 100};
         EgeAdjustmentAction *eact = create_adjustment_action( "SprayPopulationAction",
                                                               _("Population"), _("Population:"),
@@ -4570,7 +4570,7 @@ static void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainAction
                                                               GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "spray-population",
                                                               1, 100, 1.0, 10.0,
                                                               labels, values, G_N_ELEMENTS(labels),
-                                                              sp_spray_population_value_changed,  0.01, 0, 100 );
+                                                              sp_spray_population_value_changed,  1, 0 );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
         g_object_set_data( holder, "spray_population", eact );
@@ -4937,7 +4937,7 @@ static void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* main
                                                               GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "altx-calligraphy",
                                                               1, 100, 1.0, 10.0,
                                                               labels, values, G_N_ELEMENTS(labels),
-                                                              sp_ddc_width_value_changed,  1, 0);
+                                                              sp_ddc_width_value_changed,  1, 0 );
         ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
         gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
         gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );