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



Author: neo
Date: Tue Sep 16 20:56:41 2008
New Revision: 26953
URL: http://svn.gnome.org/viewvc/gimp?rev=26953&view=rev

Log:
2008-09-16  Sven Neumann  <sven gimp org>

	* app/core/gimpimage.[ch]: added GError parameter to
	gimp_image_{raise,lower}_{channel,layer,vectors} functions and
	removed calls to g_message().

	* app/actions/channels-commands.c
	* app/actions/layers-commands.c
	* app/actions/vectors-commands.c: pass NULL for the GError
	parameter as these actions are insensitive if they would fail.

	* tools/pdbgen/pdb/image.pdb: changed accordingly. Corrected the
	documentation.

	* app/pdb/image-cmds.c
	* libgimp/gimpimage_pdb.c: regenerated.



Modified:
   trunk/ChangeLog
   trunk/app/actions/channels-commands.c
   trunk/app/actions/layers-commands.c
   trunk/app/actions/vectors-commands.c
   trunk/app/core/gimpimage.c
   trunk/app/core/gimpimage.h
   trunk/app/pdb/image-cmds.c
   trunk/libgimp/gimpimage_pdb.c
   trunk/tools/pdbgen/pdb/image.pdb

Modified: trunk/app/actions/channels-commands.c
==============================================================================
--- trunk/app/actions/channels-commands.c	(original)
+++ trunk/app/actions/channels-commands.c	Tue Sep 16 20:56:41 2008
@@ -181,7 +181,7 @@
   GimpChannel *channel;
   return_if_no_channel (image, channel, data);
 
-  gimp_image_raise_channel (image, channel);
+  gimp_image_raise_channel (image, channel, NULL);
   gimp_image_flush (image);
 }
 
@@ -205,7 +205,7 @@
   GimpChannel *channel;
   return_if_no_channel (image, channel, data);
 
-  gimp_image_lower_channel (image, channel);
+  gimp_image_lower_channel (image, channel, NULL);
   gimp_image_flush (image);
 }
 

Modified: trunk/app/actions/layers-commands.c
==============================================================================
--- trunk/app/actions/layers-commands.c	(original)
+++ trunk/app/actions/layers-commands.c	Tue Sep 16 20:56:41 2008
@@ -387,7 +387,7 @@
   GimpLayer *layer;
   return_if_no_layer (image, layer, data);
 
-  gimp_image_raise_layer (image, layer);
+  gimp_image_raise_layer (image, layer, NULL);
   gimp_image_flush (image);
 }
 
@@ -411,7 +411,7 @@
   GimpLayer *layer;
   return_if_no_layer (image, layer, data);
 
-  gimp_image_lower_layer (image, layer);
+  gimp_image_lower_layer (image, layer, NULL);
   gimp_image_flush (image);
 }
 

Modified: trunk/app/actions/vectors-commands.c
==============================================================================
--- trunk/app/actions/vectors-commands.c	(original)
+++ trunk/app/actions/vectors-commands.c	Tue Sep 16 20:56:41 2008
@@ -200,7 +200,7 @@
   GimpVectors *vectors;
   return_if_no_vectors (image, vectors, data);
 
-  gimp_image_raise_vectors (image, vectors);
+  gimp_image_raise_vectors (image, vectors, NULL);
   gimp_image_flush (image);
 }
 
@@ -224,7 +224,7 @@
   GimpVectors *vectors;
   return_if_no_vectors (image, vectors, data);
 
-  gimp_image_lower_vectors (image, vectors);
+  gimp_image_lower_vectors (image, vectors, NULL);
   gimp_image_flush (image);
 }
 

Modified: trunk/app/core/gimpimage.c
==============================================================================
--- trunk/app/core/gimpimage.c	(original)
+++ trunk/app/core/gimpimage.c	Tue Sep 16 20:56:41 2008
@@ -3096,20 +3096,22 @@
 }
 
 gboolean
-gimp_image_raise_layer (GimpImage *image,
-                        GimpLayer *layer)
+gimp_image_raise_layer (GimpImage  *image,
+                        GimpLayer  *layer,
+                        GError    **error)
 {
   gint index;
 
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
   g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
   index = gimp_container_get_child_index (image->layers,
                                           GIMP_OBJECT (layer));
 
   if (index == 0)
     {
-      g_message (_("Layer cannot be raised higher."));
+      g_set_error (error, 0, 0, "%s", _("Layer cannot be raised higher."));
       return FALSE;
     }
 
@@ -3118,20 +3120,22 @@
 }
 
 gboolean
-gimp_image_lower_layer (GimpImage *image,
-                        GimpLayer *layer)
+gimp_image_lower_layer (GimpImage  *image,
+                        GimpLayer  *layer,
+                        GError    **error)
 {
   gint index;
 
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
   g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
   index = gimp_container_get_child_index (image->layers,
                                           GIMP_OBJECT (layer));
 
   if (index == gimp_container_num_children (image->layers) - 1)
     {
-      g_message (_("Layer cannot be lowered more."));
+      g_set_error (error, 0, 0, "%s", _("Layer cannot be lowered more."));
       return FALSE;
     }
 
@@ -3324,20 +3328,22 @@
 }
 
 gboolean
-gimp_image_raise_channel (GimpImage   *image,
-                          GimpChannel *channel)
+gimp_image_raise_channel (GimpImage    *image,
+                          GimpChannel  *channel,
+                          GError      **error)
 {
   gint index;
 
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
   g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
   index = gimp_container_get_child_index (image->channels,
                                           GIMP_OBJECT (channel));
 
   if (index == 0)
     {
-      g_message (_("Channel cannot be raised higher."));
+      g_set_error (error, 0, 0, "%s", _("Channel cannot be raised higher."));
       return FALSE;
     }
 
@@ -3349,39 +3355,31 @@
 gimp_image_raise_channel_to_top (GimpImage   *image,
                                  GimpChannel *channel)
 {
-  gint index;
-
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
   g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
 
-  index = gimp_container_get_child_index (image->channels,
-                                          GIMP_OBJECT (channel));
-
-  if (index == 0)
-    {
-      g_message (_("Channel is already on top."));
-      return FALSE;
-    }
-
   return gimp_image_position_channel (image, channel, 0,
                                       TRUE, _("Raise Channel to Top"));
 }
 
+
 gboolean
-gimp_image_lower_channel (GimpImage   *image,
-                          GimpChannel *channel)
+gimp_image_lower_channel (GimpImage    *image,
+                          GimpChannel  *channel,
+                          GError      **error)
 {
   gint index;
 
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
   g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
   index = gimp_container_get_child_index (image->channels,
                                           GIMP_OBJECT (channel));
 
   if (index == gimp_container_num_children (image->channels) - 1)
     {
-      g_message (_("Channel cannot be lowered more."));
+      g_set_error (error, 0, 0, "%s", _("Channel cannot be lowered more."));
       return FALSE;
     }
 
@@ -3393,23 +3391,13 @@
 gimp_image_lower_channel_to_bottom (GimpImage   *image,
                                     GimpChannel *channel)
 {
-  gint index;
   gint length;
 
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
   g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
 
-  index = gimp_container_get_child_index (image->channels,
-                                          GIMP_OBJECT (channel));
-
   length = gimp_container_num_children (image->channels);
 
-  if (index == length - 1)
-    {
-      g_message (_("Channel is already on the bottom."));
-      return FALSE;
-    }
-
   return gimp_image_position_channel (image, channel, length - 1,
                                       TRUE, _("Lower Channel to Bottom"));
 }
@@ -3562,20 +3550,22 @@
 }
 
 gboolean
-gimp_image_raise_vectors (GimpImage   *image,
-                          GimpVectors *vectors)
+gimp_image_raise_vectors (GimpImage    *image,
+                          GimpVectors  *vectors,
+                          GError      **error)
 {
   gint index;
 
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
   g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
   index = gimp_container_get_child_index (image->vectors,
                                           GIMP_OBJECT (vectors));
 
   if (index == 0)
     {
-      g_message (_("Path cannot be raised higher."));
+      g_set_error (error, 0, 0, "%s", _("Path cannot be raised higher."));
       return FALSE;
     }
 
@@ -3587,39 +3577,30 @@
 gimp_image_raise_vectors_to_top (GimpImage   *image,
                                  GimpVectors *vectors)
 {
-  gint index;
-
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
   g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
 
-  index = gimp_container_get_child_index (image->vectors,
-                                          GIMP_OBJECT (vectors));
-
-  if (index == 0)
-    {
-      g_message (_("Path is already on top."));
-      return FALSE;
-    }
-
   return gimp_image_position_vectors (image, vectors, 0,
                                       TRUE, _("Raise Path to Top"));
 }
 
 gboolean
-gimp_image_lower_vectors (GimpImage   *image,
-                          GimpVectors *vectors)
+gimp_image_lower_vectors (GimpImage    *image,
+                          GimpVectors  *vectors,
+                          GError      **error)
 {
   gint index;
 
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
   g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
   index = gimp_container_get_child_index (image->vectors,
                                           GIMP_OBJECT (vectors));
 
   if (index == gimp_container_num_children (image->vectors) - 1)
     {
-      g_message (_("Path cannot be lowered more."));
+      g_set_error (error, 0, 0, "%s", _("Path cannot be lowered more."));
       return FALSE;
     }
 
@@ -3631,23 +3612,13 @@
 gimp_image_lower_vectors_to_bottom (GimpImage   *image,
                                     GimpVectors *vectors)
 {
-  gint index;
   gint length;
 
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
   g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
 
-  index = gimp_container_get_child_index (image->vectors,
-                                          GIMP_OBJECT (vectors));
-
   length = gimp_container_num_children (image->vectors);
 
-  if (index == length - 1)
-    {
-      g_message (_("Path is already on the bottom."));
-      return FALSE;
-    }
-
   return gimp_image_position_vectors (image, vectors, length - 1,
                                       TRUE, _("Lower Path to Bottom"));
 }

Modified: trunk/app/core/gimpimage.h
==============================================================================
--- trunk/app/core/gimpimage.h	(original)
+++ trunk/app/core/gimpimage.h	Tue Sep 16 20:56:41 2008
@@ -472,9 +472,11 @@
                                                   const gchar        *undo_desc);
 
 gboolean        gimp_image_raise_layer           (GimpImage          *image,
-                                                  GimpLayer          *layer);
+                                                  GimpLayer          *layer,
+                                                  GError            **error);
 gboolean        gimp_image_lower_layer           (GimpImage          *image,
-                                                  GimpLayer          *layer);
+                                                  GimpLayer          *layer,
+                                                  GError            **error);
 gboolean        gimp_image_raise_layer_to_top    (GimpImage          *image,
                                                   GimpLayer          *layer);
 gboolean        gimp_image_lower_layer_to_bottom (GimpImage          *image,
@@ -492,11 +494,13 @@
                                                   GimpChannel        *channel);
 
 gboolean        gimp_image_raise_channel         (GimpImage          *image,
-                                                  GimpChannel        *channel);
+                                                  GimpChannel        *channel,
+                                                  GError            **error);
 gboolean        gimp_image_raise_channel_to_top  (GimpImage          *image,
                                                   GimpChannel        *channel);
 gboolean        gimp_image_lower_channel         (GimpImage          *image,
-                                                  GimpChannel        *channel);
+                                                  GimpChannel        *channel,
+                                                  GError            **error);
 gboolean      gimp_image_lower_channel_to_bottom (GimpImage          *image,
                                                   GimpChannel        *channel);
 gboolean        gimp_image_position_channel      (GimpImage          *image,
@@ -512,11 +516,13 @@
                                                   GimpVectors        *vectors);
 
 gboolean        gimp_image_raise_vectors         (GimpImage          *image,
-                                                  GimpVectors        *vectors);
+                                                  GimpVectors        *vectors,
+                                                  GError            **error);
 gboolean        gimp_image_raise_vectors_to_top  (GimpImage          *image,
                                                   GimpVectors        *vectors);
 gboolean        gimp_image_lower_vectors         (GimpImage          *image,
-                                                  GimpVectors        *vectors);
+                                                  GimpVectors        *vectors,
+                                                  GError            **error);
 gboolean      gimp_image_lower_vectors_to_bottom (GimpImage          *image,
                                                   GimpVectors        *vectors);
 gboolean        gimp_image_position_vectors      (GimpImage          *image,

Modified: trunk/app/pdb/image-cmds.c
==============================================================================
--- trunk/app/pdb/image-cmds.c	(original)
+++ trunk/app/pdb/image-cmds.c	Tue Sep 16 20:56:41 2008
@@ -958,7 +958,7 @@
 
   if (success)
     {
-      success = gimp_image_raise_layer (image, layer);
+      success = gimp_image_raise_layer (image, layer, error);
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -982,7 +982,7 @@
 
   if (success)
     {
-      success = gimp_image_lower_layer (image, layer);
+      success = gimp_image_lower_layer (image, layer, error);
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -1148,7 +1148,7 @@
 
   if (success)
     {
-      success = gimp_image_raise_channel (image, channel);
+      success = gimp_image_raise_channel (image, channel, error);
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -1172,7 +1172,7 @@
 
   if (success)
     {
-      success = gimp_image_lower_channel (image, channel);
+      success = gimp_image_lower_channel (image, channel, error);
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -1290,7 +1290,7 @@
 
   if (success)
     {
-      success = gimp_image_raise_vectors (image, vectors);
+      success = gimp_image_raise_vectors (image, vectors, error);
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -1314,7 +1314,7 @@
 
   if (success)
     {
-      success = gimp_image_lower_vectors (image, vectors);
+      success = gimp_image_lower_vectors (image, vectors, error);
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -3339,7 +3339,7 @@
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-raise-layer",
                                      "Raise the specified layer in the image's layer stack",
-                                     "This procedure raises the specified layer one step in the existing layer stack. It will not move the layer if there is no layer above it.",
+                                     "This procedure raises the specified layer one step in the existing layer stack. The procecure call will fail if there is no layer above it.",
                                      "Spencer Kimball & Peter Mattis",
                                      "Spencer Kimball & Peter Mattis",
                                      "1995-1996",
@@ -3368,7 +3368,7 @@
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-lower-layer",
                                      "Lower the specified layer in the image's layer stack",
-                                     "This procedure lowers the specified layer one step in the existing layer stack. It will not move the layer if there is no layer below it.",
+                                     "This procedure lowers the specified layer one step in the existing layer stack. The procecure call will fail if there is no layer below it.",
                                      "Spencer Kimball & Peter Mattis",
                                      "Spencer Kimball & Peter Mattis",
                                      "1995-1996",
@@ -3554,7 +3554,7 @@
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-raise-channel",
                                      "Raise the specified channel in the image's channel stack",
-                                     "This procedure raises the specified channel one step in the existing channel stack. It will not move the channel if there is no channel above it.",
+                                     "This procedure raises the specified channel one step in the existing channel stack. The procecure call will fail if there is no channel above it.",
                                      "Spencer Kimball & Peter Mattis",
                                      "Spencer Kimball & Peter Mattis",
                                      "1995-1996",
@@ -3583,7 +3583,7 @@
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-lower-channel",
                                      "Lower the specified channel in the image's channel stack",
-                                     "This procedure lowers the specified channel one step in the existing channel stack. It will not move the channel if there is no channel below it.",
+                                     "This procedure lowers the specified channel one step in the existing channel stack. The procecure call will fail if there is no channel below it.",
                                      "Spencer Kimball & Peter Mattis",
                                      "Spencer Kimball & Peter Mattis",
                                      "1995-1996",
@@ -3711,7 +3711,7 @@
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-raise-vectors",
                                      "Raise the specified vectors in the image's vectors stack",
-                                     "This procedure raises the specified vectors one step in the existing vectors stack. It will not move the vectors if there is no vectors above it.",
+                                     "This procedure raises the specified vectors one step in the existing vectors stack. The procecure call will fail if there is no vectors above it.",
                                      "Simon Budig",
                                      "Simon Budig",
                                      "2005",
@@ -3740,7 +3740,7 @@
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-lower-vectors",
                                      "Lower the specified vectors in the image's vectors stack",
-                                     "This procedure lowers the specified vectors one step in the existing vectors stack. It will not move the vectors if there is no vectors below it.",
+                                     "This procedure lowers the specified vectors one step in the existing vectors stack. The procecure call will fail if there is no vectors below it.",
                                      "Simon Budig",
                                      "Simon Budig",
                                      "2005",

Modified: trunk/libgimp/gimpimage_pdb.c
==============================================================================
--- trunk/libgimp/gimpimage_pdb.c	(original)
+++ trunk/libgimp/gimpimage_pdb.c	Tue Sep 16 20:56:41 2008
@@ -1038,7 +1038,7 @@
  * Raise the specified layer in the image's layer stack
  *
  * This procedure raises the specified layer one step in the existing
- * layer stack. It will not move the layer if there is no layer above
+ * layer stack. The procecure call will fail if there is no layer above
  * it.
  *
  * Returns: TRUE on success.
@@ -1072,7 +1072,7 @@
  * Lower the specified layer in the image's layer stack
  *
  * This procedure lowers the specified layer one step in the existing
- * layer stack. It will not move the layer if there is no layer below
+ * layer stack. The procecure call will fail if there is no layer below
  * it.
  *
  * Returns: TRUE on success.
@@ -1282,7 +1282,7 @@
  * Raise the specified channel in the image's channel stack
  *
  * This procedure raises the specified channel one step in the existing
- * channel stack. It will not move the channel if there is no channel
+ * channel stack. The procecure call will fail if there is no channel
  * above it.
  *
  * Returns: TRUE on success.
@@ -1316,7 +1316,7 @@
  * Lower the specified channel in the image's channel stack
  *
  * This procedure lowers the specified channel one step in the existing
- * channel stack. It will not move the channel if there is no channel
+ * channel stack. The procecure call will fail if there is no channel
  * below it.
  *
  * Returns: TRUE on success.
@@ -1460,7 +1460,7 @@
  * Raise the specified vectors in the image's vectors stack
  *
  * This procedure raises the specified vectors one step in the existing
- * vectors stack. It will not move the vectors if there is no vectors
+ * vectors stack. The procecure call will fail if there is no vectors
  * above it.
  *
  * Returns: TRUE on success.
@@ -1496,7 +1496,7 @@
  * Lower the specified vectors in the image's vectors stack
  *
  * This procedure lowers the specified vectors one step in the existing
- * vectors stack. It will not move the vectors if there is no vectors
+ * vectors stack. The procecure call will fail if there is no vectors
  * below it.
  *
  * Returns: TRUE on success.

Modified: trunk/tools/pdbgen/pdb/image.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/image.pdb	(original)
+++ trunk/tools/pdbgen/pdb/image.pdb	Tue Sep 16 20:56:41 2008
@@ -709,7 +709,7 @@
 
     $help = <<'HELP';
 This procedure raises the specified layer one step in the existing layer stack.
-It will not move the layer if there is no layer above it.
+The procecure call will fail if there is no layer above it.
 HELP
 
     &std_pdb_misc;
@@ -724,7 +724,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_raise_layer (image, layer);
+  success = gimp_image_raise_layer (image, layer, error);
 }
 CODE
     );
@@ -735,7 +735,7 @@
 
     $help = <<'HELP';
 This procedure lowers the specified layer one step in the existing layer stack.
-It will not move the layer if there is no layer below it.
+The procecure call will fail if there is no layer below it.
 HELP
 
     &std_pdb_misc;
@@ -750,7 +750,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_lower_layer (image, layer);
+  success = gimp_image_lower_layer (image, layer, error);
 }
 CODE
     );
@@ -1089,7 +1089,7 @@
 
     $help = <<'HELP';
 This procedure raises the specified channel one step in the existing
-channel stack. It will not move the channel if there is no channel
+channel stack. The procecure call will fail if there is no channel
 above it.
 HELP
 
@@ -1105,7 +1105,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_raise_channel (image, channel);
+  success = gimp_image_raise_channel (image, channel, error);
 }
 CODE
     );
@@ -1116,7 +1116,7 @@
 
     $help = <<'HELP';
 This procedure lowers the specified channel one step in the existing
-channel stack. It will not move the channel if there is no channel
+channel stack. The procecure call will fail if there is no channel
 below it.
 HELP
 
@@ -1132,7 +1132,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_lower_channel (image, channel);
+  success = gimp_image_lower_channel (image, channel, error);
 }
 CODE
     );
@@ -1307,7 +1307,7 @@
 
     $help = <<'HELP';
 This procedure raises the specified vectors one step in the existing
-vectors stack. It will not move the vectors if there is no vectors
+vectors stack. The procecure call will fail if there is no vectors
 above it.
 HELP
 
@@ -1323,7 +1323,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_raise_vectors (image, vectors);
+  success = gimp_image_raise_vectors (image, vectors, error);
 }
 CODE
     );
@@ -1334,7 +1334,7 @@
 
     $help = <<'HELP';
 This procedure lowers the specified vectors one step in the existing
-vectors stack. It will not move the vectors if there is no vectors
+vectors stack. The procecure call will fail if there is no vectors
 below it.
 HELP
 
@@ -1350,7 +1350,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_lower_vectors (image, vectors);
+  success = gimp_image_lower_vectors (image, vectors, error);
 }
 CODE
     );



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