Commit 4099ad42 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

removed interp_md5.[ch] from the build because it was not used at all.

2001-01-21  Sven Neumann  <sven@gimp.org>

	* plug-ins/script-fu/Makefile.am: removed interp_md5.[ch] from
	the build because it was not used at all.

	* plug-ins/script-fu/script-fu-console.c
	* plug-ins/script-fu/script-fu-scripts.c
	* plug-ins/script-fu/script-fu-server.c
	* plug-ins/script-fu/script-fu.c: even more pedantic indentation
parent 776b3a61
2001-01-21 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/Makefile.am: removed interp_md5.[ch] from
the build because it was not used at all.
* plug-ins/script-fu/script-fu-console.c
* plug-ins/script-fu/script-fu-scripts.c
* plug-ins/script-fu/script-fu-server.c
* plug-ins/script-fu/script-fu.c: even more pedantic indentation
2001-01-21 Michael Natterer <mitch@gimp.org>
* app/palette_entries.h: removed.
......
......@@ -13,8 +13,6 @@ libexecdir = $(gimpplugindir)/plug-ins
libexec_PROGRAMS = script-fu
script_fu_SOURCES = \
interp_md5.c \
interp_md5.h \
interp_regex.c \
interp_slib.c \
interp_sliba.c \
......
......@@ -56,37 +56,37 @@
typedef struct
{
GtkWidget *console;
GtkWidget *cc;
GtkWidget *console;
GtkWidget *cc;
GtkAdjustment *vadj;
GdkFont *font_strong;
GdkFont *font_emphasis;
GdkFont *font_weak;
GdkFont *font;
GdkFont *font_strong;
GdkFont *font_emphasis;
GdkFont *font_weak;
GdkFont *font;
gint32 input_id;
gint32 input_id;
} ConsoleInterface;
/*
* Local Functions
*/
static void script_fu_console_interface (void);
static void script_fu_close_callback (GtkWidget *widget,
gpointer data);
static void script_fu_browse_callback (GtkWidget *widget,
gpointer data);
static gboolean script_fu_siod_read (GIOChannel *channel,
GIOCondition cond,
gpointer data);
static gint script_fu_cc_is_empty (void);
static gint script_fu_cc_key_function (GtkWidget *widget,
GdkEventKey *event,
gpointer data);
static FILE *script_fu_open_siod_console (void);
static void script_fu_close_siod_console(void);
static void script_fu_console_interface (void);
static void script_fu_close_callback (GtkWidget *widget,
gpointer data);
static void script_fu_browse_callback (GtkWidget *widget,
gpointer data);
static gboolean script_fu_siod_read (GIOChannel *channel,
GIOCondition cond,
gpointer data);
static gboolean script_fu_cc_is_empty (void);
static gboolean script_fu_cc_key_function (GtkWidget *widget,
GdkEventKey *event,
gpointer data);
static FILE * script_fu_open_siod_console (void);
static void script_fu_close_siod_console (void);
/*
* Local variables
......@@ -106,15 +106,15 @@ static ConsoleInterface cint =
-1 /* input id */
};
static char read_buffer[BUFSIZE];
static GList *history = NULL;
static int history_len = 0;
static int history_cur = 0;
static int history_max = 50;
static gchar read_buffer[BUFSIZE];
static GList *history = NULL;
static gint history_len = 0;
static gint history_cur = 0;
static gint history_max = 50;
static int siod_output_pipe[2];
extern int siod_verbose_level;
extern char siod_err_msg[];
static gint siod_output_pipe[2];
extern gint siod_verbose_level;
extern gchar siod_err_msg[];
extern FILE *siod_output;
......@@ -125,15 +125,15 @@ extern FILE *siod_output;
*/
void
script_fu_console_run (char *name,
int nparams,
GimpParam *params,
int *nreturn_vals,
GimpParam **return_vals)
script_fu_console_run (gchar *name,
gint nparams,
GimpParam *params,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[1];
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunModeType run_mode;
GimpRunModeType run_mode;
run_mode = params[0].data.d_int32;
......@@ -163,19 +163,19 @@ script_fu_console_run (char *name,
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
}
static void
script_fu_console_interface (void)
{
GtkWidget *dlg;
GtkWidget *button;
GtkWidget *label;
GtkWidget *vsb;
GtkWidget *table;
GtkWidget *hbox;
GtkWidget *dlg;
GtkWidget *button;
GtkWidget *label;
GtkWidget *vsb;
GtkWidget *table;
GtkWidget *hbox;
GIOChannel *input_channel;
INIT_I18N_UI();
......@@ -229,10 +229,14 @@ script_fu_console_interface (void)
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
cint.font_strong = gdk_font_load ("-*-helvetica-bold-r-normal-*-*-120-*-*-*-*-*-*");
cint.font_emphasis = gdk_font_load ("-*-helvetica-medium-o-normal-*-*-100-*-*-*-*-*-*");
cint.font_weak = gdk_font_load ("-*-helvetica-medium-r-normal-*-*-100-*-*-*-*-*-*");
cint.font = gdk_font_load ("-*-*-medium-r-normal-*-*-100-*-*-c-*-*-*");
cint.font_strong =
gdk_font_load ("-*-helvetica-bold-r-normal-*-*-120-*-*-*-*-*-*");
cint.font_emphasis =
gdk_font_load ("-*-helvetica-medium-o-normal-*-*-100-*-*-*-*-*-*");
cint.font_weak =
gdk_font_load ("-*-helvetica-medium-r-normal-*-*-100-*-*-*-*-*-*");
cint.font =
gdk_font_load ("-*-*-medium-r-normal-*-*-100-*-*-c-*-*-*");
/* Realize the widget before allowing new text to be inserted */
gtk_widget_realize (cint.console);
......@@ -294,10 +298,8 @@ script_fu_console_interface (void)
gtk_widget_show (hbox);
cint.cc = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (hbox), cint.cc,
TRUE, TRUE, 0);
/* gtk_widget_set_usize (cint.cc, (ENTRY_WIDTH*5)/6, 0); */
GTK_WIDGET_SET_FLAGS (cint.cc, GTK_CAN_DEFAULT);
gtk_widget_grab_default (cint.cc);
gtk_signal_connect (GTK_OBJECT (cint.cc), "key_press_event",
......@@ -305,7 +307,6 @@ script_fu_console_interface (void)
NULL);
button = gtk_button_new_with_label (_("Browse..."));
/* gtk_widget_set_usize (button, (ENTRY_WIDTH)/6, 0); */
gtk_box_pack_start (GTK_BOX (hbox), button,
FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
......@@ -329,8 +330,10 @@ script_fu_console_interface (void)
gtk_main ();
g_source_remove (cint.input_id);
if (dlg)
gtk_widget_destroy (dlg);
gdk_flush ();
}
......@@ -355,7 +358,7 @@ apply_callback (gchar *proc_name,
GimpParamDef *params,
GimpParamDef *return_vals)
{
gint i;
gint i;
GString *text;
if (proc_name == NULL)
......@@ -381,7 +384,7 @@ script_fu_browse_callback (GtkWidget *widget,
gtk_quit_add_destroy (1, (GtkObject*) gimp_db_browser (apply_callback));
}
static gint
static gboolean
script_fu_console_scroll_end (gpointer data)
{
/* The Text widget in 1.0.1 doesn't like being scrolled before
......@@ -404,9 +407,9 @@ script_fu_siod_read (GIOChannel *channel,
GIOCondition cond,
gpointer data)
{
int count;
static int hack = 0;
GIOError error;
static gboolean hack = FALSE;
gint count;
GIOError error;
count = 0;
error = g_io_channel_read (channel, read_buffer, BUFSIZE - 1, &count);
......@@ -424,7 +427,7 @@ script_fu_siod_read (GIOChannel *channel,
* problem with my system.
*/
{
hack = 1;
hack = TRUE;
return TRUE;
}
#endif
......@@ -436,13 +439,14 @@ script_fu_siod_read (GIOChannel *channel,
script_fu_console_scroll_end (NULL);
}
return TRUE;
}
static gint
static gboolean
script_fu_cc_is_empty (void)
{
char *str;
gchar *str;
if ((str = gtk_entry_get_text (GTK_ENTRY (cint.cc))) == NULL)
return TRUE;
......@@ -458,13 +462,13 @@ script_fu_cc_is_empty (void)
return TRUE;
}
static gint
static gboolean
script_fu_cc_key_function (GtkWidget *widget,
GdkEventKey *event,
gpointer data)
{
GList *list;
int direction = 0;
gint direction = 0;
switch (event->keyval)
{
......@@ -480,10 +484,12 @@ script_fu_cc_key_function (GtkWidget *widget,
list->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (cint.cc)));
gtk_text_freeze (GTK_TEXT (cint.console));
gtk_text_insert (GTK_TEXT (cint.console), cint.font_strong, NULL, NULL, "=> ", -1);
gtk_text_insert (GTK_TEXT (cint.console), cint.font_strong, NULL, NULL,
"=> ", -1);
gtk_text_insert (GTK_TEXT (cint.console), cint.font, NULL, NULL,
gtk_entry_get_text (GTK_ENTRY (cint.cc)), -1);
gtk_text_insert (GTK_TEXT (cint.console), cint.font, NULL, NULL, "\n\n", -1);
gtk_text_insert (GTK_TEXT (cint.console), cint.font, NULL, NULL,
"\n\n", -1);
gtk_text_thaw (GTK_TEXT (cint.console));
cint.vadj->value = cint.vadj->upper - cint.vadj->page_size;
......@@ -560,7 +566,8 @@ script_fu_cc_key_function (GtkWidget *widget,
if (history_cur >= history_len)
history_cur = history_len - 1;
gtk_entry_set_text (GTK_ENTRY (cint.cc), (char *) (g_list_nth (history, history_cur))->data);
gtk_entry_set_text (GTK_ENTRY (cint.cc),
(gchar *) (g_list_nth (history, history_cur))->data);
return TRUE;
}
......@@ -603,15 +610,15 @@ script_fu_close_siod_console (void)
}
void
script_fu_eval_run (char *name,
int nparams,
GimpParam *params,
int *nreturn_vals,
GimpParam **return_vals)
script_fu_eval_run (gchar *name,
gint nparams,
GimpParam *params,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[1];
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunModeType run_mode;
GimpRunModeType run_mode;
run_mode = params[0].data.d_int32;
......@@ -635,6 +642,6 @@ script_fu_eval_run (char *name,
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
}
......@@ -145,7 +145,7 @@ typedef struct
gchar **arg_labels;
SFArgValue *arg_defaults;
SFArgValue *arg_values;
gint32 image_based;
gboolean image_based;
GimpParamDef *args; /* used only temporary until installed */
} SFScript;
......@@ -169,10 +169,10 @@ extern long nlength (LISP obj);
* Local Functions
*/
static gint script_fu_install_script (gpointer foo,
static gboolean script_fu_install_script (gpointer foo,
SFScript *script,
gpointer bar);
static gint script_fu_remove_script (gpointer foo,
static gboolean script_fu_remove_script (gpointer foo,
SFScript *script,
gpointer bar);
static void script_fu_script_proc (gchar *name,
......@@ -206,7 +206,7 @@ static void script_fu_font_dialog_ok (GtkWidget *widget,
gpointer data);
static void script_fu_font_dialog_cancel (GtkWidget *widget,
gpointer data);
static gint script_fu_font_dialog_delete (GtkWidget *widget,
static gboolean script_fu_font_dialog_delete (GtkWidget *widget,
GdkEvent *event,
gpointer data);
......@@ -217,12 +217,12 @@ static void script_fu_pattern_preview (gchar *name,
gint height,
gint bytes,
gchar *mask_data,
gint closing,
gboolean closing,
gpointer data);
static void script_fu_gradient_preview (gchar *name,
gint width,
gdouble *mask_data,
gint closing,
gboolean closing,
gpointer data);
static void script_fu_brush_preview (gchar *name,
gdouble opacity,
......@@ -231,7 +231,7 @@ static void script_fu_brush_preview (gchar *name,
gint width,
gint height,
gchar *mask_data,
gint closing,
gboolean closing,
gpointer data);
......@@ -453,8 +453,8 @@ script_fu_add_script (LISP a)
script->num_args = nlength (a) / 3;
args = g_new (GimpParamDef, script->num_args + 1);
args[0].type = GIMP_PDB_INT32;
args[0].name = "run_mode";
args[0].type = GIMP_PDB_INT32;
args[0].name = "run_mode";
args[0].description = "Interactive, non-interactive";
script->arg_types = g_new (SFArgType, script->num_args);
......@@ -789,7 +789,7 @@ script_fu_report_cc (gchar *command)
* The following function is a GTraverseFunction, Please
* note that it frees the script->args structure. --Sven
*/
static gint
static gboolean
script_fu_install_script (gpointer foo,
SFScript *script,
gpointer bar)
......@@ -822,7 +822,7 @@ script_fu_install_script (gpointer foo,
/*
* The following function is a GTraverseFunction.
*/
static gint
static gboolean
script_fu_remove_script (gpointer foo,
SFScript *script,
gpointer bar)
......@@ -832,8 +832,6 @@ script_fu_remove_script (gpointer foo,
return FALSE;
}
static void
script_fu_script_proc (gchar *name,
gint nparams,
......@@ -851,7 +849,9 @@ script_fu_script_proc (gchar *name,
run_mode = params[0].data.d_int32;
if (! (script = script_fu_find_script (name)))
status = GIMP_PDB_CALLING_ERROR;
{
status = GIMP_PDB_CALLING_ERROR;
}
else
{
if (script->num_args == 0)
......@@ -1045,7 +1045,7 @@ script_fu_script_proc (gchar *name,
}
/* this is a GTraverseFunction */
static gint
static gboolean
script_fu_lookup_script (gpointer *foo,
SFScript *script,
gchar **name)
......@@ -1067,7 +1067,10 @@ script_fu_find_script (gchar *pdb_name)
script = pdb_name;
g_tree_traverse (script_list,
(GTraverseFunc)script_fu_lookup_script, G_IN_ORDER, &script);
(GTraverseFunc) script_fu_lookup_script,
G_IN_ORDER,
&script);
if (script == pdb_name)
return NULL;
else
......@@ -1252,9 +1255,9 @@ script_fu_interface (SFScript *script)
{
/* we add a colon after the label;
some languages want an extra space here */
gchar *label_text =
gchar *label_text =
g_strdup_printf (_("%s:"), gettext (script->arg_labels[i]));
gfloat label_yalign = 0.5;
gfloat label_yalign = 0.5;
gboolean widget_leftalign = TRUE;
switch (script->arg_types[i])
......@@ -1317,7 +1320,8 @@ script_fu_interface (SFScript *script)
gtk_check_button_new_with_label (gettext (script->arg_labels[i]));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sf_interface->args_widgets[i]),
script->arg_values[i].sfa_toggle);
gtk_signal_connect (GTK_OBJECT (sf_interface->args_widgets[i]), "toggled",
gtk_signal_connect (GTK_OBJECT (sf_interface->args_widgets[i]),
"toggled",
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
&script->arg_values[i].sfa_toggle);
break;
......@@ -1365,6 +1369,7 @@ script_fu_interface (SFScript *script)
script->arg_defaults[i].sfa_adjustment.digits);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (sf_interface->args_widgets[i]), TRUE);
break;
default: /* this shouldn't happen */
sf_interface->args_widgets[i] = NULL;
break;
......@@ -1378,7 +1383,8 @@ script_fu_interface (SFScript *script)
gimp_file_selection_new (_("Script-Fu File Selection"),
script->arg_values[i].sfa_file.filename,
FALSE, TRUE);
script->arg_values[i].sfa_file.fileselection = sf_interface->args_widgets[i];
script->arg_values[i].sfa_file.fileselection =
sf_interface->args_widgets[i];
gtk_signal_connect (GTK_OBJECT (sf_interface->args_widgets[i]),
"filename_changed",
......@@ -1392,7 +1398,8 @@ script_fu_interface (SFScript *script)
sf_interface->args_widgets[i] = gtk_button_new ();
script->arg_values[i].sfa_font.preview = gtk_label_new ("");
script->arg_values[i].sfa_font.dialog = NULL;
gtk_widget_set_usize (sf_interface->args_widgets[i], FONT_PREVIEW_WIDTH, 0);
gtk_widget_set_usize (sf_interface->args_widgets[i],
FONT_PREVIEW_WIDTH, 0);
gtk_container_add (GTK_CONTAINER (sf_interface->args_widgets[i]),
script->arg_values[i].sfa_font.preview);
gtk_widget_show (script->arg_values[i].sfa_font.preview);
......@@ -1400,35 +1407,36 @@ script_fu_interface (SFScript *script)
script_fu_font_preview (script->arg_values[i].sfa_font.preview,
script->arg_values[i].sfa_font.fontname);
gtk_signal_connect (GTK_OBJECT (sf_interface->args_widgets[i]), "clicked",
gtk_signal_connect (GTK_OBJECT (sf_interface->args_widgets[i]),
"clicked",
(GtkSignalFunc) script_fu_font_preview_callback,
&script->arg_values[i].sfa_font);
break;
case SF_PATTERN:
sf_interface->args_widgets[i] =
gimp_pattern_select_widget(_("Script-fu Pattern Selection"),
script->arg_values[i].sfa_pattern,
script_fu_pattern_preview,
&script->arg_values[i].sfa_pattern);
gimp_pattern_select_widget (_("Script-fu Pattern Selection"),
script->arg_values[i].sfa_pattern,
script_fu_pattern_preview,
&script->arg_values[i].sfa_pattern);
break;
case SF_GRADIENT:
sf_interface->args_widgets[i] =
gimp_gradient_select_widget(_("Script-Fu Gradient Selection"),
script->arg_values[i].sfa_gradient,
script_fu_gradient_preview,
&script->arg_values[i].sfa_gradient);
gimp_gradient_select_widget (_("Script-Fu Gradient Selection"),
script->arg_values[i].sfa_gradient,
script_fu_gradient_preview,
&script->arg_values[i].sfa_gradient);
break;
case SF_BRUSH:
sf_interface->args_widgets[i] =
gimp_brush_select_widget(_("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,
script_fu_brush_preview,
&script->arg_values[i].sfa_brush);
gimp_brush_select_widget (_("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,
script_fu_brush_preview,
&script->arg_values[i].sfa_brush);
break;
case SF_OPTION:
......@@ -1444,6 +1452,7 @@ script_fu_interface (SFScript *script)
gtk_menu_append (GTK_MENU (menu), menu_item);
gtk_widget_show (menu_item);
}
gtk_option_menu_set_menu (GTK_OPTION_MENU (sf_interface->args_widgets[i]),
menu);
gtk_option_menu_set_history (GTK_OPTION_MENU (sf_interface->args_widgets[i]),
......@@ -1607,7 +1616,7 @@ script_fu_pattern_preview (gchar *name,
gint height,
gint bytes,
gchar *mask_data,
gint closing,
gboolean closing,
gpointer data)
{
gchar **pname;
......@@ -1622,7 +1631,7 @@ static void
script_fu_gradient_preview (gchar *name,
gint width,
gdouble *mask_data,
gint closing,
gboolean closing,
gpointer data)
{
gchar **gname;
......@@ -1641,7 +1650,7 @@ script_fu_brush_preview (gchar *name,
gint width,
gint height,
gchar *mask_data,
gint closing,
gboolean closing,
gpointer data)
{
SFBrush *brush;
......@@ -1649,6 +1658,7 @@ script_fu_brush_preview (gchar *name,
brush = (SFBrush *) data;
g_free (brush->name);
brush->name = g_strdup (name);
brush->opacity = opacity;
brush->spacing = spacing;
......@@ -1660,8 +1670,8 @@ script_fu_font_preview (GtkWidget *preview,
gchar *data)
{
GdkFont *font;
gchar *fontname;
gchar *family;
gchar *fontname;
gchar *family;
if (data == NULL)
return;
......@@ -1730,7 +1740,7 @@ script_fu_ok_callback (GtkWidget *widget,
case SF_DRAWABLE:
case SF_LAYER:
case SF_CHANNEL:
length += 12; /* Maximum size of integer value will not exceed this many characters */
length += 12; /* Maximum size of integer value */
break;
case SF_COLOR:
......@@ -1752,7 +1762,7 @@ script_fu_ok_callback (GtkWidget *widget,
break;
case SF_ADJUSTMENT:
length += 24; /* Maximum size of float value should not exceed this many characters */
length += 24; /* Maximum size of float value */
break;
case SF_FILENAME:
......@@ -1775,11 +1785,12 @@ script_fu_ok_callback (GtkWidget *widget,
case SF_BRUSH:
length += strlen (script->arg_values[i].sfa_brush.name) + 3;