Commit 176ea8da authored by GMT 1999  Adam D. Moss's avatar GMT 1999 Adam D. Moss Committed by Adam D. Moss
Browse files

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.
parent 74fae969
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>
* app/pixel_region.c, app/pixel_region.h: new function
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......@@ -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);
}
......@@ -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);
}
......@@ -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);
}
......
......@@ -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);
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);
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]);
}
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 */
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];
}
else
{
dest[alpha] = (src1[alpha]) ? src1[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 */
}
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];
......
......@@ -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);
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);
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]);
}
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 */
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];
}
else
{
dest[alpha] = (src1[alpha]) ? src1[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 */
}
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];
......
......@@ -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
......
/* 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 - <adam@gimp.org> <adam@foxbox.org>
*/
/*
......@@ -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_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);
gtk_text_insert(GTK_TEXT(text),NULL,NULL,NULL,globalcomment,-1);
gtk_signal_connect (GTK_OBJECT (text), "changed",
(GtkSignalFunc) comment_entry_callback,
NULL);