2022-07-15 10:50:36 -07:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
|
*
|
|
|
|
|
* script-fu-dialog.c
|
|
|
|
|
* Copyright (C) 2022 Lloyd Konneker
|
|
|
|
|
*
|
|
|
|
|
* 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 <libgimp/gimpui.h>
|
|
|
|
|
|
ScriptFu: fix #12150, activate apps (extension-script-fu and gimp) properly on MacOS
The gimp app and extension-script-fu (long-running)
are separate processes and "apps."
An app can be "active": in front and receiving GUI events.
As reported, on MacOS, when an extension-script-fu plugin yields,
the gimp app did not become active.
Also, on the second invocation of a plugin served by extension-script-fu,
the dialog could be hidden or require an extra click
because extension-script-fu was not active.
(Independently interpreted plugins did become active,
because it was a new process and gimpui_init activates on MacOS.)
On MacOS:
1. after the first dialog shown by extension-script-fu,
ensure subsequent calls to plugin make extension-script-fu active.
2. After a plugin yields, plugin manager ensure the Gimp app is active.
Note that this is done whenever a TEMPORARY procedure returns.
Most are calls to extension-script-fu plugins.
But some are also callbacks from Resource choosers running in the gimp app.
When they return, the gimp app remains active, and user must first click in
the plugin dialog to continue working.
Especially when the user clicks OK in a Resource Chooser, closing the chooser,
it would be nice if the plugin dialog became active.
That requires more, FUTURE development.
Special to MacOS: on Linux, "transient for foreign window" ensures this,
but that doesn't work on MacOS.
The fix is somewhat brute force and as simple as possible.
There is a more cooperative API for app activation on MacOS.
An app yields, and apps request, not force, self or other app be activated.
The fix does not use the cooperative API.
To do so would require a platform abstraction layer, in GIMP or Gtk.
The fix also sprinkles the code with #ifdefs.
That could be hidden if there were a platform abstraction layer PAL
The layer would be the greatest common denominator across platforms.
PAL methods would always be called in GIMP code,
but not do anything when the effect was accomplished another way.
For example "gimp_platform_request_app_active"
would request the app was active,
but do nothing on Linux where that is ensured by "transient for."
2024-12-03 06:58:00 -08:00
|
|
|
#ifdef GDK_WINDOWING_QUARTZ
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-07-15 10:50:36 -07:00
|
|
|
#include "script-fu-types.h" /* SFScript */
|
|
|
|
|
#include "script-fu-script.h" /* get_title */
|
|
|
|
|
#include "script-fu-command.h"
|
|
|
|
|
|
|
|
|
|
#include "script-fu-dialog.h"
|
2024-02-01 08:29:50 -08:00
|
|
|
#include "script-fu-widgets-custom.h"
|
2022-07-15 10:50:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/* An informal class that shows a dialog for a script then runs the script.
|
|
|
|
|
* It is internal to libscriptfu.
|
|
|
|
|
*
|
|
|
|
|
* The dialog is modal for the script:
|
|
|
|
|
* OK button hides the dialog then runs the script once.
|
|
|
|
|
*
|
|
|
|
|
* The dialog is non-modal with respect to the GIMP app GUI, which remains responsive.
|
|
|
|
|
*
|
|
|
|
|
* When called from plugin extension-script-fu, the dialog is modal on the extension:
|
|
|
|
|
* although GIMP app continues responsive, a user choosing a menu item
|
|
|
|
|
* that is also implemented by a script and extension-script-fu
|
|
|
|
|
* will not show a dialog until the first called script finishes.
|
2024-09-20 13:59:11 -07:00
|
|
|
* TODO combine these paragraphs
|
|
|
|
|
* We don't prevent concurrent dialogs as in script-fu-interface.c.
|
|
|
|
|
* For extension-script-fu, Gimp is already preventing concurrent dialogs.
|
|
|
|
|
* For gimp-script-fu-interpreter, each plugin is a separate process
|
|
|
|
|
* so concurrent dialogs CAN occur.
|
|
|
|
|
*
|
|
|
|
|
* There is no progress widget in GimpProcedureDialog.
|
|
|
|
|
* Also, we don't need to update the progress in Gimp UI,
|
|
|
|
|
* because Gimp shows progress: the name of all called PDB procedures.
|
|
|
|
|
*
|
|
|
|
|
* Run dialog entails: create config, create dialog for config, show dialog, and return a config.
|
|
|
|
|
* The config has one property for each arg of the script.
|
|
|
|
|
* The dialog creates a widget for each such property of the config.
|
|
|
|
|
* Each property has a ParamSpec.
|
|
|
|
|
* Requires the procedure registered with args having ParamSpecs
|
|
|
|
|
* corresponding to SFType the author declared in script-fu-register call.
|
2022-07-15 10:50:36 -07:00
|
|
|
*/
|
|
|
|
|
|
2024-12-08 11:20:14 -08:00
|
|
|
#define DEBUG_CONFIG_PROPERTIES FALSE
|
2022-07-15 10:50:36 -07:00
|
|
|
|
|
|
|
|
#if DEBUG_CONFIG_PROPERTIES
|
|
|
|
|
static void
|
2023-05-20 16:10:29 -07:00
|
|
|
dump_properties (GimpProcedureConfig *config)
|
2022-07-15 10:50:36 -07:00
|
|
|
{
|
|
|
|
|
GParamSpec **pspecs;
|
|
|
|
|
guint n_pspecs;
|
|
|
|
|
|
|
|
|
|
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (config),
|
|
|
|
|
&n_pspecs);
|
|
|
|
|
for (guint i = 1; i < n_pspecs; i++)
|
|
|
|
|
g_printerr ("%s %s\n", pspecs[i]->name, G_PARAM_SPEC_TYPE_NAME (pspecs[i]));
|
|
|
|
|
g_free (pspecs);
|
|
|
|
|
}
|
2022-09-05 16:28:35 -07:00
|
|
|
|
|
|
|
|
static void
|
2023-10-15 10:22:32 -07:00
|
|
|
dump_objects (GimpProcedureConfig *config)
|
2022-09-05 16:28:35 -07:00
|
|
|
{
|
2023-10-15 10:22:32 -07:00
|
|
|
/* Check it will return non-null objects. */
|
2022-09-05 16:28:35 -07:00
|
|
|
GParamSpec **pspecs;
|
|
|
|
|
guint n_pspecs;
|
|
|
|
|
|
2023-10-15 10:22:32 -07:00
|
|
|
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (config), &n_pspecs);
|
2022-09-05 16:28:35 -07:00
|
|
|
|
2023-10-15 10:22:32 -07:00
|
|
|
/* config will have at least 1 property: "procedure". */
|
|
|
|
|
if (n_pspecs == 1)
|
2022-09-05 16:28:35 -07:00
|
|
|
{
|
|
|
|
|
g_debug ("config holds no values");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-15 10:22:32 -07:00
|
|
|
for (gint i = 1; i < n_pspecs; i++)
|
2022-09-05 16:28:35 -07:00
|
|
|
{
|
2023-10-15 10:22:32 -07:00
|
|
|
GParamSpec *pspec = pspecs[i];
|
|
|
|
|
GValue value = G_VALUE_INIT;
|
|
|
|
|
|
|
|
|
|
g_value_init (&value, pspec->value_type);
|
|
|
|
|
g_object_get_property (G_OBJECT (config), pspec->name, &value);
|
|
|
|
|
|
|
|
|
|
if (G_VALUE_HOLDS_OBJECT (&value))
|
|
|
|
|
if (g_value_get_object (&value) == NULL)
|
2022-09-05 16:28:35 -07:00
|
|
|
g_debug ("gvalue %d holds NULL object", i);
|
2023-10-15 10:22:32 -07:00
|
|
|
|
|
|
|
|
g_value_unset (&value);
|
2022-09-05 16:28:35 -07:00
|
|
|
}
|
2023-10-15 10:22:32 -07:00
|
|
|
g_free (pspecs);
|
2022-09-05 16:28:35 -07:00
|
|
|
}
|
|
|
|
|
|
2022-07-15 10:50:36 -07:00
|
|
|
#endif
|
|
|
|
|
|
2024-09-20 13:59:11 -07:00
|
|
|
/* Require conditions for running a dialog and interpreting.
|
|
|
|
|
* Returns false when a dialog cannot be shown.
|
2022-07-15 10:50:36 -07:00
|
|
|
*
|
2024-09-20 13:59:11 -07:00
|
|
|
* A caller should not call when config has no properties that are args
|
|
|
|
|
* of the procedure.
|
2022-07-15 10:50:36 -07:00
|
|
|
*/
|
2024-09-20 13:59:11 -07:00
|
|
|
static gboolean
|
|
|
|
|
sf_dialog_can_be_run (GimpProcedure *procedure,
|
2022-07-15 10:50:36 -07:00
|
|
|
SFScript *script,
|
2023-08-12 15:05:34 -07:00
|
|
|
GimpProcedureConfig *config)
|
2022-07-15 10:50:36 -07:00
|
|
|
{
|
2024-09-20 13:59:11 -07:00
|
|
|
guint n_specs;
|
2022-07-15 10:50:36 -07:00
|
|
|
|
2024-09-20 13:59:11 -07:00
|
|
|
if ( (! G_IS_OBJECT (procedure)) ||
|
|
|
|
|
(! GIMP_IS_PROCEDURE_CONFIG (config)) ||
|
|
|
|
|
script == NULL)
|
|
|
|
|
return FALSE;
|
2022-07-15 10:50:36 -07:00
|
|
|
|
2024-09-20 13:59:11 -07:00
|
|
|
/* A config always has property "procedure"
|
|
|
|
|
* It must have at least one more, an arg, else do not need a dialog.
|
|
|
|
|
*
|
|
|
|
|
* FUTURE: make a method of config.
|
|
|
|
|
*/
|
2023-08-12 15:05:34 -07:00
|
|
|
g_free (g_object_class_list_properties (G_OBJECT_GET_CLASS (config), &n_specs));
|
|
|
|
|
if (n_specs < 2)
|
2024-09-20 13:59:11 -07:00
|
|
|
return FALSE;
|
2022-07-15 10:50:36 -07:00
|
|
|
|
2024-09-20 13:59:11 -07:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
2022-07-15 10:50:36 -07:00
|
|
|
|
2024-09-21 09:03:42 -07:00
|
|
|
/* Omit leading "procedure" and "run-mode" properties.
|
|
|
|
|
* Caller must free the list.
|
|
|
|
|
*/
|
|
|
|
|
static GList*
|
|
|
|
|
sf_get_suffix_of_config_prop_names (GimpProcedureConfig *config)
|
|
|
|
|
{
|
|
|
|
|
guint n_specs;
|
|
|
|
|
GParamSpec ** pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (config), &n_specs);
|
|
|
|
|
GList *property_names = NULL;
|
|
|
|
|
|
|
|
|
|
for (guint i=2; i<n_specs; i++)
|
|
|
|
|
property_names = g_list_append (property_names, (void*) g_param_spec_get_name (pspecs[i]));
|
|
|
|
|
|
|
|
|
|
g_free (pspecs);
|
|
|
|
|
return property_names;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-20 13:59:11 -07:00
|
|
|
/* Create and run a dialog for a procedure.
|
|
|
|
|
* Returns true when not canceled.
|
|
|
|
|
* Side effects on config.
|
|
|
|
|
*
|
2024-09-21 09:03:42 -07:00
|
|
|
* When should_skip_runmode, the config has a run-mode property
|
|
|
|
|
* the dialog does not show.
|
|
|
|
|
*
|
2024-09-20 13:59:11 -07:00
|
|
|
* Procedure may be GimpImageProcedure or ordinary GimpProcedure.
|
|
|
|
|
*
|
|
|
|
|
* Requires gimp_ui_init already called.
|
|
|
|
|
*/
|
|
|
|
|
static gboolean
|
|
|
|
|
sf_dialog_run (GimpProcedure *procedure,
|
|
|
|
|
SFScript *script,
|
2024-09-21 09:03:42 -07:00
|
|
|
GimpProcedureConfig *config,
|
|
|
|
|
gboolean should_skip_runmode)
|
2024-09-20 13:59:11 -07:00
|
|
|
{
|
|
|
|
|
GimpProcedureDialog *dialog = NULL;
|
|
|
|
|
gboolean not_canceled;
|
2022-07-15 10:50:36 -07:00
|
|
|
|
|
|
|
|
#if DEBUG_CONFIG_PROPERTIES
|
|
|
|
|
dump_properties (config);
|
2023-08-12 15:05:34 -07:00
|
|
|
dump_objects (config);
|
2022-07-15 10:50:36 -07:00
|
|
|
#endif
|
|
|
|
|
|
2025-09-19 16:10:06 -07:00
|
|
|
#ifdef GDK_WINDOWING_QUARTZ
|
|
|
|
|
/* Ensure this process doesn't appear in Dock as separate app.
|
|
|
|
|
* Set as accessory (helper) app instead of regular app.
|
|
|
|
|
*/
|
|
|
|
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-07-15 10:50:36 -07:00
|
|
|
/* Create a dialog having properties (describing arguments of the procedure)
|
|
|
|
|
* taken from the config.
|
|
|
|
|
*
|
|
|
|
|
* Title dialog with the menu item, not the procedure name.
|
|
|
|
|
* Assert menu item is localized.
|
|
|
|
|
*/
|
|
|
|
|
dialog = (GimpProcedureDialog*) gimp_procedure_dialog_new (
|
|
|
|
|
procedure,
|
|
|
|
|
config,
|
|
|
|
|
script_fu_script_get_title (script));
|
|
|
|
|
/* dialog has no widgets except standard buttons. */
|
|
|
|
|
|
2024-02-01 08:29:50 -08:00
|
|
|
/* Create custom widget where the stock widget is not adequate. */
|
|
|
|
|
script_fu_widgets_custom_add (dialog, script);
|
2022-07-15 10:50:36 -07:00
|
|
|
|
2024-09-21 09:03:42 -07:00
|
|
|
/* Create widgets for all properties of the procedure not already created. */
|
|
|
|
|
if (should_skip_runmode)
|
|
|
|
|
{
|
|
|
|
|
GList *property_names = sf_get_suffix_of_config_prop_names (config);
|
|
|
|
|
|
|
|
|
|
gimp_procedure_dialog_fill_list (dialog, property_names);
|
|
|
|
|
g_list_free (property_names);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* NULL means: all properties. */
|
|
|
|
|
gimp_procedure_dialog_fill_list (dialog, NULL);
|
|
|
|
|
}
|
2022-07-15 10:50:36 -07:00
|
|
|
|
ScriptFu: fix #12150, activate apps (extension-script-fu and gimp) properly on MacOS
The gimp app and extension-script-fu (long-running)
are separate processes and "apps."
An app can be "active": in front and receiving GUI events.
As reported, on MacOS, when an extension-script-fu plugin yields,
the gimp app did not become active.
Also, on the second invocation of a plugin served by extension-script-fu,
the dialog could be hidden or require an extra click
because extension-script-fu was not active.
(Independently interpreted plugins did become active,
because it was a new process and gimpui_init activates on MacOS.)
On MacOS:
1. after the first dialog shown by extension-script-fu,
ensure subsequent calls to plugin make extension-script-fu active.
2. After a plugin yields, plugin manager ensure the Gimp app is active.
Note that this is done whenever a TEMPORARY procedure returns.
Most are calls to extension-script-fu plugins.
But some are also callbacks from Resource choosers running in the gimp app.
When they return, the gimp app remains active, and user must first click in
the plugin dialog to continue working.
Especially when the user clicks OK in a Resource Chooser, closing the chooser,
it would be nice if the plugin dialog became active.
That requires more, FUTURE development.
Special to MacOS: on Linux, "transient for foreign window" ensures this,
but that doesn't work on MacOS.
The fix is somewhat brute force and as simple as possible.
There is a more cooperative API for app activation on MacOS.
An app yields, and apps request, not force, self or other app be activated.
The fix does not use the cooperative API.
To do so would require a platform abstraction layer, in GIMP or Gtk.
The fix also sprinkles the code with #ifdefs.
That could be hidden if there were a platform abstraction layer PAL
The layer would be the greatest common denominator across platforms.
PAL methods would always be called in GIMP code,
but not do anything when the effect was accomplished another way.
For example "gimp_platform_request_app_active"
would request the app was active,
but do nothing on Linux where that is ensured by "transient for."
2024-12-03 06:58:00 -08:00
|
|
|
#ifdef GDK_WINDOWING_QUARTZ
|
2024-12-15 07:05:06 -08:00
|
|
|
|
ScriptFu: fix #12150, activate apps (extension-script-fu and gimp) properly on MacOS
The gimp app and extension-script-fu (long-running)
are separate processes and "apps."
An app can be "active": in front and receiving GUI events.
As reported, on MacOS, when an extension-script-fu plugin yields,
the gimp app did not become active.
Also, on the second invocation of a plugin served by extension-script-fu,
the dialog could be hidden or require an extra click
because extension-script-fu was not active.
(Independently interpreted plugins did become active,
because it was a new process and gimpui_init activates on MacOS.)
On MacOS:
1. after the first dialog shown by extension-script-fu,
ensure subsequent calls to plugin make extension-script-fu active.
2. After a plugin yields, plugin manager ensure the Gimp app is active.
Note that this is done whenever a TEMPORARY procedure returns.
Most are calls to extension-script-fu plugins.
But some are also callbacks from Resource choosers running in the gimp app.
When they return, the gimp app remains active, and user must first click in
the plugin dialog to continue working.
Especially when the user clicks OK in a Resource Chooser, closing the chooser,
it would be nice if the plugin dialog became active.
That requires more, FUTURE development.
Special to MacOS: on Linux, "transient for foreign window" ensures this,
but that doesn't work on MacOS.
The fix is somewhat brute force and as simple as possible.
There is a more cooperative API for app activation on MacOS.
An app yields, and apps request, not force, self or other app be activated.
The fix does not use the cooperative API.
To do so would require a platform abstraction layer, in GIMP or Gtk.
The fix also sprinkles the code with #ifdefs.
That could be hidden if there were a platform abstraction layer PAL
The layer would be the greatest common denominator across platforms.
PAL methods would always be called in GIMP code,
but not do anything when the effect was accomplished another way.
For example "gimp_platform_request_app_active"
would request the app was active,
but do nothing on Linux where that is ensured by "transient for."
2024-12-03 06:58:00 -08:00
|
|
|
/* The user chose a plugin from gimp app, now ensure this process is active.
|
|
|
|
|
* The gimp app was active, but now the plugin should be active.
|
|
|
|
|
* This is also called in gimpui_init(), but that is not sufficient
|
|
|
|
|
* for second calls of plugins served by long-running extension-script-fu.
|
|
|
|
|
* The user can still raise other gimp windows, hiding the dialog.
|
|
|
|
|
*/
|
2024-12-15 07:05:06 -08:00
|
|
|
[NSApp activateIgnoringOtherApps:YES];
|
ScriptFu: fix #12150, activate apps (extension-script-fu and gimp) properly on MacOS
The gimp app and extension-script-fu (long-running)
are separate processes and "apps."
An app can be "active": in front and receiving GUI events.
As reported, on MacOS, when an extension-script-fu plugin yields,
the gimp app did not become active.
Also, on the second invocation of a plugin served by extension-script-fu,
the dialog could be hidden or require an extra click
because extension-script-fu was not active.
(Independently interpreted plugins did become active,
because it was a new process and gimpui_init activates on MacOS.)
On MacOS:
1. after the first dialog shown by extension-script-fu,
ensure subsequent calls to plugin make extension-script-fu active.
2. After a plugin yields, plugin manager ensure the Gimp app is active.
Note that this is done whenever a TEMPORARY procedure returns.
Most are calls to extension-script-fu plugins.
But some are also callbacks from Resource choosers running in the gimp app.
When they return, the gimp app remains active, and user must first click in
the plugin dialog to continue working.
Especially when the user clicks OK in a Resource Chooser, closing the chooser,
it would be nice if the plugin dialog became active.
That requires more, FUTURE development.
Special to MacOS: on Linux, "transient for foreign window" ensures this,
but that doesn't work on MacOS.
The fix is somewhat brute force and as simple as possible.
There is a more cooperative API for app activation on MacOS.
An app yields, and apps request, not force, self or other app be activated.
The fix does not use the cooperative API.
To do so would require a platform abstraction layer, in GIMP or Gtk.
The fix also sprinkles the code with #ifdefs.
That could be hidden if there were a platform abstraction layer PAL
The layer would be the greatest common denominator across platforms.
PAL methods would always be called in GIMP code,
but not do anything when the effect was accomplished another way.
For example "gimp_platform_request_app_active"
would request the app was active,
but do nothing on Linux where that is ensured by "transient for."
2024-12-03 06:58:00 -08:00
|
|
|
#endif
|
|
|
|
|
|
2022-07-15 10:50:36 -07:00
|
|
|
not_canceled = gimp_procedure_dialog_run (dialog);
|
2022-09-05 16:28:35 -07:00
|
|
|
|
2023-08-12 15:05:34 -07:00
|
|
|
#if DEBUG_CONFIG_PROPERTIES
|
|
|
|
|
dump_objects (config);
|
|
|
|
|
#endif
|
2022-09-05 16:28:35 -07:00
|
|
|
|
2024-09-20 13:59:11 -07:00
|
|
|
gtk_widget_destroy ((GtkWidget*) dialog);
|
|
|
|
|
return not_canceled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Run a dialog for an ImageProcedure, then interpret the script.
|
|
|
|
|
*
|
|
|
|
|
* Interpret: marshal config into Scheme text for function call, then interpret script.
|
|
|
|
|
*/
|
|
|
|
|
GimpValueArray*
|
|
|
|
|
script_fu_dialog_run_image_proc (
|
|
|
|
|
GimpProcedure *procedure,
|
|
|
|
|
SFScript *script,
|
|
|
|
|
GimpImage *image,
|
|
|
|
|
GimpDrawable **drawables,
|
|
|
|
|
GimpProcedureConfig *config)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
GimpValueArray *result = NULL;
|
|
|
|
|
gboolean not_canceled;
|
|
|
|
|
|
|
|
|
|
if (! sf_dialog_can_be_run (procedure, script, config))
|
|
|
|
|
return gimp_procedure_new_return_values (procedure, GIMP_PDB_EXECUTION_ERROR, NULL);
|
|
|
|
|
|
2024-09-21 09:03:42 -07:00
|
|
|
not_canceled = sf_dialog_run (procedure, script, config, FALSE);
|
2024-09-20 13:59:11 -07:00
|
|
|
/* Assert config holds validated arg values from a user interaction. */
|
|
|
|
|
|
2022-07-15 10:50:36 -07:00
|
|
|
if (not_canceled)
|
2024-09-20 13:59:11 -07:00
|
|
|
result = script_fu_interpret_image_proc (procedure, script,
|
2024-10-28 04:16:13 -07:00
|
|
|
image, drawables,
|
2024-09-20 13:59:11 -07:00
|
|
|
config);
|
2022-07-15 10:50:36 -07:00
|
|
|
else
|
2024-09-20 13:59:11 -07:00
|
|
|
result = gimp_procedure_new_return_values (procedure, GIMP_PDB_CANCEL, NULL);
|
2022-07-15 10:50:36 -07:00
|
|
|
|
2024-12-15 07:05:06 -08:00
|
|
|
|
2022-07-15 10:50:36 -07:00
|
|
|
return result;
|
|
|
|
|
}
|
2024-09-21 00:54:59 -07:00
|
|
|
|
2024-09-21 09:03:42 -07:00
|
|
|
/* Run a dialog for a generic GimpProcedure, then interpret the script. */
|
2024-09-21 00:54:59 -07:00
|
|
|
GimpValueArray*
|
|
|
|
|
script_fu_dialog_run_regular_proc (GimpProcedure *procedure,
|
|
|
|
|
SFScript *script,
|
|
|
|
|
GimpProcedureConfig *config)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
GimpValueArray *result = NULL;
|
|
|
|
|
gboolean not_canceled;
|
|
|
|
|
|
|
|
|
|
if (! sf_dialog_can_be_run (procedure, script, config))
|
|
|
|
|
return gimp_procedure_new_return_values (procedure, GIMP_PDB_EXECUTION_ERROR, NULL);
|
|
|
|
|
|
2024-09-21 09:03:42 -07:00
|
|
|
not_canceled = sf_dialog_run (procedure, script, config,
|
|
|
|
|
TRUE); /* skip run-mode prop of config. */
|
2024-09-21 00:54:59 -07:00
|
|
|
/* Assert config holds validated arg values from a user interaction. */
|
|
|
|
|
|
|
|
|
|
if (not_canceled)
|
|
|
|
|
result = script_fu_interpret_regular_proc (procedure, script, config);
|
|
|
|
|
else
|
|
|
|
|
result = gimp_procedure_new_return_values (procedure, GIMP_PDB_CANCEL, NULL);
|
|
|
|
|
|
2024-12-15 07:05:06 -08:00
|
|
|
|
2024-09-21 00:54:59 -07:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|