[gimp/soc-2011-warp: 34/72] gimpwarptool: add basic UI to choose the behavior



commit f2eb759bcfbcbf86f29b5bad378ebbed668c0096
Author: Michael Murà <batolettre gmail com>
Date:   Tue Jun 21 12:23:37 2011 +0200

    gimpwarptool: add basic UI to choose the behavior

 app/tools/gimpwarpoptions.c |   21 ++++++++++++++++++++-
 app/tools/gimpwarpoptions.h |    1 +
 app/tools/gimpwarptool.c    |    1 +
 3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/app/tools/gimpwarpoptions.c b/app/tools/gimpwarpoptions.c
index 4f31667..0e2360c 100644
--- a/app/tools/gimpwarpoptions.c
+++ b/app/tools/gimpwarpoptions.c
@@ -40,7 +40,8 @@ enum
 {
   PROP_0,
   PROP_EFFECT_STRENGTH,
-  PROP_EFFECT_SIZE
+  PROP_EFFECT_SIZE,
+  PROP_BEHAVIOR
 };
 
 
@@ -77,6 +78,13 @@ gimp_warp_options_class_init (GimpWarpOptionsClass *klass)
                                    "effect-size", _("Effect Size"),
                                    1.0, 10000.0, 40.0,
                                    GIMP_PARAM_STATIC_STRINGS);
+
+  GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_BEHAVIOR,
+                                 "behavior",
+                                 N_("Behavior"),
+                                 GIMP_TYPE_WARP_BEHAVIOR,
+                                 GIMP_WARP_BEHAVIOR_MOVE,
+                                 GIMP_PARAM_STATIC_STRINGS);
 }
 
 static void
@@ -100,6 +108,9 @@ gimp_warp_options_set_property (GObject      *object,
     case PROP_EFFECT_SIZE:
       options->effect_size = g_value_get_double (value);
       break;
+    case PROP_BEHAVIOR:
+      options->behavior = g_value_get_enum (value);
+      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -123,6 +134,9 @@ gimp_warp_options_get_property (GObject    *object,
     case PROP_EFFECT_SIZE:
       g_value_set_double (value, options->effect_size);
       break;
+    case PROP_BEHAVIOR:
+      g_value_set_enum (value, options->behavior);
+      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -135,9 +149,14 @@ gimp_warp_options_gui (GimpToolOptions *tool_options)
 {
   GObject   *config = G_OBJECT (tool_options);
   GtkWidget *vbox   = gimp_tool_options_gui (tool_options);
+  GtkWidget *behavior;
   GtkWidget *strength;
   GtkWidget *size;
 
+  behavior = gimp_prop_enum_combo_box_new (config, "behavior", 0, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), behavior, FALSE, FALSE, 0);
+  gtk_widget_show (behavior);
+
   strength = gimp_prop_spin_scale_new (config, "effect-strength",
                                         _("Strength"),
                                         0.01, 1.0, 2);
diff --git a/app/tools/gimpwarpoptions.h b/app/tools/gimpwarpoptions.h
index 43a1959..d5d07a4 100644
--- a/app/tools/gimpwarpoptions.h
+++ b/app/tools/gimpwarpoptions.h
@@ -41,6 +41,7 @@ struct _GimpWarpOptions
 
   gdouble          effect_strength;
   gdouble          effect_size;
+  GimpWarpBehavior behavior;
 };
 
 struct _GimpWarpOptionsClass
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index eddf55b..99a3102 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -574,6 +574,7 @@ gimp_warp_tool_add_op (GimpWarpTool *wt)
 
   new_op = gegl_node_new_child (wt->graph,
                                 "operation", "gimp:warp",
+                                "behavior", options->behavior,
                                 "strength", options->effect_strength,
                                 "size", options->effect_size,
                                 "stroke", wt->current_stroke,



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