app: turn invert-perceptual, -linear and -value into normal filter actions

so they show up in recent filters, and don't need their own callbacks.

This has the problem that they now show a GUI with no options, but
that simply puts on more pressure to fix this general uglyness of ops
without editable properties.
This commit is contained in:
Michael Natterer 2017-05-26 18:49:22 +02:00
parent ea7f1ba024
commit 84e5aed103
6 changed files with 24 additions and 81 deletions

View File

@ -47,25 +47,6 @@ static const GimpActionEntry drawable_actions[] =
G_CALLBACK (drawable_equalize_cmd_callback),
GIMP_HELP_LAYER_EQUALIZE },
{ "drawable-invert", GIMP_ICON_INVERT,
NC_("drawable-action", "In_vert"), NULL,
NC_("drawable-action", "Invert the colors perceptually"),
G_CALLBACK (drawable_invert_cmd_callback),
GIMP_HELP_LAYER_INVERT },
{ "drawable-linear-invert", GIMP_ICON_INVERT,
NC_("drawable-action", "_Linear Invert"), NULL,
NC_("drawable-action", "Invert the colors in linear light"),
G_CALLBACK (drawable_linear_invert_cmd_callback),
GIMP_HELP_LAYER_INVERT },
{ "drawable-value-invert", GIMP_ICON_GEGL,
NC_("drawable-action", "_Value Invert"), NULL,
NC_("drawable-action",
"Invert the brightness of each pixel, keeping the color"),
G_CALLBACK (drawable_value_invert_cmd_callback),
GIMP_HELP_LAYER_INVERT },
{ "drawable-levels-stretch", NULL,
NC_("drawable-action", "_White Balance"), NULL,
NC_("drawable-action", "Automatic white balance correction"),
@ -247,9 +228,6 @@ drawable_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_active (group, action, (condition) != 0)
SET_SENSITIVE ("drawable-equalize", writable && !children);
SET_SENSITIVE ("drawable-invert", writable && !children);
SET_SENSITIVE ("drawable-linear-invert", writable && !children);
SET_SENSITIVE ("drawable-value-invert", writable && !children);
SET_SENSITIVE ("drawable-levels-stretch", writable && !children && is_rgb);
SET_SENSITIVE ("drawable-dilate", writable && !children);
SET_SENSITIVE ("drawable-erode", writable && !children);

View File

@ -70,55 +70,6 @@ drawable_equalize_cmd_callback (GtkAction *action,
gimp_image_flush (image);
}
void
drawable_invert_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpDrawable *drawable;
GimpDisplay *display;
return_if_no_drawable (image, drawable, data);
return_if_no_display (display, data);
gimp_drawable_apply_operation_by_name (drawable, GIMP_PROGRESS (display),
_("Invert"), "gegl:invert-gamma",
NULL);
gimp_image_flush (image);
}
void
drawable_linear_invert_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpDrawable *drawable;
GimpDisplay *display;
return_if_no_drawable (image, drawable, data);
return_if_no_display (display, data);
gimp_drawable_apply_operation_by_name (drawable, GIMP_PROGRESS (display),
_("Linear Invert"), "gegl:invert-linear",
NULL);
gimp_image_flush (image);
}
void
drawable_value_invert_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpDrawable *drawable;
GimpDisplay *display;
return_if_no_drawable (image, drawable, data);
return_if_no_display (display, data);
gimp_drawable_apply_operation_by_name (drawable, GIMP_PROGRESS (display),
_("Value Invert"), "gegl:value-invert",
NULL);
gimp_image_flush (image);
}
void
drawable_levels_stretch_cmd_callback (GtkAction *action,
gpointer data)

View File

@ -21,12 +21,6 @@
void drawable_equalize_cmd_callback (GtkAction *action,
gpointer data);
void drawable_invert_cmd_callback (GtkAction *action,
gpointer data);
void drawable_linear_invert_cmd_callback (GtkAction *action,
gpointer data);
void drawable_value_invert_cmd_callback (GtkAction *action,
gpointer data);
void drawable_levels_stretch_cmd_callback (GtkAction *action,
gpointer data);
void drawable_dilate_cmd_callback (GtkAction *action,

View File

@ -307,6 +307,21 @@ static const GimpStringActionEntry filters_actions[] =
"gegl:image-gradient",
GIMP_HELP_FILTER_IMAGE_GRADIENT },
{ "filters-invert-linear", GIMP_ICON_INVERT,
NC_("filters-action", "_Linear Invert"), NULL, NULL,
"gegl:invert-linear",
GIMP_HELP_FILTER_INVERT_LINEAR },
{ "filters-invert-perceptual", GIMP_ICON_INVERT,
NC_("filters-action", "In_vert"), NULL, NULL,
"gegl:invert-gamma",
GIMP_HELP_FILTER_INVERT_PERCEPTUAL },
{ "filters-invert-value", GIMP_ICON_GEGL,
NC_("filters-action", "_Value Invert"), NULL, NULL,
"gegl:value-invert",
GIMP_HELP_FILTER_INVERT_VALUE },
{ "filters-kaleidoscope", GIMP_ICON_GEGL,
NC_("filters-action", "_Kaleidoscope..."), NULL, NULL,
"gegl:mirrors",
@ -755,6 +770,9 @@ filters_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("filters-high-pass", writable);
SET_SENSITIVE ("filters-hue-chroma", writable);
SET_SENSITIVE ("filters-illusion", writable);
SET_SENSITIVE ("filters-invert-linear", writable);
SET_SENSITIVE ("filters-invert-perceptual", writable);
SET_SENSITIVE ("filters-invert-value", writable);
SET_SENSITIVE ("filters-image-gradient", writable);
SET_SENSITIVE ("filters-kaleidoscope", writable);
SET_SENSITIVE ("filters-lens-distortion", writable);

View File

@ -184,7 +184,6 @@
#define GIMP_HELP_LAYER_RAISE_TO_TOP "gimp-layer-raise-to-top"
#define GIMP_HELP_LAYER_LOWER "gimp-layer-lower"
#define GIMP_HELP_LAYER_LOWER_TO_BOTTOM "gimp-layer-lower-to-bottom"
#define GIMP_HELP_LAYER_INVERT "gimp-layer-invert"
#define GIMP_HELP_LAYER_WHITE_BALANCE "gimp-layer-white-balance"
#define GIMP_HELP_LAYER_EQUALIZE "gimp-layer-equalize"
#define GIMP_HELP_LAYER_DILATE "gimp-layer-dilate"
@ -373,6 +372,9 @@
#define GIMP_HELP_FILTER_HIGH_PASS "gimp-filter-high-pass"
#define GIMP_HELP_FILTER_HUE_CHROMA "gimp-filter-hue-chroma"
#define GIMP_HELP_FILTER_ILLUSION "gimp-filter-illusion"
#define GIMP_HELP_FILTER_INVERT_LINEAR "gimp-filter-invert-linear"
#define GIMP_HELP_FILTER_INVERT_PERCEPTUAL "gimp-filter-invert-perceptual"
#define GIMP_HELP_FILTER_INVERT_VALUE "gimp-filter-invert-value"
#define GIMP_HELP_FILTER_IMAGE_GRADIENT "gimp-filter-image-gradient"
#define GIMP_HELP_FILTER_KALEIDOSCOPE "gimp-filter-kaleidoscope"
#define GIMP_HELP_FILTER_LENS_DISTORTION "gimp-filter-lens-distortion"

View File

@ -567,9 +567,9 @@
<menuitem action="tools-curves" />
<separator />
<placeholder name="Invert">
<menuitem action="drawable-invert" />
<menuitem action="drawable-linear-invert" />
<menuitem action="drawable-value-invert" />
<menuitem action="filters-invert-perceptual" />
<menuitem action="filters-invert-linear" />
<menuitem action="filters-invert-value" />
</placeholder>
<separator />
<menu action="colors-auto-menu" name="Auto">