Indentation paranoia!

--Sven
This commit is contained in:
Sven Neumann 1999-07-19 19:46:05 +00:00
parent 2518748a66
commit 645f85352d
21 changed files with 894 additions and 852 deletions

View File

@ -1,3 +1,15 @@
Mon Jul 19 21:40:48 MEST 1999 Sven Neumann <sven@gimp.org>
* app/brush_select.c: update the brush title when editing a brush
* app/gimage.[ch]
* app/gimpimage.c
* app/ops_buttons.[ch]
* app/pixel_regions.c
* app/temp_buf.c
* app/undo.c: Indentation paranoia! (I was browsing the code a lot
this weekend and just couldn't resist...)
1999-07-19 Michael Natterer <mitschel@cs.tu-berlin.de> 1999-07-19 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/gdisplay.c (gdisplay_set_menu_sensitivity): moved the _() * app/gdisplay.c (gdisplay_set_menu_sensitivity): moved the _()

View File

@ -68,12 +68,13 @@ static void pixel_region_configure (PixelRegionHolder *, PixelRegionIterator
/* Function definitions */ /* Function definitions */
void void
pixel_region_init (PR, tiles, x, y, w, h, dirty) pixel_region_init (PixelRegion *PR,
PixelRegion *PR; TileManager *tiles,
TileManager *tiles; int x,
int x, y; int y,
int w, h; int w,
int dirty; int h,
int dirty)
{ {
PR->tiles = tiles; PR->tiles = tiles;
PR->curtile = NULL; PR->curtile = NULL;
@ -89,10 +90,11 @@ pixel_region_init (PR, tiles, x, y, w, h, dirty)
void void
pixel_region_resize (PR, x, y, w, h) pixel_region_resize (PixelRegion *PR,
PixelRegion *PR; int x,
int x, y; int y,
int w, h; int w,
int h)
{ {
/* If the data is non-null, data is contiguous--need to advance */ /* If the data is non-null, data is contiguous--need to advance */
if (PR->data != NULL) if (PR->data != NULL)
@ -107,15 +109,14 @@ pixel_region_resize (PR, x, y, w, h)
PR->h = h; PR->h = h;
} }
/* request that tiles within a region be fetched asynchronously
*/ /* request that tiles within a region be fetched asynchronously */
void void
pixel_region_get_async (PR, ulx, uly, lrx, lry) pixel_region_get_async (PixelRegion *PR,
PixelRegion *PR; int ulx,
int ulx; int uly,
int uly; int lrx,
int lrx; int lry)
int lry;
{ {
int x, y; int x, y;
@ -124,13 +125,14 @@ pixel_region_get_async (PR, ulx, uly, lrx, lry)
tile_manager_get_async (PR->tiles, x, y); tile_manager_get_async (PR->tiles, x, y);
} }
void void
pixel_region_get_row (PR, x, y, w, data, subsample) pixel_region_get_row (PixelRegion *PR,
PixelRegion *PR; int x,
int x, y; int y,
int w; int w,
unsigned char *data; unsigned char *data,
int subsample; int subsample)
{ {
Tile *tile; Tile *tile;
unsigned char *tile_data; unsigned char *tile_data;
@ -176,11 +178,11 @@ pixel_region_get_row (PR, x, y, w, data, subsample)
void void
pixel_region_set_row (PR, x, y, w, data) pixel_region_set_row (PixelRegion *PR,
PixelRegion *PR; int x,
int x, y; int y,
int w; int w,
unsigned char *data; unsigned char *data)
{ {
Tile *tile; Tile *tile;
unsigned char *tile_data; unsigned char *tile_data;
@ -212,12 +214,12 @@ pixel_region_set_row (PR, x, y, w, data)
void void
pixel_region_get_col (PR, x, y, h, data, subsample) pixel_region_get_col (PixelRegion *PR,
PixelRegion *PR; int x,
int x, y; int y,
int h; int h,
unsigned char *data; unsigned char *data,
int subsample; int subsample)
{ {
Tile *tile; Tile *tile;
unsigned char *tile_data; unsigned char *tile_data;
@ -253,11 +255,11 @@ pixel_region_get_col (PR, x, y, h, data, subsample)
void void
pixel_region_set_col (PR, x, y, h, data) pixel_region_set_col (PixelRegion *PR,
PixelRegion *PR; int x,
int x, y; int y,
int h; int h,
unsigned char *data; unsigned char *data)
{ {
Tile *tile; Tile *tile;
unsigned char *tile_data; unsigned char *tile_data;
@ -292,7 +294,8 @@ pixel_region_set_col (PR, x, y, h, data)
} }
void * void *
pixel_regions_register (int num_regions, ...) pixel_regions_register (int num_regions,
...)
{ {
PixelRegion *PR; PixelRegion *PR;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
@ -345,8 +348,7 @@ pixel_regions_register (int num_regions, ...)
void * void *
pixel_regions_process (PRI_ptr) pixel_regions_process (void *PRI_ptr)
void *PRI_ptr;
{ {
GSList *list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
@ -392,8 +394,7 @@ pixel_regions_process (PRI_ptr)
} }
void void
pixel_regions_process_stop (PRI_ptr) pixel_regions_process_stop (void *PRI_ptr)
void *PRI_ptr;
{ {
GSList *list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
@ -445,8 +446,7 @@ pixel_regions_process_stop (PRI_ptr)
/* Static Function Definitions */ /* Static Function Definitions */
static int static int
get_portion_height (PRI) get_portion_height (PixelRegionIterator *PRI)
PixelRegionIterator *PRI;
{ {
GSList *list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
@ -488,8 +488,7 @@ get_portion_height (PRI)
static int static int
get_portion_width (PRI) get_portion_width (PixelRegionIterator *PRI)
PixelRegionIterator *PRI;
{ {
GSList *list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
@ -531,8 +530,7 @@ get_portion_width (PRI)
static void * static void *
pixel_regions_configure (PRI) pixel_regions_configure (PixelRegionIterator *PRI)
PixelRegionIterator *PRI;
{ {
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
GSList *list; GSList *list;
@ -580,9 +578,8 @@ pixel_regions_configure (PRI)
static void static void
pixel_region_configure (PRH, PRI) pixel_region_configure (PixelRegionHolder *PRH,
PixelRegionHolder *PRH; PixelRegionIterator *PRI)
PixelRegionIterator *PRI;
{ {
/* Configure the rowstride and data pointer for the pixel region /* Configure the rowstride and data pointer for the pixel region
* based on the current offsets into the region and whether the * based on the current offsets into the region and whether the
@ -590,7 +587,8 @@ pixel_region_configure (PRH, PRI)
*/ */
if (PRH->PR->tiles) if (PRH->PR->tiles)
{ {
PRH->PR->curtile = tile_manager_get_tile (PRH->PR->tiles, PRH->PR->x, PRH->PR->y, TRUE, PRH->PR->dirty); PRH->PR->curtile =
tile_manager_get_tile (PRH->PR->tiles, PRH->PR->x, PRH->PR->y, TRUE, PRH->PR->dirty);
PRH->PR->offx = PRH->PR->x % TILE_WIDTH; PRH->PR->offx = PRH->PR->x % TILE_WIDTH;
PRH->PR->offy = PRH->PR->y % TILE_HEIGHT; PRH->PR->offy = PRH->PR->y % TILE_HEIGHT;

View File

@ -47,16 +47,15 @@
static unsigned char * temp_buf_allocate (unsigned int); static unsigned char * temp_buf_allocate (unsigned int);
static void temp_buf_to_color (TempBuf *, TempBuf *); static void temp_buf_to_color (TempBuf *, TempBuf *);
static void temp_buf_to_gray (TempBuf *, TempBuf *); static void temp_buf_to_gray (TempBuf *, TempBuf *);
/* Memory management */ /* Memory management */
static unsigned char * static unsigned char *
temp_buf_allocate (size) temp_buf_allocate (unsigned int size)
unsigned int size;
{ {
unsigned char * data; unsigned char *data;
data = (unsigned char *) g_malloc (size); data = (unsigned char *) g_malloc (size);
@ -67,9 +66,8 @@ temp_buf_allocate (size)
/* The conversion routines */ /* The conversion routines */
static void static void
temp_buf_to_color (src_buf, dest_buf) temp_buf_to_color (TempBuf *src_buf,
TempBuf * src_buf; TempBuf *dest_buf)
TempBuf * dest_buf;
{ {
unsigned char *src; unsigned char *src;
unsigned char *dest; unsigned char *dest;
@ -92,13 +90,12 @@ temp_buf_to_color (src_buf, dest_buf)
static void static void
temp_buf_to_gray (src_buf, dest_buf) temp_buf_to_gray (TempBuf *src_buf,
TempBuf * src_buf; TempBuf *dest_buf)
TempBuf * dest_buf;
{ {
unsigned char *src; unsigned char *src;
unsigned char *dest; unsigned char *dest;
long num_bytes; long num_bytes;
float pix; float pix;
src = temp_buf_data (src_buf); src = temp_buf_data (src_buf);
@ -121,15 +118,15 @@ temp_buf_to_gray (src_buf, dest_buf)
TempBuf * TempBuf *
temp_buf_new (width, height, bytes, x, y, col) temp_buf_new (int width,
int width; int height,
int height; int bytes,
int bytes; int x,
int x, y; int y,
unsigned char * col; unsigned char *col)
{ {
long i; long i;
int j; int j;
unsigned char * data; unsigned char * data;
TempBuf * temp; TempBuf * temp;
@ -190,9 +187,8 @@ temp_buf_new (width, height, bytes, x, y, col)
TempBuf * TempBuf *
temp_buf_copy (src, dest) temp_buf_copy (TempBuf *src,
TempBuf * src; TempBuf *dest)
TempBuf * dest;
{ {
TempBuf * new; TempBuf * new;
long length; long length;
@ -233,11 +229,12 @@ temp_buf_copy (src, dest)
TempBuf * TempBuf *
temp_buf_resize (buf, bytes, x, y, w, h) temp_buf_resize (TempBuf *buf,
TempBuf * buf; int bytes,
int bytes; int x,
int x, y; int y,
int w, h; int w,
int h)
{ {
int size; int size;
@ -271,12 +268,13 @@ temp_buf_resize (buf, bytes, x, y, w, h)
TempBuf * TempBuf *
temp_buf_copy_area (src, dest, x, y, w, h, border) temp_buf_copy_area (TempBuf *src,
TempBuf * src; TempBuf *dest,
TempBuf * dest; int x,
int x, y; int y,
int w, h; int w,
int border; int h,
int border)
{ {
TempBuf * new; TempBuf * new;
PixelRegion srcR, destR; PixelRegion srcR, destR;
@ -333,8 +331,7 @@ temp_buf_copy_area (src, dest, x, y, w, h, border)
void void
temp_buf_free (temp_buf) temp_buf_free (TempBuf *temp_buf)
TempBuf * temp_buf;
{ {
if (temp_buf->data) if (temp_buf->data)
g_free (temp_buf->data); g_free (temp_buf->data);
@ -347,8 +344,7 @@ temp_buf_free (temp_buf)
unsigned char * unsigned char *
temp_buf_data (temp_buf) temp_buf_data (TempBuf *temp_buf)
TempBuf * temp_buf;
{ {
if (temp_buf->swapped) if (temp_buf->swapped)
temp_buf_unswap (temp_buf); temp_buf_unswap (temp_buf);
@ -363,9 +359,8 @@ temp_buf_data (temp_buf)
MaskBuf * MaskBuf *
mask_buf_new (width, height) mask_buf_new (int width,
int width; int height)
int height;
{ {
static unsigned char empty = 0; static unsigned char empty = 0;
@ -374,16 +369,14 @@ mask_buf_new (width, height)
void void
mask_buf_free (mask) mask_buf_free (MaskBuf *mask)
MaskBuf * mask;
{ {
temp_buf_free ((TempBuf *) mask); temp_buf_free ((TempBuf *) mask);
} }
unsigned char * unsigned char *
mask_buf_data (mask_buf) mask_buf_data (MaskBuf *mask_buf)
MaskBuf * mask_buf;
{ {
if (mask_buf->swapped) if (mask_buf->swapped)
temp_buf_unswap (mask_buf); temp_buf_unswap (mask_buf);
@ -411,13 +404,14 @@ mask_buf_data (mask_buf)
* from disk. In the former case, cached_in_memory is set to NULL; * from disk. In the former case, cached_in_memory is set to NULL;
* in the latter case, cached_in_memory is left unchanged. * in the latter case, cached_in_memory is left unchanged.
* If temp_buf_swap_free is called, cached_in_memory must be checked * If temp_buf_swap_free is called, cached_in_memory must be checked
* against the temp buf being freed. If they are the same, then cached_in_memory * against the temp buf being freed. If they are the same, then
* must be set to NULL; * cached_in_memory must be set to NULL;
* *
* In the case where memory usage is set to "stingy": * In the case where memory usage is set to "stingy":
* temp bufs are not cached in memory at all, they go right to disk. * temp bufs are not cached in memory at all, they go right to disk.
*/ */
/* a static counter for generating unique filenames */ /* a static counter for generating unique filenames */
static int swap_index = 0; static int swap_index = 0;
@ -436,8 +430,7 @@ generate_unique_filename (void)
void void
temp_buf_swap (buf) temp_buf_swap (TempBuf *buf)
TempBuf * buf;
{ {
TempBuf * swap; TempBuf * swap;
char * filename; char * filename;
@ -511,8 +504,7 @@ temp_buf_swap (buf)
void void
temp_buf_unswap (buf) temp_buf_unswap (TempBuf *buf)
TempBuf * buf;
{ {
struct stat stat_buf; struct stat stat_buf;
FILE * fp; FILE * fp;
@ -563,8 +555,7 @@ temp_buf_unswap (buf)
void void
temp_buf_swap_free (buf) temp_buf_swap_free (TempBuf *buf)
TempBuf * buf;
{ {
struct stat stat_buf; struct stat stat_buf;

View File

@ -613,6 +613,7 @@ brush_select_brush_changed (BrushSelectP bsp,
{ {
display_brushes (bsp); display_brushes (bsp);
gtk_widget_draw (bsp->preview, NULL); gtk_widget_draw (bsp->preview, NULL);
update_active_brush_field (bsp);
} }
} }

View File

@ -142,7 +142,8 @@ gimp_image_class_init (GimpImageClass *klass)
/* static functions */ /* static functions */
static void gimp_image_init (GimpImage *gimage) static void
gimp_image_init (GimpImage *gimage)
{ {
gimage->has_filename = 0; gimage->has_filename = 0;
gimage->num_cols = 0; gimage->num_cols = 0;
@ -176,15 +177,18 @@ static void gimp_image_init (GimpImage *gimage)
gimage->paths = NULL; gimage->paths = NULL;
} }
GtkType gimp_image_get_type(void){ GtkType
static GtkType type; gimp_image_get_type (void)
GIMP_TYPE_INIT(type, {
GimpImage, static GtkType type;
GimpImageClass,
gimp_image_init, GIMP_TYPE_INIT(type,
gimp_image_class_init, GimpImage,
GIMP_TYPE_OBJECT); GimpImageClass,
return type; gimp_image_init,
gimp_image_class_init,
GIMP_TYPE_OBJECT);
return type;
} }
@ -231,7 +235,10 @@ gimp_image_free_projection (GimpImage *gimage)
} }
static void static void
gimp_image_allocate_shadow (GimpImage *gimage, int width, int height, int bpp) gimp_image_allocate_shadow (GimpImage *gimage,
int width,
int height,
int bpp)
{ {
/* allocate the new projection */ /* allocate the new projection */
gimage->shadow = tile_manager_new (width, height, bpp); gimage->shadow = tile_manager_new (width, height, bpp);
@ -342,7 +349,7 @@ gimp_image_get_resolution (GimpImage *gimage,
void void
gimp_image_set_unit (GimpImage *gimage, gimp_image_set_unit (GimpImage *gimage,
GUnit unit) GUnit unit)
{ {
gimage->unit = unit; gimage->unit = unit;
} }
@ -355,7 +362,8 @@ gimp_image_get_unit (GimpImage *gimage)
void void
gimp_image_set_save_proc (GimpImage *gimage, PlugInProcDef *proc) gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{ {
gimage->save_proc = proc; gimage->save_proc = proc;
} }
@ -414,10 +422,9 @@ gimp_image_resize (GimpImage *gimage,
while (guide_list) while (guide_list)
{ {
Guide *guide; Guide *guide;
GList *next;
guide = (Guide*) guide_list->data; guide = (Guide*) guide_list->data;
next = g_list_next (guide_list); guide_list = g_list_next (guide_list);
switch (guide->orientation) switch (guide->orientation)
{ {
@ -434,7 +441,6 @@ gimp_image_resize (GimpImage *gimage,
default: default:
g_error("Unknown guide orientation I.\n"); g_error("Unknown guide orientation I.\n");
} }
guide_list = next;
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
@ -469,11 +475,11 @@ gimp_image_scale (GimpImage *gimage,
int new_height) int new_height)
{ {
Channel *channel; Channel *channel;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
GSList *list; GSList *list;
GList *glist; GList *glist;
Guide *guide; Guide *guide;
int old_width, old_height; int old_width, old_height;
int layer_width, layer_height; int layer_width, layer_height;
@ -590,21 +596,22 @@ gimp_image_free_shadow (GimpImage *gimage)
static void static void
gimp_image_destroy (GtkObject *object) gimp_image_destroy (GtkObject *object)
{ {
GimpImage* gimage=GIMP_IMAGE(object); GimpImage* gimage = GIMP_IMAGE(object);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage); gimp_image_free_projection (gimage);
gimp_image_free_channels (gimage); gimp_image_free_shadow (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites) if (gimage->cmap)
gtk_object_unref(GTK_OBJECT(gimage->parasites)); g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
gtk_object_unref(GTK_OBJECT(gimage->parasites));
} }
void void
@ -619,7 +626,7 @@ gimp_image_apply_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR, maskPR; PixelRegion src1PR, destPR, maskPR;
@ -715,7 +722,7 @@ gimp_image_replace_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR; PixelRegion src1PR, destPR;
@ -971,8 +978,6 @@ gimp_image_transform_color (GimpImage *gimage,
Guide* Guide*
gimp_image_add_hguide (GimpImage *gimage) gimp_image_add_hguide (GimpImage *gimage)
{ {
@ -1061,7 +1066,7 @@ gimp_image_attach_parasite (GimpImage *gimage,
Parasite *parasite) Parasite *parasite)
{ {
/* only set the dirty bit manually if we can be saved and the new /* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */ parasite differs from the current one and we aren't undoable */
if (parasite_is_undoable(parasite)) if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite); undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite) if (parasite_is_persistent(parasite)
@ -1081,6 +1086,7 @@ gimp_image_detach_parasite (GimpImage *gimage,
const char *parasite) const char *parasite)
{ {
Parasite *p; Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite))) if (!(p = parasite_list_find(gimage->parasites, parasite)))
return; return;
if (parasite_is_undoable(p)) if (parasite_is_undoable(p))
@ -1223,7 +1229,7 @@ static void
gimp_image_free_layers (GimpImage *gimage) gimp_image_free_layers (GimpImage *gimage)
{ {
GSList *list = gimage->layers; GSList *list = gimage->layers;
Layer * layer; Layer *layer;
while (list) while (list)
{ {
@ -1239,8 +1245,8 @@ gimp_image_free_layers (GimpImage *gimage)
static void static void
gimp_image_free_channels (GimpImage *gimage) gimp_image_free_channels (GimpImage *gimage)
{ {
GSList *list = gimage->channels; GSList *list = gimage->channels;
Channel * channel; Channel *channel;
while (list) while (list)
{ {
@ -1602,8 +1608,8 @@ gimp_image_construct (GimpImage *gimage,
} }
void void
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y, gimp_image_invalidate_without_render (GimpImage *gimage,
int w, int h, int x, int y, int w, int h,
int x1, int y1, int x2, int y2) int x1, int y1, int x2, int y2)
{ {
Tile *tile; Tile *tile;
@ -1634,14 +1640,8 @@ gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
void void
gimp_image_invalidate (GimpImage *gimage, gimp_image_invalidate (GimpImage *gimage,
int x, int x, int y, int w, int h,
int y, int x1, int y1, int x2, int y2)
int w,
int h,
int x1,
int y1,
int x2,
int y2)
{ {
Tile *tile; Tile *tile;
TileManager *tm; TileManager *tm;

View File

@ -142,7 +142,8 @@ gimp_image_class_init (GimpImageClass *klass)
/* static functions */ /* static functions */
static void gimp_image_init (GimpImage *gimage) static void
gimp_image_init (GimpImage *gimage)
{ {
gimage->has_filename = 0; gimage->has_filename = 0;
gimage->num_cols = 0; gimage->num_cols = 0;
@ -176,15 +177,18 @@ static void gimp_image_init (GimpImage *gimage)
gimage->paths = NULL; gimage->paths = NULL;
} }
GtkType gimp_image_get_type(void){ GtkType
static GtkType type; gimp_image_get_type (void)
GIMP_TYPE_INIT(type, {
GimpImage, static GtkType type;
GimpImageClass,
gimp_image_init, GIMP_TYPE_INIT(type,
gimp_image_class_init, GimpImage,
GIMP_TYPE_OBJECT); GimpImageClass,
return type; gimp_image_init,
gimp_image_class_init,
GIMP_TYPE_OBJECT);
return type;
} }
@ -231,7 +235,10 @@ gimp_image_free_projection (GimpImage *gimage)
} }
static void static void
gimp_image_allocate_shadow (GimpImage *gimage, int width, int height, int bpp) gimp_image_allocate_shadow (GimpImage *gimage,
int width,
int height,
int bpp)
{ {
/* allocate the new projection */ /* allocate the new projection */
gimage->shadow = tile_manager_new (width, height, bpp); gimage->shadow = tile_manager_new (width, height, bpp);
@ -342,7 +349,7 @@ gimp_image_get_resolution (GimpImage *gimage,
void void
gimp_image_set_unit (GimpImage *gimage, gimp_image_set_unit (GimpImage *gimage,
GUnit unit) GUnit unit)
{ {
gimage->unit = unit; gimage->unit = unit;
} }
@ -355,7 +362,8 @@ gimp_image_get_unit (GimpImage *gimage)
void void
gimp_image_set_save_proc (GimpImage *gimage, PlugInProcDef *proc) gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{ {
gimage->save_proc = proc; gimage->save_proc = proc;
} }
@ -414,10 +422,9 @@ gimp_image_resize (GimpImage *gimage,
while (guide_list) while (guide_list)
{ {
Guide *guide; Guide *guide;
GList *next;
guide = (Guide*) guide_list->data; guide = (Guide*) guide_list->data;
next = g_list_next (guide_list); guide_list = g_list_next (guide_list);
switch (guide->orientation) switch (guide->orientation)
{ {
@ -434,7 +441,6 @@ gimp_image_resize (GimpImage *gimage,
default: default:
g_error("Unknown guide orientation I.\n"); g_error("Unknown guide orientation I.\n");
} }
guide_list = next;
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
@ -469,11 +475,11 @@ gimp_image_scale (GimpImage *gimage,
int new_height) int new_height)
{ {
Channel *channel; Channel *channel;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
GSList *list; GSList *list;
GList *glist; GList *glist;
Guide *guide; Guide *guide;
int old_width, old_height; int old_width, old_height;
int layer_width, layer_height; int layer_width, layer_height;
@ -590,21 +596,22 @@ gimp_image_free_shadow (GimpImage *gimage)
static void static void
gimp_image_destroy (GtkObject *object) gimp_image_destroy (GtkObject *object)
{ {
GimpImage* gimage=GIMP_IMAGE(object); GimpImage* gimage = GIMP_IMAGE(object);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage); gimp_image_free_projection (gimage);
gimp_image_free_channels (gimage); gimp_image_free_shadow (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites) if (gimage->cmap)
gtk_object_unref(GTK_OBJECT(gimage->parasites)); g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
gtk_object_unref(GTK_OBJECT(gimage->parasites));
} }
void void
@ -619,7 +626,7 @@ gimp_image_apply_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR, maskPR; PixelRegion src1PR, destPR, maskPR;
@ -715,7 +722,7 @@ gimp_image_replace_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR; PixelRegion src1PR, destPR;
@ -971,8 +978,6 @@ gimp_image_transform_color (GimpImage *gimage,
Guide* Guide*
gimp_image_add_hguide (GimpImage *gimage) gimp_image_add_hguide (GimpImage *gimage)
{ {
@ -1061,7 +1066,7 @@ gimp_image_attach_parasite (GimpImage *gimage,
Parasite *parasite) Parasite *parasite)
{ {
/* only set the dirty bit manually if we can be saved and the new /* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */ parasite differs from the current one and we aren't undoable */
if (parasite_is_undoable(parasite)) if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite); undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite) if (parasite_is_persistent(parasite)
@ -1081,6 +1086,7 @@ gimp_image_detach_parasite (GimpImage *gimage,
const char *parasite) const char *parasite)
{ {
Parasite *p; Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite))) if (!(p = parasite_list_find(gimage->parasites, parasite)))
return; return;
if (parasite_is_undoable(p)) if (parasite_is_undoable(p))
@ -1223,7 +1229,7 @@ static void
gimp_image_free_layers (GimpImage *gimage) gimp_image_free_layers (GimpImage *gimage)
{ {
GSList *list = gimage->layers; GSList *list = gimage->layers;
Layer * layer; Layer *layer;
while (list) while (list)
{ {
@ -1239,8 +1245,8 @@ gimp_image_free_layers (GimpImage *gimage)
static void static void
gimp_image_free_channels (GimpImage *gimage) gimp_image_free_channels (GimpImage *gimage)
{ {
GSList *list = gimage->channels; GSList *list = gimage->channels;
Channel * channel; Channel *channel;
while (list) while (list)
{ {
@ -1602,8 +1608,8 @@ gimp_image_construct (GimpImage *gimage,
} }
void void
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y, gimp_image_invalidate_without_render (GimpImage *gimage,
int w, int h, int x, int y, int w, int h,
int x1, int y1, int x2, int y2) int x1, int y1, int x2, int y2)
{ {
Tile *tile; Tile *tile;
@ -1634,14 +1640,8 @@ gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
void void
gimp_image_invalidate (GimpImage *gimage, gimp_image_invalidate (GimpImage *gimage,
int x, int x, int y, int w, int h,
int y, int x1, int y1, int x2, int y2)
int w,
int h,
int x1,
int y1,
int x2,
int y2)
{ {
Tile *tile; Tile *tile;
TileManager *tm; TileManager *tm;

View File

@ -142,7 +142,8 @@ gimp_image_class_init (GimpImageClass *klass)
/* static functions */ /* static functions */
static void gimp_image_init (GimpImage *gimage) static void
gimp_image_init (GimpImage *gimage)
{ {
gimage->has_filename = 0; gimage->has_filename = 0;
gimage->num_cols = 0; gimage->num_cols = 0;
@ -176,15 +177,18 @@ static void gimp_image_init (GimpImage *gimage)
gimage->paths = NULL; gimage->paths = NULL;
} }
GtkType gimp_image_get_type(void){ GtkType
static GtkType type; gimp_image_get_type (void)
GIMP_TYPE_INIT(type, {
GimpImage, static GtkType type;
GimpImageClass,
gimp_image_init, GIMP_TYPE_INIT(type,
gimp_image_class_init, GimpImage,
GIMP_TYPE_OBJECT); GimpImageClass,
return type; gimp_image_init,
gimp_image_class_init,
GIMP_TYPE_OBJECT);
return type;
} }
@ -231,7 +235,10 @@ gimp_image_free_projection (GimpImage *gimage)
} }
static void static void
gimp_image_allocate_shadow (GimpImage *gimage, int width, int height, int bpp) gimp_image_allocate_shadow (GimpImage *gimage,
int width,
int height,
int bpp)
{ {
/* allocate the new projection */ /* allocate the new projection */
gimage->shadow = tile_manager_new (width, height, bpp); gimage->shadow = tile_manager_new (width, height, bpp);
@ -342,7 +349,7 @@ gimp_image_get_resolution (GimpImage *gimage,
void void
gimp_image_set_unit (GimpImage *gimage, gimp_image_set_unit (GimpImage *gimage,
GUnit unit) GUnit unit)
{ {
gimage->unit = unit; gimage->unit = unit;
} }
@ -355,7 +362,8 @@ gimp_image_get_unit (GimpImage *gimage)
void void
gimp_image_set_save_proc (GimpImage *gimage, PlugInProcDef *proc) gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{ {
gimage->save_proc = proc; gimage->save_proc = proc;
} }
@ -414,10 +422,9 @@ gimp_image_resize (GimpImage *gimage,
while (guide_list) while (guide_list)
{ {
Guide *guide; Guide *guide;
GList *next;
guide = (Guide*) guide_list->data; guide = (Guide*) guide_list->data;
next = g_list_next (guide_list); guide_list = g_list_next (guide_list);
switch (guide->orientation) switch (guide->orientation)
{ {
@ -434,7 +441,6 @@ gimp_image_resize (GimpImage *gimage,
default: default:
g_error("Unknown guide orientation I.\n"); g_error("Unknown guide orientation I.\n");
} }
guide_list = next;
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
@ -469,11 +475,11 @@ gimp_image_scale (GimpImage *gimage,
int new_height) int new_height)
{ {
Channel *channel; Channel *channel;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
GSList *list; GSList *list;
GList *glist; GList *glist;
Guide *guide; Guide *guide;
int old_width, old_height; int old_width, old_height;
int layer_width, layer_height; int layer_width, layer_height;
@ -590,21 +596,22 @@ gimp_image_free_shadow (GimpImage *gimage)
static void static void
gimp_image_destroy (GtkObject *object) gimp_image_destroy (GtkObject *object)
{ {
GimpImage* gimage=GIMP_IMAGE(object); GimpImage* gimage = GIMP_IMAGE(object);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage); gimp_image_free_projection (gimage);
gimp_image_free_channels (gimage); gimp_image_free_shadow (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites) if (gimage->cmap)
gtk_object_unref(GTK_OBJECT(gimage->parasites)); g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
gtk_object_unref(GTK_OBJECT(gimage->parasites));
} }
void void
@ -619,7 +626,7 @@ gimp_image_apply_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR, maskPR; PixelRegion src1PR, destPR, maskPR;
@ -715,7 +722,7 @@ gimp_image_replace_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR; PixelRegion src1PR, destPR;
@ -971,8 +978,6 @@ gimp_image_transform_color (GimpImage *gimage,
Guide* Guide*
gimp_image_add_hguide (GimpImage *gimage) gimp_image_add_hguide (GimpImage *gimage)
{ {
@ -1061,7 +1066,7 @@ gimp_image_attach_parasite (GimpImage *gimage,
Parasite *parasite) Parasite *parasite)
{ {
/* only set the dirty bit manually if we can be saved and the new /* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */ parasite differs from the current one and we aren't undoable */
if (parasite_is_undoable(parasite)) if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite); undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite) if (parasite_is_persistent(parasite)
@ -1081,6 +1086,7 @@ gimp_image_detach_parasite (GimpImage *gimage,
const char *parasite) const char *parasite)
{ {
Parasite *p; Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite))) if (!(p = parasite_list_find(gimage->parasites, parasite)))
return; return;
if (parasite_is_undoable(p)) if (parasite_is_undoable(p))
@ -1223,7 +1229,7 @@ static void
gimp_image_free_layers (GimpImage *gimage) gimp_image_free_layers (GimpImage *gimage)
{ {
GSList *list = gimage->layers; GSList *list = gimage->layers;
Layer * layer; Layer *layer;
while (list) while (list)
{ {
@ -1239,8 +1245,8 @@ gimp_image_free_layers (GimpImage *gimage)
static void static void
gimp_image_free_channels (GimpImage *gimage) gimp_image_free_channels (GimpImage *gimage)
{ {
GSList *list = gimage->channels; GSList *list = gimage->channels;
Channel * channel; Channel *channel;
while (list) while (list)
{ {
@ -1602,8 +1608,8 @@ gimp_image_construct (GimpImage *gimage,
} }
void void
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y, gimp_image_invalidate_without_render (GimpImage *gimage,
int w, int h, int x, int y, int w, int h,
int x1, int y1, int x2, int y2) int x1, int y1, int x2, int y2)
{ {
Tile *tile; Tile *tile;
@ -1634,14 +1640,8 @@ gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
void void
gimp_image_invalidate (GimpImage *gimage, gimp_image_invalidate (GimpImage *gimage,
int x, int x, int y, int w, int h,
int y, int x1, int y1, int x2, int y2)
int w,
int h,
int x1,
int y1,
int x2,
int y2)
{ {
Tile *tile; Tile *tile;
TileManager *tm; TileManager *tm;

View File

@ -142,7 +142,8 @@ gimp_image_class_init (GimpImageClass *klass)
/* static functions */ /* static functions */
static void gimp_image_init (GimpImage *gimage) static void
gimp_image_init (GimpImage *gimage)
{ {
gimage->has_filename = 0; gimage->has_filename = 0;
gimage->num_cols = 0; gimage->num_cols = 0;
@ -176,15 +177,18 @@ static void gimp_image_init (GimpImage *gimage)
gimage->paths = NULL; gimage->paths = NULL;
} }
GtkType gimp_image_get_type(void){ GtkType
static GtkType type; gimp_image_get_type (void)
GIMP_TYPE_INIT(type, {
GimpImage, static GtkType type;
GimpImageClass,
gimp_image_init, GIMP_TYPE_INIT(type,
gimp_image_class_init, GimpImage,
GIMP_TYPE_OBJECT); GimpImageClass,
return type; gimp_image_init,
gimp_image_class_init,
GIMP_TYPE_OBJECT);
return type;
} }
@ -231,7 +235,10 @@ gimp_image_free_projection (GimpImage *gimage)
} }
static void static void
gimp_image_allocate_shadow (GimpImage *gimage, int width, int height, int bpp) gimp_image_allocate_shadow (GimpImage *gimage,
int width,
int height,
int bpp)
{ {
/* allocate the new projection */ /* allocate the new projection */
gimage->shadow = tile_manager_new (width, height, bpp); gimage->shadow = tile_manager_new (width, height, bpp);
@ -342,7 +349,7 @@ gimp_image_get_resolution (GimpImage *gimage,
void void
gimp_image_set_unit (GimpImage *gimage, gimp_image_set_unit (GimpImage *gimage,
GUnit unit) GUnit unit)
{ {
gimage->unit = unit; gimage->unit = unit;
} }
@ -355,7 +362,8 @@ gimp_image_get_unit (GimpImage *gimage)
void void
gimp_image_set_save_proc (GimpImage *gimage, PlugInProcDef *proc) gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{ {
gimage->save_proc = proc; gimage->save_proc = proc;
} }
@ -414,10 +422,9 @@ gimp_image_resize (GimpImage *gimage,
while (guide_list) while (guide_list)
{ {
Guide *guide; Guide *guide;
GList *next;
guide = (Guide*) guide_list->data; guide = (Guide*) guide_list->data;
next = g_list_next (guide_list); guide_list = g_list_next (guide_list);
switch (guide->orientation) switch (guide->orientation)
{ {
@ -434,7 +441,6 @@ gimp_image_resize (GimpImage *gimage,
default: default:
g_error("Unknown guide orientation I.\n"); g_error("Unknown guide orientation I.\n");
} }
guide_list = next;
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
@ -469,11 +475,11 @@ gimp_image_scale (GimpImage *gimage,
int new_height) int new_height)
{ {
Channel *channel; Channel *channel;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
GSList *list; GSList *list;
GList *glist; GList *glist;
Guide *guide; Guide *guide;
int old_width, old_height; int old_width, old_height;
int layer_width, layer_height; int layer_width, layer_height;
@ -590,21 +596,22 @@ gimp_image_free_shadow (GimpImage *gimage)
static void static void
gimp_image_destroy (GtkObject *object) gimp_image_destroy (GtkObject *object)
{ {
GimpImage* gimage=GIMP_IMAGE(object); GimpImage* gimage = GIMP_IMAGE(object);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage); gimp_image_free_projection (gimage);
gimp_image_free_channels (gimage); gimp_image_free_shadow (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites) if (gimage->cmap)
gtk_object_unref(GTK_OBJECT(gimage->parasites)); g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
gtk_object_unref(GTK_OBJECT(gimage->parasites));
} }
void void
@ -619,7 +626,7 @@ gimp_image_apply_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR, maskPR; PixelRegion src1PR, destPR, maskPR;
@ -715,7 +722,7 @@ gimp_image_replace_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR; PixelRegion src1PR, destPR;
@ -971,8 +978,6 @@ gimp_image_transform_color (GimpImage *gimage,
Guide* Guide*
gimp_image_add_hguide (GimpImage *gimage) gimp_image_add_hguide (GimpImage *gimage)
{ {
@ -1061,7 +1066,7 @@ gimp_image_attach_parasite (GimpImage *gimage,
Parasite *parasite) Parasite *parasite)
{ {
/* only set the dirty bit manually if we can be saved and the new /* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */ parasite differs from the current one and we aren't undoable */
if (parasite_is_undoable(parasite)) if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite); undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite) if (parasite_is_persistent(parasite)
@ -1081,6 +1086,7 @@ gimp_image_detach_parasite (GimpImage *gimage,
const char *parasite) const char *parasite)
{ {
Parasite *p; Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite))) if (!(p = parasite_list_find(gimage->parasites, parasite)))
return; return;
if (parasite_is_undoable(p)) if (parasite_is_undoable(p))
@ -1223,7 +1229,7 @@ static void
gimp_image_free_layers (GimpImage *gimage) gimp_image_free_layers (GimpImage *gimage)
{ {
GSList *list = gimage->layers; GSList *list = gimage->layers;
Layer * layer; Layer *layer;
while (list) while (list)
{ {
@ -1239,8 +1245,8 @@ gimp_image_free_layers (GimpImage *gimage)
static void static void
gimp_image_free_channels (GimpImage *gimage) gimp_image_free_channels (GimpImage *gimage)
{ {
GSList *list = gimage->channels; GSList *list = gimage->channels;
Channel * channel; Channel *channel;
while (list) while (list)
{ {
@ -1602,8 +1608,8 @@ gimp_image_construct (GimpImage *gimage,
} }
void void
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y, gimp_image_invalidate_without_render (GimpImage *gimage,
int w, int h, int x, int y, int w, int h,
int x1, int y1, int x2, int y2) int x1, int y1, int x2, int y2)
{ {
Tile *tile; Tile *tile;
@ -1634,14 +1640,8 @@ gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
void void
gimp_image_invalidate (GimpImage *gimage, gimp_image_invalidate (GimpImage *gimage,
int x, int x, int y, int w, int h,
int y, int x1, int y1, int x2, int y2)
int w,
int h,
int x1,
int y1,
int x2,
int y2)
{ {
Tile *tile; Tile *tile;
TileManager *tm; TileManager *tm;

View File

@ -142,7 +142,8 @@ gimp_image_class_init (GimpImageClass *klass)
/* static functions */ /* static functions */
static void gimp_image_init (GimpImage *gimage) static void
gimp_image_init (GimpImage *gimage)
{ {
gimage->has_filename = 0; gimage->has_filename = 0;
gimage->num_cols = 0; gimage->num_cols = 0;
@ -176,15 +177,18 @@ static void gimp_image_init (GimpImage *gimage)
gimage->paths = NULL; gimage->paths = NULL;
} }
GtkType gimp_image_get_type(void){ GtkType
static GtkType type; gimp_image_get_type (void)
GIMP_TYPE_INIT(type, {
GimpImage, static GtkType type;
GimpImageClass,
gimp_image_init, GIMP_TYPE_INIT(type,
gimp_image_class_init, GimpImage,
GIMP_TYPE_OBJECT); GimpImageClass,
return type; gimp_image_init,
gimp_image_class_init,
GIMP_TYPE_OBJECT);
return type;
} }
@ -231,7 +235,10 @@ gimp_image_free_projection (GimpImage *gimage)
} }
static void static void
gimp_image_allocate_shadow (GimpImage *gimage, int width, int height, int bpp) gimp_image_allocate_shadow (GimpImage *gimage,
int width,
int height,
int bpp)
{ {
/* allocate the new projection */ /* allocate the new projection */
gimage->shadow = tile_manager_new (width, height, bpp); gimage->shadow = tile_manager_new (width, height, bpp);
@ -342,7 +349,7 @@ gimp_image_get_resolution (GimpImage *gimage,
void void
gimp_image_set_unit (GimpImage *gimage, gimp_image_set_unit (GimpImage *gimage,
GUnit unit) GUnit unit)
{ {
gimage->unit = unit; gimage->unit = unit;
} }
@ -355,7 +362,8 @@ gimp_image_get_unit (GimpImage *gimage)
void void
gimp_image_set_save_proc (GimpImage *gimage, PlugInProcDef *proc) gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{ {
gimage->save_proc = proc; gimage->save_proc = proc;
} }
@ -414,10 +422,9 @@ gimp_image_resize (GimpImage *gimage,
while (guide_list) while (guide_list)
{ {
Guide *guide; Guide *guide;
GList *next;
guide = (Guide*) guide_list->data; guide = (Guide*) guide_list->data;
next = g_list_next (guide_list); guide_list = g_list_next (guide_list);
switch (guide->orientation) switch (guide->orientation)
{ {
@ -434,7 +441,6 @@ gimp_image_resize (GimpImage *gimage,
default: default:
g_error("Unknown guide orientation I.\n"); g_error("Unknown guide orientation I.\n");
} }
guide_list = next;
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
@ -469,11 +475,11 @@ gimp_image_scale (GimpImage *gimage,
int new_height) int new_height)
{ {
Channel *channel; Channel *channel;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
GSList *list; GSList *list;
GList *glist; GList *glist;
Guide *guide; Guide *guide;
int old_width, old_height; int old_width, old_height;
int layer_width, layer_height; int layer_width, layer_height;
@ -590,21 +596,22 @@ gimp_image_free_shadow (GimpImage *gimage)
static void static void
gimp_image_destroy (GtkObject *object) gimp_image_destroy (GtkObject *object)
{ {
GimpImage* gimage=GIMP_IMAGE(object); GimpImage* gimage = GIMP_IMAGE(object);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage); gimp_image_free_projection (gimage);
gimp_image_free_channels (gimage); gimp_image_free_shadow (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites) if (gimage->cmap)
gtk_object_unref(GTK_OBJECT(gimage->parasites)); g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
gtk_object_unref(GTK_OBJECT(gimage->parasites));
} }
void void
@ -619,7 +626,7 @@ gimp_image_apply_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR, maskPR; PixelRegion src1PR, destPR, maskPR;
@ -715,7 +722,7 @@ gimp_image_replace_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR; PixelRegion src1PR, destPR;
@ -971,8 +978,6 @@ gimp_image_transform_color (GimpImage *gimage,
Guide* Guide*
gimp_image_add_hguide (GimpImage *gimage) gimp_image_add_hguide (GimpImage *gimage)
{ {
@ -1061,7 +1066,7 @@ gimp_image_attach_parasite (GimpImage *gimage,
Parasite *parasite) Parasite *parasite)
{ {
/* only set the dirty bit manually if we can be saved and the new /* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */ parasite differs from the current one and we aren't undoable */
if (parasite_is_undoable(parasite)) if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite); undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite) if (parasite_is_persistent(parasite)
@ -1081,6 +1086,7 @@ gimp_image_detach_parasite (GimpImage *gimage,
const char *parasite) const char *parasite)
{ {
Parasite *p; Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite))) if (!(p = parasite_list_find(gimage->parasites, parasite)))
return; return;
if (parasite_is_undoable(p)) if (parasite_is_undoable(p))
@ -1223,7 +1229,7 @@ static void
gimp_image_free_layers (GimpImage *gimage) gimp_image_free_layers (GimpImage *gimage)
{ {
GSList *list = gimage->layers; GSList *list = gimage->layers;
Layer * layer; Layer *layer;
while (list) while (list)
{ {
@ -1239,8 +1245,8 @@ gimp_image_free_layers (GimpImage *gimage)
static void static void
gimp_image_free_channels (GimpImage *gimage) gimp_image_free_channels (GimpImage *gimage)
{ {
GSList *list = gimage->channels; GSList *list = gimage->channels;
Channel * channel; Channel *channel;
while (list) while (list)
{ {
@ -1602,8 +1608,8 @@ gimp_image_construct (GimpImage *gimage,
} }
void void
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y, gimp_image_invalidate_without_render (GimpImage *gimage,
int w, int h, int x, int y, int w, int h,
int x1, int y1, int x2, int y2) int x1, int y1, int x2, int y2)
{ {
Tile *tile; Tile *tile;
@ -1634,14 +1640,8 @@ gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
void void
gimp_image_invalidate (GimpImage *gimage, gimp_image_invalidate (GimpImage *gimage,
int x, int x, int y, int w, int h,
int y, int x1, int y1, int x2, int y2)
int w,
int h,
int x1,
int y1,
int x2,
int y2)
{ {
Tile *tile; Tile *tile;
TileManager *tm; TileManager *tm;

View File

@ -103,8 +103,8 @@ void undo_free_qmask (int, void *);
/* Sizing functions */ /* Sizing functions */
static int layer_size (Layer *); static int layer_size (Layer *);
static int channel_size (Channel *); static int channel_size (Channel *);
static int group_count = 0; static int group_count = 0;
static int shrink_wrap = FALSE; static int shrink_wrap = FALSE;
@ -117,7 +117,8 @@ layer_size (Layer *layer)
{ {
int size; int size;
size = sizeof (Layer) + GIMP_DRAWABLE(layer)->width * GIMP_DRAWABLE(layer)->height * GIMP_DRAWABLE(layer)->bytes + size = sizeof (Layer) +
GIMP_DRAWABLE(layer)->width * GIMP_DRAWABLE(layer)->height * GIMP_DRAWABLE(layer)->bytes +
strlen (GIMP_DRAWABLE(layer)->name); strlen (GIMP_DRAWABLE(layer)->name);
if (layer_mask (layer)) if (layer_mask (layer))
@ -276,7 +277,7 @@ static int
pop_stack (GImage *gimage, pop_stack (GImage *gimage,
GSList **stack_ptr, GSList **stack_ptr,
GSList **unstack_ptr, GSList **unstack_ptr,
int state) int state)
{ {
Undo * object; Undo * object;
GSList *stack; GSList *stack;
@ -452,12 +453,12 @@ struct _image_undo
int int
undo_push_image (GImage *gimage, undo_push_image (GImage *gimage,
GimpDrawable *drawable, GimpDrawable *drawable,
int x1, int x1,
int y1, int y1,
int x2, int x2,
int y2) int y2)
{ {
long size; long size;
Undo *new; Undo *new;
@ -509,14 +510,14 @@ undo_push_image (GImage *gimage,
int int
undo_push_image_mod (GImage *gimage, undo_push_image_mod (GImage *gimage,
GimpDrawable *drawable, GimpDrawable *drawable,
int x1, int x1,
int y1, int y1,
int x2, int x2,
int y2, int y2,
void *tiles_ptr, void *tiles_ptr,
int sparse) int sparse)
{ {
long size; long size;
int dwidth, dheight; int dwidth, dheight;
@ -803,7 +804,7 @@ undo_free_mask (int state,
/* Layer displacement Undo functions */ /* Layer displacement Undo functions */
int int
undo_push_layer_displace (GImage *gimage, undo_push_layer_displace (GImage *gimage,
GimpLayer *layer) GimpLayer *layer)
{ {
Undo * new; Undo * new;
@ -1218,7 +1219,8 @@ undo_push_layer_mod (GImage *gimage,
tiles = GIMP_DRAWABLE(layer)->tiles; tiles = GIMP_DRAWABLE(layer)->tiles;
tiles->x = GIMP_DRAWABLE(layer)->offset_x; tiles->x = GIMP_DRAWABLE(layer)->offset_x;
tiles->y = GIMP_DRAWABLE(layer)->offset_y; tiles->y = GIMP_DRAWABLE(layer)->offset_y;
size = GIMP_DRAWABLE(layer)->width * GIMP_DRAWABLE(layer)->height * GIMP_DRAWABLE(layer)->bytes + sizeof (void *) * 3; size = GIMP_DRAWABLE(layer)->width * GIMP_DRAWABLE(layer)->height *
GIMP_DRAWABLE(layer)->bytes + sizeof (void *) * 3;
if ((new = undo_push (gimage, size, LAYER_MOD))) if ((new = undo_push (gimage, size, LAYER_MOD)))
{ {
@ -1306,7 +1308,8 @@ undo_pop_layer_mod (GImage *gimage,
data[1] = temp; data[1] = temp;
/* Issue the second update */ /* Issue the second update */
drawable_update (GIMP_DRAWABLE(layer), 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height); drawable_update (GIMP_DRAWABLE(layer), 0, 0,
GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height);
return TRUE; return TRUE;
} }
@ -1398,7 +1401,8 @@ undo_pop_layer_mask (GImage *gimage,
* this is undoing an add... * this is undoing an add...
*/ */
if ((state == REDO && lmu->mode == DISCARD) || state == UNDO) if ((state == REDO && lmu->mode == DISCARD) || state == UNDO)
drawable_update (GIMP_DRAWABLE(lmu->layer), 0, 0, GIMP_DRAWABLE(lmu->layer)->width, GIMP_DRAWABLE(lmu->layer)->height); drawable_update (GIMP_DRAWABLE(lmu->layer), 0, 0,
GIMP_DRAWABLE(lmu->layer)->width, GIMP_DRAWABLE(lmu->layer)->height);
} }
/* restore layer */ /* restore layer */
else else
@ -1415,7 +1419,8 @@ undo_pop_layer_mask (GImage *gimage,
* this is redoing an add * this is redoing an add
*/ */
if ((state == UNDO && lmu->mode == DISCARD) || state == REDO) if ((state == UNDO && lmu->mode == DISCARD) || state == REDO)
drawable_update (GIMP_DRAWABLE(lmu->layer), 0, 0, GIMP_DRAWABLE(lmu->layer)->width, GIMP_DRAWABLE(lmu->layer)->height); drawable_update (GIMP_DRAWABLE(lmu->layer), 0, 0,
GIMP_DRAWABLE(lmu->layer)->width, GIMP_DRAWABLE(lmu->layer)->height);
} }
return TRUE; return TRUE;
@ -1515,7 +1520,8 @@ undo_pop_channel (GImage *gimage,
gimage_set_active_channel (gimage, cu->prev_channel); gimage_set_active_channel (gimage, cu->prev_channel);
/* update the area */ /* update the area */
drawable_update (GIMP_DRAWABLE(cu->channel), 0, 0, GIMP_DRAWABLE(cu->channel)->width, GIMP_DRAWABLE(cu->channel)->height); drawable_update (GIMP_DRAWABLE(cu->channel), 0, 0,
GIMP_DRAWABLE(cu->channel)->width, GIMP_DRAWABLE(cu->channel)->height);
} }
/* restore channel */ /* restore channel */
else else
@ -1530,7 +1536,8 @@ undo_pop_channel (GImage *gimage,
gimage_set_active_channel (gimage, cu->channel); gimage_set_active_channel (gimage, cu->channel);
/* update the area */ /* update the area */
drawable_update (GIMP_DRAWABLE(cu->channel), 0, 0, GIMP_DRAWABLE(cu->channel)->width, GIMP_DRAWABLE(cu->channel)->height); drawable_update (GIMP_DRAWABLE(cu->channel), 0, 0,
GIMP_DRAWABLE(cu->channel)->width, GIMP_DRAWABLE(cu->channel)->height);
} }
return TRUE; return TRUE;
@ -1629,7 +1636,8 @@ undo_pop_channel_mod (GImage *gimage,
tiles = (TileManager *) data[1]; tiles = (TileManager *) data[1];
/* Issue the first update */ /* Issue the first update */
drawable_update (GIMP_DRAWABLE(channel), 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height); drawable_update (GIMP_DRAWABLE(channel), 0, 0,
GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height);
temp = GIMP_DRAWABLE(channel)->tiles; temp = GIMP_DRAWABLE(channel)->tiles;
GIMP_DRAWABLE(channel)->tiles = tiles; GIMP_DRAWABLE(channel)->tiles = tiles;
@ -1640,7 +1648,8 @@ undo_pop_channel_mod (GImage *gimage,
data[1] = temp; data[1] = temp;
/* Issue the second update */ /* Issue the second update */
drawable_update (GIMP_DRAWABLE(channel), 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height); drawable_update (GIMP_DRAWABLE(channel), 0, 0,
GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height);
return TRUE; return TRUE;
} }
@ -1727,8 +1736,11 @@ undo_pop_fs_to_layer (GImage *gimage,
gimage->floating_sel = fsu->layer; gimage->floating_sel = fsu->layer;
/* restore the contents of the drawable */ /* restore the contents of the drawable */
floating_sel_store (fsu->layer, GIMP_DRAWABLE(fsu->layer)->offset_x, GIMP_DRAWABLE(fsu->layer)->offset_y, floating_sel_store (fsu->layer,
GIMP_DRAWABLE(fsu->layer)->width, GIMP_DRAWABLE(fsu->layer)->height); GIMP_DRAWABLE(fsu->layer)->offset_x,
GIMP_DRAWABLE(fsu->layer)->offset_y,
GIMP_DRAWABLE(fsu->layer)->width,
GIMP_DRAWABLE(fsu->layer)->height);
fsu->layer->fs.initial = TRUE; fsu->layer->fs.initial = TRUE;
/* clear the selection */ /* clear the selection */
@ -1740,8 +1752,11 @@ undo_pop_fs_to_layer (GImage *gimage,
case REDO: case REDO:
/* restore the contents of the drawable */ /* restore the contents of the drawable */
floating_sel_restore (fsu->layer, GIMP_DRAWABLE(fsu->layer)->offset_x, GIMP_DRAWABLE(fsu->layer)->offset_y, floating_sel_restore (fsu->layer,
GIMP_DRAWABLE(fsu->layer)->width, GIMP_DRAWABLE(fsu->layer)->height); GIMP_DRAWABLE(fsu->layer)->offset_x,
GIMP_DRAWABLE(fsu->layer)->offset_y,
GIMP_DRAWABLE(fsu->layer)->width,
GIMP_DRAWABLE(fsu->layer)->height);
/* Update the preview for the gimage and underlying drawable */ /* Update the preview for the gimage and underlying drawable */
drawable_invalidate_preview (GIMP_DRAWABLE(fsu->layer)); drawable_invalidate_preview (GIMP_DRAWABLE(fsu->layer));
@ -1824,16 +1839,20 @@ undo_pop_fs_rigor (GImage *gimage,
/* restore the contents of drawable the floating layer is attached to */ /* restore the contents of drawable the floating layer is attached to */
if (floating_layer->fs.initial == FALSE) if (floating_layer->fs.initial == FALSE)
floating_sel_restore (floating_layer, floating_sel_restore (floating_layer,
GIMP_DRAWABLE(floating_layer)->offset_x, GIMP_DRAWABLE(floating_layer)->offset_y, GIMP_DRAWABLE(floating_layer)->offset_x,
GIMP_DRAWABLE(floating_layer)->width, GIMP_DRAWABLE(floating_layer)->height); GIMP_DRAWABLE(floating_layer)->offset_y,
GIMP_DRAWABLE(floating_layer)->width,
GIMP_DRAWABLE(floating_layer)->height);
floating_layer->fs.initial = TRUE; floating_layer->fs.initial = TRUE;
break; break;
case REDO: case REDO:
/* store the affected area from the drawable in the backing store */ /* store the affected area from the drawable in the backing store */
floating_sel_store (floating_layer, floating_sel_store (floating_layer,
GIMP_DRAWABLE(floating_layer)->offset_x, GIMP_DRAWABLE(floating_layer)->offset_y, GIMP_DRAWABLE(floating_layer)->offset_x,
GIMP_DRAWABLE(floating_layer)->width, GIMP_DRAWABLE(floating_layer)->height); GIMP_DRAWABLE(floating_layer)->offset_y,
GIMP_DRAWABLE(floating_layer)->width,
GIMP_DRAWABLE(floating_layer)->height);
floating_layer->fs.initial = TRUE; floating_layer->fs.initial = TRUE;
break; break;
} }
@ -1897,8 +1916,10 @@ undo_pop_fs_relax (GImage *gimage,
case UNDO: case UNDO:
/* store the affected area from the drawable in the backing store */ /* store the affected area from the drawable in the backing store */
floating_sel_store (floating_layer, floating_sel_store (floating_layer,
GIMP_DRAWABLE(floating_layer)->offset_x, GIMP_DRAWABLE(floating_layer)->offset_y, GIMP_DRAWABLE(floating_layer)->offset_x,
GIMP_DRAWABLE(floating_layer)->width, GIMP_DRAWABLE(floating_layer)->height); GIMP_DRAWABLE(floating_layer)->offset_y,
GIMP_DRAWABLE(floating_layer)->width,
GIMP_DRAWABLE(floating_layer)->height);
floating_layer->fs.initial = TRUE; floating_layer->fs.initial = TRUE;
break; break;
@ -1906,8 +1927,10 @@ undo_pop_fs_relax (GImage *gimage,
/* restore the contents of drawable the floating layer is attached to */ /* restore the contents of drawable the floating layer is attached to */
if (floating_layer->fs.initial == FALSE) if (floating_layer->fs.initial == FALSE)
floating_sel_restore (floating_layer, floating_sel_restore (floating_layer,
GIMP_DRAWABLE(floating_layer)->offset_x, GIMP_DRAWABLE(floating_layer)->offset_y, GIMP_DRAWABLE(floating_layer)->offset_x,
GIMP_DRAWABLE(floating_layer)->width, GIMP_DRAWABLE(floating_layer)->height); GIMP_DRAWABLE(floating_layer)->offset_y,
GIMP_DRAWABLE(floating_layer)->width,
GIMP_DRAWABLE(floating_layer)->height);
floating_layer->fs.initial = TRUE; floating_layer->fs.initial = TRUE;
break; break;
} }
@ -2063,7 +2086,6 @@ undo_pop_qmask (GImage *gimage,
{ {
QmaskUndo *data; QmaskUndo *data;
int tmp; int tmp;
int tmp_ref;
data = data_ptr; data = data_ptr;
@ -2195,10 +2217,10 @@ typedef struct _ParasiteUndo ParasiteUndo;
struct _ParasiteUndo struct _ParasiteUndo
{ {
GImage *gimage; GImage *gimage;
GimpDrawable *drawable; GimpDrawable *drawable;
Parasite *parasite; Parasite *parasite;
char *name; char *name;
}; };
int int
@ -2223,8 +2245,8 @@ undo_push_image_parasite (GImage *gimage,
data->gimage = gimage; data->gimage = gimage;
data->drawable = NULL; data->drawable = NULL;
data->name = g_strdup(parasite_name(parasite)); data->name = g_strdup (parasite_name (parasite));
data->parasite = parasite_copy(gimp_image_find_parasite(gimage, data->name)); data->parasite = parasite_copy (gimp_image_find_parasite (gimage, data->name));
return TRUE; return TRUE;
} }
@ -2254,8 +2276,8 @@ undo_push_image_parasite_remove (GImage *gimage,
data->gimage = gimage; data->gimage = gimage;
data->drawable = NULL; data->drawable = NULL;
data->name = g_strdup(name); data->name = g_strdup (name);
data->parasite = parasite_copy(gimp_image_find_parasite(gimage, data->name)); data->parasite = parasite_copy (gimp_image_find_parasite (gimage, data->name));
return TRUE; return TRUE;
} }
@ -2286,8 +2308,8 @@ undo_push_drawable_parasite (GImage *gimage,
data->gimage = NULL; data->gimage = NULL;
data->drawable = drawable; data->drawable = drawable;
data->name = g_strdup(parasite_name(parasite)); data->name = g_strdup (parasite_name (parasite));
data->parasite = parasite_copy(gimp_drawable_find_parasite(drawable, data->name)); data->parasite = parasite_copy (gimp_drawable_find_parasite (drawable, data->name));
return TRUE; return TRUE;
} }
@ -2317,8 +2339,8 @@ undo_push_drawable_parasite_remove (GImage *gimage,
data->gimage = NULL; data->gimage = NULL;
data->drawable = drawable; data->drawable = drawable;
data->name = g_strdup(name); data->name = g_strdup (name);
data->parasite = parasite_copy(gimp_drawable_find_parasite(drawable, data->name)); data->parasite = parasite_copy (gimp_drawable_find_parasite (drawable, data->name));
return TRUE; return TRUE;
} }
@ -2328,9 +2350,9 @@ undo_push_drawable_parasite_remove (GImage *gimage,
int int
undo_pop_parasite (GImage *gimage, undo_pop_parasite (GImage *gimage,
int state, int state,
int type, int type,
void *data_ptr) void *data_ptr)
{ {
ParasiteUndo *data; ParasiteUndo *data;
Parasite *tmp; Parasite *tmp;
@ -2341,33 +2363,33 @@ undo_pop_parasite (GImage *gimage,
if (data->gimage) if (data->gimage)
{ {
data->parasite = parasite_copy(gimp_image_find_parasite(gimage, data->parasite = parasite_copy (gimp_image_find_parasite (gimage,
data->name)); data->name));
if (tmp) if (tmp)
parasite_list_add(data->gimage->parasites, tmp); parasite_list_add (data->gimage->parasites, tmp);
else else
parasite_list_remove(data->gimage->parasites, data->name); parasite_list_remove (data->gimage->parasites, data->name);
} }
else if (data->drawable) else if (data->drawable)
{ {
data->parasite = parasite_copy(gimp_drawable_find_parasite(data->drawable, data->parasite = parasite_copy (gimp_drawable_find_parasite (data->drawable,
data->name)); data->name));
if (tmp) if (tmp)
parasite_list_add(data->drawable->parasites, tmp); parasite_list_add (data->drawable->parasites, tmp);
else else
parasite_list_remove(data->drawable->parasites, data->name); parasite_list_remove (data->drawable->parasites, data->name);
} }
else else
{ {
data->parasite = parasite_copy(gimp_find_parasite(data->name)); data->parasite = parasite_copy (gimp_find_parasite (data->name));
if (tmp) if (tmp)
gimp_attach_parasite(tmp); gimp_attach_parasite (tmp);
else else
gimp_detach_parasite(data->name); gimp_detach_parasite (data->name);
} }
if (tmp) if (tmp)
parasite_free(tmp); parasite_free (tmp);
/* if ((tmp && parasite_is_persistant(tmp)) || */ /* if ((tmp && parasite_is_persistant(tmp)) || */
/* (data->parasite && parasite_is_persistant(data->parasite))) */ /* (data->parasite && parasite_is_persistant(data->parasite))) */
@ -2387,7 +2409,7 @@ undo_pop_parasite (GImage *gimage,
void void
undo_free_parasite (int state, undo_free_parasite (int state,
void *data_ptr) void *data_ptr)
{ {
ParasiteUndo *data; ParasiteUndo *data;

View File

@ -142,7 +142,8 @@ gimp_image_class_init (GimpImageClass *klass)
/* static functions */ /* static functions */
static void gimp_image_init (GimpImage *gimage) static void
gimp_image_init (GimpImage *gimage)
{ {
gimage->has_filename = 0; gimage->has_filename = 0;
gimage->num_cols = 0; gimage->num_cols = 0;
@ -176,15 +177,18 @@ static void gimp_image_init (GimpImage *gimage)
gimage->paths = NULL; gimage->paths = NULL;
} }
GtkType gimp_image_get_type(void){ GtkType
static GtkType type; gimp_image_get_type (void)
GIMP_TYPE_INIT(type, {
GimpImage, static GtkType type;
GimpImageClass,
gimp_image_init, GIMP_TYPE_INIT(type,
gimp_image_class_init, GimpImage,
GIMP_TYPE_OBJECT); GimpImageClass,
return type; gimp_image_init,
gimp_image_class_init,
GIMP_TYPE_OBJECT);
return type;
} }
@ -231,7 +235,10 @@ gimp_image_free_projection (GimpImage *gimage)
} }
static void static void
gimp_image_allocate_shadow (GimpImage *gimage, int width, int height, int bpp) gimp_image_allocate_shadow (GimpImage *gimage,
int width,
int height,
int bpp)
{ {
/* allocate the new projection */ /* allocate the new projection */
gimage->shadow = tile_manager_new (width, height, bpp); gimage->shadow = tile_manager_new (width, height, bpp);
@ -342,7 +349,7 @@ gimp_image_get_resolution (GimpImage *gimage,
void void
gimp_image_set_unit (GimpImage *gimage, gimp_image_set_unit (GimpImage *gimage,
GUnit unit) GUnit unit)
{ {
gimage->unit = unit; gimage->unit = unit;
} }
@ -355,7 +362,8 @@ gimp_image_get_unit (GimpImage *gimage)
void void
gimp_image_set_save_proc (GimpImage *gimage, PlugInProcDef *proc) gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{ {
gimage->save_proc = proc; gimage->save_proc = proc;
} }
@ -414,10 +422,9 @@ gimp_image_resize (GimpImage *gimage,
while (guide_list) while (guide_list)
{ {
Guide *guide; Guide *guide;
GList *next;
guide = (Guide*) guide_list->data; guide = (Guide*) guide_list->data;
next = g_list_next (guide_list); guide_list = g_list_next (guide_list);
switch (guide->orientation) switch (guide->orientation)
{ {
@ -434,7 +441,6 @@ gimp_image_resize (GimpImage *gimage,
default: default:
g_error("Unknown guide orientation I.\n"); g_error("Unknown guide orientation I.\n");
} }
guide_list = next;
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
@ -469,11 +475,11 @@ gimp_image_scale (GimpImage *gimage,
int new_height) int new_height)
{ {
Channel *channel; Channel *channel;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
GSList *list; GSList *list;
GList *glist; GList *glist;
Guide *guide; Guide *guide;
int old_width, old_height; int old_width, old_height;
int layer_width, layer_height; int layer_width, layer_height;
@ -590,21 +596,22 @@ gimp_image_free_shadow (GimpImage *gimage)
static void static void
gimp_image_destroy (GtkObject *object) gimp_image_destroy (GtkObject *object)
{ {
GimpImage* gimage=GIMP_IMAGE(object); GimpImage* gimage = GIMP_IMAGE(object);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage); gimp_image_free_projection (gimage);
gimp_image_free_channels (gimage); gimp_image_free_shadow (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites) if (gimage->cmap)
gtk_object_unref(GTK_OBJECT(gimage->parasites)); g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
gtk_object_unref(GTK_OBJECT(gimage->parasites));
} }
void void
@ -619,7 +626,7 @@ gimp_image_apply_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR, maskPR; PixelRegion src1PR, destPR, maskPR;
@ -715,7 +722,7 @@ gimp_image_replace_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR; PixelRegion src1PR, destPR;
@ -971,8 +978,6 @@ gimp_image_transform_color (GimpImage *gimage,
Guide* Guide*
gimp_image_add_hguide (GimpImage *gimage) gimp_image_add_hguide (GimpImage *gimage)
{ {
@ -1061,7 +1066,7 @@ gimp_image_attach_parasite (GimpImage *gimage,
Parasite *parasite) Parasite *parasite)
{ {
/* only set the dirty bit manually if we can be saved and the new /* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */ parasite differs from the current one and we aren't undoable */
if (parasite_is_undoable(parasite)) if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite); undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite) if (parasite_is_persistent(parasite)
@ -1081,6 +1086,7 @@ gimp_image_detach_parasite (GimpImage *gimage,
const char *parasite) const char *parasite)
{ {
Parasite *p; Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite))) if (!(p = parasite_list_find(gimage->parasites, parasite)))
return; return;
if (parasite_is_undoable(p)) if (parasite_is_undoable(p))
@ -1223,7 +1229,7 @@ static void
gimp_image_free_layers (GimpImage *gimage) gimp_image_free_layers (GimpImage *gimage)
{ {
GSList *list = gimage->layers; GSList *list = gimage->layers;
Layer * layer; Layer *layer;
while (list) while (list)
{ {
@ -1239,8 +1245,8 @@ gimp_image_free_layers (GimpImage *gimage)
static void static void
gimp_image_free_channels (GimpImage *gimage) gimp_image_free_channels (GimpImage *gimage)
{ {
GSList *list = gimage->channels; GSList *list = gimage->channels;
Channel * channel; Channel *channel;
while (list) while (list)
{ {
@ -1602,8 +1608,8 @@ gimp_image_construct (GimpImage *gimage,
} }
void void
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y, gimp_image_invalidate_without_render (GimpImage *gimage,
int w, int h, int x, int y, int w, int h,
int x1, int y1, int x2, int y2) int x1, int y1, int x2, int y2)
{ {
Tile *tile; Tile *tile;
@ -1634,14 +1640,8 @@ gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
void void
gimp_image_invalidate (GimpImage *gimage, gimp_image_invalidate (GimpImage *gimage,
int x, int x, int y, int w, int h,
int y, int x1, int y1, int x2, int y2)
int w,
int h,
int x1,
int y1,
int x2,
int y2)
{ {
Tile *tile; Tile *tile;
TileManager *tm; TileManager *tm;

View File

@ -142,7 +142,8 @@ gimp_image_class_init (GimpImageClass *klass)
/* static functions */ /* static functions */
static void gimp_image_init (GimpImage *gimage) static void
gimp_image_init (GimpImage *gimage)
{ {
gimage->has_filename = 0; gimage->has_filename = 0;
gimage->num_cols = 0; gimage->num_cols = 0;
@ -176,15 +177,18 @@ static void gimp_image_init (GimpImage *gimage)
gimage->paths = NULL; gimage->paths = NULL;
} }
GtkType gimp_image_get_type(void){ GtkType
static GtkType type; gimp_image_get_type (void)
GIMP_TYPE_INIT(type, {
GimpImage, static GtkType type;
GimpImageClass,
gimp_image_init, GIMP_TYPE_INIT(type,
gimp_image_class_init, GimpImage,
GIMP_TYPE_OBJECT); GimpImageClass,
return type; gimp_image_init,
gimp_image_class_init,
GIMP_TYPE_OBJECT);
return type;
} }
@ -231,7 +235,10 @@ gimp_image_free_projection (GimpImage *gimage)
} }
static void static void
gimp_image_allocate_shadow (GimpImage *gimage, int width, int height, int bpp) gimp_image_allocate_shadow (GimpImage *gimage,
int width,
int height,
int bpp)
{ {
/* allocate the new projection */ /* allocate the new projection */
gimage->shadow = tile_manager_new (width, height, bpp); gimage->shadow = tile_manager_new (width, height, bpp);
@ -342,7 +349,7 @@ gimp_image_get_resolution (GimpImage *gimage,
void void
gimp_image_set_unit (GimpImage *gimage, gimp_image_set_unit (GimpImage *gimage,
GUnit unit) GUnit unit)
{ {
gimage->unit = unit; gimage->unit = unit;
} }
@ -355,7 +362,8 @@ gimp_image_get_unit (GimpImage *gimage)
void void
gimp_image_set_save_proc (GimpImage *gimage, PlugInProcDef *proc) gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{ {
gimage->save_proc = proc; gimage->save_proc = proc;
} }
@ -414,10 +422,9 @@ gimp_image_resize (GimpImage *gimage,
while (guide_list) while (guide_list)
{ {
Guide *guide; Guide *guide;
GList *next;
guide = (Guide*) guide_list->data; guide = (Guide*) guide_list->data;
next = g_list_next (guide_list); guide_list = g_list_next (guide_list);
switch (guide->orientation) switch (guide->orientation)
{ {
@ -434,7 +441,6 @@ gimp_image_resize (GimpImage *gimage,
default: default:
g_error("Unknown guide orientation I.\n"); g_error("Unknown guide orientation I.\n");
} }
guide_list = next;
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
@ -469,11 +475,11 @@ gimp_image_scale (GimpImage *gimage,
int new_height) int new_height)
{ {
Channel *channel; Channel *channel;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
GSList *list; GSList *list;
GList *glist; GList *glist;
Guide *guide; Guide *guide;
int old_width, old_height; int old_width, old_height;
int layer_width, layer_height; int layer_width, layer_height;
@ -590,21 +596,22 @@ gimp_image_free_shadow (GimpImage *gimage)
static void static void
gimp_image_destroy (GtkObject *object) gimp_image_destroy (GtkObject *object)
{ {
GimpImage* gimage=GIMP_IMAGE(object); GimpImage* gimage = GIMP_IMAGE(object);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage); gimp_image_free_projection (gimage);
gimp_image_free_channels (gimage); gimp_image_free_shadow (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites) if (gimage->cmap)
gtk_object_unref(GTK_OBJECT(gimage->parasites)); g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
gtk_object_unref(GTK_OBJECT(gimage->parasites));
} }
void void
@ -619,7 +626,7 @@ gimp_image_apply_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR, maskPR; PixelRegion src1PR, destPR, maskPR;
@ -715,7 +722,7 @@ gimp_image_replace_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR; PixelRegion src1PR, destPR;
@ -971,8 +978,6 @@ gimp_image_transform_color (GimpImage *gimage,
Guide* Guide*
gimp_image_add_hguide (GimpImage *gimage) gimp_image_add_hguide (GimpImage *gimage)
{ {
@ -1061,7 +1066,7 @@ gimp_image_attach_parasite (GimpImage *gimage,
Parasite *parasite) Parasite *parasite)
{ {
/* only set the dirty bit manually if we can be saved and the new /* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */ parasite differs from the current one and we aren't undoable */
if (parasite_is_undoable(parasite)) if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite); undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite) if (parasite_is_persistent(parasite)
@ -1081,6 +1086,7 @@ gimp_image_detach_parasite (GimpImage *gimage,
const char *parasite) const char *parasite)
{ {
Parasite *p; Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite))) if (!(p = parasite_list_find(gimage->parasites, parasite)))
return; return;
if (parasite_is_undoable(p)) if (parasite_is_undoable(p))
@ -1223,7 +1229,7 @@ static void
gimp_image_free_layers (GimpImage *gimage) gimp_image_free_layers (GimpImage *gimage)
{ {
GSList *list = gimage->layers; GSList *list = gimage->layers;
Layer * layer; Layer *layer;
while (list) while (list)
{ {
@ -1239,8 +1245,8 @@ gimp_image_free_layers (GimpImage *gimage)
static void static void
gimp_image_free_channels (GimpImage *gimage) gimp_image_free_channels (GimpImage *gimage)
{ {
GSList *list = gimage->channels; GSList *list = gimage->channels;
Channel * channel; Channel *channel;
while (list) while (list)
{ {
@ -1602,8 +1608,8 @@ gimp_image_construct (GimpImage *gimage,
} }
void void
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y, gimp_image_invalidate_without_render (GimpImage *gimage,
int w, int h, int x, int y, int w, int h,
int x1, int y1, int x2, int y2) int x1, int y1, int x2, int y2)
{ {
Tile *tile; Tile *tile;
@ -1634,14 +1640,8 @@ gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
void void
gimp_image_invalidate (GimpImage *gimage, gimp_image_invalidate (GimpImage *gimage,
int x, int x, int y, int w, int h,
int y, int x1, int y1, int x2, int y2)
int w,
int h,
int x1,
int y1,
int x2,
int y2)
{ {
Tile *tile; Tile *tile;
TileManager *tm; TileManager *tm;

View File

@ -23,17 +23,19 @@
to proper places. That is, the handlers should be moved to to proper places. That is, the handlers should be moved to
layers_dialog, gdisplay, tools, etc.. */ layers_dialog, gdisplay, tools, etc.. */
static void gimage_dirty_handler (GimpImage* gimage); static void gimage_dirty_handler (GimpImage* gimage);
static void gimage_destroy_handler (GimpImage* gimage); static void gimage_destroy_handler (GimpImage* gimage);
static void gimage_cmap_change_handler (GimpImage* gimage, gint ncol, static void gimage_cmap_change_handler (GimpImage* gimage, gint ncol, gpointer user_data);
gpointer user_data); static void gimage_rename_handler (GimpImage* gimage);
static void gimage_rename_handler (GimpImage* gimage); static void gimage_resize_handler (GimpImage* gimage);
static void gimage_resize_handler (GimpImage* gimage); static void gimage_restructure_handler (GimpImage* gimage);
static void gimage_restructure_handler (GimpImage* gimage); static void gimage_repaint_handler (GimpImage* gimage, gint, gint, gint, gint);
static void gimage_repaint_handler (GimpImage* gimage, gint, gint, gint, gint);
GImage* GImage*
gimage_new(int width, int height, GimpImageBaseType base_type) gimage_new(int width,
int height,
GimpImageBaseType base_type)
{ {
GimpImage* gimage = gimp_image_new (width, height, base_type); GimpImage* gimage = gimp_image_new (width, height, base_type);
@ -52,17 +54,16 @@ gimage_new(int width, int height, GimpImageBaseType base_type)
gtk_signal_connect (GTK_OBJECT (gimage), "colormap_changed", gtk_signal_connect (GTK_OBJECT (gimage), "colormap_changed",
GTK_SIGNAL_FUNC(gimage_cmap_change_handler), NULL); GTK_SIGNAL_FUNC(gimage_cmap_change_handler), NULL);
gimp_set_add (image_context, gimage);
gimp_set_add(image_context, gimage);
palette_import_image_new(gimage); palette_import_image_new (gimage);
return gimage; return gimage;
} }
GImage* GImage*
gimage_get_ID (gint ID) gimage_get_ID (gint ID)
{ {
return pdb_id_to_image(ID); return pdb_id_to_image (ID);
} }
@ -74,19 +75,21 @@ void
gimage_delete (GImage *gimage) gimage_delete (GImage *gimage)
{ {
gimage->ref_count--; gimage->ref_count--;
if (gimage->ref_count <= 0) if (gimage->ref_count <= 0)
gtk_object_unref (GTK_OBJECT(gimage)); gtk_object_unref (GTK_OBJECT (gimage));
} }
static void static void
invalidate_cb(gpointer image, gpointer user_data){ invalidate_cb (gpointer image,
gimp_image_invalidate_preview(GIMP_IMAGE(image)); gpointer user_data)
{
gimp_image_invalidate_preview (GIMP_IMAGE(image));
} }
void void
gimage_invalidate_previews (void) gimage_invalidate_previews (void)
{ {
gimp_set_foreach(image_context, invalidate_cb, NULL); gimp_set_foreach (image_context, invalidate_cb, NULL);
} }
static void static void
@ -107,21 +110,23 @@ gimage_dirty_handler (GimpImage* gimage)
} }
static void static void
gimlist_cb(gpointer im, gpointer data){ gimlist_cb (gpointer im,
GSList** l=(GSList**)data; gpointer data)
*l=g_slist_prepend(*l, im); {
GSList** l=(GSList**)data;
*l=g_slist_prepend(*l, im);
} }
gint gint
gimage_image_count() gimage_image_count (void)
{ {
GSList *list=NULL; GSList *list=NULL;
gint num_images = 0; gint num_images = 0;
gimage_foreach(gimlist_cb, &list); gimage_foreach (gimlist_cb, &list);
num_images = g_slist_length (list); num_images = g_slist_length (list);
g_slist_free(list); g_slist_free (list);
return (num_images); return (num_images);
} }
@ -129,22 +134,23 @@ gimage_image_count()
static void static void
gimage_destroy_handler (GimpImage* gimage) gimage_destroy_handler (GimpImage* gimage)
{ {
/* free the undo list */ /* free the undo list */
undo_free (gimage); undo_free (gimage);
palette_import_image_destroyed(gimage); palette_import_image_destroyed (gimage);
if(gimage_image_count() == 1) /* This is the last image */ if (gimage_image_count () == 1) /* This is the last image */
{ {
dialog_show_toolbox(); dialog_show_toolbox ();
} }
} }
static void gimage_cmap_change_handler (GimpImage* gimage, gint ncol, static void
gpointer user_data) gimage_cmap_change_handler (GimpImage *gimage,
gint ncol,
gpointer user_data)
{ {
gdisplays_update_full(gimage); gdisplays_update_full (gimage);
} }
@ -154,7 +160,7 @@ gimage_rename_handler (GimpImage* gimage)
gdisplays_update_title (gimage); gdisplays_update_title (gimage);
lc_dialog_update_image_list (); lc_dialog_update_image_list ();
palette_import_image_renamed(gimage); palette_import_image_renamed (gimage);
} }
static void static void
@ -178,7 +184,11 @@ gimage_restructure_handler (GimpImage* gimage)
} }
static void static void
gimage_repaint_handler (GimpImage* gimage, gint x, gint y, gint w, gint h) gimage_repaint_handler (GimpImage* gimage,
gint x,
gint y,
gint w,
gint h)
{ {
gdisplays_update_area (gimage, x, y, w, h); gdisplays_update_area (gimage, x, y, w, h);
} }
@ -188,27 +198,29 @@ gimage_repaint_handler (GimpImage* gimage, gint x, gint y, gint w, gint h)
/* These really belong in the layer class */ /* These really belong in the layer class */
void void
gimage_set_layer_mask_apply (GImage *gimage, GimpLayer* layer) gimage_set_layer_mask_apply (GImage *gimage,
GimpLayer *layer)
{ {
int off_x, off_y; int off_x, off_y;
g_return_if_fail(gimage); g_return_if_fail (gimage);
g_return_if_fail(layer); g_return_if_fail (layer);
if (! layer->mask) if (! layer->mask)
return; return;
layer->apply_mask = ! layer->apply_mask; layer->apply_mask = ! layer->apply_mask;
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y); drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
gdisplays_update_area (gimage, off_x, off_y, gdisplays_update_area (gimage, off_x, off_y,
drawable_width (GIMP_DRAWABLE(layer)), drawable_width (GIMP_DRAWABLE (layer)),
drawable_height (GIMP_DRAWABLE(layer))); drawable_height (GIMP_DRAWABLE (layer)));
} }
void void
gimage_set_layer_mask_edit (GImage *gimage, Layer * layer, int edit) gimage_set_layer_mask_edit (GImage *gimage,
Layer *layer,
int edit)
{ {
/* find the layer */ /* find the layer */
if (!layer) if (!layer)
@ -220,24 +232,32 @@ gimage_set_layer_mask_edit (GImage *gimage, Layer * layer, int edit)
void void
gimage_set_layer_mask_show (GImage *gimage, GimpLayer* layer) gimage_set_layer_mask_show (GImage *gimage,
GimpLayer *layer)
{ {
int off_x, off_y; int off_x, off_y;
g_return_if_fail(gimage); g_return_if_fail (gimage);
g_return_if_fail(layer); g_return_if_fail (layer);
if (! layer->mask) if (! layer->mask)
return; return;
layer->show_mask = ! layer->show_mask; layer->show_mask = ! layer->show_mask;
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y); drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
gdisplays_update_area (gimage, off_x, off_y, gdisplays_update_area (gimage, off_x, off_y,
drawable_width (GIMP_DRAWABLE(layer)), drawable_height (GIMP_DRAWABLE(layer))); drawable_width (GIMP_DRAWABLE (layer)),
drawable_height (GIMP_DRAWABLE (layer)));
} }
void void
gimage_foreach (GFunc func, gpointer user_data){ gimage_foreach (GFunc func,
gimp_set_foreach(image_context, func, user_data); gpointer user_data)
{
gimp_set_foreach (image_context, func, user_data);
} }

View File

@ -24,29 +24,14 @@
typedef GimpImage GImage; typedef GimpImage GImage;
GImage* GImage* gimage_new (int width, int height, GimpImageBaseType base_type);
gimage_new(int width, int height, GimpImageBaseType base_type); GImage* gimage_get_ID (gint ID);
void gimage_delete (GImage *gimage);
GImage* void gimage_invalidate_previews (void);
gimage_get_ID (gint ID); void gimage_set_layer_mask_apply (GImage *gimage, GimpLayer *layer);
void gimage_set_layer_mask_edit (GImage *gimage, GimpLayer *layer, int edit);
void void gimage_set_layer_mask_show (GImage *gimage, GimpLayer *layer);
gimage_delete (GImage *gimage); void gimage_foreach (GFunc func, gpointer user_data);
void
gimage_invalidate_previews (void);
void
gimage_set_layer_mask_apply (GImage *gimage, GimpLayer* layer);
void
gimage_set_layer_mask_edit (GImage *gimage, GimpLayer * layer, int edit);
void
gimage_set_layer_mask_show (GImage *gimage, GimpLayer* layer);
void
gimage_foreach (GFunc func, gpointer user_data);
#define gimage_set_filename gimp_image_set_filename #define gimage_set_filename gimp_image_set_filename

View File

@ -142,7 +142,8 @@ gimp_image_class_init (GimpImageClass *klass)
/* static functions */ /* static functions */
static void gimp_image_init (GimpImage *gimage) static void
gimp_image_init (GimpImage *gimage)
{ {
gimage->has_filename = 0; gimage->has_filename = 0;
gimage->num_cols = 0; gimage->num_cols = 0;
@ -176,15 +177,18 @@ static void gimp_image_init (GimpImage *gimage)
gimage->paths = NULL; gimage->paths = NULL;
} }
GtkType gimp_image_get_type(void){ GtkType
static GtkType type; gimp_image_get_type (void)
GIMP_TYPE_INIT(type, {
GimpImage, static GtkType type;
GimpImageClass,
gimp_image_init, GIMP_TYPE_INIT(type,
gimp_image_class_init, GimpImage,
GIMP_TYPE_OBJECT); GimpImageClass,
return type; gimp_image_init,
gimp_image_class_init,
GIMP_TYPE_OBJECT);
return type;
} }
@ -231,7 +235,10 @@ gimp_image_free_projection (GimpImage *gimage)
} }
static void static void
gimp_image_allocate_shadow (GimpImage *gimage, int width, int height, int bpp) gimp_image_allocate_shadow (GimpImage *gimage,
int width,
int height,
int bpp)
{ {
/* allocate the new projection */ /* allocate the new projection */
gimage->shadow = tile_manager_new (width, height, bpp); gimage->shadow = tile_manager_new (width, height, bpp);
@ -342,7 +349,7 @@ gimp_image_get_resolution (GimpImage *gimage,
void void
gimp_image_set_unit (GimpImage *gimage, gimp_image_set_unit (GimpImage *gimage,
GUnit unit) GUnit unit)
{ {
gimage->unit = unit; gimage->unit = unit;
} }
@ -355,7 +362,8 @@ gimp_image_get_unit (GimpImage *gimage)
void void
gimp_image_set_save_proc (GimpImage *gimage, PlugInProcDef *proc) gimp_image_set_save_proc (GimpImage *gimage,
PlugInProcDef *proc)
{ {
gimage->save_proc = proc; gimage->save_proc = proc;
} }
@ -414,10 +422,9 @@ gimp_image_resize (GimpImage *gimage,
while (guide_list) while (guide_list)
{ {
Guide *guide; Guide *guide;
GList *next;
guide = (Guide*) guide_list->data; guide = (Guide*) guide_list->data;
next = g_list_next (guide_list); guide_list = g_list_next (guide_list);
switch (guide->orientation) switch (guide->orientation)
{ {
@ -434,7 +441,6 @@ gimp_image_resize (GimpImage *gimage,
default: default:
g_error("Unknown guide orientation I.\n"); g_error("Unknown guide orientation I.\n");
} }
guide_list = next;
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
@ -469,11 +475,11 @@ gimp_image_scale (GimpImage *gimage,
int new_height) int new_height)
{ {
Channel *channel; Channel *channel;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
GSList *list; GSList *list;
GList *glist; GList *glist;
Guide *guide; Guide *guide;
int old_width, old_height; int old_width, old_height;
int layer_width, layer_height; int layer_width, layer_height;
@ -590,21 +596,22 @@ gimp_image_free_shadow (GimpImage *gimage)
static void static void
gimp_image_destroy (GtkObject *object) gimp_image_destroy (GtkObject *object)
{ {
GimpImage* gimage=GIMP_IMAGE(object); GimpImage* gimage = GIMP_IMAGE(object);
gimp_image_free_projection (gimage);
gimp_image_free_shadow (gimage);
if (gimage->cmap)
g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage); gimp_image_free_projection (gimage);
gimp_image_free_channels (gimage); gimp_image_free_shadow (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites) if (gimage->cmap)
gtk_object_unref(GTK_OBJECT(gimage->parasites)); g_free (gimage->cmap);
if (gimage->has_filename)
g_free (gimage->filename);
gimp_image_free_layers (gimage);
gimp_image_free_channels (gimage);
channel_delete (gimage->selection_mask);
if (gimage->parasites)
gtk_object_unref(GTK_OBJECT(gimage->parasites));
} }
void void
@ -619,7 +626,7 @@ gimp_image_apply_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR, maskPR; PixelRegion src1PR, destPR, maskPR;
@ -715,7 +722,7 @@ gimp_image_replace_image (GimpImage *gimage,
int x, int x,
int y) int y)
{ {
Channel * mask; Channel *mask;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int offset_x, offset_y; int offset_x, offset_y;
PixelRegion src1PR, destPR; PixelRegion src1PR, destPR;
@ -971,8 +978,6 @@ gimp_image_transform_color (GimpImage *gimage,
Guide* Guide*
gimp_image_add_hguide (GimpImage *gimage) gimp_image_add_hguide (GimpImage *gimage)
{ {
@ -1061,7 +1066,7 @@ gimp_image_attach_parasite (GimpImage *gimage,
Parasite *parasite) Parasite *parasite)
{ {
/* only set the dirty bit manually if we can be saved and the new /* only set the dirty bit manually if we can be saved and the new
parasite differs from the current one and we arn't undoable */ parasite differs from the current one and we aren't undoable */
if (parasite_is_undoable(parasite)) if (parasite_is_undoable(parasite))
undo_push_image_parasite (gimage, parasite); undo_push_image_parasite (gimage, parasite);
if (parasite_is_persistent(parasite) if (parasite_is_persistent(parasite)
@ -1081,6 +1086,7 @@ gimp_image_detach_parasite (GimpImage *gimage,
const char *parasite) const char *parasite)
{ {
Parasite *p; Parasite *p;
if (!(p = parasite_list_find(gimage->parasites, parasite))) if (!(p = parasite_list_find(gimage->parasites, parasite)))
return; return;
if (parasite_is_undoable(p)) if (parasite_is_undoable(p))
@ -1223,7 +1229,7 @@ static void
gimp_image_free_layers (GimpImage *gimage) gimp_image_free_layers (GimpImage *gimage)
{ {
GSList *list = gimage->layers; GSList *list = gimage->layers;
Layer * layer; Layer *layer;
while (list) while (list)
{ {
@ -1239,8 +1245,8 @@ gimp_image_free_layers (GimpImage *gimage)
static void static void
gimp_image_free_channels (GimpImage *gimage) gimp_image_free_channels (GimpImage *gimage)
{ {
GSList *list = gimage->channels; GSList *list = gimage->channels;
Channel * channel; Channel *channel;
while (list) while (list)
{ {
@ -1602,8 +1608,8 @@ gimp_image_construct (GimpImage *gimage,
} }
void void
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y, gimp_image_invalidate_without_render (GimpImage *gimage,
int w, int h, int x, int y, int w, int h,
int x1, int y1, int x2, int y2) int x1, int y1, int x2, int y2)
{ {
Tile *tile; Tile *tile;
@ -1634,14 +1640,8 @@ gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
void void
gimp_image_invalidate (GimpImage *gimage, gimp_image_invalidate (GimpImage *gimage,
int x, int x, int y, int w, int h,
int y, int x1, int y1, int x2, int y2)
int w,
int h,
int x1,
int y1,
int x2,
int y2)
{ {
Tile *tile; Tile *tile;
TileManager *tm; TileManager *tm;

View File

@ -613,6 +613,7 @@ brush_select_brush_changed (BrushSelectP bsp,
{ {
display_brushes (bsp); display_brushes (bsp);
gtk_widget_draw (bsp->preview, NULL); gtk_widget_draw (bsp->preview, NULL);
update_active_brush_field (bsp);
} }
} }

View File

@ -25,14 +25,15 @@
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"
void ops_button_pressed_callback (GtkWidget*, GdkEventButton*, gpointer); void ops_button_pressed_callback (GtkWidget*, GdkEventButton*, gpointer);
void ops_button_extended_callback (GtkWidget*, gpointer); void ops_button_extended_callback (GtkWidget*, gpointer);
GtkWidget *ops_button_box_new (GtkWidget *parent, GtkWidget *
GtkTooltips *tool_tips, ops_button_box_new (GtkWidget *parent,
OpsButton *ops_button, GtkTooltips *tool_tips,
OpsButtonType ops_type) OpsButton *ops_button,
OpsButtonType ops_type)
{ {
GtkWidget *button; GtkWidget *button;
GtkWidget *button_box; GtkWidget *button_box;
@ -125,9 +126,9 @@ ops_button_box_set_insensitive (OpsButton *ops_button)
} }
void void
ops_button_pressed_callback (GtkWidget *widget, ops_button_pressed_callback (GtkWidget *widget,
GdkEventButton *bevent, GdkEventButton *bevent,
gpointer client_data) gpointer client_data)
{ {
OpsButton *ops_button; OpsButton *ops_button;

View File

@ -40,19 +40,19 @@ typedef enum {
struct _OpsButton struct _OpsButton
{ {
gchar **xpm_data; /* xpm data for the button */ gchar **xpm_data; /* xpm data for the button */
OpsButtonCallback callback; OpsButtonCallback callback; /* callback function */
OpsButtonCallback *ext_callbacks; OpsButtonCallback *ext_callbacks; /* callback functions when modifiers are pressed */
char *tooltip; char *tooltip;
GtkWidget *widget; /* the button widget */ GtkWidget *widget; /* the button widget */
gint modifier; gint modifier;
}; };
/* Function declarations */ /* Function declarations */
GtkWidget * ops_button_box_new (GtkWidget *, /* parent widget */ GtkWidget * ops_button_box_new (GtkWidget *, /* parent widget */
GtkTooltips *, GtkTooltips *,
OpsButton *, OpsButton *,
OpsButtonType); OpsButtonType);
void ops_button_box_set_insensitive (OpsButton *); void ops_button_box_set_insensitive (OpsButton *);

View File

@ -68,12 +68,13 @@ static void pixel_region_configure (PixelRegionHolder *, PixelRegionIterator
/* Function definitions */ /* Function definitions */
void void
pixel_region_init (PR, tiles, x, y, w, h, dirty) pixel_region_init (PixelRegion *PR,
PixelRegion *PR; TileManager *tiles,
TileManager *tiles; int x,
int x, y; int y,
int w, h; int w,
int dirty; int h,
int dirty)
{ {
PR->tiles = tiles; PR->tiles = tiles;
PR->curtile = NULL; PR->curtile = NULL;
@ -89,10 +90,11 @@ pixel_region_init (PR, tiles, x, y, w, h, dirty)
void void
pixel_region_resize (PR, x, y, w, h) pixel_region_resize (PixelRegion *PR,
PixelRegion *PR; int x,
int x, y; int y,
int w, h; int w,
int h)
{ {
/* If the data is non-null, data is contiguous--need to advance */ /* If the data is non-null, data is contiguous--need to advance */
if (PR->data != NULL) if (PR->data != NULL)
@ -107,15 +109,14 @@ pixel_region_resize (PR, x, y, w, h)
PR->h = h; PR->h = h;
} }
/* request that tiles within a region be fetched asynchronously
*/ /* request that tiles within a region be fetched asynchronously */
void void
pixel_region_get_async (PR, ulx, uly, lrx, lry) pixel_region_get_async (PixelRegion *PR,
PixelRegion *PR; int ulx,
int ulx; int uly,
int uly; int lrx,
int lrx; int lry)
int lry;
{ {
int x, y; int x, y;
@ -124,13 +125,14 @@ pixel_region_get_async (PR, ulx, uly, lrx, lry)
tile_manager_get_async (PR->tiles, x, y); tile_manager_get_async (PR->tiles, x, y);
} }
void void
pixel_region_get_row (PR, x, y, w, data, subsample) pixel_region_get_row (PixelRegion *PR,
PixelRegion *PR; int x,
int x, y; int y,
int w; int w,
unsigned char *data; unsigned char *data,
int subsample; int subsample)
{ {
Tile *tile; Tile *tile;
unsigned char *tile_data; unsigned char *tile_data;
@ -176,11 +178,11 @@ pixel_region_get_row (PR, x, y, w, data, subsample)
void void
pixel_region_set_row (PR, x, y, w, data) pixel_region_set_row (PixelRegion *PR,
PixelRegion *PR; int x,
int x, y; int y,
int w; int w,
unsigned char *data; unsigned char *data)
{ {
Tile *tile; Tile *tile;
unsigned char *tile_data; unsigned char *tile_data;
@ -212,12 +214,12 @@ pixel_region_set_row (PR, x, y, w, data)
void void
pixel_region_get_col (PR, x, y, h, data, subsample) pixel_region_get_col (PixelRegion *PR,
PixelRegion *PR; int x,
int x, y; int y,
int h; int h,
unsigned char *data; unsigned char *data,
int subsample; int subsample)
{ {
Tile *tile; Tile *tile;
unsigned char *tile_data; unsigned char *tile_data;
@ -253,11 +255,11 @@ pixel_region_get_col (PR, x, y, h, data, subsample)
void void
pixel_region_set_col (PR, x, y, h, data) pixel_region_set_col (PixelRegion *PR,
PixelRegion *PR; int x,
int x, y; int y,
int h; int h,
unsigned char *data; unsigned char *data)
{ {
Tile *tile; Tile *tile;
unsigned char *tile_data; unsigned char *tile_data;
@ -292,7 +294,8 @@ pixel_region_set_col (PR, x, y, h, data)
} }
void * void *
pixel_regions_register (int num_regions, ...) pixel_regions_register (int num_regions,
...)
{ {
PixelRegion *PR; PixelRegion *PR;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
@ -345,8 +348,7 @@ pixel_regions_register (int num_regions, ...)
void * void *
pixel_regions_process (PRI_ptr) pixel_regions_process (void *PRI_ptr)
void *PRI_ptr;
{ {
GSList *list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
@ -392,8 +394,7 @@ pixel_regions_process (PRI_ptr)
} }
void void
pixel_regions_process_stop (PRI_ptr) pixel_regions_process_stop (void *PRI_ptr)
void *PRI_ptr;
{ {
GSList *list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
@ -445,8 +446,7 @@ pixel_regions_process_stop (PRI_ptr)
/* Static Function Definitions */ /* Static Function Definitions */
static int static int
get_portion_height (PRI) get_portion_height (PixelRegionIterator *PRI)
PixelRegionIterator *PRI;
{ {
GSList *list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
@ -488,8 +488,7 @@ get_portion_height (PRI)
static int static int
get_portion_width (PRI) get_portion_width (PixelRegionIterator *PRI)
PixelRegionIterator *PRI;
{ {
GSList *list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
@ -531,8 +530,7 @@ get_portion_width (PRI)
static void * static void *
pixel_regions_configure (PRI) pixel_regions_configure (PixelRegionIterator *PRI)
PixelRegionIterator *PRI;
{ {
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
GSList *list; GSList *list;
@ -580,9 +578,8 @@ pixel_regions_configure (PRI)
static void static void
pixel_region_configure (PRH, PRI) pixel_region_configure (PixelRegionHolder *PRH,
PixelRegionHolder *PRH; PixelRegionIterator *PRI)
PixelRegionIterator *PRI;
{ {
/* Configure the rowstride and data pointer for the pixel region /* Configure the rowstride and data pointer for the pixel region
* based on the current offsets into the region and whether the * based on the current offsets into the region and whether the
@ -590,7 +587,8 @@ pixel_region_configure (PRH, PRI)
*/ */
if (PRH->PR->tiles) if (PRH->PR->tiles)
{ {
PRH->PR->curtile = tile_manager_get_tile (PRH->PR->tiles, PRH->PR->x, PRH->PR->y, TRUE, PRH->PR->dirty); PRH->PR->curtile =
tile_manager_get_tile (PRH->PR->tiles, PRH->PR->x, PRH->PR->y, TRUE, PRH->PR->dirty);
PRH->PR->offx = PRH->PR->x % TILE_WIDTH; PRH->PR->offx = PRH->PR->x % TILE_WIDTH;
PRH->PR->offy = PRH->PR->y % TILE_HEIGHT; PRH->PR->offy = PRH->PR->y % TILE_HEIGHT;

View File

@ -47,16 +47,15 @@
static unsigned char * temp_buf_allocate (unsigned int); static unsigned char * temp_buf_allocate (unsigned int);
static void temp_buf_to_color (TempBuf *, TempBuf *); static void temp_buf_to_color (TempBuf *, TempBuf *);
static void temp_buf_to_gray (TempBuf *, TempBuf *); static void temp_buf_to_gray (TempBuf *, TempBuf *);
/* Memory management */ /* Memory management */
static unsigned char * static unsigned char *
temp_buf_allocate (size) temp_buf_allocate (unsigned int size)
unsigned int size;
{ {
unsigned char * data; unsigned char *data;
data = (unsigned char *) g_malloc (size); data = (unsigned char *) g_malloc (size);
@ -67,9 +66,8 @@ temp_buf_allocate (size)
/* The conversion routines */ /* The conversion routines */
static void static void
temp_buf_to_color (src_buf, dest_buf) temp_buf_to_color (TempBuf *src_buf,
TempBuf * src_buf; TempBuf *dest_buf)
TempBuf * dest_buf;
{ {
unsigned char *src; unsigned char *src;
unsigned char *dest; unsigned char *dest;
@ -92,13 +90,12 @@ temp_buf_to_color (src_buf, dest_buf)
static void static void
temp_buf_to_gray (src_buf, dest_buf) temp_buf_to_gray (TempBuf *src_buf,
TempBuf * src_buf; TempBuf *dest_buf)
TempBuf * dest_buf;
{ {
unsigned char *src; unsigned char *src;
unsigned char *dest; unsigned char *dest;
long num_bytes; long num_bytes;
float pix; float pix;
src = temp_buf_data (src_buf); src = temp_buf_data (src_buf);
@ -121,15 +118,15 @@ temp_buf_to_gray (src_buf, dest_buf)
TempBuf * TempBuf *
temp_buf_new (width, height, bytes, x, y, col) temp_buf_new (int width,
int width; int height,
int height; int bytes,
int bytes; int x,
int x, y; int y,
unsigned char * col; unsigned char *col)
{ {
long i; long i;
int j; int j;
unsigned char * data; unsigned char * data;
TempBuf * temp; TempBuf * temp;
@ -190,9 +187,8 @@ temp_buf_new (width, height, bytes, x, y, col)
TempBuf * TempBuf *
temp_buf_copy (src, dest) temp_buf_copy (TempBuf *src,
TempBuf * src; TempBuf *dest)
TempBuf * dest;
{ {
TempBuf * new; TempBuf * new;
long length; long length;
@ -233,11 +229,12 @@ temp_buf_copy (src, dest)
TempBuf * TempBuf *
temp_buf_resize (buf, bytes, x, y, w, h) temp_buf_resize (TempBuf *buf,
TempBuf * buf; int bytes,
int bytes; int x,
int x, y; int y,
int w, h; int w,
int h)
{ {
int size; int size;
@ -271,12 +268,13 @@ temp_buf_resize (buf, bytes, x, y, w, h)
TempBuf * TempBuf *
temp_buf_copy_area (src, dest, x, y, w, h, border) temp_buf_copy_area (TempBuf *src,
TempBuf * src; TempBuf *dest,
TempBuf * dest; int x,
int x, y; int y,
int w, h; int w,
int border; int h,
int border)
{ {
TempBuf * new; TempBuf * new;
PixelRegion srcR, destR; PixelRegion srcR, destR;
@ -333,8 +331,7 @@ temp_buf_copy_area (src, dest, x, y, w, h, border)
void void
temp_buf_free (temp_buf) temp_buf_free (TempBuf *temp_buf)
TempBuf * temp_buf;
{ {
if (temp_buf->data) if (temp_buf->data)
g_free (temp_buf->data); g_free (temp_buf->data);
@ -347,8 +344,7 @@ temp_buf_free (temp_buf)
unsigned char * unsigned char *
temp_buf_data (temp_buf) temp_buf_data (TempBuf *temp_buf)
TempBuf * temp_buf;
{ {
if (temp_buf->swapped) if (temp_buf->swapped)
temp_buf_unswap (temp_buf); temp_buf_unswap (temp_buf);
@ -363,9 +359,8 @@ temp_buf_data (temp_buf)
MaskBuf * MaskBuf *
mask_buf_new (width, height) mask_buf_new (int width,
int width; int height)
int height;
{ {
static unsigned char empty = 0; static unsigned char empty = 0;
@ -374,16 +369,14 @@ mask_buf_new (width, height)
void void
mask_buf_free (mask) mask_buf_free (MaskBuf *mask)
MaskBuf * mask;
{ {
temp_buf_free ((TempBuf *) mask); temp_buf_free ((TempBuf *) mask);
} }
unsigned char * unsigned char *
mask_buf_data (mask_buf) mask_buf_data (MaskBuf *mask_buf)
MaskBuf * mask_buf;
{ {
if (mask_buf->swapped) if (mask_buf->swapped)
temp_buf_unswap (mask_buf); temp_buf_unswap (mask_buf);
@ -411,13 +404,14 @@ mask_buf_data (mask_buf)
* from disk. In the former case, cached_in_memory is set to NULL; * from disk. In the former case, cached_in_memory is set to NULL;
* in the latter case, cached_in_memory is left unchanged. * in the latter case, cached_in_memory is left unchanged.
* If temp_buf_swap_free is called, cached_in_memory must be checked * If temp_buf_swap_free is called, cached_in_memory must be checked
* against the temp buf being freed. If they are the same, then cached_in_memory * against the temp buf being freed. If they are the same, then
* must be set to NULL; * cached_in_memory must be set to NULL;
* *
* In the case where memory usage is set to "stingy": * In the case where memory usage is set to "stingy":
* temp bufs are not cached in memory at all, they go right to disk. * temp bufs are not cached in memory at all, they go right to disk.
*/ */
/* a static counter for generating unique filenames */ /* a static counter for generating unique filenames */
static int swap_index = 0; static int swap_index = 0;
@ -436,8 +430,7 @@ generate_unique_filename (void)
void void
temp_buf_swap (buf) temp_buf_swap (TempBuf *buf)
TempBuf * buf;
{ {
TempBuf * swap; TempBuf * swap;
char * filename; char * filename;
@ -511,8 +504,7 @@ temp_buf_swap (buf)
void void
temp_buf_unswap (buf) temp_buf_unswap (TempBuf *buf)
TempBuf * buf;
{ {
struct stat stat_buf; struct stat stat_buf;
FILE * fp; FILE * fp;
@ -563,8 +555,7 @@ temp_buf_unswap (buf)
void void
temp_buf_swap_free (buf) temp_buf_swap_free (TempBuf *buf)
TempBuf * buf;
{ {
struct stat stat_buf; struct stat stat_buf;

View File

@ -103,8 +103,8 @@ void undo_free_qmask (int, void *);
/* Sizing functions */ /* Sizing functions */
static int layer_size (Layer *); static int layer_size (Layer *);
static int channel_size (Channel *); static int channel_size (Channel *);
static int group_count = 0; static int group_count = 0;
static int shrink_wrap = FALSE; static int shrink_wrap = FALSE;
@ -117,7 +117,8 @@ layer_size (Layer *layer)
{ {
int size; int size;
size = sizeof (Layer) + GIMP_DRAWABLE(layer)->width * GIMP_DRAWABLE(layer)->height * GIMP_DRAWABLE(layer)->bytes + size = sizeof (Layer) +
GIMP_DRAWABLE(layer)->width * GIMP_DRAWABLE(layer)->height * GIMP_DRAWABLE(layer)->bytes +
strlen (GIMP_DRAWABLE(layer)->name); strlen (GIMP_DRAWABLE(layer)->name);
if (layer_mask (layer)) if (layer_mask (layer))
@ -276,7 +277,7 @@ static int
pop_stack (GImage *gimage, pop_stack (GImage *gimage,
GSList **stack_ptr, GSList **stack_ptr,
GSList **unstack_ptr, GSList **unstack_ptr,
int state) int state)
{ {
Undo * object; Undo * object;
GSList *stack; GSList *stack;
@ -452,12 +453,12 @@ struct _image_undo
int int
undo_push_image (GImage *gimage, undo_push_image (GImage *gimage,
GimpDrawable *drawable, GimpDrawable *drawable,
int x1, int x1,
int y1, int y1,
int x2, int x2,
int y2) int y2)
{ {
long size; long size;
Undo *new; Undo *new;
@ -509,14 +510,14 @@ undo_push_image (GImage *gimage,
int int
undo_push_image_mod (GImage *gimage, undo_push_image_mod (GImage *gimage,
GimpDrawable *drawable, GimpDrawable *drawable,
int x1, int x1,
int y1, int y1,
int x2, int x2,
int y2, int y2,
void *tiles_ptr, void *tiles_ptr,
int sparse) int sparse)
{ {
long size; long size;
int dwidth, dheight; int dwidth, dheight;
@ -803,7 +804,7 @@ undo_free_mask (int state,
/* Layer displacement Undo functions */ /* Layer displacement Undo functions */
int int
undo_push_layer_displace (GImage *gimage, undo_push_layer_displace (GImage *gimage,
GimpLayer *layer) GimpLayer *layer)
{ {
Undo * new; Undo * new;
@ -1218,7 +1219,8 @@ undo_push_layer_mod (GImage *gimage,
tiles = GIMP_DRAWABLE(layer)->tiles; tiles = GIMP_DRAWABLE(layer)->tiles;
tiles->x = GIMP_DRAWABLE(layer)->offset_x; tiles->x = GIMP_DRAWABLE(layer)->offset_x;
tiles->y = GIMP_DRAWABLE(layer)->offset_y; tiles->y = GIMP_DRAWABLE(layer)->offset_y;
size = GIMP_DRAWABLE(layer)->width * GIMP_DRAWABLE(layer)->height * GIMP_DRAWABLE(layer)->bytes + sizeof (void *) * 3; size = GIMP_DRAWABLE(layer)->width * GIMP_DRAWABLE(layer)->height *
GIMP_DRAWABLE(layer)->bytes + sizeof (void *) * 3;
if ((new = undo_push (gimage, size, LAYER_MOD))) if ((new = undo_push (gimage, size, LAYER_MOD)))
{ {
@ -1306,7 +1308,8 @@ undo_pop_layer_mod (GImage *gimage,
data[1] = temp; data[1] = temp;
/* Issue the second update */ /* Issue the second update */
drawable_update (GIMP_DRAWABLE(layer), 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height); drawable_update (GIMP_DRAWABLE(layer), 0, 0,
GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height);
return TRUE; return TRUE;
} }
@ -1398,7 +1401,8 @@ undo_pop_layer_mask (GImage *gimage,
* this is undoing an add... * this is undoing an add...
*/ */
if ((state == REDO && lmu->mode == DISCARD) || state == UNDO) if ((state == REDO && lmu->mode == DISCARD) || state == UNDO)
drawable_update (GIMP_DRAWABLE(lmu->layer), 0, 0, GIMP_DRAWABLE(lmu->layer)->width, GIMP_DRAWABLE(lmu->layer)->height); drawable_update (GIMP_DRAWABLE(lmu->layer), 0, 0,
GIMP_DRAWABLE(lmu->layer)->width, GIMP_DRAWABLE(lmu->layer)->height);
} }
/* restore layer */ /* restore layer */
else else
@ -1415,7 +1419,8 @@ undo_pop_layer_mask (GImage *gimage,
* this is redoing an add * this is redoing an add
*/ */
if ((state == UNDO && lmu->mode == DISCARD) || state == REDO) if ((state == UNDO && lmu->mode == DISCARD) || state == REDO)
drawable_update (GIMP_DRAWABLE(lmu->layer), 0, 0, GIMP_DRAWABLE(lmu->layer)->width, GIMP_DRAWABLE(lmu->layer)->height); drawable_update (GIMP_DRAWABLE(lmu->layer), 0, 0,
GIMP_DRAWABLE(lmu->layer)->width, GIMP_DRAWABLE(lmu->layer)->height);
} }
return TRUE; return TRUE;
@ -1515,7 +1520,8 @@ undo_pop_channel (GImage *gimage,
gimage_set_active_channel (gimage, cu->prev_channel); gimage_set_active_channel (gimage, cu->prev_channel);
/* update the area */ /* update the area */
drawable_update (GIMP_DRAWABLE(cu->channel), 0, 0, GIMP_DRAWABLE(cu->channel)->width, GIMP_DRAWABLE(cu->channel)->height); drawable_update (GIMP_DRAWABLE(cu->channel), 0, 0,
GIMP_DRAWABLE(cu->channel)->width, GIMP_DRAWABLE(cu->channel)->height);
} }
/* restore channel */ /* restore channel */
else else
@ -1530,7 +1536,8 @@ undo_pop_channel (GImage *gimage,
gimage_set_active_channel (gimage, cu->channel); gimage_set_active_channel (gimage, cu->channel);
/* update the area */ /* update the area */
drawable_update (GIMP_DRAWABLE(cu->channel), 0, 0, GIMP_DRAWABLE(cu->channel)->width, GIMP_DRAWABLE(cu->channel)->height); drawable_update (GIMP_DRAWABLE(cu->channel), 0, 0,
GIMP_DRAWABLE(cu->channel)->width, GIMP_DRAWABLE(cu->channel)->height);
} }
return TRUE; return TRUE;
@ -1629,7 +1636,8 @@ undo_pop_channel_mod (GImage *gimage,
tiles = (TileManager *) data[1]; tiles = (TileManager *) data[1];
/* Issue the first update */ /* Issue the first update */
drawable_update (GIMP_DRAWABLE(channel), 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height); drawable_update (GIMP_DRAWABLE(channel), 0, 0,
GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height);
temp = GIMP_DRAWABLE(channel)->tiles; temp = GIMP_DRAWABLE(channel)->tiles;
GIMP_DRAWABLE(channel)->tiles = tiles; GIMP_DRAWABLE(channel)->tiles = tiles;
@ -1640,7 +1648,8 @@ undo_pop_channel_mod (GImage *gimage,
data[1] = temp; data[1] = temp;
/* Issue the second update */ /* Issue the second update */
drawable_update (GIMP_DRAWABLE(channel), 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height); drawable_update (GIMP_DRAWABLE(channel), 0, 0,
GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height);
return TRUE; return TRUE;
} }
@ -1727,8 +1736,11 @@ undo_pop_fs_to_layer (GImage *gimage,
gimage->floating_sel = fsu->layer; gimage->floating_sel = fsu->layer;
/* restore the contents of the drawable */ /* restore the contents of the drawable */
floating_sel_store (fsu->layer, GIMP_DRAWABLE(fsu->layer)->offset_x, GIMP_DRAWABLE(fsu->layer)->offset_y, floating_sel_store (fsu->layer,
GIMP_DRAWABLE(fsu->layer)->width, GIMP_DRAWABLE(fsu->layer)->height); GIMP_DRAWABLE(fsu->layer)->offset_x,
GIMP_DRAWABLE(fsu->layer)->offset_y,
GIMP_DRAWABLE(fsu->layer)->width,
GIMP_DRAWABLE(fsu->layer)->height);
fsu->layer->fs.initial = TRUE; fsu->layer->fs.initial = TRUE;
/* clear the selection */ /* clear the selection */
@ -1740,8 +1752,11 @@ undo_pop_fs_to_layer (GImage *gimage,
case REDO: case REDO:
/* restore the contents of the drawable */ /* restore the contents of the drawable */
floating_sel_restore (fsu->layer, GIMP_DRAWABLE(fsu->layer)->offset_x, GIMP_DRAWABLE(fsu->layer)->offset_y, floating_sel_restore (fsu->layer,
GIMP_DRAWABLE(fsu->layer)->width, GIMP_DRAWABLE(fsu->layer)->height); GIMP_DRAWABLE(fsu->layer)->offset_x,
GIMP_DRAWABLE(fsu->layer)->offset_y,
GIMP_DRAWABLE(fsu->layer)->width,
GIMP_DRAWABLE(fsu->layer)->height);
/* Update the preview for the gimage and underlying drawable */ /* Update the preview for the gimage and underlying drawable */
drawable_invalidate_preview (GIMP_DRAWABLE(fsu->layer)); drawable_invalidate_preview (GIMP_DRAWABLE(fsu->layer));
@ -1824,16 +1839,20 @@ undo_pop_fs_rigor (GImage *gimage,
/* restore the contents of drawable the floating layer is attached to */ /* restore the contents of drawable the floating layer is attached to */
if (floating_layer->fs.initial == FALSE) if (floating_layer->fs.initial == FALSE)
floating_sel_restore (floating_layer, floating_sel_restore (floating_layer,
GIMP_DRAWABLE(floating_layer)->offset_x, GIMP_DRAWABLE(floating_layer)->offset_y, GIMP_DRAWABLE(floating_layer)->offset_x,
GIMP_DRAWABLE(floating_layer)->width, GIMP_DRAWABLE(floating_layer)->height); GIMP_DRAWABLE(floating_layer)->offset_y,
GIMP_DRAWABLE(floating_layer)->width,
GIMP_DRAWABLE(floating_layer)->height);
floating_layer->fs.initial = TRUE; floating_layer->fs.initial = TRUE;
break; break;
case REDO: case REDO:
/* store the affected area from the drawable in the backing store */ /* store the affected area from the drawable in the backing store */
floating_sel_store (floating_layer, floating_sel_store (floating_layer,
GIMP_DRAWABLE(floating_layer)->offset_x, GIMP_DRAWABLE(floating_layer)->offset_y, GIMP_DRAWABLE(floating_layer)->offset_x,
GIMP_DRAWABLE(floating_layer)->width, GIMP_DRAWABLE(floating_layer)->height); GIMP_DRAWABLE(floating_layer)->offset_y,
GIMP_DRAWABLE(floating_layer)->width,
GIMP_DRAWABLE(floating_layer)->height);
floating_layer->fs.initial = TRUE; floating_layer->fs.initial = TRUE;
break; break;
} }
@ -1897,8 +1916,10 @@ undo_pop_fs_relax (GImage *gimage,
case UNDO: case UNDO:
/* store the affected area from the drawable in the backing store */ /* store the affected area from the drawable in the backing store */
floating_sel_store (floating_layer, floating_sel_store (floating_layer,
GIMP_DRAWABLE(floating_layer)->offset_x, GIMP_DRAWABLE(floating_layer)->offset_y, GIMP_DRAWABLE(floating_layer)->offset_x,
GIMP_DRAWABLE(floating_layer)->width, GIMP_DRAWABLE(floating_layer)->height); GIMP_DRAWABLE(floating_layer)->offset_y,
GIMP_DRAWABLE(floating_layer)->width,
GIMP_DRAWABLE(floating_layer)->height);
floating_layer->fs.initial = TRUE; floating_layer->fs.initial = TRUE;
break; break;
@ -1906,8 +1927,10 @@ undo_pop_fs_relax (GImage *gimage,
/* restore the contents of drawable the floating layer is attached to */ /* restore the contents of drawable the floating layer is attached to */
if (floating_layer->fs.initial == FALSE) if (floating_layer->fs.initial == FALSE)
floating_sel_restore (floating_layer, floating_sel_restore (floating_layer,
GIMP_DRAWABLE(floating_layer)->offset_x, GIMP_DRAWABLE(floating_layer)->offset_y, GIMP_DRAWABLE(floating_layer)->offset_x,
GIMP_DRAWABLE(floating_layer)->width, GIMP_DRAWABLE(floating_layer)->height); GIMP_DRAWABLE(floating_layer)->offset_y,
GIMP_DRAWABLE(floating_layer)->width,
GIMP_DRAWABLE(floating_layer)->height);
floating_layer->fs.initial = TRUE; floating_layer->fs.initial = TRUE;
break; break;
} }
@ -2063,7 +2086,6 @@ undo_pop_qmask (GImage *gimage,
{ {
QmaskUndo *data; QmaskUndo *data;
int tmp; int tmp;
int tmp_ref;
data = data_ptr; data = data_ptr;
@ -2195,10 +2217,10 @@ typedef struct _ParasiteUndo ParasiteUndo;
struct _ParasiteUndo struct _ParasiteUndo
{ {
GImage *gimage; GImage *gimage;
GimpDrawable *drawable; GimpDrawable *drawable;
Parasite *parasite; Parasite *parasite;
char *name; char *name;
}; };
int int
@ -2223,8 +2245,8 @@ undo_push_image_parasite (GImage *gimage,
data->gimage = gimage; data->gimage = gimage;
data->drawable = NULL; data->drawable = NULL;
data->name = g_strdup(parasite_name(parasite)); data->name = g_strdup (parasite_name (parasite));
data->parasite = parasite_copy(gimp_image_find_parasite(gimage, data->name)); data->parasite = parasite_copy (gimp_image_find_parasite (gimage, data->name));
return TRUE; return TRUE;
} }
@ -2254,8 +2276,8 @@ undo_push_image_parasite_remove (GImage *gimage,
data->gimage = gimage; data->gimage = gimage;
data->drawable = NULL; data->drawable = NULL;
data->name = g_strdup(name); data->name = g_strdup (name);
data->parasite = parasite_copy(gimp_image_find_parasite(gimage, data->name)); data->parasite = parasite_copy (gimp_image_find_parasite (gimage, data->name));
return TRUE; return TRUE;
} }
@ -2286,8 +2308,8 @@ undo_push_drawable_parasite (GImage *gimage,
data->gimage = NULL; data->gimage = NULL;
data->drawable = drawable; data->drawable = drawable;
data->name = g_strdup(parasite_name(parasite)); data->name = g_strdup (parasite_name (parasite));
data->parasite = parasite_copy(gimp_drawable_find_parasite(drawable, data->name)); data->parasite = parasite_copy (gimp_drawable_find_parasite (drawable, data->name));
return TRUE; return TRUE;
} }
@ -2317,8 +2339,8 @@ undo_push_drawable_parasite_remove (GImage *gimage,
data->gimage = NULL; data->gimage = NULL;
data->drawable = drawable; data->drawable = drawable;
data->name = g_strdup(name); data->name = g_strdup (name);
data->parasite = parasite_copy(gimp_drawable_find_parasite(drawable, data->name)); data->parasite = parasite_copy (gimp_drawable_find_parasite (drawable, data->name));
return TRUE; return TRUE;
} }
@ -2328,9 +2350,9 @@ undo_push_drawable_parasite_remove (GImage *gimage,
int int
undo_pop_parasite (GImage *gimage, undo_pop_parasite (GImage *gimage,
int state, int state,
int type, int type,
void *data_ptr) void *data_ptr)
{ {
ParasiteUndo *data; ParasiteUndo *data;
Parasite *tmp; Parasite *tmp;
@ -2341,33 +2363,33 @@ undo_pop_parasite (GImage *gimage,
if (data->gimage) if (data->gimage)
{ {
data->parasite = parasite_copy(gimp_image_find_parasite(gimage, data->parasite = parasite_copy (gimp_image_find_parasite (gimage,
data->name)); data->name));
if (tmp) if (tmp)
parasite_list_add(data->gimage->parasites, tmp); parasite_list_add (data->gimage->parasites, tmp);
else else
parasite_list_remove(data->gimage->parasites, data->name); parasite_list_remove (data->gimage->parasites, data->name);
} }
else if (data->drawable) else if (data->drawable)
{ {
data->parasite = parasite_copy(gimp_drawable_find_parasite(data->drawable, data->parasite = parasite_copy (gimp_drawable_find_parasite (data->drawable,
data->name)); data->name));
if (tmp) if (tmp)
parasite_list_add(data->drawable->parasites, tmp); parasite_list_add (data->drawable->parasites, tmp);
else else
parasite_list_remove(data->drawable->parasites, data->name); parasite_list_remove (data->drawable->parasites, data->name);
} }
else else
{ {
data->parasite = parasite_copy(gimp_find_parasite(data->name)); data->parasite = parasite_copy (gimp_find_parasite (data->name));
if (tmp) if (tmp)
gimp_attach_parasite(tmp); gimp_attach_parasite (tmp);
else else
gimp_detach_parasite(data->name); gimp_detach_parasite (data->name);
} }
if (tmp) if (tmp)
parasite_free(tmp); parasite_free (tmp);
/* if ((tmp && parasite_is_persistant(tmp)) || */ /* if ((tmp && parasite_is_persistant(tmp)) || */
/* (data->parasite && parasite_is_persistant(data->parasite))) */ /* (data->parasite && parasite_is_persistant(data->parasite))) */
@ -2387,7 +2409,7 @@ undo_pop_parasite (GImage *gimage,
void void
undo_free_parasite (int state, undo_free_parasite (int state,
void *data_ptr) void *data_ptr)
{ {
ParasiteUndo *data; ParasiteUndo *data;