From e01189ca77d366db8dc056d112c64a68fc75d28c Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 20 Mar 2012 21:33:55 +0100 Subject: [PATCH] app: remove checks from stuff that now works on indexed layers --- app/actions/drawable-actions.c | 2 +- app/pdb/color-cmds.c | 13 +++++-------- app/tools/gimpbrightnesscontrasttool.c | 8 -------- app/tools/gimpcolorizetool.c | 4 ++-- app/tools/gimpposterizetool.c | 7 ------- app/tools/gimpthresholdtool.c | 7 ------- libgimp/gimpcolor_pdb.c | 2 +- tools/pdbgen/pdb/color.pdb | 14 +++++--------- 8 files changed, 14 insertions(+), 43 deletions(-) diff --git a/app/actions/drawable-actions.c b/app/actions/drawable-actions.c index 10645fc6c0..d1718d7e36 100644 --- a/app/actions/drawable-actions.c +++ b/app/actions/drawable-actions.c @@ -211,7 +211,7 @@ drawable_actions_update (GimpActionGroup *group, gimp_action_group_set_action_active (group, action, (condition) != 0) SET_SENSITIVE ("drawable-equalize", writable && !children && !is_indexed); - SET_SENSITIVE ("drawable-invert", writable && !children && !is_indexed); + SET_SENSITIVE ("drawable-invert", writable && !children); SET_SENSITIVE ("drawable-levels-stretch", writable && !children && is_rgb); SET_SENSITIVE ("drawable-offset", writable && !children); diff --git a/app/pdb/color-cmds.c b/app/pdb/color-cmds.c index e3fed5f93d..7c1e432e2f 100644 --- a/app/pdb/color-cmds.c +++ b/app/pdb/color-cmds.c @@ -67,8 +67,7 @@ brightness_contrast_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)) { GObject *config = g_object_new (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG, "brightness", brightness / 127.0, @@ -212,8 +211,7 @@ posterize_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)) { GObject *config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG, "levels", levels, @@ -516,7 +514,7 @@ colorize_invoker (GimpProcedure *procedure, { 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_rgb (drawable)) + ! gimp_drawable_is_gray (drawable)) { GObject *config = g_object_new (GIMP_TYPE_COLORIZE_CONFIG, "hue", hue / 360.0, @@ -669,8 +667,7 @@ threshold_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)) { GObject *config = g_object_new (GIMP_TYPE_THRESHOLD_CONFIG, "low", low_threshold / 255.0, @@ -1117,7 +1114,7 @@ register_color_procs (GimpPDB *pdb) gimp_procedure_set_static_strings (procedure, "gimp-colorize", "Render the drawable as a grayscale image seen through a colored glass.", - "Desaturates the drawable, then tints it with the specified color. This tool is only valid on RGB color images. It will not operate on grayscale or indexed drawables.", + "Desaturates the drawable, then tints it with the specified color. This tool is only valid on RGB color images. It will not operate on grayscale drawables.", "Sven Neumann ", "Sven Neumann", "2004", diff --git a/app/tools/gimpbrightnesscontrasttool.c b/app/tools/gimpbrightnesscontrasttool.c index 277f4a281d..a4311621ec 100644 --- a/app/tools/gimpbrightnesscontrasttool.c +++ b/app/tools/gimpbrightnesscontrasttool.c @@ -147,14 +147,6 @@ gimp_brightness_contrast_tool_initialize (GimpTool *tool, if (! drawable) return FALSE; - if (gimp_drawable_is_indexed (drawable)) - { - g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, - _("Brightness-Contrast does not operate " - "on indexed layers.")); - return FALSE; - } - gimp_config_reset (GIMP_CONFIG (bc_tool->config)); return GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error); diff --git a/app/tools/gimpcolorizetool.c b/app/tools/gimpcolorizetool.c index 8915c77210..11b13bb160 100644 --- a/app/tools/gimpcolorizetool.c +++ b/app/tools/gimpcolorizetool.c @@ -124,10 +124,10 @@ gimp_colorize_tool_initialize (GimpTool *tool, if (! drawable) return FALSE; - if (! gimp_drawable_is_rgb (drawable)) + if (gimp_drawable_is_gray (drawable)) { g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, - _("Colorize operates only on RGB color layers.")); + _("Colorize does not operate on grayscale layers.")); return FALSE; } diff --git a/app/tools/gimpposterizetool.c b/app/tools/gimpposterizetool.c index 2cbc79fc62..d7e2f906a0 100644 --- a/app/tools/gimpposterizetool.c +++ b/app/tools/gimpposterizetool.c @@ -116,13 +116,6 @@ gimp_posterize_tool_initialize (GimpTool *tool, if (! drawable) return FALSE; - if (gimp_drawable_is_indexed (drawable)) - { - g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, - _("Posterize does not operate on indexed layers.")); - return FALSE; - } - gimp_config_reset (GIMP_CONFIG (posterize_tool->config)); if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error)) diff --git a/app/tools/gimpthresholdtool.c b/app/tools/gimpthresholdtool.c index 8738c3750e..143a692ef3 100644 --- a/app/tools/gimpthresholdtool.c +++ b/app/tools/gimpthresholdtool.c @@ -145,13 +145,6 @@ gimp_threshold_tool_initialize (GimpTool *tool, if (! drawable) return FALSE; - if (gimp_drawable_is_indexed (drawable)) - { - g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, - _("Threshold does not operate on indexed layers.")); - return FALSE; - } - gimp_config_reset (GIMP_CONFIG (t_tool->config)); if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error)) diff --git a/libgimp/gimpcolor_pdb.c b/libgimp/gimpcolor_pdb.c index 5059cb3713..f2630c9428 100644 --- a/libgimp/gimpcolor_pdb.c +++ b/libgimp/gimpcolor_pdb.c @@ -514,7 +514,7 @@ gimp_color_balance (gint32 drawable_ID, * * Desaturates the drawable, then tints it with the specified color. * This tool is only valid on RGB color images. It will not operate on - * grayscale or indexed drawables. + * grayscale drawables. * * Returns: TRUE on success. * diff --git a/tools/pdbgen/pdb/color.pdb b/tools/pdbgen/pdb/color.pdb index 2eb9dee561..e44b0558f1 100644 --- a/tools/pdbgen/pdb/color.pdb +++ b/tools/pdbgen/pdb/color.pdb @@ -42,8 +42,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)) { GObject *config = g_object_new (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG, "brightness", brightness / 127.0, @@ -206,8 +205,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)) { GObject *config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG, "levels", levels, @@ -539,8 +537,7 @@ sub colorize { $help = <<'HELP'; Desaturates the drawable, then tints it with the specified color. This tool is -only valid on RGB color images. It will not operate on grayscale or indexed -drawables. +only valid on RGB color images. It will not operate on grayscale drawables. HELP &neo_pdb_misc('2004', '2.2'); @@ -562,7 +559,7 @@ HELP { 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_rgb (drawable)) + ! gimp_drawable_is_gray (drawable)) { GObject *config = g_object_new (GIMP_TYPE_COLORIZE_CONFIG, "hue", hue / 360.0, @@ -738,8 +735,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)) { GObject *config = g_object_new (GIMP_TYPE_THRESHOLD_CONFIG, "low", low_threshold / 255.0,