With this commit we finally say goodbye to SIOD. This large set of changes

2006-10-15  Kevin Cozens  <kcozens@cvs.gnome.org>

	With this commit we finally say goodbye to SIOD. This large set of
	changes updates the Script-Fu plug-in to use the TinyScheme Scheme
	interpreter. These changes originated with changes originally made
	to Script-Fu which created Tiny-Fu (aka. the gimp-tiny-fu module).

	* plug-ins/script-fu/Makefile.am
	* plug-ins/script-fu/script-fu-console.c
	* plug-ins/script-fu/script-fu-interface.c
	* plug-ins/script-fu/script-fu-scripts.c
	* plug-ins/script-fu/script-fu-scripts.h
	* plug-ins/script-fu/script-fu-server.c
	* plug-ins/script-fu/script-fu-text-console.c
	* plug-ins/script-fu/script-fu.c: Updated with the changes made to
	these files as part of the work on the Tiny-Fu project.

	* plug-ins/script-fu/scheme-wrapper.c
	* plug-ins/script-fu/scheme-wrapper.h: Renamed from siod-wrapper.[ch]
	and updated based on differences to ts-wrapper.[ch] from gimp-tiny-fu.

	* plug-ins/script-fu/ftx/*
	* plug-ins/script-fu/re/*
	* plug-ins/script-fu/tinyscheme/*
	* plug-ins/script-fu/scripts/script-fu.init
	* plug-ins/script-fu/scripts/script-fu-compat.init
	* plug-ins/script-fu/scripts/contactsheet.scm
	* plug-ins/script-fu/scripts/script-fu-set-cmap.scm
	* plug-ins/script-fu/scripts/script-fu-util-setpt.scm
	* plug-ins/script-fu/scripts/ts-helloworld.scm: Added all of these
	files and directories from Tiny-Fu. Updated the Makefile.am files
	of ftx, re, and tinyscheme now they are in the GIMP source tree.

	* plug-ins/script-fu/scripts/*.scm: All scripts have been updated as
	needed to ensure they will work with the TinyScheme interpreter. Most
	of the files have been reformatted making it easier to see the syntax
	of Scheme and making them easier to read.

	* plug-ins/script-fu/scripts/Makefile.am: Updated script file lists.

	* plug-ins/script-fu/siod-wrapper.c
	* plug-ins/script-fu/siod-wrapper.h
	* plug-ins/script-fu/siod/*: Removed obsolete files.

	* configure.in: Updated list of files in AC_CONFIG_FILES. Changed
	--disable-script-fu to --without-script-fu which it should have
	been when originally added.

	* INSTALL: Updated to show change to --without-script-fu.
This commit is contained in:
Kevin Cozens
2006-10-16 01:08:54 +00:00
committed by Kevin Cozens
parent 9314c3ea8e
commit 6239dddda3
127 changed files with 9946 additions and 17357 deletions

View File

@ -23,7 +23,8 @@
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "siod/siod.h"
#include "tinyscheme/scheme-private.h"
#include "scheme-wrapper.h"
#include "script-fu-types.h"
@ -108,7 +109,7 @@ static void script_fu_brush_callback (gpointer data,
*/
static SFInterface *sf_interface = NULL; /* there can only be at most one
interactive interface */
interactive interface */
/*
@ -135,9 +136,9 @@ script_fu_interface_report_cc (const gchar *command)
sf_interface->command_count++;
new_command = g_strdup_printf ("%s <%d>",
command, sf_interface->command_count);
command, sf_interface->command_count);
gtk_label_set_text (GTK_LABEL (sf_interface->progress_label),
new_command);
new_command);
g_free (new_command);
}
else
@ -289,241 +290,241 @@ script_fu_interface (SFScript *script)
gettext (script->arg_labels[i]));
switch (script->arg_types[i])
{
case SF_IMAGE:
case SF_DRAWABLE:
case SF_LAYER:
case SF_CHANNEL:
switch (script->arg_types[i])
{
case SF_IMAGE:
widget = gimp_image_combo_box_new (NULL, NULL);
ID_ptr = &script->arg_values[i].sfa_image;
break;
{
case SF_IMAGE:
case SF_DRAWABLE:
case SF_LAYER:
case SF_CHANNEL:
switch (script->arg_types[i])
{
case SF_IMAGE:
widget = gimp_image_combo_box_new (NULL, NULL);
ID_ptr = &script->arg_values[i].sfa_image;
break;
case SF_DRAWABLE:
widget = gimp_drawable_combo_box_new (NULL, NULL);
ID_ptr = &script->arg_values[i].sfa_drawable;
break;
case SF_DRAWABLE:
widget = gimp_drawable_combo_box_new (NULL, NULL);
ID_ptr = &script->arg_values[i].sfa_drawable;
break;
case SF_LAYER:
widget = gimp_layer_combo_box_new (NULL, NULL);
ID_ptr = &script->arg_values[i].sfa_layer;
break;
case SF_LAYER:
widget = gimp_layer_combo_box_new (NULL, NULL);
ID_ptr = &script->arg_values[i].sfa_layer;
break;
case SF_CHANNEL:
widget = gimp_channel_combo_box_new (NULL, NULL);
ID_ptr = &script->arg_values[i].sfa_channel;
break;
case SF_CHANNEL:
widget = gimp_channel_combo_box_new (NULL, NULL);
ID_ptr = &script->arg_values[i].sfa_channel;
break;
default:
menu = NULL;
break;
}
default:
menu = NULL;
break;
}
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (widget), *ID_ptr,
G_CALLBACK (gimp_int_combo_box_get_active),
ID_ptr);
break;
break;
case SF_COLOR:
left_align = TRUE;
widget = gimp_color_button_new (_("Script-Fu Color Selection"),
COLOR_SAMPLE_WIDTH,
COLOR_SAMPLE_HEIGHT,
&script->arg_values[i].sfa_color,
GIMP_COLOR_AREA_FLAT);
case SF_COLOR:
left_align = TRUE;
widget = gimp_color_button_new (_("Script-Fu Color Selection"),
COLOR_SAMPLE_WIDTH,
COLOR_SAMPLE_HEIGHT,
&script->arg_values[i].sfa_color,
GIMP_COLOR_AREA_FLAT);
gimp_color_button_set_update (GIMP_COLOR_BUTTON (widget), TRUE);
gimp_color_button_set_update (GIMP_COLOR_BUTTON (widget), TRUE);
g_signal_connect (widget, "color-changed",
G_CALLBACK (gimp_color_button_get_color),
&script->arg_values[i].sfa_color);
break;
g_signal_connect (widget, "color-changed",
G_CALLBACK (gimp_color_button_get_color),
&script->arg_values[i].sfa_color);
break;
case SF_TOGGLE:
g_free (label_text);
label_text = NULL;
widget =
gtk_check_button_new_with_mnemonic (gettext (script->arg_labels[i]));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
script->arg_values[i].sfa_toggle);
case SF_TOGGLE:
g_free (label_text);
label_text = NULL;
widget =
gtk_check_button_new_with_mnemonic (gettext (script->arg_labels[i]));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
script->arg_values[i].sfa_toggle);
g_signal_connect (widget, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&script->arg_values[i].sfa_toggle);
break;
g_signal_connect (widget, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&script->arg_values[i].sfa_toggle);
break;
case SF_VALUE:
case SF_STRING:
widget = gtk_entry_new ();
gtk_widget_set_size_request (widget, TEXT_WIDTH, -1);
gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
case SF_VALUE:
case SF_STRING:
widget = gtk_entry_new ();
gtk_widget_set_size_request (widget, TEXT_WIDTH, -1);
gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
gtk_entry_set_text (GTK_ENTRY (widget),
script->arg_values[i].sfa_value);
break;
gtk_entry_set_text (GTK_ENTRY (widget),
script->arg_values[i].sfa_value);
break;
case SF_TEXT:
case SF_TEXT:
{
GtkWidget *view;
GtkTextBuffer *buffer;
widget = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (widget),
GTK_SHADOW_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_widget_set_size_request (widget, TEXT_WIDTH, -1);
view = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (widget), view);
gtk_widget_show (view);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), TRUE);
gtk_text_buffer_set_text (buffer,
script->arg_values[i].sfa_value, -1);
label_yalign = 0.0;
}
break;
case SF_ADJUSTMENT:
switch (script->arg_defaults[i].sfa_adjustment.type)
{
GtkWidget *view;
GtkTextBuffer *buffer;
widget = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (widget),
GTK_SHADOW_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_widget_set_size_request (widget, TEXT_WIDTH, -1);
view = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (widget), view);
gtk_widget_show (view);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), TRUE);
gtk_text_buffer_set_text (buffer,
script->arg_values[i].sfa_value, -1);
label_yalign = 0.0;
}
break;
case SF_ADJUSTMENT:
switch (script->arg_defaults[i].sfa_adjustment.type)
{
case SF_SLIDER:
script->arg_values[i].sfa_adjustment.adj = (GtkAdjustment *)
gimp_scale_entry_new (GTK_TABLE (sf_interface->table),
0, row,
label_text, SLIDER_WIDTH, -1,
script->arg_values[i].sfa_adjustment.value,
script->arg_defaults[i].sfa_adjustment.lower,
script->arg_defaults[i].sfa_adjustment.upper,
script->arg_defaults[i].sfa_adjustment.step,
script->arg_defaults[i].sfa_adjustment.page,
script->arg_defaults[i].sfa_adjustment.digits,
TRUE, 0.0, 0.0,
NULL, NULL);
case SF_SLIDER:
script->arg_values[i].sfa_adjustment.adj = (GtkAdjustment *)
gimp_scale_entry_new (GTK_TABLE (sf_interface->table),
0, row,
label_text, SLIDER_WIDTH, -1,
script->arg_values[i].sfa_adjustment.value,
script->arg_defaults[i].sfa_adjustment.lower,
script->arg_defaults[i].sfa_adjustment.upper,
script->arg_defaults[i].sfa_adjustment.step,
script->arg_defaults[i].sfa_adjustment.page,
script->arg_defaults[i].sfa_adjustment.digits,
TRUE, 0.0, 0.0,
NULL, NULL);
gtk_entry_set_activates_default (GIMP_SCALE_ENTRY_SPINBUTTON (script->arg_values[i].sfa_adjustment.adj), TRUE);
break;
break;
case SF_SPINNER:
left_align = TRUE;
widget =
gimp_spin_button_new (&adj,
script->arg_values[i].sfa_adjustment.value,
script->arg_defaults[i].sfa_adjustment.lower,
script->arg_defaults[i].sfa_adjustment.upper,
script->arg_defaults[i].sfa_adjustment.step,
script->arg_defaults[i].sfa_adjustment.page,
0, 0,
script->arg_defaults[i].sfa_adjustment.digits);
gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
script->arg_values[i].sfa_adjustment.adj = GTK_ADJUSTMENT (adj);
break;
}
case SF_SPINNER:
left_align = TRUE;
widget =
gimp_spin_button_new (&adj,
script->arg_values[i].sfa_adjustment.value,
script->arg_defaults[i].sfa_adjustment.lower,
script->arg_defaults[i].sfa_adjustment.upper,
script->arg_defaults[i].sfa_adjustment.step,
script->arg_defaults[i].sfa_adjustment.page,
0, 0,
script->arg_defaults[i].sfa_adjustment.digits);
gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
script->arg_values[i].sfa_adjustment.adj = GTK_ADJUSTMENT (adj);
break;
}
g_signal_connect (script->arg_values[i].sfa_adjustment.adj,
"value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&script->arg_values[i].sfa_adjustment.value);
break;
break;
case SF_FILENAME:
case SF_DIRNAME:
if (script->arg_types[i] == SF_FILENAME)
widget = gtk_file_chooser_button_new (_("Script-Fu File Selection"),
GTK_FILE_CHOOSER_ACTION_OPEN);
case SF_FILENAME:
case SF_DIRNAME:
if (script->arg_types[i] == SF_FILENAME)
widget = gtk_file_chooser_button_new (_("Script-Fu File Selection"),
GTK_FILE_CHOOSER_ACTION_OPEN);
else
widget = gtk_file_chooser_button_new (_("Script-Fu Folder Selection"),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
if (script->arg_values[i].sfa_file.filename)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget),
if (script->arg_values[i].sfa_file.filename)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget),
script->arg_values[i].sfa_file.filename);
g_signal_connect (widget, "selection-changed",
G_CALLBACK (script_fu_file_callback),
&script->arg_values[i].sfa_file);
break;
g_signal_connect (widget, "selection-changed",
G_CALLBACK (script_fu_file_callback),
&script->arg_values[i].sfa_file);
break;
case SF_FONT:
widget = gimp_font_select_button_new (_("Script-Fu Font Selection"),
script->arg_values[i].sfa_font);
g_signal_connect_swapped (widget, "font-set",
G_CALLBACK (script_fu_font_callback),
&script->arg_values[i].sfa_font);
break;
case SF_FONT:
widget = gimp_font_select_button_new (_("Script-Fu Font Selection"),
script->arg_values[i].sfa_font);
g_signal_connect_swapped (widget, "font-set",
G_CALLBACK (script_fu_font_callback),
&script->arg_values[i].sfa_font);
break;
case SF_PALETTE:
widget = gimp_palette_select_button_new (_("Script-Fu Palette Selection"),
script->arg_values[i].sfa_palette);
g_signal_connect_swapped (widget, "palette-set",
G_CALLBACK (script_fu_palette_callback),
&script->arg_values[i].sfa_palette);
break;
case SF_PALETTE:
widget = gimp_palette_select_button_new (_("Script-Fu Palette Selection"),
script->arg_values[i].sfa_palette);
g_signal_connect_swapped (widget, "palette-set",
G_CALLBACK (script_fu_palette_callback),
&script->arg_values[i].sfa_palette);
break;
case SF_PATTERN:
left_align = TRUE;
widget = gimp_pattern_select_button_new (_("Script-fu Pattern Selection"),
script->arg_values[i].sfa_pattern);
g_signal_connect_swapped (widget, "pattern-set",
G_CALLBACK (script_fu_pattern_callback),
&script->arg_values[i].sfa_pattern);
break;
case SF_PATTERN:
left_align = TRUE;
widget = gimp_pattern_select_button_new (_("Script-Fu Pattern Selection"),
script->arg_values[i].sfa_pattern);
g_signal_connect_swapped (widget, "pattern-set",
G_CALLBACK (script_fu_pattern_callback),
&script->arg_values[i].sfa_pattern);
break;
case SF_GRADIENT:
left_align = TRUE;
widget = gimp_gradient_select_button_new (_("Script-Fu Gradient Selection"),
script->arg_values[i].sfa_gradient);
g_signal_connect_swapped (widget, "gradient-set",
G_CALLBACK (script_fu_gradient_callback),
&script->arg_values[i].sfa_gradient);
break;
case SF_GRADIENT:
left_align = TRUE;
widget = gimp_gradient_select_button_new (_("Script-Fu Gradient Selection"),
script->arg_values[i].sfa_gradient);
g_signal_connect_swapped (widget, "gradient-set",
G_CALLBACK (script_fu_gradient_callback),
&script->arg_values[i].sfa_gradient);
break;
case SF_BRUSH:
left_align = TRUE;
widget = gimp_brush_select_button_new (_("Script-Fu Brush Selection"),
script->arg_values[i].sfa_brush.name,
script->arg_values[i].sfa_brush.opacity,
script->arg_values[i].sfa_brush.spacing,
script->arg_values[i].sfa_brush.paint_mode);
g_signal_connect_swapped (widget, "brush-set",
G_CALLBACK (script_fu_brush_callback),
&script->arg_values[i].sfa_brush);
break;
case SF_BRUSH:
left_align = TRUE;
widget = gimp_brush_select_button_new (_("Script-Fu Brush Selection"),
script->arg_values[i].sfa_brush.name,
script->arg_values[i].sfa_brush.opacity,
script->arg_values[i].sfa_brush.spacing,
script->arg_values[i].sfa_brush.paint_mode);
g_signal_connect_swapped (widget, "brush-set",
G_CALLBACK (script_fu_brush_callback),
&script->arg_values[i].sfa_brush);
break;
case SF_OPTION:
widget = gtk_combo_box_new_text ();
for (list = script->arg_defaults[i].sfa_option.list;
list;
list = g_slist_next (list))
{
gtk_combo_box_append_text (GTK_COMBO_BOX (widget),
gettext ((const gchar *) list->data));
}
case SF_OPTION:
widget = gtk_combo_box_new_text ();
for (list = script->arg_defaults[i].sfa_option.list;
list;
list = g_slist_next (list))
{
gtk_combo_box_append_text (GTK_COMBO_BOX (widget),
gettext ((const gchar *) list->data));
}
gtk_combo_box_set_active (GTK_COMBO_BOX (widget),
script->arg_values[i].sfa_option.history);
gtk_combo_box_set_active (GTK_COMBO_BOX (widget),
script->arg_values[i].sfa_option.history);
g_signal_connect (widget, "changed",
G_CALLBACK (script_fu_combo_callback),
&script->arg_values[i].sfa_option);
break;
g_signal_connect (widget, "changed",
G_CALLBACK (script_fu_combo_callback),
&script->arg_values[i].sfa_option);
break;
case SF_ENUM:
widget = gimp_enum_combo_box_new (g_type_from_name (script->arg_defaults[i].sfa_enum.type_name));
case SF_ENUM:
widget = gimp_enum_combo_box_new (g_type_from_name (script->arg_defaults[i].sfa_enum.type_name));
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (widget),
script->arg_values[i].sfa_enum.history);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (widget),
script->arg_values[i].sfa_enum.history);
g_signal_connect (widget, "changed",
G_CALLBACK (gimp_int_combo_box_get_active),
&script->arg_values[i].sfa_enum.history);
break;
}
g_signal_connect (widget, "changed",
G_CALLBACK (gimp_int_combo_box_get_active),
&script->arg_values[i].sfa_enum.history);
break;
}
if (widget)
{
@ -596,12 +597,12 @@ script_fu_interface_quit (SFScript *script)
case SF_PATTERN:
case SF_GRADIENT:
case SF_BRUSH:
gimp_select_button_close_popup
gimp_select_button_close_popup
(GIMP_SELECT_BUTTON (sf_interface->widgets[i]));
break;
break;
default:
break;
break;
}
g_free (sf_interface->widgets);
@ -871,7 +872,7 @@ script_fu_ok (SFScript *script)
command = g_string_free (s, FALSE);
/* run the command through the interpreter */
if (repl_c_string (command, 0, 0, 1) != 0)
if (ts_interpret_string (command))
script_fu_error_msg (command);
g_free (command);
@ -897,12 +898,12 @@ script_fu_reset (SFScript *script)
case SF_COLOR:
gimp_color_button_set_color (GIMP_COLOR_BUTTON (widget),
&script->arg_defaults[i].sfa_color);
break;
break;
case SF_TOGGLE:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
script->arg_defaults[i].sfa_toggle);
break;
break;
case SF_VALUE:
case SF_STRING:
@ -949,7 +950,7 @@ script_fu_reset (SFScript *script)
break;
case SF_PATTERN:
gimp_pattern_select_button_set_pattern (GIMP_PATTERN_SELECT_BUTTON (widget),
gimp_pattern_select_button_set_pattern (GIMP_PATTERN_SELECT_BUTTON (widget),
script->arg_defaults[i].sfa_pattern);
break;