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



commit 84e5aed1034441f81d9c903b4ec9a1f76fe43021
Author: Michael Natterer <mitch gimp org>
Date:   Fri May 26 18:49:22 2017 +0200

    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.

 app/actions/drawable-actions.c  |   22 -----------------
 app/actions/drawable-commands.c |   49 ---------------------------------------
 app/actions/drawable-commands.h |    6 ----
 app/actions/filters-actions.c   |   18 ++++++++++++++
 app/widgets/gimphelp-ids.h      |    4 ++-
 menus/image-menu.xml.in         |    6 ++--
 6 files changed, 24 insertions(+), 81 deletions(-)
---
diff --git a/app/actions/drawable-actions.c b/app/actions/drawable-actions.c
index f50683f..8a45a99 100644
--- a/app/actions/drawable-actions.c
+++ b/app/actions/drawable-actions.c
@@ -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);
diff --git a/app/actions/drawable-commands.c b/app/actions/drawable-commands.c
index 3b282cf..378be6c 100644
--- a/app/actions/drawable-commands.c
+++ b/app/actions/drawable-commands.c
@@ -71,55 +71,6 @@ drawable_equalize_cmd_callback (GtkAction *action,
 }
 
 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)
 {
diff --git a/app/actions/drawable-commands.h b/app/actions/drawable-commands.h
index 90a8af8..ae437e1 100644
--- a/app/actions/drawable-commands.h
+++ b/app/actions/drawable-commands.h
@@ -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,
diff --git a/app/actions/filters-actions.c b/app/actions/filters-actions.c
index 8ae9c00..813b154 100644
--- a/app/actions/filters-actions.c
+++ b/app/actions/filters-actions.c
@@ -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);
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index d782e3f..c9d9a11 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -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"
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 8a98afc..160f7dd 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -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">


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