Commit be1215a2 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

added -DGDK_PIXBUF_DISABLE_DEPRECATED to CPPFLAGS.

2001-12-18  Michael Natterer  <mitch@gimp.org>

	* configure.in: added -DGDK_PIXBUF_DISABLE_DEPRECATED to CPPFLAGS.

	* app/core/gimpbuffer.[ch]: gimp_buffer_get_[width|height]:
	added "const" to the GimpBuffer parameter.

	* app/core/gimpchannel.c: indentation and comment changes.

	* app/core/gimpdrawable-desaturate.c: don't include
	"paint-funcs/paint-funcs.h".

	* app/display/gimpdisplayshell.c: don't include "base/temp-buf.h".

	* app/gui/gui.c: removed the image container's "name_changed"
	handler.

	* app/gui/palette-import-dialog.[ch]: use GimpPreview and
	GimpContainerMenu instead of doing the same manually. Removed lots
	of code. Not perfect yet.

	* app/tools/gimpfuzzyselecttool.c: no need to include tile stuff.

	* app/widgets/gimpcontainerview-utils.c: better g_warning() message.

	* tools/pdbgen/pdb/paint_tools.pdb: don't include
	"base/tile-manager.h".

	* app/pdb/paint_tools_cmds.c: regenerated.

	* data/images/Makefile.am
	* data/images/gimp_logo.ppm: removed...
	* data/images/gimp_logo.png: ...and added as PNG.

	* app/gui/about-dialog.c: use gdk_pixbuf_new_from_file() to load
	the PNG logo instead of manually parsing the PPM.
parent d15b07b4
2001-12-18 Michael Natterer <mitch@gimp.org>
* configure.in: added -DGDK_PIXBUF_DISABLE_DEPRECATED to CPPFLAGS.
* app/core/gimpbuffer.[ch]: gimp_buffer_get_[width|height]:
added "const" to the GimpBuffer parameter.
* app/core/gimpchannel.c: indentation and comment changes.
* app/core/gimpdrawable-desaturate.c: don't include
"paint-funcs/paint-funcs.h".
* app/display/gimpdisplayshell.c: don't include "base/temp-buf.h".
* app/gui/gui.c: removed the image container's "name_changed"
handler.
* app/gui/palette-import-dialog.[ch]: use GimpPreview and
GimpContainerMenu instead of doing the same manually. Removed lots
of code. Not perfect yet.
* app/tools/gimpfuzzyselecttool.c: no need to include tile stuff.
* app/widgets/gimpcontainerview-utils.c: better g_warning() message.
* tools/pdbgen/pdb/paint_tools.pdb: don't include
"base/tile-manager.h".
* app/pdb/paint_tools_cmds.c: regenerated.
* data/images/Makefile.am
* data/images/gimp_logo.ppm: removed...
* data/images/gimp_logo.png: ...and added as PNG.
* app/gui/about-dialog.c: use gdk_pixbuf_new_from_file() to load
the PNG logo instead of manually parsing the PPM.
2001-12-17 Michael Natterer <mitch@gimp.org> 2001-12-17 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdrawablelistview.[ch]: changed * app/widgets/gimpdrawablelistview.[ch]: changed
......
...@@ -196,7 +196,7 @@ gimp_buffer_new (TileManager *tiles, ...@@ -196,7 +196,7 @@ gimp_buffer_new (TileManager *tiles,
} }
gint gint
gimp_buffer_get_width (GimpBuffer *buffer) gimp_buffer_get_width (const GimpBuffer *buffer)
{ {
g_return_val_if_fail (GIMP_IS_BUFFER (buffer), 0); g_return_val_if_fail (GIMP_IS_BUFFER (buffer), 0);
...@@ -204,7 +204,7 @@ gimp_buffer_get_width (GimpBuffer *buffer) ...@@ -204,7 +204,7 @@ gimp_buffer_get_width (GimpBuffer *buffer)
} }
gint gint
gimp_buffer_get_height (GimpBuffer *buffer) gimp_buffer_get_height (const GimpBuffer *buffer)
{ {
g_return_val_if_fail (GIMP_IS_BUFFER (buffer), 0); g_return_val_if_fail (GIMP_IS_BUFFER (buffer), 0);
......
...@@ -48,12 +48,12 @@ struct _GimpBufferClass ...@@ -48,12 +48,12 @@ struct _GimpBufferClass
GType gimp_buffer_get_type (void) G_GNUC_CONST; GType gimp_buffer_get_type (void) G_GNUC_CONST;
GimpBuffer * gimp_buffer_new (TileManager *tiles, GimpBuffer * gimp_buffer_new (TileManager *tiles,
const gchar *name, const gchar *name,
gboolean copy_pixels); gboolean copy_pixels);
gint gimp_buffer_get_width (GimpBuffer *buffer); gint gimp_buffer_get_width (const GimpBuffer *buffer);
gint gimp_buffer_get_height (GimpBuffer *buffer); gint gimp_buffer_get_height (const GimpBuffer *buffer);
#endif /* __GIMP_BUFFER_H__ */ #endif /* __GIMP_BUFFER_H__ */
...@@ -276,25 +276,30 @@ gimp_channel_scale (GimpChannel *channel, ...@@ -276,25 +276,30 @@ gimp_channel_scale (GimpChannel *channel,
GIMP_DRAWABLE (channel)->width, GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height); GIMP_DRAWABLE (channel)->height);
/* Allocate the new channel */
new_tiles = tile_manager_new (new_width, new_height, 1);
/* Configure the pixel regions */ /* Configure the pixel regions */
pixel_region_init (&srcPR, GIMP_DRAWABLE (channel)->tiles, pixel_region_init (&srcPR, GIMP_DRAWABLE (channel)->tiles,
0, 0, 0, 0,
GIMP_DRAWABLE (channel)->width, GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, FALSE); GIMP_DRAWABLE (channel)->height,
FALSE);
/* Allocate the new channel, configure dest region */ pixel_region_init (&destPR, new_tiles,
new_tiles = tile_manager_new (new_width, new_height, 1); 0, 0,
pixel_region_init (&destPR, new_tiles, 0, 0, new_width, new_height, TRUE); new_width, new_height,
TRUE);
/* Add an alpha channel */ /* Sclae the channel */
scale_region (&srcPR, &destPR); scale_region (&srcPR, &destPR);
/* Push the channel on the undo stack */ /* Push the channel on the undo stack */
undo_push_channel_mod (GIMP_DRAWABLE (channel)->gimage, channel); undo_push_channel_mod (GIMP_DRAWABLE (channel)->gimage, channel);
/* Configure the new channel */ /* Configure the new channel */
GIMP_DRAWABLE (channel)->tiles = new_tiles; GIMP_DRAWABLE (channel)->tiles = new_tiles;
GIMP_DRAWABLE (channel)->width = new_width; GIMP_DRAWABLE (channel)->width = new_width;
GIMP_DRAWABLE (channel)->height = new_height; GIMP_DRAWABLE (channel)->height = new_height;
/* bounds are now unknown */ /* bounds are now unknown */
...@@ -323,7 +328,7 @@ gimp_channel_resize (GimpChannel *channel, ...@@ -323,7 +328,7 @@ gimp_channel_resize (GimpChannel *channel,
g_return_if_fail (GIMP_IS_CHANNEL (channel)); g_return_if_fail (GIMP_IS_CHANNEL (channel));
if (!new_width || !new_height) if (new_width == 0 || new_height == 0)
return; return;
x1 = CLAMP (offx, 0, new_width); x1 = CLAMP (offx, 0, new_width);
...@@ -379,7 +384,11 @@ gimp_channel_resize (GimpChannel *channel, ...@@ -379,7 +384,11 @@ gimp_channel_resize (GimpChannel *channel,
/* Set to black (empty--for selections) */ /* Set to black (empty--for selections) */
if (clear) if (clear)
{ {
pixel_region_init (&destPR, new_tiles, 0, 0, new_width, new_height, TRUE); pixel_region_init (&destPR, new_tiles,
0, 0,
new_width, new_height,
TRUE);
color_region (&destPR, &bg); color_region (&destPR, &bg);
} }
......
...@@ -276,25 +276,30 @@ gimp_channel_scale (GimpChannel *channel, ...@@ -276,25 +276,30 @@ gimp_channel_scale (GimpChannel *channel,
GIMP_DRAWABLE (channel)->width, GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height); GIMP_DRAWABLE (channel)->height);
/* Allocate the new channel */
new_tiles = tile_manager_new (new_width, new_height, 1);
/* Configure the pixel regions */ /* Configure the pixel regions */
pixel_region_init (&srcPR, GIMP_DRAWABLE (channel)->tiles, pixel_region_init (&srcPR, GIMP_DRAWABLE (channel)->tiles,
0, 0, 0, 0,
GIMP_DRAWABLE (channel)->width, GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, FALSE); GIMP_DRAWABLE (channel)->height,
FALSE);
/* Allocate the new channel, configure dest region */ pixel_region_init (&destPR, new_tiles,
new_tiles = tile_manager_new (new_width, new_height, 1); 0, 0,
pixel_region_init (&destPR, new_tiles, 0, 0, new_width, new_height, TRUE); new_width, new_height,
TRUE);
/* Add an alpha channel */ /* Sclae the channel */
scale_region (&srcPR, &destPR); scale_region (&srcPR, &destPR);
/* Push the channel on the undo stack */ /* Push the channel on the undo stack */
undo_push_channel_mod (GIMP_DRAWABLE (channel)->gimage, channel); undo_push_channel_mod (GIMP_DRAWABLE (channel)->gimage, channel);
/* Configure the new channel */ /* Configure the new channel */
GIMP_DRAWABLE (channel)->tiles = new_tiles; GIMP_DRAWABLE (channel)->tiles = new_tiles;
GIMP_DRAWABLE (channel)->width = new_width; GIMP_DRAWABLE (channel)->width = new_width;
GIMP_DRAWABLE (channel)->height = new_height; GIMP_DRAWABLE (channel)->height = new_height;
/* bounds are now unknown */ /* bounds are now unknown */
...@@ -323,7 +328,7 @@ gimp_channel_resize (GimpChannel *channel, ...@@ -323,7 +328,7 @@ gimp_channel_resize (GimpChannel *channel,
g_return_if_fail (GIMP_IS_CHANNEL (channel)); g_return_if_fail (GIMP_IS_CHANNEL (channel));
if (!new_width || !new_height) if (new_width == 0 || new_height == 0)
return; return;
x1 = CLAMP (offx, 0, new_width); x1 = CLAMP (offx, 0, new_width);
...@@ -379,7 +384,11 @@ gimp_channel_resize (GimpChannel *channel, ...@@ -379,7 +384,11 @@ gimp_channel_resize (GimpChannel *channel,
/* Set to black (empty--for selections) */ /* Set to black (empty--for selections) */
if (clear) if (clear)
{ {
pixel_region_init (&destPR, new_tiles, 0, 0, new_width, new_height, TRUE); pixel_region_init (&destPR, new_tiles,
0, 0,
new_width, new_height,
TRUE);
color_region (&destPR, &bg); color_region (&destPR, &bg);
} }
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include "base/pixel-region.h" #include "base/pixel-region.h"
#include "paint-funcs/paint-funcs.h"
#include "gimpdrawable.h" #include "gimpdrawable.h"
#include "gimpdrawable-desaturate.h" #include "gimpdrawable-desaturate.h"
#include "gimpimage.h" #include "gimpimage.h"
......
...@@ -47,12 +47,12 @@ ...@@ -47,12 +47,12 @@
#define ANIMATION_STEPS 16 #define ANIMATION_STEPS 16
#define ANIMATION_SIZE 2 #define ANIMATION_SIZE 2
static gboolean about_dialog_load_logo (GtkWidget *window); static gboolean about_dialog_load_logo (GtkWidget *window);
static void about_dialog_destroy (GtkObject *object, static void about_dialog_destroy (GtkObject *object,
gpointer data); gpointer data);
static void about_dialog_unmap (GtkWidget *widget, static void about_dialog_unmap (GtkWidget *widget,
GdkEvent *event, gpointer data);
gpointer data);
static gint about_dialog_logo_expose (GtkWidget *widget, static gint about_dialog_logo_expose (GtkWidget *widget,
GdkEventExpose *event, GdkEventExpose *event,
gpointer data); gpointer data);
...@@ -139,7 +139,7 @@ about_dialog_create (void) ...@@ -139,7 +139,7 @@ about_dialog_create (void)
g_signal_connect (G_OBJECT (about_dialog), "destroy", g_signal_connect (G_OBJECT (about_dialog), "destroy",
G_CALLBACK (about_dialog_destroy), G_CALLBACK (about_dialog_destroy),
NULL); NULL);
g_signal_connect (G_OBJECT (about_dialog), "unmap_event", g_signal_connect (G_OBJECT (about_dialog), "unmap",
G_CALLBACK (about_dialog_unmap), G_CALLBACK (about_dialog_unmap),
NULL); NULL);
g_signal_connect (G_OBJECT (about_dialog), "button_press_event", g_signal_connect (G_OBJECT (about_dialog), "button_press_event",
...@@ -304,81 +304,55 @@ about_dialog_create (void) ...@@ -304,81 +304,55 @@ about_dialog_create (void)
static gboolean static gboolean
about_dialog_load_logo (GtkWidget *window) about_dialog_load_logo (GtkWidget *window)
{ {
GtkWidget *preview;
GdkGC *gc;
gchar buf[1024];
gchar *filename; gchar *filename;
guchar *pixelrow; GdkPixbuf *pixbuf;
FILE *fp; GdkGC *gc;
gint count;
gint i, j, k; gint i, j, k;
if (logo_pixmap) if (logo_pixmap)
return TRUE; return TRUE;
filename = g_build_filename (gimp_data_directory (), "images", filename = g_build_filename (gimp_data_directory (), "images",
"gimp_logo.ppm", NULL); "gimp_logo.png", NULL);
fp = fopen (filename, "rb");
g_free (filename);
if (!fp) pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
return FALSE;
fgets (buf, 1024, fp); g_free (filename);
if (strncmp (buf, "P6", 2) != 0)
{
fclose (fp);
return FALSE;
}
fgets (buf, 1024, fp);
fgets (buf, 1024, fp);
sscanf (buf, "%d %d", &logo_width, &logo_height);
fgets (buf, 1024, fp); if (! pixbuf)
if (strncmp (buf, "255", 3) != 0) return FALSE;
{
fclose (fp);
return FALSE;
}
preview = gtk_preview_new (GTK_PREVIEW_COLOR); logo_width = gdk_pixbuf_get_width (pixbuf);
gtk_preview_size (GTK_PREVIEW (preview), logo_width, logo_height); logo_height = gdk_pixbuf_get_height (pixbuf);
pixelrow = g_new (guchar, logo_width * 3);
for (i = 0; i < logo_height; i++) gtk_widget_realize (window);
{
count = fread (pixelrow, sizeof (guchar), logo_width * 3, fp);
if (count != (logo_width * 3))
{
gtk_object_sink (GTK_OBJECT (preview));
g_free (pixelrow);
fclose (fp);
return FALSE;
}
gtk_preview_draw_row (GTK_PREVIEW (preview), pixelrow, 0, i, logo_width); logo_pixmap = gdk_pixmap_new (window->window,
} logo_width, logo_height,
gtk_widget_get_visual (window)->depth);
gtk_widget_realize (window);
logo_pixmap = gdk_pixmap_new (window->window, logo_width, logo_height,
gtk_preview_get_visual ()->depth);
gc = gdk_gc_new (logo_pixmap); gc = gdk_gc_new (logo_pixmap);
gtk_preview_put (GTK_PREVIEW (preview),
logo_pixmap, gc,
0, 0, 0, 0, logo_width, logo_height);
g_object_unref (gc);
gtk_object_sink (GTK_OBJECT (preview)); gdk_pixbuf_render_to_drawable (pixbuf,
g_free (pixelrow); GDK_DRAWABLE (logo_pixmap),
gc,
0, 0,
0, 0,
logo_width,
logo_height,
GDK_RGB_DITHER_MAX,
0, 0);
fclose (fp); g_object_unref (G_OBJECT (gc));
g_object_unref (G_OBJECT (pixbuf));
dissolve_width = dissolve_width =
(logo_width / ANIMATION_SIZE) + (logo_width % ANIMATION_SIZE == 0 ? 0 : 1); (logo_width / ANIMATION_SIZE) +
(logo_width % ANIMATION_SIZE == 0 ? 0 : 1);
dissolve_height = dissolve_height =
(logo_height / ANIMATION_SIZE) + (logo_height % ANIMATION_SIZE == 0 ? 0 : 1); (logo_height / ANIMATION_SIZE) +
(logo_height % ANIMATION_SIZE == 0 ? 0 : 1);
dissolve_map = g_new (guchar, dissolve_width * dissolve_height); dissolve_map = g_new (guchar, dissolve_width * dissolve_height);
...@@ -396,13 +370,12 @@ about_dialog_destroy (GtkObject *object, ...@@ -396,13 +370,12 @@ about_dialog_destroy (GtkObject *object,
gpointer data) gpointer data)
{ {
about_dialog = NULL; about_dialog = NULL;
about_dialog_unmap (NULL, NULL, NULL); about_dialog_unmap (NULL, NULL);
} }
static void static void
about_dialog_unmap (GtkWidget *widget, about_dialog_unmap (GtkWidget *widget,
GdkEvent *event, gpointer data)
gpointer data)
{ {
if (timer) if (timer)
{ {
......
This diff is collapsed.
...@@ -20,12 +20,8 @@ ...@@ -20,12 +20,8 @@
#define __PALETTE_IMPORT_H__ #define __PALETTE_IMPORT_H__
void palette_import_dialog_show (Gimp *gimp); void palette_import_dialog_show (Gimp *gimp);
void palette_import_dialog_destroy (void); void palette_import_dialog_destroy (void);
/* FIXME */
void palette_import_image_renamed (GimpImage *gimage);
#endif /* __PALETTE_IMPORT_H__ */ #endif /* __PALETTE_IMPORT_H__ */
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include "display-types.h" #include "display-types.h"
#include "base/temp-buf.h"
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpbuffer.h" #include "core/gimpbuffer.h"
#include "core/gimpcontext.h" #include "core/gimpcontext.h"
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include "display-types.h" #include "display-types.h"
#include "base/temp-buf.h"
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpbuffer.h" #include "core/gimpbuffer.h"
#include "core/gimpcontext.h" #include "core/gimpcontext.h"
......
...@@ -47,12 +47,12 @@ ...@@ -47,12 +47,12 @@
#define ANIMATION_STEPS 16 #define ANIMATION_STEPS 16
#define ANIMATION_SIZE 2 #define ANIMATION_SIZE 2
static gboolean about_dialog_load_logo (GtkWidget *window); static gboolean about_dialog_load_logo (GtkWidget *window);
static void about_dialog_destroy (GtkObject *object, static void about_dialog_destroy (GtkObject *object,
gpointer data); gpointer data);
static void about_dialog_unmap (GtkWidget *widget, static void about_dialog_unmap (GtkWidget *widget,
GdkEvent *event, gpointer data);
gpointer data);
static gint about_dialog_logo_expose (GtkWidget *widget, static gint about_dialog_logo_expose (GtkWidget *widget,
GdkEventExpose *event, GdkEventExpose *event,
gpointer data); gpointer data);
...@@ -139,7 +139,7 @@ about_dialog_create (void) ...@@ -139,7 +139,7 @@ about_dialog_create (void)
g_signal_connect (G_OBJECT (about_dialog), "destroy", g_signal_connect (G_OBJECT (about_dialog), "destroy",
G_CALLBACK (about_dialog_destroy), G_CALLBACK (about_dialog_destroy),
NULL); NULL);
g_signal_connect (G_OBJECT (about_dialog), "unmap_event", g_signal_connect (G_OBJECT (about_dialog), "unmap",
G_CALLBACK (about_dialog_unmap), G_CALLBACK (about_dialog_unmap),
NULL); NULL);
g_signal_connect (G_OBJECT (about_dialog), "button_press_event", g_signal_connect (G_OBJECT (about_dialog), "button_press_event",
...@@ -304,81 +304,55 @@ about_dialog_create (void) ...@@ -304,81 +304,55 @@ about_dialog_create (void)
static gboolean static gboolean
about_dialog_load_logo (GtkWidget *window) about_dialog_load_logo (GtkWidget *window)
{ {
GtkWidget *preview;
GdkGC *gc;
gchar buf[1024];
gchar *filename; gchar *filename;
guchar *pixelrow; GdkPixbuf *pixbuf;
FILE *fp; GdkGC *gc;
gint count;
gint i, j, k; gint i, j, k;
if (logo_pixmap) if (logo_pixmap)
return TRUE; return TRUE;
filename = g_build_filename (gimp_data_directory (), "images", filename = g_build_filename (gimp_data_directory (), "images",
"gimp_logo.ppm", NULL); "gimp_logo.png", NULL);
fp = fopen (filename, "rb");
g_free (filename);
if (!fp) pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
return FALSE;
fgets (buf, 1024, fp); g_free (filename);
if (strncmp (buf, "P6", 2) != 0)
{
fclose (fp);
return FALSE;
}
fgets (buf, 1024, fp);
fgets (buf, 1024, fp);
sscanf (buf, "%d %d", &logo_width, &logo_height);
fgets (buf, 1024, fp); if (! pixbuf)
if (strncmp (buf, "255", 3) != 0) return FALSE;
{
fclose (fp);
return FALSE;
}
preview = gtk_preview_new (GTK_PREVIEW_COLOR); logo_width = gdk_pixbuf_get_width (pixbuf);
gtk_preview_size (GTK_PREVIEW (preview), logo_width, logo_height); logo_height = gdk_pixbuf_get_height (pixbuf);
pixelrow = g_new (guchar, logo_width * 3);
for (i = 0; i < logo_height; i++) gtk_widget_realize (window);
{