diff --git a/ChangeLog b/ChangeLog index b6b7df2a61..7cd41d85cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Sat Jan 23 18:43:23 GMT 1999 Adam D. Moss + + * plug-ins/gif/gif.c: Multi-line comments, a little more + sanity-checking. + + * app/convert.c: Cosmetic changes to the warning about having + too many colours for saving transparent/animated GIFs. + + * app/gdisplay.c: Titlebar is correctly updated upon revert. + + * app/paint_funcs.c: Minor improvement. + + * docs/parasites.txt: Minor amendments. + + * plug-ins/jpeg/jpeg.c: Minor code comment amendments. + 1999-01-22 Jay Cox * app/pixel_region.c, app/pixel_region.h: new function diff --git a/app/convert.c b/app/convert.c index 87dd9738cc..9c392c434f 100644 --- a/app/convert.c +++ b/app/convert.c @@ -284,6 +284,7 @@ static ActionAreaItem action_items[] = { N_("Cancel"), indexed_cancel_callback, NULL, NULL } }; +/* static void realize_text (GtkWidget *text, gpointer data) { @@ -295,6 +296,7 @@ realize_text (GtkWidget *text, gpointer data) gtk_text_thaw (GTK_TEXT (text)); } +*/ void convert_to_indexed (GimpImage *gimage) @@ -302,12 +304,10 @@ convert_to_indexed (GimpImage *gimage) IndexedDialog *dialog; GtkWidget *vbox; GtkWidget *hbox; - GtkWidget *table; GtkWidget *label; GtkWidget *text; GtkWidget *frame; GtkWidget *toggle; - GtkWidget *scrollbar; GSList *group = NULL; dialog = g_new(IndexedDialog, 1); @@ -510,6 +510,14 @@ convert_to_indexed (GimpImage *gimage) gtk_container_set_border_width (GTK_CONTAINER (frame), 2); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox), frame, TRUE, TRUE, 0); + label = gtk_label_new ("You are attempting to convert an image with alpha/layers from RGB/GRAY to INDEXED.\n" + "\tYou should not generate a palette of more than 255 colors if you intend to create a transparent or animated GIF file from this image."); + gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_FILL); + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + gtk_container_add (GTK_CONTAINER (frame), label); + gtk_widget_show(label); + + /* table = gtk_table_new (2, 1, FALSE); { gtk_container_set_border_width (GTK_CONTAINER (table), 1); @@ -534,6 +542,7 @@ convert_to_indexed (GimpImage *gimage) gtk_widget_show (scrollbar); } gtk_widget_show(table); + */ } gtk_widget_show(frame); } diff --git a/app/core/gimpimage-convert.c b/app/core/gimpimage-convert.c index 87dd9738cc..9c392c434f 100644 --- a/app/core/gimpimage-convert.c +++ b/app/core/gimpimage-convert.c @@ -284,6 +284,7 @@ static ActionAreaItem action_items[] = { N_("Cancel"), indexed_cancel_callback, NULL, NULL } }; +/* static void realize_text (GtkWidget *text, gpointer data) { @@ -295,6 +296,7 @@ realize_text (GtkWidget *text, gpointer data) gtk_text_thaw (GTK_TEXT (text)); } +*/ void convert_to_indexed (GimpImage *gimage) @@ -302,12 +304,10 @@ convert_to_indexed (GimpImage *gimage) IndexedDialog *dialog; GtkWidget *vbox; GtkWidget *hbox; - GtkWidget *table; GtkWidget *label; GtkWidget *text; GtkWidget *frame; GtkWidget *toggle; - GtkWidget *scrollbar; GSList *group = NULL; dialog = g_new(IndexedDialog, 1); @@ -510,6 +510,14 @@ convert_to_indexed (GimpImage *gimage) gtk_container_set_border_width (GTK_CONTAINER (frame), 2); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox), frame, TRUE, TRUE, 0); + label = gtk_label_new ("You are attempting to convert an image with alpha/layers from RGB/GRAY to INDEXED.\n" + "\tYou should not generate a palette of more than 255 colors if you intend to create a transparent or animated GIF file from this image."); + gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_FILL); + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + gtk_container_add (GTK_CONTAINER (frame), label); + gtk_widget_show(label); + + /* table = gtk_table_new (2, 1, FALSE); { gtk_container_set_border_width (GTK_CONTAINER (table), 1); @@ -534,6 +542,7 @@ convert_to_indexed (GimpImage *gimage) gtk_widget_show (scrollbar); } gtk_widget_show(table); + */ } gtk_widget_show(frame); } diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index 9797fadfa8..936fbad04d 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -1363,7 +1363,7 @@ gdisplay_remove_override_cursor (GDisplay *gdisp) } else { - g_warning ("Tried to remove override-cursor from un-overridden gdisp."); +/* g_warning ("Tried to remove override-cursor from un-overridden gdisp."); */ } } @@ -1913,8 +1913,6 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage) gimage_delete (gdisp->gimage); - gdisplay_format_title (gimage, title); - instance = gimage->instance_count; gimage->instance_count++; gimage->ref_count++; @@ -1922,6 +1920,9 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage) gdisp->gimage = gimage; gdisp->instance = instance; + gdisplay_format_title (gimage, title); + gdisplays_update_title (gimage); + gdisplay_expose_full (gdisp); gdisplay_flush (gdisp); } diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index 9797fadfa8..936fbad04d 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -1363,7 +1363,7 @@ gdisplay_remove_override_cursor (GDisplay *gdisp) } else { - g_warning ("Tried to remove override-cursor from un-overridden gdisp."); +/* g_warning ("Tried to remove override-cursor from un-overridden gdisp."); */ } } @@ -1913,8 +1913,6 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage) gimage_delete (gdisp->gimage); - gdisplay_format_title (gimage, title); - instance = gimage->instance_count; gimage->instance_count++; gimage->ref_count++; @@ -1922,6 +1920,9 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage) gdisp->gimage = gimage; gdisp->instance = instance; + gdisplay_format_title (gimage, title); + gdisplays_update_title (gimage); + gdisplay_expose_full (gdisp); gdisplay_flush (gdisp); } diff --git a/app/gdisplay.c b/app/gdisplay.c index 9797fadfa8..936fbad04d 100644 --- a/app/gdisplay.c +++ b/app/gdisplay.c @@ -1363,7 +1363,7 @@ gdisplay_remove_override_cursor (GDisplay *gdisp) } else { - g_warning ("Tried to remove override-cursor from un-overridden gdisp."); +/* g_warning ("Tried to remove override-cursor from un-overridden gdisp."); */ } } @@ -1913,8 +1913,6 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage) gimage_delete (gdisp->gimage); - gdisplay_format_title (gimage, title); - instance = gimage->instance_count; gimage->instance_count++; gimage->ref_count++; @@ -1922,6 +1920,9 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage) gdisp->gimage = gimage; gdisp->instance = instance; + gdisplay_format_title (gimage, title); + gdisplays_update_title (gimage); + gdisplay_expose_full (gdisp); gdisplay_flush (gdisp); } diff --git a/app/gimpimage-convert.c b/app/gimpimage-convert.c index 87dd9738cc..9c392c434f 100644 --- a/app/gimpimage-convert.c +++ b/app/gimpimage-convert.c @@ -284,6 +284,7 @@ static ActionAreaItem action_items[] = { N_("Cancel"), indexed_cancel_callback, NULL, NULL } }; +/* static void realize_text (GtkWidget *text, gpointer data) { @@ -295,6 +296,7 @@ realize_text (GtkWidget *text, gpointer data) gtk_text_thaw (GTK_TEXT (text)); } +*/ void convert_to_indexed (GimpImage *gimage) @@ -302,12 +304,10 @@ convert_to_indexed (GimpImage *gimage) IndexedDialog *dialog; GtkWidget *vbox; GtkWidget *hbox; - GtkWidget *table; GtkWidget *label; GtkWidget *text; GtkWidget *frame; GtkWidget *toggle; - GtkWidget *scrollbar; GSList *group = NULL; dialog = g_new(IndexedDialog, 1); @@ -510,6 +510,14 @@ convert_to_indexed (GimpImage *gimage) gtk_container_set_border_width (GTK_CONTAINER (frame), 2); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox), frame, TRUE, TRUE, 0); + label = gtk_label_new ("You are attempting to convert an image with alpha/layers from RGB/GRAY to INDEXED.\n" + "\tYou should not generate a palette of more than 255 colors if you intend to create a transparent or animated GIF file from this image."); + gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_FILL); + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + gtk_container_add (GTK_CONTAINER (frame), label); + gtk_widget_show(label); + + /* table = gtk_table_new (2, 1, FALSE); { gtk_container_set_border_width (GTK_CONTAINER (table), 1); @@ -534,6 +542,7 @@ convert_to_indexed (GimpImage *gimage) gtk_widget_show (scrollbar); } gtk_widget_show(table); + */ } gtk_widget_show(frame); } diff --git a/app/paint-funcs/paint-funcs.c b/app/paint-funcs/paint-funcs.c index 0369e3ad3e..76df041b82 100644 --- a/app/paint-funcs/paint-funcs.c +++ b/app/paint-funcs/paint-funcs.c @@ -2000,32 +2000,34 @@ combine_inten_a_and_inten_a_pixels (const unsigned char *src1, /* HEAD */ i = (((int)m) & (sizeof(int)-1)); if (i != 0) - i = sizeof(int) - i; - length -= i; - while (i--) { - /* GUTS */ - src2_alpha = INT_MULT(src2[alpha], *m, tmp); - new_alpha = src1[alpha] + - INT_MULT((255 - src1[alpha]), src2_alpha, tmp); - - alphify (src2_alpha, new_alpha); - - if (mode_affect) + i = sizeof(int) - i; + length -= i; + while (i--) { - dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; - } - else - { - dest[alpha] = (src1[alpha]) ? src1[alpha] : - (affect[alpha] ? new_alpha : src1[alpha]); - } + /* GUTS */ + src2_alpha = INT_MULT(src2[alpha], *m, tmp); + new_alpha = src1[alpha] + + INT_MULT((255 - src1[alpha]), src2_alpha, tmp); - m++; - src1 += bytes; - src2 += bytes; - dest += bytes; - /* GUTS END */ + alphify (src2_alpha, new_alpha); + + if (mode_affect) + { + dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; + } + else + { + dest[alpha] = (src1[alpha]) ? src1[alpha] : + (affect[alpha] ? new_alpha : src1[alpha]); + } + + m++; + src1 += bytes; + src2 += bytes; + dest += bytes; + /* GUTS END */ + } } /* BODY */ @@ -2113,34 +2115,36 @@ combine_inten_a_and_inten_a_pixels (const unsigned char *src1, /* HEAD */ i = (((int)m) & (sizeof(int)-1)); if (i != 0) - i = sizeof(int) - i; - length -= i; - while (i--) { - /* GUTS */ - src2_alpha = INT_MULT3(src2[alpha], *m, opacity, tmp); - new_alpha = src1[alpha] + - INT_MULT((255 - src1[alpha]), src2_alpha, tmp); - - alphify (src2_alpha, new_alpha); - - if (mode_affect) + i = sizeof(int) - i; + length -= i; + while (i--) { - dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; + /* GUTS */ + src2_alpha = INT_MULT3(src2[alpha], *m, opacity, tmp); + new_alpha = src1[alpha] + + INT_MULT((255 - src1[alpha]), src2_alpha, tmp); + + alphify (src2_alpha, new_alpha); + + if (mode_affect) + { + dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; + } + else + { + dest[alpha] = (src1[alpha]) ? src1[alpha] : + (affect[alpha] ? new_alpha : src1[alpha]); + } + + m++; + src1 += bytes; + src2 += bytes; + dest += bytes; + /* GUTS END */ } - else - { - dest[alpha] = (src1[alpha]) ? src1[alpha] : - (affect[alpha] ? new_alpha : src1[alpha]); - } - - m++; - src1 += bytes; - src2 += bytes; - dest += bytes; - /* GUTS END */ } - + /* BODY */ mask_ip = (int*)m; i = length / sizeof(int); @@ -2157,9 +2161,9 @@ combine_inten_a_and_inten_a_pixels (const unsigned char *src1, src2_alpha = INT_MULT3(src2[alpha], *m, opacity, tmp); new_alpha = src1[alpha] + INT_MULT((255 - src1[alpha]), src2_alpha, tmp); - + alphify (src2_alpha, new_alpha); - + if (mode_affect) { dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; diff --git a/app/paint_funcs.c b/app/paint_funcs.c index 0369e3ad3e..76df041b82 100644 --- a/app/paint_funcs.c +++ b/app/paint_funcs.c @@ -2000,32 +2000,34 @@ combine_inten_a_and_inten_a_pixels (const unsigned char *src1, /* HEAD */ i = (((int)m) & (sizeof(int)-1)); if (i != 0) - i = sizeof(int) - i; - length -= i; - while (i--) { - /* GUTS */ - src2_alpha = INT_MULT(src2[alpha], *m, tmp); - new_alpha = src1[alpha] + - INT_MULT((255 - src1[alpha]), src2_alpha, tmp); - - alphify (src2_alpha, new_alpha); - - if (mode_affect) + i = sizeof(int) - i; + length -= i; + while (i--) { - dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; - } - else - { - dest[alpha] = (src1[alpha]) ? src1[alpha] : - (affect[alpha] ? new_alpha : src1[alpha]); - } + /* GUTS */ + src2_alpha = INT_MULT(src2[alpha], *m, tmp); + new_alpha = src1[alpha] + + INT_MULT((255 - src1[alpha]), src2_alpha, tmp); - m++; - src1 += bytes; - src2 += bytes; - dest += bytes; - /* GUTS END */ + alphify (src2_alpha, new_alpha); + + if (mode_affect) + { + dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; + } + else + { + dest[alpha] = (src1[alpha]) ? src1[alpha] : + (affect[alpha] ? new_alpha : src1[alpha]); + } + + m++; + src1 += bytes; + src2 += bytes; + dest += bytes; + /* GUTS END */ + } } /* BODY */ @@ -2113,34 +2115,36 @@ combine_inten_a_and_inten_a_pixels (const unsigned char *src1, /* HEAD */ i = (((int)m) & (sizeof(int)-1)); if (i != 0) - i = sizeof(int) - i; - length -= i; - while (i--) { - /* GUTS */ - src2_alpha = INT_MULT3(src2[alpha], *m, opacity, tmp); - new_alpha = src1[alpha] + - INT_MULT((255 - src1[alpha]), src2_alpha, tmp); - - alphify (src2_alpha, new_alpha); - - if (mode_affect) + i = sizeof(int) - i; + length -= i; + while (i--) { - dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; + /* GUTS */ + src2_alpha = INT_MULT3(src2[alpha], *m, opacity, tmp); + new_alpha = src1[alpha] + + INT_MULT((255 - src1[alpha]), src2_alpha, tmp); + + alphify (src2_alpha, new_alpha); + + if (mode_affect) + { + dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; + } + else + { + dest[alpha] = (src1[alpha]) ? src1[alpha] : + (affect[alpha] ? new_alpha : src1[alpha]); + } + + m++; + src1 += bytes; + src2 += bytes; + dest += bytes; + /* GUTS END */ } - else - { - dest[alpha] = (src1[alpha]) ? src1[alpha] : - (affect[alpha] ? new_alpha : src1[alpha]); - } - - m++; - src1 += bytes; - src2 += bytes; - dest += bytes; - /* GUTS END */ } - + /* BODY */ mask_ip = (int*)m; i = length / sizeof(int); @@ -2157,9 +2161,9 @@ combine_inten_a_and_inten_a_pixels (const unsigned char *src1, src2_alpha = INT_MULT3(src2[alpha], *m, opacity, tmp); new_alpha = src1[alpha] + INT_MULT((255 - src1[alpha]), src2_alpha, tmp); - + alphify (src2_alpha, new_alpha); - + if (mode_affect) { dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; diff --git a/docs/parasites.txt b/docs/parasites.txt index 4fa4dce5e8..6a99e0a3c9 100644 --- a/docs/parasites.txt +++ b/docs/parasites.txt @@ -5,13 +5,14 @@ PARASITE REGISTRY - 1998/10/09 This document is designed for the convenience of GIMP developers. It does not need to concern users. -If your plugin or script writes parasites, please amend this file. +>>>> If your plugin or script writes parasites, please +>>>> amend this file in CVS or submit patches to +>>>> gimp-developer@scam.xcf.berkeley.edu ------------------------------------------------------------------ *** PREFIXES: -"gif2" : The standard GIMP GIF plugin "tiff" : The standard GIMP TIFF plugin "gimp" : For common and standard parasites diff --git a/plug-ins/common/gif.c b/plug-ins/common/gif.c index 07f0395d5a..bf3db82310 100644 --- a/plug-ins/common/gif.c +++ b/plug-ins/common/gif.c @@ -1,4 +1,4 @@ -/* GIF loading and saving file filter for The GIMP version 1.0 +/* GIF loading and saving file filter for The GIMP version 1.0/1.1 * * - Adam D. Moss * - Peter Mattis @@ -7,7 +7,7 @@ * Based around original GIF code by David Koblas. * * - * Version 2.1.0 - 98/10/09 + * Version 2.1.1 - 99/01/23 * Adam D. Moss - */ /* @@ -23,6 +23,11 @@ /* * REVISION HISTORY * + * 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 + * permitted. + * * 98/10/09 * 2.01.00 - Added support for persistant GIF Comments through * the GIMP 1.1 Parasite mechanism where available. @@ -212,8 +217,6 @@ /* * TODO (more *'s means more important!) * - * - Show GIF comments in a popup window? - * * - PDB stuff for comments * * - 'requantize' option for INDEXEDA images which really have 256 colours @@ -2053,11 +2056,14 @@ save_dialog ( gint32 image_ID ) GtkWidget *toggle; GtkWidget *label; GtkWidget *entry; + GtkWidget *text; GtkWidget *frame; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *menu; GtkWidget *disposal_option_menu; + GtkWidget *com_table; + GtkWidget *vscrollbar; #ifdef FACEHUGGERS Parasite* GIF2_CMNT; #endif @@ -2133,15 +2139,23 @@ save_dialog ( gint32 image_ID ) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), 1); gtk_widget_show (toggle); - entry = gtk_entry_new (); - gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); - gtk_widget_set_usize (entry, 240, 0); + com_table = gtk_table_new (1, 1, FALSE); + /* gtk_container_border_width (GTK_CONTAINER (com_table), 10);*/ + gtk_box_pack_start (GTK_BOX (hbox), com_table, TRUE, TRUE, 0); + + text = gtk_text_new (NULL, NULL); + gtk_text_set_editable (GTK_TEXT (text), TRUE); + gtk_widget_set_usize (text, 80,3); + gtk_table_attach (GTK_TABLE (com_table), text, 0, 1, 0, 1, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + if (globalcomment!=NULL) { g_free(globalcomment); } #ifdef FACEHUGGERS - GIF2_CMNT = gimp_image_find_parasite (image_ID, "gimp-comment"); + GIF2_CMNT = gimp_image_find_parasite (image_ID, "gimp-comment"); if (GIF2_CMNT) { globalcomment = g_malloc(GIF2_CMNT->size); @@ -2156,17 +2170,23 @@ save_dialog ( gint32 image_ID ) } parasite_free (GIF2_CMNT); #endif + + gtk_text_insert(GTK_TEXT(text),NULL,NULL,NULL,globalcomment,-1); + gtk_signal_connect (GTK_OBJECT (text), "changed", + (GtkSignalFunc) comment_entry_callback, + NULL); - gtk_entry_set_text (GTK_ENTRY (entry), globalcomment); - gtk_signal_connect (GTK_OBJECT (entry), "changed", - (GtkSignalFunc) comment_entry_callback, - NULL); - gtk_widget_show (entry); - - gtk_widget_show (hbox); - - gtk_widget_show (vbox); - gtk_widget_show (frame); + vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj); + gtk_table_attach (GTK_TABLE (com_table), vscrollbar, 1, 2, 0, 1, + GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + gtk_widget_show (vscrollbar); + gtk_widget_show (text); + gtk_widget_show (com_table); + + gtk_widget_show (hbox); + + gtk_widget_show (vbox); + gtk_widget_show (frame); /* additional animated gif parameter settings */ @@ -2833,6 +2853,12 @@ static void GIFEncodeCommentExt (FILE *fp, char *comment) return; } + if (strlen(comment)>240) + { + g_print ("GIF: warning: comment too large - comment block not written.\n"); + return; + } + fputc(0x21,fp); fputc(0xfe,fp); fputc(strlen(comment),fp); @@ -3384,20 +3410,25 @@ comment_entry_callback (GtkWidget *widget, gpointer data) { gint ssize; + gchar* str; - ssize = strlen(gtk_entry_get_text (GTK_ENTRY (widget))); + str = gtk_editable_get_chars(GTK_EDITABLE (widget),0,-1); + ssize = strlen(str); /* Temporary kludge for overlength strings - just return */ if (ssize>240) { g_message ("GIF save: Your comment string is too long.\n"); + g_free(str); return; } if (globalcomment!=NULL) g_free(globalcomment); globalcomment = g_malloc(ssize+1); - strcpy(globalcomment, gtk_entry_get_text (GTK_ENTRY (widget))); + /*strcpy(globalcomment, gtk_entry_get_text (GTK_ENTRY (widget)));*/ + strcpy(globalcomment, str); + g_free(str); /* g_print ("COMMENT: %s\n",globalcomment); */ } diff --git a/plug-ins/common/jpeg.c b/plug-ins/common/jpeg.c index de91c81897..37cb64548b 100644 --- a/plug-ins/common/jpeg.c +++ b/plug-ins/common/jpeg.c @@ -45,7 +45,9 @@ * progressive loads - gimp doesn't) loads the image it first gets a * low res version displayed and then the image is progressively * enhanced until you get the final version. It doesn't add any size - * to the image - the only draw back is some might find it annoying. + * to the image (actually it often results in smaller file size) - the + * only draw backs are that progressive jpegs are not supported by some + * older viewers/browsers, and some might find it annoying. */ #include diff --git a/plug-ins/gif/gif.c b/plug-ins/gif/gif.c index 07f0395d5a..bf3db82310 100644 --- a/plug-ins/gif/gif.c +++ b/plug-ins/gif/gif.c @@ -1,4 +1,4 @@ -/* GIF loading and saving file filter for The GIMP version 1.0 +/* GIF loading and saving file filter for The GIMP version 1.0/1.1 * * - Adam D. Moss * - Peter Mattis @@ -7,7 +7,7 @@ * Based around original GIF code by David Koblas. * * - * Version 2.1.0 - 98/10/09 + * Version 2.1.1 - 99/01/23 * Adam D. Moss - */ /* @@ -23,6 +23,11 @@ /* * REVISION HISTORY * + * 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 + * permitted. + * * 98/10/09 * 2.01.00 - Added support for persistant GIF Comments through * the GIMP 1.1 Parasite mechanism where available. @@ -212,8 +217,6 @@ /* * TODO (more *'s means more important!) * - * - Show GIF comments in a popup window? - * * - PDB stuff for comments * * - 'requantize' option for INDEXEDA images which really have 256 colours @@ -2053,11 +2056,14 @@ save_dialog ( gint32 image_ID ) GtkWidget *toggle; GtkWidget *label; GtkWidget *entry; + GtkWidget *text; GtkWidget *frame; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *menu; GtkWidget *disposal_option_menu; + GtkWidget *com_table; + GtkWidget *vscrollbar; #ifdef FACEHUGGERS Parasite* GIF2_CMNT; #endif @@ -2133,15 +2139,23 @@ save_dialog ( gint32 image_ID ) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), 1); gtk_widget_show (toggle); - entry = gtk_entry_new (); - gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); - gtk_widget_set_usize (entry, 240, 0); + com_table = gtk_table_new (1, 1, FALSE); + /* gtk_container_border_width (GTK_CONTAINER (com_table), 10);*/ + gtk_box_pack_start (GTK_BOX (hbox), com_table, TRUE, TRUE, 0); + + text = gtk_text_new (NULL, NULL); + gtk_text_set_editable (GTK_TEXT (text), TRUE); + gtk_widget_set_usize (text, 80,3); + gtk_table_attach (GTK_TABLE (com_table), text, 0, 1, 0, 1, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, + GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + if (globalcomment!=NULL) { g_free(globalcomment); } #ifdef FACEHUGGERS - GIF2_CMNT = gimp_image_find_parasite (image_ID, "gimp-comment"); + GIF2_CMNT = gimp_image_find_parasite (image_ID, "gimp-comment"); if (GIF2_CMNT) { globalcomment = g_malloc(GIF2_CMNT->size); @@ -2156,17 +2170,23 @@ save_dialog ( gint32 image_ID ) } parasite_free (GIF2_CMNT); #endif + + gtk_text_insert(GTK_TEXT(text),NULL,NULL,NULL,globalcomment,-1); + gtk_signal_connect (GTK_OBJECT (text), "changed", + (GtkSignalFunc) comment_entry_callback, + NULL); - gtk_entry_set_text (GTK_ENTRY (entry), globalcomment); - gtk_signal_connect (GTK_OBJECT (entry), "changed", - (GtkSignalFunc) comment_entry_callback, - NULL); - gtk_widget_show (entry); - - gtk_widget_show (hbox); - - gtk_widget_show (vbox); - gtk_widget_show (frame); + vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj); + gtk_table_attach (GTK_TABLE (com_table), vscrollbar, 1, 2, 0, 1, + GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); + gtk_widget_show (vscrollbar); + gtk_widget_show (text); + gtk_widget_show (com_table); + + gtk_widget_show (hbox); + + gtk_widget_show (vbox); + gtk_widget_show (frame); /* additional animated gif parameter settings */ @@ -2833,6 +2853,12 @@ static void GIFEncodeCommentExt (FILE *fp, char *comment) return; } + if (strlen(comment)>240) + { + g_print ("GIF: warning: comment too large - comment block not written.\n"); + return; + } + fputc(0x21,fp); fputc(0xfe,fp); fputc(strlen(comment),fp); @@ -3384,20 +3410,25 @@ comment_entry_callback (GtkWidget *widget, gpointer data) { gint ssize; + gchar* str; - ssize = strlen(gtk_entry_get_text (GTK_ENTRY (widget))); + str = gtk_editable_get_chars(GTK_EDITABLE (widget),0,-1); + ssize = strlen(str); /* Temporary kludge for overlength strings - just return */ if (ssize>240) { g_message ("GIF save: Your comment string is too long.\n"); + g_free(str); return; } if (globalcomment!=NULL) g_free(globalcomment); globalcomment = g_malloc(ssize+1); - strcpy(globalcomment, gtk_entry_get_text (GTK_ENTRY (widget))); + /*strcpy(globalcomment, gtk_entry_get_text (GTK_ENTRY (widget)));*/ + strcpy(globalcomment, str); + g_free(str); /* g_print ("COMMENT: %s\n",globalcomment); */ } diff --git a/plug-ins/jpeg/jpeg-load.c b/plug-ins/jpeg/jpeg-load.c index de91c81897..37cb64548b 100644 --- a/plug-ins/jpeg/jpeg-load.c +++ b/plug-ins/jpeg/jpeg-load.c @@ -45,7 +45,9 @@ * progressive loads - gimp doesn't) loads the image it first gets a * low res version displayed and then the image is progressively * enhanced until you get the final version. It doesn't add any size - * to the image - the only draw back is some might find it annoying. + * to the image (actually it often results in smaller file size) - the + * only draw backs are that progressive jpegs are not supported by some + * older viewers/browsers, and some might find it annoying. */ #include diff --git a/plug-ins/jpeg/jpeg-load.h b/plug-ins/jpeg/jpeg-load.h index de91c81897..37cb64548b 100644 --- a/plug-ins/jpeg/jpeg-load.h +++ b/plug-ins/jpeg/jpeg-load.h @@ -45,7 +45,9 @@ * progressive loads - gimp doesn't) loads the image it first gets a * low res version displayed and then the image is progressively * enhanced until you get the final version. It doesn't add any size - * to the image - the only draw back is some might find it annoying. + * to the image (actually it often results in smaller file size) - the + * only draw backs are that progressive jpegs are not supported by some + * older viewers/browsers, and some might find it annoying. */ #include diff --git a/plug-ins/jpeg/jpeg-save.c b/plug-ins/jpeg/jpeg-save.c index de91c81897..37cb64548b 100644 --- a/plug-ins/jpeg/jpeg-save.c +++ b/plug-ins/jpeg/jpeg-save.c @@ -45,7 +45,9 @@ * progressive loads - gimp doesn't) loads the image it first gets a * low res version displayed and then the image is progressively * enhanced until you get the final version. It doesn't add any size - * to the image - the only draw back is some might find it annoying. + * to the image (actually it often results in smaller file size) - the + * only draw backs are that progressive jpegs are not supported by some + * older viewers/browsers, and some might find it annoying. */ #include diff --git a/plug-ins/jpeg/jpeg-save.h b/plug-ins/jpeg/jpeg-save.h index de91c81897..37cb64548b 100644 --- a/plug-ins/jpeg/jpeg-save.h +++ b/plug-ins/jpeg/jpeg-save.h @@ -45,7 +45,9 @@ * progressive loads - gimp doesn't) loads the image it first gets a * low res version displayed and then the image is progressively * enhanced until you get the final version. It doesn't add any size - * to the image - the only draw back is some might find it annoying. + * to the image (actually it often results in smaller file size) - the + * only draw backs are that progressive jpegs are not supported by some + * older viewers/browsers, and some might find it annoying. */ #include diff --git a/plug-ins/jpeg/jpeg.c b/plug-ins/jpeg/jpeg.c index de91c81897..37cb64548b 100644 --- a/plug-ins/jpeg/jpeg.c +++ b/plug-ins/jpeg/jpeg.c @@ -45,7 +45,9 @@ * progressive loads - gimp doesn't) loads the image it first gets a * low res version displayed and then the image is progressively * enhanced until you get the final version. It doesn't add any size - * to the image - the only draw back is some might find it annoying. + * to the image (actually it often results in smaller file size) - the + * only draw backs are that progressive jpegs are not supported by some + * older viewers/browsers, and some might find it annoying. */ #include diff --git a/plug-ins/jpeg/jpeg.h b/plug-ins/jpeg/jpeg.h index de91c81897..37cb64548b 100644 --- a/plug-ins/jpeg/jpeg.h +++ b/plug-ins/jpeg/jpeg.h @@ -45,7 +45,9 @@ * progressive loads - gimp doesn't) loads the image it first gets a * low res version displayed and then the image is progressively * enhanced until you get the final version. It doesn't add any size - * to the image - the only draw back is some might find it annoying. + * to the image (actually it often results in smaller file size) - the + * only draw backs are that progressive jpegs are not supported by some + * older viewers/browsers, and some might find it annoying. */ #include