Create SF-RUN-MODE constant for use in Script-Fu. Fixes bug #479893.

2007-09-27  Kevin Cozens  <kcozens@cvs.gnome.org>

	Create SF-RUN-MODE constant for use in Script-Fu. Fixes bug #479893.

	* plug-ins/script-fu/scheme-wrapper.c
	* plug-ins/script-fu/scheme-wrapper.h: Added set_run_mode_constant()
	which creates a new constant called SF-RUN-MODE. This constant can
	be used by Script-Fu scripts when calling a plug-in that needs to
	know the current run mode.

	* plug-ins/script-fu/script-fu-scripts.c
	* plug-ins/script-fu/script-fu-console.c
	* plug-ins/script-fu/script-fu.c
	* plug-ins/script-fu/script-fu-server.c: Added calls to create the
	new SF-RUN-MODE constant.

	* plug-ins/script-fu/scripts/difference-clouds.scm: Pass SF-RUN-MODE
	to the solid noise plug-in instead of always using RUN-INTERACTIVE.

svn path=/trunk/; revision=23674
This commit is contained in:
Kevin Cozens 2007-09-27 19:54:28 +00:00 committed by Kevin Cozens
parent a5ed305f62
commit 0cb80bdcd8
8 changed files with 45 additions and 8 deletions

View File

@ -1,3 +1,22 @@
2007-09-27 Kevin Cozens <kcozens@cvs.gnome.org>
Create SF-RUN-MODE constant for use in Script-Fu. Fixes bug #479893.
* plug-ins/script-fu/scheme-wrapper.c
* plug-ins/script-fu/scheme-wrapper.h: Added set_run_mode_constant()
which creates a new constant called SF-RUN-MODE. This constant can
be used by Script-Fu scripts when calling a plug-in that needs to
know the current run mode.
* plug-ins/script-fu/script-fu-scripts.c
* plug-ins/script-fu/script-fu-console.c
* plug-ins/script-fu/script-fu.c
* plug-ins/script-fu/script-fu-server.c: Added calls to create the
new SF-RUN-MODE constant.
* plug-ins/script-fu/scripts/difference-clouds.scm: Pass SF-RUN-MODE
to the solid noise plug-in instead of always using RUN-INTERACTIVE.
2007-09-27 Michael Natterer <mitch@gimp.org>
* app/gui/ige-mac-menu.c: new version which correctly updates the

View File

@ -333,6 +333,19 @@ tinyscheme_deinit (void)
scheme_deinit (&sc);
}
/* Create an SF-RUN-MODE constant for use in scripts. */
/* It is set to the run mode state determined by GIMP. */
void
set_run_mode_constant (GimpRunMode run_mode)
{
pointer symbol;
symbol = sc.vptr->mk_symbol (&sc, "SF-RUN-MODE");
sc.vptr->scheme_define (&sc, sc.global_env, symbol,
sc.vptr->mk_integer (&sc, run_mode));
sc.vptr->setimmutable(symbol);
}
static void convert_string (gchar *str);
static pointer marshall_proc_db_call (scheme *sc, pointer a);
static pointer script_fu_register_call (scheme *sc, pointer a);

View File

@ -40,6 +40,8 @@ void tinyscheme_init (const gchar *path,
gboolean local_register_scripts);
void tinyscheme_deinit (void);
void set_run_mode_constant (GimpRunMode run_mode);
void ts_interpret_stdin (void);
/* if the return value is 0, success. error otherwise. */

View File

@ -703,6 +703,7 @@ script_fu_eval_run (const gchar *name,
GimpRunMode run_mode;
run_mode = params[0].data.d_int32;
set_run_mode_constant (run_mode);
switch (run_mode)
{

View File

@ -887,12 +887,9 @@ script_fu_script_proc (const gchar *name,
if (status == GIMP_PDB_SUCCESS)
{
GimpRunMode run_mode;
GimpRunMode run_mode = params[0].data.d_int32;
run_mode = params[0].data.d_int32;
if (script->num_args == 0)
run_mode = GIMP_RUN_NONINTERACTIVE;
set_run_mode_constant (run_mode);
switch (run_mode)
{
@ -901,7 +898,8 @@ script_fu_script_proc (const gchar *name,
gint min_args = 0;
/* First, try to collect the standard script arguments... */
min_args = script_fu_collect_standard_args (script, nparams, params);
min_args = script_fu_collect_standard_args (script,
nparams, params);
/* ...then acquire the rest of arguments (if any) with a dialog */
if (script->num_args > min_args)

View File

@ -199,6 +199,7 @@ script_fu_server_run (const gchar *name,
GimpRunMode run_mode;
run_mode = params[0].data.d_int32;
set_run_mode_constant (run_mode);
switch (run_mode)
{

View File

@ -195,6 +195,9 @@ script_fu_run (const gchar *name,
tinyscheme_init (path, FALSE);
}
if (param != NULL)
set_run_mode_constant ((GimpRunMode)param[0].data.d_int32);
/* Load all of the available scripts */
script_fu_find_scripts (path);

View File

@ -38,7 +38,7 @@
(gimp-image-undo-group-start image)
; Add the cloud layer above the current layer
; Add the cloud layer above the current layer
(gimp-image-add-layer image diff-clouds -1)
; Clear the layer (so there are no noise in it)
@ -53,7 +53,7 @@
(gimp-layer-translate diff-clouds offset-x offset-y))
; Show the solid noise dialog
(plug-in-solid-noise RUN-INTERACTIVE image diff-clouds 0 0 0 1 4.0 4.0)
(plug-in-solid-noise SF-RUN-MODE image diff-clouds 0 0 0 1 4.0 4.0)
; Merge the clouds layer with the layer below
(gimp-image-merge-down image diff-clouds EXPAND-AS-NECESSARY)