[gimp] app/pdb: allow some more stuff on indexed by simply removing the restriction



commit 3a46cfbbc6ae6ea6da024a84309e24e51e093299
Author: Michael Natterer <mitch gimp org>
Date:   Mon Apr 23 00:47:32 2012 +0200

    app/pdb: allow some more stuff on indexed by simply removing the restriction

 app/actions/drawable-actions.c  |    8 +++-----
 app/actions/drawable-commands.c |   10 ----------
 app/pdb/color-cmds.c            |   12 +++++-------
 libgimp/gimpcolor_pdb.c         |    8 +++-----
 tools/pdbgen/pdb/color.pdb      |   23 ++++++++++-------------
 5 files changed, 21 insertions(+), 40 deletions(-)
---
diff --git a/app/actions/drawable-actions.c b/app/actions/drawable-actions.c
index 5359f3b..0871c1a 100644
--- a/app/actions/drawable-actions.c
+++ b/app/actions/drawable-actions.c
@@ -173,7 +173,6 @@ drawable_actions_update (GimpActionGroup *group,
   GimpImage    *image;
   GimpDrawable *drawable   = NULL;
   gboolean      is_rgb     = FALSE;
-  gboolean      is_indexed = FALSE;
   gboolean      visible    = FALSE;
   gboolean      linked     = FALSE;
   gboolean      locked     = FALSE;
@@ -191,8 +190,7 @@ drawable_actions_update (GimpActionGroup *group,
         {
           GimpItem *item;
 
-          is_rgb     = gimp_drawable_is_rgb (drawable);
-          is_indexed = gimp_drawable_is_indexed (drawable);
+          is_rgb = gimp_drawable_is_rgb (drawable);
 
           if (GIMP_IS_LAYER_MASK (drawable))
             item = GIMP_ITEM (gimp_layer_mask_get_layer (GIMP_LAYER_MASK (drawable)));
@@ -215,10 +213,10 @@ drawable_actions_update (GimpActionGroup *group,
 #define SET_ACTIVE(action,condition) \
         gimp_action_group_set_action_active (group, action, (condition) != 0)
 
-  SET_SENSITIVE ("drawable-equalize",       writable && !children && !is_indexed);
+  SET_SENSITIVE ("drawable-equalize",       writable && !children);
   SET_SENSITIVE ("drawable-invert",         writable && !children);
   SET_SENSITIVE ("drawable-value-invert",   writable && !children);
-  SET_SENSITIVE ("drawable-levels-stretch", writable && !children &&  is_rgb);
+  SET_SENSITIVE ("drawable-levels-stretch", writable && !children && is_rgb);
   SET_SENSITIVE ("drawable-offset",         writable && !children);
 
   SET_SENSITIVE ("drawable-visible",      drawable);
diff --git a/app/actions/drawable-commands.c b/app/actions/drawable-commands.c
index 45202f4..5ef5b9c 100644
--- a/app/actions/drawable-commands.c
+++ b/app/actions/drawable-commands.c
@@ -51,17 +51,7 @@ drawable_equalize_cmd_callback (GtkAction *action,
 {
   GimpImage    *image;
   GimpDrawable *drawable;
-  GtkWidget    *widget;
   return_if_no_drawable (image, drawable, data);
-  return_if_no_widget (widget, data);
-
-  if (gimp_drawable_is_indexed (drawable))
-    {
-      gimp_message_literal (image->gimp,
-			    G_OBJECT (widget), GIMP_MESSAGE_WARNING,
-			    _("Equalize does not operate on indexed layers."));
-      return;
-    }
 
   gimp_drawable_equalize (drawable, TRUE);
   gimp_image_flush (image);
diff --git a/app/pdb/color-cmds.c b/app/pdb/color-cmds.c
index 336a3ea..3273cf6 100644
--- a/app/pdb/color-cmds.c
+++ b/app/pdb/color-cmds.c
@@ -336,8 +336,7 @@ equalize_invoker (GimpProcedure      *procedure,
   if (success)
     {
       if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
-          ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
-          gimp_drawable_is_indexed (drawable))
+          ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         success = FALSE;
 
       if (success)
@@ -364,8 +363,7 @@ invert_invoker (GimpProcedure      *procedure,
   if (success)
     {
       if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
-          gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
-          ! gimp_drawable_is_indexed (drawable))
+          gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
           gimp_drawable_apply_operation_by_name (drawable, progress,
                                                  _("Invert"),
@@ -783,7 +781,7 @@ register_color_procs (GimpPDB *pdb)
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-levels",
                                      "Modifies intensity levels in the specified drawable.",
-                                     "This tool allows intensity levels in the specified drawable to be remapped according to a set of parameters. The low/high input levels specify an initial mapping from the source intensities. The gamma value determines how intensities between the low and high input intensities are interpolated. A gamma value of 1.0 results in a linear interpolation. Higher gamma values result in more high-level intensities. Lower gamma values result in more low-level intensities. The low/high output levels constrain the final intensity mapping--that is, no final intensity will be lower than the low output level and no final intensity will be higher than the high output level. This tool is only valid on RGB color and grayscale images. It will not operate on indexed drawables.",
+                                     "This tool allows intensity levels in the specified drawable to be remapped according to a set of parameters. The low/high input levels specify an initial mapping from the source intensities. The gamma value determines how intensities between the low and high input intensities are interpolated. A gamma value of 1.0 results in a linear interpolation. Higher gamma values result in more high-level intensities. Lower gamma values result in more low-level intensities. The low/high output levels constrain the final intensity mapping--that is, no final intensity will be lower than the low output level and no final intensity will be higher than the high output level. This tool is only valid on RGB color and grayscale images.",
                                      "Spencer Kimball & Peter Mattis",
                                      "Spencer Kimball & Peter Mattis",
                                      "1995-1996",
@@ -971,7 +969,7 @@ register_color_procs (GimpPDB *pdb)
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-equalize",
                                      "Equalize the contents of the specified drawable.",
-                                     "This procedure equalizes the contents of the specified drawable. Each intensity channel is equalized independently. The equalized intensity is given as inten' = (255 - inten). Indexed color drawables are not valid for this operation. The 'mask_only' option specifies whether to adjust only the area of the image within the selection bounds, or the entire image based on the histogram of the selected area. If there is no selection, the entire image is adjusted based on the histogram for the entire image.",
+                                     "This procedure equalizes the contents of the specified drawable. Each intensity channel is equalized independently. The equalized intensity is given as inten' = (255 - inten). The 'mask_only' option specifies whether to adjust only the area of the image within the selection bounds, or the entire image based on the histogram of the selected area. If there is no selection, the entire image is adjusted based on the histogram for the entire image.",
                                      "Spencer Kimball & Peter Mattis",
                                      "Spencer Kimball & Peter Mattis",
                                      "1995-1996",
@@ -1000,7 +998,7 @@ register_color_procs (GimpPDB *pdb)
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-invert",
                                      "Invert the contents of the specified drawable.",
-                                     "This procedure inverts the contents of the specified drawable. Each intensity channel is inverted independently. The inverted intensity is given as inten' = (255 - inten). Indexed color drawables are not valid for this operation.",
+                                     "This procedure inverts the contents of the specified drawable. Each intensity channel is inverted independently. The inverted intensity is given as inten' = (255 - inten).",
                                      "Spencer Kimball & Peter Mattis",
                                      "Spencer Kimball & Peter Mattis",
                                      "1995-1996",
diff --git a/libgimp/gimpcolor_pdb.c b/libgimp/gimpcolor_pdb.c
index 4021231..9233618 100644
--- a/libgimp/gimpcolor_pdb.c
+++ b/libgimp/gimpcolor_pdb.c
@@ -97,7 +97,7 @@ gimp_brightness_contrast (gint32 drawable_ID,
  * intensity mapping--that is, no final intensity will be lower than
  * the low output level and no final intensity will be higher than the
  * high output level. This tool is only valid on RGB color and
- * grayscale images. It will not operate on indexed drawables.
+ * grayscale images.
  *
  * Returns: TRUE on success.
  **/
@@ -299,8 +299,7 @@ gimp_desaturate_full (gint32             drawable_ID,
  *
  * This procedure equalizes the contents of the specified drawable.
  * Each intensity channel is equalized independently. The equalized
- * intensity is given as inten' = (255 - inten). Indexed color
- * drawables are not valid for this operation. The 'mask_only' option
+ * intensity is given as inten' = (255 - inten). The 'mask_only' option
  * specifies whether to adjust only the area of the image within the
  * selection bounds, or the entire image based on the histogram of the
  * selected area. If there is no selection, the entire image is
@@ -337,8 +336,7 @@ gimp_equalize (gint32   drawable_ID,
  *
  * This procedure inverts the contents of the specified drawable. Each
  * intensity channel is inverted independently. The inverted intensity
- * is given as inten' = (255 - inten). Indexed color drawables are not
- * valid for this operation.
+ * is given as inten' = (255 - inten).
  *
  * Returns: TRUE on success.
  **/
diff --git a/tools/pdbgen/pdb/color.pdb b/tools/pdbgen/pdb/color.pdb
index 7395e71..8a575c2 100644
--- a/tools/pdbgen/pdb/color.pdb
+++ b/tools/pdbgen/pdb/color.pdb
@@ -75,8 +75,7 @@ high-level intensities. Lower gamma values result in more low-level
 intensities. The low/high output levels constrain the final intensity
 mapping--that is, no final intensity will be lower than the low output level
 and no final intensity will be higher than the high output level. This tool is
-only valid on RGB color and grayscale images. It will not operate on indexed
-drawables.
+only valid on RGB color and grayscale images.
 HELP
 
     &std_pdb_misc;
@@ -323,12 +322,12 @@ sub equalize {
     $blurb = 'Equalize the contents of the specified drawable.';
 
     $help = <<'HELP';
-This procedure equalizes the contents of the specified drawable. Each intensity
-channel is equalized independently. The equalized intensity is given as inten'
-= (255 - inten). Indexed color drawables are not valid for this operation. The
-'mask_only' option specifies whether to adjust only the area of the image
-within the selection bounds, or the entire image based on the histogram of the
-selected area. If there is no selection, the entire image is adjusted based on
+This procedure equalizes the contents of the specified drawable. Each
+intensity channel is equalized independently. The equalized intensity
+is given as inten' = (255 - inten). The 'mask_only' option specifies
+whether to adjust only the area of the image within the selection
+bounds, or the entire image based on the histogram of the selected
+area. If there is no selection, the entire image is adjusted based on
 the histogram for the entire image.
 HELP
 
@@ -346,8 +345,7 @@ HELP
 	code => <<'CODE'
 {
   if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
-      ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
-      gimp_drawable_is_indexed (drawable))
+      ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     success = FALSE;
 
   if (success)
@@ -363,7 +361,7 @@ sub invert {
     $help = <<'HELP';
 This procedure inverts the contents of the specified drawable. Each intensity
 channel is inverted independently. The inverted intensity is given as inten' =
-(255 - inten). Indexed color drawables are not valid for this operation.
+(255 - inten).
 HELP
 
     &std_pdb_misc;
@@ -377,8 +375,7 @@ HELP
 	code => <<'CODE'
 {
   if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
-      gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) &&
-      ! gimp_drawable_is_indexed (drawable))
+      gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       gimp_drawable_apply_operation_by_name (drawable, progress,
                                              _("Invert"),



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