[gimp/soc-2009-dynamics] Lots of improvements on dynamics



commit 3a041ad2523198dce1f5792a8ec3bcfe6563175c
Author: Alexia Death <alexiadeath gmail com>
Date:   Sat Oct 3 18:53:25 2009 +0300

    Lots of improvements on dynamics

 app/core/gimpdynamics.c          |   41 ++-
 app/core/gimpdynamics.h          |   10 +-
 app/paint/gimpairbrush.c         |    7 +-
 app/paint/gimpbrushcore.c        |   18 +-
 app/paint/gimpclone.c            |    9 +-
 app/paint/gimpconvolve.c         |    6 +-
 app/paint/gimpdodgeburn.c        |    9 +-
 app/paint/gimperaser.c           |    9 +-
 app/paint/gimpheal.c             |    9 +-
 app/paint/gimppaintbrush.c       |   11 +-
 app/paint/gimppaintoptions.c     |   27 +--
 app/paint/gimpsmudge.c           |   13 +-
 app/tools/gimppaintoptions-gui.c |  560 +-------------------------------------
 app/widgets/gimpdynamicseditor.c |    4 -
 14 files changed, 95 insertions(+), 638 deletions(-)
---
diff --git a/app/core/gimpdynamics.c b/app/core/gimpdynamics.c
index 1e16ed8..119aa42 100644
--- a/app/core/gimpdynamics.c
+++ b/app/core/gimpdynamics.c
@@ -879,7 +879,7 @@ gimp_dynamics_get_standard (void)
 }
 
 gdouble
-gimp_dynamics_get_linear_output_val (GimpDynamicsOutput *output, GimpCoords coords)
+gimp_dynamics_get_linear_output_val (GimpDynamicsOutput *output, GimpCoords coords, gdouble fade_point)
 {
   gdouble total = 0.0;
   gdouble factors = 0.0;
@@ -918,9 +918,8 @@ gimp_dynamics_get_linear_output_val (GimpDynamicsOutput *output, GimpCoords coor
 
   if (output->fade)
     {
-      //total += g_random_double_range (0.0, 1.0);
-      //factors++;
-      /*Implementation needs fixing*/
+      total += fade_point;
+      factors++;
     }
 
   if (factors > 0)
@@ -931,7 +930,7 @@ gimp_dynamics_get_linear_output_val (GimpDynamicsOutput *output, GimpCoords coor
 }
 
 gdouble
-gimp_dynamics_get_angular_output_val (GimpDynamicsOutput *output, GimpCoords coords)
+gimp_dynamics_get_angular_output_val (GimpDynamicsOutput *output, GimpCoords coords, gdouble fade_point)
 {
   gdouble total = 0.0;
   gdouble factors = 0.0;
@@ -999,9 +998,8 @@ gimp_dynamics_get_angular_output_val (GimpDynamicsOutput *output, GimpCoords coo
 
   if (output->fade)
     {
-      //total += g_random_double_range (0.0, 1.0);
-      //factors++;
-      /*Implementation needs fixing*/
+      total += fade_point;
+      factors++;
     }
 
   if (factors > 0)
@@ -1012,7 +1010,7 @@ gimp_dynamics_get_angular_output_val (GimpDynamicsOutput *output, GimpCoords coo
 
 
 gdouble
-gimp_dynamics_get_aspect_output_val (GimpDynamicsOutput *output, GimpCoords coords)
+gimp_dynamics_get_aspect_output_val (GimpDynamicsOutput *output, GimpCoords coords, gdouble fade_point)
 {
   gdouble total = 0.0;
   gdouble factors = 0.0;
@@ -1066,9 +1064,8 @@ gimp_dynamics_get_aspect_output_val (GimpDynamicsOutput *output, GimpCoords coor
 
   if (output->fade)
     {
-      //total += g_random_double_range (0.0, 1.0);
-      //factors++;
-      /*Implementation needs fixing*/
+      total += fade_point;
+      factors++;
     }
 
   if (factors > 0)
@@ -1080,7 +1077,7 @@ gimp_dynamics_get_aspect_output_val (GimpDynamicsOutput *output, GimpCoords coor
 
 
 gdouble
-gimp_dynamics_get_scale_output_val (GimpDynamicsOutput *output, GimpCoords coords)
+gimp_dynamics_get_scale_output_val (GimpDynamicsOutput *output, GimpCoords coords, gdouble fade_point)
 {
   gdouble total = 0.0;
   gdouble factors = 0.0;
@@ -1119,9 +1116,8 @@ gimp_dynamics_get_scale_output_val (GimpDynamicsOutput *output, GimpCoords coord
 
   if (output->fade)
     {
-      //total += g_random_double_range (0.0, 1.0);
-      //factors++;
-      /*Implementation needs fixing*/
+      total += fade_point;
+      factors++;
     }
 
   if (factors > 0)
@@ -1141,4 +1137,17 @@ gimp_dynamics_output_get_enabled(GimpDynamicsOutput *output)
 {
   return (output->pressure || output->velocity || output->direction ||
          output->tilt      || output->random   || output->fade);
+}
+
+gboolean
+gimp_dynamics_input_fade_enabled(GimpDynamics *dynamics)
+{
+  return (dynamics->opacity_dynamics->fade ||
+          dynamics->hardness_dynamics->fade ||
+          dynamics->rate_dynamics->fade ||
+          dynamics->size_dynamics->fade ||
+          dynamics->aspect_ratio_dynamics->fade ||
+          dynamics->color_dynamics->fade ||
+          dynamics->angle_dynamics->fade);
+
 }
\ No newline at end of file
diff --git a/app/core/gimpdynamics.h b/app/core/gimpdynamics.h
index e181f51..5d47a6e 100644
--- a/app/core/gimpdynamics.h
+++ b/app/core/gimpdynamics.h
@@ -90,17 +90,19 @@ GimpData           * gimp_dynamics_new   (const gchar *name);
 
 GimpData           * gimp_dynamics_get_standard     (void);
 
-gdouble            gimp_dynamics_get_linear_output_val (GimpDynamicsOutput *output, GimpCoords coords);
+gdouble            gimp_dynamics_get_linear_output_val (GimpDynamicsOutput *output, GimpCoords coords, gdouble fade_point);
 
 
-gdouble            gimp_dynamics_get_angular_output_val (GimpDynamicsOutput *output, GimpCoords coords);
+gdouble            gimp_dynamics_get_angular_output_val (GimpDynamicsOutput *output, GimpCoords coords, gdouble fade_point);
 
 
-gdouble            gimp_dynamics_get_aspect_output_val (GimpDynamicsOutput *output, GimpCoords coords);
+gdouble            gimp_dynamics_get_aspect_output_val (GimpDynamicsOutput *output, GimpCoords coords, gdouble fade_point);
 
 
-gdouble            gimp_dynamics_get_scale_output_val (GimpDynamicsOutput *output, GimpCoords coords);
+gdouble            gimp_dynamics_get_scale_output_val (GimpDynamicsOutput *output, GimpCoords coords, gdouble fade_point);
 
 gboolean           gimp_dynamics_output_get_enabled (GimpDynamicsOutput *output);
 
+gboolean           gimp_dynamics_input_fade_enabled (GimpDynamics *dynamics);
+
 #endif  /*  __GIMP_DYNAMICS_OPTIONS_H__  */
diff --git a/app/paint/gimpairbrush.c b/app/paint/gimpairbrush.c
index b8f0fd2..4aea439 100644
--- a/app/paint/gimpairbrush.c
+++ b/app/paint/gimpairbrush.c
@@ -112,6 +112,7 @@ gimp_airbrush_paint (GimpPaintCore    *paint_core,
 {
   GimpAirbrush        *airbrush = GIMP_AIRBRUSH (paint_core);
   GimpAirbrushOptions *options  = GIMP_AIRBRUSH_OPTIONS (paint_options);
+  GimpDynamics        *dynamics = gimp_context_get_dynamics(GIMP_CONTEXT(paint_options));
 
   switch (paint_state)
     {
@@ -141,13 +142,13 @@ gimp_airbrush_paint (GimpPaintCore    *paint_core,
         {
           gdouble dynamic_rate;
           gint    timeout;
+          gdouble fade_point = gimp_paint_options_get_fade (paint_options, gimp_item_get_image (GIMP_ITEM (drawable)),
+                                                            paint_core->pixel_dist);
 
           airbrush->drawable      = drawable;
           airbrush->paint_options = paint_options;
 
-          dynamic_rate = 1;// gimp_paint_options_get_dynamic_rate (paint_options,
-                                       //                       coords,
-                                       //                        paint_core->pixel_dist);
+          dynamic_rate = gimp_dynamics_get_linear_output_val(dynamics->rate_dynamics, *coords, fade_point);
 
           timeout = 10000 / (options->rate * dynamic_rate);
 
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index 0d5d5fe..fe1d24c 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -401,11 +401,14 @@ gimp_brush_core_start (GimpPaintCore     *paint_core,
 
       if (core->dynamics)
         {
-          core->scale *= gimp_dynamics_get_linear_output_val(core->dynamics->size_dynamics, *coords);
+          gdouble fade_point = gimp_paint_options_get_fade (paint_options, gimp_item_get_image (GIMP_ITEM (drawable)),
+                                                            paint_core->pixel_dist);
 
-          core->angle += gimp_dynamics_get_angular_output_val(core->dynamics->angle_dynamics, *coords);
+          core->scale *= gimp_dynamics_get_scale_output_val(core->dynamics->size_dynamics, *coords, fade_point);
 
-          core->aspect_ratio *= gimp_dynamics_get_aspect_output_val(core->dynamics->aspect_ratio_dynamics, *coords);
+          core->angle += gimp_dynamics_get_angular_output_val(core->dynamics->angle_dynamics, *coords, fade_point);
+
+          core->aspect_ratio *= gimp_dynamics_get_aspect_output_val(core->dynamics->aspect_ratio_dynamics, *coords, fade_point);
         }
     }
 
@@ -754,11 +757,14 @@ gimp_brush_core_get_paint_area (GimpPaintCore    *paint_core,
 
       if (core->dynamics)
       {
-        core->scale *= gimp_dynamics_get_linear_output_val(core->dynamics->size_dynamics, *coords);
+        gdouble fade_point = gimp_paint_options_get_fade (paint_options, gimp_item_get_image (GIMP_ITEM (drawable)),
+                                                          paint_core->pixel_dist);
+
+        core->scale *= gimp_dynamics_get_scale_output_val(core->dynamics->size_dynamics, *coords, fade_point);
 
-        core->angle += gimp_dynamics_get_angular_output_val(core->dynamics->angle_dynamics, *coords);
+        core->angle += gimp_dynamics_get_angular_output_val(core->dynamics->angle_dynamics, *coords, fade_point);
 
-        core->aspect_ratio *= gimp_dynamics_get_aspect_output_val(core->dynamics->aspect_ratio_dynamics, *coords);
+        core->aspect_ratio *= gimp_dynamics_get_aspect_output_val(core->dynamics->aspect_ratio_dynamics, *coords, fade_point);
 
       }
     }
diff --git a/app/paint/gimpclone.c b/app/paint/gimpclone.c
index a9f8a47..1f10598 100644
--- a/app/paint/gimpclone.c
+++ b/app/paint/gimpclone.c
@@ -176,6 +176,9 @@ gimp_clone_motion (GimpSourceCore   *source_core,
   GimpPattern       *pattern = NULL;
   gdouble            hardness;
 
+  gdouble fade_point = gimp_paint_options_get_fade (paint_options, gimp_item_get_image (GIMP_ITEM (drawable)),
+                                                    paint_core->pixel_dist);
+
   image = gimp_item_get_image (GIMP_ITEM (drawable));
 
   switch (options->clone_type)
@@ -238,11 +241,9 @@ gimp_clone_motion (GimpSourceCore   *source_core,
         }
     }
 
-  opacity *= 1; /*gimp_paint_options_get_dynamic_opacity (paint_options, coords,
-                                                     paint_core->pixel_dist);*/
+  opacity *= gimp_dynamics_get_linear_output_val(GIMP_BRUSH_CORE(paint_core)->dynamics->opacity_dynamics, *coords, fade_point);
 
-  hardness = 1; /*gimp_paint_options_get_dynamic_hardness (paint_options, coords,
-                                                      paint_core->pixel_dist);*/
+  hardness = gimp_dynamics_get_linear_output_val(GIMP_BRUSH_CORE(paint_core)->dynamics->hardness_dynamics, *coords, fade_point);
 
   gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
                                 coords,
diff --git a/app/paint/gimpconvolve.c b/app/paint/gimpconvolve.c
index 627c8c6..fdbdcbd 100644
--- a/app/paint/gimpconvolve.c
+++ b/app/paint/gimpconvolve.c
@@ -137,6 +137,9 @@ gimp_convolve_motion (GimpPaintCore    *paint_core,
   gdouble              rate;
   gint                 bytes;
 
+  gdouble fade_point = gimp_paint_options_get_fade (paint_options, gimp_item_get_image (GIMP_ITEM (drawable)),
+                                                    paint_core->pixel_dist);
+
   image = gimp_item_get_image (GIMP_ITEM (drawable));
 
   if (gimp_drawable_is_indexed (drawable))
@@ -154,8 +157,7 @@ gimp_convolve_motion (GimpPaintCore    *paint_core,
 
   rate = options->rate;
 
-  rate *= 1;/*gimp_paint_options_get_dynamic_rate (paint_options, coords,
-                                               paint_core->pixel_dist);*/
+  rate *= gimp_dynamics_get_linear_output_val(GIMP_BRUSH_CORE(paint_core)->dynamics->rate_dynamics, *coords, fade_point);
 
   gimp_convolve_calculate_matrix (convolve, options->type,
                                   brush_core->brush->mask->width / 2,
diff --git a/app/paint/gimpdodgeburn.c b/app/paint/gimpdodgeburn.c
index 7846768..42ded85 100644
--- a/app/paint/gimpdodgeburn.c
+++ b/app/paint/gimpdodgeburn.c
@@ -176,6 +176,9 @@ gimp_dodge_burn_motion (GimpPaintCore    *paint_core,
   gdouble        opacity;
   gdouble        hardness;
 
+  gdouble fade_point = gimp_paint_options_get_fade (paint_options, gimp_item_get_image (GIMP_ITEM (drawable)),
+                                                    paint_core->pixel_dist);
+
   image = gimp_item_get_image (GIMP_ITEM (drawable));
 
   if (gimp_drawable_is_indexed (drawable))
@@ -246,11 +249,9 @@ gimp_dodge_burn_motion (GimpPaintCore    *paint_core,
 
   g_free (temp_data);
 
-  opacity *= 1; /*gimp_paint_options_get_dynamic_opacity (paint_options, coords,
-                                                     paint_core->pixel_dist);*/
+  opacity *= gimp_dynamics_get_linear_output_val(GIMP_BRUSH_CORE(paint_core)->dynamics->opacity_dynamics, *coords, fade_point);
 
-  hardness = 1; /*gimp_paint_options_get_dynamic_hardness (paint_options, coords,
-                                                      paint_core->pixel_dist);*/
+  hardness = gimp_dynamics_get_linear_output_val(GIMP_BRUSH_CORE(paint_core)->dynamics->hardness_dynamics, *coords, fade_point);
 
   /* Replace the newly dodgedburned area (canvas_buf) to the image */
   gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
diff --git a/app/paint/gimperaser.c b/app/paint/gimperaser.c
index 99efb39..bc1f246 100644
--- a/app/paint/gimperaser.c
+++ b/app/paint/gimperaser.c
@@ -113,6 +113,9 @@ gimp_eraser_motion (GimpPaintCore    *paint_core,
   guchar             col[MAX_CHANNELS];
   gdouble            hardness;
 
+  gdouble fade_point = gimp_paint_options_get_fade (paint_options, gimp_item_get_image (GIMP_ITEM (drawable)),
+                                                    paint_core->pixel_dist);
+
   image = gimp_item_get_image (GIMP_ITEM (drawable));
 
   opacity = gimp_paint_options_get_fade (paint_options, image,
@@ -135,11 +138,9 @@ gimp_eraser_motion (GimpPaintCore    *paint_core,
   color_pixels (temp_buf_get_data (area), col,
                 area->width * area->height, area->bytes);
 
-  opacity *= 1; /*gimp_paint_options_get_dynamic_opacity (paint_options, coords,
-                                                     paint_core->pixel_dist);*/
+  opacity *= gimp_dynamics_get_linear_output_val(GIMP_BRUSH_CORE(paint_core)->dynamics->opacity_dynamics, *coords, fade_point);
 
-  hardness = 1; /*gimp_paint_options_get_dynamic_hardness (paint_options, coords,
-                                                      paint_core->pixel_dist);*/
+  hardness = gimp_dynamics_get_linear_output_val(GIMP_BRUSH_CORE(paint_core)->dynamics->hardness_dynamics, *coords, fade_point);
 
   gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
                                 coords,
diff --git a/app/paint/gimpheal.c b/app/paint/gimpheal.c
index b1a30e8..8666240 100644
--- a/app/paint/gimpheal.c
+++ b/app/paint/gimpheal.c
@@ -439,8 +439,10 @@ gimp_heal_motion (GimpSourceCore   *source_core,
   TempBuf       *mask_buf;
   gdouble        hardness;
 
-  hardness = 1;/*gimp_paint_options_get_dynamic_hardness (paint_options, coords,
-                                                      paint_core->pixel_dist);*/
+  gdouble fade_point = gimp_paint_options_get_fade (paint_options, gimp_item_get_image (GIMP_ITEM (drawable)),
+                                                    paint_core->pixel_dist);
+
+  hardness = gimp_dynamics_get_linear_output_val(GIMP_BRUSH_CORE(paint_core)->dynamics->hardness_dynamics, *coords, fade_point);
 
   mask_buf = gimp_brush_core_get_brush_mask (GIMP_BRUSH_CORE (source_core),
                                              coords,
@@ -548,8 +550,7 @@ gimp_heal_motion (GimpSourceCore   *source_core,
 
   temp_buf_free (temp);
 
-  opacity *= 1;/*gimp_paint_options_get_dynamic_opacity (paint_options, coords,
-                                                     paint_core->pixel_dist);*/
+  opacity *= gimp_dynamics_get_linear_output_val(GIMP_BRUSH_CORE(paint_core)->dynamics->opacity_dynamics, *coords, fade_point);
 
   /* replace the canvas with our healed data */
   gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c
index 6c85253..49f2ebc 100644
--- a/app/paint/gimppaintbrush.c
+++ b/app/paint/gimppaintbrush.c
@@ -116,13 +116,12 @@ _gimp_paintbrush_motion (GimpPaintCore    *paint_core,
   GimpPaintApplicationMode  paint_appl_mode;
   gdouble                   grad_point;
   gdouble                   hardness;
+  gdouble                   fade_point;
 
   image = gimp_item_get_image (GIMP_ITEM (drawable));
 
-  opacity *= gimp_paint_options_get_fade (paint_options, image,
+  fade_point = gimp_paint_options_get_fade (paint_options, image,
                                           paint_core->pixel_dist);
-  if (opacity == 0.0)
-    return;
 
   area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options,
                                          coords);
@@ -131,7 +130,7 @@ _gimp_paintbrush_motion (GimpPaintCore    *paint_core,
 
   paint_appl_mode = paint_options->application_mode;
 
-  grad_point = gimp_dynamics_get_linear_output_val(brush_core->dynamics->color_dynamics, *coords);
+  grad_point = gimp_dynamics_get_linear_output_val(brush_core->dynamics->color_dynamics, *coords, fade_point);
 
   /* optionally take the color from the current gradient */
   if (gimp_paint_options_get_gradient_color (paint_options, image,
@@ -176,9 +175,9 @@ _gimp_paintbrush_motion (GimpPaintCore    *paint_core,
                     area->bytes);
     }
 
-  opacity *= gimp_dynamics_get_linear_output_val(brush_core->dynamics->opacity_dynamics, *coords);
+  opacity *= gimp_dynamics_get_linear_output_val(brush_core->dynamics->opacity_dynamics, *coords, fade_point);
 
-  hardness = gimp_dynamics_get_linear_output_val(brush_core->dynamics->hardness_dynamics, *coords);
+  hardness = gimp_dynamics_get_linear_output_val(brush_core->dynamics->hardness_dynamics, *coords, fade_point);
 
   /* finally, let the brush core paste the colored area on the canvas */
   gimp_brush_core_paste_canvas (brush_core, drawable,
diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c
index 42e84da..8422e3d 100644
--- a/app/paint/gimppaintoptions.c
+++ b/app/paint/gimppaintoptions.c
@@ -42,7 +42,6 @@
 #define DEFAULT_APPLICATION_MODE       GIMP_PAINT_CONSTANT
 #define DEFAULT_HARD                   FALSE
 
-#define DEFAULT_USE_FADE               FALSE
 #define DEFAULT_FADE_LENGTH            100.0
 #define DEFAULT_FADE_UNIT              GIMP_UNIT_PIXEL
 
@@ -69,7 +68,6 @@ enum
   PROP_APPLICATION_MODE,
   PROP_HARD,
 
-  PROP_USE_FADE,
   PROP_FADE_LENGTH,
   PROP_FADE_UNIT,
 
@@ -151,10 +149,6 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
                                     DEFAULT_HARD,
                                     GIMP_PARAM_STATIC_STRINGS);
 
-  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_FADE,
-                                    "use-fade", NULL,
-                                    DEFAULT_USE_FADE,
-                                    GIMP_PARAM_STATIC_STRINGS);
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_FADE_LENGTH,
                                    "fade-length", NULL,
                                    0.0, 32767.0, DEFAULT_FADE_LENGTH,
@@ -293,10 +287,6 @@ gimp_paint_options_set_property (GObject      *object,
       options->hard = g_value_get_boolean (value);
       break;
 
-    case PROP_USE_FADE:
-      fade_options->use_fade = g_value_get_boolean (value);
-      break;
-
     case PROP_FADE_LENGTH:
       fade_options->fade_length = g_value_get_double (value);
       break;
@@ -400,11 +390,6 @@ gimp_paint_options_get_property (GObject    *object,
       g_value_set_boolean (value, options->hard);
       break;
 
-
-    case PROP_USE_FADE:
-      g_value_set_boolean (value, fade_options->use_fade);
-      break;
-
     case PROP_FADE_LENGTH:
       g_value_set_double (value, fade_options->fade_length);
       break;
@@ -527,7 +512,7 @@ gimp_paint_options_get_fade (GimpPaintOptions *paint_options,
 
   fade_options = paint_options->fade_options;
 
-  if (fade_options->use_fade)
+  if (gimp_dynamics_input_fade_enabled(gimp_context_get_dynamics (GIMP_CONTEXT (paint_options))))
     {
       gdouble fade_out = 0.0;
       gdouble unit_factor;
@@ -679,15 +664,17 @@ gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
 GimpBrushApplicationMode
 gimp_paint_options_get_brush_mode (GimpPaintOptions *paint_options)
 {
+  GimpDynamics *dynamics;
+
   g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), GIMP_BRUSH_SOFT);
 
   if (paint_options->hard)
     return GIMP_BRUSH_HARD;
 
-/*  if (paint_options->pressure_options->hardness ||
-      paint_options->velocity_options->hardness ||
-      paint_options->random_options->hardness)
-    return GIMP_BRUSH_PRESSURE;*/
+  dynamics = gimp_context_get_dynamics (GIMP_CONTEXT (paint_options));
+
+  if (gimp_dynamics_output_get_enabled(dynamics->hardness_dynamics))
+    return GIMP_BRUSH_PRESSURE;
 
   return GIMP_BRUSH_SOFT;
 }
diff --git a/app/paint/gimpsmudge.c b/app/paint/gimpsmudge.c
index c3a73dd..ec973b4 100644
--- a/app/paint/gimpsmudge.c
+++ b/app/paint/gimpsmudge.c
@@ -247,6 +247,9 @@ gimp_smudge_motion (GimpPaintCore    *paint_core,
   gint               x, y, w, h;
   gdouble            hardness;
 
+  gdouble fade_point = gimp_paint_options_get_fade (paint_options, gimp_item_get_image (GIMP_ITEM (drawable)),
+                                                    paint_core->pixel_dist);
+
   image = gimp_item_get_image (GIMP_ITEM (drawable));
 
   if (gimp_drawable_is_indexed (drawable))
@@ -271,8 +274,8 @@ gimp_smudge_motion (GimpPaintCore    *paint_core,
                      area->x, area->y, area->width, area->height, FALSE);
 
   /* Enable dynamic rate */
-  dynamic_rate = 1;/*gimp_paint_options_get_dynamic_rate (paint_options, coords,
-                                                      paint_core->pixel_dist);*/
+  dynamic_rate = gimp_dynamics_get_linear_output_val(GIMP_BRUSH_CORE(paint_core)->dynamics->rate_dynamics, *coords, fade_point);
+
   rate = (options->rate / 100.0) * dynamic_rate;
 
   /* The tempPR will be the built up buffer (for smudge) */
@@ -312,11 +315,9 @@ gimp_smudge_motion (GimpPaintCore    *paint_core,
   else
     copy_region (&tempPR, &destPR);
 
-  opacity *= 1;/*gimp_paint_options_get_dynamic_opacity (paint_options, coords,
-                                                     paint_core->pixel_dist);*/
+  opacity *= gimp_dynamics_get_linear_output_val(GIMP_BRUSH_CORE(paint_core)->dynamics->opacity_dynamics, *coords, fade_point);
 
-  hardness = 1;/*gimp_paint_options_get_dynamic_hardness (paint_options, coords,
-                                                      paint_core->pixel_dist);*/
+  hardness = gimp_dynamics_get_linear_output_val(GIMP_BRUSH_CORE(paint_core)->dynamics->hardness_dynamics, *coords, fade_point);
 
   gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
                                   coords,
diff --git a/app/tools/gimppaintoptions-gui.c b/app/tools/gimppaintoptions-gui.c
index bf41706..eace09c 100644
--- a/app/tools/gimppaintoptions-gui.c
+++ b/app/tools/gimppaintoptions-gui.c
@@ -55,28 +55,6 @@ static gboolean    tool_has_color_dynamics        (GType       tool_type);
 static gboolean    tool_has_angle_dynamics        (GType       tool_type);
 static gboolean    tool_has_aspect_ratio_dynamics (GType       tool_type);
 
-/*static void        pressure_options_gui  (GimpPaintOptions *paint_options,
-                                          GType             tool_type,
-                                          GtkTable         *table,
-                                          gint              row,
-                                          GtkWidget        *labels[]);
-static void        velocity_options_gui  (GimpPaintOptions *paint_options,
-                                          GType             tool_type,
-                                          GtkTable         *table,
-                                          gint              row);
-static void        direction_options_gui (GimpPaintOptions *paint_options,
-                                          GType             tool_type,
-                                          GtkTable         *table,
-                                          gint              row);
-static void        tilt_options_gui      (GimpPaintOptions *paint_options,
-                                          GType             tool_type,
-                                          GtkTable         *table,
-                                          gint              row);
-static void        random_options_gui    (GimpPaintOptions *paint_options,
-                                          GType             tool_type,
-                                          GtkTable         *table,
-                                          gint              row);*/
-/**/
 static void        fading_options_gui    (GimpPaintOptions *paint_options,
                                           GType             tool_type,
                                           GtkTable         *table,
@@ -176,150 +154,6 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
                                              FALSE, 0.0, 0.0);
     }
 
-  /*if (tool_has_opacity_dynamics (tool_type))
-    {
-      dynamics_labels[n_dynamics] = gtk_label_new (_("Opacity"));
-      n_dynamics++;
-    }
-
-  if (tool_has_hardness_dynamics (tool_type))
-    {
-      dynamics_labels[n_dynamics] = gtk_label_new (_("Hardness"));
-      n_dynamics++;
-    }
-
-  if (tool_has_rate_dynamics (tool_type))
-    {
-      dynamics_labels[n_dynamics] = gtk_label_new (_("Rate"));
-      n_dynamics++;
-    }
-
-  if (tool_has_size_dynamics (tool_type))
-    {
-      dynamics_labels[n_dynamics] = gtk_label_new (_("Size"));
-      n_dynamics++;
-    }
-
-  if (tool_has_aspect_ratio_dynamics (tool_type))
-    {
-      dynamics_labels[n_dynamics] = gtk_label_new (_("Aspect ratio"));
-      n_dynamics++;
-    }
-
-
-  if (tool_has_angle_dynamics (tool_type))
-    {
-      dynamics_labels[n_dynamics] = gtk_label_new (_("Angle"));
-      n_dynamics++;
-    }
-
-  if (tool_has_color_dynamics (tool_type))
-    {
-      dynamics_labels[n_dynamics] = gtk_label_new (_("Color"));
-      n_dynamics++;
-    }
-  */
-  /* NB: When adding new dynamics, increase size of the
-   * dynamics_labels[] array
-   */
-
-/*
-  if (n_dynamics > 0)
-    {
-      GtkWidget *inner_frame;
-      GtkWidget *fixed;
-      gint       i;
-      gboolean   rtl = gtk_widget_get_direction (vbox) == GTK_TEXT_DIR_RTL;
-
-      frame = gimp_prop_expander_new (config, "dynamics-expanded",
-                                      _("Brush Dynamics"));
-      gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
-      gtk_widget_show (frame);
-
-      inner_frame = gimp_frame_new ("<expander>");
-      gtk_container_add (GTK_CONTAINER (frame), inner_frame);
-      gtk_widget_show (inner_frame);
-
-      table = gtk_table_new (7, n_dynamics + 2, FALSE);
-      gtk_container_add (GTK_CONTAINER (inner_frame), table);
-      gtk_widget_show (table);
-
-      label = gtk_label_new (_("Pressure:"));
-      gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-      gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
-                        GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
-      gtk_widget_show (label);
-
-      label = gtk_label_new (_("Velocity:"));
-      gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-      gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
-                        GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
-      gtk_widget_show (label);
-
-      label = gtk_label_new (_("Direction:"));
-      gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-      gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
-                        GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
-      gtk_widget_show (label);
-
-      label = gtk_label_new (_("Tilt:"));
-      gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-      gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5,
-                        GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
-      gtk_widget_show (label);
-
-      label = gtk_label_new (_("Random:"));
-      gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-      gtk_table_attach (GTK_TABLE (table), label, 0, 1, 5, 6,
-                        GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
-      gtk_widget_show (label);
-
-//@@Nicolas
-
-      label = gtk_label_new (_("Fading - new:"));
-      gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-      gtk_table_attach (GTK_TABLE (table), label, 0, 1, 6, 7,
-                        GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
-      gtk_widget_show (label);
-
-      pressure_options_gui (options, tool_type,
-                            GTK_TABLE (table), 1,
-                            dynamics_labels);
-
-      velocity_options_gui (options, tool_type,
-                            GTK_TABLE (table), 2);
-
-      direction_options_gui (options, tool_type,
-                             GTK_TABLE (table), 3);
-
-      tilt_options_gui (options, tool_type,
-                        GTK_TABLE (table), 4);
-
-      random_options_gui (options, tool_type,
-                          GTK_TABLE (table), 5);
-
-      fading_options_gui (options, tool_type,
-                          GTK_TABLE (table), 6);
-
-       */
-      /* EEK: pack the fixed *after* the buttons so the table calls
-       * size-allocates on it *before* it places the toggles. Fixes
-       * label positions in RTL mode.
-       */
-   /*   fixed = gtk_fixed_new ();
-      gtk_table_attach (GTK_TABLE (table), fixed, 0, n_dynamics + 2, 0, 1,
-                        GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
-      gtk_widget_show (fixed);
-
-      for (i = 0; i < n_dynamics; i++)
-        {
-          gtk_label_set_angle (GTK_LABEL (dynamics_labels[i]),
-                               rtl ? 315 : 45);
-          gtk_misc_set_alignment (GTK_MISC (dynamics_labels[i]), 1.0, 1.0);
-          gtk_fixed_put (GTK_FIXED (fixed), dynamics_labels[i], 0, 0);
-          gtk_widget_show (dynamics_labels[i]);
-        }
-    }*/
 
   if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
     {
@@ -480,392 +314,6 @@ dynamics_check_button_size_allocate (GtkWidget     *toggle,
   gtk_fixed_move (GTK_FIXED (fixed), label, x, y);
 }
 
-static void
-pressure_options_gui (GimpPaintOptions *paint_options,
-                      GType             tool_type,
-                      GtkTable         *table,
-                      gint              row,
-                      GtkWidget        *labels[])
-{
-  GObject   *config = G_OBJECT (paint_options);
-  GtkWidget *button;
-  gint       column = 1;
-  GtkWidget *scalebutton;
-
-  if (tool_has_opacity_dynamics (tool_type))
-    {
-      button = dynamics_check_button_new (config, "pressure-opacity",
-                                          table, column, row);
-      g_signal_connect (button, "size-allocate",
-                        G_CALLBACK (dynamics_check_button_size_allocate),
-                        labels[column - 1]);
-      column++;
-    }
-
-  if (tool_has_hardness_dynamics (tool_type))
-    {
-      button = dynamics_check_button_new (config, "pressure-hardness",
-                                          table, column, row);
-      g_signal_connect (button, "size-allocate",
-                        G_CALLBACK (dynamics_check_button_size_allocate),
-                        labels[column - 1]);
-      column++;
-    }
-
-  if (tool_has_rate_dynamics (tool_type))
-    {
-      button = dynamics_check_button_new (config, "pressure-rate",
-                                          table, column, row);
-      g_signal_connect (button, "size-allocate",
-                        G_CALLBACK (dynamics_check_button_size_allocate),
-                        labels[column - 1]);
-      column++;
-    }
-
-  if (tool_has_size_dynamics (tool_type))
-    {
-      if (tool_type != GIMP_TYPE_AIRBRUSH_TOOL)
-        button = dynamics_check_button_new (config, "pressure-size",
-                                            table, column, row);
-      else
-        button = dynamics_check_button_new (config, "pressure-inverse-size",
-                                            table, column, row);
-
-      g_signal_connect (button, "size-allocate",
-                        G_CALLBACK (dynamics_check_button_size_allocate),
-                        labels[column - 1]);
-      column++;
-    }
-
-  if (tool_has_aspect_ratio_dynamics (tool_type))
-    {
-      button = dynamics_check_button_new (config, "pressure-aspect_ratio",
-                                          table, column, row);
-
-      g_signal_connect (button, "size-allocate",
-                        G_CALLBACK (dynamics_check_button_size_allocate),
-                        labels[column - 1]);
-      column++;
-     }
-
-  if (tool_has_angle_dynamics (tool_type))
-    {
-      button = dynamics_check_button_new (config, "pressure-angle",
-                                          table, column, row);
-      g_signal_connect (button, "size-allocate",
-                        G_CALLBACK (dynamics_check_button_size_allocate),
-                        labels[column - 1]);
-      column++;
-    }
-
-  if (tool_has_color_dynamics (tool_type))
-    {
-      button = dynamics_check_button_new (config, "pressure-color",
-                                          table, column, row);
-      g_signal_connect (button, "size-allocate",
-                        G_CALLBACK (dynamics_check_button_size_allocate),
-                        labels[column - 1]);
-      column++;
-    }
-
-   scalebutton = gimp_prop_scale_button_new (config, "pressure-prescale");
-   gtk_table_attach (table, scalebutton, column, column + 1, row, row + 1,
-                    GTK_SHRINK, GTK_SHRINK, 0, 0);
-   gtk_widget_show (scalebutton);
-}
-
-static void
-velocity_options_gui (GimpPaintOptions *paint_options,
-                      GType             tool_type,
-                      GtkTable         *table,
-                      gint              row)
-{
-  GObject   *config = G_OBJECT (paint_options);
-  gint       column = 1;
-  GtkWidget *scalebutton;
-
-  if (tool_has_opacity_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "velocity-opacity",
-                                 table, column++, row);
-    }
-
-  if (tool_has_hardness_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "velocity-hardness",
-                                 table, column++, row);
-    }
-
-  if (tool_has_rate_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "velocity-rate",
-                                 table, column++, row);
-    }
-
-  if (tool_has_size_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "velocity-size",
-                                 table, column++, row);
-    }
-
-  if (tool_has_aspect_ratio_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "velocity-aspect-ratio",
-                                 table, column++, row);
-    }
-
-
-  if (tool_has_angle_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "velocity-angle",
-                                 table, column++, row);
-    }
-
-  if (tool_has_color_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "velocity-color",
-                                 table, column++, row);
-    }
-
-  scalebutton = gimp_prop_scale_button_new (config, "velocity-prescale");
-  gtk_table_attach (table, scalebutton, column, column + 1, row, row + 1,
-                    GTK_SHRINK, GTK_SHRINK, 0, 0);
-  gtk_widget_show (scalebutton);
-}
-
-static void
-direction_options_gui (GimpPaintOptions *paint_options,
-                       GType             tool_type,
-                       GtkTable         *table,
-                       gint              row)
-{
-  GObject   *config = G_OBJECT (paint_options);
-  gint       column = 1;
-  GtkWidget *scalebutton;
-
-  if (tool_has_opacity_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "direction-opacity",
-                                 table, column++, row);
-    }
-
-  if (tool_has_hardness_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "direction-hardness",
-                                 table, column++, row);
-    }
-
-  if (tool_has_rate_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "direction-rate",
-                                 table, column++, row);
-    }
-
-  if (tool_has_size_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "direction-size",
-                                 table, column++, row);
-    }
-
-  if (tool_has_aspect_ratio_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "direction-aspect-ratio",
-                                 table, column++, row);
-    }
-
-  if (tool_has_angle_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "direction-angle",
-                                 table, column++, row);
-    }
-
-  if (tool_has_color_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "direction-color",
-                                 table, column++, row);
-    }
-
-  scalebutton = gimp_prop_scale_button_new (config, "direction-prescale");
-  gtk_table_attach (table, scalebutton, column, column + 1, row, row + 1,
-                    GTK_SHRINK, GTK_SHRINK, 0, 0);
-  gtk_widget_show (scalebutton);
-}
-
-
-static void
-tilt_options_gui (GimpPaintOptions *paint_options,
-                       GType             tool_type,
-                       GtkTable         *table,
-                       gint              row)
-{
-  GObject   *config = G_OBJECT (paint_options);
-  gint       column = 1;
-  GtkWidget *scalebutton;
-
-  if (tool_has_opacity_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "tilt-opacity",
-                                 table, column++, row);
-    }
-
-  if (tool_has_hardness_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "tilt-hardness",
-                                 table, column++, row);
-    }
-
-  if (tool_has_rate_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "tilt-rate",
-                                 table, column++, row);
-    }
-
-  if (tool_has_size_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "tilt-size",
-                                 table, column++, row);
-    }
-
-if (tool_has_aspect_ratio_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "tilt-aspect-ratio",
-                                 table, column++, row);
-    }
-
-  if (tool_has_angle_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "tilt-angle",
-                                 table, column++, row);
-    }
-
-  if (tool_has_color_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "tilt-color",
-                                 table, column++, row);
-    }
-
-  scalebutton = gimp_prop_scale_button_new (config, "tilt-prescale");
-  gtk_table_attach (table, scalebutton, column, column + 1, row, row + 1,
-                    GTK_SHRINK, GTK_SHRINK, 0, 0);
-  gtk_widget_show (scalebutton);
-}
-
-static void
-random_options_gui (GimpPaintOptions *paint_options,
-                    GType             tool_type,
-                    GtkTable         *table,
-                    gint              row)
-{
-  GObject   *config = G_OBJECT (paint_options);
-  gint       column = 1;
-  GtkWidget *scalebutton;
-
-  if (tool_has_opacity_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "random-opacity",
-                                 table, column++, row);
-    }
-
-  if (tool_has_hardness_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "random-hardness",
-                                 table, column++, row);
-    }
-
-  if (tool_has_rate_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "random-rate",
-                                 table, column++, row);
-    }
-
-  if (tool_has_size_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "random-size",
-                                 table, column++, row);
-    }
-
-  if (tool_has_aspect_ratio_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "random-aspect-ratio",
-                                 table, column++, row);
-    }
-
-  if (tool_has_angle_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "random-angle",
-                                 table, column++, row);
-    }
-
-  if (tool_has_color_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "random-color",
-                                 table, column++, row);
-    }
-
-   scalebutton = gimp_prop_scale_button_new (config, "random-prescale");
-   gtk_table_attach (table, scalebutton, column, column + 1, row, row + 1,
-                    GTK_SHRINK, GTK_SHRINK, 0, 0);
-   gtk_widget_show (scalebutton);
-}
-
-static void
-fading_options_gui (GimpPaintOptions *paint_options,
-                    GType             tool_type,
-                    GtkTable         *table,
-                    gint              row)
-{
-  GObject   *config = G_OBJECT (paint_options);
-  gint       column = 1;
-  GtkWidget *scalebutton;
-
-  if (tool_has_opacity_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "fading-opacity",
-                                 table, column++, row);
-    }
-
-  if (tool_has_hardness_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "fading-hardness",
-                                 table, column++, row);
-    }
-
-  if (tool_has_rate_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "fading-rate",
-                                 table, column++, row);
-    }
-
-  if (tool_has_size_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "fading-size",
-                                 table, column++, row);
-    }
-
-  if (tool_has_aspect_ratio_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "fading-aspect-ratio",
-                                 table, column++, row);
-    }
-
-  if (tool_has_angle_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "fading-angle",
-                                 table, column++, row);
-    }
-
-  if (tool_has_color_dynamics (tool_type))
-    {
-      dynamics_check_button_new (config, "fading-color",
-                                 table, column++, row);
-    }
-
-   scalebutton = gimp_prop_scale_button_new (config, "fading-prescale");
-   gtk_table_attach (table, scalebutton, column, column + 1, row, row + 1,
-                    GTK_SHRINK, GTK_SHRINK, 0, 0);
-   gtk_widget_show (scalebutton);
-}
-
 static GtkWidget *
 fade_options_gui (GimpPaintOptions *paint_options,
                   GType             tool_type)
@@ -879,9 +327,11 @@ fade_options_gui (GimpPaintOptions *paint_options,
   table = gtk_table_new (1, 3, FALSE);
   gtk_table_set_col_spacings (GTK_TABLE (table), 2);
 
-  frame = gimp_prop_expanding_frame_new (config, "use-fade",
-                                         _("Fade out"),
-                                         table, NULL);
+  gtk_widget_show (table);
+
+  frame = gtk_frame_new (_("Fade settings"));
+
+  gtk_container_add(GTK_CONTAINER(frame), table);
 
   /*  the fade-out sizeentry  */
   spinbutton = gimp_prop_spin_button_new (config, "fade-length",
diff --git a/app/widgets/gimpdynamicseditor.c b/app/widgets/gimpdynamicseditor.c
index 67ae7cf..857defd 100644
--- a/app/widgets/gimpdynamicseditor.c
+++ b/app/widgets/gimpdynamicseditor.c
@@ -170,10 +170,6 @@ gimp_dynamics_editor_set_data (GimpDataEditor *editor,
 
   gimp_view_set_viewable (GIMP_VIEW (editor->view), GIMP_VIEWABLE (data));
 
-  if (editor->data && GIMP_IS_DYNAMICS (editor->data))
-    {
-      GimpDynamics *options = GIMP_DYNAMICS (editor->data);
-    }
 }
 
 



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