From adabbad9097bc4d084a295604136a02a21f28689 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 6 Jan 2005 23:21:43 +0000 Subject: [PATCH] plug-ins/jpeg/Makefile.am plug-ins/jpeg/jpeg-exif.c 2005-01-07 Sven Neumann * plug-ins/jpeg/Makefile.am * plug-ins/jpeg/jpeg-exif.c * plug-ins/jpeg/jpeg-load.c * plug-ins/jpeg/jpeg-save.c * plug-ins/jpeg/jpeg.[ch]: some code cleanup. --- ChangeLog | 8 +++++ plug-ins/jpeg/Makefile.am | 12 +++---- plug-ins/jpeg/jpeg-exif.c | 64 ++++++++++++++++++--------------- plug-ins/jpeg/jpeg-load.c | 37 +++++++++++++++----- plug-ins/jpeg/jpeg-save.c | 27 ++++++++++++++ plug-ins/jpeg/jpeg.c | 41 +++++++++++++++------- plug-ins/jpeg/jpeg.h | 74 +++++++++++++++++---------------------- 7 files changed, 165 insertions(+), 98 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5cfbdefde8..3653f186bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-01-07 Sven Neumann + + * plug-ins/jpeg/Makefile.am + * plug-ins/jpeg/jpeg-exif.c + * plug-ins/jpeg/jpeg-load.c + * plug-ins/jpeg/jpeg-save.c + * plug-ins/jpeg/jpeg.[ch]: some code cleanup. + 2005-01-06 Manish Singh * libgimpwidgets/gimpdialog.c: flush the display in dispose if we're diff --git a/plug-ins/jpeg/Makefile.am b/plug-ins/jpeg/Makefile.am index dc3c695f3c..0cbdf0404b 100644 --- a/plug-ins/jpeg/Makefile.am +++ b/plug-ins/jpeg/Makefile.am @@ -31,12 +31,12 @@ libexec_PROGRAMS = $(JPEG) EXTRA_PROGRAMS = jpeg jpeg_SOURCES = \ - jpeg.c \ - jpeg-load.c \ - jpeg-save.c \ - jpeg.h \ - jpeg-save.h \ - jpeg-load.h \ + jpeg.c \ + jpeg-load.c \ + jpeg-save.c \ + jpeg.h \ + jpeg-save.h \ + jpeg-load.h \ jpeg-exif.c jpeg_LDADD = \ diff --git a/plug-ins/jpeg/jpeg-exif.c b/plug-ins/jpeg/jpeg-exif.c index 23836931af..85d1bad835 100644 --- a/plug-ins/jpeg/jpeg-exif.c +++ b/plug-ins/jpeg/jpeg-exif.c @@ -13,7 +13,7 @@ * * 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. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 2MA 02111-1307, USA. */ /* @@ -22,30 +22,47 @@ * other plugins. */ -#include "jpeg.h" +#include "config.h" #ifdef HAVE_EXIF +#include +#include +#include +#include + +#include +#include + #include +#include #include #define EXIF_HEADER_SIZE 8 +#include +#include -#define jpeg_exif_content_get_value(c,t,v,m) \ - (exif_content_get_entry (c,t) ? \ +#include "libgimp/stdplugins-intl.h" + +#include "jpeg.h" + + +#define jpeg_exif_content_get_value(c,t,v,m) \ + (exif_content_get_entry (c,t) ? \ jpeg_exif_entry_get_value (exif_content_get_entry (c,t),v,m) : NULL) -static void jpeg_remove_exif_entry (ExifData *exif_data, - ExifIfd ifd, - ExifTag tag); +static void jpeg_remove_exif_entry (ExifData *exif_data, + ExifIfd ifd, + ExifTag tag); -static const gchar *jpeg_exif_entry_get_value (ExifEntry *e, - gchar *val, - guint maxlen); +static const gchar * jpeg_exif_entry_get_value (ExifEntry *e, + gchar *val, + guint maxlen); + +static gboolean jpeg_query (const gchar *msg); -static gboolean jpeg_query (const gchar *msg); void jpeg_apply_exif_data_to_image (const gchar *filename, @@ -397,28 +414,19 @@ jpeg_exif_entry_get_value (ExifEntry *e, static gboolean jpeg_query (const gchar *msg) { - GtkWidget *label; - gboolean ret; + GtkWidget *dialog; + gboolean ret; - GtkWidget *dialog = gimp_dialog_new (_("Loading JPEG . . ."), "jpeg-query", - NULL, 0, gimp_standard_help_func, - "file-jpeg-load", + dialog = gtk_message_dialog_new (NULL, 0, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_OK_CANCEL, + "%s", msg); - GTK_STOCK_NO, GTK_RESPONSE_CANCEL, - GTK_STOCK_YES, GTK_RESPONSE_OK, - - NULL); - - label = gtk_label_new (msg); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, TRUE, TRUE, 12); - gtk_widget_show (label); - - ret = gimp_dialog_run (GIMP_DIALOG (dialog)); + ret = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); - return ((ret == GTK_RESPONSE_OK)); + return (ret == GTK_RESPONSE_OK); } diff --git a/plug-ins/jpeg/jpeg-load.c b/plug-ins/jpeg/jpeg-load.c index ee58ce5dcb..2946c0be90 100644 --- a/plug-ins/jpeg/jpeg-load.c +++ b/plug-ins/jpeg/jpeg-load.c @@ -16,9 +16,29 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + +#include +#include +#include +#include + +#include +#include + +#ifdef HAVE_EXIF +#include +#endif /* HAVE_EXIF */ + +#include +#include + +#include "libgimp/stdplugins-intl.h" + #include "jpeg.h" #include "jpeg-load.h" + /* Read next byte */ static guint jpeg_getc (j_decompress_ptr cinfo) @@ -239,9 +259,8 @@ load_image (const gchar *filename, /*fallthrough*/ default: - g_message ("Don't know how to load JPEGs\n" - "with %d color channels\n" - "using colorspace %d (%d)", + g_message ("Don't know how to load JPEG images " + "with %d color channels, using colorspace %d (%d).", cinfo.output_components, cinfo.out_color_space, cinfo.jpeg_color_space); gimp_quit (); @@ -321,7 +340,7 @@ load_image (const gchar *filename, break; default: - g_message ("Unknown density unit %d\nassuming dots per inch", + g_message ("Unknown density unit %d, assuming dots per inch.", cinfo.density_unit); break; } @@ -372,7 +391,8 @@ load_image (const gchar *filename, break; default: - g_warning ("JPEG - shouldn't have gotten here.\nReport to http://bugzilla.gnome.org/"); + g_warning ("JPEG - shouldn't have gotten here.\n" + "Report to http://bugzilla.gnome.org/"); break; } } @@ -660,9 +680,8 @@ load_thumbnail_image (const gchar *filename, /*fallthrough*/ default: - g_message ("Don't know how to load JPEGs\n" - "with %d color channels\n" - "using colorspace %d (%d)", + g_message ("Don't know how to load JPEG images " + "with %d color channels, using colorspace %d (%d).", cinfo.output_components, cinfo.out_color_space, cinfo.jpeg_color_space); @@ -728,7 +747,7 @@ load_thumbnail_image (const gchar *filename, break; default: - g_message ("Unknown density unit %d\nassuming dots per inch", + g_message ("Unknown density unit %d, assuming dots per inch.", cinfo.density_unit); break; } diff --git a/plug-ins/jpeg/jpeg-save.c b/plug-ins/jpeg/jpeg-save.c index 9a93bb83c4..fe7cc9c160 100644 --- a/plug-ins/jpeg/jpeg-save.c +++ b/plug-ins/jpeg/jpeg-save.c @@ -16,9 +16,36 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#include +#include + +#ifdef HAVE_EXIF +#include +#endif /* HAVE_EXIF */ + +#include +#include + +#include "libgimp/stdplugins-intl.h" + #include "jpeg.h" #include "jpeg-save.h" + typedef struct { struct jpeg_compress_struct cinfo; diff --git a/plug-ins/jpeg/jpeg.c b/plug-ins/jpeg/jpeg.c index 923d97c62a..06a274fc60 100644 --- a/plug-ins/jpeg/jpeg.c +++ b/plug-ins/jpeg/jpeg.c @@ -16,20 +16,39 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "jpeg.h" -#include "jpeg-save.h" -#include "jpeg-load.h" +#include "config.h" +#include +#include +#include + +#include +#include + +#ifdef HAVE_EXIF +#include +#endif /* HAVE_EXIF */ + +#include +#include + +#include "libgimp/stdplugins-intl.h" + +#include "jpeg.h" +#include "jpeg-load.h" +#include "jpeg-save.h" /* Declare local functions. */ -static void query (void); -static void run (const gchar *name, - gint nparams, - const GimpParam *param, - gint *nreturn_vals, - GimpParam **return_vals); + +static void query (void); +static void run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); + GimpPlugInInfo PLUG_IN_INFO = { @@ -40,7 +59,6 @@ GimpPlugInInfo PLUG_IN_INFO = }; - MAIN () @@ -559,6 +577,3 @@ my_output_message (j_common_ptr cinfo) g_message (buffer); } } - - - diff --git a/plug-ins/jpeg/jpeg.h b/plug-ins/jpeg/jpeg.h index 9ccad4ec50..4124ef5860 100644 --- a/plug-ins/jpeg/jpeg.h +++ b/plug-ins/jpeg/jpeg.h @@ -1,30 +1,20 @@ -#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */ - -#include /* We want glib.h first because of some - * pretty obscure Win32 compilation issues. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#include -#include - -#ifdef HAVE_EXIF -#include -#endif /* HAVE_EXIF */ - -#include -#include - -#include "libgimp/stdplugins-intl.h" +/* The GIMP -- an 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. + */ typedef struct my_error_mgr { @@ -51,30 +41,30 @@ gint32 display_ID; gchar *image_comment; -gint32 load_image (const gchar *filename, - GimpRunMode runmode, - gboolean preview); +gint32 load_image (const gchar *filename, + GimpRunMode runmode, + gboolean preview); -void destroy_preview (void); +void destroy_preview (void); -void my_error_exit (j_common_ptr cinfo); -void my_emit_message (j_common_ptr cinfo, - int msg_level); -void my_output_message (j_common_ptr cinfo); +void my_error_exit (j_common_ptr cinfo); +void my_emit_message (j_common_ptr cinfo, + int msg_level); +void my_output_message (j_common_ptr cinfo); #ifdef HAVE_EXIF ExifData *exif_data; -gint32 load_thumbnail_image (const gchar *filename, - gint *width, - gint *height); +gint32 load_thumbnail_image (const gchar *filename, + gint *width, + gint *height); -void jpeg_apply_exif_data_to_image (const gchar *filename, - const gint32 image_ID); +void jpeg_apply_exif_data_to_image (const gchar *filename, + const gint32 image_ID); -void jpeg_setup_exif_for_save (ExifData *exif_data, - const gint32 image_ID); +void jpeg_setup_exif_for_save (ExifData *exif_data, + const gint32 image_ID); #endif /* HAVE_EXIF */