From e51f6f666c966f19ee6f775519c2ab7c3b0534db Mon Sep 17 00:00:00 2001 From: "GMT 1999 Adam D. Moss" Date: Tue, 23 Feb 1999 00:18:24 +0000 Subject: [PATCH] Moved the RunModeType enum into the header so we can use it elsewhere Tue Feb 23 00:05:39 GMT 1999 Adam D. Moss * app/plug_in.c app/plug_in.h: Moved the RunModeType enum into the header so we can use it elsewhere (e.g. fileops) * plug-ins/gif/gif.c plug-ins/jpeg/jpeg.c: Don't show progress-bars if we're running noninteractively. This makes thumbnail updating look more pleasant. Try to do the same for all file plugins (and others)! * app/fileops.c: Reworked the thumbnail display again, fixed some buglets, file_open_image() is RunMode aware, added some tweaks, rhubarb rhubarb, merged in some 'cosmetic' tweaks from Marco. --- ChangeLog | 17 ++++ MAINTAINERS | 6 +- app/actions/plug-in-commands.c | 7 -- app/fileops.c | 142 +++++++++++++++++++-------- app/gui/plug-in-commands.c | 7 -- app/gui/plug-in-menus.c | 7 -- app/menus/plug-in-menus.c | 7 -- app/plug-in/gimpplugin-message.c | 7 -- app/plug-in/gimpplugin-progress.c | 7 -- app/plug-in/gimpplugin-progress.h | 9 ++ app/plug-in/gimpplugin.c | 7 -- app/plug-in/gimpplugin.h | 9 ++ app/plug-in/gimppluginmanager-call.c | 7 -- app/plug-in/gimppluginmanager-run.c | 7 -- app/plug-in/gimppluginmanager.c | 7 -- app/plug-in/gimppluginmanager.h | 9 ++ app/plug-in/gimppluginshm.c | 7 -- app/plug-in/plug-in-def.c | 7 -- app/plug-in/plug-in-def.h | 9 ++ app/plug-in/plug-in-message.c | 7 -- app/plug-in/plug-in-params.c | 7 -- app/plug-in/plug-in-params.h | 9 ++ app/plug-in/plug-in-progress.c | 7 -- app/plug-in/plug-in-progress.h | 9 ++ app/plug-in/plug-in-run.c | 7 -- app/plug-in/plug-in-shm.c | 7 -- app/plug-in/plug-in.c | 7 -- app/plug-in/plug-in.h | 9 ++ app/plug-in/plug-ins.c | 7 -- app/plug-in/plug-ins.h | 9 ++ app/plug_in.c | 7 -- app/plug_in.h | 9 ++ plug-ins/common/gif.c | 56 ++++++----- plug-ins/common/jpeg.c | 22 +++-- plug-ins/gif/gif.c | 56 ++++++----- plug-ins/jpeg/jpeg-load.c | 22 +++-- plug-ins/jpeg/jpeg-load.h | 22 +++-- plug-ins/jpeg/jpeg-save.c | 22 +++-- plug-ins/jpeg/jpeg-save.h | 22 +++-- plug-ins/jpeg/jpeg.c | 22 +++-- plug-ins/jpeg/jpeg.h | 22 +++-- 41 files changed, 369 insertions(+), 283 deletions(-) diff --git a/ChangeLog b/ChangeLog index a0c75e6c5a..3fb4807d1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +Tue Feb 23 00:05:39 GMT 1999 Adam D. Moss + + * app/plug_in.c + app/plug_in.h: Moved the RunModeType enum + into the header so we can use it elsewhere (e.g. fileops) + + * plug-ins/gif/gif.c + plug-ins/jpeg/jpeg.c: Don't show progress-bars if we're + running noninteractively. This makes thumbnail updating + look more pleasant. Try to do the same for all file plugins + (and others)! + + * app/fileops.c: Reworked the thumbnail display again, fixed + some buglets, file_open_image() is RunMode aware, added some + tweaks, rhubarb rhubarb, merged in some 'cosmetic' tweaks + from Marco. + 1999-02-22 adam, blah blah * app/appenv.h: fixed a macro bug waiting to happen diff --git a/MAINTAINERS b/MAINTAINERS index 60479d6554..31b7d292cc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -115,9 +115,9 @@ commit access: yes Name: Adam D. Moss Email: adam@gimp.org url: http://www.foxbox.org -ircnick: aspirin -expertise: convert.c, idlerender, general core and UI, gif.c - animationplay.c and various other subversive plugins. +ircnick: Aspirin +expertise: convert.c, idlerender, general core and UI, thumbnails, + gif.c, animationplay.c and various other subversive plugins. current work: making derisive comments about everyone else's cvs commits commit access: yes diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index 569ab72668..528c00c8b6 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/fileops.c b/app/fileops.c index 899114466c..89166ef39f 100644 --- a/app/fileops.c +++ b/app/fileops.c @@ -83,7 +83,8 @@ static gint file_overwrite_delete_callback (GtkWidget *w, gpointer client_data); static GimpImage* file_open_image (char *filename, - char *raw_filename); + char *raw_filename, + RunModeType runmode); static void genbutton_callback (GtkWidget *w, gpointer client_data); @@ -136,7 +137,7 @@ static GtkPreview *open_options_preview = NULL; static GtkWidget *open_options_fixed = NULL; static GtkWidget *open_options_label = NULL; static GtkWidget *open_options_frame = NULL; -static GtkWidget *open_options_genbutton = NULL; +static GtkWidget *open_options_genbuttonlabel = NULL; /* Some state for the thumbnailer */ static gchar *preview_fullname = NULL; @@ -186,7 +187,7 @@ static ProcRecord file_save_proc = { "gimp_file_save", "Saves a file by extension", - "This procedure invokes the correct file save handler according to the file's extension and/or prefix. The name of the file to save is typically a full pathname, and the name entered is what the user actually typed before prepending a directory path. The reason for this is that if the user types http://www.xcf/~gimp he wants to fetch a URL, and the full pathname will not look like a URL.", + "This procedure invokes the correct file save handler according to the file's extension and/or prefix. The name of the file to save is typically a full pathname, and the name entered is what the user actually typed before prepending a directory path. The reason for this is that if the user types http://www.xcf/~gimp she wants to fetch a URL, and the full pathname will not look like a URL.", "Josh MacDonald", "Josh MacDonald", "1997", @@ -516,6 +517,7 @@ file_open_callback (GtkWidget *w, GtkWidget *label; GtkWidget *option_menu; GtkWidget *load_menu; + GtkWidget *open_options_genbutton; GDisplay *gdisplay; if (!fileload) @@ -568,25 +570,25 @@ file_open_callback (GtkWidget *w, vbox = gtk_vbox_new (FALSE, 0); { - gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 2); gtk_container_add (GTK_CONTAINER (frame), vbox); - hbox = gtk_hbox_new (TRUE, 1); + hbox = gtk_hbox_new (FALSE, 1); { - gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); label = gtk_label_new (_("Determine file type:")); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 5); gtk_widget_show (label); option_menu = gtk_option_menu_new (); - gtk_box_pack_start (GTK_BOX (hbox), option_menu, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (hbox), option_menu, FALSE, TRUE, 0); gtk_widget_show (option_menu); menus_get_load_menu (&load_menu, NULL); gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), load_menu); - gtk_box_pack_start (GTK_BOX (open_options), frame, FALSE, TRUE, 5); + gtk_box_pack_start (GTK_BOX (open_options), frame, TRUE, TRUE, 5); } gtk_widget_show (hbox); } @@ -612,31 +614,66 @@ file_open_callback (GtkWidget *w, gtk_container_set_border_width (GTK_CONTAINER (hbox), 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); - open_options_genbutton = gtk_button_new_with_label - ("generate\npreview"); + open_options_genbutton = gtk_button_new(); { gtk_signal_connect (GTK_OBJECT (open_options_genbutton), "clicked", (GtkSignalFunc) genbutton_callback, open_options_genbutton); gtk_box_pack_end (GTK_BOX (hbox), open_options_genbutton, - FALSE, FALSE, 0); + TRUE, FALSE, 0); } gtk_widget_show (open_options_genbutton); open_options_fixed = gtk_fixed_new (); { - gtk_widget_set_usize (open_options_fixed, 80, 60); - gtk_box_pack_start (GTK_BOX (hbox), open_options_fixed, - FALSE, FALSE, 0); + GtkWidget* abox; + GtkWidget* sbox; - open_options_preview = GTK_PREVIEW (gtk_preview_new - (GTK_PREVIEW_COLOR)); + gtk_widget_set_usize (open_options_fixed, 80, 60); + gtk_container_add (GTK_CONTAINER (GTK_BIN (open_options_genbutton)), open_options_fixed); + + sbox = gtk_vbox_new(TRUE, 0); { + GtkWidget* align; + gtk_container_add (GTK_CONTAINER (open_options_fixed), - GTK_WIDGET (open_options_preview)); + GTK_WIDGET (sbox)); + + align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); + { + gtk_widget_set_usize (align, 80, 60); + + gtk_box_pack_start (GTK_BOX (sbox), + GTK_WIDGET (align), + FALSE, TRUE, 0); + + abox = gtk_hbox_new (FALSE, 0); + { + gtk_container_add (GTK_CONTAINER (align), abox); + + open_options_preview = GTK_PREVIEW (gtk_preview_new + (GTK_PREVIEW_COLOR)); + { + gtk_box_pack_start (GTK_BOX (abox), + GTK_WIDGET (open_options_preview), + FALSE, TRUE, 0); + } + gtk_widget_show(GTK_WIDGET (open_options_preview)); + + open_options_genbuttonlabel = gtk_label_new("generate\npreview"); + { + gtk_box_pack_start (GTK_BOX (abox), + GTK_WIDGET (open_options_genbuttonlabel), + FALSE, TRUE, 0); + } + gtk_widget_show(GTK_WIDGET (open_options_genbuttonlabel)); + } + gtk_widget_show(abox); + } + gtk_widget_show(align); } - gtk_widget_show(GTK_WIDGET (open_options_preview)); + gtk_widget_show(sbox); } gtk_widget_show (open_options_fixed); } @@ -655,13 +692,16 @@ file_open_callback (GtkWidget *w, /* pack the containing open_options hbox into the load-dialog */ gtk_box_pack_end (GTK_BOX (GTK_FILE_SELECTION (fileload)->main_vbox), - open_options, FALSE, FALSE, 5); + open_options, FALSE, FALSE, 1); } gtk_frame_set_label (GTK_FRAME(open_options_frame), _("Preview")); gtk_label_set_text (GTK_LABEL(open_options_label), "No selection."); - gtk_widget_set_sensitive (GTK_WIDGET(open_options_genbutton), FALSE); + + gtk_widget_show (GTK_WIDGET(open_options_genbuttonlabel)); gtk_widget_hide (GTK_WIDGET(open_options_preview)); + gtk_widget_set_sensitive (GTK_WIDGET(open_options_frame), FALSE); + gtk_widget_show (open_options); file_dialog_show (fileload); @@ -788,7 +828,7 @@ file_revert_callback (GtkWidget *w, filename = gimage_filename (gdisplay->gimage); raw_filename = g_basename (filename); - if ((gimage = file_open_image (filename, raw_filename)) != NULL) + if ((gimage = file_open_image (filename, raw_filename, RUN_INTERACTIVE)) != NULL) gdisplay_reconnect (gdisplay, gimage); else g_message (_("Revert failed.")); @@ -858,7 +898,7 @@ file_save_type_callback (GtkWidget *w, } static GimpImage* -file_open_image (char *filename, char *raw_filename) +file_open_image (char *filename, char *raw_filename, RunModeType runmode) { PlugInProcDef *file_proc; ProcRecord *proc; @@ -886,7 +926,7 @@ file_open_image (char *filename, char *raw_filename) for (i = 0; i < proc->num_args; i++) args[i].arg_type = proc->args[i].arg_type; - args[0].value.pdb_int = 0; + args[0].value.pdb_int = runmode; args[1].value.pdb_pointer = filename; args[2].value.pdb_pointer = raw_filename; @@ -908,7 +948,7 @@ file_open (char *filename, char *raw_filename) { GimpImage *gimage; - if ((gimage = file_open_image (filename, raw_filename)) != NULL) + if ((gimage = file_open_image (filename, raw_filename, RUN_INTERACTIVE)) != NULL) { /* enable & clear all undo steps */ gimage_enable_undo (gimage); @@ -986,14 +1026,14 @@ file_save_thumbnail (GimpImage* gimage, } } - printf("tn: %d x %d -> ", w, h);fflush(stdout); + /*printf("tn: %d x %d -> ", w, h);fflush(stdout);*/ tempbuf = gimp_image_composite_preview (gimage, Gray, w, h); tbd = temp_buf_data(tempbuf); w = tempbuf->width; h = tempbuf->height; - printf("tn: %d x %d\n", w, h);fflush(stdout); + /*printf("tn: %d x %d\n", w, h);fflush(stdout);*/ mkdir (xvpathname, 0755); @@ -1242,6 +1282,7 @@ readXVThumb(const gchar *fnam, } +/* don't call with preview_fullname as parameter! will be clobbered! */ static void set_preview (const gchar* fullfname) { @@ -1255,8 +1296,8 @@ set_preview (const gchar* fullfname) struct stat file_stat; struct stat thumb_stat; gboolean thumb_may_be_outdated = FALSE; - gboolean show_generate_button = FALSE; - + gboolean show_generate_label = TRUE; + pname = g_dirname (fullfname); fname = g_basename (fullfname); /* Don't free this! */ @@ -1274,7 +1315,6 @@ set_preview (const gchar* fullfname) if ((thumb_stat.st_mtime) < (file_stat.st_mtime)) { thumb_may_be_outdated = TRUE; - show_generate_button = TRUE; } } @@ -1284,8 +1324,11 @@ set_preview (const gchar* fullfname) gtk_frame_set_label (GTK_FRAME(open_options_frame), fname); + if (preview_fullname) - g_free (preview_fullname); + { + g_free (preview_fullname); + } preview_fullname = g_strdup (fullfname); if (raw_thumb) @@ -1315,6 +1358,8 @@ set_preview (const gchar* fullfname) (imginfo ? imginfo : "(no information)")); gtk_widget_show (GTK_WIDGET(open_options_preview)); gtk_widget_queue_draw (GTK_WIDGET(open_options_preview)); + + show_generate_label = FALSE; g_free (thumb_rgb); g_free (raw_thumb); @@ -1324,17 +1369,21 @@ set_preview (const gchar* fullfname) if (imginfo) g_free(imginfo); - show_generate_button = TRUE; - gtk_widget_hide (GTK_WIDGET(open_options_preview)); gtk_label_set_text (GTK_LABEL(open_options_label), "no preview available"); } - if (show_generate_button) - gtk_widget_set_sensitive (GTK_WIDGET(open_options_genbutton), TRUE); + if (show_generate_label) + { + gtk_widget_hide (GTK_WIDGET(open_options_preview)); + gtk_widget_show (GTK_WIDGET(open_options_genbuttonlabel)); + } else - gtk_widget_set_sensitive (GTK_WIDGET(open_options_genbutton), FALSE); + { + gtk_widget_hide (GTK_WIDGET(open_options_genbuttonlabel)); + gtk_widget_show (GTK_WIDGET(open_options_preview)); + } } @@ -1346,6 +1395,7 @@ file_open_clistrow_callback (GtkWidget *w, fullfname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fileload)); + gtk_widget_set_sensitive (GTK_WIDGET(open_options_frame), TRUE); set_preview (fullfname); } @@ -1355,24 +1405,36 @@ genbutton_callback (GtkWidget *w, gpointer client_data) { GimpImage* gimage_to_be_thumbed; + gchar* filename; if (!preview_fullname) { g_warning ("Tried to generate thumbnail for NULL filename."); return; } + + filename = g_strdup(preview_fullname); gimp_add_busy_cursors(); gtk_widget_set_sensitive (GTK_WIDGET (fileload), FALSE); - if ((gimage_to_be_thumbed = file_open_image (preview_fullname, - g_basename(preview_fullname)))) + if ((gimage_to_be_thumbed = file_open_image (filename, + g_basename(filename), + RUN_NONINTERACTIVE))) { - file_save_thumbnail (gimage_to_be_thumbed, preview_fullname); + file_save_thumbnail (gimage_to_be_thumbed, filename); + set_preview(filename); gimage_delete (gimage_to_be_thumbed); } - set_preview(preview_fullname); + else + { + gtk_label_set_text (GTK_LABEL(open_options_label), + "(could not make preview)"); + } + gtk_widget_set_sensitive (GTK_WIDGET (fileload), TRUE); gimp_remove_busy_cursors(NULL); + + g_free (filename); } diff --git a/app/gui/plug-in-commands.c b/app/gui/plug-in-commands.c index 569ab72668..528c00c8b6 100644 --- a/app/gui/plug-in-commands.c +++ b/app/gui/plug-in-commands.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index 569ab72668..528c00c8b6 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index 569ab72668..528c00c8b6 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/gimpplugin-progress.h b/app/plug-in/gimpplugin-progress.h index 4e52275b80..0fcf1ab3b4 100644 --- a/app/plug-in/gimpplugin-progress.h +++ b/app/plug-in/gimpplugin-progress.h @@ -34,6 +34,15 @@ #define INDEXEDA_IMAGE 0x20 + +typedef enum +{ + RUN_INTERACTIVE = 0x0, + RUN_NONINTERACTIVE = 0x1, + RUN_WITH_LAST_VALS = 0x2 +} RunModeType; + + typedef struct _PlugIn PlugIn; typedef struct _PlugInDef PlugInDef; typedef struct _PlugInProcDef PlugInProcDef; diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/gimpplugin.h b/app/plug-in/gimpplugin.h index 4e52275b80..0fcf1ab3b4 100644 --- a/app/plug-in/gimpplugin.h +++ b/app/plug-in/gimpplugin.h @@ -34,6 +34,15 @@ #define INDEXEDA_IMAGE 0x20 + +typedef enum +{ + RUN_INTERACTIVE = 0x0, + RUN_NONINTERACTIVE = 0x1, + RUN_WITH_LAST_VALS = 0x2 +} RunModeType; + + typedef struct _PlugIn PlugIn; typedef struct _PlugInDef PlugInDef; typedef struct _PlugInProcDef PlugInProcDef; diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/gimppluginmanager.h b/app/plug-in/gimppluginmanager.h index 4e52275b80..0fcf1ab3b4 100644 --- a/app/plug-in/gimppluginmanager.h +++ b/app/plug-in/gimppluginmanager.h @@ -34,6 +34,15 @@ #define INDEXEDA_IMAGE 0x20 + +typedef enum +{ + RUN_INTERACTIVE = 0x0, + RUN_NONINTERACTIVE = 0x1, + RUN_WITH_LAST_VALS = 0x2 +} RunModeType; + + typedef struct _PlugIn PlugIn; typedef struct _PlugInDef PlugInDef; typedef struct _PlugInProcDef PlugInProcDef; diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/gimppluginshm.c +++ b/app/plug-in/gimppluginshm.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/plug-in-def.c b/app/plug-in/plug-in-def.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/plug-in-def.c +++ b/app/plug-in/plug-in-def.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/plug-in-def.h b/app/plug-in/plug-in-def.h index 4e52275b80..0fcf1ab3b4 100644 --- a/app/plug-in/plug-in-def.h +++ b/app/plug-in/plug-in-def.h @@ -34,6 +34,15 @@ #define INDEXEDA_IMAGE 0x20 + +typedef enum +{ + RUN_INTERACTIVE = 0x0, + RUN_NONINTERACTIVE = 0x1, + RUN_WITH_LAST_VALS = 0x2 +} RunModeType; + + typedef struct _PlugIn PlugIn; typedef struct _PlugInDef PlugInDef; typedef struct _PlugInProcDef PlugInProcDef; diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/plug-in-params.c +++ b/app/plug-in/plug-in-params.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/plug-in-params.h b/app/plug-in/plug-in-params.h index 4e52275b80..0fcf1ab3b4 100644 --- a/app/plug-in/plug-in-params.h +++ b/app/plug-in/plug-in-params.h @@ -34,6 +34,15 @@ #define INDEXEDA_IMAGE 0x20 + +typedef enum +{ + RUN_INTERACTIVE = 0x0, + RUN_NONINTERACTIVE = 0x1, + RUN_WITH_LAST_VALS = 0x2 +} RunModeType; + + typedef struct _PlugIn PlugIn; typedef struct _PlugInDef PlugInDef; typedef struct _PlugInProcDef PlugInProcDef; diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/plug-in-progress.h b/app/plug-in/plug-in-progress.h index 4e52275b80..0fcf1ab3b4 100644 --- a/app/plug-in/plug-in-progress.h +++ b/app/plug-in/plug-in-progress.h @@ -34,6 +34,15 @@ #define INDEXEDA_IMAGE 0x20 + +typedef enum +{ + RUN_INTERACTIVE = 0x0, + RUN_NONINTERACTIVE = 0x1, + RUN_WITH_LAST_VALS = 0x2 +} RunModeType; + + typedef struct _PlugIn PlugIn; typedef struct _PlugInDef PlugInDef; typedef struct _PlugInProcDef PlugInProcDef; diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/plug-in-shm.c b/app/plug-in/plug-in-shm.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/plug-in-shm.c +++ b/app/plug-in/plug-in-shm.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/plug-in.h b/app/plug-in/plug-in.h index 4e52275b80..0fcf1ab3b4 100644 --- a/app/plug-in/plug-in.h +++ b/app/plug-in/plug-in.h @@ -34,6 +34,15 @@ #define INDEXEDA_IMAGE 0x20 + +typedef enum +{ + RUN_INTERACTIVE = 0x0, + RUN_NONINTERACTIVE = 0x1, + RUN_WITH_LAST_VALS = 0x2 +} RunModeType; + + typedef struct _PlugIn PlugIn; typedef struct _PlugInDef PlugInDef; typedef struct _PlugInProcDef PlugInProcDef; diff --git a/app/plug-in/plug-ins.c b/app/plug-in/plug-ins.c index 569ab72668..528c00c8b6 100644 --- a/app/plug-in/plug-ins.c +++ b/app/plug-in/plug-ins.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug-in/plug-ins.h b/app/plug-in/plug-ins.h index 4e52275b80..0fcf1ab3b4 100644 --- a/app/plug-in/plug-ins.h +++ b/app/plug-in/plug-ins.h @@ -34,6 +34,15 @@ #define INDEXEDA_IMAGE 0x20 + +typedef enum +{ + RUN_INTERACTIVE = 0x0, + RUN_NONINTERACTIVE = 0x1, + RUN_WITH_LAST_VALS = 0x2 +} RunModeType; + + typedef struct _PlugIn PlugIn; typedef struct _PlugInDef PlugInDef; typedef struct _PlugInProcDef PlugInProcDef; diff --git a/app/plug_in.c b/app/plug_in.c index 569ab72668..528c00c8b6 100644 --- a/app/plug_in.c +++ b/app/plug_in.c @@ -68,13 +68,6 @@ typedef struct _PlugInBlocked PlugInBlocked; -typedef enum -{ - RUN_INTERACTIVE = 0x0, - RUN_NONINTERACTIVE = 0x1, - RUN_WITH_LAST_VALS = 0x2 -} RunModeType; - struct _PlugInBlocked { PlugIn *plug_in; diff --git a/app/plug_in.h b/app/plug_in.h index 4e52275b80..0fcf1ab3b4 100644 --- a/app/plug_in.h +++ b/app/plug_in.h @@ -34,6 +34,15 @@ #define INDEXEDA_IMAGE 0x20 + +typedef enum +{ + RUN_INTERACTIVE = 0x0, + RUN_NONINTERACTIVE = 0x1, + RUN_WITH_LAST_VALS = 0x2 +} RunModeType; + + typedef struct _PlugIn PlugIn; typedef struct _PlugInDef PlugInDef; typedef struct _PlugInProcDef PlugInProcDef; diff --git a/plug-ins/common/gif.c b/plug-ins/common/gif.c index bf3db82310..a629f04a47 100644 --- a/plug-ins/common/gif.c +++ b/plug-ins/common/gif.c @@ -7,7 +7,7 @@ * Based around original GIF code by David Koblas. * * - * Version 2.1.1 - 99/01/23 + * Version 2.1.2 - 99/02/22 * Adam D. Moss - */ /* @@ -23,6 +23,9 @@ /* * REVISION HISTORY * + * 99/02/22 + * 2.01.02 - Don't show a progress bar when loading non-interactively + * * 99/01/23 * 2.01.01 - Use a text-box to permit multi-line comments. Don't * try to write comment blocks which are longer than @@ -270,7 +273,7 @@ #define FACEHUGGERS aieee #endif /* PS: I know that technically facehuggers aren't parasites, - the pupal-forms are. But facehuggers are cute. */ + the pupal-forms are. But facehuggers are ky00te. */ typedef struct @@ -301,10 +304,8 @@ static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID); -static gboolean -boundscheck (gint32 image_ID); -static gboolean -badbounds_dialog ( void ); +static gboolean boundscheck (gint32 image_ID); +static gboolean badbounds_dialog ( void ); static void cropok_callback (GtkWidget *widget, @@ -341,6 +342,7 @@ static gint radio_pressed[3]; static guchar used_cmap[3][256]; static gboolean can_crop; +static GRunModeType run_mode; static guchar highest_used_index; static gboolean promote_to_rgb = FALSE; static guchar gimp_cmap[768]; @@ -446,7 +448,6 @@ run (char *name, { static GParam values[2]; GStatusType status = STATUS_SUCCESS; - GRunModeType run_mode; gint32 image_ID; gchar **argv; gint argc; @@ -661,9 +662,12 @@ load_image (char *filename) name_buf = g_malloc (strlen (filename) + 11); - sprintf (name_buf, "Loading %s:", filename); - gimp_progress_init (name_buf); - g_free (name_buf); + if (run_mode != RUN_NONINTERACTIVE) + { + sprintf (name_buf, "Loading %s:", filename); + gimp_progress_init (name_buf); + g_free (name_buf); + } if (!ReadOK (fd, buf, 6)) { @@ -1382,9 +1386,12 @@ ReadImage (FILE *fd, ypos++; } - cur_progress++; - if ((cur_progress % 16) == 0) - gimp_progress_update ((double) cur_progress / (double) max_progress); + if (run_mode != RUN_NONINTERACTIVE) + { + cur_progress++; + if ((cur_progress % 16) == 0) + gimp_progress_update ((double) cur_progress / (double) max_progress); + } } if (ypos >= height) break; @@ -1786,12 +1793,14 @@ save_image (char *filename, break; } - - /* init the progress meter */ - temp_buf = g_malloc (strlen (filename) + 11); - sprintf (temp_buf, "Saving %s:", filename); - gimp_progress_init (temp_buf); - g_free (temp_buf); + if (run_mode != RUN_NONINTERACTIVE) + { + /* init the progress meter */ + temp_buf = g_malloc (strlen (filename) + 11); + sprintf (temp_buf, "Saving %s:", filename); + gimp_progress_init (temp_buf); + g_free (temp_buf); + } /* open the destination file for writing */ @@ -2383,9 +2392,12 @@ BumpPixel () */ if (curx == Width) { - cur_progress++; - if ((cur_progress % 16) == 0) - gimp_progress_update ((double) cur_progress / (double) max_progress); + if (run_mode != RUN_NONINTERACTIVE) + { + cur_progress++; + if ((cur_progress % 16) == 0) + gimp_progress_update ((double) cur_progress / (double) max_progress); + } curx = 0; diff --git a/plug-ins/common/jpeg.c b/plug-ins/common/jpeg.c index 37cb64548b..d84ddf145b 100644 --- a/plug-ins/common/jpeg.c +++ b/plug-ins/common/jpeg.c @@ -94,7 +94,7 @@ static void run (char *name, GParam *param, int *nreturn_vals, GParam **return_vals); -static gint32 load_image (char *filename); +static gint32 load_image (char *filename, GRunModeType runmode); static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID); @@ -220,7 +220,7 @@ run (char *name, if (strcmp (name, "file_jpeg_load") == 0) { - image_ID = load_image (param[1].data.d_string); + image_ID = load_image (param[1].data.d_string, run_mode); if (image_ID != -1) { @@ -445,7 +445,7 @@ my_error_exit (j_common_ptr cinfo) } static gint32 -load_image (char *filename) +load_image (char *filename, GRunModeType runmode) { GPixelRgn pixel_rgn; GDrawable *drawable; @@ -480,10 +480,13 @@ load_image (char *filename) gimp_quit (); } - name = malloc (strlen (filename) + 12); - sprintf (name, "Loading %s:", filename); - gimp_progress_init (name); - free (name); + if (runmode != RUN_NONINTERACTIVE) + { + name = malloc (strlen (filename) + 12); + sprintf (name, "Loading %s:", filename); + gimp_progress_init (name); + free (name); + } image_ID = -1; /* Establish the setjmp return context for my_error_exit to use. */ @@ -668,7 +671,10 @@ load_image (char *filename) gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, start, drawable->width, scanlines); - gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + if (runmode != RUN_NONINTERACTIVE) + { + gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + } } /* Step 7: Finish decompression */ diff --git a/plug-ins/gif/gif.c b/plug-ins/gif/gif.c index bf3db82310..a629f04a47 100644 --- a/plug-ins/gif/gif.c +++ b/plug-ins/gif/gif.c @@ -7,7 +7,7 @@ * Based around original GIF code by David Koblas. * * - * Version 2.1.1 - 99/01/23 + * Version 2.1.2 - 99/02/22 * Adam D. Moss - */ /* @@ -23,6 +23,9 @@ /* * REVISION HISTORY * + * 99/02/22 + * 2.01.02 - Don't show a progress bar when loading non-interactively + * * 99/01/23 * 2.01.01 - Use a text-box to permit multi-line comments. Don't * try to write comment blocks which are longer than @@ -270,7 +273,7 @@ #define FACEHUGGERS aieee #endif /* PS: I know that technically facehuggers aren't parasites, - the pupal-forms are. But facehuggers are cute. */ + the pupal-forms are. But facehuggers are ky00te. */ typedef struct @@ -301,10 +304,8 @@ static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID); -static gboolean -boundscheck (gint32 image_ID); -static gboolean -badbounds_dialog ( void ); +static gboolean boundscheck (gint32 image_ID); +static gboolean badbounds_dialog ( void ); static void cropok_callback (GtkWidget *widget, @@ -341,6 +342,7 @@ static gint radio_pressed[3]; static guchar used_cmap[3][256]; static gboolean can_crop; +static GRunModeType run_mode; static guchar highest_used_index; static gboolean promote_to_rgb = FALSE; static guchar gimp_cmap[768]; @@ -446,7 +448,6 @@ run (char *name, { static GParam values[2]; GStatusType status = STATUS_SUCCESS; - GRunModeType run_mode; gint32 image_ID; gchar **argv; gint argc; @@ -661,9 +662,12 @@ load_image (char *filename) name_buf = g_malloc (strlen (filename) + 11); - sprintf (name_buf, "Loading %s:", filename); - gimp_progress_init (name_buf); - g_free (name_buf); + if (run_mode != RUN_NONINTERACTIVE) + { + sprintf (name_buf, "Loading %s:", filename); + gimp_progress_init (name_buf); + g_free (name_buf); + } if (!ReadOK (fd, buf, 6)) { @@ -1382,9 +1386,12 @@ ReadImage (FILE *fd, ypos++; } - cur_progress++; - if ((cur_progress % 16) == 0) - gimp_progress_update ((double) cur_progress / (double) max_progress); + if (run_mode != RUN_NONINTERACTIVE) + { + cur_progress++; + if ((cur_progress % 16) == 0) + gimp_progress_update ((double) cur_progress / (double) max_progress); + } } if (ypos >= height) break; @@ -1786,12 +1793,14 @@ save_image (char *filename, break; } - - /* init the progress meter */ - temp_buf = g_malloc (strlen (filename) + 11); - sprintf (temp_buf, "Saving %s:", filename); - gimp_progress_init (temp_buf); - g_free (temp_buf); + if (run_mode != RUN_NONINTERACTIVE) + { + /* init the progress meter */ + temp_buf = g_malloc (strlen (filename) + 11); + sprintf (temp_buf, "Saving %s:", filename); + gimp_progress_init (temp_buf); + g_free (temp_buf); + } /* open the destination file for writing */ @@ -2383,9 +2392,12 @@ BumpPixel () */ if (curx == Width) { - cur_progress++; - if ((cur_progress % 16) == 0) - gimp_progress_update ((double) cur_progress / (double) max_progress); + if (run_mode != RUN_NONINTERACTIVE) + { + cur_progress++; + if ((cur_progress % 16) == 0) + gimp_progress_update ((double) cur_progress / (double) max_progress); + } curx = 0; diff --git a/plug-ins/jpeg/jpeg-load.c b/plug-ins/jpeg/jpeg-load.c index 37cb64548b..d84ddf145b 100644 --- a/plug-ins/jpeg/jpeg-load.c +++ b/plug-ins/jpeg/jpeg-load.c @@ -94,7 +94,7 @@ static void run (char *name, GParam *param, int *nreturn_vals, GParam **return_vals); -static gint32 load_image (char *filename); +static gint32 load_image (char *filename, GRunModeType runmode); static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID); @@ -220,7 +220,7 @@ run (char *name, if (strcmp (name, "file_jpeg_load") == 0) { - image_ID = load_image (param[1].data.d_string); + image_ID = load_image (param[1].data.d_string, run_mode); if (image_ID != -1) { @@ -445,7 +445,7 @@ my_error_exit (j_common_ptr cinfo) } static gint32 -load_image (char *filename) +load_image (char *filename, GRunModeType runmode) { GPixelRgn pixel_rgn; GDrawable *drawable; @@ -480,10 +480,13 @@ load_image (char *filename) gimp_quit (); } - name = malloc (strlen (filename) + 12); - sprintf (name, "Loading %s:", filename); - gimp_progress_init (name); - free (name); + if (runmode != RUN_NONINTERACTIVE) + { + name = malloc (strlen (filename) + 12); + sprintf (name, "Loading %s:", filename); + gimp_progress_init (name); + free (name); + } image_ID = -1; /* Establish the setjmp return context for my_error_exit to use. */ @@ -668,7 +671,10 @@ load_image (char *filename) gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, start, drawable->width, scanlines); - gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + if (runmode != RUN_NONINTERACTIVE) + { + gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + } } /* Step 7: Finish decompression */ diff --git a/plug-ins/jpeg/jpeg-load.h b/plug-ins/jpeg/jpeg-load.h index 37cb64548b..d84ddf145b 100644 --- a/plug-ins/jpeg/jpeg-load.h +++ b/plug-ins/jpeg/jpeg-load.h @@ -94,7 +94,7 @@ static void run (char *name, GParam *param, int *nreturn_vals, GParam **return_vals); -static gint32 load_image (char *filename); +static gint32 load_image (char *filename, GRunModeType runmode); static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID); @@ -220,7 +220,7 @@ run (char *name, if (strcmp (name, "file_jpeg_load") == 0) { - image_ID = load_image (param[1].data.d_string); + image_ID = load_image (param[1].data.d_string, run_mode); if (image_ID != -1) { @@ -445,7 +445,7 @@ my_error_exit (j_common_ptr cinfo) } static gint32 -load_image (char *filename) +load_image (char *filename, GRunModeType runmode) { GPixelRgn pixel_rgn; GDrawable *drawable; @@ -480,10 +480,13 @@ load_image (char *filename) gimp_quit (); } - name = malloc (strlen (filename) + 12); - sprintf (name, "Loading %s:", filename); - gimp_progress_init (name); - free (name); + if (runmode != RUN_NONINTERACTIVE) + { + name = malloc (strlen (filename) + 12); + sprintf (name, "Loading %s:", filename); + gimp_progress_init (name); + free (name); + } image_ID = -1; /* Establish the setjmp return context for my_error_exit to use. */ @@ -668,7 +671,10 @@ load_image (char *filename) gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, start, drawable->width, scanlines); - gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + if (runmode != RUN_NONINTERACTIVE) + { + gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + } } /* Step 7: Finish decompression */ diff --git a/plug-ins/jpeg/jpeg-save.c b/plug-ins/jpeg/jpeg-save.c index 37cb64548b..d84ddf145b 100644 --- a/plug-ins/jpeg/jpeg-save.c +++ b/plug-ins/jpeg/jpeg-save.c @@ -94,7 +94,7 @@ static void run (char *name, GParam *param, int *nreturn_vals, GParam **return_vals); -static gint32 load_image (char *filename); +static gint32 load_image (char *filename, GRunModeType runmode); static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID); @@ -220,7 +220,7 @@ run (char *name, if (strcmp (name, "file_jpeg_load") == 0) { - image_ID = load_image (param[1].data.d_string); + image_ID = load_image (param[1].data.d_string, run_mode); if (image_ID != -1) { @@ -445,7 +445,7 @@ my_error_exit (j_common_ptr cinfo) } static gint32 -load_image (char *filename) +load_image (char *filename, GRunModeType runmode) { GPixelRgn pixel_rgn; GDrawable *drawable; @@ -480,10 +480,13 @@ load_image (char *filename) gimp_quit (); } - name = malloc (strlen (filename) + 12); - sprintf (name, "Loading %s:", filename); - gimp_progress_init (name); - free (name); + if (runmode != RUN_NONINTERACTIVE) + { + name = malloc (strlen (filename) + 12); + sprintf (name, "Loading %s:", filename); + gimp_progress_init (name); + free (name); + } image_ID = -1; /* Establish the setjmp return context for my_error_exit to use. */ @@ -668,7 +671,10 @@ load_image (char *filename) gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, start, drawable->width, scanlines); - gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + if (runmode != RUN_NONINTERACTIVE) + { + gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + } } /* Step 7: Finish decompression */ diff --git a/plug-ins/jpeg/jpeg-save.h b/plug-ins/jpeg/jpeg-save.h index 37cb64548b..d84ddf145b 100644 --- a/plug-ins/jpeg/jpeg-save.h +++ b/plug-ins/jpeg/jpeg-save.h @@ -94,7 +94,7 @@ static void run (char *name, GParam *param, int *nreturn_vals, GParam **return_vals); -static gint32 load_image (char *filename); +static gint32 load_image (char *filename, GRunModeType runmode); static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID); @@ -220,7 +220,7 @@ run (char *name, if (strcmp (name, "file_jpeg_load") == 0) { - image_ID = load_image (param[1].data.d_string); + image_ID = load_image (param[1].data.d_string, run_mode); if (image_ID != -1) { @@ -445,7 +445,7 @@ my_error_exit (j_common_ptr cinfo) } static gint32 -load_image (char *filename) +load_image (char *filename, GRunModeType runmode) { GPixelRgn pixel_rgn; GDrawable *drawable; @@ -480,10 +480,13 @@ load_image (char *filename) gimp_quit (); } - name = malloc (strlen (filename) + 12); - sprintf (name, "Loading %s:", filename); - gimp_progress_init (name); - free (name); + if (runmode != RUN_NONINTERACTIVE) + { + name = malloc (strlen (filename) + 12); + sprintf (name, "Loading %s:", filename); + gimp_progress_init (name); + free (name); + } image_ID = -1; /* Establish the setjmp return context for my_error_exit to use. */ @@ -668,7 +671,10 @@ load_image (char *filename) gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, start, drawable->width, scanlines); - gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + if (runmode != RUN_NONINTERACTIVE) + { + gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + } } /* Step 7: Finish decompression */ diff --git a/plug-ins/jpeg/jpeg.c b/plug-ins/jpeg/jpeg.c index 37cb64548b..d84ddf145b 100644 --- a/plug-ins/jpeg/jpeg.c +++ b/plug-ins/jpeg/jpeg.c @@ -94,7 +94,7 @@ static void run (char *name, GParam *param, int *nreturn_vals, GParam **return_vals); -static gint32 load_image (char *filename); +static gint32 load_image (char *filename, GRunModeType runmode); static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID); @@ -220,7 +220,7 @@ run (char *name, if (strcmp (name, "file_jpeg_load") == 0) { - image_ID = load_image (param[1].data.d_string); + image_ID = load_image (param[1].data.d_string, run_mode); if (image_ID != -1) { @@ -445,7 +445,7 @@ my_error_exit (j_common_ptr cinfo) } static gint32 -load_image (char *filename) +load_image (char *filename, GRunModeType runmode) { GPixelRgn pixel_rgn; GDrawable *drawable; @@ -480,10 +480,13 @@ load_image (char *filename) gimp_quit (); } - name = malloc (strlen (filename) + 12); - sprintf (name, "Loading %s:", filename); - gimp_progress_init (name); - free (name); + if (runmode != RUN_NONINTERACTIVE) + { + name = malloc (strlen (filename) + 12); + sprintf (name, "Loading %s:", filename); + gimp_progress_init (name); + free (name); + } image_ID = -1; /* Establish the setjmp return context for my_error_exit to use. */ @@ -668,7 +671,10 @@ load_image (char *filename) gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, start, drawable->width, scanlines); - gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + if (runmode != RUN_NONINTERACTIVE) + { + gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + } } /* Step 7: Finish decompression */ diff --git a/plug-ins/jpeg/jpeg.h b/plug-ins/jpeg/jpeg.h index 37cb64548b..d84ddf145b 100644 --- a/plug-ins/jpeg/jpeg.h +++ b/plug-ins/jpeg/jpeg.h @@ -94,7 +94,7 @@ static void run (char *name, GParam *param, int *nreturn_vals, GParam **return_vals); -static gint32 load_image (char *filename); +static gint32 load_image (char *filename, GRunModeType runmode); static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID); @@ -220,7 +220,7 @@ run (char *name, if (strcmp (name, "file_jpeg_load") == 0) { - image_ID = load_image (param[1].data.d_string); + image_ID = load_image (param[1].data.d_string, run_mode); if (image_ID != -1) { @@ -445,7 +445,7 @@ my_error_exit (j_common_ptr cinfo) } static gint32 -load_image (char *filename) +load_image (char *filename, GRunModeType runmode) { GPixelRgn pixel_rgn; GDrawable *drawable; @@ -480,10 +480,13 @@ load_image (char *filename) gimp_quit (); } - name = malloc (strlen (filename) + 12); - sprintf (name, "Loading %s:", filename); - gimp_progress_init (name); - free (name); + if (runmode != RUN_NONINTERACTIVE) + { + name = malloc (strlen (filename) + 12); + sprintf (name, "Loading %s:", filename); + gimp_progress_init (name); + free (name); + } image_ID = -1; /* Establish the setjmp return context for my_error_exit to use. */ @@ -668,7 +671,10 @@ load_image (char *filename) gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, start, drawable->width, scanlines); - gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + if (runmode != RUN_NONINTERACTIVE) + { + gimp_progress_update ((double) cinfo.output_scanline / (double) cinfo.output_height); + } } /* Step 7: Finish decompression */