Commit faeaa7cc authored by Lauri Alanko's avatar Lauri Alanko

Removed most of the image id system. They're still used with pdb.

	At quick glance, nothing seems to be broken, but if things weird
	out, blame me.

	Now just the same for layers, channels and displays...
parent 7a4579db
Mon Jun 29 03:14:14 EEST 1998 Lauri Alanko <nether@gimp.org>
* app/airbrush.c app/bezier_select.c app/by_color_select.c:
* app/channel.c app/channel.h app/channel_cmds.c app/channel_ops.c:
* app/channel_ops.h app/channels_dialog.c app/commands.c:
* app/convert.c app/convert.h app/convolve.c app/crop.c:
* app/drawable.c app/drawable.h app/drawable_pvt.h:
* app/ellipse_select.c app/file_new_dialog.c app/fileops.c:
* app/fileops.h app/floating_sel.c app/free_select.c:
* app/fuzzy_select.c app/gdisplay.c app/gdisplay.h app/gimage.c:
* app/gimage_cmds.c app/gimage_mask.c app/gimpimage.c:
* app/gimpimage.h app/gimpimageF.h app/gimpobject.c app/gimpobject.h:
* app/indexed_palette.c app/indexed_palette.h app/ink.c:
* app/iscissors.c app/layer.c app/layer.h app/layer_cmds.c:
* app/layers_dialog.c app/layers_dialog.h app/layers_dialogP.h:
* app/move.c app/paint_core.c app/paint_funcs.c app/paint_funcs.h:
* app/preferences_dialog.c app/rect_select.c app/text_tool.c:
* app/transform_core.c app/undo.c app/xcf.c:
Removed most of the image id system. They're still used with pdb.
At quick glance, nothing seems to be broken, but if things weird
out, blame me.
Now just the same for layers, channels and displays...
Sun Jun 28 10:08:53 PDT 1998 Manish Singh <yosh@gimp.org>
* plug-ins/ps/ps.c: don't use app private includes
......
......@@ -983,9 +983,9 @@ dialogs_lc_cmd_callback (GtkWidget *widget,
gdisp = gdisplay_active ();
if (gdisp == NULL)
lc_dialog_create (-1);
lc_dialog_create (NULL);
else
lc_dialog_create (gdisp->gimage->ID);
lc_dialog_create (gdisp->gimage);
}
void
......@@ -996,7 +996,7 @@ dialogs_indexed_palette_cmd_callback (GtkWidget *widget,
gdisp = gdisplay_active ();
indexed_palette_create (gdisp->gimage->ID);
indexed_palette_create (gdisp->gimage);
}
void
......
......@@ -27,6 +27,7 @@
#include "airbrush.h"
#include "selection.h"
#include "tools.h"
#include "gimage.h"
typedef struct _AirbrushTimeout AirbrushTimeout;
......
......@@ -1319,7 +1319,7 @@ bezier_convert (BezierSelect *bezier_sel,
}
/* create a new mask */
bezier_sel->mask = channel_ref (channel_new_mask (gdisp->gimage->ID,
bezier_sel->mask = channel_ref (channel_new_mask (gdisp->gimage,
gdisp->gimage->width,
gdisp->gimage->height));
......
......@@ -198,7 +198,7 @@ by_color_select_color (GImage *gimage,
}
alpha = bytes - 1;
mask = channel_new_mask (gimage->ID, width, height);
mask = channel_new_mask (gimage, width, height);
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE(mask)),
0, 0, width, height, TRUE);
......
......@@ -117,7 +117,7 @@ channel_validate (TileManager *tm, Tile *tile, int level)
Channel *
channel_new (int gimage_ID, int width, int height, char *name, int opacity,
channel_new (GimpImage* gimage, int width, int height, char *name, int opacity,
unsigned char *col)
{
Channel * channel;
......@@ -126,7 +126,7 @@ channel_new (int gimage_ID, int width, int height, char *name, int opacity,
channel = gtk_type_new (gimp_channel_get_type ());
gimp_drawable_configure (GIMP_DRAWABLE(channel),
gimage_ID, width, height, GRAY_GIMAGE, name);
gimage, width, height, GRAY_GIMAGE, name);
/* set the channel color and opacity */
for (i = 0; i < 3; i++)
......@@ -177,7 +177,7 @@ channel_copy (Channel *channel)
sprintf (channel_name, "%s copy", GIMP_DRAWABLE(channel)->name);
/* allocate a new channel object */
new_channel = channel_new (GIMP_DRAWABLE(channel)->gimage_ID,
new_channel = channel_new (GIMP_DRAWABLE(channel)->gimage,
GIMP_DRAWABLE(channel)->width,
GIMP_DRAWABLE(channel)->height,
channel_name, channel->opacity, channel->col);
......@@ -260,7 +260,7 @@ channel_scale (Channel *channel, int new_width, int new_height)
scale_region (&srcPR, &destPR);
/* Push the channel on the undo stack */
undo_push_channel_mod (gimage_get_ID (GIMP_DRAWABLE(channel)->gimage_ID), channel);
undo_push_channel_mod (GIMP_DRAWABLE(channel)->gimage, channel);
/* Configure the new channel */
GIMP_DRAWABLE(channel)->tiles = new_tiles;
......@@ -348,7 +348,7 @@ channel_resize (Channel *channel, int new_width, int new_height,
copy_region (&srcPR, &destPR);
/* Push the channel on the undo stack */
undo_push_channel_mod (gimage_get_ID (GIMP_DRAWABLE(channel)->gimage_ID), channel);
undo_push_channel_mod (GIMP_DRAWABLE(channel)->gimage, channel);
/* Configure the new channel */
GIMP_DRAWABLE(channel)->tiles = new_tiles;
......@@ -430,14 +430,10 @@ channel_preview (Channel *channel, int width, int height)
void
channel_invalidate_previews (int gimage_id)
channel_invalidate_previews (GimpImage* gimage)
{
GSList * tmp;
Channel * channel;
GImage * gimage;
if (! (gimage = gimage_get_ID (gimage_id)))
return;
tmp = gimage->channels;
......@@ -455,13 +451,13 @@ channel_invalidate_previews (int gimage_id)
Channel *
channel_new_mask (int gimage_ID, int width, int height)
channel_new_mask (GimpImage* gimage, int width, int height)
{
unsigned char black[3] = {0, 0, 0};
Channel *new_channel;
/* Create the new channel */
new_channel = channel_new (gimage_ID, width, height, "Selection Mask", 127, black);
new_channel = channel_new (gimage, width, height, "Selection Mask", 127, black);
/* Set the validate procedure */
tile_manager_set_validate_proc (GIMP_DRAWABLE(new_channel)->tiles, channel_validate);
......@@ -1100,7 +1096,7 @@ channel_push_undo (Channel *mask)
mask_undo->y = y1;
/* push the undo buffer onto the undo stack */
gimage = gimage_get_ID (GIMP_DRAWABLE(mask)->gimage_ID);
gimage = GIMP_DRAWABLE(mask)->gimage;
undo_push_mask (gimage, mask_undo);
gimage_mask_invalidate (gimage);
......@@ -1373,7 +1369,7 @@ channel_translate (Channel *mask, int off_x, int off_y)
/* copy the portion of the mask we will keep to a
* temporary buffer
*/
tmp_mask = channel_new_mask (GIMP_DRAWABLE(mask)->gimage_ID, width, height);
tmp_mask = channel_new_mask (GIMP_DRAWABLE(mask)->gimage, width, height);
pixel_region_init (&srcPR, GIMP_DRAWABLE(mask)->tiles, x1 - off_x, y1 - off_y, width, height, FALSE);
pixel_region_init (&destPR, GIMP_DRAWABLE(tmp_mask)->tiles, 0, 0, width, height, TRUE);
......
......@@ -23,6 +23,7 @@
#include "boundary.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "gimpimageF.h"
/* OPERATIONS */
......@@ -74,7 +75,7 @@ struct _mask_undo
/* function declarations */
Channel * channel_new (int, int, int, char *, int, unsigned char *);
Channel * channel_new (GimpImage*, int, int, char *, int, unsigned char *);
Channel * channel_copy (Channel *);
Channel * channel_ref (Channel *);
void channel_unref (Channel *);
......@@ -90,11 +91,11 @@ unsigned char * channel_data (Channel *);
int channel_toggle_visibility (Channel *);
TempBuf * channel_preview (Channel *, int, int);
void channel_invalidate_previews (int);
void channel_invalidate_previews (GimpImage*);
/* selection mask functions */
Channel * channel_new_mask (int, int, int);
Channel * channel_new_mask (GimpImage*, int, int);
int channel_boundary (Channel *, BoundSeg **, BoundSeg **,
int *, int *, int, int, int, int);
int channel_bounds (Channel *, int *, int *, int *, int *);
......
......@@ -84,7 +84,7 @@ channel_new_invoker (Argument *args)
}
if (success)
success = ((channel = channel_new (gimage_id, width, height, name, opacity, color)) != NULL);
success = ((channel = channel_new (gimage_get_ID(gimage_id), width, height, name, opacity, color)) != NULL);
return_args = procedural_db_return_args (&channel_new_proc, success);
......
......@@ -44,7 +44,7 @@ typedef struct
int wrap_around;
int transparent;
int background;
int gimage_id;
GimpImage* gimage;
} OffsetDialog;
......@@ -76,7 +76,7 @@ static Argument * channel_ops_offset_invoker (Argument *args);
void
channel_ops_offset (void *gimage_ptr)
channel_ops_offset (GimpImage* gimage)
{
OffsetDialog *off_d;
GtkWidget *button;
......@@ -89,16 +89,14 @@ channel_ops_offset (void *gimage_ptr)
GtkWidget *table;
GSList *group = NULL;
GimpDrawable *drawable;
GImage *gimage;
gimage = (GImage *) gimage_ptr;
drawable = gimage_active_drawable (gimage);
off_d = g_new (OffsetDialog, 1);
off_d->wrap_around = TRUE;
off_d->transparent = drawable_has_alpha (drawable);
off_d->background = !off_d->transparent;
off_d->gimage_id = gimage->ID;
off_d->gimage = gimage;
off_d->dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (off_d->dlg), "offset", "Gimp");
......@@ -458,7 +456,7 @@ offset_ok_callback (GtkWidget *widget,
int fill_type;
off_d = (OffsetDialog *) data;
if ((gimage = gimage_get_ID (off_d->gimage_id)) != NULL)
if ((gimage = off_d->gimage) != NULL)
{
drawable = gimage_active_drawable (gimage);
......@@ -538,7 +536,7 @@ offset_halfheight_update (GtkWidget *widget,
gchar buffer[16];
off_d = (OffsetDialog *) data;
gimage = gimage_get_ID (off_d->gimage_id);
gimage = off_d->gimage;
sprintf (buffer, "%d", gimage->width / 2);
gtk_entry_set_text (GTK_ENTRY (off_d->off_x_entry), buffer);
......
......@@ -19,9 +19,10 @@
#define __CHANNEL_OPS_H__
#include "procedural_db.h"
#include "gimpimageF.h"
/* channel_ops functions */
void channel_ops_offset (void *);
void channel_ops_offset (GimpImage*);
/* Procedure definition and marshalling function */
extern ProcRecord channel_ops_offset_proc;
......
......@@ -102,7 +102,7 @@ struct _ChannelsDialog {
int gimage_width, gimage_height;
/* state information */
int gimage_id;
GimpImage* gimage;
Channel * active_channel;
Layer *floating_sel;
GSList *channel_widgets;
......@@ -142,7 +142,7 @@ static void channel_widget_exclusive_visible (ChannelWidget *);
static void channel_widget_channel_flush (GtkWidget *, gpointer);
/* assorted query dialogs */
static void channels_dialog_new_channel_query (int);
static void channels_dialog_new_channel_query (GimpImage*);
static void channels_dialog_edit_channel_query (ChannelWidget *);
......@@ -200,7 +200,7 @@ channels_dialog_create ()
{
channelsD = g_malloc (sizeof (ChannelsDialog));
channelsD->preview = NULL;
channelsD->gimage_id = -1;
channelsD->gimage = NULL;
channelsD->active_channel = NULL;
channelsD->floating_sel = NULL;
channelsD->channel_widgets = NULL;
......@@ -273,7 +273,7 @@ channels_dialog_flush ()
if (!channelsD)
return;
if (! (gimage = gimage_get_ID (channelsD->gimage_id)))
if (! (gimage = channelsD->gimage))
return;
/* Check if the gimage extents have changed */
......@@ -281,8 +281,8 @@ channels_dialog_flush ()
(gimage->height != channelsD->gimage_height) ||
(gimage_base_type (gimage) != channelsD->base_type))
{
channelsD->gimage_id = -1;
channels_dialog_update (gimage->ID);
channelsD->gimage = NULL;
channels_dialog_update (gimage);
}
/* Set all current channel widgets to visited = FALSE */
......@@ -357,21 +357,20 @@ channels_dialog_flush ()
/*************************************/
void
channels_dialog_update (int gimage_id)
channels_dialog_update (GimpImage* gimage)
{
ChannelWidget *cw;
GImage *gimage;
Channel *channel;
GSList *list;
GList *item_list;
if (!channelsD)
return;
if (channelsD->gimage_id == gimage_id)
if (channelsD->gimage == gimage)
return;
channelsD->gimage_id = gimage_id;
channelsD->gimage=gimage;
suspend_gimage_notify++;
/* Free all elements in the channels listbox */
gtk_list_clear_items (GTK_LIST (channelsD->channel_list), 0, -1);
......@@ -386,9 +385,6 @@ channels_dialog_update (int gimage_id)
}
channelsD->channel_widgets = NULL;
if (! (gimage = gimage_get_ID (channelsD->gimage_id)))
return;
/* Find the preview extents */
channels_dialog_preview_extents ();
......@@ -506,10 +502,9 @@ channels_dialog_preview_extents ()
{
GImage *gimage;
if (! channelsD)
return;
gimage = gimage_get_ID (channelsD->gimage_id);
g_return_if_fail(channelsD);
g_return_if_fail(gimage = channelsD->gimage);
channelsD->gimage_width = gimage->width;
channelsD->gimage_height = gimage->height;
......@@ -713,7 +708,7 @@ channels_dialog_add_channel (Channel *channel)
if (!channelsD || !channel)
return;
if (! (gimage = gimage_get_ID (channelsD->gimage_id)))
if (! (gimage = channelsD->gimage))
return;
item_list = NULL;
......@@ -853,10 +848,10 @@ channels_dialog_new_channel_callback (GtkWidget *w,
*/
if (!channelsD)
return;
if (channelsD->gimage_id == -1)
if (channelsD->gimage == NULL)
return;
channels_dialog_new_channel_query (channelsD->gimage_id);
channels_dialog_new_channel_query (channelsD->gimage);
}
......@@ -868,7 +863,7 @@ channels_dialog_raise_channel_callback (GtkWidget *w,
if (!channelsD)
return;
if (! (gimage = gimage_get_ID (channelsD->gimage_id)))
if (! (gimage = channelsD->gimage))
return;
if (gimage->active_channel != NULL)
......@@ -887,7 +882,7 @@ channels_dialog_lower_channel_callback (GtkWidget *w,
if (!channelsD)
return;
if (! (gimage = gimage_get_ID (channelsD->gimage_id)))
if (! (gimage = channelsD->gimage))
return;
if (gimage->active_channel != NULL)
......@@ -910,7 +905,7 @@ channels_dialog_duplicate_channel_callback (GtkWidget *w,
*/
if (!channelsD)
return;
if (! (gimage = gimage_get_ID (channelsD->gimage_id)))
if (! (gimage = channelsD->gimage))
return;
if ((active_channel = gimage_get_active_channel (gimage)))
......@@ -932,7 +927,7 @@ channels_dialog_delete_channel_callback (GtkWidget *w,
*/
if (!channelsD)
return;
if (! (gimage = gimage_get_ID (channelsD->gimage_id)))
if (! (gimage = channelsD->gimage))
return;
if (gimage->active_channel != NULL)
......@@ -953,7 +948,7 @@ channels_dialog_channel_to_sel_callback (GtkWidget *w,
*/
if (!channelsD)
return;
if (! (gimage = gimage_get_ID (channelsD->gimage_id)))
if (! (gimage = channelsD->gimage))
return;
if (gimage->active_channel != NULL)
......@@ -1222,12 +1217,12 @@ channel_widget_button_events (GtkWidget *widget,
{
if (exclusive)
{
gdisplays_update_area (channel_widget->gimage->ID, 0, 0, width, height);
gdisplays_update_area (channel_widget->gimage, 0, 0, width, height);
gdisplays_flush ();
}
else if (old_state != visible)
{
gdisplays_update_area (channel_widget->gimage->ID, 0, 0, width, height);
gdisplays_update_area (channel_widget->gimage, 0, 0, width, height);
gdisplays_flush ();
}
}
......@@ -1701,7 +1696,7 @@ struct _NewChannelOptions {
GtkWidget *name_entry;
ColorPanel *color_panel;
int gimage_id;
GimpImage* gimage;
double opacity;
};
......@@ -1722,9 +1717,9 @@ new_channel_query_ok_callback (GtkWidget *w,
g_free (channel_name);
channel_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
if ((gimage = gimage_get_ID (options->gimage_id)))
if ((gimage = options->gimage))
{
new_channel = channel_new (gimage->ID, gimage->width, gimage->height,
new_channel = channel_new (gimage, gimage->width, gimage->height,
channel_name, (int) (255 * options->opacity) / 100,
options->color_panel->color);
drawable_fill (GIMP_DRAWABLE(new_channel), TRANSPARENT_FILL);
......@@ -1771,14 +1766,13 @@ new_channel_query_scale_update (GtkAdjustment *adjustment,
}
static void
channels_dialog_new_channel_query (int gimage_id)
channels_dialog_new_channel_query (GimpImage* gimage)
{
static ActionAreaItem action_items[2] =
{
{ "OK", new_channel_query_ok_callback, NULL, NULL },
{ "Cancel", new_channel_query_cancel_callback, NULL, NULL }
};
GImage *gimage;
NewChannelOptions *options;
GtkWidget *vbox;
GtkWidget *table;
......@@ -1786,11 +1780,9 @@ channels_dialog_new_channel_query (int gimage_id)
GtkWidget *opacity_scale;
GtkObject *opacity_scale_data;
gimage = gimage_get_ID (gimage_id);
/* the new options structure */
options = (NewChannelOptions *) g_malloc (sizeof (NewChannelOptions));
options->gimage_id = gimage_id;
options->gimage = gimage;
options->opacity = 50.0;
options->color_panel = color_panel_new (channel_color, 48, 64);
......@@ -1872,7 +1864,7 @@ struct _EditChannelOptions {
GtkWidget *name_entry;
ChannelWidget *channel_widget;
int gimage_id;
GimpImage* gimage;
ColorPanel *color_panel;
double opacity;
};
......@@ -1892,7 +1884,7 @@ edit_channel_query_ok_callback (GtkWidget *w,
opacity = (int) (255 * options->opacity) / 100;
if (gimage_get_ID (options->gimage_id)) {
if (options->gimage) {
/* Set the new channel name */
if (GIMP_DRAWABLE(channel)->name)
......@@ -1966,7 +1958,7 @@ channels_dialog_edit_channel_query (ChannelWidget *channel_widget)
/* the new options structure */
options = (EditChannelOptions *) g_malloc (sizeof (EditChannelOptions));
options->channel_widget = channel_widget;
options->gimage_id = channel_widget->gimage->ID;
options->gimage = channel_widget->gimage;
options->opacity = (double) channel_widget->channel->opacity / 2.55;
for (i = 0; i < 3; i++)
channel_color[i] = channel_widget->channel->col[i];
......
......@@ -983,9 +983,9 @@ dialogs_lc_cmd_callback (GtkWidget *widget,
gdisp = gdisplay_active ();
if (gdisp == NULL)
lc_dialog_create (-1);
lc_dialog_create (NULL);
else
lc_dialog_create (gdisp->gimage->ID);
lc_dialog_create (gdisp->gimage);
}
void
......@@ -996,7 +996,7 @@ dialogs_indexed_palette_cmd_callback (GtkWidget *widget,
gdisp = gdisplay_active ();
indexed_palette_create (gdisp->gimage->ID);
indexed_palette_create (gdisp->gimage);
}
void
......
......@@ -196,9 +196,7 @@ typedef struct
typedef struct
{
GtkWidget * shell;
void * gimage_ptr;
int gimage_ID;
GimpImage* gimage;
int dither;
int num_cols;
int palette;
......@@ -241,21 +239,15 @@ static void palette_entries_callback(GtkWidget *w, gpointer client_data);
static PaletteEntriesP theCustomPalette = NULL;
void
convert_to_rgb (void *gimage_ptr)
convert_to_rgb (GimpImage *gimage)
{
GImage *gimage;
gimage = (GImage *) gimage_ptr;
convert_image (gimage, RGB, 0, 0, 0);
gdisplays_flush ();
}
void
convert_to_grayscale (void *gimage_ptr)
convert_to_grayscale (GimpImage* gimage)
{
GImage *gimage;