plug-ins/script-fu/Makefile.am new files split out of

2008-08-21  Sven Neumann  <sven@gimp.org>

	* plug-ins/script-fu/Makefile.am
	* plug-ins/script-fu/script-fu-eval.[ch]: new files split out of
	script-fu-console.c[ch].

	* plug-ins/script-fu/script-fu-text-console.h: fixed comment.

	* plug-ins/script-fu/script-fu-console.[ch]: removed 
script-fu-eval
	procedure here.

	* plug-ins/script-fu/script-fu.c: changed accordingly.


svn path=/trunk/; revision=26698
This commit is contained in:
Sven Neumann 2008-08-21 14:48:29 +00:00 committed by Sven Neumann
parent c85fc6eb21
commit bf1c783f44
10 changed files with 133 additions and 64 deletions

View File

@ -1,3 +1,16 @@
2008-08-21 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/Makefile.am
* plug-ins/script-fu/script-fu-eval.[ch]: new files split out of
script-fu-console.c[ch].
* plug-ins/script-fu/script-fu-text-console.h: fixed comment.
* plug-ins/script-fu/script-fu-console.[ch]: removed script-fu-eval
procedure here.
* plug-ins/script-fu/script-fu.c: changed accordingly.
2008-08-21 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/script-fu.c (script_fu_run): formatting.

View File

@ -38,6 +38,8 @@ script_fu_SOURCES = \
script-fu.c \
script-fu-console.c \
script-fu-console.h \
script-fu-eval.c \
script-fu-eval.h \
script-fu-interface.c \
script-fu-interface.h \
script-fu-text-console.h \

View File

@ -28,8 +28,6 @@
#include <gdk/gdkkeysyms.h>
#include "tinyscheme/scheme.h"
#include "scheme-wrapper.h"
#include "script-fu-console.h"
@ -693,48 +691,3 @@ script_fu_cc_key_function (GtkWidget *widget,
return FALSE;
}
void
script_fu_eval_run (const gchar *name,
gint nparams,
const GimpParam *params,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[2];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
run_mode = params[0].data.d_int32;
set_run_mode_constant (run_mode);
switch (run_mode)
{
case GIMP_RUN_NONINTERACTIVE:
/* Disable Script-Fu output */
ts_register_output_func (NULL, NULL);
if (ts_interpret_string (params[1].data.d_string) != 0)
status = GIMP_PDB_EXECUTION_ERROR;
break;
case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS:
status = GIMP_PDB_CALLING_ERROR;
*nreturn_vals = 2;
values[1].type = GIMP_PDB_STRING;
values[1].data.d_string = _("Script-Fu evaluation mode only allows "
"non-interactive invocation");
break;
default:
break;
}
values[0].data.d_status = status;
}

View File

@ -20,16 +20,11 @@
#define __SCRIPT_FU_CONSOLE_H__
void script_fu_console_run (const gchar *name,
gint nparams,
const GimpParam *params,
gint *nreturn_vals,
GimpParam **return_vals);
void script_fu_eval_run (const gchar *name,
gint nparams,
const GimpParam *params,
gint *nreturn_vals,
GimpParam **return_vals);
void script_fu_console_run (const gchar *name,
gint nparams,
const GimpParam *params,
gint *nreturn_vals,
GimpParam **return_vals);
#endif /* __SCRIPT_FU_CONSOLE__ */
#endif /* __SCRIPT_FU_CONSOLE_H__ */

View File

@ -0,0 +1,72 @@
/* GIMP - The GNU Image Manipulation Program
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "libgimp/gimp.h"
#include "scheme-wrapper.h"
#include "script-fu-eval.h"
#include "script-fu-intl.h"
void
script_fu_eval_run (const gchar *name,
gint nparams,
const GimpParam *params,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[2];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
run_mode = params[0].data.d_int32;
set_run_mode_constant (run_mode);
switch (run_mode)
{
case GIMP_RUN_NONINTERACTIVE:
/* Disable Script-Fu output */
ts_register_output_func (NULL, NULL);
if (ts_interpret_string (params[1].data.d_string) != 0)
status = GIMP_PDB_EXECUTION_ERROR;
break;
case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS:
status = GIMP_PDB_CALLING_ERROR;
*nreturn_vals = 2;
values[1].type = GIMP_PDB_STRING;
values[1].data.d_string = _("Script-Fu evaluation mode only allows "
"non-interactive invocation");
break;
default:
break;
}
values[0].data.d_status = status;
}

View File

@ -0,0 +1,30 @@
/* GIMP - The GNU Image Manipulation Program
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __SCRIPT_FU_EVAL_H__
#define __SCRIPT_FU_EVAL_H__
void script_fu_eval_run (const gchar *name,
gint nparams,
const GimpParam *params,
gint *nreturn_vals,
GimpParam **return_vals);
#endif /* __SCRIPT_FU_EVAL_H__ */

View File

@ -20,11 +20,11 @@
#define __SCRIPT_FU_TEXT_CONSOLE_H__
void script_fu_text_console_run (const gchar *name,
gint nparams,
const GimpParam *params,
gint *nreturn_vals,
GimpParam **return_vals);
void script_fu_text_console_run (const gchar *name,
gint nparams,
const GimpParam *params,
gint *nreturn_vals,
GimpParam **return_vals);
#endif /* __SCRIPT_FU_TEXT_CONSOLE__ */
#endif /* __SCRIPT_FU_TEXT_CONSOLE_H__ */

View File

@ -28,6 +28,7 @@
#include "script-fu-types.h"
#include "script-fu-console.h"
#include "script-fu-eval.h"
#include "script-fu-interface.h"
#include "script-fu-scripts.h"
#include "script-fu-server.h"

View File

@ -1,5 +1,7 @@
2008-08-21 Sven Neumann <sven@gimp.org>
* POTFILES.in: added plug-ins/script-fu/script-fu-eval.c
* POTFILES.skip: follow plug-in name changes.
2008-08-19 Alexandre Prokoudine <alexandre.prokoudine@gmail.com>

View File

@ -4,6 +4,7 @@
[encoding: UTF-8]
plug-ins/script-fu/script-fu-console.c
plug-ins/script-fu/script-fu-eval.c
plug-ins/script-fu/script-fu-interface.c
plug-ins/script-fu/script-fu-scripts.c
plug-ins/script-fu/script-fu-server.c