gimp r27711 - in trunk: . app/actions app/core app/pdb app/tools tools/pdbgen/pdb



Author: mitch
Date: Sat Nov 22 22:07:55 2008
New Revision: 27711
URL: http://svn.gnome.org/viewvc/gimp?rev=27711&view=rev

Log:
2008-11-22  Michael Natterer  <mitch gimp org>

	* app/core/gimpselection.[ch]: make the entire selection
	API take GimpSelection arguments, not GimpChannel.
	Clean up gimp_selection_load() a bit.

	* app/actions/select-commands.c
	* app/core/gimp-edit.c
	* app/core/gimpdrawable-transform.c
	* app/core/gimpimage-quick-mask.c
	* app/tools/gimpeditselectiontool.c
	* tools/pdbgen/pdb/selection.pdb: add the needed casts.

	* app/pdb/selection-cmds.c: regenerated.



Modified:
   trunk/ChangeLog
   trunk/app/actions/select-commands.c
   trunk/app/core/gimp-edit.c
   trunk/app/core/gimpdrawable-transform.c
   trunk/app/core/gimpimage-quick-mask.c
   trunk/app/core/gimpselection.c
   trunk/app/core/gimpselection.h
   trunk/app/pdb/selection-cmds.c
   trunk/app/tools/gimpeditselectiontool.c
   trunk/tools/pdbgen/pdb/selection.pdb

Modified: trunk/app/actions/select-commands.c
==============================================================================
--- trunk/app/actions/select-commands.c	(original)
+++ trunk/app/actions/select-commands.c	Sat Nov 22 22:07:55 2008
@@ -124,7 +124,7 @@
   return_if_no_image (image, data);
   return_if_no_widget (widget, data);
 
-  if (gimp_selection_float (gimp_image_get_mask (image),
+  if (gimp_selection_float (GIMP_SELECTION (gimp_image_get_mask (image)),
                             gimp_image_get_active_drawable (image),
                             action_data_get_context (data),
                             TRUE, 0, 0, &error))
@@ -305,7 +305,7 @@
   return_if_no_image (image, data);
   return_if_no_widget (widget, data);
 
-  gimp_selection_save (gimp_image_get_mask (image));
+  gimp_selection_save (GIMP_SELECTION (gimp_image_get_mask (image)));
   gimp_image_flush (image);
 
   gimp_dialog_factory_dialog_raise (global_dock_factory,

Modified: trunk/app/core/gimp-edit.c
==============================================================================
--- trunk/app/core/gimp-edit.c	(original)
+++ trunk/app/core/gimp-edit.c	Sat Nov 22 22:07:55 2008
@@ -556,8 +556,9 @@
     gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_CUT, _("Cut"));
 
   /*  Cut/copy the mask portion from the image  */
-  tiles = gimp_selection_extract (gimp_image_get_mask (image), pickable,
-                                  context, cut_pixels, FALSE, FALSE, error);
+  tiles = gimp_selection_extract (GIMP_SELECTION (gimp_image_get_mask (image)),
+                                  pickable, context,
+                                  cut_pixels, FALSE, FALSE, error);
 
   if (cut_pixels)
     gimp_image_undo_group_end (image);

Modified: trunk/app/core/gimpdrawable-transform.c
==============================================================================
--- trunk/app/core/gimpdrawable-transform.c	(original)
+++ trunk/app/core/gimpdrawable-transform.c	Sat Nov 22 22:07:55 2008
@@ -790,7 +790,7 @@
        */
       if (gimp_drawable_mask_intersect (drawable, &x, &y, &w, &h))
         {
-          tiles = gimp_selection_extract (gimp_image_get_mask (image),
+          tiles = gimp_selection_extract (GIMP_SELECTION (gimp_image_get_mask (image)),
                                           GIMP_PICKABLE (drawable),
                                           context,
                                           TRUE, FALSE, TRUE,
@@ -808,7 +808,7 @@
     }
   else  /*  otherwise, just copy the layer  */
     {
-      tiles = gimp_selection_extract (gimp_image_get_mask (image),
+      tiles = gimp_selection_extract (GIMP_SELECTION (gimp_image_get_mask (image)),
                                       GIMP_PICKABLE (drawable),
                                       context,
                                       FALSE, TRUE, GIMP_IS_LAYER (drawable),

Modified: trunk/app/core/gimpimage-quick-mask.c
==============================================================================
--- trunk/app/core/gimpimage-quick-mask.c	(original)
+++ trunk/app/core/gimpimage-quick-mask.c	Sat Nov 22 22:07:55 2008
@@ -137,7 +137,8 @@
           if (floating_sel && floating_sel->fs.drawable == GIMP_DRAWABLE (mask))
             floating_sel_anchor (floating_sel);
 
-          gimp_selection_load (gimp_image_get_mask (image), mask);
+          gimp_selection_load (GIMP_SELECTION (gimp_image_get_mask (image)),
+                               mask);
           gimp_image_remove_channel (image, mask, TRUE, NULL);
 
           if (! channel_was_active)

Modified: trunk/app/core/gimpselection.c
==============================================================================
--- trunk/app/core/gimpselection.c	(original)
+++ trunk/app/core/gimpselection.c	Sat Nov 22 22:07:55 2008
@@ -553,50 +553,45 @@
 }
 
 void
-gimp_selection_load (GimpChannel *selection,
-                     GimpChannel *channel)
+gimp_selection_load (GimpSelection *selection,
+                     GimpChannel   *channel)
 {
-  GimpItem    *src_item;
-  GimpItem    *dest_item;
-  PixelRegion  srcPR;
-  PixelRegion  destPR;
+  PixelRegion srcPR;
+  PixelRegion destPR;
+  gint        width;
+  gint        height;
 
   g_return_if_fail (GIMP_IS_SELECTION (selection));
   g_return_if_fail (GIMP_IS_CHANNEL (channel));
 
-  src_item  = GIMP_ITEM (channel);
-  dest_item = GIMP_ITEM (selection);
+  width  = gimp_item_get_width  (GIMP_ITEM (selection));
+  height = gimp_item_get_height (GIMP_ITEM (selection));
 
-  g_return_if_fail (gimp_item_get_width  (src_item) == gimp_item_get_width  (dest_item));
-  g_return_if_fail (gimp_item_get_height (src_item) == gimp_item_get_height (dest_item));
+  g_return_if_fail (width  == gimp_item_get_width  (GIMP_ITEM (channel)));
+  g_return_if_fail (height == gimp_item_get_height (GIMP_ITEM (channel)));
 
-  gimp_channel_push_undo (selection, _("Channel to Selection"));
+  gimp_channel_push_undo (GIMP_CHANNEL (selection),
+                          _("Channel to Selection"));
 
   /*  copy the channel to the mask  */
   pixel_region_init (&srcPR,
                      gimp_drawable_get_tiles (GIMP_DRAWABLE (channel)),
-                     0, 0,
-                     gimp_item_get_width  (src_item),
-                     gimp_item_get_height (src_item),
+                     0, 0, width, height,
                      FALSE);
   pixel_region_init (&destPR,
                      gimp_drawable_get_tiles (GIMP_DRAWABLE (selection)),
-                     0, 0,
-                     gimp_item_get_width  (dest_item),
-                     gimp_item_get_height (dest_item),
+                     0, 0, width, height,
                      TRUE);
   copy_region (&srcPR, &destPR);
 
-  selection->bounds_known = FALSE;
+  GIMP_CHANNEL (selection)->bounds_known = FALSE;
 
   gimp_drawable_update (GIMP_DRAWABLE (selection),
-                        0, 0,
-                        gimp_item_get_width  (dest_item),
-                        gimp_item_get_height (dest_item));
+                        0, 0, width, height);
 }
 
 GimpChannel *
-gimp_selection_save (GimpChannel *selection)
+gimp_selection_save (GimpSelection *selection)
 {
   GimpImage   *image;
   GimpChannel *new_channel;
@@ -617,13 +612,13 @@
 }
 
 TileManager *
-gimp_selection_extract (GimpChannel  *selection,
-                        GimpPickable *pickable,
-                        GimpContext  *context,
-                        gboolean      cut_image,
-                        gboolean      keep_indexed,
-                        gboolean      add_alpha,
-                        GError      **error)
+gimp_selection_extract (GimpSelection *selection,
+                        GimpPickable  *pickable,
+                        GimpContext   *context,
+                        gboolean       cut_image,
+                        gboolean       keep_indexed,
+                        gboolean       add_alpha,
+                        GError       **error)
 {
   GimpImage         *image;
   TileManager       *tiles;
@@ -807,7 +802,7 @@
 }
 
 GimpLayer *
-gimp_selection_float (GimpChannel   *selection,
+gimp_selection_float (GimpSelection *selection,
                       GimpDrawable  *drawable,
                       GimpContext   *context,
                       gboolean       cut_image,
@@ -848,7 +843,7 @@
                                   cut_image, FALSE, TRUE, NULL);
 
   /*  Clear the selection  */
-  gimp_channel_clear (selection, NULL, TRUE);
+  gimp_channel_clear (GIMP_CHANNEL (selection), NULL, TRUE);
 
   /* Create a new layer from the buffer, using the drawable's type
    *  because it may be different from the image's type if we cut from
@@ -875,7 +870,7 @@
   gimp_image_undo_group_end (image);
 
   /*  invalidate the image's boundary variables  */
-  selection->boundary_known = FALSE;
+  GIMP_CHANNEL (selection)->boundary_known = FALSE;
 
   return layer;
 }

Modified: trunk/app/core/gimpselection.h
==============================================================================
--- trunk/app/core/gimpselection.h	(original)
+++ trunk/app/core/gimpselection.h	Sat Nov 22 22:07:55 2008
@@ -55,11 +55,11 @@
 gint          gimp_selection_push_stroking (GimpSelection *selection);
 gint          gimp_selection_pop_stroking  (GimpSelection *selection);
 
-void          gimp_selection_load          (GimpChannel   *selection,
+void          gimp_selection_load          (GimpSelection *selection,
                                             GimpChannel   *channel);
-GimpChannel * gimp_selection_save          (GimpChannel   *selection);
+GimpChannel * gimp_selection_save          (GimpSelection *selection);
 
-TileManager * gimp_selection_extract       (GimpChannel   *selection,
+TileManager * gimp_selection_extract       (GimpSelection *selection,
                                             GimpPickable  *pickable,
                                             GimpContext   *context,
                                             gboolean       cut_image,
@@ -67,7 +67,7 @@
                                             gboolean       add_alpha,
                                             GError       **error);
 
-GimpLayer   * gimp_selection_float         (GimpChannel   *selection,
+GimpLayer   * gimp_selection_float         (GimpSelection *selection,
                                             GimpDrawable  *drawable,
                                             GimpContext   *context,
                                             gboolean       cut_image,

Modified: trunk/app/pdb/selection-cmds.c
==============================================================================
--- trunk/app/pdb/selection-cmds.c	(original)
+++ trunk/app/pdb/selection-cmds.c	Sat Nov 22 22:07:55 2008
@@ -195,7 +195,7 @@
         {
           GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
 
-          layer = gimp_selection_float (gimp_image_get_mask (image),
+          layer = gimp_selection_float (GIMP_SELECTION (gimp_image_get_mask (image)),
                                         drawable, context, TRUE, offx, offy,
                                         error);
           if (! layer)
@@ -479,7 +479,7 @@
 
   if (success)
     {
-      channel = gimp_selection_save (gimp_image_get_mask (image));
+      channel = gimp_selection_save (GIMP_SELECTION (gimp_image_get_mask (image)));
 
       if (! channel)
         success = FALSE;

Modified: trunk/app/tools/gimpeditselectiontool.c
==============================================================================
--- trunk/app/tools/gimpeditselectiontool.c	(original)
+++ trunk/app/tools/gimpeditselectiontool.c	Sat Nov 22 22:07:55 2008
@@ -681,7 +681,7 @@
 
         case GIMP_TRANSLATE_MODE_MASK_TO_LAYER:
         case GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER:
-          if (! gimp_selection_float (gimp_image_get_mask (display->image),
+          if (! gimp_selection_float (GIMP_SELECTION (gimp_image_get_mask (display->image)),
                                       GIMP_DRAWABLE (active_item),
                                       gimp_get_user_context (display->image->gimp),
                                       edit_select->edit_mode ==

Modified: trunk/tools/pdbgen/pdb/selection.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/selection.pdb	(original)
+++ trunk/tools/pdbgen/pdb/selection.pdb	Sat Nov 22 22:07:55 2008
@@ -188,7 +188,7 @@
     {
       GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
 
-      layer = gimp_selection_float (gimp_image_get_mask (image),
+      layer = gimp_selection_float (GIMP_SELECTION (gimp_image_get_mask (image)),
                                     drawable, context, TRUE, offx, offy,
                                     error);
       if (! layer)
@@ -539,7 +539,7 @@
         headers => [qw("core/gimpselection.h") ],
 	code    => <<'CODE'
 {
-  channel = gimp_selection_save (gimp_image_get_mask (image));
+  channel = gimp_selection_save (GIMP_SELECTION (gimp_image_get_mask (image)));
 
   if (! channel)
     success = FALSE;



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