app: remove checks from stuff that now works on indexed layers

This commit is contained in:
Michael Natterer 2012-03-20 21:33:55 +01:00
parent 0053494c18
commit e01189ca77
8 changed files with 14 additions and 43 deletions

View file

@ -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);

View file

@ -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@gimp.org>",
"Sven Neumann",
"2004",

View file

@ -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);

View file

@ -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;
}

View file

@ -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))

View file

@ -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))

View file

@ -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.
*

View file

@ -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,