[gimp] app, pdb: change range of brush-spacing to 0.01..5.0



commit a101ed2aeff994dd406ea0ad9b8caf018bd0ebb1
Author: Michael Natterer <mitch gimp org>
Date:   Mon Nov 17 23:56:16 2014 +0100

    app, pdb: change range of brush-spacing to 0.01..5.0
    
    And only use percent in the GUI.

 app/paint/gimpbrushcore.c        |    4 ++--
 app/paint/gimppaintoptions.c     |    6 +++---
 app/pdb/context-cmds.c           |    8 ++++----
 app/tools/gimppaintoptions-gui.c |    6 +++---
 libgimp/gimpcontext_pdb.c        |    4 ++--
 tools/pdbgen/pdb/context.pdb     |    8 ++++----
 6 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index 1063445..40fb32b 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -417,7 +417,7 @@ gimp_brush_core_start (GimpPaintCore     *paint_core,
                                                coords);
     }
 
-  core->spacing = (gdouble) paint_options->brush_spacing / 100;
+  core->spacing = paint_options->brush_spacing;
 
   core->brush = core->main_brush;
 
@@ -556,7 +556,7 @@ gimp_brush_core_interpolate (GimpPaintCore    *paint_core,
        * spacing has a hard defined max.
        */
       dyn_spacing = (core->spacing +
-                     ((2.0 - core->spacing) * ( 1.0 - dyn_spacing)));
+                     ((2.0 - core->spacing) * (1.0 - dyn_spacing)));
 
       /*  Limiting spacing to minimum 1%  */
       dyn_spacing = MAX (core->spacing, dyn_spacing);
diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c
index b5733f3..14211a5 100644
--- a/app/paint/gimppaintoptions.c
+++ b/app/paint/gimppaintoptions.c
@@ -44,7 +44,7 @@
 
 #define DEFAULT_BRUSH_ASPECT_RATIO     0.0
 #define DEFAULT_BRUSH_ANGLE            0.0
-#define DEFAULT_BRUSH_SPACING          10.0
+#define DEFAULT_BRUSH_SPACING          0.1
 
 #define DEFAULT_BRUSH_HARDNESS         1.0 /* Generated brushes have their own */
 #define DEFAULT_BRUSH_FORCE            0.5
@@ -184,7 +184,7 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
 
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BRUSH_SPACING,
                                    "brush-spacing", _("Brush Spacing"),
-                                   1.0, 5000.0, DEFAULT_BRUSH_SPACING,
+                                   0.01, 50.0, DEFAULT_BRUSH_SPACING,
                                    GIMP_PARAM_STATIC_STRINGS);
 
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BRUSH_HARDNESS,
@@ -833,7 +833,7 @@ gimp_paint_options_set_default_brush_spacing (GimpPaintOptions *paint_options,
   if (brush)
     {
       g_object_set (paint_options,
-                    "brush-spacing", (gdouble) gimp_brush_get_spacing (brush),
+                    "brush-spacing", (gdouble) gimp_brush_get_spacing (brush) / 100.0,
                     NULL);
     }
 }
diff --git a/app/pdb/context-cmds.c b/app/pdb/context-cmds.c
index bfb3967..7de9cf2 100644
--- a/app/pdb/context-cmds.c
+++ b/app/pdb/context-cmds.c
@@ -2813,8 +2813,8 @@ register_context_procs (GimpPDB *pdb)
   gimp_procedure_add_return_value (procedure,
                                    g_param_spec_double ("spacing",
                                                         "spacing",
-                                                        "Brush spacing as percent of size",
-                                                        0, G_MAXDOUBLE, 0,
+                                                        "Brush spacing as fraction of size",
+                                                        0.01, 50.0, 0.01,
                                                         GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
@@ -2836,8 +2836,8 @@ register_context_procs (GimpPDB *pdb)
   gimp_procedure_add_argument (procedure,
                                g_param_spec_double ("spacing",
                                                     "spacing",
-                                                    "Brush spacing as percent of size",
-                                                    0, G_MAXDOUBLE, 0,
+                                                    "Brush spacing as fraction of size",
+                                                    0.01, 50.0, 0.01,
                                                     GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
diff --git a/app/tools/gimppaintoptions-gui.c b/app/tools/gimppaintoptions-gui.c
index 848c392..abc6639 100644
--- a/app/tools/gimppaintoptions-gui.c
+++ b/app/tools/gimppaintoptions-gui.c
@@ -178,7 +178,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
       hbox = gimp_paint_options_gui_scale_with_reset_button
         (config, "brush-spacing", _("Spacing"),
          _("Reset spacing to brush's native spacing"),
-         0.1, 1.0, 2, 1.0, 200.0, 1.0, 1.7,
+         0.1, 1.0, 1, 1.0, 200.0, 100.0, 1.7,
          G_CALLBACK (gimp_paint_options_gui_reset_spacing));
       gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
       gtk_widget_show (hbox);
@@ -186,7 +186,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
       hbox = gimp_paint_options_gui_scale_with_reset_button
         (config, "brush-hardness", _("Hardness"),
          _("Reset hardness to default"),
-         0.001, 0.01, 3, 0.0, 100.0, 100.0, 1.0,
+         0.1, 1.0, 1, 0.0, 100.0, 100.0, 1.0,
          G_CALLBACK (gimp_paint_options_gui_reset_hardness));
       gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
       gtk_widget_show (hbox);
@@ -194,7 +194,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
       hbox = gimp_paint_options_gui_scale_with_reset_button
         (config, "brush-force", _("Force"),
          _("Reset force to default"),
-         0.001, 0.01, 2, 0.0, 100.0, 100.0, 1.0,
+         0.1, 1.0, 1, 0.0, 100.0, 100.0, 1.0,
          G_CALLBACK (gimp_paint_options_gui_reset_force));
       gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
       gtk_widget_show (hbox);
diff --git a/libgimp/gimpcontext_pdb.c b/libgimp/gimpcontext_pdb.c
index f940234..b4fb78f 100644
--- a/libgimp/gimpcontext_pdb.c
+++ b/libgimp/gimpcontext_pdb.c
@@ -856,7 +856,7 @@ gimp_context_set_brush_angle (gdouble angle)
  * Get the brush spacing as percent of size for brush based paint
  * tools.
  *
- * Returns: Brush spacing as percent of size.
+ * Returns: Brush spacing as fraction of size.
  *
  * Since: GIMP 2.10
  **/
@@ -881,7 +881,7 @@ gimp_context_get_brush_spacing (void)
 
 /**
  * gimp_context_set_brush_spacing:
- * @spacing: Brush spacing as percent of size.
+ * @spacing: Brush spacing as fraction of size.
  *
  * Set brush spacing as percent of size.
  *
diff --git a/tools/pdbgen/pdb/context.pdb b/tools/pdbgen/pdb/context.pdb
index adb52e0..b72f4e4 100644
--- a/tools/pdbgen/pdb/context.pdb
+++ b/tools/pdbgen/pdb/context.pdb
@@ -709,8 +709,8 @@ sub context_get_brush_spacing {
     &adeath_pdb_misc('2014', '2.10');
 
     @outargs = (
-        { name => "spacing", type => "0 < float",
-          desc => "Brush spacing as percent of size" }
+        { name => "spacing", type => "0.01 <= float <= 50.0",
+          desc => "Brush spacing as fraction of size" }
     );
 
     %invoke = (
@@ -739,8 +739,8 @@ sub context_set_brush_spacing {
     &adeath_pdb_misc('2014', '2.10');
 
     @inargs = (
-        { name => "spacing", type => "0 < float",
-          desc => "Brush spacing as percent of size" }
+        { name => "spacing", type => "0.01 <= float <= 50.0",
+          desc => "Brush spacing as fraction of size" }
     );
 
     %invoke = (


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]