Commit 1c19f04c authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist
Browse files

Also provide a Clear button.

1999-08-21  Tor Lillqvist  <tml@iki.fi>

* app/errorconsole.c: Also provide a Clear button.

* app/gimprc.c: Add a missing static function declaration.

* app/makefile.{cygwin,msc}: Add new files.

* libgimp/gimp.def: Add new entry points.

* plug-ins/common/jpeg.c: Must include glib.h first. You don't
want to know why.

* plug-ins/common/psp.c: New file. This plug-in Loads Paint Shop
Pro files (.psp and .tub). Doesn't yet save them. Handles only 24-
bit images (with or without alpha) correctly so far.

* plug-ins/makefile.{cygwin,msc}: Build psp. Somebody please add
it to the auto* build system, too. I guess a test for zlib (which it
needs) is needed in configure.in.
parent 24032473
1999-08-21 Tor Lillqvist <tml@iki.fi>
* app/errorconsole.c: Also provide a Clear button.
* app/gimprc.c: Add a missing static function declaration.
* app/makefile.{cygwin,msc}: Add new files.
* libgimp/gimp.def: Add new entry points.
* plug-ins/common/jpeg.c: Must include glib.h first. You don't
want to know why.
* plug-ins/common/psp.c: New file. This plug-in Loads Paint Shop
Pro files (.psp and .tub). Doesn't yet save them. Handles only 24-
bit images (with or without alpha) correctly so far.
* plug-ins/makefile.{cygwin,msc}: Build psp. Somebody please add
it to the auto* build system, too. I guess a test for zlib (which it
needs) is needed in configure.in.
Sat Aug 21 16:53:17 BST 1999 Adam D. Moss <adam@gimp.org>
* plug-ins/common/jpeg.c: Preview layers need to be alpha-padded,
......
......@@ -75,6 +75,14 @@ error_console_close_callback (GtkWidget *widget,
message_handler = MESSAGE_BOX;
}
static void
error_console_clear_callback (GtkWidget *widget,
gpointer data)
{
gtk_editable_delete_text
(GTK_EDITABLE (text), 0, gtk_text_get_length (GTK_TEXT (text)));
}
static gint
error_console_delete_callback (GtkWidget *widget,
GdkEvent *event,
......@@ -257,6 +265,7 @@ text_clicked_callback (GtkWidget *widget,
/* the action area structure */
static ActionAreaItem action_items[] =
{
{ N_("Clear"), error_console_clear_callback, NULL, NULL },
{ N_("Close"), error_console_close_callback, NULL, NULL }
};
......@@ -283,10 +292,6 @@ error_console_create_window (void)
(GdkEventFunc) error_console_delete_callback, NULL);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (error_console)->vbox), 2);
/* Action area */
action_items[0].user_data = error_console;
build_action_area (GTK_DIALOG (error_console), action_items, 1, 0);
menu = gtk_menu_new ();
menuitem = gtk_menu_item_new_with_label (_("Write all errors to file..."));
......@@ -329,6 +334,11 @@ error_console_create_window (void)
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (vscrollbar);
/* Action area */
action_items[0].user_data = error_console;
action_items[1].user_data = text;
build_action_area (GTK_DIALOG (error_console), action_items, 2, 0);
gtk_widget_show (error_console);
}
......
......@@ -197,6 +197,7 @@ static inline char* boolean_to_str (gpointer val1p, gpointer val2p);
static inline char* position_to_str (gpointer val1p, gpointer val2p);
static inline char* mem_size_to_str (gpointer val1p, gpointer val2p);
static inline char* image_type_to_str (gpointer val1p, gpointer val2p);
static inline char* interpolation_type_to_str (gpointer val1p, gpointer val2p);
static inline char* color_cube_to_str (gpointer val1p, gpointer val2p);
static inline char* preview_size_to_str (gpointer val1p, gpointer val2p);
static inline char* units_to_str (gpointer val1p, gpointer val2p);
......
......@@ -139,6 +139,7 @@ gimp_OBJECTS = \
gimpbrushlist.o \
gimpbrushpixmap.o \
gimpcontext.o \
gimpdnd.o \
gimphistogram.o \
gimplist.o \
gimplut.o \
......
......@@ -146,6 +146,7 @@ gimp_OBJECTS = \
gimpbrushlist.obj \
gimpbrushpixmap.obj \
gimpcontext.obj \
gimpdnd.obj \
gimphistogram.obj \
gimplist.obj \
gimplut.obj \
......
......@@ -90,6 +90,7 @@ EXPORTS
gimp_image_find_parasite
gimp_image_flatten
gimp_image_floating_selection
gimp_image_freeze_undo
gimp_image_get_active_channel
gimp_image_get_active_layer
gimp_image_get_channels
......@@ -123,6 +124,7 @@ EXPORTS
gimp_image_set_filename
gimp_image_set_resolution
gimp_image_set_unit
gimp_image_thaw_undo
gimp_image_width
gimp_install_cmap
gimp_install_procedure
......@@ -218,6 +220,8 @@ EXPORTS
gimp_tile_ref_zero
gimp_tile_unref
gimp_tile_width
gimp_undo_push_group_end
gimp_undo_push_group_start
gimp_uninstall_temp_proc
gimp_unit_get_abbreviation
gimp_unit_get_deletion_flag
......
......@@ -103,6 +103,11 @@
* changed.
*/
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include <glib.h> /* We want glib.h first because of some
* pretty obscure Win32 compilation issues.
*/
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -111,7 +116,6 @@
#include <unistd.h>
#include <jpeglib.h>
#include <jerror.h>
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/stdplugins-intl.h"
......
......@@ -19,7 +19,7 @@
/*
*
* Work in progress! Doesn't do anything at all useful yet.
* Work in progress! Doesn't handle saving yet.
*
* For a copy of the PSP file format documentation, surf to
* http://www.jasc.com.
......@@ -27,7 +27,7 @@
*/
/* set to the level of debugging output you want, 0 for none */
#define PSP_DEBUG 2
#define PSP_DEBUG 0
/* the max number of layers that this plugin should try to load */
#define MAX_LAYERS 64
......@@ -58,17 +58,18 @@
g_free (_t); \
} G_STMT_END
/* The following was cut and pasted from the PSP file format
* documentation version 3.0.(Minor stylistic changes done.)
*
* Note that the upcoming PSP version 6 writes PSP file format version
/* Note that the upcoming PSP version 6 writes PSP file format version
* 4.0, but the documentation for that apparently isn't publicly
* available (yet). The format is designed to be downward compatible,
* however. The semantics of many of the additional fields and
* block types can be deduced by reverse engineering.
* available (yet). The format is luckily designed to be somwehat
* downward compatible, however. The semantics of many of the
* additional fields and block types can be relatively easily reverse
* engineered.
*/
/*
/* The following was cut and pasted from the PSP file format
* documentation version 3.0.(Minor stylistic changes done.)
*
*
* To be on the safe side, here is the whole copyright notice from the
* specification:
*
......@@ -122,7 +123,8 @@
*
* Jasc reserves the right to amend, modify, change, revoke or
* withdraw the Specification at any time and from time to time. Jasc
* shall have no obligation to support or maintain the Specification. */
* shall have no obligation to support or maintain the Specification.
*/
/* Block identifiers.
*/
......@@ -966,9 +968,21 @@ channel_type_name (int type)
return err_name;
}
static void *
psp_zalloc (void *opaque, guint items, guint size)
{
return g_malloc (items*size);
}
static void
psp_zfree (void *opaque, void *ptr)
{
g_free (ptr);
}
static int
read_channel_data (FILE *f,
PSPCompression compression,
PSPimage *ia,
guchar **pixels,
guint bytespp,
guint offset,
......@@ -976,10 +990,12 @@ read_channel_data (FILE *f,
guint32 compressed_len)
{
gint i, n, x, y, width = drawable->width, height = drawable->height;
guchar *scanline, *p, *q, *endq;
gint npixels = width * height;
guchar *buf, *buf2, *p, *q, *endq;
guchar runcount, byte;
z_stream zstream;
switch (compression)
switch (ia->compression)
{
case PSP_COMP_NONE:
if (bytespp == 1)
......@@ -997,13 +1013,13 @@ read_channel_data (FILE *f,
}
else
{
scanline = g_malloc (width);
buf = g_malloc (width);
for (y = 0; y < height; y++)
{
fread (scanline, width, 1, f);
fread (buf, width, 1, f);
if (width % 4)
fseek (f, 4 - (width % 4), SEEK_CUR);
p = scanline;
p = buf;
q = pixels[y] + offset;
for (i = 0; i < width; i++)
{
......@@ -1011,45 +1027,88 @@ read_channel_data (FILE *f,
q += bytespp;
}
}
g_free (scanline);
g_free (buf);
}
break;
case PSP_COMP_RLE:
q = pixels[0] + offset;
endq = q + height * width * bytespp;
scanline = g_malloc (127);
endq = q + npixels * bytespp;
buf = g_malloc (127);
while (q < endq)
{
p = scanline;
p = buf;
fread (&runcount, 1, 1, f);
if (runcount > 128)
{
runcount -= 128;
fread (&byte, 1, 1, f);
memset (scanline, byte, runcount);
memset (buf, byte, runcount);
}
else
fread (scanline, runcount, 1, f);
fread (buf, runcount, 1, f);
if (bytespp == 1)
{
memmove (q, scanline, runcount);
memmove (q, buf, runcount);
q += runcount;
}
else
{
p = buf;
for (i = 0; i < runcount; i++)
{
*q = scanline[i];
*q = *p++;
q += bytespp;
}
}
}
g_free (scanline);
g_free (buf);
break;
case PSP_COMP_LZ77:
buf = g_malloc (compressed_len);
fread (buf, compressed_len, 1, f);
zstream.next_in = buf;
zstream.avail_in = compressed_len;
zstream.zalloc = psp_zalloc;
zstream.zfree = psp_zfree;
zstream.opaque = f;
if (inflateInit (&zstream) != Z_OK)
{
gimp_message ("PSP: zlib error");
fclose (f);
return -1;
}
if (bytespp == 1)
zstream.next_out = pixels[0];
else
{
buf2 = g_malloc (npixels);
zstream.next_out = buf2;
}
zstream.avail_out = npixels;
if (inflate (&zstream, Z_FINISH) != Z_STREAM_END)
{
gimp_message ("PSP: zlib error");
inflateEnd (&zstream);
fclose (f);
return -1;
}
inflateEnd (&zstream);
g_free (buf);
if (bytespp > 1)
{
p = buf2;
q = pixels[0] + offset;
for (i = 0; i < npixels; i++)
{
*q = *p++;
q += bytespp;
}
g_free (buf2);
}
break;
}
}
......@@ -1189,14 +1248,23 @@ read_layer_block (FILE *f,
height = saved_image_rect[3] - saved_image_rect[1];
IFDBG(2) gimp_message_printf
(("PSP: layer: %s %dx%d (%dx%d) opacity %d blend_mode %s "
(("PSP: layer: %s %dx%d (%dx%d) @%d,%d opacity %d blend_mode %s "
"%d bitmaps %d channels",
name,
image_rect[2] - image_rect[0], image_rect[3] - image_rect[1],
width, height,
saved_image_rect[0], saved_image_rect[1],
opacity, blend_mode_name (blend_mode),
bitmap_count, channel_count));
IFDBG(2) gimp_message_printf
(("PSP: mask %dx%d (%dx%d) @%d,%d",
mask_rect[2] - mask_rect[0],
mask_rect[3] - mask_rect[1],
saved_mask_rect[2] - saved_mask_rect[0],
saved_mask_rect[3] - saved_mask_rect[1],
saved_mask_rect[0], saved_mask_rect[1]));
if (width == 0)
{
width++;
......@@ -1337,7 +1405,7 @@ read_layer_block (FILE *f,
bytespp));
if (bitmap_type == PSP_DIB_TRANS_MASK)
offset = 4;
offset = 3;
else
offset = channel_type - PSP_CHANNEL_RED;
......@@ -1349,8 +1417,12 @@ read_layer_block (FILE *f,
}
if (!null_layer)
read_channel_data (f, ia->compression, pixels,
bytespp, offset, drawable, compressed_len);
if (read_channel_data (f, ia, pixels, bytespp,
offset, drawable, compressed_len) == -1)
{
gimp_image_delete (image_ID);
return -1;
}
if (try_fseek (f, channel_start + channel_total_len, SEEK_SET) < 0)
{
......@@ -1483,7 +1555,7 @@ load_image (char *filename)
block_total_len, &ia) == -1)
return -1;
IFDBG(3) gimp_message_printf (("PSP: %d dpi %dx%d %s",
IFDBG(2) gimp_message_printf (("PSP: %d dpi %dx%d %s",
(int) ia.resolution,
ia.width, ia.height,
compression_name (ia.compression)));
......@@ -1571,7 +1643,9 @@ save_image (char *filename,
gint32 image_ID,
gint32 drawable_ID)
{
return 42;
gimp_message ("PSP: Saving not implemented yet");
return 0;
}
static void
......
......@@ -103,6 +103,11 @@
* changed.
*/
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include <glib.h> /* We want glib.h first because of some
* pretty obscure Win32 compilation issues.
*/
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -111,7 +116,6 @@
#include <unistd.h>
#include <jpeglib.h>
#include <jerror.h>
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/stdplugins-intl.h"
......
......@@ -103,6 +103,11 @@
* changed.
*/
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include <glib.h> /* We want glib.h first because of some
* pretty obscure Win32 compilation issues.
*/
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -111,7 +116,6 @@
#include <unistd.h>
#include <jpeglib.h>
#include <jerror.h>
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/stdplugins-intl.h"
......
......@@ -103,6 +103,11 @@
* changed.
*/
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include <glib.h> /* We want glib.h first because of some
* pretty obscure Win32 compilation issues.
*/
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -111,7 +116,6 @@
#include <unistd.h>
#include <jpeglib.h>
#include <jerror.h>
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/stdplugins-intl.h"
......
......@@ -103,6 +103,11 @@
* changed.
*/
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include <glib.h> /* We want glib.h first because of some
* pretty obscure Win32 compilation issues.
*/
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -111,7 +116,6 @@
#include <unistd.h>
#include <jpeglib.h>
#include <jerror.h>
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/stdplugins-intl.h"
......
......@@ -103,6 +103,11 @@
* changed.
*/
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include <glib.h> /* We want glib.h first because of some
* pretty obscure Win32 compilation issues.
*/
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -111,7 +116,6 @@
#include <unistd.h>
#include <jpeglib.h>
#include <jerror.h>
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/stdplugins-intl.h"
......
......@@ -103,6 +103,11 @@
* changed.
*/
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include <glib.h> /* We want glib.h first because of some
* pretty obscure Win32 compilation issues.
*/
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -111,7 +116,6 @@
#include <unistd.h>
#include <jpeglib.h>
#include <jerror.h>
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/stdplugins-intl.h"
......
......@@ -25,7 +25,7 @@ FROMPLUGINSDIR=YES # Used to bypass other parts below
COMMON1 = CEL CML_explorer align_layers animationplay animoptimize apply_lens autocrop autostretch_hsv blinds blur bumpmap c_astretch checkerboard colorify compose convmatrix csource cubism curve_bend
COMMON2 = decompose deinterlace depthmerge despeckle destripe diffraction displace edge emboss engrave exchange film flarefx fractaltrace
COMMON3 = gauss_iir gauss_rle gbr gee gicon gif gifload glasstile gqbist gradmap grid gtm guillotine gz header hot hrz illusion iwarp jigsaw jpeg laplace lic
COMMON4 = mapcolor max_rgb mblur newsprint nlfilt noisify normalize nova oilify palette papertile pat pcx pix pixelize plasma plugindetails png pnm polar ps psd randomize ripple rotate rotators
COMMON4 = mapcolor max_rgb mblur newsprint nlfilt noisify normalize nova oilify palette papertile pat pcx pix pixelize plasma plugindetails png pnm polar ps psd psp randomize ripple rotate rotators
COMMON5 = sample_colorize scatter_hsv semiflatten sharpen shift smooth_palette snoise sobel sparkle spread sunras tga threshold_alpha tiff tile tileit tiler video vinvert vpropagate waves whirlpinch winclipboard wind winprint wmf xbm xwd zealouscrop
# These have own subdirectories each
......@@ -217,8 +217,6 @@ OBJECTS = \
endif
ifdef EXTRA_jpeg
# Location of jpeg-6b sources
JPEG = $(TOP)/../jpeg-6b
EXTRACFLAGS = -I$(JPEG)
EXTRALIBS = -L $(JPEG) -ljpeg
endif
......@@ -232,10 +230,6 @@ OBJECTS = \
endif
ifdef EXTRA_png
# Location of libpng sources
PNG = $(TOP)/../libpng-1.0.3
# And zlib
ZLIB = $(TOP)/../zlib-1.1.3
EXTRACFLAGS = -I$(PNG) -I$(ZLIB)
EXTRALIBS = -L $(PNG) -lpng -L $(ZLIB) -lz
endif
......@@ -249,6 +243,11 @@ OBJECTS = \
print-util.o
endif
ifdef EXTRA_psp
EXTRACFLAGS = -I$(ZLIB)
EXTRALIBS = -L $(ZLIB) -lz
endif
ifdef EXTRA_rcm
OBJECTS = \
rcm.o \
......@@ -295,12 +294,6 @@ OBJECTS = \
endif
ifdef EXTRA_tiff
# Location of tiff-3.4 sources
TIFF = $(TOP)/../tiff-v3.4/libtiff
# Location of jpeg-6b sources
JPEG = $(TOP)/../jpeg-6b
# And zlib
ZLIB = $(TOP)/../zlib-1.1.3
EXTRACFLAGS = -I$(TIFF)
EXTRALIBS = -L $(TIFF) -ltiff -L $(JPEG) -ljpeg -L $(ZLIB) -lz -luser32
endif
......@@ -381,6 +374,15 @@ GTK = $(TOP)/../gtk+
GLIB = $(TOP)/../glib
INTL = $(TOP)/../intl
# Location of libpng sources
PNG = $(TOP)/../libpng-1.0.3
# Location of tiff-3.4 sources
TIFF = $(TOP)/../tiff-v3.4/libtiff
# Location of jpeg-6b sources
JPEG = $(TOP)/../jpeg-6b
# And zlib
ZLIB = $(TOP)/../zlib-1.1.3
PLUGINDIR = $(TOP)/plug-ins
OPTIMIZE = -O
......
......@@ -236,8 +236,6 @@ OPTIMIZE =
!ENDIF
!IFDEF EXTRA_jpeg
# Location of jpeg-6b sources
JPEG = $(TOP)\..\jpeg-6b
EXTRACFLAGS = -I$(JPEG)
EXTRALIBS = $(JPEG)\libjpeg.lib
!ENDIF
......@@ -251,10 +249,6 @@ OBJECTS = \
!ENDIF
!IFDEF EXTRA_png
# Location of libpng sources
PNG = $(TOP)\..\libpng-1.0.3
# And zlib
ZLIB = $(TOP)\..\zlib-1.1.3
EXTRACFLAGS = -I$(PNG) -I$(ZLIB)
EXTRALIBS = $(PNG)\libpng.lib $(ZLIB)\zlib.lib
!ENDIF
......@@ -268,6 +262,11 @@ OBJECTS = \
print-util.obj
!ENDIF
!IFDEF EXTRA_psp
EXTRACFLAGS = -I$(ZLIB)
EXTRALIBS = $(ZLIB)\zlib.lib user32.lib
!ENDIF
!IFDEF EXTRA_rcm
OBJECTS = \
rcm.obj \
......@@ -314,12 +313,6 @@ OBJECTS = \
!ENDIF