gimp r24810 - in trunk: . app/core app/tools



Author: mitch
Date: Tue Feb  5 13:54:25 2008
New Revision: 24810
URL: http://svn.gnome.org/viewvc/gimp?rev=24810&view=rev

Log:
2008-02-05  Michael Natterer  <mitch gimp org>

	* app/core/gimpimagemap.c (gimp_image_map_apply): do the right
	thing for operations without "input" pad so we can use all source
	operations too.

	* app/tools/gimpimagemaptool.[ch]: make
	gimp_image_map_tool_create_map() public for the time being.

	* app/tools/gimpgegltool.c (gimp_gegl_tool_operation_changed):
	recreate the GimpImageMap so we can switch from filter to source
	operations and back.



Modified:
   trunk/ChangeLog
   trunk/app/core/gimpimagemap.c
   trunk/app/tools/gimpgegltool.c
   trunk/app/tools/gimpimagemaptool.c
   trunk/app/tools/gimpimagemaptool.h

Modified: trunk/app/core/gimpimagemap.c
==============================================================================
--- trunk/app/core/gimpimagemap.c	(original)
+++ trunk/app/core/gimpimagemap.c	Tue Feb  5 13:54:25 2008
@@ -429,15 +429,18 @@
         {
           image_map->gegl = gegl_node_new ();
 
-          image_map->input =
-            gegl_node_new_child (image_map->gegl,
-                                 "operation", "gimp-tilemanager-source",
-                                 NULL);
-
-          image_map->shift =
-            gegl_node_new_child (image_map->gegl,
-                                 "operation", "shift",
-                                 NULL);
+          if (gegl_node_find_property (image_map->operation, "input"))
+            {
+              image_map->input =
+                gegl_node_new_child (image_map->gegl,
+                                     "operation", "gimp-tilemanager-source",
+                                     NULL);
+
+              image_map->shift =
+                gegl_node_new_child (image_map->gegl,
+                                     "operation", "shift",
+                                     NULL);
+            }
 
           gegl_node_add_child (image_map->gegl, image_map->operation);
 
@@ -460,22 +463,34 @@
             g_object_unref (sink_operation);
           }
 
-          gegl_node_link_many (image_map->input,
-                               image_map->shift,
-                               image_map->operation,
-                               image_map->output,
-                               NULL);
+          if (image_map->input)
+            {
+              gegl_node_link_many (image_map->input,
+                                   image_map->shift,
+                                   image_map->operation,
+                                   image_map->output,
+                                   NULL);
+            }
+          else
+            {
+              gegl_node_link_many (image_map->operation,
+                                   image_map->output,
+                                   NULL);
+            }
         }
 
-      gegl_node_set (image_map->input,
-                     "tile-manager", image_map->undo_tiles,
-                     "linear",       TRUE,
-                     NULL);
-
-      gegl_node_set (image_map->shift,
-                     "x", (gdouble) rect.x,
-                     "y", (gdouble) rect.y,
-                     NULL);
+      if (image_map->input)
+        {
+          gegl_node_set (image_map->input,
+                         "tile-manager", image_map->undo_tiles,
+                         "linear",       TRUE,
+                         NULL);
+
+          gegl_node_set (image_map->shift,
+                         "x", (gdouble) rect.x,
+                         "y", (gdouble) rect.y,
+                         NULL);
+        }
 
       gegl_node_set (image_map->output,
                      "tile-manager", gimp_drawable_get_shadow_tiles (image_map->drawable),

Modified: trunk/app/tools/gimpgegltool.c
==============================================================================
--- trunk/app/tools/gimpgegltool.c	(original)
+++ trunk/app/tools/gimpgegltool.c	Tue Feb  5 13:54:25 2008
@@ -605,10 +605,19 @@
   if (! tool->operation)
     return;
 
+  if (GIMP_IMAGE_MAP_TOOL (tool)->image_map)
+    {
+      gimp_image_map_clear (GIMP_IMAGE_MAP_TOOL (tool)->image_map);
+      g_object_unref (GIMP_IMAGE_MAP_TOOL (tool)->image_map);
+      GIMP_IMAGE_MAP_TOOL (tool)->image_map = NULL;
+    }
+
   gegl_node_set (GIMP_IMAGE_MAP_TOOL (tool)->operation,
                  "operation", tool->operation,
                  NULL);
 
+  gimp_image_map_tool_create_map (GIMP_IMAGE_MAP_TOOL (tool));
+
   tool->config = gimp_gegl_tool_get_config (tool);
 
   if (tool->options_table)

Modified: trunk/app/tools/gimpimagemaptool.c
==============================================================================
--- trunk/app/tools/gimpimagemaptool.c	(original)
+++ trunk/app/tools/gimpimagemaptool.c	Tue Feb  5 13:54:25 2008
@@ -90,8 +90,6 @@
 static void      gimp_image_map_tool_dialog      (GimpImageMapTool *im_tool);
 static void      gimp_image_map_tool_reset       (GimpImageMapTool *im_tool);
 
-static void      gimp_image_map_tool_create_map  (GimpImageMapTool *im_tool);
-
 static void      gimp_image_map_tool_flush       (GimpImageMap     *image_map,
                                                   GimpImageMapTool *im_tool);
 
@@ -571,12 +569,16 @@
     }
 }
 
-static void
+void
 gimp_image_map_tool_create_map (GimpImageMapTool *tool)
 {
-  Gimp     *gimp = GIMP_TOOL (tool)->tool_info->gimp;
+  Gimp     *gimp;
   gboolean  use_gegl;
 
+  g_return_if_fail (GIMP_IS_IMAGE_MAP_TOOL (tool));
+
+  gimp = GIMP_TOOL (tool)->tool_info->gimp;
+
   if (tool->image_map)
     {
       gimp_image_map_clear (tool->image_map);

Modified: trunk/app/tools/gimpimagemaptool.h
==============================================================================
--- trunk/app/tools/gimpimagemaptool.h	(original)
+++ trunk/app/tools/gimpimagemaptool.h	Tue Feb  5 13:54:25 2008
@@ -86,9 +86,13 @@
 };
 
 
-GType   gimp_image_map_tool_get_type (void) G_GNUC_CONST;
+GType   gimp_image_map_tool_get_type   (void) G_GNUC_CONST;
+
+void    gimp_image_map_tool_preview    (GimpImageMapTool *image_map_tool);
+
+/* temp hack for the gegl tool */
+void    gimp_image_map_tool_create_map (GimpImageMapTool *image_map_tool);
 
-void    gimp_image_map_tool_preview  (GimpImageMapTool *image_map_tool);
 
 
 #endif  /*  __GIMP_IMAGE_MAP_TOOL_H__  */



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