Multi-line comments, a little more sanity-checking.

Sat Jan 23 18:43:23 GMT 1999  Adam D. Moss  <adam@gimp.org>

	* 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.
This commit is contained in:
GMT 1999 Adam D. Moss 1999-01-23 18:49:52 +00:00 committed by Adam D. Moss
parent 74fae96949
commit 176ea8da52
19 changed files with 293 additions and 162 deletions

View File

@ -1,3 +1,19 @@
Sat Jan 23 18:43:23 GMT 1999 Adam D. Moss <adam@gimp.org>
* 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 <jaycox@earthlink.net> 1999-01-22 Jay Cox <jaycox@earthlink.net>
* app/pixel_region.c, app/pixel_region.h: new function * app/pixel_region.c, app/pixel_region.h: new function

View File

@ -284,6 +284,7 @@ static ActionAreaItem action_items[] =
{ N_("Cancel"), indexed_cancel_callback, NULL, NULL } { N_("Cancel"), indexed_cancel_callback, NULL, NULL }
}; };
/*
static void static void
realize_text (GtkWidget *text, gpointer data) realize_text (GtkWidget *text, gpointer data)
{ {
@ -295,6 +296,7 @@ realize_text (GtkWidget *text, gpointer data)
gtk_text_thaw (GTK_TEXT (text)); gtk_text_thaw (GTK_TEXT (text));
} }
*/
void void
convert_to_indexed (GimpImage *gimage) convert_to_indexed (GimpImage *gimage)
@ -302,12 +304,10 @@ convert_to_indexed (GimpImage *gimage)
IndexedDialog *dialog; IndexedDialog *dialog;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *table;
GtkWidget *label; GtkWidget *label;
GtkWidget *text; GtkWidget *text;
GtkWidget *frame; GtkWidget *frame;
GtkWidget *toggle; GtkWidget *toggle;
GtkWidget *scrollbar;
GSList *group = NULL; GSList *group = NULL;
dialog = g_new(IndexedDialog, 1); dialog = g_new(IndexedDialog, 1);
@ -510,6 +510,14 @@ convert_to_indexed (GimpImage *gimage)
gtk_container_set_border_width (GTK_CONTAINER (frame), 2); gtk_container_set_border_width (GTK_CONTAINER (frame), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox), frame, TRUE, TRUE, 0); 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); table = gtk_table_new (2, 1, FALSE);
{ {
gtk_container_set_border_width (GTK_CONTAINER (table), 1); 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 (scrollbar);
} }
gtk_widget_show(table); gtk_widget_show(table);
*/
} }
gtk_widget_show(frame); gtk_widget_show(frame);
} }

View File

@ -284,6 +284,7 @@ static ActionAreaItem action_items[] =
{ N_("Cancel"), indexed_cancel_callback, NULL, NULL } { N_("Cancel"), indexed_cancel_callback, NULL, NULL }
}; };
/*
static void static void
realize_text (GtkWidget *text, gpointer data) realize_text (GtkWidget *text, gpointer data)
{ {
@ -295,6 +296,7 @@ realize_text (GtkWidget *text, gpointer data)
gtk_text_thaw (GTK_TEXT (text)); gtk_text_thaw (GTK_TEXT (text));
} }
*/
void void
convert_to_indexed (GimpImage *gimage) convert_to_indexed (GimpImage *gimage)
@ -302,12 +304,10 @@ convert_to_indexed (GimpImage *gimage)
IndexedDialog *dialog; IndexedDialog *dialog;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *table;
GtkWidget *label; GtkWidget *label;
GtkWidget *text; GtkWidget *text;
GtkWidget *frame; GtkWidget *frame;
GtkWidget *toggle; GtkWidget *toggle;
GtkWidget *scrollbar;
GSList *group = NULL; GSList *group = NULL;
dialog = g_new(IndexedDialog, 1); dialog = g_new(IndexedDialog, 1);
@ -510,6 +510,14 @@ convert_to_indexed (GimpImage *gimage)
gtk_container_set_border_width (GTK_CONTAINER (frame), 2); gtk_container_set_border_width (GTK_CONTAINER (frame), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox), frame, TRUE, TRUE, 0); 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); table = gtk_table_new (2, 1, FALSE);
{ {
gtk_container_set_border_width (GTK_CONTAINER (table), 1); 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 (scrollbar);
} }
gtk_widget_show(table); gtk_widget_show(table);
*/
} }
gtk_widget_show(frame); gtk_widget_show(frame);
} }

View File

@ -1363,7 +1363,7 @@ gdisplay_remove_override_cursor (GDisplay *gdisp)
} }
else 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); gimage_delete (gdisp->gimage);
gdisplay_format_title (gimage, title);
instance = gimage->instance_count; instance = gimage->instance_count;
gimage->instance_count++; gimage->instance_count++;
gimage->ref_count++; gimage->ref_count++;
@ -1922,6 +1920,9 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
gdisp->gimage = gimage; gdisp->gimage = gimage;
gdisp->instance = instance; gdisp->instance = instance;
gdisplay_format_title (gimage, title);
gdisplays_update_title (gimage);
gdisplay_expose_full (gdisp); gdisplay_expose_full (gdisp);
gdisplay_flush (gdisp); gdisplay_flush (gdisp);
} }

View File

@ -1363,7 +1363,7 @@ gdisplay_remove_override_cursor (GDisplay *gdisp)
} }
else 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); gimage_delete (gdisp->gimage);
gdisplay_format_title (gimage, title);
instance = gimage->instance_count; instance = gimage->instance_count;
gimage->instance_count++; gimage->instance_count++;
gimage->ref_count++; gimage->ref_count++;
@ -1922,6 +1920,9 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
gdisp->gimage = gimage; gdisp->gimage = gimage;
gdisp->instance = instance; gdisp->instance = instance;
gdisplay_format_title (gimage, title);
gdisplays_update_title (gimage);
gdisplay_expose_full (gdisp); gdisplay_expose_full (gdisp);
gdisplay_flush (gdisp); gdisplay_flush (gdisp);
} }

View File

@ -1363,7 +1363,7 @@ gdisplay_remove_override_cursor (GDisplay *gdisp)
} }
else 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); gimage_delete (gdisp->gimage);
gdisplay_format_title (gimage, title);
instance = gimage->instance_count; instance = gimage->instance_count;
gimage->instance_count++; gimage->instance_count++;
gimage->ref_count++; gimage->ref_count++;
@ -1922,6 +1920,9 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
gdisp->gimage = gimage; gdisp->gimage = gimage;
gdisp->instance = instance; gdisp->instance = instance;
gdisplay_format_title (gimage, title);
gdisplays_update_title (gimage);
gdisplay_expose_full (gdisp); gdisplay_expose_full (gdisp);
gdisplay_flush (gdisp); gdisplay_flush (gdisp);
} }

View File

@ -284,6 +284,7 @@ static ActionAreaItem action_items[] =
{ N_("Cancel"), indexed_cancel_callback, NULL, NULL } { N_("Cancel"), indexed_cancel_callback, NULL, NULL }
}; };
/*
static void static void
realize_text (GtkWidget *text, gpointer data) realize_text (GtkWidget *text, gpointer data)
{ {
@ -295,6 +296,7 @@ realize_text (GtkWidget *text, gpointer data)
gtk_text_thaw (GTK_TEXT (text)); gtk_text_thaw (GTK_TEXT (text));
} }
*/
void void
convert_to_indexed (GimpImage *gimage) convert_to_indexed (GimpImage *gimage)
@ -302,12 +304,10 @@ convert_to_indexed (GimpImage *gimage)
IndexedDialog *dialog; IndexedDialog *dialog;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *table;
GtkWidget *label; GtkWidget *label;
GtkWidget *text; GtkWidget *text;
GtkWidget *frame; GtkWidget *frame;
GtkWidget *toggle; GtkWidget *toggle;
GtkWidget *scrollbar;
GSList *group = NULL; GSList *group = NULL;
dialog = g_new(IndexedDialog, 1); dialog = g_new(IndexedDialog, 1);
@ -510,6 +510,14 @@ convert_to_indexed (GimpImage *gimage)
gtk_container_set_border_width (GTK_CONTAINER (frame), 2); gtk_container_set_border_width (GTK_CONTAINER (frame), 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->shell)->vbox), frame, TRUE, TRUE, 0); 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); table = gtk_table_new (2, 1, FALSE);
{ {
gtk_container_set_border_width (GTK_CONTAINER (table), 1); 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 (scrollbar);
} }
gtk_widget_show(table); gtk_widget_show(table);
*/
} }
gtk_widget_show(frame); gtk_widget_show(frame);
} }

View File

@ -2000,32 +2000,34 @@ combine_inten_a_and_inten_a_pixels (const unsigned char *src1,
/* HEAD */ /* HEAD */
i = (((int)m) & (sizeof(int)-1)); i = (((int)m) & (sizeof(int)-1));
if (i != 0) if (i != 0)
i = sizeof(int) - i;
length -= i;
while (i--)
{ {
/* GUTS */ i = sizeof(int) - i;
src2_alpha = INT_MULT(src2[alpha], *m, tmp); length -= i;
new_alpha = src1[alpha] + while (i--)
INT_MULT((255 - src1[alpha]), src2_alpha, tmp);
alphify (src2_alpha, new_alpha);
if (mode_affect)
{ {
dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; /* GUTS */
} src2_alpha = INT_MULT(src2[alpha], *m, tmp);
else new_alpha = src1[alpha] +
{ INT_MULT((255 - src1[alpha]), src2_alpha, tmp);
dest[alpha] = (src1[alpha]) ? src1[alpha] :
(affect[alpha] ? new_alpha : src1[alpha]);
}
m++; alphify (src2_alpha, new_alpha);
src1 += bytes;
src2 += bytes; if (mode_affect)
dest += bytes; {
/* GUTS END */ 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 */ /* BODY */
@ -2113,34 +2115,36 @@ combine_inten_a_and_inten_a_pixels (const unsigned char *src1,
/* HEAD */ /* HEAD */
i = (((int)m) & (sizeof(int)-1)); i = (((int)m) & (sizeof(int)-1));
if (i != 0) if (i != 0)
i = sizeof(int) - i;
length -= i;
while (i--)
{ {
/* GUTS */ i = sizeof(int) - i;
src2_alpha = INT_MULT3(src2[alpha], *m, opacity, tmp); length -= i;
new_alpha = src1[alpha] + while (i--)
INT_MULT((255 - src1[alpha]), src2_alpha, tmp);
alphify (src2_alpha, new_alpha);
if (mode_affect)
{ {
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 */ /* BODY */
mask_ip = (int*)m; mask_ip = (int*)m;
i = length / sizeof(int); 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); src2_alpha = INT_MULT3(src2[alpha], *m, opacity, tmp);
new_alpha = src1[alpha] + new_alpha = src1[alpha] +
INT_MULT((255 - src1[alpha]), src2_alpha, tmp); INT_MULT((255 - src1[alpha]), src2_alpha, tmp);
alphify (src2_alpha, new_alpha); alphify (src2_alpha, new_alpha);
if (mode_affect) if (mode_affect)
{ {
dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha];

View File

@ -2000,32 +2000,34 @@ combine_inten_a_and_inten_a_pixels (const unsigned char *src1,
/* HEAD */ /* HEAD */
i = (((int)m) & (sizeof(int)-1)); i = (((int)m) & (sizeof(int)-1));
if (i != 0) if (i != 0)
i = sizeof(int) - i;
length -= i;
while (i--)
{ {
/* GUTS */ i = sizeof(int) - i;
src2_alpha = INT_MULT(src2[alpha], *m, tmp); length -= i;
new_alpha = src1[alpha] + while (i--)
INT_MULT((255 - src1[alpha]), src2_alpha, tmp);
alphify (src2_alpha, new_alpha);
if (mode_affect)
{ {
dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; /* GUTS */
} src2_alpha = INT_MULT(src2[alpha], *m, tmp);
else new_alpha = src1[alpha] +
{ INT_MULT((255 - src1[alpha]), src2_alpha, tmp);
dest[alpha] = (src1[alpha]) ? src1[alpha] :
(affect[alpha] ? new_alpha : src1[alpha]);
}
m++; alphify (src2_alpha, new_alpha);
src1 += bytes;
src2 += bytes; if (mode_affect)
dest += bytes; {
/* GUTS END */ 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 */ /* BODY */
@ -2113,34 +2115,36 @@ combine_inten_a_and_inten_a_pixels (const unsigned char *src1,
/* HEAD */ /* HEAD */
i = (((int)m) & (sizeof(int)-1)); i = (((int)m) & (sizeof(int)-1));
if (i != 0) if (i != 0)
i = sizeof(int) - i;
length -= i;
while (i--)
{ {
/* GUTS */ i = sizeof(int) - i;
src2_alpha = INT_MULT3(src2[alpha], *m, opacity, tmp); length -= i;
new_alpha = src1[alpha] + while (i--)
INT_MULT((255 - src1[alpha]), src2_alpha, tmp);
alphify (src2_alpha, new_alpha);
if (mode_affect)
{ {
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 */ /* BODY */
mask_ip = (int*)m; mask_ip = (int*)m;
i = length / sizeof(int); 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); src2_alpha = INT_MULT3(src2[alpha], *m, opacity, tmp);
new_alpha = src1[alpha] + new_alpha = src1[alpha] +
INT_MULT((255 - src1[alpha]), src2_alpha, tmp); INT_MULT((255 - src1[alpha]), src2_alpha, tmp);
alphify (src2_alpha, new_alpha); alphify (src2_alpha, new_alpha);
if (mode_affect) if (mode_affect)
{ {
dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha]; dest[alpha] = (affect[alpha]) ? new_alpha : src1[alpha];

View File

@ -5,13 +5,14 @@ PARASITE REGISTRY - 1998/10/09
This document is designed for the convenience of GIMP developers. This document is designed for the convenience of GIMP developers.
It does not need to concern users. 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: *** PREFIXES:
"gif2" : The standard GIMP GIF plugin
"tiff" : The standard GIMP TIFF plugin "tiff" : The standard GIMP TIFF plugin
"gimp" : For common and standard parasites "gimp" : For common and standard parasites

View File

@ -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 * - Adam D. Moss
* - Peter Mattis * - Peter Mattis
@ -7,7 +7,7 @@
* Based around original GIF code by David Koblas. * 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 - <adam@gimp.org> <adam@foxbox.org> * Adam D. Moss - <adam@gimp.org> <adam@foxbox.org>
*/ */
/* /*
@ -23,6 +23,11 @@
/* /*
* REVISION HISTORY * 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 * 98/10/09
* 2.01.00 - Added support for persistant GIF Comments through * 2.01.00 - Added support for persistant GIF Comments through
* the GIMP 1.1 Parasite mechanism where available. * the GIMP 1.1 Parasite mechanism where available.
@ -212,8 +217,6 @@
/* /*
* TODO (more *'s means more important!) * TODO (more *'s means more important!)
* *
* - Show GIF comments in a popup window?
*
* - PDB stuff for comments * - PDB stuff for comments
* *
* - 'requantize' option for INDEXEDA images which really have 256 colours * - 'requantize' option for INDEXEDA images which really have 256 colours
@ -2053,11 +2056,14 @@ save_dialog ( gint32 image_ID )
GtkWidget *toggle; GtkWidget *toggle;
GtkWidget *label; GtkWidget *label;
GtkWidget *entry; GtkWidget *entry;
GtkWidget *text;
GtkWidget *frame; GtkWidget *frame;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *menu; GtkWidget *menu;
GtkWidget *disposal_option_menu; GtkWidget *disposal_option_menu;
GtkWidget *com_table;
GtkWidget *vscrollbar;
#ifdef FACEHUGGERS #ifdef FACEHUGGERS
Parasite* GIF2_CMNT; Parasite* GIF2_CMNT;
#endif #endif
@ -2133,15 +2139,23 @@ save_dialog ( gint32 image_ID )
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), 1); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), 1);
gtk_widget_show (toggle); gtk_widget_show (toggle);
entry = gtk_entry_new (); com_table = gtk_table_new (1, 1, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); /* gtk_container_border_width (GTK_CONTAINER (com_table), 10);*/
gtk_widget_set_usize (entry, 240, 0); 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) if (globalcomment!=NULL)
{ {
g_free(globalcomment); g_free(globalcomment);
} }
#ifdef FACEHUGGERS #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) if (GIF2_CMNT)
{ {
globalcomment = g_malloc(GIF2_CMNT->size); globalcomment = g_malloc(GIF2_CMNT->size);
@ -2156,17 +2170,23 @@ save_dialog ( gint32 image_ID )
} }
parasite_free (GIF2_CMNT); parasite_free (GIF2_CMNT);
#endif #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); vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
gtk_signal_connect (GTK_OBJECT (entry), "changed", gtk_table_attach (GTK_TABLE (com_table), vscrollbar, 1, 2, 0, 1,
(GtkSignalFunc) comment_entry_callback, GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
NULL); gtk_widget_show (vscrollbar);
gtk_widget_show (entry); gtk_widget_show (text);
gtk_widget_show (com_table);
gtk_widget_show (hbox);
gtk_widget_show (hbox);
gtk_widget_show (vbox);
gtk_widget_show (frame); gtk_widget_show (vbox);
gtk_widget_show (frame);
/* additional animated gif parameter settings */ /* additional animated gif parameter settings */
@ -2833,6 +2853,12 @@ static void GIFEncodeCommentExt (FILE *fp, char *comment)
return; return;
} }
if (strlen(comment)>240)
{
g_print ("GIF: warning: comment too large - comment block not written.\n");
return;
}
fputc(0x21,fp); fputc(0x21,fp);
fputc(0xfe,fp); fputc(0xfe,fp);
fputc(strlen(comment),fp); fputc(strlen(comment),fp);
@ -3384,20 +3410,25 @@ comment_entry_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gint ssize; 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 */ /* Temporary kludge for overlength strings - just return */
if (ssize>240) if (ssize>240)
{ {
g_message ("GIF save: Your comment string is too long.\n"); g_message ("GIF save: Your comment string is too long.\n");
g_free(str);
return; return;
} }
if (globalcomment!=NULL) g_free(globalcomment); if (globalcomment!=NULL) g_free(globalcomment);
globalcomment = g_malloc(ssize+1); 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); */ /* g_print ("COMMENT: %s\n",globalcomment); */
} }

View File

@ -45,7 +45,9 @@
* progressive loads - gimp doesn't) loads the image it first gets a * progressive loads - gimp doesn't) loads the image it first gets a
* low res version displayed and then the image is progressively * low res version displayed and then the image is progressively
* enhanced until you get the final version. It doesn't add any size * 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 <setjmp.h> #include <setjmp.h>

View File

@ -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 * - Adam D. Moss
* - Peter Mattis * - Peter Mattis
@ -7,7 +7,7 @@
* Based around original GIF code by David Koblas. * 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 - <adam@gimp.org> <adam@foxbox.org> * Adam D. Moss - <adam@gimp.org> <adam@foxbox.org>
*/ */
/* /*
@ -23,6 +23,11 @@
/* /*
* REVISION HISTORY * 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 * 98/10/09
* 2.01.00 - Added support for persistant GIF Comments through * 2.01.00 - Added support for persistant GIF Comments through
* the GIMP 1.1 Parasite mechanism where available. * the GIMP 1.1 Parasite mechanism where available.
@ -212,8 +217,6 @@
/* /*
* TODO (more *'s means more important!) * TODO (more *'s means more important!)
* *
* - Show GIF comments in a popup window?
*
* - PDB stuff for comments * - PDB stuff for comments
* *
* - 'requantize' option for INDEXEDA images which really have 256 colours * - 'requantize' option for INDEXEDA images which really have 256 colours
@ -2053,11 +2056,14 @@ save_dialog ( gint32 image_ID )
GtkWidget *toggle; GtkWidget *toggle;
GtkWidget *label; GtkWidget *label;
GtkWidget *entry; GtkWidget *entry;
GtkWidget *text;
GtkWidget *frame; GtkWidget *frame;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *menu; GtkWidget *menu;
GtkWidget *disposal_option_menu; GtkWidget *disposal_option_menu;
GtkWidget *com_table;
GtkWidget *vscrollbar;
#ifdef FACEHUGGERS #ifdef FACEHUGGERS
Parasite* GIF2_CMNT; Parasite* GIF2_CMNT;
#endif #endif
@ -2133,15 +2139,23 @@ save_dialog ( gint32 image_ID )
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), 1); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), 1);
gtk_widget_show (toggle); gtk_widget_show (toggle);
entry = gtk_entry_new (); com_table = gtk_table_new (1, 1, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); /* gtk_container_border_width (GTK_CONTAINER (com_table), 10);*/
gtk_widget_set_usize (entry, 240, 0); 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) if (globalcomment!=NULL)
{ {
g_free(globalcomment); g_free(globalcomment);
} }
#ifdef FACEHUGGERS #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) if (GIF2_CMNT)
{ {
globalcomment = g_malloc(GIF2_CMNT->size); globalcomment = g_malloc(GIF2_CMNT->size);
@ -2156,17 +2170,23 @@ save_dialog ( gint32 image_ID )
} }
parasite_free (GIF2_CMNT); parasite_free (GIF2_CMNT);
#endif #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); vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
gtk_signal_connect (GTK_OBJECT (entry), "changed", gtk_table_attach (GTK_TABLE (com_table), vscrollbar, 1, 2, 0, 1,
(GtkSignalFunc) comment_entry_callback, GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
NULL); gtk_widget_show (vscrollbar);
gtk_widget_show (entry); gtk_widget_show (text);
gtk_widget_show (com_table);
gtk_widget_show (hbox);
gtk_widget_show (hbox);
gtk_widget_show (vbox);
gtk_widget_show (frame); gtk_widget_show (vbox);
gtk_widget_show (frame);
/* additional animated gif parameter settings */ /* additional animated gif parameter settings */
@ -2833,6 +2853,12 @@ static void GIFEncodeCommentExt (FILE *fp, char *comment)
return; return;
} }
if (strlen(comment)>240)
{
g_print ("GIF: warning: comment too large - comment block not written.\n");
return;
}
fputc(0x21,fp); fputc(0x21,fp);
fputc(0xfe,fp); fputc(0xfe,fp);
fputc(strlen(comment),fp); fputc(strlen(comment),fp);
@ -3384,20 +3410,25 @@ comment_entry_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gint ssize; 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 */ /* Temporary kludge for overlength strings - just return */
if (ssize>240) if (ssize>240)
{ {
g_message ("GIF save: Your comment string is too long.\n"); g_message ("GIF save: Your comment string is too long.\n");
g_free(str);
return; return;
} }
if (globalcomment!=NULL) g_free(globalcomment); if (globalcomment!=NULL) g_free(globalcomment);
globalcomment = g_malloc(ssize+1); 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); */ /* g_print ("COMMENT: %s\n",globalcomment); */
} }

View File

@ -45,7 +45,9 @@
* progressive loads - gimp doesn't) loads the image it first gets a * progressive loads - gimp doesn't) loads the image it first gets a
* low res version displayed and then the image is progressively * low res version displayed and then the image is progressively
* enhanced until you get the final version. It doesn't add any size * 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 <setjmp.h> #include <setjmp.h>

View File

@ -45,7 +45,9 @@
* progressive loads - gimp doesn't) loads the image it first gets a * progressive loads - gimp doesn't) loads the image it first gets a
* low res version displayed and then the image is progressively * low res version displayed and then the image is progressively
* enhanced until you get the final version. It doesn't add any size * 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 <setjmp.h> #include <setjmp.h>

View File

@ -45,7 +45,9 @@
* progressive loads - gimp doesn't) loads the image it first gets a * progressive loads - gimp doesn't) loads the image it first gets a
* low res version displayed and then the image is progressively * low res version displayed and then the image is progressively
* enhanced until you get the final version. It doesn't add any size * 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 <setjmp.h> #include <setjmp.h>

View File

@ -45,7 +45,9 @@
* progressive loads - gimp doesn't) loads the image it first gets a * progressive loads - gimp doesn't) loads the image it first gets a
* low res version displayed and then the image is progressively * low res version displayed and then the image is progressively
* enhanced until you get the final version. It doesn't add any size * 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 <setjmp.h> #include <setjmp.h>

View File

@ -45,7 +45,9 @@
* progressive loads - gimp doesn't) loads the image it first gets a * progressive loads - gimp doesn't) loads the image it first gets a
* low res version displayed and then the image is progressively * low res version displayed and then the image is progressively
* enhanced until you get the final version. It doesn't add any size * 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 <setjmp.h> #include <setjmp.h>

View File

@ -45,7 +45,9 @@
* progressive loads - gimp doesn't) loads the image it first gets a * progressive loads - gimp doesn't) loads the image it first gets a
* low res version displayed and then the image is progressively * low res version displayed and then the image is progressively
* enhanced until you get the final version. It doesn't add any size * 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 <setjmp.h> #include <setjmp.h>