1288 lines
47 KiB
C
1288 lines
47 KiB
C
/* PIKA - Photo and Image Kooker Application
|
|
* a rebranding of The GNU Image Manipulation Program (created with heckimp)
|
|
* A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
|
|
*
|
|
* Original copyright, applying to most contents (license remains unchanged):
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include <gegl.h>
|
|
#include <gegl-plugin.h>
|
|
#include <gtk/gtk.h>
|
|
|
|
#include "libpikawidgets/pikawidgets.h"
|
|
|
|
#include "actions-types.h"
|
|
|
|
#include "gegl/pika-gegl-utils.h"
|
|
|
|
#include "core/pika-filter-history.h"
|
|
#include "core/pikaimage.h"
|
|
#include "core/pikalayermask.h"
|
|
|
|
#include "pdb/pikaprocedure.h"
|
|
|
|
#include "widgets/pikaaction.h"
|
|
#include "widgets/pikaactiongroup.h"
|
|
#include "widgets/pikahelp-ids.h"
|
|
#include "widgets/pikauimanager.h"
|
|
#include "widgets/pikawidgets-utils.h"
|
|
|
|
#include "actions.h"
|
|
#include "filters-actions.h"
|
|
#include "filters-commands.h"
|
|
|
|
#include "pika-intl.h"
|
|
|
|
|
|
/* local function prototypes */
|
|
|
|
static void filters_actions_set_tooltips (PikaActionGroup *group,
|
|
const PikaStringActionEntry *entries,
|
|
gint n_entries);
|
|
static void filters_actions_history_changed (Pika *pika,
|
|
PikaActionGroup *group);
|
|
|
|
|
|
/* private variables */
|
|
|
|
static const PikaStringActionEntry filters_actions[] =
|
|
{
|
|
{ "filters-antialias", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Antialias"), NULL, { NULL }, NULL,
|
|
"gegl:antialias",
|
|
PIKA_HELP_FILTER_ANTIALIAS },
|
|
|
|
{ "filters-color-enhance", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Color Enhance"), NULL, { NULL }, NULL,
|
|
"gegl:color-enhance",
|
|
PIKA_HELP_FILTER_COLOR_ENHANCE },
|
|
|
|
{ "filters-invert-linear", PIKA_ICON_INVERT,
|
|
NC_("filters-action", "L_inear Invert"), NULL, { NULL }, NULL,
|
|
"gegl:invert-linear",
|
|
PIKA_HELP_FILTER_INVERT_LINEAR },
|
|
|
|
{ "filters-invert-perceptual", PIKA_ICON_INVERT,
|
|
NC_("filters-action", "In_vert"), NULL, { NULL }, NULL,
|
|
"gegl:invert-gamma",
|
|
PIKA_HELP_FILTER_INVERT_PERCEPTUAL },
|
|
|
|
{ "filters-invert-value", PIKA_ICON_INVERT,
|
|
NC_("filters-action", "_Value Invert"), NULL, { NULL }, NULL,
|
|
"gegl:value-invert",
|
|
PIKA_HELP_FILTER_INVERT_VALUE },
|
|
|
|
{ "filters-stretch-contrast-hsv", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Stretch Contrast HSV"), NULL, { NULL }, NULL,
|
|
"gegl:stretch-contrast-hsv",
|
|
PIKA_HELP_FILTER_STRETCH_CONTRAST_HSV }
|
|
};
|
|
|
|
static const PikaStringActionEntry filters_settings_actions[] =
|
|
{
|
|
{ "filters-dilate", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Dilate"), NULL, { NULL },
|
|
NC_("filters-action", "Grow lighter areas of the image"),
|
|
"gegl:value-propagate\n"
|
|
"(mode white)"
|
|
"(lower-threshold 0.000000)"
|
|
"(upper-threshold 1.000000)"
|
|
"(rate 1.000000)"
|
|
"(top yes)"
|
|
"(left yes)"
|
|
"(right yes)"
|
|
"(bottom yes)"
|
|
"(value yes)"
|
|
"(alpha no)",
|
|
PIKA_HELP_FILTER_DILATE },
|
|
|
|
{ "filters-erode", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Erode"), NULL, { NULL },
|
|
NC_("filters-action", "Grow darker areas of the image"),
|
|
"gegl:value-propagate\n"
|
|
"(mode black)"
|
|
"(lower-threshold 0.000000)"
|
|
"(upper-threshold 1.000000)"
|
|
"(rate 1.000000)"
|
|
"(top yes)"
|
|
"(left yes)"
|
|
"(right yes)"
|
|
"(bottom yes)"
|
|
"(value yes)"
|
|
"(alpha no)",
|
|
PIKA_HELP_FILTER_ERODE }
|
|
};
|
|
|
|
static const PikaStringActionEntry filters_interactive_actions[] =
|
|
{
|
|
{ "filters-alien-map", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Alien Map..."), NULL, { NULL }, NULL,
|
|
"gegl:alien-map",
|
|
PIKA_HELP_FILTER_ALIEN_MAP },
|
|
|
|
{ "filters-apply-canvas", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Apply Canvas..."), NULL, { NULL }, NULL,
|
|
"gegl:texturize-canvas",
|
|
PIKA_HELP_FILTER_APPLY_CANVAS },
|
|
|
|
{ "filters-apply-lens", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Apply _Lens..."), NULL, { NULL }, NULL,
|
|
"gegl:apply-lens",
|
|
PIKA_HELP_FILTER_APPLY_LENS },
|
|
|
|
{ "filters-bayer-matrix", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Bayer Matrix..."), NULL, { NULL }, NULL,
|
|
"gegl:bayer-matrix",
|
|
PIKA_HELP_FILTER_BAYER_MATRIX },
|
|
|
|
{ "filters-bloom", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Bloom..."), NULL, { NULL }, NULL,
|
|
"gegl:bloom",
|
|
PIKA_HELP_FILTER_BLOOM },
|
|
|
|
{ "filters-brightness-contrast", PIKA_ICON_TOOL_BRIGHTNESS_CONTRAST,
|
|
NC_("filters-action", "B_rightness-Contrast..."), NULL, { NULL }, NULL,
|
|
"pika:brightness-contrast",
|
|
PIKA_HELP_TOOL_BRIGHTNESS_CONTRAST },
|
|
|
|
{ "filters-bump-map", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Bump Map..."), NULL, { NULL }, NULL,
|
|
"gegl:bump-map",
|
|
PIKA_HELP_FILTER_BUMP_MAP },
|
|
|
|
{ "filters-c2g", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Color to Gray..."), NULL, { NULL }, NULL,
|
|
"gegl:c2g",
|
|
PIKA_HELP_FILTER_C2G },
|
|
|
|
{ "filters-cartoon", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Ca_rtoon..."), NULL, { NULL }, NULL,
|
|
"gegl:cartoon",
|
|
PIKA_HELP_FILTER_CARTOON },
|
|
|
|
{ "filters-channel-mixer", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Channel Mixer..."), NULL, { NULL }, NULL,
|
|
"gegl:channel-mixer",
|
|
PIKA_HELP_FILTER_CHANNEL_MIXER },
|
|
|
|
{ "filters-checkerboard", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Checkerboard..."), NULL, { NULL }, NULL,
|
|
"gegl:checkerboard",
|
|
PIKA_HELP_FILTER_CHECKERBOARD },
|
|
|
|
{ "filters-color-balance", PIKA_ICON_TOOL_COLOR_BALANCE,
|
|
NC_("filters-action", "Color _Balance..."), NULL, { NULL }, NULL,
|
|
"pika:color-balance",
|
|
PIKA_HELP_TOOL_COLOR_BALANCE },
|
|
|
|
{ "filters-color-exchange", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Color Exchange..."), NULL, { NULL }, NULL,
|
|
"gegl:color-exchange",
|
|
PIKA_HELP_FILTER_COLOR_EXCHANGE },
|
|
|
|
{ "filters-colorize", PIKA_ICON_TOOL_COLORIZE,
|
|
NC_("filters-action", "Colori_ze..."), NULL, { NULL }, NULL,
|
|
"pika:colorize",
|
|
PIKA_HELP_TOOL_COLORIZE },
|
|
|
|
{ "filters-dither", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Dithe_r..."), NULL, { NULL }, NULL,
|
|
"gegl:dither",
|
|
PIKA_HELP_FILTER_DITHER },
|
|
|
|
{ "filters-color-rotate", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Rotate Colors..."), NULL, { NULL }, NULL,
|
|
"gegl:color-rotate",
|
|
PIKA_HELP_FILTER_COLOR_ROTATE },
|
|
|
|
{ "filters-color-temperature", PIKA_ICON_TOOL_COLOR_TEMPERATURE,
|
|
NC_("filters-action", "Color T_emperature..."), NULL, { NULL }, NULL,
|
|
"gegl:color-temperature",
|
|
PIKA_HELP_FILTER_COLOR_TEMPERATURE },
|
|
|
|
{ "filters-color-to-alpha", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Color to _Alpha..."), NULL, { NULL }, NULL,
|
|
"gegl:color-to-alpha",
|
|
PIKA_HELP_FILTER_COLOR_TO_ALPHA },
|
|
|
|
{ "filters-component-extract", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Extract Component..."), NULL, { NULL }, NULL,
|
|
"gegl:component-extract",
|
|
PIKA_HELP_FILTER_COMPONENT_EXTRACT },
|
|
|
|
{ "filters-convolution-matrix", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Convolution Matrix..."), NULL, { NULL }, NULL,
|
|
"gegl:convolution-matrix",
|
|
PIKA_HELP_FILTER_CONVOLUTION_MATRIX },
|
|
|
|
{ "filters-cubism", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Cubism..."), NULL, { NULL }, NULL,
|
|
"gegl:cubism",
|
|
PIKA_HELP_FILTER_CUBISM },
|
|
|
|
{ "filters-curves", PIKA_ICON_TOOL_CURVES,
|
|
NC_("filters-action", "_Curves..."), NULL, { NULL }, NULL,
|
|
"pika:curves",
|
|
PIKA_HELP_TOOL_CURVES },
|
|
|
|
{ "filters-deinterlace", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Deinterlace..."), NULL, { NULL }, NULL,
|
|
"gegl:deinterlace",
|
|
PIKA_HELP_FILTER_DEINTERLACE },
|
|
|
|
{ "filters-desaturate", PIKA_ICON_TOOL_DESATURATE,
|
|
NC_("filters-action", "_Desaturate..."), NULL, { NULL }, NULL,
|
|
"pika:desaturate",
|
|
PIKA_HELP_FILTER_DESATURATE },
|
|
|
|
{ "filters-difference-of-gaussians", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Difference of _Gaussians..."), NULL, { NULL }, NULL,
|
|
"gegl:difference-of-gaussians",
|
|
PIKA_HELP_FILTER_DIFFERENCE_OF_GAUSSIANS },
|
|
|
|
{ "filters-diffraction-patterns", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "D_iffraction Patterns..."), NULL, { NULL }, NULL,
|
|
"gegl:diffraction-patterns",
|
|
PIKA_HELP_FILTER_DIFFRACTION_PATTERNS },
|
|
|
|
{ "filters-displace", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Displace..."), NULL, { NULL }, NULL,
|
|
"gegl:displace",
|
|
PIKA_HELP_FILTER_DISPLACE },
|
|
|
|
{ "filters-distance-map", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Distance _Map..."), NULL, { NULL }, NULL,
|
|
"gegl:distance-transform",
|
|
PIKA_HELP_FILTER_DISTANCE_MAP },
|
|
|
|
{ "filters-dropshadow", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Drop Shadow..."), NULL, { NULL }, NULL,
|
|
"gegl:dropshadow",
|
|
PIKA_HELP_FILTER_DROPSHADOW },
|
|
|
|
{ "filters-edge", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Edge..."), NULL, { NULL }, NULL,
|
|
"gegl:edge",
|
|
PIKA_HELP_FILTER_EDGE },
|
|
|
|
{ "filters-edge-laplace", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Laplace"), NULL, { NULL }, NULL,
|
|
"gegl:edge-laplace",
|
|
PIKA_HELP_FILTER_EDGE_LAPLACE },
|
|
|
|
{ "filters-edge-neon", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Neon..."), NULL, { NULL }, NULL,
|
|
"gegl:edge-neon",
|
|
PIKA_HELP_FILTER_EDGE_NEON },
|
|
|
|
{ "filters-edge-sobel", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Sobel..."), NULL, { NULL }, NULL,
|
|
"gegl:edge-sobel",
|
|
PIKA_HELP_FILTER_EDGE_SOBEL },
|
|
|
|
{ "filters-emboss", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Emboss..."), NULL, { NULL }, NULL,
|
|
"gegl:emboss",
|
|
PIKA_HELP_FILTER_EMBOSS },
|
|
|
|
{ "filters-engrave", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "En_grave..."), NULL, { NULL }, NULL,
|
|
"gegl:engrave",
|
|
PIKA_HELP_FILTER_ENGRAVE },
|
|
|
|
{ "filters-exposure", PIKA_ICON_TOOL_EXPOSURE,
|
|
NC_("filters-action", "E_xposure..."), NULL, { NULL }, NULL,
|
|
"gegl:exposure",
|
|
PIKA_HELP_FILTER_EXPOSURE },
|
|
|
|
{ "filters-fattal-2002", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Fattal et al. 2002..."), NULL, { NULL }, NULL,
|
|
"gegl:fattal02",
|
|
PIKA_HELP_FILTER_FATTAL_2002 },
|
|
|
|
{ "filters-focus-blur", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Focus Blur..."), NULL, { NULL }, NULL,
|
|
"gegl:focus-blur",
|
|
PIKA_HELP_FILTER_FOCUS_BLUR },
|
|
|
|
{ "filters-fractal-trace", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Fractal Trace..."), NULL, { NULL }, NULL,
|
|
"gegl:fractal-trace",
|
|
PIKA_HELP_FILTER_FRACTAL_TRACE },
|
|
|
|
{ "filters-gaussian-blur", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Gaussian Blur..."), NULL, { NULL }, NULL,
|
|
"gegl:gaussian-blur",
|
|
PIKA_HELP_FILTER_GAUSSIAN_BLUR },
|
|
|
|
{ "filters-gaussian-blur-selective", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Selective Gaussian Blur..."), NULL, { NULL }, NULL,
|
|
"gegl:gaussian-blur-selective",
|
|
PIKA_HELP_FILTER_GAUSSIAN_BLUR_SELECTIVE },
|
|
|
|
{ "filters-gegl-graph", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_GEGL Graph..."), NULL, { NULL }, NULL,
|
|
"gegl:gegl",
|
|
PIKA_HELP_FILTER_GEGL_GRAPH },
|
|
|
|
{ "filters-grid", PIKA_ICON_GRID,
|
|
NC_("filters-action", "_Grid..."), NULL, { NULL }, NULL,
|
|
"gegl:grid",
|
|
PIKA_HELP_FILTER_GRID },
|
|
|
|
{ "filters-high-pass", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_High Pass..."), NULL, { NULL }, NULL,
|
|
"gegl:high-pass",
|
|
PIKA_HELP_FILTER_HIGH_PASS },
|
|
|
|
{ "filters-hue-chroma", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Hue-_Chroma..."), NULL, { NULL }, NULL,
|
|
"gegl:hue-chroma",
|
|
PIKA_HELP_FILTER_HUE_CHROMA },
|
|
|
|
{ "filters-hue-saturation", PIKA_ICON_TOOL_HUE_SATURATION,
|
|
NC_("filters-action", "Hue-_Saturation..."), NULL, { NULL }, NULL,
|
|
"pika:hue-saturation",
|
|
PIKA_HELP_TOOL_HUE_SATURATION },
|
|
|
|
{ "filters-illusion", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Illusion..."), NULL, { NULL }, NULL,
|
|
"gegl:illusion",
|
|
PIKA_HELP_FILTER_ILLUSION },
|
|
|
|
{ "filters-image-gradient", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Image Gradient..."), NULL, { NULL }, NULL,
|
|
"gegl:image-gradient",
|
|
PIKA_HELP_FILTER_IMAGE_GRADIENT },
|
|
|
|
{ "filters-kaleidoscope", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Kaleidoscope..."), NULL, { NULL }, NULL,
|
|
"gegl:mirrors",
|
|
PIKA_HELP_FILTER_KALEIDOSCOPE },
|
|
|
|
{ "filters-lens-blur", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Le_ns Blur..."), NULL, { NULL }, NULL,
|
|
"gegl:lens-blur",
|
|
PIKA_HELP_FILTER_LENS_BLUR },
|
|
|
|
{ "filters-lens-distortion", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Le_ns Distortion..."), NULL, { NULL }, NULL,
|
|
"gegl:lens-distortion",
|
|
PIKA_HELP_FILTER_LENS_DISTORTION },
|
|
|
|
{ "filters-lens-flare", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Lens _Flare..."), NULL, { NULL }, NULL,
|
|
"gegl:lens-flare",
|
|
PIKA_HELP_FILTER_LENS_FLARE },
|
|
|
|
{ "filters-levels", PIKA_ICON_TOOL_LEVELS,
|
|
NC_("filters-action", "_Levels..."), NULL, { NULL }, NULL,
|
|
"pika:levels",
|
|
PIKA_HELP_TOOL_LEVELS },
|
|
|
|
{ "filters-linear-sinusoid", PIKA_ICON_TOOL_LEVELS,
|
|
NC_("filters-action", "_Linear Sinusoid..."), NULL, { NULL }, NULL,
|
|
"gegl:linear-sinusoid",
|
|
PIKA_HELP_FILTER_LINEAR_SINUSOID },
|
|
|
|
{ "filters-little-planet", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Little Planet..."), NULL, { NULL }, NULL,
|
|
"gegl:stereographic-projection",
|
|
PIKA_HELP_FILTER_LITTLE_PLANET },
|
|
|
|
{ "filters-long-shadow", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Long Shadow..."), NULL, { NULL }, NULL,
|
|
"gegl:long-shadow",
|
|
PIKA_HELP_FILTER_LONG_SHADOW },
|
|
|
|
{ "filters-mantiuk-2006", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Mantiuk 2006..."), NULL, { NULL }, NULL,
|
|
"gegl:mantiuk06",
|
|
PIKA_HELP_FILTER_MANTIUK_2006 },
|
|
|
|
{ "filters-maze", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Maze..."), NULL, { NULL }, NULL,
|
|
"gegl:maze",
|
|
PIKA_HELP_FILTER_MAZE },
|
|
|
|
{ "filters-mean-curvature-blur", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Mean C_urvature Blur..."), NULL, { NULL }, NULL,
|
|
"gegl:mean-curvature-blur",
|
|
PIKA_HELP_FILTER_MEAN_CURVATURE_BLUR },
|
|
|
|
{ "filters-median-blur", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Median Blur..."), NULL, { NULL }, NULL,
|
|
"gegl:median-blur",
|
|
PIKA_HELP_FILTER_MEDIAN_BLUR },
|
|
|
|
{ "filters-mono-mixer", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Mono Mixer..."), NULL, { NULL }, NULL,
|
|
"gegl:mono-mixer",
|
|
PIKA_HELP_FILTER_MONO_MIXER },
|
|
|
|
{ "filters-mosaic", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Mosaic..."), NULL, { NULL }, NULL,
|
|
"gegl:mosaic",
|
|
PIKA_HELP_FILTER_MOSAIC },
|
|
|
|
{ "filters-motion-blur-circular", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Circular Motion Blur..."), NULL, { NULL }, NULL,
|
|
"gegl:motion-blur-circular",
|
|
PIKA_HELP_FILTER_MOTION_BLUR_CIRCULAR },
|
|
|
|
{ "filters-motion-blur-linear", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Linear Motion Blur..."), NULL, { NULL }, NULL,
|
|
"gegl:motion-blur-linear",
|
|
PIKA_HELP_FILTER_MOTION_BLUR_LINEAR },
|
|
|
|
{ "filters-motion-blur-zoom", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Zoom Motion Blur..."), NULL, { NULL }, NULL,
|
|
"gegl:motion-blur-zoom",
|
|
PIKA_HELP_FILTER_MOTION_BLUR_ZOOM },
|
|
|
|
{ "filters-noise-cell", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Cell Noise..."), NULL, { NULL }, NULL,
|
|
"gegl:cell-noise",
|
|
PIKA_HELP_FILTER_NOISE_CELL },
|
|
|
|
{ "filters-newsprint", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Newsprint..."), NULL, { NULL }, NULL,
|
|
"gegl:newsprint",
|
|
PIKA_HELP_FILTER_NEWSPRINT },
|
|
|
|
{ "filters-noise-cie-lch", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_CIE lch Noise..."), NULL, { NULL }, NULL,
|
|
"gegl:noise-cie-lch",
|
|
PIKA_HELP_FILTER_NOISE_CIE_LCH },
|
|
|
|
{ "filters-noise-hsv", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "HS_V Noise..."), NULL, { NULL }, NULL,
|
|
"gegl:noise-hsv",
|
|
PIKA_HELP_FILTER_NOISE_HSV },
|
|
|
|
{ "filters-noise-hurl", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Hurl..."), NULL, { NULL }, NULL,
|
|
"gegl:noise-hurl",
|
|
PIKA_HELP_FILTER_NOISE_HURL },
|
|
|
|
{ "filters-noise-perlin", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Perlin _Noise..."), NULL, { NULL }, NULL,
|
|
"gegl:perlin-noise",
|
|
PIKA_HELP_FILTER_NOISE_PERLIN },
|
|
|
|
{ "filters-noise-pick", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Pick..."), NULL, { NULL }, NULL,
|
|
"gegl:noise-pick",
|
|
PIKA_HELP_FILTER_NOISE_PICK },
|
|
|
|
{ "filters-noise-rgb", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_RGB Noise..."), NULL, { NULL }, NULL,
|
|
"gegl:noise-rgb",
|
|
PIKA_HELP_FILTER_NOISE_RGB },
|
|
|
|
{ "filters-noise-reduction", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Noise R_eduction..."), NULL, { NULL }, NULL,
|
|
"gegl:noise-reduction",
|
|
PIKA_HELP_FILTER_NOISE_REDUCTION },
|
|
|
|
{ "filters-noise-simplex", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Simplex Noise..."), NULL, { NULL }, NULL,
|
|
"gegl:simplex-noise",
|
|
PIKA_HELP_FILTER_NOISE_SIMPLEX },
|
|
|
|
{ "filters-noise-slur", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Slur..."), NULL, { NULL }, NULL,
|
|
"gegl:noise-slur",
|
|
PIKA_HELP_FILTER_NOISE_SLUR },
|
|
|
|
{ "filters-noise-solid", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Solid Noise..."), NULL, { NULL }, NULL,
|
|
"gegl:noise-solid",
|
|
PIKA_HELP_FILTER_NOISE_SOLID },
|
|
|
|
{ "filters-noise-spread", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Sp_read..."), NULL, { NULL }, NULL,
|
|
"gegl:noise-spread",
|
|
PIKA_HELP_FILTER_NOISE_SPREAD },
|
|
|
|
{ "filters-normal-map", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Normal Map..."), NULL, { NULL }, NULL,
|
|
"gegl:normal-map",
|
|
PIKA_HELP_FILTER_NORMAL_MAP },
|
|
|
|
{ "filters-offset", PIKA_ICON_TOOL_OFFSET,
|
|
NC_("filters-action", "_Offset..."), NULL, { "<primary><shift>O", NULL }, NULL,
|
|
"pika:offset",
|
|
PIKA_HELP_TOOL_OFFSET },
|
|
|
|
{ "filters-oilify", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Oili_fy..."), NULL, { NULL }, NULL,
|
|
"gegl:oilify",
|
|
PIKA_HELP_FILTER_OILIFY },
|
|
|
|
{ "filters-panorama-projection", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Panorama Projection..."), NULL, { NULL }, NULL,
|
|
"gegl:panorama-projection",
|
|
PIKA_HELP_FILTER_PANORAMA_PROJECTION },
|
|
|
|
{ "filters-photocopy", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Photocopy..."), NULL, { NULL }, NULL,
|
|
"gegl:photocopy",
|
|
PIKA_HELP_FILTER_PHOTOCOPY },
|
|
|
|
{ "filters-pixelize", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Pixelize..."), NULL, { NULL }, NULL,
|
|
"gegl:pixelize",
|
|
PIKA_HELP_FILTER_PIXELIZE },
|
|
|
|
{ "filters-plasma", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Plasma..."), NULL, { NULL }, NULL,
|
|
"gegl:plasma",
|
|
PIKA_HELP_FILTER_PLASMA },
|
|
|
|
{ "filters-polar-coordinates", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "P_olar Coordinates..."), NULL, { NULL }, NULL,
|
|
"gegl:polar-coordinates",
|
|
PIKA_HELP_FILTER_POLAR_COORDINATES },
|
|
|
|
{ "filters-posterize", PIKA_ICON_TOOL_POSTERIZE,
|
|
NC_("filters-action", "_Posterize..."), NULL, { NULL }, NULL,
|
|
"pika:posterize",
|
|
PIKA_HELP_FILTER_POSTERIZE },
|
|
|
|
{ "filters-recursive-transform", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Recursive Transform..."), NULL, { NULL }, NULL,
|
|
"gegl:recursive-transform",
|
|
PIKA_HELP_FILTER_RECURSIVE_TRANSFORM },
|
|
|
|
{ "filters-red-eye-removal", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Red Eye Removal..."), NULL, { NULL }, NULL,
|
|
"gegl:red-eye-removal",
|
|
PIKA_HELP_FILTER_RED_EYE_REMOVAL },
|
|
|
|
{ "filters-reinhard-2005", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Reinhard 2005..."), NULL, { NULL }, NULL,
|
|
"gegl:reinhard05",
|
|
PIKA_HELP_FILTER_REINHARD_2005 },
|
|
|
|
{ "filters-rgb-clip", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "RGB _Clip..."), NULL, { NULL }, NULL,
|
|
"gegl:rgb-clip",
|
|
PIKA_HELP_FILTER_RGB_CLIP },
|
|
|
|
{ "filters-ripple", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Ripple..."), NULL, { NULL }, NULL,
|
|
"gegl:ripple",
|
|
PIKA_HELP_FILTER_RIPPLE },
|
|
|
|
{ "filters-saturation", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Sat_uration..."), NULL, { NULL }, NULL,
|
|
"gegl:saturation",
|
|
PIKA_HELP_FILTER_SATURATION },
|
|
|
|
{ "filters-semi-flatten", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Semi-Flatten..."), NULL, { NULL }, NULL,
|
|
"pika:semi-flatten",
|
|
PIKA_HELP_FILTER_SEMI_FLATTEN },
|
|
|
|
{ "filters-sepia", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Sepia..."), NULL, { NULL }, NULL,
|
|
"gegl:sepia",
|
|
PIKA_HELP_FILTER_SEPIA },
|
|
|
|
{ "filters-shadows-highlights", PIKA_ICON_TOOL_SHADOWS_HIGHLIGHTS,
|
|
NC_("filters-action", "S_hadows-Highlights..."), NULL, { NULL }, NULL,
|
|
"gegl:shadows-highlights",
|
|
PIKA_HELP_FILTER_SHADOWS_HIGHLIGHTS },
|
|
|
|
{ "filters-shift", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Shift..."), NULL, { NULL }, NULL,
|
|
"gegl:shift",
|
|
PIKA_HELP_FILTER_SHIFT },
|
|
|
|
{ "filters-sinus", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Sinus..."), NULL, { NULL }, NULL,
|
|
"gegl:sinus",
|
|
PIKA_HELP_FILTER_SINUS },
|
|
|
|
{ "filters-slic", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Simple Linear Iterative Clustering..."), NULL, { NULL }, NULL,
|
|
"gegl:slic",
|
|
PIKA_HELP_FILTER_SLIC },
|
|
|
|
{ "filters-snn-mean", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Symmetric Nearest Neighbor..."), NULL, { NULL }, NULL,
|
|
"gegl:snn-mean",
|
|
PIKA_HELP_FILTER_SNN_MEAN },
|
|
|
|
{ "filters-softglow", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Softglow..."), NULL, { NULL }, NULL,
|
|
"gegl:softglow",
|
|
PIKA_HELP_FILTER_SOFTGLOW },
|
|
|
|
{ "filters-spherize", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Spheri_ze..."), NULL, { NULL }, NULL,
|
|
"gegl:spherize",
|
|
PIKA_HELP_FILTER_SPHERIZE },
|
|
|
|
{ "filters-spiral", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "S_piral..."), NULL, { NULL }, NULL,
|
|
"gegl:spiral",
|
|
PIKA_HELP_FILTER_SPIRAL },
|
|
|
|
{ "filters-stretch-contrast", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Stretch Contrast..."), NULL, { NULL }, NULL,
|
|
"gegl:stretch-contrast",
|
|
PIKA_HELP_FILTER_STRETCH_CONTRAST },
|
|
|
|
{ "filters-stress", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Stress..."), NULL, { NULL }, NULL,
|
|
"gegl:stress",
|
|
PIKA_HELP_FILTER_STRESS },
|
|
|
|
{ "filters-supernova", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Super_nova..."), NULL, { NULL }, NULL,
|
|
"gegl:supernova",
|
|
PIKA_HELP_FILTER_SUPERNOVA },
|
|
|
|
{ "filters-threshold", PIKA_ICON_TOOL_THRESHOLD,
|
|
NC_("filters-action", "_Threshold..."), NULL, { NULL }, NULL,
|
|
"pika:threshold",
|
|
PIKA_HELP_TOOL_THRESHOLD },
|
|
|
|
{ "filters-threshold-alpha", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Threshold Alpha..."), NULL, { NULL }, NULL,
|
|
"pika:threshold-alpha",
|
|
PIKA_HELP_FILTER_THRESHOLD_ALPHA },
|
|
|
|
{ "filters-tile-glass", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Glass Tile..."), NULL, { NULL }, NULL,
|
|
"gegl:tile-glass",
|
|
PIKA_HELP_FILTER_TILE_GLASS },
|
|
|
|
{ "filters-tile-paper", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Paper Tile..."), NULL, { NULL }, NULL,
|
|
"gegl:tile-paper",
|
|
PIKA_HELP_FILTER_TILE_PAPER },
|
|
|
|
{ "filters-tile-seamless", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Tile Seamless..."), NULL, { NULL }, NULL,
|
|
"gegl:tile-seamless",
|
|
PIKA_HELP_FILTER_TILE_SEAMLESS },
|
|
|
|
{ "filters-unsharp-mask", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Sharpen (_Unsharp Mask)..."), NULL, { NULL }, NULL,
|
|
"gegl:unsharp-mask",
|
|
PIKA_HELP_FILTER_UNSHARP_MASK },
|
|
|
|
{ "filters-value-propagate", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Value Propagate..."), NULL, { NULL }, NULL,
|
|
"gegl:value-propagate",
|
|
PIKA_HELP_FILTER_VALUE_PROPAGATE },
|
|
|
|
{ "filters-variable-blur", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Variable Blur..."), NULL, { NULL }, NULL,
|
|
"gegl:variable-blur",
|
|
PIKA_HELP_FILTER_VARIABLE_BLUR },
|
|
|
|
{ "filters-video-degradation", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "Vi_deo Degradation..."), NULL, { NULL }, NULL,
|
|
"gegl:video-degradation",
|
|
PIKA_HELP_FILTER_VIDEO_DEGRADATION },
|
|
|
|
{ "filters-vignette", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Vignette..."), NULL, { NULL }, NULL,
|
|
"gegl:vignette",
|
|
PIKA_HELP_FILTER_VIGNETTE },
|
|
|
|
{ "filters-waterpixels", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Waterpixels..."), NULL, { NULL }, NULL,
|
|
"gegl:waterpixels",
|
|
PIKA_HELP_FILTER_WATERPIXELS },
|
|
|
|
{ "filters-waves", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "_Waves..."), NULL, { NULL }, NULL,
|
|
"gegl:waves",
|
|
PIKA_HELP_FILTER_WAVES },
|
|
|
|
{ "filters-whirl-pinch", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "W_hirl and Pinch..."), NULL, { NULL }, NULL,
|
|
"gegl:whirl-pinch",
|
|
PIKA_HELP_FILTER_WHIRL_PINCH },
|
|
|
|
{ "filters-wind", PIKA_ICON_GEGL,
|
|
NC_("filters-action", "W_ind..."), NULL, { NULL }, NULL,
|
|
"gegl:wind",
|
|
PIKA_HELP_FILTER_WIND }
|
|
};
|
|
|
|
static const PikaEnumActionEntry filters_repeat_actions[] =
|
|
{
|
|
{ "filters-repeat", PIKA_ICON_SYSTEM_RUN,
|
|
NC_("filters-action", "Re_peat Last"), NULL, { "<primary>F", NULL },
|
|
NC_("filters-action",
|
|
"Rerun the last used filter using the same settings"),
|
|
PIKA_RUN_WITH_LAST_VALS, FALSE,
|
|
PIKA_HELP_FILTER_REPEAT },
|
|
|
|
{ "filters-reshow", PIKA_ICON_DIALOG_RESHOW_FILTER,
|
|
NC_("filters-action", "R_e-Show Last"), NULL, { "<primary><shift>F", NULL },
|
|
NC_("filters-action", "Show the last used filter dialog again"),
|
|
PIKA_RUN_INTERACTIVE, FALSE,
|
|
PIKA_HELP_FILTER_RESHOW }
|
|
};
|
|
|
|
|
|
void
|
|
filters_actions_setup (PikaActionGroup *group)
|
|
{
|
|
PikaProcedureActionEntry *entries;
|
|
gint n_entries;
|
|
gint i;
|
|
GList *op_classes;
|
|
GList *iter;
|
|
GStrvBuilder *gegl_actions;
|
|
|
|
pika_action_group_add_string_actions (group, "filters-action",
|
|
filters_actions,
|
|
G_N_ELEMENTS (filters_actions),
|
|
filters_apply_cmd_callback);
|
|
filters_actions_set_tooltips (group, filters_actions,
|
|
G_N_ELEMENTS (filters_actions));
|
|
|
|
pika_action_group_add_string_actions (group, "filters-action",
|
|
filters_settings_actions,
|
|
G_N_ELEMENTS (filters_settings_actions),
|
|
filters_apply_cmd_callback);
|
|
filters_actions_set_tooltips (group, filters_settings_actions,
|
|
G_N_ELEMENTS (filters_settings_actions));
|
|
|
|
pika_action_group_add_string_actions (group, "filters-action",
|
|
filters_interactive_actions,
|
|
G_N_ELEMENTS (filters_interactive_actions),
|
|
filters_apply_interactive_cmd_callback);
|
|
filters_actions_set_tooltips (group, filters_interactive_actions,
|
|
G_N_ELEMENTS (filters_interactive_actions));
|
|
|
|
gegl_actions = g_strv_builder_new ();
|
|
op_classes = pika_gegl_get_op_classes ();
|
|
|
|
for (iter = op_classes; iter; iter = iter->next)
|
|
{
|
|
GeglOperationClass *op_class = GEGL_OPERATION_CLASS (iter->data);
|
|
PikaStringActionEntry entry = { 0, };
|
|
gchar *formatted_op_name;
|
|
gchar *action_name;
|
|
const gchar *title;
|
|
const gchar *op_name;
|
|
gchar *label;
|
|
|
|
formatted_op_name = g_strdup (op_class->name);
|
|
pika_make_valid_action_name (formatted_op_name);
|
|
action_name = g_strdup_printf ("filters-%s", formatted_op_name);
|
|
i = 2;
|
|
while (pika_action_group_get_action (group, action_name) != NULL)
|
|
{
|
|
/* In the off-chance that after formatting to a valid action name, 2
|
|
* operations end up generating the same action name. Typically we
|
|
* don't want a third-party operation called "my-op" to have the same
|
|
* action name than "my_op" (which is to say that one will be
|
|
* overrided by the other).
|
|
*/
|
|
g_free (action_name);
|
|
action_name = g_strdup_printf ("filters-%s-%d", formatted_op_name, i++);
|
|
}
|
|
g_free (formatted_op_name);
|
|
|
|
title = gegl_operation_class_get_key (op_class, "title");
|
|
op_name = op_class->name;
|
|
|
|
if (g_str_has_prefix (op_name, "gegl:"))
|
|
op_name += strlen ("gegl:");
|
|
|
|
if (title)
|
|
label = g_strdup_printf ("%s (%s)", title, op_name);
|
|
else
|
|
label = g_strdup (op_name);
|
|
|
|
entry.name = action_name;
|
|
entry.icon_name = PIKA_ICON_GEGL;
|
|
entry.label = label;
|
|
entry.tooltip = gegl_operation_class_get_key (op_class, "description");
|
|
entry.value = op_class->name;
|
|
entry.help_id = PIKA_HELP_TOOL_GEGL;
|
|
|
|
pika_action_group_add_string_actions (group, "filters-action",
|
|
&entry, 1,
|
|
filters_apply_interactive_cmd_callback);
|
|
|
|
if (gegl_operation_class_get_key (op_class, "pika:menu-label"))
|
|
{
|
|
PikaAction *action;
|
|
|
|
action = pika_action_group_get_action (group, action_name);
|
|
|
|
pika_action_set_short_label (action,
|
|
gegl_operation_class_get_key (op_class,
|
|
"pika:menu-label"));
|
|
}
|
|
else if (title)
|
|
{
|
|
PikaAction *action;
|
|
/* TRANSLATORS: %s is the title of a GEGL operation (filter), after
|
|
* which we append "..." as the standardized labelling to indicate
|
|
* that this action raises a dialog.
|
|
*/
|
|
gchar *short_label = g_strdup_printf (_("%s..."), title);
|
|
|
|
action = pika_action_group_get_action (group, action_name);
|
|
pika_action_set_short_label (action, short_label);
|
|
g_free (short_label);
|
|
}
|
|
|
|
g_strv_builder_add (gegl_actions, action_name);
|
|
|
|
g_free (label);
|
|
g_free (action_name);
|
|
}
|
|
|
|
g_object_set_data_full (G_OBJECT (group),
|
|
"filters-group-generated-gegl-actions",
|
|
g_strv_builder_end (gegl_actions),
|
|
(GDestroyNotify) g_strfreev);
|
|
g_strv_builder_unref (gegl_actions);
|
|
g_list_free (op_classes);
|
|
|
|
pika_action_group_add_enum_actions (group, "filters-action",
|
|
filters_repeat_actions,
|
|
G_N_ELEMENTS (filters_repeat_actions),
|
|
filters_repeat_cmd_callback);
|
|
|
|
n_entries = pika_filter_history_size (group->pika);
|
|
|
|
entries = g_new0 (PikaProcedureActionEntry, n_entries);
|
|
|
|
for (i = 0; i < n_entries; i++)
|
|
{
|
|
entries[i].name = g_strdup_printf ("filters-recent-%02d", i + 1);
|
|
entries[i].icon_name = NULL;
|
|
entries[i].label = "";
|
|
entries[i].tooltip = NULL;
|
|
entries[i].procedure = NULL;
|
|
entries[i].help_id = PIKA_HELP_FILTER_RESHOW;
|
|
}
|
|
|
|
pika_action_group_add_procedure_actions (group, entries, n_entries,
|
|
filters_history_cmd_callback);
|
|
|
|
for (i = 0; i < n_entries; i++)
|
|
{
|
|
pika_action_group_set_action_visible (group, entries[i].name, FALSE);
|
|
g_free ((gchar *) entries[i].name);
|
|
}
|
|
|
|
g_free (entries);
|
|
|
|
g_signal_connect_object (group->pika, "filter-history-changed",
|
|
G_CALLBACK (filters_actions_history_changed),
|
|
group, 0);
|
|
|
|
filters_actions_history_changed (group->pika, group);
|
|
}
|
|
|
|
void
|
|
filters_actions_update (PikaActionGroup *group,
|
|
gpointer data)
|
|
{
|
|
PikaImage *image;
|
|
gboolean writable = FALSE;
|
|
gboolean gray = FALSE;
|
|
gboolean alpha = FALSE;
|
|
gboolean supports_alpha = FALSE;
|
|
|
|
image = action_data_get_image (data);
|
|
|
|
if (image)
|
|
{
|
|
GList *drawables;
|
|
|
|
drawables = pika_image_get_selected_drawables (image);
|
|
|
|
if (g_list_length (drawables) == 1)
|
|
{
|
|
PikaDrawable *drawable = drawables->data;
|
|
PikaItem *item;
|
|
|
|
gray = pika_drawable_is_gray (drawable);
|
|
alpha = pika_drawable_has_alpha (drawable);
|
|
supports_alpha = pika_drawable_supports_alpha (drawable);
|
|
|
|
if (PIKA_IS_LAYER_MASK (drawable))
|
|
item = PIKA_ITEM (pika_layer_mask_get_layer (PIKA_LAYER_MASK (drawable)));
|
|
else
|
|
item = PIKA_ITEM (drawable);
|
|
|
|
writable = ! pika_item_is_content_locked (item, NULL);
|
|
|
|
if (pika_viewable_get_children (PIKA_VIEWABLE (drawable)))
|
|
writable = FALSE;
|
|
}
|
|
|
|
g_list_free (drawables);
|
|
}
|
|
|
|
#define SET_SENSITIVE(action,condition) \
|
|
pika_action_group_set_action_sensitive (group, action, (condition) != 0, NULL)
|
|
|
|
SET_SENSITIVE ("filters-alien-map", writable);
|
|
SET_SENSITIVE ("filters-antialias", writable);
|
|
SET_SENSITIVE ("filters-apply-canvas", writable);
|
|
SET_SENSITIVE ("filters-apply-lens", writable);
|
|
SET_SENSITIVE ("filters-bayer-matrix", writable);
|
|
SET_SENSITIVE ("filters-bloom", writable);
|
|
SET_SENSITIVE ("filters-brightness-contrast", writable);
|
|
SET_SENSITIVE ("filters-bump-map", writable);
|
|
SET_SENSITIVE ("filters-c2g", writable && !gray);
|
|
SET_SENSITIVE ("filters-cartoon", writable);
|
|
SET_SENSITIVE ("filters-channel-mixer", writable);
|
|
SET_SENSITIVE ("filters-checkerboard", writable);
|
|
SET_SENSITIVE ("filters-color-balance", writable && !gray);
|
|
SET_SENSITIVE ("filters-color-enhance", writable && !gray);
|
|
SET_SENSITIVE ("filters-color-exchange", writable);
|
|
SET_SENSITIVE ("filters-colorize", writable && !gray);
|
|
SET_SENSITIVE ("filters-dither", writable);
|
|
SET_SENSITIVE ("filters-color-rotate", writable);
|
|
SET_SENSITIVE ("filters-color-temperature", writable && !gray);
|
|
SET_SENSITIVE ("filters-color-to-alpha", writable && supports_alpha);
|
|
SET_SENSITIVE ("filters-component-extract", writable);
|
|
SET_SENSITIVE ("filters-convolution-matrix", writable);
|
|
SET_SENSITIVE ("filters-cubism", writable);
|
|
SET_SENSITIVE ("filters-curves", writable);
|
|
SET_SENSITIVE ("filters-deinterlace", writable);
|
|
SET_SENSITIVE ("filters-desaturate", writable && !gray);
|
|
SET_SENSITIVE ("filters-difference-of-gaussians", writable);
|
|
SET_SENSITIVE ("filters-diffraction-patterns", writable);
|
|
SET_SENSITIVE ("filters-dilate", writable);
|
|
SET_SENSITIVE ("filters-displace", writable);
|
|
SET_SENSITIVE ("filters-distance-map", writable);
|
|
SET_SENSITIVE ("filters-dropshadow", writable && alpha);
|
|
SET_SENSITIVE ("filters-edge", writable);
|
|
SET_SENSITIVE ("filters-edge-laplace", writable);
|
|
SET_SENSITIVE ("filters-edge-neon", writable);
|
|
SET_SENSITIVE ("filters-edge-sobel", writable);
|
|
SET_SENSITIVE ("filters-emboss", writable);
|
|
SET_SENSITIVE ("filters-engrave", writable);
|
|
SET_SENSITIVE ("filters-erode", writable);
|
|
SET_SENSITIVE ("filters-exposure", writable);
|
|
SET_SENSITIVE ("filters-fattal-2002", writable);
|
|
SET_SENSITIVE ("filters-focus-blur", writable);
|
|
SET_SENSITIVE ("filters-fractal-trace", writable);
|
|
SET_SENSITIVE ("filters-gaussian-blur", writable);
|
|
SET_SENSITIVE ("filters-gaussian-blur-selective", writable);
|
|
SET_SENSITIVE ("filters-gegl-graph", writable);
|
|
SET_SENSITIVE ("filters-grid", writable);
|
|
SET_SENSITIVE ("filters-high-pass", writable);
|
|
SET_SENSITIVE ("filters-hue-chroma", writable);
|
|
SET_SENSITIVE ("filters-hue-saturation", writable && !gray);
|
|
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-blur", writable);
|
|
SET_SENSITIVE ("filters-lens-distortion", writable);
|
|
SET_SENSITIVE ("filters-lens-flare", writable);
|
|
SET_SENSITIVE ("filters-levels", writable);
|
|
SET_SENSITIVE ("filters-linear-sinusoid", writable);
|
|
SET_SENSITIVE ("filters-little-planet", writable);
|
|
SET_SENSITIVE ("filters-long-shadow", writable && alpha);
|
|
SET_SENSITIVE ("filters-mantiuk-2006", writable);
|
|
SET_SENSITIVE ("filters-maze", writable);
|
|
SET_SENSITIVE ("filters-mean-curvature-blur", writable);
|
|
SET_SENSITIVE ("filters-median-blur", writable);
|
|
SET_SENSITIVE ("filters-mono-mixer", writable && !gray);
|
|
SET_SENSITIVE ("filters-mosaic", writable);
|
|
SET_SENSITIVE ("filters-motion-blur-circular", writable);
|
|
SET_SENSITIVE ("filters-motion-blur-linear", writable);
|
|
SET_SENSITIVE ("filters-motion-blur-zoom", writable);
|
|
SET_SENSITIVE ("filters-newsprint", writable);
|
|
SET_SENSITIVE ("filters-noise-cell", writable);
|
|
SET_SENSITIVE ("filters-noise-cie-lch", writable);
|
|
SET_SENSITIVE ("filters-noise-hsv", writable && !gray);
|
|
SET_SENSITIVE ("filters-noise-hurl", writable);
|
|
SET_SENSITIVE ("filters-noise-perlin", writable);
|
|
SET_SENSITIVE ("filters-noise-pick", writable);
|
|
SET_SENSITIVE ("filters-noise-reduction", writable);
|
|
SET_SENSITIVE ("filters-noise-rgb", writable);
|
|
SET_SENSITIVE ("filters-noise-simplex", writable);
|
|
SET_SENSITIVE ("filters-noise-slur", writable);
|
|
SET_SENSITIVE ("filters-noise-solid", writable);
|
|
SET_SENSITIVE ("filters-noise-spread", writable);
|
|
SET_SENSITIVE ("filters-normal-map", writable);
|
|
SET_SENSITIVE ("filters-offset", writable);
|
|
SET_SENSITIVE ("filters-oilify", writable);
|
|
SET_SENSITIVE ("filters-panorama-projection", writable);
|
|
SET_SENSITIVE ("filters-photocopy", writable);
|
|
SET_SENSITIVE ("filters-pixelize", writable);
|
|
SET_SENSITIVE ("filters-plasma", writable);
|
|
SET_SENSITIVE ("filters-polar-coordinates", writable);
|
|
SET_SENSITIVE ("filters-posterize", writable);
|
|
SET_SENSITIVE ("filters-recursive-transform", writable);
|
|
SET_SENSITIVE ("filters-red-eye-removal", writable && !gray);
|
|
SET_SENSITIVE ("filters-reinhard-2005", writable);
|
|
SET_SENSITIVE ("filters-rgb-clip", writable);
|
|
SET_SENSITIVE ("filters-ripple", writable);
|
|
SET_SENSITIVE ("filters-saturation", writable && !gray);
|
|
SET_SENSITIVE ("filters-semi-flatten", writable && alpha);
|
|
SET_SENSITIVE ("filters-sepia", writable && !gray);
|
|
SET_SENSITIVE ("filters-shadows-highlights", writable);
|
|
SET_SENSITIVE ("filters-shift", writable);
|
|
SET_SENSITIVE ("filters-sinus", writable);
|
|
SET_SENSITIVE ("filters-slic", writable);
|
|
SET_SENSITIVE ("filters-snn-mean", writable);
|
|
SET_SENSITIVE ("filters-softglow", writable);
|
|
SET_SENSITIVE ("filters-spherize", writable);
|
|
SET_SENSITIVE ("filters-spiral", writable);
|
|
SET_SENSITIVE ("filters-stretch-contrast", writable);
|
|
SET_SENSITIVE ("filters-stretch-contrast-hsv", writable);
|
|
SET_SENSITIVE ("filters-stress", writable);
|
|
SET_SENSITIVE ("filters-supernova", writable);
|
|
SET_SENSITIVE ("filters-threshold", writable);
|
|
SET_SENSITIVE ("filters-threshold-alpha", writable && alpha);
|
|
SET_SENSITIVE ("filters-tile-glass", writable);
|
|
SET_SENSITIVE ("filters-tile-paper", writable);
|
|
SET_SENSITIVE ("filters-tile-seamless", writable);
|
|
SET_SENSITIVE ("filters-unsharp-mask", writable);
|
|
SET_SENSITIVE ("filters-value-propagate", writable);
|
|
SET_SENSITIVE ("filters-variable-blur", writable);
|
|
SET_SENSITIVE ("filters-video-degradation", writable);
|
|
SET_SENSITIVE ("filters-vignette", writable);
|
|
SET_SENSITIVE ("filters-waterpixels", writable);
|
|
SET_SENSITIVE ("filters-waves", writable);
|
|
SET_SENSITIVE ("filters-whirl-pinch", writable);
|
|
SET_SENSITIVE ("filters-wind", writable);
|
|
|
|
#undef SET_SENSITIVE
|
|
|
|
{
|
|
PikaProcedure *proc = pika_filter_history_nth (group->pika, 0);
|
|
const gchar *reason = NULL;
|
|
gint i;
|
|
|
|
if (proc &&
|
|
pika_procedure_get_sensitive (proc, PIKA_OBJECT (image), &reason))
|
|
{
|
|
pika_action_group_set_action_sensitive (group, "filters-repeat", TRUE, NULL);
|
|
pika_action_group_set_action_sensitive (group, "filters-reshow", TRUE, NULL);
|
|
}
|
|
else
|
|
{
|
|
pika_action_group_set_action_sensitive (group, "filters-repeat", FALSE, reason);
|
|
pika_action_group_set_action_sensitive (group, "filters-reshow", FALSE, reason);
|
|
}
|
|
|
|
for (i = 0; i < pika_filter_history_length (group->pika); i++)
|
|
{
|
|
gchar *name = g_strdup_printf ("filters-recent-%02d", i + 1);
|
|
gboolean sensitive;
|
|
|
|
proc = pika_filter_history_nth (group->pika, i);
|
|
|
|
reason = NULL;
|
|
sensitive = pika_procedure_get_sensitive (proc, PIKA_OBJECT (image),
|
|
&reason);
|
|
|
|
pika_action_group_set_action_sensitive (group, name, sensitive, reason);
|
|
|
|
g_free (name);
|
|
}
|
|
}
|
|
}
|
|
|
|
static void
|
|
filters_actions_set_tooltips (PikaActionGroup *group,
|
|
const PikaStringActionEntry *entries,
|
|
gint n_entries)
|
|
{
|
|
gint i;
|
|
|
|
for (i = 0; i < n_entries; i++)
|
|
{
|
|
const PikaStringActionEntry *entry = entries + i;
|
|
const gchar *description;
|
|
|
|
description = gegl_operation_get_key (entry->value, "description");
|
|
|
|
if (description)
|
|
pika_action_group_set_action_tooltip (group, entry->name,
|
|
description);
|
|
}
|
|
}
|
|
|
|
static PikaActionGroup *
|
|
filters_actions_get_plug_in_group (PikaActionGroup *group)
|
|
{
|
|
GList *list;
|
|
|
|
for (list = pika_ui_managers_from_name ("<Image>");
|
|
list;
|
|
list = g_list_next (list))
|
|
{
|
|
PikaUIManager *manager = list->data;
|
|
|
|
/* if this is our UI manager */
|
|
if (pika_ui_manager_get_action_group (manager, "filters") == group)
|
|
return pika_ui_manager_get_action_group (manager, "plug-in");
|
|
}
|
|
|
|
/* this happens during initial UI manager construction */
|
|
return NULL;
|
|
}
|
|
|
|
static void
|
|
filters_actions_history_changed (Pika *pika,
|
|
PikaActionGroup *group)
|
|
{
|
|
PikaProcedure *proc;
|
|
PikaActionGroup *plug_in_group;
|
|
gint i;
|
|
|
|
plug_in_group = filters_actions_get_plug_in_group (group);
|
|
|
|
proc = pika_filter_history_nth (pika, 0);
|
|
|
|
if (proc)
|
|
{
|
|
PikaAction *actual_action = NULL;
|
|
const gchar *label;
|
|
gchar *repeat;
|
|
gchar *reshow;
|
|
const gchar *reason = NULL;
|
|
gboolean sensitive = FALSE;
|
|
|
|
label = pika_procedure_get_label (proc);
|
|
|
|
repeat = g_strdup_printf (_("Re_peat \"%s\""), label);
|
|
reshow = g_strdup_printf (_("R_e-Show \"%s\""), label);
|
|
|
|
pika_action_group_set_action_label (group, "filters-repeat", repeat);
|
|
pika_action_group_set_action_label (group, "filters-reshow", reshow);
|
|
|
|
g_free (repeat);
|
|
g_free (reshow);
|
|
|
|
if (g_str_has_prefix (pika_object_get_name (proc), "filters-"))
|
|
{
|
|
actual_action =
|
|
pika_action_group_get_action (group,
|
|
pika_object_get_name (proc));
|
|
}
|
|
else if (plug_in_group)
|
|
{
|
|
/* copy the sensitivity of the plug-in procedure's actual
|
|
* action instead of calling filters_actions_update()
|
|
* because doing the latter would set the sensitivity of
|
|
* this image's action on all images' actions. See bug
|
|
* #517683.
|
|
*/
|
|
actual_action =
|
|
pika_action_group_get_action (plug_in_group,
|
|
pika_object_get_name (proc));
|
|
}
|
|
|
|
if (actual_action)
|
|
sensitive = pika_action_get_sensitive (actual_action, &reason);
|
|
|
|
pika_action_group_set_action_sensitive (group, "filters-repeat",
|
|
sensitive, reason);
|
|
pika_action_group_set_action_sensitive (group, "filters-reshow",
|
|
sensitive, reason);
|
|
}
|
|
else
|
|
{
|
|
pika_action_group_set_action_label (group, "filters-repeat",
|
|
_("Repeat Last"));
|
|
pika_action_group_set_action_label (group, "filters-reshow",
|
|
_("Re-Show Last"));
|
|
|
|
pika_action_group_set_action_sensitive (group, "filters-repeat",
|
|
FALSE, _("No last used filters"));
|
|
pika_action_group_set_action_sensitive (group, "filters-reshow",
|
|
FALSE, _("No last used filters"));
|
|
}
|
|
|
|
for (i = 0; i < pika_filter_history_length (pika); i++)
|
|
{
|
|
PikaAction *action;
|
|
PikaAction *actual_action = NULL;
|
|
const gchar *label;
|
|
gchar *name;
|
|
gboolean sensitive = FALSE;
|
|
|
|
name = g_strdup_printf ("filters-recent-%02d", i + 1);
|
|
action = pika_action_group_get_action (group, name);
|
|
g_free (name);
|
|
|
|
proc = pika_filter_history_nth (pika, i);
|
|
|
|
label = pika_procedure_get_menu_label (proc);
|
|
|
|
if (g_str_has_prefix (pika_object_get_name (proc), "filters-"))
|
|
{
|
|
actual_action =
|
|
pika_action_group_get_action (group,
|
|
pika_object_get_name (proc));
|
|
}
|
|
else if (plug_in_group)
|
|
{
|
|
/* see comment above */
|
|
actual_action =
|
|
pika_action_group_get_action (plug_in_group,
|
|
pika_object_get_name (proc));
|
|
}
|
|
|
|
if (actual_action)
|
|
sensitive = pika_action_get_sensitive (actual_action, NULL);
|
|
|
|
g_object_set (action,
|
|
"visible", TRUE,
|
|
"sensitive", sensitive,
|
|
"procedure", proc,
|
|
"label", label,
|
|
"icon-name", pika_viewable_get_icon_name (PIKA_VIEWABLE (proc)),
|
|
"tooltip", pika_procedure_get_blurb (proc),
|
|
NULL);
|
|
}
|
|
|
|
for (; i < pika_filter_history_size (pika); i++)
|
|
{
|
|
PikaAction *action;
|
|
gchar *name = g_strdup_printf ("filters-recent-%02d", i + 1);
|
|
|
|
action = pika_action_group_get_action (group, name);
|
|
g_free (name);
|
|
|
|
g_object_set (action,
|
|
"visible", FALSE,
|
|
"procedure", NULL,
|
|
NULL);
|
|
}
|
|
}
|