removed all usage of linked.[ch] and switched to GSLists

-Yosh
This commit is contained in:
Manish Singh 1998-01-29 08:03:27 +00:00
parent 9af736f243
commit 89b600d2bc
90 changed files with 1369 additions and 1760 deletions

View File

@ -1,3 +1,7 @@
Thu Jan 29 00:00:54 PST 1998 Manish Singh <yosh@gimp.org>
* removed all usage of linked.[ch] and switched to GSLists
Wed Jan 28 22:03:42 EST 1998 Adrian Likins <adrian@gimp.org> Wed Jan 28 22:03:42 EST 1998 Adrian Likins <adrian@gimp.org>
* Fixed carve-it.scm and circuit.scm (circuit broke due * Fixed carve-it.scm and circuit.scm (circuit broke due

View File

@ -179,8 +179,6 @@ gimp_SOURCES = \
layers_dialogP.h \ layers_dialogP.h \
levels.c \ levels.c \
levels.h \ levels.h \
linked.h \
linked.c \
magnify.c \ magnify.c \
magnify.h \ magnify.h \
main.c \ main.c \

View File

@ -2,5 +2,4 @@ convert to using gtk+
remove traces of autodialog remove traces of autodialog
remove traces of action areas remove traces of action areas
remove use of mem chunks from memutils.[ch] remove use of mem chunks from memutils.[ch]
remove use of linked.[ch]
remove use of xmalloc and xfree (use g_malloc and g_free instead) remove use of xmalloc and xfree (use g_malloc and g_free instead)

View File

@ -20,7 +20,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include "appenv.h" #include "appenv.h"
#include "linked.h"
#include "pixel_region.h" #include "pixel_region.h"
#include "tile_manager_pvt.h" #include "tile_manager_pvt.h"
@ -40,7 +39,7 @@ typedef struct _PixelRegionIterator PixelRegionIterator;
struct _PixelRegionIterator struct _PixelRegionIterator
{ {
link_ptr pixel_regions; GSList *pixel_regions;
int region_width; int region_width;
int region_height; int region_height;
int portion_width; int portion_width;
@ -292,7 +291,7 @@ pixel_regions_register (int num_regions, ...)
} }
/* Add the pixel region holder to the list */ /* Add the pixel region holder to the list */
PRI->pixel_regions = add_to_list (PRI->pixel_regions, PRH); PRI->pixel_regions = g_slist_prepend (PRI->pixel_regions, PRH);
} }
va_end (ap); va_end (ap);
@ -305,7 +304,7 @@ void *
pixel_regions_process (PRI_ptr) pixel_regions_process (PRI_ptr)
void *PRI_ptr; void *PRI_ptr;
{ {
link_ptr list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
PixelRegionIterator *PRI; PixelRegionIterator *PRI;
@ -342,7 +341,7 @@ pixel_regions_process (PRI_ptr)
} }
} }
list = next_item (list); list = g_slist_next (list);
} }
return pixel_regions_configure (PRI); return pixel_regions_configure (PRI);
@ -352,7 +351,7 @@ void
pixel_regions_process_stop (PRI_ptr) pixel_regions_process_stop (PRI_ptr)
void *PRI_ptr; void *PRI_ptr;
{ {
link_ptr list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
PixelRegionIterator *PRI; PixelRegionIterator *PRI;
@ -381,7 +380,7 @@ pixel_regions_process_stop (PRI_ptr)
} }
} }
list = next_item (list); list = g_slist_next (list);
} }
if (PRI->pixel_regions) if (PRI->pixel_regions)
@ -390,9 +389,9 @@ pixel_regions_process_stop (PRI_ptr)
while (list) while (list)
{ {
g_free (list->data); g_free (list->data);
list = next_item (list); list = g_slist_next (list);
} }
free_list (PRI->pixel_regions); g_slist_free (PRI->pixel_regions);
g_free (PRI); g_free (PRI);
} }
} }
@ -405,7 +404,7 @@ static int
get_portion_height (PRI) get_portion_height (PRI)
PixelRegionIterator *PRI; PixelRegionIterator *PRI;
{ {
link_ptr list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
int min_height = G_MAXINT; int min_height = G_MAXINT;
int height; int height;
@ -437,7 +436,7 @@ get_portion_height (PRI)
min_height = height; min_height = height;
} }
list = next_item (list); list = g_slist_next (list);
} }
return min_height; return min_height;
@ -448,7 +447,7 @@ static int
get_portion_width (PRI) get_portion_width (PRI)
PixelRegionIterator *PRI; PixelRegionIterator *PRI;
{ {
link_ptr list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
int min_width = G_MAXINT; int min_width = G_MAXINT;
int width; int width;
@ -480,7 +479,7 @@ get_portion_width (PRI)
min_width = width; min_width = width;
} }
list = next_item (list); list = g_slist_next (list);
} }
return min_width; return min_width;
@ -492,7 +491,7 @@ pixel_regions_configure (PRI)
PixelRegionIterator *PRI; PixelRegionIterator *PRI;
{ {
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
link_ptr list; GSList *list;
/* Determine the portion width and height */ /* Determine the portion width and height */
PRI->portion_width = get_portion_width (PRI); PRI->portion_width = get_portion_width (PRI);
@ -507,9 +506,9 @@ pixel_regions_configure (PRI)
while (list) while (list)
{ {
g_free (list->data); g_free (list->data);
list = next_item (list); list = g_slist_next (list);
} }
free_list (PRI->pixel_regions); g_slist_free (PRI->pixel_regions);
g_free (PRI); g_free (PRI);
} }
@ -529,7 +528,7 @@ pixel_regions_configure (PRI)
pixel_region_configure (PRH, PRI); pixel_region_configure (PRH, PRI);
} }
list = next_item (list); list = g_slist_next (list);
} }
return PRI; return PRI;

View File

@ -25,7 +25,6 @@
#include "errors.h" #include "errors.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "linked.h"
#include "rect_select.h" #include "rect_select.h"
#define BEZIER_START 1 #define BEZIER_START 1
@ -71,7 +70,7 @@ struct _bezier_select
BezierPoint *last_point; /* the last point on the curve */ BezierPoint *last_point; /* the last point on the curve */
int num_points; /* number of points in the curve */ int num_points; /* number of points in the curve */
Channel *mask; /* null if the curve is open */ Channel *mask; /* null if the curve is open */
link_ptr *scanlines; /* used in converting a curve */ GSList **scanlines; /* used in converting a curve */
}; };
static void bezier_select_reset (BezierSelect *); static void bezier_select_reset (BezierSelect *);
@ -95,8 +94,8 @@ static void bezier_compose (BezierMatrix, BezierMatrix, BezierMa
static void bezier_convert (BezierSelect *, GDisplay *, int, int); static void bezier_convert (BezierSelect *, GDisplay *, int, int);
static void bezier_convert_points (BezierSelect *, GdkPoint *, int); static void bezier_convert_points (BezierSelect *, GdkPoint *, int);
static void bezier_convert_line (link_ptr *, int, int, int, int); static void bezier_convert_line (GSList **, int, int, int, int);
static link_ptr bezier_insert_in_list (link_ptr, int); static GSList * bezier_insert_in_list (GSList *, int);
static BezierMatrix basis = static BezierMatrix basis =
{ {
@ -1042,7 +1041,7 @@ bezier_convert (BezierSelect *bezier_sel,
PixelRegion maskPR; PixelRegion maskPR;
BezierPoint * points; BezierPoint * points;
BezierPoint * start_pt; BezierPoint * start_pt;
link_ptr list; GSList * list;
unsigned char *buf, *b; unsigned char *buf, *b;
int draw_type; int draw_type;
int * vals, val; int * vals, val;
@ -1084,7 +1083,7 @@ bezier_convert (BezierSelect *bezier_sel,
gdisp->gimage->height); gdisp->gimage->height);
/* allocate room for the scanlines */ /* allocate room for the scanlines */
bezier_sel->scanlines = g_malloc (sizeof (link_ptr) * height); bezier_sel->scanlines = g_malloc (sizeof (GSList *) * height);
/* zero out the scanlines */ /* zero out the scanlines */
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
@ -1146,7 +1145,7 @@ bezier_convert (BezierSelect *bezier_sel,
for (j = 0; j < w; j++) for (j = 0; j < w; j++)
vals[j + x] += 255; vals[j + x] += 255;
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1168,7 +1167,7 @@ bezier_convert (BezierSelect *bezier_sel,
drawable_width (GIMP_DRAWABLE(bezier_sel->mask)), buf); drawable_width (GIMP_DRAWABLE(bezier_sel->mask)), buf);
} }
free_list (bezier_sel->scanlines[i]); g_slist_free (bezier_sel->scanlines[i]);
} }
if (antialias) if (antialias)
@ -1207,7 +1206,7 @@ bezier_convert_points (BezierSelect *bezier_sel,
} }
static void static void
bezier_convert_line (link_ptr *scanlines, bezier_convert_line (GSList ** scanlines,
int x1, int x1,
int y1, int y1,
int x2, int x2,
@ -1323,32 +1322,32 @@ bezier_convert_line (link_ptr *scanlines,
} }
} }
static link_ptr static GSList *
bezier_insert_in_list (link_ptr list, bezier_insert_in_list (GSList * list,
int x) int x)
{ {
link_ptr orig = list; GSList * orig = list;
link_ptr rest; GSList * rest;
if (!list) if (!list)
return add_to_list (list, (void *) ((long) x)); return g_slist_prepend (list, (void *) ((long) x));
while (list) while (list)
{ {
rest = next_item (list); rest = g_slist_next (list);
if (x < (long) list->data) if (x < (long) list->data)
{ {
rest = add_to_list (rest, list->data); rest = g_slist_prepend (rest, list->data);
list->next = rest; list->next = rest;
list->data = (void *) ((long) x); list->data = (void *) ((long) x);
return orig; return orig;
} }
else if (!rest) else if (!rest)
{ {
append_to_list (list, (void *) ((long) x)); g_slist_append (list, (void *) ((long) x));
return orig; return orig;
} }
list = next_item (list); list = g_slist_next (list);
} }
return orig; return orig;

View File

@ -468,7 +468,7 @@ display_setup (BrushSelectP bsp)
static void static void
display_brushes (BrushSelectP bsp) display_brushes (BrushSelectP bsp)
{ {
link_ptr list = brush_list; /* the global brush list */ GSList * list = brush_list; /* the global brush list */
int row, col; int row, col;
GBrushP brush; GBrushP brush;
@ -500,7 +500,7 @@ display_brushes (BrushSelectP bsp)
col = 0; col = 0;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }

View File

@ -32,13 +32,12 @@
#include "errors.h" #include "errors.h"
#include "general.h" #include "general.h"
#include "gimprc.h" #include "gimprc.h"
#include "linked.h"
#include "menus.h" #include "menus.h"
/* global variables */ /* global variables */
GBrushP active_brush = NULL; GBrushP active_brush = NULL;
link_ptr brush_list = NULL; GSList * brush_list = NULL;
int num_brushes = 0; int num_brushes = 0;
double opacity = 1.0; double opacity = 1.0;
@ -54,19 +53,21 @@ static Argument *return_args;
static int have_default_brush = 0; static int have_default_brush = 0;
/* static function prototypes */ /* static function prototypes */
static link_ptr insert_brush_in_list (link_ptr, GBrushP); static GSList * insert_brush_in_list (GSList *, GBrushP);
static void create_default_brush (void); static void create_default_brush (void);
static void load_brush (char *filename); static void load_brush (char *filename);
static void free_brush (GBrushP); static void free_brush (GBrushP);
static void brushes_free_one (gpointer, gpointer);
static gint brush_compare_func (gpointer, gpointer);
/* function declarations */ /* function declarations */
void void
brushes_init () brushes_init ()
{ {
link_ptr list; GSList * list;
if (brush_list) if (brush_list)
brushes_free (); brushes_free();
brush_list = NULL; brush_list = NULL;
num_brushes = 0; num_brushes = 0;
@ -81,30 +82,34 @@ brushes_init ()
list = brush_list; list = brush_list;
while (list) { while (list) {
/* Set the brush index */ /* Set the brush index */
((GBrush *) list->data)->index = num_brushes++;
((GBrush *) list->data)->index = num_brushes++; list = g_slist_next (list);
list = next_item (list);
} }
} }
static void
brushes_free_one (gpointer data, gpointer dummy)
{
free_brush ((GBrushP) data);
}
static gint
brush_compare_func (gpointer first, gpointer second)
{
return strcmp (((GBrushP)first)->name, ((GBrushP)second)->name);
}
void void
brushes_free () brushes_free ()
{ {
link_ptr list; if (brush_list) {
GBrushP brush; g_slist_foreach (brush_list, brushes_free_one, NULL);
g_slist_free (brush_list);
list = brush_list; }
while (list)
{
brush = (GBrushP) list->data;
free_brush (brush);
list = next_item (list);
}
free_list (list);
have_default_brush = 0; have_default_brush = 0;
active_brush = NULL; active_brush = NULL;
@ -140,67 +145,10 @@ get_active_brush ()
} }
static link_ptr static GSList *
insert_brush_in_list (list, brush) insert_brush_in_list (GSList *list, GBrushP brush)
link_ptr list;
GBrushP brush;
{ {
link_ptr tmp; return g_slist_insert_sorted (list, brush, brush_compare_func);
link_ptr prev;
link_ptr new_link;
GBrushP b;
int val;
/* Insert the item in the list */
if (list)
{
prev = NULL;
tmp = list;
do {
if (tmp)
{
b = (GBrushP) tmp->data;
/* do the comparison needed for the insertion sort */
val = strcmp (brush->name, b->name);
}
else
val = -1;
if (val <= 0)
{
/* this is the place the item goes */
/* Insert the item into the list. We'll have to create
* a new link and then do a little insertion.
*/
new_link = alloc_list ();
if (!new_link)
fatal_error ("Unable to allocate memory");
new_link->data = brush;
new_link->next = tmp;
if (prev)
prev->next = new_link;
if (tmp == list)
list = new_link;
return list;
}
/* Advance to the next item in the list.
*/
prev = tmp;
tmp = next_item (tmp);
} while (prev);
}
else
/* There are no items in the brush list, so we'll just start
* one right now.
*/
list = add_to_list (list, brush);
return list;
} }
static void static void
@ -341,29 +289,21 @@ load_brush(char *filename)
GBrushP GBrushP
get_brush_by_index (index) get_brush_by_index (int index)
int index;
{ {
link_ptr list; GSList *list;
GBrushP brush; GBrushP brush = NULL;
list = brush_list; list = g_slist_nth (brush_list, index);
if (list)
brush = (GBrushP) list->data;
while (list) return brush;
{
brush = (GBrushP) list->data;
if (brush->index == index)
return brush;
list = next_item (list);
}
return NULL;
} }
void void
select_brush (brush) select_brush (GBrushP brush)
GBrushP brush;
{ {
/* Make sure the active brush is swapped before we get a new one... */ /* Make sure the active brush is swapped before we get a new one... */
if (stingy_memory_use) if (stingy_memory_use)
@ -579,7 +519,7 @@ static Argument *
brushes_set_brush_invoker (Argument *args) brushes_set_brush_invoker (Argument *args)
{ {
GBrushP brushp; GBrushP brushp;
link_ptr list; GSList *list;
char *name; char *name;
success = (name = (char *) args[0].value.pdb_pointer) != NULL; success = (name = (char *) args[0].value.pdb_pointer) != NULL;
@ -600,7 +540,7 @@ brushes_set_brush_invoker (Argument *args)
break; break;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -925,7 +865,7 @@ static Argument *
brushes_list_invoker (Argument *args) brushes_list_invoker (Argument *args)
{ {
GBrushP brushp; GBrushP brushp;
link_ptr list; GSList *list;
char **brushes; char **brushes;
int i; int i;
@ -939,7 +879,7 @@ brushes_list_invoker (Argument *args)
brushp = (GBrushP) list->data; brushp = (GBrushP) list->data;
brushes[i++] = g_strdup (brushp->name); brushes[i++] = g_strdup (brushp->name);
list = next_item (list); list = g_slist_next (list);
} }
return_args = procedural_db_return_args (&brushes_list_proc, success); return_args = procedural_db_return_args (&brushes_list_proc, success);

View File

@ -18,7 +18,7 @@
#ifndef __BRUSHES_H__ #ifndef __BRUSHES_H__
#define __BRUSHES_H__ #define __BRUSHES_H__
#include "linked.h" #include <glib.h>
#include "procedural_db.h" #include "procedural_db.h"
#include "temp_buf.h" #include "temp_buf.h"
@ -35,7 +35,7 @@ struct _GBrush
}; };
/* global variables */ /* global variables */
extern link_ptr brush_list; extern GSList * brush_list;
extern int num_brushes; extern int num_brushes;

View File

@ -26,7 +26,6 @@
#include "errors.h" #include "errors.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "layer.h" #include "layer.h"
#include "linked.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -412,7 +411,7 @@ channel_preview (Channel *channel, int width, int height)
void void
channel_invalidate_previews (int gimage_id) channel_invalidate_previews (int gimage_id)
{ {
link_ptr tmp; GSList * tmp;
Channel * channel; Channel * channel;
GImage * gimage; GImage * gimage;
@ -425,7 +424,7 @@ channel_invalidate_previews (int gimage_id)
{ {
channel = (Channel *) tmp->data; channel = (Channel *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE(channel)); drawable_invalidate_preview (GIMP_DRAWABLE(channel));
tmp = next_item (tmp); tmp = g_slist_next (tmp);
} }
} }

View File

@ -94,7 +94,7 @@ struct _ChannelsDialog {
int gimage_id; int gimage_id;
Channel * active_channel; Channel * active_channel;
Layer *floating_sel; Layer *floating_sel;
link_ptr channel_widgets; GSList *channel_widgets;
}; };
/* channels dialog widget routines */ /* channels dialog widget routines */
@ -230,7 +230,7 @@ channels_dialog_flush ()
GImage *gimage; GImage *gimage;
Channel *channel; Channel *channel;
ChannelWidget *cw; ChannelWidget *cw;
link_ptr list; GSList *list;
int gimage_pos; int gimage_pos;
int pos; int pos;
@ -255,7 +255,7 @@ channels_dialog_flush ()
{ {
cw = (ChannelWidget *) list->data; cw = (ChannelWidget *) list->data;
cw->visited = FALSE; cw->visited = FALSE;
list = next_item (list); list = g_slist_next (list);
} }
/* Add any missing channels */ /* Add any missing channels */
@ -271,7 +271,7 @@ channels_dialog_flush ()
else else
cw->visited = TRUE; cw->visited = TRUE;
list = next_item (list); list = g_slist_next (list);
} }
/* Remove any extraneous auxillary channels */ /* Remove any extraneous auxillary channels */
@ -279,7 +279,7 @@ channels_dialog_flush ()
while (list) while (list)
{ {
cw = (ChannelWidget *) list->data; cw = (ChannelWidget *) list->data;
list = next_item (list); list = g_slist_next (list);
if (cw->visited == FALSE && cw->type == Auxillary) if (cw->visited == FALSE && cw->type == Auxillary)
/* will only be true for auxillary channels */ /* will only be true for auxillary channels */
@ -292,7 +292,7 @@ channels_dialog_flush ()
while (list) while (list)
{ {
cw = (ChannelWidget *) list->data; cw = (ChannelWidget *) list->data;
list = next_item (list); list = g_slist_next (list);
if (cw->type == Auxillary) if (cw->type == Auxillary)
if ((gimage_pos = gimage_get_channel_index (gimage, cw->channel)) != pos) if ((gimage_pos = gimage_get_channel_index (gimage, cw->channel)) != pos)
@ -326,7 +326,7 @@ channels_dialog_update (int gimage_id)
ChannelWidget *cw; ChannelWidget *cw;
GImage *gimage; GImage *gimage;
Channel *channel; Channel *channel;
link_ptr list; GSList *list;
GList *item_list; GList *item_list;
if (!channelsD) if (!channelsD)
@ -345,7 +345,7 @@ channels_dialog_update (int gimage_id)
while (list) while (list)
{ {
cw = (ChannelWidget *) list->data; cw = (ChannelWidget *) list->data;
list = next_item(list); list = g_slist_next (list);
channel_widget_delete (cw); channel_widget_delete (cw);
} }
channelsD->channel_widgets = NULL; channelsD->channel_widgets = NULL;
@ -365,17 +365,17 @@ channels_dialog_update (int gimage_id)
{ {
case RGB: case RGB:
cw = create_channel_widget (gimage, NULL, Red); cw = create_channel_widget (gimage, NULL, Red);
channelsD->channel_widgets = append_to_list (channelsD->channel_widgets, cw); channelsD->channel_widgets = g_slist_append (channelsD->channel_widgets, cw);
item_list = g_list_append (item_list, cw->list_item); item_list = g_list_append (item_list, cw->list_item);
channelsD->components[0] = Red; channelsD->components[0] = Red;
cw = create_channel_widget (gimage, NULL, Green); cw = create_channel_widget (gimage, NULL, Green);
channelsD->channel_widgets = append_to_list (channelsD->channel_widgets, cw); channelsD->channel_widgets = g_slist_append (channelsD->channel_widgets, cw);
item_list = g_list_append (item_list, cw->list_item); item_list = g_list_append (item_list, cw->list_item);
channelsD->components[1] = Green; channelsD->components[1] = Green;
cw = create_channel_widget (gimage, NULL, Blue); cw = create_channel_widget (gimage, NULL, Blue);
channelsD->channel_widgets = append_to_list (channelsD->channel_widgets, cw); channelsD->channel_widgets = g_slist_append (channelsD->channel_widgets, cw);
item_list = g_list_append (item_list, cw->list_item); item_list = g_list_append (item_list, cw->list_item);
channelsD->components[2] = Blue; channelsD->components[2] = Blue;
@ -384,7 +384,7 @@ channels_dialog_update (int gimage_id)
case GRAY: case GRAY:
cw = create_channel_widget (gimage, NULL, Gray); cw = create_channel_widget (gimage, NULL, Gray);
channelsD->channel_widgets = append_to_list (channelsD->channel_widgets, cw); channelsD->channel_widgets = g_slist_append (channelsD->channel_widgets, cw);
item_list = g_list_append (item_list, cw->list_item); item_list = g_list_append (item_list, cw->list_item);
channelsD->components[0] = Gray; channelsD->components[0] = Gray;
@ -393,7 +393,7 @@ channels_dialog_update (int gimage_id)
case INDEXED: case INDEXED:
cw = create_channel_widget (gimage, NULL, Indexed); cw = create_channel_widget (gimage, NULL, Indexed);
channelsD->channel_widgets = append_to_list (channelsD->channel_widgets, cw); channelsD->channel_widgets = g_slist_append (channelsD->channel_widgets, cw);
item_list = g_list_append (item_list, cw->list_item); item_list = g_list_append (item_list, cw->list_item);
channelsD->components[0] = Indexed; channelsD->components[0] = Indexed;
@ -408,10 +408,10 @@ channels_dialog_update (int gimage_id)
/* create a channel list item */ /* create a channel list item */
channel = (Channel *) list->data; channel = (Channel *) list->data;
cw = create_channel_widget (gimage, channel, Auxillary); cw = create_channel_widget (gimage, channel, Auxillary);
channelsD->channel_widgets = append_to_list (channelsD->channel_widgets, cw); channelsD->channel_widgets = g_slist_append (channelsD->channel_widgets, cw);
item_list = g_list_append (item_list, cw->list_item); item_list = g_list_append (item_list, cw->list_item);
list = next_item (list); list = g_slist_next (list);
} }
/* get the index of the active channel */ /* get the index of the active channel */
@ -431,7 +431,7 @@ channels_dialog_clear ()
void void
channels_dialog_free () channels_dialog_free ()
{ {
link_ptr list; GSList *list;
ChannelWidget *cw; ChannelWidget *cw;
if (channelsD == NULL) if (channelsD == NULL)
@ -446,7 +446,7 @@ channels_dialog_free ()
while (list) while (list)
{ {
cw = (ChannelWidget *) list->data; cw = (ChannelWidget *) list->data;
list = next_item(list); list = g_slist_next (list);
channel_widget_delete (cw); channel_widget_delete (cw);
} }
channelsD->channel_widgets = NULL; channelsD->channel_widgets = NULL;
@ -677,7 +677,7 @@ channels_dialog_add_channel (Channel *channel)
item_list = g_list_append (item_list, channel_widget->list_item); item_list = g_list_append (item_list, channel_widget->list_item);
position = gimage_get_channel_index (gimage, channel); position = gimage_get_channel_index (gimage, channel);
channelsD->channel_widgets = insert_in_list (channelsD->channel_widgets, channel_widget, channelsD->channel_widgets = g_slist_insert (channelsD->channel_widgets, channel_widget,
position + channelsD->num_components); position + channelsD->num_components);
gtk_list_insert_items (GTK_LIST (channelsD->channel_list), item_list, gtk_list_insert_items (GTK_LIST (channelsD->channel_list), item_list,
position + channelsD->num_components); position + channelsD->num_components);
@ -920,7 +920,7 @@ static ChannelWidget *
channel_widget_get_ID (Channel *channel) channel_widget_get_ID (Channel *channel)
{ {
ChannelWidget *lw; ChannelWidget *lw;
link_ptr list; GSList *list;
if (!channelsD) if (!channelsD)
return NULL; return NULL;
@ -933,7 +933,7 @@ channel_widget_get_ID (Channel *channel)
if (lw->channel == channel) if (lw->channel == channel)
return lw; return lw;
list = next_item(list); list = g_slist_next (list);
} }
return NULL; return NULL;
@ -1042,7 +1042,7 @@ channel_widget_delete (ChannelWidget *channel_widget)
gdk_pixmap_unref (channel_widget->channel_pixmap); gdk_pixmap_unref (channel_widget->channel_pixmap);
/* Remove the channel widget from the list */ /* Remove the channel widget from the list */
channelsD->channel_widgets = remove_from_list (channelsD->channel_widgets, channel_widget); channelsD->channel_widgets = g_slist_remove (channelsD->channel_widgets, channel_widget);
/* Free the widget */ /* Free the widget */
g_free (channel_widget); g_free (channel_widget);
@ -1476,7 +1476,7 @@ channel_widget_eye_redraw (ChannelWidget *channel_widget)
static void static void
channel_widget_exclusive_visible (ChannelWidget *channel_widget) channel_widget_exclusive_visible (ChannelWidget *channel_widget)
{ {
link_ptr list; GSList *list;
ChannelWidget *cw; ChannelWidget *cw;
int visible = FALSE; int visible = FALSE;
@ -1501,7 +1501,7 @@ channel_widget_exclusive_visible (ChannelWidget *channel_widget)
} }
} }
list = next_item (list); list = g_slist_next (list);
} }
/* Now, toggle the visibility for all channels except the specified one */ /* Now, toggle the visibility for all channels except the specified one */
@ -1532,7 +1532,7 @@ channel_widget_exclusive_visible (ChannelWidget *channel_widget)
channel_widget_eye_redraw (cw); channel_widget_eye_redraw (cw);
list = next_item (list); list = g_slist_next (list);
} }
} }

View File

@ -459,7 +459,7 @@ static GtkWidget *
build_palette_menu(int *default_palette){ build_palette_menu(int *default_palette){
GtkWidget *menu; GtkWidget *menu;
GtkWidget *menu_item; GtkWidget *menu_item;
link_ptr list; GSList *list;
PaletteEntriesP entries; PaletteEntriesP entries;
int i; int i;
@ -478,7 +478,7 @@ build_palette_menu(int *default_palette){
for(i=0,list = palette_entries_list,*default_palette=-1; for(i=0,list = palette_entries_list,*default_palette=-1;
list; list;
i++,list = next_item (list)) i++,list = g_slist_next (list))
{ {
entries = (PaletteEntriesP) list->data; entries = (PaletteEntriesP) list->data;
/* fprintf(stderr, "(palette %s)\n", entries->filename);*/ /* fprintf(stderr, "(palette %s)\n", entries->filename);*/
@ -600,7 +600,7 @@ convert_image (GImage *gimage,
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
int old_type; int old_type;
link_ptr list; GSList *list;
int new_layer_type; int new_layer_type;
int new_layer_bytes; int new_layer_bytes;
int has_alpha; int has_alpha;
@ -656,7 +656,7 @@ convert_image (GImage *gimage,
while (list) while (list)
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
list = next_item (list); list = g_slist_next (list);
if (old_type == GRAY) if (old_type == GRAY)
generate_histogram_gray (quantobj->histogram, layer); generate_histogram_gray (quantobj->histogram, layer);
else else
@ -722,7 +722,7 @@ convert_image (GImage *gimage,
while (list) while (list)
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
list = next_item (list); list = g_slist_next (list);
has_alpha = layer_has_alpha (layer); has_alpha = layer_has_alpha (layer);
switch (new_type) switch (new_type)
@ -2024,7 +2024,7 @@ static void
custompal_pass1 (QuantizeObj *quantobj) custompal_pass1 (QuantizeObj *quantobj)
{ {
int i; int i;
link_ptr list; GSList *list;
PaletteEntryP entry; PaletteEntryP entry;
/* fprintf(stderr, "custompal_pass1: using (theCustomPalette %s) from (file %s)\n", /* fprintf(stderr, "custompal_pass1: using (theCustomPalette %s) from (file %s)\n",
@ -2032,7 +2032,7 @@ custompal_pass1 (QuantizeObj *quantobj)
for (i=0,list=theCustomPalette->colors; for (i=0,list=theCustomPalette->colors;
list; list;
i++,list=next_item(list)) i++,list=g_slist_next(list))
{ {
entry=(PaletteEntryP)list->data; entry=(PaletteEntryP)list->data;
quantobj->cmap[i].red = entry->color[0]; quantobj->cmap[i].red = entry->color[0];
@ -3036,7 +3036,7 @@ convert_indexed_palette_invoker (Argument *args)
if (success) if (success)
{ {
PaletteEntriesP entries, the_palette = NULL; PaletteEntriesP entries, the_palette = NULL;
link_ptr list; GSList *list;
palette_type = args[2].value.pdb_int; palette_type = args[2].value.pdb_int;
switch(palette_type) { switch(palette_type) {
@ -3057,7 +3057,7 @@ convert_indexed_palette_invoker (Argument *args)
if (!palette_entries_list) palette_init_palettes(); if (!palette_entries_list) palette_init_palettes();
for(list = palette_entries_list; for(list = palette_entries_list;
list; list;
list = next_item(list)) { list = g_slist_next(list)) {
entries = (PaletteEntriesP) list->data; entries = (PaletteEntriesP) list->data;
if (strcmp(palette_name, entries->name)==0) { if (strcmp(palette_name, entries->name)==0) {
/* fprintf(stderr, "found it!\n"); */ /* fprintf(stderr, "found it!\n"); */

View File

@ -27,7 +27,6 @@
#include "global_edit.h" #include "global_edit.h"
#include "interface.h" #include "interface.h"
#include "layer.h" #include "layer.h"
#include "linked.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "tools.h" #include "tools.h"
#include "undo.h" #include "undo.h"
@ -57,7 +56,7 @@ struct _named_buffer
/* The named buffer list */ /* The named buffer list */
link_ptr named_buffers = NULL; GSList * named_buffers = NULL;
/* The global edit buffer */ /* The global edit buffer */
TileManager * global_buf = NULL; TileManager * global_buf = NULL;
@ -449,7 +448,7 @@ global_edit_free ()
static void static void
set_list_of_named_buffers (GtkWidget *list_widget) set_list_of_named_buffers (GtkWidget *list_widget)
{ {
link_ptr list; GSList *list;
NamedBuffer *nb; NamedBuffer *nb;
GtkWidget *list_item; GtkWidget *list_item;
@ -459,7 +458,7 @@ set_list_of_named_buffers (GtkWidget *list_widget)
while (list) while (list)
{ {
nb = (NamedBuffer *) list->data; nb = (NamedBuffer *) list->data;
list = next_item (list); list = g_slist_next (list);
list_item = gtk_list_item_new_with_label (nb->name); list_item = gtk_list_item_new_with_label (nb->name);
gtk_container_add (GTK_CONTAINER (list_widget), list_item); gtk_container_add (GTK_CONTAINER (list_widget), list_item);
@ -513,7 +512,7 @@ named_buffer_delete_foreach (GtkWidget *w,
{ {
pn_dlg = (PasteNamedDlg *) client_data; pn_dlg = (PasteNamedDlg *) client_data;
nb = (NamedBuffer *) gtk_object_get_user_data (GTK_OBJECT (w)); nb = (NamedBuffer *) gtk_object_get_user_data (GTK_OBJECT (w));
named_buffers = remove_from_list (named_buffers, (void *) nb); named_buffers = g_slist_remove (named_buffers, (void *) nb);
g_free (nb->name); g_free (nb->name);
tile_manager_destroy (nb->buf); tile_manager_destroy (nb->buf);
g_free (nb); g_free (nb);
@ -653,7 +652,7 @@ new_named_buffer_callback (GtkWidget *w,
copy_region (&srcPR, &destPR); copy_region (&srcPR, &destPR);
nb->name = g_strdup ((char *) call_data); nb->name = g_strdup ((char *) call_data);
named_buffers = append_to_list (named_buffers, (void *) nb); named_buffers = g_slist_append (named_buffers, (void *) nb);
} }
static void static void
@ -717,7 +716,7 @@ named_edit_paste (void *gdisp_ptr)
void void
named_buffers_free () named_buffers_free ()
{ {
link_ptr list; GSList *list;
NamedBuffer * nb; NamedBuffer * nb;
list = named_buffers; list = named_buffers;
@ -728,9 +727,9 @@ named_buffers_free ()
tile_manager_destroy (nb->buf); tile_manager_destroy (nb->buf);
g_free (nb->name); g_free (nb->name);
g_free (nb); g_free (nb);
list = next_item (list); list = g_slist_next (list);
} }
free_list (named_buffers); g_slist_free (named_buffers);
named_buffers = NULL; named_buffers = NULL;
} }

View File

@ -26,7 +26,6 @@
#include "errors.h" #include "errors.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "layer.h" #include "layer.h"
#include "linked.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -412,7 +411,7 @@ channel_preview (Channel *channel, int width, int height)
void void
channel_invalidate_previews (int gimage_id) channel_invalidate_previews (int gimage_id)
{ {
link_ptr tmp; GSList * tmp;
Channel * channel; Channel * channel;
GImage * gimage; GImage * gimage;
@ -425,7 +424,7 @@ channel_invalidate_previews (int gimage_id)
{ {
channel = (Channel *) tmp->data; channel = (Channel *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE(channel)); drawable_invalidate_preview (GIMP_DRAWABLE(channel));
tmp = next_item (tmp); tmp = g_slist_next (tmp);
} }
} }

View File

@ -26,7 +26,6 @@
#include "errors.h" #include "errors.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "layer.h" #include "layer.h"
#include "linked.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -412,7 +411,7 @@ channel_preview (Channel *channel, int width, int height)
void void
channel_invalidate_previews (int gimage_id) channel_invalidate_previews (int gimage_id)
{ {
link_ptr tmp; GSList * tmp;
Channel * channel; Channel * channel;
GImage * gimage; GImage * gimage;
@ -425,7 +424,7 @@ channel_invalidate_previews (int gimage_id)
{ {
channel = (Channel *) tmp->data; channel = (Channel *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE(channel)); drawable_invalidate_preview (GIMP_DRAWABLE(channel));
tmp = next_item (tmp); tmp = g_slist_next (tmp);
} }
} }

View File

@ -27,7 +27,6 @@
#include "global_edit.h" #include "global_edit.h"
#include "interface.h" #include "interface.h"
#include "layer.h" #include "layer.h"
#include "linked.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "tools.h" #include "tools.h"
#include "undo.h" #include "undo.h"
@ -57,7 +56,7 @@ struct _named_buffer
/* The named buffer list */ /* The named buffer list */
link_ptr named_buffers = NULL; GSList * named_buffers = NULL;
/* The global edit buffer */ /* The global edit buffer */
TileManager * global_buf = NULL; TileManager * global_buf = NULL;
@ -449,7 +448,7 @@ global_edit_free ()
static void static void
set_list_of_named_buffers (GtkWidget *list_widget) set_list_of_named_buffers (GtkWidget *list_widget)
{ {
link_ptr list; GSList *list;
NamedBuffer *nb; NamedBuffer *nb;
GtkWidget *list_item; GtkWidget *list_item;
@ -459,7 +458,7 @@ set_list_of_named_buffers (GtkWidget *list_widget)
while (list) while (list)
{ {
nb = (NamedBuffer *) list->data; nb = (NamedBuffer *) list->data;
list = next_item (list); list = g_slist_next (list);
list_item = gtk_list_item_new_with_label (nb->name); list_item = gtk_list_item_new_with_label (nb->name);
gtk_container_add (GTK_CONTAINER (list_widget), list_item); gtk_container_add (GTK_CONTAINER (list_widget), list_item);
@ -513,7 +512,7 @@ named_buffer_delete_foreach (GtkWidget *w,
{ {
pn_dlg = (PasteNamedDlg *) client_data; pn_dlg = (PasteNamedDlg *) client_data;
nb = (NamedBuffer *) gtk_object_get_user_data (GTK_OBJECT (w)); nb = (NamedBuffer *) gtk_object_get_user_data (GTK_OBJECT (w));
named_buffers = remove_from_list (named_buffers, (void *) nb); named_buffers = g_slist_remove (named_buffers, (void *) nb);
g_free (nb->name); g_free (nb->name);
tile_manager_destroy (nb->buf); tile_manager_destroy (nb->buf);
g_free (nb); g_free (nb);
@ -653,7 +652,7 @@ new_named_buffer_callback (GtkWidget *w,
copy_region (&srcPR, &destPR); copy_region (&srcPR, &destPR);
nb->name = g_strdup ((char *) call_data); nb->name = g_strdup ((char *) call_data);
named_buffers = append_to_list (named_buffers, (void *) nb); named_buffers = g_slist_append (named_buffers, (void *) nb);
} }
static void static void
@ -717,7 +716,7 @@ named_edit_paste (void *gdisp_ptr)
void void
named_buffers_free () named_buffers_free ()
{ {
link_ptr list; GSList *list;
NamedBuffer * nb; NamedBuffer * nb;
list = named_buffers; list = named_buffers;
@ -728,9 +727,9 @@ named_buffers_free ()
tile_manager_destroy (nb->buf); tile_manager_destroy (nb->buf);
g_free (nb->name); g_free (nb->name);
g_free (nb); g_free (nb);
list = next_item (list); list = g_slist_next (list);
} }
free_list (named_buffers); g_slist_free (named_buffers);
named_buffers = NULL; named_buffers = NULL;
} }

View File

@ -459,7 +459,7 @@ static GtkWidget *
build_palette_menu(int *default_palette){ build_palette_menu(int *default_palette){
GtkWidget *menu; GtkWidget *menu;
GtkWidget *menu_item; GtkWidget *menu_item;
link_ptr list; GSList *list;
PaletteEntriesP entries; PaletteEntriesP entries;
int i; int i;
@ -478,7 +478,7 @@ build_palette_menu(int *default_palette){
for(i=0,list = palette_entries_list,*default_palette=-1; for(i=0,list = palette_entries_list,*default_palette=-1;
list; list;
i++,list = next_item (list)) i++,list = g_slist_next (list))
{ {
entries = (PaletteEntriesP) list->data; entries = (PaletteEntriesP) list->data;
/* fprintf(stderr, "(palette %s)\n", entries->filename);*/ /* fprintf(stderr, "(palette %s)\n", entries->filename);*/
@ -600,7 +600,7 @@ convert_image (GImage *gimage,
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
int old_type; int old_type;
link_ptr list; GSList *list;
int new_layer_type; int new_layer_type;
int new_layer_bytes; int new_layer_bytes;
int has_alpha; int has_alpha;
@ -656,7 +656,7 @@ convert_image (GImage *gimage,
while (list) while (list)
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
list = next_item (list); list = g_slist_next (list);
if (old_type == GRAY) if (old_type == GRAY)
generate_histogram_gray (quantobj->histogram, layer); generate_histogram_gray (quantobj->histogram, layer);
else else
@ -722,7 +722,7 @@ convert_image (GImage *gimage,
while (list) while (list)
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
list = next_item (list); list = g_slist_next (list);
has_alpha = layer_has_alpha (layer); has_alpha = layer_has_alpha (layer);
switch (new_type) switch (new_type)
@ -2024,7 +2024,7 @@ static void
custompal_pass1 (QuantizeObj *quantobj) custompal_pass1 (QuantizeObj *quantobj)
{ {
int i; int i;
link_ptr list; GSList *list;
PaletteEntryP entry; PaletteEntryP entry;
/* fprintf(stderr, "custompal_pass1: using (theCustomPalette %s) from (file %s)\n", /* fprintf(stderr, "custompal_pass1: using (theCustomPalette %s) from (file %s)\n",
@ -2032,7 +2032,7 @@ custompal_pass1 (QuantizeObj *quantobj)
for (i=0,list=theCustomPalette->colors; for (i=0,list=theCustomPalette->colors;
list; list;
i++,list=next_item(list)) i++,list=g_slist_next(list))
{ {
entry=(PaletteEntryP)list->data; entry=(PaletteEntryP)list->data;
quantobj->cmap[i].red = entry->color[0]; quantobj->cmap[i].red = entry->color[0];
@ -3036,7 +3036,7 @@ convert_indexed_palette_invoker (Argument *args)
if (success) if (success)
{ {
PaletteEntriesP entries, the_palette = NULL; PaletteEntriesP entries, the_palette = NULL;
link_ptr list; GSList *list;
palette_type = args[2].value.pdb_int; palette_type = args[2].value.pdb_int;
switch(palette_type) { switch(palette_type) {
@ -3057,7 +3057,7 @@ convert_indexed_palette_invoker (Argument *args)
if (!palette_entries_list) palette_init_palettes(); if (!palette_entries_list) palette_init_palettes();
for(list = palette_entries_list; for(list = palette_entries_list;
list; list;
list = next_item(list)) { list = g_slist_next(list)) {
entries = (PaletteEntriesP) list->data; entries = (PaletteEntriesP) list->data;
if (strcmp(palette_name, entries->name)==0) { if (strcmp(palette_name, entries->name)==0) {
/* fprintf(stderr, "found it!\n"); */ /* fprintf(stderr, "found it!\n"); */

View File

@ -30,7 +30,6 @@
#include "gimprc.h" #include "gimprc.h"
#include "indexed_palette.h" #include "indexed_palette.h"
#include "layer.h" #include "layer.h"
#include "linked.h"
#include "paint_core.h" #include "paint_core.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "tools.h" #include "tools.h"
@ -135,9 +134,9 @@ channel_size (Channel *channel)
static void static void
undo_free_list (GImage *gimage, undo_free_list (GImage *gimage,
int state, int state,
link_ptr list) GSList *list)
{ {
link_ptr orig; GSList * orig;
Undo * undo; Undo * undo;
orig = list; orig = list;
@ -151,17 +150,18 @@ undo_free_list (GImage *gimage,
gimage->undo_bytes -= undo->bytes; gimage->undo_bytes -= undo->bytes;
g_free (undo); g_free (undo);
} }
list = next_item (list); list = g_slist_next (list);
} }
free_list (orig); g_slist_free (orig);
} }
static link_ptr static GSList *
remove_stack_bottom (GImage *gimage) remove_stack_bottom (GImage *gimage)
{ {
link_ptr list, last; GSList *list;
GSList *last;
int in_group = 0; int in_group = 0;
list = gimage->undo_stack; list = gimage->undo_stack;
@ -193,7 +193,7 @@ remove_stack_bottom (GImage *gimage)
(!list->data && !in_group)) (!list->data && !in_group))
last = list; last = list;
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -258,21 +258,21 @@ undo_push (GImage *gimage,
else else
new->type = gimage->pushing_undo_group; new->type = gimage->pushing_undo_group;
gimage->undo_stack = add_to_list (gimage->undo_stack, (void *) new); gimage->undo_stack = g_slist_prepend (gimage->undo_stack, (void *) new);
return new; return new;
} }
static int static int
pop_stack (GImage *gimage, pop_stack (GImage *gimage,
link_ptr *stack_ptr, GSList **stack_ptr,
link_ptr *unstack_ptr, GSList **unstack_ptr,
int state) int state)
{ {
Undo * object; Undo * object;
link_ptr stack; GSList *stack;
link_ptr tmp; GSList *tmp;
int status = 0; int status = 0;
int in_group = 0; int in_group = 0;
@ -302,12 +302,12 @@ pop_stack (GImage *gimage,
gimage->undo_levels += (state == UNDO) ? -1 : 1; gimage->undo_levels += (state == UNDO) ? -1 : 1;
} }
*unstack_ptr = add_to_list (*unstack_ptr, (void *) object); *unstack_ptr = g_slist_prepend (*unstack_ptr, (void *) object);
tmp = stack; tmp = stack;
*stack_ptr = next_item (*stack_ptr); *stack_ptr = g_slist_next (*stack_ptr);
tmp->next = NULL; tmp->next = NULL;
free_list (tmp); g_slist_free (tmp);
if (status && !in_group) if (status && !in_group)
{ {
@ -381,7 +381,7 @@ undo_push_group_start (GImage *gimage,
return FALSE; return FALSE;
gimage->pushing_undo_group = type; gimage->pushing_undo_group = type;
gimage->undo_stack = add_to_list (gimage->undo_stack, NULL); gimage->undo_stack = g_slist_prepend (gimage->undo_stack, NULL);
gimage->undo_levels++; gimage->undo_levels++;
return TRUE; return TRUE;
@ -399,7 +399,7 @@ undo_push_group_end (GImage *gimage)
if (group_count == 0) if (group_count == 0)
{ {
gimage->pushing_undo_group = 0; gimage->pushing_undo_group = 0;
gimage->undo_stack = add_to_list (gimage->undo_stack, NULL); gimage->undo_stack = g_slist_prepend (gimage->undo_stack, NULL);
} }
return TRUE; return TRUE;
@ -1072,8 +1072,8 @@ undo_pop_layer (GImage *gimage,
gimage_set_active_layer (gimage, lu->prev_layer); gimage_set_active_layer (gimage, lu->prev_layer);
/* remove the layer */ /* remove the layer */
gimage->layers = remove_from_list (gimage->layers, lu->layer); gimage->layers = g_slist_remove (gimage->layers, lu->layer);
gimage->layer_stack = remove_from_list (gimage->layer_stack, lu->layer); gimage->layer_stack = g_slist_remove (gimage->layer_stack, lu->layer);
/* reset the gimage values */ /* reset the gimage values */
if (layer_is_floating_sel (lu->layer)) if (layer_is_floating_sel (lu->layer))
@ -1100,8 +1100,8 @@ undo_pop_layer (GImage *gimage,
gimage->floating_sel = lu->layer; gimage->floating_sel = lu->layer;
/* add the new layer */ /* add the new layer */
gimage->layers = insert_in_list (gimage->layers, lu->layer, lu->prev_position); gimage->layers = g_slist_insert (gimage->layers, lu->layer, lu->prev_position);
gimage->layer_stack = add_to_list (gimage->layer_stack, lu->layer); gimage->layer_stack = g_slist_prepend (gimage->layer_stack, lu->layer);
gimage->active_layer = lu->layer; gimage->active_layer = lu->layer;
drawable_update (GIMP_DRAWABLE(lu->layer), 0, 0, GIMP_DRAWABLE(lu->layer)->width, GIMP_DRAWABLE(lu->layer)->height); drawable_update (GIMP_DRAWABLE(lu->layer), 0, 0, GIMP_DRAWABLE(lu->layer)->width, GIMP_DRAWABLE(lu->layer)->height);
} }
@ -1443,7 +1443,7 @@ undo_pop_channel (GImage *gimage,
cu->prev_position = gimage_get_channel_index (gimage, cu->channel); cu->prev_position = gimage_get_channel_index (gimage, cu->channel);
/* remove the channel */ /* remove the channel */
gimage->channels = remove_from_list (gimage->channels, cu->channel); gimage->channels = g_slist_remove (gimage->channels, cu->channel);
/* set the previous channel */ /* set the previous channel */
gimage_set_active_channel (gimage, cu->prev_channel); gimage_set_active_channel (gimage, cu->prev_channel);
@ -1458,7 +1458,7 @@ undo_pop_channel (GImage *gimage,
cu->prev_channel = gimage->active_channel; cu->prev_channel = gimage->active_channel;
/* add the new channel */ /* add the new channel */
gimage->channels = insert_in_list (gimage->channels, cu->channel, cu->prev_position); gimage->channels = g_slist_insert (gimage->channels, cu->channel, cu->prev_position);
/* set the new channel */ /* set the new channel */
gimage_set_active_channel (gimage, cu->channel); gimage_set_active_channel (gimage, cu->channel);

View File

@ -31,7 +31,6 @@
#include "interface.h" #include "interface.h"
#include "layer.h" #include "layer.h"
#include "layers_dialog.h" #include "layers_dialog.h"
#include "linked.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -1119,7 +1118,7 @@ void
layer_invalidate_previews (gimage_id) layer_invalidate_previews (gimage_id)
int gimage_id; int gimage_id;
{ {
link_ptr tmp; GSList * tmp;
Layer * layer; Layer * layer;
GImage * gimage; GImage * gimage;
@ -1132,7 +1131,7 @@ layer_invalidate_previews (gimage_id)
{ {
layer = (Layer *) tmp->data; layer = (Layer *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE(layer)); drawable_invalidate_preview (GIMP_DRAWABLE(layer));
tmp = next_item (tmp); tmp = g_slist_next (tmp);
} }
} }

View File

@ -35,7 +35,6 @@
#include "info_window.h" #include "info_window.h"
#include "interface.h" #include "interface.h"
#include "layers_dialog.h" #include "layers_dialog.h"
#include "linked.h"
#include "menus.h" #include "menus.h"
#include "plug_in.h" #include "plug_in.h"
#include "scale.h" #include "scale.h"
@ -50,7 +49,7 @@
#define EPSILON 5 #define EPSILON 5
/* variable declarations */ /* variable declarations */
link_ptr display_list = NULL; GSList * display_list = NULL;
static int display_num = 1; static int display_num = 1;
static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW; static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW;
@ -72,8 +71,8 @@ static char *image_type_strs[] =
/* Local functions */ /* Local functions */
static void gdisplay_format_title (GImage *, char *); static void gdisplay_format_title (GImage *, char *);
static void gdisplay_delete (GDisplay *); static void gdisplay_delete (GDisplay *);
static link_ptr gdisplay_free_area_list (link_ptr); static GSList * gdisplay_free_area_list (GSList *);
static link_ptr gdisplay_process_area_list(link_ptr, GArea *); static GSList * gdisplay_process_area_list(GSList *, GArea *);
static void gdisplay_add_update_area (GDisplay *, int, int, int, int); static void gdisplay_add_update_area (GDisplay *, int, int, int, int);
static void gdisplay_add_display_area (GDisplay *, int, int, int, int); static void gdisplay_add_display_area (GDisplay *, int, int, int, int);
static void gdisplay_paint_area (GDisplay *, int, int, int, int); static void gdisplay_paint_area (GDisplay *, int, int, int, int);
@ -124,7 +123,7 @@ gdisplay_new (GImage *gimage,
gdisp->snap_to_guides = TRUE; gdisp->snap_to_guides = TRUE;
/* add the new display to the list so that it isn't lost */ /* add the new display to the list so that it isn't lost */
display_list = append_to_list (display_list, (void *) gdisp); display_list = g_slist_append (display_list, (void *) gdisp);
/* create the shell for the image */ /* create the shell for the image */
create_display_shell (gdisp->ID, gimage->width, gimage->height, create_display_shell (gdisp->ID, gimage->width, gimage->height,
@ -215,10 +214,10 @@ gdisplay_delete (GDisplay *gdisp)
} }
static link_ptr static GSList *
gdisplay_free_area_list (link_ptr list) gdisplay_free_area_list (GSList *list)
{ {
link_ptr l = list; GSList *l = list;
GArea *ga; GArea *ga;
while (l) while (l)
@ -227,27 +226,27 @@ gdisplay_free_area_list (link_ptr list)
ga = (GArea *) l->data; ga = (GArea *) l->data;
g_free (ga); g_free (ga);
l = next_item (l); l = g_slist_next (l);
} }
if (list) if (list)
free_list (list); g_slist_free (list);
return NULL; return NULL;
} }
static link_ptr static GSList *
gdisplay_process_area_list (link_ptr list, gdisplay_process_area_list (GSList *list,
GArea *ga1) GArea *ga1)
{ {
link_ptr new_list; GSList *new_list;
link_ptr l = list; GSList *l = list;
int area1, area2, area3; int area1, area2, area3;
GArea *ga2; GArea *ga2;
/* start new list off */ /* start new list off */
new_list = add_to_list (NULL, ga1); new_list = g_slist_prepend (NULL, ga1);
while (l) while (l)
{ {
/* process the data */ /* process the data */
@ -258,7 +257,7 @@ gdisplay_process_area_list (link_ptr list,
(MAXIMUM (ga2->y2, ga1->y2) - MINIMUM (ga2->y1, ga1->y1)) + OVERHEAD; (MAXIMUM (ga2->y2, ga1->y2) - MINIMUM (ga2->y1, ga1->y1)) + OVERHEAD;
if ((area1 + area2) < area3) if ((area1 + area2) < area3)
new_list = add_to_list (new_list, ga2); new_list = g_slist_prepend (new_list, ga2);
else else
{ {
ga1->x1 = MINIMUM (ga1->x1, ga2->x1); ga1->x1 = MINIMUM (ga1->x1, ga2->x1);
@ -269,11 +268,11 @@ gdisplay_process_area_list (link_ptr list,
g_free (ga2); g_free (ga2);
} }
l = next_item (l); l = g_slist_next (l);
} }
if (list) if (list)
free_list (list); g_slist_free (list);
return new_list; return new_list;
} }
@ -282,8 +281,8 @@ gdisplay_process_area_list (link_ptr list,
void void
gdisplay_flush (GDisplay *gdisp) gdisplay_flush (GDisplay *gdisp)
{ {
GArea * ga; GArea *ga;
link_ptr list; GSList *list;
/* Flush the items in the displays and updates lists-- /* Flush the items in the displays and updates lists--
* but only if gdisplay has been mapped and exposed * but only if gdisplay has been mapped and exposed
@ -300,7 +299,7 @@ gdisplay_flush (GDisplay *gdisp)
gdisplay_paint_area (gdisp, ga->x1, ga->y1, gdisplay_paint_area (gdisp, ga->x1, ga->y1,
(ga->x2 - ga->x1), (ga->y2 - ga->y1)); (ga->x2 - ga->x1), (ga->y2 - ga->y1));
list = next_item (list); list = g_slist_next (list);
} }
/* Free the update lists */ /* Free the update lists */
gdisp->update_areas = gdisplay_free_area_list (gdisp->update_areas); gdisp->update_areas = gdisplay_free_area_list (gdisp->update_areas);
@ -320,7 +319,7 @@ gdisplay_flush (GDisplay *gdisp)
gdisplay_display_area (gdisp, ga->x1, ga->y1, gdisplay_display_area (gdisp, ga->x1, ga->y1,
(ga->x2 - ga->x1), (ga->y2 - ga->y1)); (ga->x2 - ga->x1), (ga->y2 - ga->y1));
list = next_item (list); list = g_slist_next (list);
} }
/* Free the update lists */ /* Free the update lists */
gdisp->display_areas = gdisplay_free_area_list (gdisp->display_areas); gdisp->display_areas = gdisplay_free_area_list (gdisp->display_areas);
@ -614,7 +613,7 @@ void
gdisplay_remove_and_delete (GDisplay *gdisp) gdisplay_remove_and_delete (GDisplay *gdisp)
{ {
/* remove the display from the list */ /* remove the display from the list */
display_list = remove_from_list (display_list, (void *) gdisp); display_list = g_slist_remove (display_list, (void *) gdisp);
gdisplay_delete (gdisp); gdisplay_delete (gdisp);
} }
@ -1130,7 +1129,7 @@ GDisplay *
gdisplay_get_ID (int ID) gdisplay_get_ID (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
/* Traverse the list of displays, returning the one that matches the ID */ /* Traverse the list of displays, returning the one that matches the ID */
/* If no display in the list is a match, return NULL. */ /* If no display in the list is a match, return NULL. */
@ -1140,7 +1139,7 @@ gdisplay_get_ID (int ID)
if (gdisp->ID == ID) if (gdisp->ID == ID)
return gdisp; return gdisp;
list = next_item (list); list = g_slist_next (list);
} }
return NULL; return NULL;
@ -1151,7 +1150,7 @@ void
gdisplays_update_title (int ID) gdisplays_update_title (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
char title [MAX_TITLE_BUF]; char title [MAX_TITLE_BUF];
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
@ -1165,7 +1164,7 @@ gdisplays_update_title (int ID)
gdk_window_set_title (gdisp->shell->window, title); gdk_window_set_title (gdisp->shell->window, title);
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1178,7 +1177,7 @@ gdisplays_update_area (int ID,
int h) int h)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int count = 0; int count = 0;
@ -1202,7 +1201,7 @@ gdisplays_update_area (int ID,
count++; count++;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1212,7 +1211,7 @@ gdisplays_expose_guides (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
GList *tmp_list; GList *tmp_list;
link_ptr list; GSList *list;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
list = display_list; list = display_list;
@ -1229,7 +1228,7 @@ gdisplays_expose_guides (int ID)
} }
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1239,7 +1238,7 @@ gdisplays_expose_guide (int ID,
Guide *guide) Guide *guide)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list; GSList *list;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
list = display_list; list = display_list;
@ -1249,7 +1248,7 @@ gdisplays_expose_guide (int ID,
if (gdisp->gimage->ID == ID) if (gdisp->gimage->ID == ID)
gdisplay_expose_guide (gdisp, guide); gdisplay_expose_guide (gdisp, guide);
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1258,7 +1257,7 @@ void
gdisplays_update_full (int ID) gdisplays_update_full (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
int count = 0; int count = 0;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
@ -1279,7 +1278,7 @@ gdisplays_update_full (int ID)
count++; count++;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1288,7 +1287,7 @@ void
gdisplays_shrink_wrap (int ID) gdisplays_shrink_wrap (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
while (list) while (list)
@ -1297,7 +1296,7 @@ gdisplays_shrink_wrap (int ID)
if (gdisp->gimage->ID == ID) if (gdisp->gimage->ID == ID)
shrink_wrap_display (gdisp); shrink_wrap_display (gdisp);
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1306,14 +1305,14 @@ void
gdisplays_expose_full () gdisplays_expose_full ()
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
while (list) while (list)
{ {
gdisp = (GDisplay *) list->data; gdisp = (GDisplay *) list->data;
gdisplay_expose_full (gdisp); gdisplay_expose_full (gdisp);
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1323,7 +1322,7 @@ gdisplays_selection_visibility (int gimage_ID,
SelectionControl function) SelectionControl function)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
int count = 0; int count = 0;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
@ -1353,7 +1352,7 @@ gdisplays_selection_visibility (int gimage_ID,
count++; count++;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1362,14 +1361,14 @@ int
gdisplays_dirty () gdisplays_dirty ()
{ {
int dirty = 0; int dirty = 0;
link_ptr list = display_list; GSList *list = display_list;
/* traverse the linked list of displays */ /* traverse the linked list of displays */
while (list) while (list)
{ {
if (((GDisplay *) list->data)->gimage->dirty > 0) if (((GDisplay *) list->data)->gimage->dirty > 0)
dirty = 1; dirty = 1;
list = next_item (list); list = g_slist_next (list);
} }
return dirty; return dirty;
@ -1379,17 +1378,17 @@ gdisplays_dirty ()
void void
gdisplays_delete () gdisplays_delete ()
{ {
link_ptr list = display_list; GSList *list = display_list;
/* traverse the linked list of displays */ /* traverse the linked list of displays */
while (list) while (list)
{ {
gdisplay_delete ((GDisplay *) list->data); gdisplay_delete ((GDisplay *) list->data);
list = next_item (list); list = g_slist_next (list);
} }
/* free up linked list data */ /* free up linked list data */
free_list (display_list); g_slist_free (display_list);
} }
@ -1397,7 +1396,7 @@ void
gdisplays_flush () gdisplays_flush ()
{ {
static int flushing = FALSE; static int flushing = FALSE;
link_ptr list = display_list; GSList *list = display_list;
/* no flushing necessary without an interface */ /* no flushing necessary without an interface */
if (no_interface) if (no_interface)
@ -1413,7 +1412,7 @@ gdisplays_flush ()
while (list) while (list)
{ {
gdisplay_flush ((GDisplay *) list->data); gdisplay_flush ((GDisplay *) list->data);
list = next_item (list); list = g_slist_next (list);
} }
/* for convenience, we call the layers dialog flush here */ /* for convenience, we call the layers dialog flush here */

View File

@ -20,7 +20,6 @@
#include "gimage.h" #include "gimage.h"
#include "info_dialog.h" #include "info_dialog.h"
#include "linked.h"
#include "selection.h" #include "selection.h"
/* /*
@ -86,8 +85,8 @@ struct _GDisplay
GdkGC *scroll_gc; /* GC for scrolling */ GdkGC *scroll_gc; /* GC for scrolling */
link_ptr update_areas; /* Update areas list */ GSList *update_areas; /* Update areas list */
link_ptr display_areas; /* Display areas list */ GSList *display_areas; /* Display areas list */
GdkCursorType current_cursor; /* Currently installed cursor */ GdkCursorType current_cursor; /* Currently installed cursor */
}; };

View File

@ -560,7 +560,7 @@ crop_image (GImage *gimage,
Layer *floating_layer; Layer *floating_layer;
Channel *channel; Channel *channel;
GList *guide_list_ptr; GList *guide_list_ptr;
link_ptr list; GSList *list;
int width, height; int width, height;
int lx1, ly1, lx2, ly2; int lx1, ly1, lx2, ly2;
int off_x, off_y; int off_x, off_y;
@ -592,7 +592,7 @@ crop_image (GImage *gimage,
{ {
channel = (Channel *) list->data; channel = (Channel *) list->data;
channel_resize (channel, width, height, -x1, -y1); channel_resize (channel, width, height, -x1, -y1);
list = next_item (list); list = g_slist_next (list);
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
@ -616,7 +616,7 @@ crop_image (GImage *gimage,
width = lx2 - lx1; width = lx2 - lx1;
height = ly2 - ly1; height = ly2 - ly1;
list = next_item (list); list = g_slist_next (list);
if (width && height) if (width && height)
layer_resize (layer, width, height, layer_resize (layer, width, height,

View File

@ -122,7 +122,7 @@ info_dialog_new (char *title)
void void
info_dialog_free (InfoDialog *idialog) info_dialog_free (InfoDialog *idialog)
{ {
link_ptr list; GSList *list;
if (!idialog) if (!idialog)
return; return;
@ -133,11 +133,11 @@ info_dialog_free (InfoDialog *idialog)
while (list) while (list)
{ {
g_free (list->data); g_free (list->data);
list = next_item (list); list = g_slist_next (list);
} }
/* Free the actual field linked list */ /* Free the actual field linked list */
free_list (idialog->field_list); g_slist_free (idialog->field_list);
/* Destroy the associated widgets */ /* Destroy the associated widgets */
gtk_widget_destroy (idialog->shell); gtk_widget_destroy (idialog->shell);
@ -157,7 +157,7 @@ info_dialog_add_field (InfoDialog *idialog,
return; return;
new_field = info_field_new (idialog, title, text_ptr); new_field = info_field_new (idialog, title, text_ptr);
idialog->field_list = add_to_list (idialog->field_list, (void *) new_field); idialog->field_list = g_slist_prepend (idialog->field_list, (void *) new_field);
} }
void void
@ -183,7 +183,7 @@ info_dialog_popdown (InfoDialog *idialog)
void void
info_dialog_update (InfoDialog *idialog) info_dialog_update (InfoDialog *idialog)
{ {
link_ptr list; GSList *list;
if (!idialog) if (!idialog)
return; return;
@ -193,7 +193,7 @@ info_dialog_update (InfoDialog *idialog)
while (list) while (list)
{ {
update_field ((InfoField *) list->data); update_field ((InfoField *) list->data);
list = next_item (list); list = g_slist_next (list);
} }
} }

View File

@ -19,7 +19,6 @@
#define __INFO_DIALOG_H__ #define __INFO_DIALOG_H__
#include "gtk/gtk.h" #include "gtk/gtk.h"
#include "linked.h"
typedef struct _info_field InfoField; typedef struct _info_field InfoField;
@ -40,7 +39,7 @@ struct _info_dialog
GtkWidget *labels; GtkWidget *labels;
GtkWidget *values; GtkWidget *values;
link_ptr field_list; GSList *field_list;
void *user_data; void *user_data;
}; };

View File

@ -35,7 +35,6 @@
#include "info_window.h" #include "info_window.h"
#include "interface.h" #include "interface.h"
#include "layers_dialog.h" #include "layers_dialog.h"
#include "linked.h"
#include "menus.h" #include "menus.h"
#include "plug_in.h" #include "plug_in.h"
#include "scale.h" #include "scale.h"
@ -50,7 +49,7 @@
#define EPSILON 5 #define EPSILON 5
/* variable declarations */ /* variable declarations */
link_ptr display_list = NULL; GSList * display_list = NULL;
static int display_num = 1; static int display_num = 1;
static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW; static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW;
@ -72,8 +71,8 @@ static char *image_type_strs[] =
/* Local functions */ /* Local functions */
static void gdisplay_format_title (GImage *, char *); static void gdisplay_format_title (GImage *, char *);
static void gdisplay_delete (GDisplay *); static void gdisplay_delete (GDisplay *);
static link_ptr gdisplay_free_area_list (link_ptr); static GSList * gdisplay_free_area_list (GSList *);
static link_ptr gdisplay_process_area_list(link_ptr, GArea *); static GSList * gdisplay_process_area_list(GSList *, GArea *);
static void gdisplay_add_update_area (GDisplay *, int, int, int, int); static void gdisplay_add_update_area (GDisplay *, int, int, int, int);
static void gdisplay_add_display_area (GDisplay *, int, int, int, int); static void gdisplay_add_display_area (GDisplay *, int, int, int, int);
static void gdisplay_paint_area (GDisplay *, int, int, int, int); static void gdisplay_paint_area (GDisplay *, int, int, int, int);
@ -124,7 +123,7 @@ gdisplay_new (GImage *gimage,
gdisp->snap_to_guides = TRUE; gdisp->snap_to_guides = TRUE;
/* add the new display to the list so that it isn't lost */ /* add the new display to the list so that it isn't lost */
display_list = append_to_list (display_list, (void *) gdisp); display_list = g_slist_append (display_list, (void *) gdisp);
/* create the shell for the image */ /* create the shell for the image */
create_display_shell (gdisp->ID, gimage->width, gimage->height, create_display_shell (gdisp->ID, gimage->width, gimage->height,
@ -215,10 +214,10 @@ gdisplay_delete (GDisplay *gdisp)
} }
static link_ptr static GSList *
gdisplay_free_area_list (link_ptr list) gdisplay_free_area_list (GSList *list)
{ {
link_ptr l = list; GSList *l = list;
GArea *ga; GArea *ga;
while (l) while (l)
@ -227,27 +226,27 @@ gdisplay_free_area_list (link_ptr list)
ga = (GArea *) l->data; ga = (GArea *) l->data;
g_free (ga); g_free (ga);
l = next_item (l); l = g_slist_next (l);
} }
if (list) if (list)
free_list (list); g_slist_free (list);
return NULL; return NULL;
} }
static link_ptr static GSList *
gdisplay_process_area_list (link_ptr list, gdisplay_process_area_list (GSList *list,
GArea *ga1) GArea *ga1)
{ {
link_ptr new_list; GSList *new_list;
link_ptr l = list; GSList *l = list;
int area1, area2, area3; int area1, area2, area3;
GArea *ga2; GArea *ga2;
/* start new list off */ /* start new list off */
new_list = add_to_list (NULL, ga1); new_list = g_slist_prepend (NULL, ga1);
while (l) while (l)
{ {
/* process the data */ /* process the data */
@ -258,7 +257,7 @@ gdisplay_process_area_list (link_ptr list,
(MAXIMUM (ga2->y2, ga1->y2) - MINIMUM (ga2->y1, ga1->y1)) + OVERHEAD; (MAXIMUM (ga2->y2, ga1->y2) - MINIMUM (ga2->y1, ga1->y1)) + OVERHEAD;
if ((area1 + area2) < area3) if ((area1 + area2) < area3)
new_list = add_to_list (new_list, ga2); new_list = g_slist_prepend (new_list, ga2);
else else
{ {
ga1->x1 = MINIMUM (ga1->x1, ga2->x1); ga1->x1 = MINIMUM (ga1->x1, ga2->x1);
@ -269,11 +268,11 @@ gdisplay_process_area_list (link_ptr list,
g_free (ga2); g_free (ga2);
} }
l = next_item (l); l = g_slist_next (l);
} }
if (list) if (list)
free_list (list); g_slist_free (list);
return new_list; return new_list;
} }
@ -282,8 +281,8 @@ gdisplay_process_area_list (link_ptr list,
void void
gdisplay_flush (GDisplay *gdisp) gdisplay_flush (GDisplay *gdisp)
{ {
GArea * ga; GArea *ga;
link_ptr list; GSList *list;
/* Flush the items in the displays and updates lists-- /* Flush the items in the displays and updates lists--
* but only if gdisplay has been mapped and exposed * but only if gdisplay has been mapped and exposed
@ -300,7 +299,7 @@ gdisplay_flush (GDisplay *gdisp)
gdisplay_paint_area (gdisp, ga->x1, ga->y1, gdisplay_paint_area (gdisp, ga->x1, ga->y1,
(ga->x2 - ga->x1), (ga->y2 - ga->y1)); (ga->x2 - ga->x1), (ga->y2 - ga->y1));
list = next_item (list); list = g_slist_next (list);
} }
/* Free the update lists */ /* Free the update lists */
gdisp->update_areas = gdisplay_free_area_list (gdisp->update_areas); gdisp->update_areas = gdisplay_free_area_list (gdisp->update_areas);
@ -320,7 +319,7 @@ gdisplay_flush (GDisplay *gdisp)
gdisplay_display_area (gdisp, ga->x1, ga->y1, gdisplay_display_area (gdisp, ga->x1, ga->y1,
(ga->x2 - ga->x1), (ga->y2 - ga->y1)); (ga->x2 - ga->x1), (ga->y2 - ga->y1));
list = next_item (list); list = g_slist_next (list);
} }
/* Free the update lists */ /* Free the update lists */
gdisp->display_areas = gdisplay_free_area_list (gdisp->display_areas); gdisp->display_areas = gdisplay_free_area_list (gdisp->display_areas);
@ -614,7 +613,7 @@ void
gdisplay_remove_and_delete (GDisplay *gdisp) gdisplay_remove_and_delete (GDisplay *gdisp)
{ {
/* remove the display from the list */ /* remove the display from the list */
display_list = remove_from_list (display_list, (void *) gdisp); display_list = g_slist_remove (display_list, (void *) gdisp);
gdisplay_delete (gdisp); gdisplay_delete (gdisp);
} }
@ -1130,7 +1129,7 @@ GDisplay *
gdisplay_get_ID (int ID) gdisplay_get_ID (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
/* Traverse the list of displays, returning the one that matches the ID */ /* Traverse the list of displays, returning the one that matches the ID */
/* If no display in the list is a match, return NULL. */ /* If no display in the list is a match, return NULL. */
@ -1140,7 +1139,7 @@ gdisplay_get_ID (int ID)
if (gdisp->ID == ID) if (gdisp->ID == ID)
return gdisp; return gdisp;
list = next_item (list); list = g_slist_next (list);
} }
return NULL; return NULL;
@ -1151,7 +1150,7 @@ void
gdisplays_update_title (int ID) gdisplays_update_title (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
char title [MAX_TITLE_BUF]; char title [MAX_TITLE_BUF];
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
@ -1165,7 +1164,7 @@ gdisplays_update_title (int ID)
gdk_window_set_title (gdisp->shell->window, title); gdk_window_set_title (gdisp->shell->window, title);
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1178,7 +1177,7 @@ gdisplays_update_area (int ID,
int h) int h)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int count = 0; int count = 0;
@ -1202,7 +1201,7 @@ gdisplays_update_area (int ID,
count++; count++;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1212,7 +1211,7 @@ gdisplays_expose_guides (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
GList *tmp_list; GList *tmp_list;
link_ptr list; GSList *list;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
list = display_list; list = display_list;
@ -1229,7 +1228,7 @@ gdisplays_expose_guides (int ID)
} }
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1239,7 +1238,7 @@ gdisplays_expose_guide (int ID,
Guide *guide) Guide *guide)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list; GSList *list;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
list = display_list; list = display_list;
@ -1249,7 +1248,7 @@ gdisplays_expose_guide (int ID,
if (gdisp->gimage->ID == ID) if (gdisp->gimage->ID == ID)
gdisplay_expose_guide (gdisp, guide); gdisplay_expose_guide (gdisp, guide);
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1258,7 +1257,7 @@ void
gdisplays_update_full (int ID) gdisplays_update_full (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
int count = 0; int count = 0;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
@ -1279,7 +1278,7 @@ gdisplays_update_full (int ID)
count++; count++;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1288,7 +1287,7 @@ void
gdisplays_shrink_wrap (int ID) gdisplays_shrink_wrap (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
while (list) while (list)
@ -1297,7 +1296,7 @@ gdisplays_shrink_wrap (int ID)
if (gdisp->gimage->ID == ID) if (gdisp->gimage->ID == ID)
shrink_wrap_display (gdisp); shrink_wrap_display (gdisp);
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1306,14 +1305,14 @@ void
gdisplays_expose_full () gdisplays_expose_full ()
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
while (list) while (list)
{ {
gdisp = (GDisplay *) list->data; gdisp = (GDisplay *) list->data;
gdisplay_expose_full (gdisp); gdisplay_expose_full (gdisp);
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1323,7 +1322,7 @@ gdisplays_selection_visibility (int gimage_ID,
SelectionControl function) SelectionControl function)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
int count = 0; int count = 0;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
@ -1353,7 +1352,7 @@ gdisplays_selection_visibility (int gimage_ID,
count++; count++;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1362,14 +1361,14 @@ int
gdisplays_dirty () gdisplays_dirty ()
{ {
int dirty = 0; int dirty = 0;
link_ptr list = display_list; GSList *list = display_list;
/* traverse the linked list of displays */ /* traverse the linked list of displays */
while (list) while (list)
{ {
if (((GDisplay *) list->data)->gimage->dirty > 0) if (((GDisplay *) list->data)->gimage->dirty > 0)
dirty = 1; dirty = 1;
list = next_item (list); list = g_slist_next (list);
} }
return dirty; return dirty;
@ -1379,17 +1378,17 @@ gdisplays_dirty ()
void void
gdisplays_delete () gdisplays_delete ()
{ {
link_ptr list = display_list; GSList *list = display_list;
/* traverse the linked list of displays */ /* traverse the linked list of displays */
while (list) while (list)
{ {
gdisplay_delete ((GDisplay *) list->data); gdisplay_delete ((GDisplay *) list->data);
list = next_item (list); list = g_slist_next (list);
} }
/* free up linked list data */ /* free up linked list data */
free_list (display_list); g_slist_free (display_list);
} }
@ -1397,7 +1396,7 @@ void
gdisplays_flush () gdisplays_flush ()
{ {
static int flushing = FALSE; static int flushing = FALSE;
link_ptr list = display_list; GSList *list = display_list;
/* no flushing necessary without an interface */ /* no flushing necessary without an interface */
if (no_interface) if (no_interface)
@ -1413,7 +1412,7 @@ gdisplays_flush ()
while (list) while (list)
{ {
gdisplay_flush ((GDisplay *) list->data); gdisplay_flush ((GDisplay *) list->data);
list = next_item (list); list = g_slist_next (list);
} }
/* for convenience, we call the layers dialog flush here */ /* for convenience, we call the layers dialog flush here */

View File

@ -20,7 +20,6 @@
#include "gimage.h" #include "gimage.h"
#include "info_dialog.h" #include "info_dialog.h"
#include "linked.h"
#include "selection.h" #include "selection.h"
/* /*
@ -86,8 +85,8 @@ struct _GDisplay
GdkGC *scroll_gc; /* GC for scrolling */ GdkGC *scroll_gc; /* GC for scrolling */
link_ptr update_areas; /* Update areas list */ GSList *update_areas; /* Update areas list */
link_ptr display_areas; /* Display areas list */ GSList *display_areas; /* Display areas list */
GdkCursorType current_cursor; /* Currently installed cursor */ GdkCursorType current_cursor; /* Currently installed cursor */
}; };

View File

@ -31,7 +31,6 @@
#include "gimprc.h" #include "gimprc.h"
#include "general.h" #include "general.h"
#include "interface.h" #include "interface.h"
#include "linked.h"
#include "menus.h" #include "menus.h"
#include "tools.h" #include "tools.h"

View File

@ -179,8 +179,8 @@ layer_select_advance (LayerSelect *layer_select,
int index; int index;
int length; int length;
int count; int count;
link_ptr list; GSList *list;
link_ptr nth; GSList *nth;
Layer *layer; Layer *layer;
index = 0; index = 0;
@ -197,17 +197,17 @@ layer_select_advance (LayerSelect *layer_select,
if (layer == layer_select->current_layer) if (layer == layer_select->current_layer)
index = count; index = count;
count++; count++;
list = next_item (list); list = g_slist_next (list);
} }
length = list_length (layer_select->gimage->layer_stack); length = g_slist_length (layer_select->gimage->layer_stack);
if (dir == 1) if (dir == 1)
index = (index == length - 1) ? 0 : (index + 1); index = (index == length - 1) ? 0 : (index + 1);
else else
index = (index == 0) ? (length - 1) : (index - 1); index = (index == 0) ? (length - 1) : (index - 1);
nth = nth_item (layer_select->gimage->layer_stack, index); nth = g_slist_nth (layer_select->gimage->layer_stack, index);
if (nth) if (nth)
{ {

View File

@ -31,7 +31,6 @@
#include "gimprc.h" #include "gimprc.h"
#include "general.h" #include "general.h"
#include "interface.h" #include "interface.h"
#include "linked.h"
#include "menus.h" #include "menus.h"
#include "tools.h" #include "tools.h"

View File

@ -161,7 +161,7 @@ edit_selection_button_release (Tool *tool,
GDisplay * gdisp; GDisplay * gdisp;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
link_ptr layer_list; GSList *layer_list;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -223,7 +223,7 @@ edit_selection_button_release (Tool *tool,
if (layer == gdisp->gimage->active_layer || if (layer == gdisp->gimage->active_layer ||
layer_linked (layer)) layer_linked (layer))
layer_translate (layer, (x - edit_select.origx), (y - edit_select.origy)); layer_translate (layer, (x - edit_select.origx), (y - edit_select.origy));
layer_list = next_item (layer_list); layer_list = g_slist_next (layer_list);
} }
if (floating_layer) if (floating_layer)
@ -296,7 +296,7 @@ edit_selection_draw (Tool *tool)
GdkSegment * seg; GdkSegment * seg;
Selection * select; Selection * select;
Layer *layer; Layer *layer;
link_ptr layer_list; GSList *layer_list;
int floating_sel; int floating_sel;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int x3, y3, x4, y4; int x3, y3, x4, y4;
@ -404,7 +404,7 @@ edit_selection_draw (Tool *tool)
if (y4 > y2) if (y4 > y2)
y2 = y4; y2 = y4;
} }
layer_list = next_item (layer_list); layer_list = g_slist_next (layer_list);
} }
gdk_draw_rectangle (edit_select.core->win, gdk_draw_rectangle (edit_select.core->win,
@ -485,7 +485,7 @@ edit_sel_arrow_keys_func (Tool *tool,
GDisplay *gdisp; GDisplay *gdisp;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
link_ptr layer_list; GSList *layer_list;
EditType edit_type; EditType edit_type;
layer = NULL; layer = NULL;
@ -547,7 +547,7 @@ edit_sel_arrow_keys_func (Tool *tool,
layer = (Layer *) layer_list->data; layer = (Layer *) layer_list->data;
if (((layer) == gdisp->gimage->active_layer) || layer_linked (layer)) if (((layer) == gdisp->gimage->active_layer) || layer_linked (layer))
layer_translate (layer, inc_x, inc_y); layer_translate (layer, inc_x, inc_y);
layer_list = next_item (layer_list); layer_list = g_slist_next (layer_list);
} }
if (floating_layer) if (floating_layer)

View File

@ -24,7 +24,6 @@
#include "free_select.h" #include "free_select.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "linked.h"
#include "rect_select.h" #include "rect_select.h"
typedef struct _free_select FreeSelect; typedef struct _free_select FreeSelect;
@ -80,38 +79,38 @@ add_point (int num_pts, int x, int y)
/* Routines to scan convert the polygon */ /* Routines to scan convert the polygon */
static link_ptr static GSList *
insert_into_sorted_list (link_ptr list, int x) insert_into_sorted_list (GSList *list, int x)
{ {
link_ptr orig = list; GSList *orig = list;
link_ptr rest; GSList *rest;
if (!list) if (!list)
return add_to_list (list, (gpointer) ((long) x)); return g_slist_prepend (list, (gpointer) ((long) x));
while (list) while (list)
{ {
rest = next_item (list); rest = g_slist_next (list);
if (x < (long) list->data) if (x < (long) list->data)
{ {
rest = add_to_list (rest, list->data); rest = g_slist_prepend (rest, list->data);
list->next = rest; list->next = rest;
list->data = (gpointer) ((long) x); list->data = (gpointer) ((long) x);
return orig; return orig;
} }
else if (!rest) else if (!rest)
{ {
append_to_list (list, (gpointer) ((long) x)); g_slist_append (list, (gpointer) ((long) x));
return orig; return orig;
} }
list = next_item (list); list = g_slist_next (list);
} }
return orig; return orig;
} }
static void static void
convert_segment (link_ptr *scanlines, int width, int height, convert_segment (GSList **scanlines, int width, int height,
int x1, int y1, int x2, int y2) int x1, int y1, int x2, int y2)
{ {
int ydiff, y, tmp; int ydiff, y, tmp;
@ -141,8 +140,8 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
{ {
PixelRegion maskPR; PixelRegion maskPR;
Channel * mask; Channel * mask;
link_ptr * scanlines; GSList **scanlines;
link_ptr list; GSList *list;
unsigned char *buf, *b; unsigned char *buf, *b;
int * vals, val; int * vals, val;
int start, end; int start, end;
@ -166,7 +165,7 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
vals = (int *) g_malloc (sizeof (int) * width); vals = (int *) g_malloc (sizeof (int) * width);
} }
scanlines = (link_ptr *) g_malloc (sizeof (link_ptr) * height); scanlines = (GSList **) g_malloc (sizeof (GSList *) * height);
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
scanlines[i] = NULL; scanlines[i] = NULL;
@ -211,7 +210,7 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
while (list) while (list)
{ {
x = (long) list->data; x = (long) list->data;
list = next_item(list); list = g_slist_next(list);
if (!list) if (!list)
warning ("Cannot properly scanline convert polygon!\n"); warning ("Cannot properly scanline convert polygon!\n");
else else
@ -230,7 +229,7 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
for (j = 0; j < w; j++) for (j = 0; j < w; j++)
vals[j + x] += 255; vals[j + x] += 255;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -252,7 +251,7 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
drawable_width (GIMP_DRAWABLE(mask)), buf); drawable_width (GIMP_DRAWABLE(mask)), buf);
} }
free_list (scanlines[i]); g_slist_free (scanlines[i]);
} }
if (antialias) if (antialias)

View File

@ -35,7 +35,6 @@
#include "info_window.h" #include "info_window.h"
#include "interface.h" #include "interface.h"
#include "layers_dialog.h" #include "layers_dialog.h"
#include "linked.h"
#include "menus.h" #include "menus.h"
#include "plug_in.h" #include "plug_in.h"
#include "scale.h" #include "scale.h"
@ -50,7 +49,7 @@
#define EPSILON 5 #define EPSILON 5
/* variable declarations */ /* variable declarations */
link_ptr display_list = NULL; GSList * display_list = NULL;
static int display_num = 1; static int display_num = 1;
static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW; static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW;
@ -72,8 +71,8 @@ static char *image_type_strs[] =
/* Local functions */ /* Local functions */
static void gdisplay_format_title (GImage *, char *); static void gdisplay_format_title (GImage *, char *);
static void gdisplay_delete (GDisplay *); static void gdisplay_delete (GDisplay *);
static link_ptr gdisplay_free_area_list (link_ptr); static GSList * gdisplay_free_area_list (GSList *);
static link_ptr gdisplay_process_area_list(link_ptr, GArea *); static GSList * gdisplay_process_area_list(GSList *, GArea *);
static void gdisplay_add_update_area (GDisplay *, int, int, int, int); static void gdisplay_add_update_area (GDisplay *, int, int, int, int);
static void gdisplay_add_display_area (GDisplay *, int, int, int, int); static void gdisplay_add_display_area (GDisplay *, int, int, int, int);
static void gdisplay_paint_area (GDisplay *, int, int, int, int); static void gdisplay_paint_area (GDisplay *, int, int, int, int);
@ -124,7 +123,7 @@ gdisplay_new (GImage *gimage,
gdisp->snap_to_guides = TRUE; gdisp->snap_to_guides = TRUE;
/* add the new display to the list so that it isn't lost */ /* add the new display to the list so that it isn't lost */
display_list = append_to_list (display_list, (void *) gdisp); display_list = g_slist_append (display_list, (void *) gdisp);
/* create the shell for the image */ /* create the shell for the image */
create_display_shell (gdisp->ID, gimage->width, gimage->height, create_display_shell (gdisp->ID, gimage->width, gimage->height,
@ -215,10 +214,10 @@ gdisplay_delete (GDisplay *gdisp)
} }
static link_ptr static GSList *
gdisplay_free_area_list (link_ptr list) gdisplay_free_area_list (GSList *list)
{ {
link_ptr l = list; GSList *l = list;
GArea *ga; GArea *ga;
while (l) while (l)
@ -227,27 +226,27 @@ gdisplay_free_area_list (link_ptr list)
ga = (GArea *) l->data; ga = (GArea *) l->data;
g_free (ga); g_free (ga);
l = next_item (l); l = g_slist_next (l);
} }
if (list) if (list)
free_list (list); g_slist_free (list);
return NULL; return NULL;
} }
static link_ptr static GSList *
gdisplay_process_area_list (link_ptr list, gdisplay_process_area_list (GSList *list,
GArea *ga1) GArea *ga1)
{ {
link_ptr new_list; GSList *new_list;
link_ptr l = list; GSList *l = list;
int area1, area2, area3; int area1, area2, area3;
GArea *ga2; GArea *ga2;
/* start new list off */ /* start new list off */
new_list = add_to_list (NULL, ga1); new_list = g_slist_prepend (NULL, ga1);
while (l) while (l)
{ {
/* process the data */ /* process the data */
@ -258,7 +257,7 @@ gdisplay_process_area_list (link_ptr list,
(MAXIMUM (ga2->y2, ga1->y2) - MINIMUM (ga2->y1, ga1->y1)) + OVERHEAD; (MAXIMUM (ga2->y2, ga1->y2) - MINIMUM (ga2->y1, ga1->y1)) + OVERHEAD;
if ((area1 + area2) < area3) if ((area1 + area2) < area3)
new_list = add_to_list (new_list, ga2); new_list = g_slist_prepend (new_list, ga2);
else else
{ {
ga1->x1 = MINIMUM (ga1->x1, ga2->x1); ga1->x1 = MINIMUM (ga1->x1, ga2->x1);
@ -269,11 +268,11 @@ gdisplay_process_area_list (link_ptr list,
g_free (ga2); g_free (ga2);
} }
l = next_item (l); l = g_slist_next (l);
} }
if (list) if (list)
free_list (list); g_slist_free (list);
return new_list; return new_list;
} }
@ -282,8 +281,8 @@ gdisplay_process_area_list (link_ptr list,
void void
gdisplay_flush (GDisplay *gdisp) gdisplay_flush (GDisplay *gdisp)
{ {
GArea * ga; GArea *ga;
link_ptr list; GSList *list;
/* Flush the items in the displays and updates lists-- /* Flush the items in the displays and updates lists--
* but only if gdisplay has been mapped and exposed * but only if gdisplay has been mapped and exposed
@ -300,7 +299,7 @@ gdisplay_flush (GDisplay *gdisp)
gdisplay_paint_area (gdisp, ga->x1, ga->y1, gdisplay_paint_area (gdisp, ga->x1, ga->y1,
(ga->x2 - ga->x1), (ga->y2 - ga->y1)); (ga->x2 - ga->x1), (ga->y2 - ga->y1));
list = next_item (list); list = g_slist_next (list);
} }
/* Free the update lists */ /* Free the update lists */
gdisp->update_areas = gdisplay_free_area_list (gdisp->update_areas); gdisp->update_areas = gdisplay_free_area_list (gdisp->update_areas);
@ -320,7 +319,7 @@ gdisplay_flush (GDisplay *gdisp)
gdisplay_display_area (gdisp, ga->x1, ga->y1, gdisplay_display_area (gdisp, ga->x1, ga->y1,
(ga->x2 - ga->x1), (ga->y2 - ga->y1)); (ga->x2 - ga->x1), (ga->y2 - ga->y1));
list = next_item (list); list = g_slist_next (list);
} }
/* Free the update lists */ /* Free the update lists */
gdisp->display_areas = gdisplay_free_area_list (gdisp->display_areas); gdisp->display_areas = gdisplay_free_area_list (gdisp->display_areas);
@ -614,7 +613,7 @@ void
gdisplay_remove_and_delete (GDisplay *gdisp) gdisplay_remove_and_delete (GDisplay *gdisp)
{ {
/* remove the display from the list */ /* remove the display from the list */
display_list = remove_from_list (display_list, (void *) gdisp); display_list = g_slist_remove (display_list, (void *) gdisp);
gdisplay_delete (gdisp); gdisplay_delete (gdisp);
} }
@ -1130,7 +1129,7 @@ GDisplay *
gdisplay_get_ID (int ID) gdisplay_get_ID (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
/* Traverse the list of displays, returning the one that matches the ID */ /* Traverse the list of displays, returning the one that matches the ID */
/* If no display in the list is a match, return NULL. */ /* If no display in the list is a match, return NULL. */
@ -1140,7 +1139,7 @@ gdisplay_get_ID (int ID)
if (gdisp->ID == ID) if (gdisp->ID == ID)
return gdisp; return gdisp;
list = next_item (list); list = g_slist_next (list);
} }
return NULL; return NULL;
@ -1151,7 +1150,7 @@ void
gdisplays_update_title (int ID) gdisplays_update_title (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
char title [MAX_TITLE_BUF]; char title [MAX_TITLE_BUF];
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
@ -1165,7 +1164,7 @@ gdisplays_update_title (int ID)
gdk_window_set_title (gdisp->shell->window, title); gdk_window_set_title (gdisp->shell->window, title);
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1178,7 +1177,7 @@ gdisplays_update_area (int ID,
int h) int h)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int count = 0; int count = 0;
@ -1202,7 +1201,7 @@ gdisplays_update_area (int ID,
count++; count++;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1212,7 +1211,7 @@ gdisplays_expose_guides (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
GList *tmp_list; GList *tmp_list;
link_ptr list; GSList *list;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
list = display_list; list = display_list;
@ -1229,7 +1228,7 @@ gdisplays_expose_guides (int ID)
} }
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1239,7 +1238,7 @@ gdisplays_expose_guide (int ID,
Guide *guide) Guide *guide)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list; GSList *list;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
list = display_list; list = display_list;
@ -1249,7 +1248,7 @@ gdisplays_expose_guide (int ID,
if (gdisp->gimage->ID == ID) if (gdisp->gimage->ID == ID)
gdisplay_expose_guide (gdisp, guide); gdisplay_expose_guide (gdisp, guide);
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1258,7 +1257,7 @@ void
gdisplays_update_full (int ID) gdisplays_update_full (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
int count = 0; int count = 0;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
@ -1279,7 +1278,7 @@ gdisplays_update_full (int ID)
count++; count++;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1288,7 +1287,7 @@ void
gdisplays_shrink_wrap (int ID) gdisplays_shrink_wrap (int ID)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
while (list) while (list)
@ -1297,7 +1296,7 @@ gdisplays_shrink_wrap (int ID)
if (gdisp->gimage->ID == ID) if (gdisp->gimage->ID == ID)
shrink_wrap_display (gdisp); shrink_wrap_display (gdisp);
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1306,14 +1305,14 @@ void
gdisplays_expose_full () gdisplays_expose_full ()
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
while (list) while (list)
{ {
gdisp = (GDisplay *) list->data; gdisp = (GDisplay *) list->data;
gdisplay_expose_full (gdisp); gdisplay_expose_full (gdisp);
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1323,7 +1322,7 @@ gdisplays_selection_visibility (int gimage_ID,
SelectionControl function) SelectionControl function)
{ {
GDisplay *gdisp; GDisplay *gdisp;
link_ptr list = display_list; GSList *list = display_list;
int count = 0; int count = 0;
/* traverse the linked list of displays, handling each one */ /* traverse the linked list of displays, handling each one */
@ -1353,7 +1352,7 @@ gdisplays_selection_visibility (int gimage_ID,
count++; count++;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1362,14 +1361,14 @@ int
gdisplays_dirty () gdisplays_dirty ()
{ {
int dirty = 0; int dirty = 0;
link_ptr list = display_list; GSList *list = display_list;
/* traverse the linked list of displays */ /* traverse the linked list of displays */
while (list) while (list)
{ {
if (((GDisplay *) list->data)->gimage->dirty > 0) if (((GDisplay *) list->data)->gimage->dirty > 0)
dirty = 1; dirty = 1;
list = next_item (list); list = g_slist_next (list);
} }
return dirty; return dirty;
@ -1379,17 +1378,17 @@ gdisplays_dirty ()
void void
gdisplays_delete () gdisplays_delete ()
{ {
link_ptr list = display_list; GSList *list = display_list;
/* traverse the linked list of displays */ /* traverse the linked list of displays */
while (list) while (list)
{ {
gdisplay_delete ((GDisplay *) list->data); gdisplay_delete ((GDisplay *) list->data);
list = next_item (list); list = g_slist_next (list);
} }
/* free up linked list data */ /* free up linked list data */
free_list (display_list); g_slist_free (display_list);
} }
@ -1397,7 +1396,7 @@ void
gdisplays_flush () gdisplays_flush ()
{ {
static int flushing = FALSE; static int flushing = FALSE;
link_ptr list = display_list; GSList *list = display_list;
/* no flushing necessary without an interface */ /* no flushing necessary without an interface */
if (no_interface) if (no_interface)
@ -1413,7 +1412,7 @@ gdisplays_flush ()
while (list) while (list)
{ {
gdisplay_flush ((GDisplay *) list->data); gdisplay_flush ((GDisplay *) list->data);
list = next_item (list); list = g_slist_next (list);
} }
/* for convenience, we call the layers dialog flush here */ /* for convenience, we call the layers dialog flush here */

View File

@ -20,7 +20,6 @@
#include "gimage.h" #include "gimage.h"
#include "info_dialog.h" #include "info_dialog.h"
#include "linked.h"
#include "selection.h" #include "selection.h"
/* /*
@ -86,8 +85,8 @@ struct _GDisplay
GdkGC *scroll_gc; /* GC for scrolling */ GdkGC *scroll_gc; /* GC for scrolling */
link_ptr update_areas; /* Update areas list */ GSList *update_areas; /* Update areas list */
link_ptr display_areas; /* Display areas list */ GSList *display_areas; /* Display areas list */
GdkCursorType current_cursor; /* Currently installed cursor */ GdkCursorType current_cursor; /* Currently installed cursor */
}; };

View File

@ -87,7 +87,7 @@ int valid_combinations[][MAX_CHANNELS + 1] =
* Static variables * Static variables
*/ */
static int global_gimage_ID = 1; static int global_gimage_ID = 1;
link_ptr image_list = NULL; GSList *image_list = NULL;
/* static functions */ /* static functions */
@ -125,7 +125,7 @@ gimage_create (void)
gimage->comp_preview_valid[2] = FALSE; gimage->comp_preview_valid[2] = FALSE;
gimage->comp_preview = NULL; gimage->comp_preview = NULL;
image_list = append_to_list (image_list, (void *) gimage); image_list = g_slist_append (image_list, (void *) gimage);
return gimage; return gimage;
} }
@ -265,7 +265,7 @@ gimage_resize (GImage *gimage, int new_width, int new_height,
Channel *channel; Channel *channel;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
link_ptr list; GSList *list;
if (new_width <= 0 || new_height <= 0) if (new_width <= 0 || new_height <= 0)
{ {
@ -295,7 +295,7 @@ gimage_resize (GImage *gimage, int new_width, int new_height,
{ {
channel = (Channel *) list->data; channel = (Channel *) list->data;
channel_resize (channel, new_width, new_height, offset_x, offset_y); channel_resize (channel, new_width, new_height, offset_x, offset_y);
list = next_item (list); list = g_slist_next (list);
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
@ -308,7 +308,7 @@ gimage_resize (GImage *gimage, int new_width, int new_height,
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
layer_translate (layer, offset_x, offset_y); layer_translate (layer, offset_x, offset_y);
list = next_item (list); list = g_slist_next (list);
} }
/* Make sure the projection matches the gimage size */ /* Make sure the projection matches the gimage size */
@ -335,7 +335,7 @@ gimage_scale (GImage *gimage, int new_width, int new_height)
Channel *channel; Channel *channel;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
link_ptr list; GSList *list;
int old_width, old_height; int old_width, old_height;
int layer_width, layer_height; int layer_width, layer_height;
@ -363,7 +363,7 @@ gimage_scale (GImage *gimage, int new_width, int new_height)
{ {
channel = (Channel *) list->data; channel = (Channel *) list->data;
channel_scale (channel, new_width, new_height); channel_scale (channel, new_width, new_height);
list = next_item (list); list = g_slist_next (list);
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
@ -379,7 +379,7 @@ gimage_scale (GImage *gimage, int new_width, int new_height)
layer_width = (new_width * drawable_width (GIMP_DRAWABLE(layer))) / old_width; layer_width = (new_width * drawable_width (GIMP_DRAWABLE(layer))) / old_width;
layer_height = (new_height * drawable_height (GIMP_DRAWABLE(layer))) / old_height; layer_height = (new_height * drawable_height (GIMP_DRAWABLE(layer))) / old_height;
layer_scale (layer, layer_width, layer_height, FALSE); layer_scale (layer, layer_width, layer_height, FALSE);
list = next_item (list); list = g_slist_next (list);
} }
/* Make sure the projection matches the gimage size */ /* Make sure the projection matches the gimage size */
@ -403,7 +403,7 @@ gimage_scale (GImage *gimage, int new_width, int new_height)
GImage * GImage *
gimage_get_named (char *name) gimage_get_named (char *name)
{ {
link_ptr tmp = image_list; GSList *tmp = image_list;
GImage *gimage; GImage *gimage;
char *str; char *str;
@ -414,7 +414,7 @@ gimage_get_named (char *name)
if (strcmp (str, name) == 0) if (strcmp (str, name) == 0)
return gimage; return gimage;
tmp = next_item (tmp); tmp = g_slist_next (tmp);
} }
return NULL; return NULL;
@ -424,7 +424,7 @@ gimage_get_named (char *name)
GImage * GImage *
gimage_get_ID (int ID) gimage_get_ID (int ID)
{ {
link_ptr tmp = image_list; GSList *tmp = image_list;
GImage *gimage; GImage *gimage;
while (tmp) while (tmp)
@ -433,7 +433,7 @@ gimage_get_ID (int ID)
if (gimage->ID == ID) if (gimage->ID == ID)
return gimage; return gimage;
tmp = next_item (tmp); tmp = g_slist_next (tmp);
} }
return NULL; return NULL;
@ -479,7 +479,7 @@ gimage_delete (GImage *gimage)
undo_free (gimage); undo_free (gimage);
/* remove this image from the global list */ /* remove this image from the global list */
image_list = remove_from_list (image_list, (void *) gimage); image_list = g_slist_remove (image_list, (void *) gimage);
gimage_free_projection (gimage); gimage_free_projection (gimage);
gimage_free_shadow (gimage); gimage_free_shadow (gimage);
@ -958,33 +958,33 @@ project_channel (GImage *gimage, Channel *channel,
static void static void
gimage_free_layers (GImage *gimage) gimage_free_layers (GImage *gimage)
{ {
link_ptr list = gimage->layers; GSList *list = gimage->layers;
Layer * layer; Layer * layer;
while (list) while (list)
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
layer_delete (layer); layer_delete (layer);
list = next_item (list); list = g_slist_next (list);
} }
free_list (gimage->layers); g_slist_free (gimage->layers);
free_list (gimage->layer_stack); g_slist_free (gimage->layer_stack);
} }
static void static void
gimage_free_channels (GImage *gimage) gimage_free_channels (GImage *gimage)
{ {
link_ptr list = gimage->channels; GSList *list = gimage->channels;
Channel * channel; Channel * channel;
while (list) while (list)
{ {
channel = (Channel *) list->data; channel = (Channel *) list->data;
channel_delete (channel); channel_delete (channel);
list = next_item (list); list = g_slist_next (list);
} }
free_list (gimage->channels); g_slist_free (gimage->channels);
} }
@ -995,8 +995,8 @@ gimage_construct_layers (GImage *gimage, int x, int y, int w, int h)
int x1, y1, x2, y2; int x1, y1, x2, y2;
PixelRegion src1PR, src2PR, maskPR; PixelRegion src1PR, src2PR, maskPR;
PixelRegion * mask; PixelRegion * mask;
link_ptr list = gimage->layers; GSList *list = gimage->layers;
link_ptr reverse_list = NULL; GSList *reverse_list = NULL;
int off_x, off_y; int off_x, off_y;
/* composite the floating selection if it exists */ /* composite the floating selection if it exists */
@ -1040,9 +1040,9 @@ gimage_construct_layers (GImage *gimage, int x, int y, int w, int h)
/* only add layers that are visible and not floating selections to the list */ /* only add layers that are visible and not floating selections to the list */
if (!layer_is_floating_sel (layer) && drawable_visible (GIMP_DRAWABLE(layer))) if (!layer_is_floating_sel (layer) && drawable_visible (GIMP_DRAWABLE(layer)))
reverse_list = add_to_list (reverse_list, layer); reverse_list = g_slist_prepend (reverse_list, layer);
list = next_item (list); list = g_slist_next (list);
} }
while (reverse_list) while (reverse_list)
@ -1109,10 +1109,10 @@ gimage_construct_layers (GImage *gimage, int x, int y, int w, int h)
} }
gimage->construct_flag = 1; /* something was projected */ gimage->construct_flag = 1; /* something was projected */
reverse_list = next_item (reverse_list); reverse_list = g_slist_next (reverse_list);
} }
free_list (reverse_list); g_slist_free (reverse_list);
} }
@ -1121,14 +1121,14 @@ gimage_construct_channels (GImage *gimage, int x, int y, int w, int h)
{ {
Channel * channel; Channel * channel;
PixelRegion src1PR, src2PR; PixelRegion src1PR, src2PR;
link_ptr list = gimage->channels; GSList *list = gimage->channels;
link_ptr reverse_list = NULL; GSList *reverse_list = NULL;
/* reverse the channel list */ /* reverse the channel list */
while (list) while (list)
{ {
reverse_list = add_to_list (reverse_list, list->data); reverse_list = g_slist_prepend (reverse_list, list->data);
list = next_item (list); list = g_slist_next (list);
} }
while (reverse_list) while (reverse_list)
@ -1146,17 +1146,17 @@ gimage_construct_channels (GImage *gimage, int x, int y, int w, int h)
gimage->construct_flag = 1; gimage->construct_flag = 1;
} }
reverse_list = next_item (reverse_list); reverse_list = g_slist_next (reverse_list);
} }
free_list (reverse_list); g_slist_free (reverse_list);
} }
static void static void
gimage_initialize_projection (GImage *gimage, int x, int y, int w, int h) gimage_initialize_projection (GImage *gimage, int x, int y, int w, int h)
{ {
link_ptr list; GSList *list;
Layer *layer; Layer *layer;
int coverage = 0; int coverage = 0;
PixelRegion PR; PixelRegion PR;
@ -1180,7 +1180,7 @@ gimage_initialize_projection (GImage *gimage, int x, int y, int w, int h)
(off_y + drawable_height (GIMP_DRAWABLE(layer)) >= y + h)) (off_y + drawable_height (GIMP_DRAWABLE(layer)) >= y + h))
coverage = 1; coverage = 1;
list = next_item (list); list = g_slist_next (list);
} }
if (!coverage) if (!coverage)
@ -1368,7 +1368,7 @@ int
gimage_get_layer_index (GImage *gimage, Layer *layer_arg) gimage_get_layer_index (GImage *gimage, Layer *layer_arg)
{ {
Layer *layer; Layer *layer;
link_ptr layers = gimage->layers; GSList *layers = gimage->layers;
int index = 0; int index = 0;
while (layers) while (layers)
@ -1378,7 +1378,7 @@ gimage_get_layer_index (GImage *gimage, Layer *layer_arg)
return index; return index;
index++; index++;
layers = next_item (layers); layers = g_slist_next (layers);
} }
return -1; return -1;
@ -1388,7 +1388,7 @@ int
gimage_get_channel_index (GImage *gimage, Channel *channel_ID) gimage_get_channel_index (GImage *gimage, Channel *channel_ID)
{ {
Channel *channel; Channel *channel;
link_ptr channels = gimage->channels; GSList *channels = gimage->channels;
int index = 0; int index = 0;
while (channels) while (channels)
@ -1398,7 +1398,7 @@ gimage_get_channel_index (GImage *gimage, Channel *channel_ID)
return index; return index;
index++; index++;
channels = next_item (channels); channels = g_slist_next (channels);
} }
return -1; return -1;
@ -1498,8 +1498,8 @@ gimage_set_active_layer (GImage *gimage, Layer * layer)
return NULL; return NULL;
/* Configure the layer stack to reflect this change */ /* Configure the layer stack to reflect this change */
gimage->layer_stack = remove_from_list (gimage->layer_stack, (void *) layer); gimage->layer_stack = g_slist_remove (gimage->layer_stack, (void *) layer);
gimage->layer_stack = add_to_list (gimage->layer_stack, (void *) layer); gimage->layer_stack = g_slist_prepend (gimage->layer_stack, (void *) layer);
/* invalidate the selection boundary because of a layer modification */ /* invalidate the selection boundary because of a layer modification */
layer_invalidate_boundary (layer); layer_invalidate_boundary (layer);
@ -1600,7 +1600,7 @@ Layer *
gimage_pick_correlate_layer (GImage *gimage, int x, int y) gimage_pick_correlate_layer (GImage *gimage, int x, int y)
{ {
Layer *layer; Layer *layer;
link_ptr list; GSList *list;
list = gimage->layers; list = gimage->layers;
while (list) while (list)
@ -1609,7 +1609,7 @@ gimage_pick_correlate_layer (GImage *gimage, int x, int y)
if (layer_pick_correlate (layer, x, y)) if (layer_pick_correlate (layer, x, y))
return layer; return layer;
list = next_item (list); list = g_slist_next (list);
} }
return NULL; return NULL;
@ -1672,8 +1672,8 @@ gimage_raise_layer (GImage *gimage, Layer *layer_arg)
{ {
Layer *layer; Layer *layer;
Layer *prev_layer; Layer *prev_layer;
link_ptr list; GSList *list;
link_ptr prev; GSList *prev;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int index = -1; int index = -1;
int off_x, off_y; int off_x, off_y;
@ -1724,7 +1724,7 @@ gimage_raise_layer (GImage *gimage, Layer *layer_arg)
prev = list; prev = list;
index++; index++;
list = next_item (list); list = g_slist_next (list);
} }
return NULL; return NULL;
@ -1736,8 +1736,8 @@ gimage_lower_layer (GImage *gimage, Layer *layer_arg)
{ {
Layer *layer; Layer *layer;
Layer *next_layer; Layer *next_layer;
link_ptr list; GSList *list;
link_ptr next; GSList *next;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int index = 0; int index = 0;
int off_x, off_y; int off_x, off_y;
@ -1750,7 +1750,7 @@ gimage_lower_layer (GImage *gimage, Layer *layer_arg)
while (list) while (list)
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
next = next_item (list); next = g_slist_next (list);
if (next) if (next)
next_layer = (Layer *) next->data; next_layer = (Layer *) next->data;
@ -1801,8 +1801,8 @@ gimage_lower_layer (GImage *gimage, Layer *layer_arg)
Layer * Layer *
gimage_merge_visible_layers (GImage *gimage, MergeType merge_type) gimage_merge_visible_layers (GImage *gimage, MergeType merge_type)
{ {
link_ptr layer_list; GSList *layer_list;
link_ptr merge_list = NULL; GSList *merge_list = NULL;
Layer *layer; Layer *layer;
layer_list = gimage->layers; layer_list = gimage->layers;
@ -1810,22 +1810,22 @@ gimage_merge_visible_layers (GImage *gimage, MergeType merge_type)
{ {
layer = (Layer *) layer_list->data; layer = (Layer *) layer_list->data;
if (drawable_visible (GIMP_DRAWABLE(layer))) if (drawable_visible (GIMP_DRAWABLE(layer)))
merge_list = append_to_list (merge_list, layer); merge_list = g_slist_append (merge_list, layer);
layer_list = next_item (layer_list); layer_list = g_slist_next (layer_list);
} }
if (merge_list && merge_list->next) if (merge_list && merge_list->next)
{ {
layer = gimage_merge_layers (gimage, merge_list, merge_type); layer = gimage_merge_layers (gimage, merge_list, merge_type);
free_list (merge_list); g_slist_free (merge_list);
return layer; return layer;
} }
else else
{ {
message_box ("There are not enough visible layers for a merge.\nThere must be at least two.", message_box ("There are not enough visible layers for a merge.\nThere must be at least two.",
NULL, NULL); NULL, NULL);
free_list (merge_list); g_slist_free (merge_list);
return NULL; return NULL;
} }
} }
@ -1834,8 +1834,8 @@ gimage_merge_visible_layers (GImage *gimage, MergeType merge_type)
Layer * Layer *
gimage_flatten (GImage *gimage) gimage_flatten (GImage *gimage)
{ {
link_ptr layer_list; GSList *layer_list;
link_ptr merge_list = NULL; GSList *merge_list = NULL;
Layer *layer; Layer *layer;
layer_list = gimage->layers; layer_list = gimage->layers;
@ -1843,21 +1843,21 @@ gimage_flatten (GImage *gimage)
{ {
layer = (Layer *) layer_list->data; layer = (Layer *) layer_list->data;
if (drawable_visible (GIMP_DRAWABLE(layer))) if (drawable_visible (GIMP_DRAWABLE(layer)))
merge_list = append_to_list (merge_list, layer); merge_list = g_slist_append (merge_list, layer);
layer_list = next_item (layer_list); layer_list = g_slist_next (layer_list);
} }
layer = gimage_merge_layers (gimage, merge_list, FlattenImage); layer = gimage_merge_layers (gimage, merge_list, FlattenImage);
free_list (merge_list); g_slist_free (merge_list);
return layer; return layer;
} }
Layer * Layer *
gimage_merge_layers (GImage *gimage, link_ptr merge_list, MergeType merge_type) gimage_merge_layers (GImage *gimage, GSList *merge_list, MergeType merge_type)
{ {
link_ptr reverse_list = NULL; GSList *reverse_list = NULL;
PixelRegion src1PR, src2PR, maskPR; PixelRegion src1PR, src2PR, maskPR;
PixelRegion * mask; PixelRegion * mask;
Layer *merge_layer; Layer *merge_layer;
@ -1936,8 +1936,8 @@ gimage_merge_layers (GImage *gimage, link_ptr merge_list, MergeType merge_type)
} }
count ++; count ++;
reverse_list = add_to_list (reverse_list, layer); reverse_list = g_slist_prepend (reverse_list, layer);
merge_list = next_item (merge_list); merge_list = g_slist_next (merge_list);
} }
if ((x2 - x1) == 0 || (y2 - y1) == 0) if ((x2 - x1) == 0 || (y2 - y1) == 0)
@ -2002,7 +2002,7 @@ gimage_merge_layers (GImage *gimage, link_ptr merge_list, MergeType merge_type)
* in order to add the final, merged layer to the layer list correctly * in order to add the final, merged layer to the layer list correctly
*/ */
layer = (Layer *) reverse_list->data; layer = (Layer *) reverse_list->data;
position = list_length (gimage->layers) - gimage_get_layer_index (gimage, layer); position = g_slist_length (gimage->layers) - gimage_get_layer_index (gimage, layer);
/* set the mode of the bottom layer to normal so that the contents /* set the mode of the bottom layer to normal so that the contents
* aren't lost when merging with the all-alpha merge_layer * aren't lost when merging with the all-alpha merge_layer
@ -2052,14 +2052,14 @@ gimage_merge_layers (GImage *gimage, link_ptr merge_list, MergeType merge_type)
layer->opacity, layer->mode, active, operation); layer->opacity, layer->mode, active, operation);
gimage_remove_layer (gimage, layer); gimage_remove_layer (gimage, layer);
reverse_list = next_item (reverse_list); reverse_list = g_slist_next (reverse_list);
} }
/* Save old mode in undo */ /* Save old mode in undo */
if (bottom) if (bottom)
bottom -> mode = merge_layer -> mode; bottom -> mode = merge_layer -> mode;
free_list (reverse_list); g_slist_free (reverse_list);
/* if the type is flatten, remove all the remaining layers */ /* if the type is flatten, remove all the remaining layers */
if (merge_type == FlattenImage) if (merge_type == FlattenImage)
@ -2068,7 +2068,7 @@ gimage_merge_layers (GImage *gimage, link_ptr merge_list, MergeType merge_type)
while (merge_list) while (merge_list)
{ {
layer = (Layer *) merge_list->data; layer = (Layer *) merge_list->data;
merge_list = next_item (merge_list); merge_list = g_slist_next (merge_list);
gimage_remove_layer (gimage, layer); gimage_remove_layer (gimage, layer);
} }
@ -2077,7 +2077,7 @@ gimage_merge_layers (GImage *gimage, link_ptr merge_list, MergeType merge_type)
else else
{ {
/* Add the layer to the gimage */ /* Add the layer to the gimage */
gimage_add_layer (gimage, merge_layer, (list_length (gimage->layers) - position + 1)); gimage_add_layer (gimage, merge_layer, (g_slist_length (gimage->layers) - position + 1));
} }
/* End the merge undo group */ /* End the merge undo group */
@ -2110,7 +2110,7 @@ gimage_add_layer (GImage *gimage, Layer *float_layer, int position)
} }
{ {
link_ptr ll = gimage->layers; GSList *ll = gimage->layers;
while (ll) while (ll)
{ {
if (ll->data == float_layer) if (ll->data == float_layer)
@ -2118,7 +2118,7 @@ gimage_add_layer (GImage *gimage, Layer *float_layer, int position)
warning("gimage_add_layer: trying to add layer to image twice"); warning("gimage_add_layer: trying to add layer to image twice");
return NULL; return NULL;
} }
ll = next_item(ll); ll = g_slist_next(ll);
} }
} }
@ -2147,11 +2147,11 @@ gimage_add_layer (GImage *gimage, Layer *float_layer, int position)
*/ */
if (gimage_floating_sel (gimage) && (gimage->floating_sel != float_layer) && position == 0) if (gimage_floating_sel (gimage) && (gimage->floating_sel != float_layer) && position == 0)
position = 1; position = 1;
gimage->layers = insert_in_list (gimage->layers, float_layer, position); gimage->layers = g_slist_insert (gimage->layers, float_layer, position);
} }
else else
gimage->layers = add_to_list (gimage->layers, float_layer); gimage->layers = g_slist_prepend (gimage->layers, float_layer);
gimage->layer_stack = add_to_list (gimage->layer_stack, float_layer); gimage->layer_stack = g_slist_prepend (gimage->layer_stack, float_layer);
/* notify the layers dialog of the currently active layer */ /* notify the layers dialog of the currently active layer */
gimage_set_active_layer (gimage, float_layer); gimage_set_active_layer (gimage, float_layer);
@ -2181,8 +2181,8 @@ gimage_remove_layer (GImage *gimage, Layer * layer)
lu->prev_layer = layer; lu->prev_layer = layer;
lu->undo_type = 1; lu->undo_type = 1;
gimage->layers = remove_from_list (gimage->layers, layer); gimage->layers = g_slist_remove (gimage->layers, layer);
gimage->layer_stack = remove_from_list (gimage->layer_stack, layer); gimage->layer_stack = g_slist_remove (gimage->layer_stack, layer);
/* If this was the floating selection, reset the fs pointer */ /* If this was the floating selection, reset the fs pointer */
if (gimage->floating_sel == layer) if (gimage->floating_sel == layer)
@ -2312,8 +2312,8 @@ gimage_raise_channel (GImage *gimage, Channel * channel_arg)
{ {
Channel *channel; Channel *channel;
Channel *prev_channel; Channel *prev_channel;
link_ptr list; GSList *list;
link_ptr prev; GSList *prev;
int index = -1; int index = -1;
list = gimage->channels; list = gimage->channels;
@ -2344,7 +2344,7 @@ gimage_raise_channel (GImage *gimage, Channel * channel_arg)
prev = list; prev = list;
index++; index++;
list = next_item (list); list = g_slist_next (list);
} }
return NULL; return NULL;
@ -2356,8 +2356,8 @@ gimage_lower_channel (GImage *gimage, Channel *channel_arg)
{ {
Channel *channel; Channel *channel;
Channel *next_channel; Channel *next_channel;
link_ptr list; GSList *list;
link_ptr next; GSList *next;
int index = 0; int index = 0;
list = gimage->channels; list = gimage->channels;
@ -2366,7 +2366,7 @@ gimage_lower_channel (GImage *gimage, Channel *channel_arg)
while (list) while (list)
{ {
channel = (Channel *) list->data; channel = (Channel *) list->data;
next = next_item (list); next = g_slist_next (list);
if (next) if (next)
next_channel = (Channel *) next->data; next_channel = (Channel *) next->data;
@ -2409,7 +2409,7 @@ gimage_add_channel (GImage *gimage, Channel *channel, int position)
} }
{ {
link_ptr cc = gimage->channels; GSList *cc = gimage->channels;
while (cc) while (cc)
{ {
if (cc->data == channel) if (cc->data == channel)
@ -2417,7 +2417,7 @@ gimage_add_channel (GImage *gimage, Channel *channel, int position)
warning("gimage_add_channel: trying to add channel to image twice"); warning("gimage_add_channel: trying to add channel to image twice");
return NULL; return NULL;
} }
cc = next_item(cc); cc = g_slist_next (cc);
} }
} }
@ -2431,7 +2431,7 @@ gimage_add_channel (GImage *gimage, Channel *channel, int position)
undo_push_channel (gimage, cu); undo_push_channel (gimage, cu);
/* add the channel to the list */ /* add the channel to the list */
gimage->channels = add_to_list (gimage->channels, channel); gimage->channels = g_slist_prepend (gimage->channels, channel);
/* notify this gimage of the currently active channel */ /* notify this gimage of the currently active channel */
gimage_set_active_channel (gimage, channel); gimage_set_active_channel (gimage, channel);
@ -2458,7 +2458,7 @@ gimage_remove_channel (GImage *gimage, Channel *channel)
cu->prev_channel = gimage->active_channel; cu->prev_channel = gimage->active_channel;
cu->undo_type = 1; cu->undo_type = 1;
gimage->channels = remove_from_list (gimage->channels, channel); gimage->channels = g_slist_remove (gimage->channels, channel);
if (gimage->active_channel == channel) if (gimage->active_channel == channel)
{ {
@ -2783,8 +2783,8 @@ gimage_construct_composite_preview (GImage *gimage, int width, int height)
TempBuf *comp; TempBuf *comp;
TempBuf *layer_buf; TempBuf *layer_buf;
TempBuf *mask_buf; TempBuf *mask_buf;
link_ptr list = gimage->layers; GSList *list = gimage->layers;
link_ptr reverse_list = NULL; GSList *reverse_list = NULL;
double ratio; double ratio;
int x, y, w, h; int x, y, w, h;
int x1, y1, x2, y2; int x1, y1, x2, y2;
@ -2819,9 +2819,9 @@ gimage_construct_composite_preview (GImage *gimage, int width, int height)
/* only add layers that are visible and not floating selections to the list */ /* only add layers that are visible and not floating selections to the list */
if (!layer_is_floating_sel (layer) && drawable_visible (GIMP_DRAWABLE(layer))) if (!layer_is_floating_sel (layer) && drawable_visible (GIMP_DRAWABLE(layer)))
reverse_list = add_to_list (reverse_list, layer); reverse_list = g_slist_prepend (reverse_list, layer);
list = next_item (list); list = g_slist_next (list);
} }
construct_flag = 0; construct_flag = 0;
@ -2900,10 +2900,10 @@ gimage_construct_composite_preview (GImage *gimage, int width, int height)
construct_flag = 1; construct_flag = 1;
reverse_list = next_item (reverse_list); reverse_list = g_slist_next (reverse_list);
} }
free_list (reverse_list); g_slist_free (reverse_list);
return comp; return comp;
} }
@ -2978,14 +2978,14 @@ gimage_invalidate_preview (GImage *gimage)
void void
gimage_invalidate_previews (void) gimage_invalidate_previews (void)
{ {
link_ptr tmp = image_list; GSList *tmp = image_list;
GImage *gimage; GImage *gimage;
while (tmp) while (tmp)
{ {
gimage = (GImage *) tmp->data; gimage = (GImage *) tmp->data;
gimage_invalidate_preview (gimage); gimage_invalidate_preview (gimage);
tmp = next_item (tmp); tmp = g_slist_next (tmp);
} }
} }

View File

@ -22,7 +22,6 @@
#include "drawable.h" #include "drawable.h"
#include "channel.h" #include "channel.h"
#include "layer.h" #include "layer.h"
#include "linked.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
@ -125,9 +124,9 @@ struct _GImage
GList *guides; /* guides */ GList *guides; /* guides */
/* Layer/Channel attributes */ /* Layer/Channel attributes */
link_ptr layers; /* the list of layers */ GSList *layers; /* the list of layers */
link_ptr channels; /* the list of masks */ GSList *channels; /* the list of masks */
link_ptr layer_stack; /* the layers in MRU order */ GSList *layer_stack; /* the layers in MRU order */
Layer * active_layer; /* ID of active layer */ Layer * active_layer; /* ID of active layer */
Channel * active_channel; /* ID of active channel */ Channel * active_channel; /* ID of active channel */
@ -141,8 +140,8 @@ struct _GImage
/* "by color" selection dialog */ /* "by color" selection dialog */
/* Undo apparatus */ /* Undo apparatus */
link_ptr undo_stack; /* stack for undo operations */ GSList *undo_stack; /* stack for undo operations */
link_ptr redo_stack; /* stack for redo operations */ GSList *redo_stack; /* stack for redo operations */
int undo_bytes; /* bytes in undo stack */ int undo_bytes; /* bytes in undo stack */
int undo_levels; /* levels in undo stack */ int undo_levels; /* levels in undo stack */
int pushing_undo_group; /* undo group status flag */ int pushing_undo_group; /* undo group status flag */
@ -204,7 +203,7 @@ Layer * gimage_raise_layer (GImage *, Layer *);
Layer * gimage_lower_layer (GImage *, Layer *); Layer * gimage_lower_layer (GImage *, Layer *);
Layer * gimage_merge_visible_layers (GImage *, MergeType); Layer * gimage_merge_visible_layers (GImage *, MergeType);
Layer * gimage_flatten (GImage *); Layer * gimage_flatten (GImage *);
Layer * gimage_merge_layers (GImage *, link_ptr, MergeType); Layer * gimage_merge_layers (GImage *, GSList *, MergeType);
Layer * gimage_add_layer (GImage *, Layer *, int); Layer * gimage_add_layer (GImage *, Layer *, int);
Layer * gimage_remove_layer (GImage *, Layer *); Layer * gimage_remove_layer (GImage *, Layer *);
LayerMask * gimage_add_layer_mask (GImage *, Layer *, LayerMask *); LayerMask * gimage_add_layer_mask (GImage *, Layer *, LayerMask *);

View File

@ -33,7 +33,7 @@ static int int_value;
static int success; static int success;
static Argument *return_args; static Argument *return_args;
extern link_ptr image_list; extern GSList * image_list;
static GImage * duplicate (GImage *gimage); static GImage * duplicate (GImage *gimage);
@ -44,7 +44,7 @@ static Argument * channel_ops_duplicate_invoker (Argument *args);
static Argument * static Argument *
gimage_list_images_invoker (Argument *args) gimage_list_images_invoker (Argument *args)
{ {
link_ptr list; GSList *list;
int num_images; int num_images;
int *image_ids; int *image_ids;
Argument *return_args; Argument *return_args;
@ -55,7 +55,7 @@ gimage_list_images_invoker (Argument *args)
if (success) if (success)
{ {
list = image_list; list = image_list;
num_images = list_length (list); num_images = g_slist_length (list);
image_ids = NULL; image_ids = NULL;
if (num_images) if (num_images)
@ -64,7 +64,7 @@ gimage_list_images_invoker (Argument *args)
image_ids = (int *) g_malloc (sizeof (int) * num_images); image_ids = (int *) g_malloc (sizeof (int) * num_images);
for (i = 0; i < num_images; i++, list = next_item (list)) for (i = 0; i < num_images; i++, list = g_slist_next (list))
image_ids[i] = ((GImage *) list->data)->ID; image_ids[i] = ((GImage *) list->data)->ID;
} }
@ -478,7 +478,7 @@ static Argument *
gimage_get_layers_invoker (Argument *args) gimage_get_layers_invoker (Argument *args)
{ {
GImage *gimage; GImage *gimage;
link_ptr layer_list; GSList *layer_list;
int num_layers; int num_layers;
int *layer_ids; int *layer_ids;
Argument *return_args; Argument *return_args;
@ -495,7 +495,7 @@ gimage_get_layers_invoker (Argument *args)
if (success) if (success)
{ {
layer_list = gimage->layers; layer_list = gimage->layers;
num_layers = list_length (layer_list); num_layers = g_slist_length (layer_list);
layer_ids = NULL; layer_ids = NULL;
if (num_layers) if (num_layers)
@ -504,7 +504,7 @@ gimage_get_layers_invoker (Argument *args)
layer_ids = (int *) g_malloc (sizeof (int) * num_layers); layer_ids = (int *) g_malloc (sizeof (int) * num_layers);
for (i = 0; i < num_layers; i++, layer_list = next_item (layer_list)) for (i = 0; i < num_layers; i++, layer_list = g_slist_next (layer_list))
layer_ids[i] = drawable_ID (GIMP_DRAWABLE(((Layer *) layer_list->data))); layer_ids[i] = drawable_ID (GIMP_DRAWABLE(((Layer *) layer_list->data)));
} }
@ -568,7 +568,7 @@ gimage_get_channels_invoker (Argument *args)
GImage *gimage; GImage *gimage;
int num_channels; int num_channels;
int *channel_ids; int *channel_ids;
link_ptr channel_list; GSList *channel_list;
Argument *return_args; Argument *return_args;
success = TRUE; success = TRUE;
@ -583,7 +583,7 @@ gimage_get_channels_invoker (Argument *args)
if (success) if (success)
{ {
channel_list = gimage->channels; channel_list = gimage->channels;
num_channels = list_length (channel_list); num_channels = g_slist_length (channel_list);
channel_ids = NULL; channel_ids = NULL;
if (num_channels) if (num_channels)
@ -592,7 +592,7 @@ gimage_get_channels_invoker (Argument *args)
channel_ids = (int *) g_malloc (sizeof (int) * num_channels); channel_ids = (int *) g_malloc (sizeof (int) * num_channels);
for (i = 0; i < num_channels; i++, channel_list = next_item (channel_list)) for (i = 0; i < num_channels; i++, channel_list = g_slist_next (channel_list))
channel_ids[i] = drawable_ID (GIMP_DRAWABLE(((Channel *) channel_list->data))); channel_ids[i] = drawable_ID (GIMP_DRAWABLE(((Channel *) channel_list->data)));
} }
@ -3223,7 +3223,7 @@ duplicate (GImage *gimage)
Layer *layer, *new_layer; Layer *layer, *new_layer;
Layer *floating_layer; Layer *floating_layer;
Channel *channel, *new_channel; Channel *channel, *new_channel;
link_ptr list; GSList *list;
Layer *active_layer = NULL; Layer *active_layer = NULL;
Channel *active_channel = NULL; Channel *active_channel = NULL;
GimpDrawable *new_floating_sel_drawable = NULL; GimpDrawable *new_floating_sel_drawable = NULL;
@ -3250,7 +3250,7 @@ duplicate (GImage *gimage)
while (list) while (list)
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
list = next_item (list); list = g_slist_next (list);
new_layer = layer_copy (layer, FALSE); new_layer = layer_copy (layer, FALSE);
GIMP_DRAWABLE(new_layer)->gimage_ID = new_gimage->ID; GIMP_DRAWABLE(new_layer)->gimage_ID = new_gimage->ID;
@ -3286,7 +3286,7 @@ duplicate (GImage *gimage)
while (list) while (list)
{ {
channel = (Channel *) list->data; channel = (Channel *) list->data;
list = next_item (list); list = g_slist_next (list);
new_channel = channel_copy (channel); new_channel = channel_copy (channel);

View File

@ -26,7 +26,6 @@
#include "errors.h" #include "errors.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "layer.h" #include "layer.h"
#include "linked.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -412,7 +411,7 @@ channel_preview (Channel *channel, int width, int height)
void void
channel_invalidate_previews (int gimage_id) channel_invalidate_previews (int gimage_id)
{ {
link_ptr tmp; GSList * tmp;
Channel * channel; Channel * channel;
GImage * gimage; GImage * gimage;
@ -425,7 +424,7 @@ channel_invalidate_previews (int gimage_id)
{ {
channel = (Channel *) tmp->data; channel = (Channel *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE(channel)); drawable_invalidate_preview (GIMP_DRAWABLE(channel));
tmp = next_item (tmp); tmp = g_slist_next (tmp);
} }
} }

View File

@ -459,7 +459,7 @@ static GtkWidget *
build_palette_menu(int *default_palette){ build_palette_menu(int *default_palette){
GtkWidget *menu; GtkWidget *menu;
GtkWidget *menu_item; GtkWidget *menu_item;
link_ptr list; GSList *list;
PaletteEntriesP entries; PaletteEntriesP entries;
int i; int i;
@ -478,7 +478,7 @@ build_palette_menu(int *default_palette){
for(i=0,list = palette_entries_list,*default_palette=-1; for(i=0,list = palette_entries_list,*default_palette=-1;
list; list;
i++,list = next_item (list)) i++,list = g_slist_next (list))
{ {
entries = (PaletteEntriesP) list->data; entries = (PaletteEntriesP) list->data;
/* fprintf(stderr, "(palette %s)\n", entries->filename);*/ /* fprintf(stderr, "(palette %s)\n", entries->filename);*/
@ -600,7 +600,7 @@ convert_image (GImage *gimage,
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
int old_type; int old_type;
link_ptr list; GSList *list;
int new_layer_type; int new_layer_type;
int new_layer_bytes; int new_layer_bytes;
int has_alpha; int has_alpha;
@ -656,7 +656,7 @@ convert_image (GImage *gimage,
while (list) while (list)
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
list = next_item (list); list = g_slist_next (list);
if (old_type == GRAY) if (old_type == GRAY)
generate_histogram_gray (quantobj->histogram, layer); generate_histogram_gray (quantobj->histogram, layer);
else else
@ -722,7 +722,7 @@ convert_image (GImage *gimage,
while (list) while (list)
{ {
layer = (Layer *) list->data; layer = (Layer *) list->data;
list = next_item (list); list = g_slist_next (list);
has_alpha = layer_has_alpha (layer); has_alpha = layer_has_alpha (layer);
switch (new_type) switch (new_type)
@ -2024,7 +2024,7 @@ static void
custompal_pass1 (QuantizeObj *quantobj) custompal_pass1 (QuantizeObj *quantobj)
{ {
int i; int i;
link_ptr list; GSList *list;
PaletteEntryP entry; PaletteEntryP entry;
/* fprintf(stderr, "custompal_pass1: using (theCustomPalette %s) from (file %s)\n", /* fprintf(stderr, "custompal_pass1: using (theCustomPalette %s) from (file %s)\n",
@ -2032,7 +2032,7 @@ custompal_pass1 (QuantizeObj *quantobj)
for (i=0,list=theCustomPalette->colors; for (i=0,list=theCustomPalette->colors;
list; list;
i++,list=next_item(list)) i++,list=g_slist_next(list))
{ {
entry=(PaletteEntryP)list->data; entry=(PaletteEntryP)list->data;
quantobj->cmap[i].red = entry->color[0]; quantobj->cmap[i].red = entry->color[0];
@ -3036,7 +3036,7 @@ convert_indexed_palette_invoker (Argument *args)
if (success) if (success)
{ {
PaletteEntriesP entries, the_palette = NULL; PaletteEntriesP entries, the_palette = NULL;
link_ptr list; GSList *list;
palette_type = args[2].value.pdb_int; palette_type = args[2].value.pdb_int;
switch(palette_type) { switch(palette_type) {
@ -3057,7 +3057,7 @@ convert_indexed_palette_invoker (Argument *args)
if (!palette_entries_list) palette_init_palettes(); if (!palette_entries_list) palette_init_palettes();
for(list = palette_entries_list; for(list = palette_entries_list;
list; list;
list = next_item(list)) { list = g_slist_next(list)) {
entries = (PaletteEntriesP) list->data; entries = (PaletteEntriesP) list->data;
if (strcmp(palette_name, entries->name)==0) { if (strcmp(palette_name, entries->name)==0) {
/* fprintf(stderr, "found it!\n"); */ /* fprintf(stderr, "found it!\n"); */

View File

@ -31,7 +31,6 @@
#include "interface.h" #include "interface.h"
#include "layer.h" #include "layer.h"
#include "layers_dialog.h" #include "layers_dialog.h"
#include "linked.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -1119,7 +1118,7 @@ void
layer_invalidate_previews (gimage_id) layer_invalidate_previews (gimage_id)
int gimage_id; int gimage_id;
{ {
link_ptr tmp; GSList * tmp;
Layer * layer; Layer * layer;
GImage * gimage; GImage * gimage;
@ -1132,7 +1131,7 @@ layer_invalidate_previews (gimage_id)
{ {
layer = (Layer *) tmp->data; layer = (Layer *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE(layer)); drawable_invalidate_preview (GIMP_DRAWABLE(layer));
tmp = next_item (tmp); tmp = g_slist_next (tmp);
} }
} }

View File

@ -18,7 +18,7 @@
#ifndef __GIMPRC_H__ #ifndef __GIMPRC_H__
#define __GIMPRC_H__ #define __GIMPRC_H__
#include "linked.h" #include <glib.h>
#include "procedural_db.h" #include "procedural_db.h"
/* global gimprc variables */ /* global gimprc variables */

View File

@ -27,7 +27,6 @@
#include "global_edit.h" #include "global_edit.h"
#include "interface.h" #include "interface.h"
#include "layer.h" #include "layer.h"
#include "linked.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "tools.h" #include "tools.h"
#include "undo.h" #include "undo.h"
@ -57,7 +56,7 @@ struct _named_buffer
/* The named buffer list */ /* The named buffer list */
link_ptr named_buffers = NULL; GSList * named_buffers = NULL;
/* The global edit buffer */ /* The global edit buffer */
TileManager * global_buf = NULL; TileManager * global_buf = NULL;
@ -449,7 +448,7 @@ global_edit_free ()
static void static void
set_list_of_named_buffers (GtkWidget *list_widget) set_list_of_named_buffers (GtkWidget *list_widget)
{ {
link_ptr list; GSList *list;
NamedBuffer *nb; NamedBuffer *nb;
GtkWidget *list_item; GtkWidget *list_item;
@ -459,7 +458,7 @@ set_list_of_named_buffers (GtkWidget *list_widget)
while (list) while (list)
{ {
nb = (NamedBuffer *) list->data; nb = (NamedBuffer *) list->data;
list = next_item (list); list = g_slist_next (list);
list_item = gtk_list_item_new_with_label (nb->name); list_item = gtk_list_item_new_with_label (nb->name);
gtk_container_add (GTK_CONTAINER (list_widget), list_item); gtk_container_add (GTK_CONTAINER (list_widget), list_item);
@ -513,7 +512,7 @@ named_buffer_delete_foreach (GtkWidget *w,
{ {
pn_dlg = (PasteNamedDlg *) client_data; pn_dlg = (PasteNamedDlg *) client_data;
nb = (NamedBuffer *) gtk_object_get_user_data (GTK_OBJECT (w)); nb = (NamedBuffer *) gtk_object_get_user_data (GTK_OBJECT (w));
named_buffers = remove_from_list (named_buffers, (void *) nb); named_buffers = g_slist_remove (named_buffers, (void *) nb);
g_free (nb->name); g_free (nb->name);
tile_manager_destroy (nb->buf); tile_manager_destroy (nb->buf);
g_free (nb); g_free (nb);
@ -653,7 +652,7 @@ new_named_buffer_callback (GtkWidget *w,
copy_region (&srcPR, &destPR); copy_region (&srcPR, &destPR);
nb->name = g_strdup ((char *) call_data); nb->name = g_strdup ((char *) call_data);
named_buffers = append_to_list (named_buffers, (void *) nb); named_buffers = g_slist_append (named_buffers, (void *) nb);
} }
static void static void
@ -717,7 +716,7 @@ named_edit_paste (void *gdisp_ptr)
void void
named_buffers_free () named_buffers_free ()
{ {
link_ptr list; GSList *list;
NamedBuffer * nb; NamedBuffer * nb;
list = named_buffers; list = named_buffers;
@ -728,9 +727,9 @@ named_buffers_free ()
tile_manager_destroy (nb->buf); tile_manager_destroy (nb->buf);
g_free (nb->name); g_free (nb->name);
g_free (nb); g_free (nb);
list = next_item (list); list = g_slist_next (list);
} }
free_list (named_buffers); g_slist_free (named_buffers);
named_buffers = NULL; named_buffers = NULL;
} }

View File

@ -157,7 +157,6 @@
#include "gimprc.h" #include "gimprc.h"
#include "gradient.h" #include "gradient.h"
#include "interface.h" #include "interface.h"
#include "linked.h"
#include "palette.h" #include "palette.h"
@ -556,7 +555,7 @@ static Argument *gradients_sample_custom_invoker(Argument *args);
/***** Local variables *****/ /***** Local variables *****/
static int num_gradients = 0; static int num_gradients = 0;
static link_ptr gradients_list = NULL; /* The list of gradients */ static GSList *gradients_list = NULL; /* The list of gradients */
static gradient_t *curr_gradient = NULL; /* The active gradient */ static gradient_t *curr_gradient = NULL; /* The active gradient */
static gradient_t *grad_default_gradient = NULL; static gradient_t *grad_default_gradient = NULL;
@ -1088,7 +1087,7 @@ ed_set_hint(char *str)
static void static void
ed_set_list_of_gradients(void) ed_set_list_of_gradients(void)
{ {
link_ptr list; GSList *list;
gradient_t *grad; gradient_t *grad;
int n; int n;
@ -1103,7 +1102,7 @@ ed_set_list_of_gradients(void)
else else
ed_insert_in_gradients_listbox(grad, n, 0); ed_insert_in_gradients_listbox(grad, n, 0);
list = next_item(list); list = g_slist_next(list);
n++; n++;
} /* while */ } /* while */
} /* ed_set_list_of_gradients */ } /* ed_set_list_of_gradients */
@ -1436,7 +1435,7 @@ static void
ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data) ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
{ {
GList *list; GList *list;
link_ptr tmp; GSList *tmp;
int n; int n;
gradient_t *g; gradient_t *g;
GtkWidget *list_item; GtkWidget *list_item;
@ -1460,7 +1459,7 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
} /* if */ } /* if */
n++; /* Next gradient */ n++; /* Next gradient */
tmp = next_item(tmp); tmp = g_slist_next(tmp);
} /* while */ } /* while */
if (tmp == NULL) if (tmp == NULL)
@ -1470,7 +1469,7 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
list_item = curr_gradient->list_item; /* Remember list item to delete it later */ list_item = curr_gradient->list_item; /* Remember list item to delete it later */
gradients_list = remove_from_list(gradients_list, curr_gradient); gradients_list = g_slist_remove(gradients_list, curr_gradient);
/* Delete file and free gradient */ /* Delete file and free gradient */
@ -1484,7 +1483,7 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
/* Select new gradient */ /* Select new gradient */
curr_gradient = nth_item(gradients_list, n)->data; curr_gradient = g_slist_nth(gradients_list, n)->data;
gtk_list_select_item(GTK_LIST(g_editor->list), n); gtk_list_select_item(GTK_LIST(g_editor->list), n);
/* Update! */ /* Update! */
@ -1531,13 +1530,13 @@ ed_save_pov_callback(GtkWidget *widget, gpointer client_data)
static void static void
ed_refresh_callback(GtkWidget *widget, gpointer client_data) ed_refresh_callback(GtkWidget *widget, gpointer client_data)
{ {
link_ptr node; GSList *node;
gradient_t *grad; gradient_t *grad;
GList *list; GList *list;
list = NULL; list = NULL;
for (node = gradients_list; node; node = next_item(node)) { for (node = gradients_list; node; node = g_slist_next(node)) {
grad = node->data; grad = node->data;
list = g_list_append(list, grad->list_item); list = g_list_append(list, grad->list_item);
} }
@ -5054,7 +5053,7 @@ grad_free_gradient(gradient_t *grad)
static void static void
grad_free_gradients(void) grad_free_gradients(void)
{ {
link_ptr node; GSList *node;
gradient_t *grad; gradient_t *grad;
node = gradients_list; node = gradients_list;
@ -5069,10 +5068,10 @@ grad_free_gradients(void)
grad_free_gradient(grad); grad_free_gradient(grad);
node = next_item(node); node = g_slist_next(node);
} /* while */ } /* while */
free_list(gradients_list); g_slist_free(gradients_list);
num_gradients = 0; num_gradients = 0;
gradients_list = NULL; gradients_list = NULL;
@ -5236,7 +5235,7 @@ grad_create_default_gradient(void)
static int static int
grad_insert_in_gradients_list(gradient_t *grad) grad_insert_in_gradients_list(gradient_t *grad)
{ {
link_ptr tmp; GSList *tmp;
gradient_t *g; gradient_t *g;
int n; int n;
@ -5254,11 +5253,11 @@ grad_insert_in_gradients_list(gradient_t *grad)
break; /* We found the one we want */ break; /* We found the one we want */
n++; n++;
tmp = next_item(tmp); tmp = g_slist_next(tmp);
} /* while */ } /* while */
num_gradients++; num_gradients++;
gradients_list = insert_in_list(gradients_list, grad, n); gradients_list = g_slist_insert(gradients_list, grad, n);
return n; return n;
} /* grad_insert_in_gradients_list */ } /* grad_insert_in_gradients_list */
@ -5731,7 +5730,7 @@ gradients_get_list_invoker(Argument *args)
{ {
Argument *return_args; Argument *return_args;
gradient_t *grad; gradient_t *grad;
link_ptr list; GSList *list;
char **gradients; char **gradients;
int i; int i;
int success; int success;
@ -5747,7 +5746,7 @@ gradients_get_list_invoker(Argument *args)
while (list) { while (list) {
grad = list->data; grad = list->data;
gradients[i++] = g_strdup(grad->name); gradients[i++] = g_strdup(grad->name);
list = next_item(list); list = g_slist_next(list);
} /* while */ } /* while */
return_args = procedural_db_return_args(&gradients_get_list_proc, success); return_args = procedural_db_return_args(&gradients_get_list_proc, success);
@ -5857,7 +5856,7 @@ Argument *
gradients_set_active_invoker(Argument *args) gradients_set_active_invoker(Argument *args)
{ {
char *name; char *name;
link_ptr list; GSList *list;
gradient_t *grad; gradient_t *grad;
int success; int success;
@ -5890,7 +5889,7 @@ gradients_set_active_invoker(Argument *args)
break; break;
} /* if */ } /* if */
list = next_item(list); list = g_slist_next(list);
} /* while */ } /* while */
} /* if */ } /* if */

View File

@ -157,7 +157,6 @@
#include "gimprc.h" #include "gimprc.h"
#include "gradient.h" #include "gradient.h"
#include "interface.h" #include "interface.h"
#include "linked.h"
#include "palette.h" #include "palette.h"
@ -556,7 +555,7 @@ static Argument *gradients_sample_custom_invoker(Argument *args);
/***** Local variables *****/ /***** Local variables *****/
static int num_gradients = 0; static int num_gradients = 0;
static link_ptr gradients_list = NULL; /* The list of gradients */ static GSList *gradients_list = NULL; /* The list of gradients */
static gradient_t *curr_gradient = NULL; /* The active gradient */ static gradient_t *curr_gradient = NULL; /* The active gradient */
static gradient_t *grad_default_gradient = NULL; static gradient_t *grad_default_gradient = NULL;
@ -1088,7 +1087,7 @@ ed_set_hint(char *str)
static void static void
ed_set_list_of_gradients(void) ed_set_list_of_gradients(void)
{ {
link_ptr list; GSList *list;
gradient_t *grad; gradient_t *grad;
int n; int n;
@ -1103,7 +1102,7 @@ ed_set_list_of_gradients(void)
else else
ed_insert_in_gradients_listbox(grad, n, 0); ed_insert_in_gradients_listbox(grad, n, 0);
list = next_item(list); list = g_slist_next(list);
n++; n++;
} /* while */ } /* while */
} /* ed_set_list_of_gradients */ } /* ed_set_list_of_gradients */
@ -1436,7 +1435,7 @@ static void
ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data) ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
{ {
GList *list; GList *list;
link_ptr tmp; GSList *tmp;
int n; int n;
gradient_t *g; gradient_t *g;
GtkWidget *list_item; GtkWidget *list_item;
@ -1460,7 +1459,7 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
} /* if */ } /* if */
n++; /* Next gradient */ n++; /* Next gradient */
tmp = next_item(tmp); tmp = g_slist_next(tmp);
} /* while */ } /* while */
if (tmp == NULL) if (tmp == NULL)
@ -1470,7 +1469,7 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
list_item = curr_gradient->list_item; /* Remember list item to delete it later */ list_item = curr_gradient->list_item; /* Remember list item to delete it later */
gradients_list = remove_from_list(gradients_list, curr_gradient); gradients_list = g_slist_remove(gradients_list, curr_gradient);
/* Delete file and free gradient */ /* Delete file and free gradient */
@ -1484,7 +1483,7 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
/* Select new gradient */ /* Select new gradient */
curr_gradient = nth_item(gradients_list, n)->data; curr_gradient = g_slist_nth(gradients_list, n)->data;
gtk_list_select_item(GTK_LIST(g_editor->list), n); gtk_list_select_item(GTK_LIST(g_editor->list), n);
/* Update! */ /* Update! */
@ -1531,13 +1530,13 @@ ed_save_pov_callback(GtkWidget *widget, gpointer client_data)
static void static void
ed_refresh_callback(GtkWidget *widget, gpointer client_data) ed_refresh_callback(GtkWidget *widget, gpointer client_data)
{ {
link_ptr node; GSList *node;
gradient_t *grad; gradient_t *grad;
GList *list; GList *list;
list = NULL; list = NULL;
for (node = gradients_list; node; node = next_item(node)) { for (node = gradients_list; node; node = g_slist_next(node)) {
grad = node->data; grad = node->data;
list = g_list_append(list, grad->list_item); list = g_list_append(list, grad->list_item);
} }
@ -5054,7 +5053,7 @@ grad_free_gradient(gradient_t *grad)
static void static void
grad_free_gradients(void) grad_free_gradients(void)
{ {
link_ptr node; GSList *node;
gradient_t *grad; gradient_t *grad;
node = gradients_list; node = gradients_list;
@ -5069,10 +5068,10 @@ grad_free_gradients(void)
grad_free_gradient(grad); grad_free_gradient(grad);
node = next_item(node); node = g_slist_next(node);
} /* while */ } /* while */
free_list(gradients_list); g_slist_free(gradients_list);
num_gradients = 0; num_gradients = 0;
gradients_list = NULL; gradients_list = NULL;
@ -5236,7 +5235,7 @@ grad_create_default_gradient(void)
static int static int
grad_insert_in_gradients_list(gradient_t *grad) grad_insert_in_gradients_list(gradient_t *grad)
{ {
link_ptr tmp; GSList *tmp;
gradient_t *g; gradient_t *g;
int n; int n;
@ -5254,11 +5253,11 @@ grad_insert_in_gradients_list(gradient_t *grad)
break; /* We found the one we want */ break; /* We found the one we want */
n++; n++;
tmp = next_item(tmp); tmp = g_slist_next(tmp);
} /* while */ } /* while */
num_gradients++; num_gradients++;
gradients_list = insert_in_list(gradients_list, grad, n); gradients_list = g_slist_insert(gradients_list, grad, n);
return n; return n;
} /* grad_insert_in_gradients_list */ } /* grad_insert_in_gradients_list */
@ -5731,7 +5730,7 @@ gradients_get_list_invoker(Argument *args)
{ {
Argument *return_args; Argument *return_args;
gradient_t *grad; gradient_t *grad;
link_ptr list; GSList *list;
char **gradients; char **gradients;
int i; int i;
int success; int success;
@ -5747,7 +5746,7 @@ gradients_get_list_invoker(Argument *args)
while (list) { while (list) {
grad = list->data; grad = list->data;
gradients[i++] = g_strdup(grad->name); gradients[i++] = g_strdup(grad->name);
list = next_item(list); list = g_slist_next(list);
} /* while */ } /* while */
return_args = procedural_db_return_args(&gradients_get_list_proc, success); return_args = procedural_db_return_args(&gradients_get_list_proc, success);
@ -5857,7 +5856,7 @@ Argument *
gradients_set_active_invoker(Argument *args) gradients_set_active_invoker(Argument *args)
{ {
char *name; char *name;
link_ptr list; GSList *list;
gradient_t *grad; gradient_t *grad;
int success; int success;
@ -5890,7 +5889,7 @@ gradients_set_active_invoker(Argument *args)
break; break;
} /* if */ } /* if */
list = next_item(list); list = g_slist_next(list);
} /* while */ } /* while */
} /* if */ } /* if */

View File

@ -468,7 +468,7 @@ display_setup (BrushSelectP bsp)
static void static void
display_brushes (BrushSelectP bsp) display_brushes (BrushSelectP bsp)
{ {
link_ptr list = brush_list; /* the global brush list */ GSList * list = brush_list; /* the global brush list */
int row, col; int row, col;
GBrushP brush; GBrushP brush;
@ -500,7 +500,7 @@ display_brushes (BrushSelectP bsp)
col = 0; col = 0;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }

View File

@ -94,7 +94,7 @@ struct _ChannelsDialog {
int gimage_id; int gimage_id;
Channel * active_channel; Channel * active_channel;
Layer *floating_sel; Layer *floating_sel;
link_ptr channel_widgets; GSList *channel_widgets;
}; };
/* channels dialog widget routines */ /* channels dialog widget routines */
@ -230,7 +230,7 @@ channels_dialog_flush ()
GImage *gimage; GImage *gimage;
Channel *channel; Channel *channel;
ChannelWidget *cw; ChannelWidget *cw;
link_ptr list; GSList *list;
int gimage_pos; int gimage_pos;
int pos; int pos;
@ -255,7 +255,7 @@ channels_dialog_flush ()
{ {
cw = (ChannelWidget *) list->data; cw = (ChannelWidget *) list->data;
cw->visited = FALSE; cw->visited = FALSE;
list = next_item (list); list = g_slist_next (list);
} }
/* Add any missing channels */ /* Add any missing channels */
@ -271,7 +271,7 @@ channels_dialog_flush ()
else else
cw->visited = TRUE; cw->visited = TRUE;
list = next_item (list); list = g_slist_next (list);
} }
/* Remove any extraneous auxillary channels */ /* Remove any extraneous auxillary channels */
@ -279,7 +279,7 @@ channels_dialog_flush ()
while (list) while (list)
{ {
cw = (ChannelWidget *) list->data; cw = (ChannelWidget *) list->data;
list = next_item (list); list = g_slist_next (list);
if (cw->visited == FALSE && cw->type == Auxillary) if (cw->visited == FALSE && cw->type == Auxillary)
/* will only be true for auxillary channels */ /* will only be true for auxillary channels */
@ -292,7 +292,7 @@ channels_dialog_flush ()
while (list) while (list)
{ {
cw = (ChannelWidget *) list->data; cw = (ChannelWidget *) list->data;
list = next_item (list); list = g_slist_next (list);
if (cw->type == Auxillary) if (cw->type == Auxillary)
if ((gimage_pos = gimage_get_channel_index (gimage, cw->channel)) != pos) if ((gimage_pos = gimage_get_channel_index (gimage, cw->channel)) != pos)
@ -326,7 +326,7 @@ channels_dialog_update (int gimage_id)
ChannelWidget *cw; ChannelWidget *cw;
GImage *gimage; GImage *gimage;
Channel *channel; Channel *channel;
link_ptr list; GSList *list;
GList *item_list; GList *item_list;
if (!channelsD) if (!channelsD)
@ -345,7 +345,7 @@ channels_dialog_update (int gimage_id)
while (list) while (list)
{ {
cw = (ChannelWidget *) list->data; cw = (ChannelWidget *) list->data;
list = next_item(list); list = g_slist_next (list);
channel_widget_delete (cw); channel_widget_delete (cw);
} }
channelsD->channel_widgets = NULL; channelsD->channel_widgets = NULL;
@ -365,17 +365,17 @@ channels_dialog_update (int gimage_id)
{ {
case RGB: case RGB:
cw = create_channel_widget (gimage, NULL, Red); cw = create_channel_widget (gimage, NULL, Red);
channelsD->channel_widgets = append_to_list (channelsD->channel_widgets, cw); channelsD->channel_widgets = g_slist_append (channelsD->channel_widgets, cw);
item_list = g_list_append (item_list, cw->list_item); item_list = g_list_append (item_list, cw->list_item);
channelsD->components[0] = Red; channelsD->components[0] = Red;
cw = create_channel_widget (gimage, NULL, Green); cw = create_channel_widget (gimage, NULL, Green);
channelsD->channel_widgets = append_to_list (channelsD->channel_widgets, cw); channelsD->channel_widgets = g_slist_append (channelsD->channel_widgets, cw);
item_list = g_list_append (item_list, cw->list_item); item_list = g_list_append (item_list, cw->list_item);
channelsD->components[1] = Green; channelsD->components[1] = Green;
cw = create_channel_widget (gimage, NULL, Blue); cw = create_channel_widget (gimage, NULL, Blue);
channelsD->channel_widgets = append_to_list (channelsD->channel_widgets, cw); channelsD->channel_widgets = g_slist_append (channelsD->channel_widgets, cw);
item_list = g_list_append (item_list, cw->list_item); item_list = g_list_append (item_list, cw->list_item);
channelsD->components[2] = Blue; channelsD->components[2] = Blue;
@ -384,7 +384,7 @@ channels_dialog_update (int gimage_id)
case GRAY: case GRAY:
cw = create_channel_widget (gimage, NULL, Gray); cw = create_channel_widget (gimage, NULL, Gray);
channelsD->channel_widgets = append_to_list (channelsD->channel_widgets, cw); channelsD->channel_widgets = g_slist_append (channelsD->channel_widgets, cw);
item_list = g_list_append (item_list, cw->list_item); item_list = g_list_append (item_list, cw->list_item);
channelsD->components[0] = Gray; channelsD->components[0] = Gray;
@ -393,7 +393,7 @@ channels_dialog_update (int gimage_id)
case INDEXED: case INDEXED:
cw = create_channel_widget (gimage, NULL, Indexed); cw = create_channel_widget (gimage, NULL, Indexed);
channelsD->channel_widgets = append_to_list (channelsD->channel_widgets, cw); channelsD->channel_widgets = g_slist_append (channelsD->channel_widgets, cw);
item_list = g_list_append (item_list, cw->list_item); item_list = g_list_append (item_list, cw->list_item);
channelsD->components[0] = Indexed; channelsD->components[0] = Indexed;
@ -408,10 +408,10 @@ channels_dialog_update (int gimage_id)
/* create a channel list item */ /* create a channel list item */
channel = (Channel *) list->data; channel = (Channel *) list->data;
cw = create_channel_widget (gimage, channel, Auxillary); cw = create_channel_widget (gimage, channel, Auxillary);
channelsD->channel_widgets = append_to_list (channelsD->channel_widgets, cw); channelsD->channel_widgets = g_slist_append (channelsD->channel_widgets, cw);
item_list = g_list_append (item_list, cw->list_item); item_list = g_list_append (item_list, cw->list_item);
list = next_item (list); list = g_slist_next (list);
} }
/* get the index of the active channel */ /* get the index of the active channel */
@ -431,7 +431,7 @@ channels_dialog_clear ()
void void
channels_dialog_free () channels_dialog_free ()
{ {
link_ptr list; GSList *list;
ChannelWidget *cw; ChannelWidget *cw;
if (channelsD == NULL) if (channelsD == NULL)
@ -446,7 +446,7 @@ channels_dialog_free ()
while (list) while (list)
{ {
cw = (ChannelWidget *) list->data; cw = (ChannelWidget *) list->data;
list = next_item(list); list = g_slist_next (list);
channel_widget_delete (cw); channel_widget_delete (cw);
} }
channelsD->channel_widgets = NULL; channelsD->channel_widgets = NULL;
@ -677,7 +677,7 @@ channels_dialog_add_channel (Channel *channel)
item_list = g_list_append (item_list, channel_widget->list_item); item_list = g_list_append (item_list, channel_widget->list_item);
position = gimage_get_channel_index (gimage, channel); position = gimage_get_channel_index (gimage, channel);
channelsD->channel_widgets = insert_in_list (channelsD->channel_widgets, channel_widget, channelsD->channel_widgets = g_slist_insert (channelsD->channel_widgets, channel_widget,
position + channelsD->num_components); position + channelsD->num_components);
gtk_list_insert_items (GTK_LIST (channelsD->channel_list), item_list, gtk_list_insert_items (GTK_LIST (channelsD->channel_list), item_list,
position + channelsD->num_components); position + channelsD->num_components);
@ -920,7 +920,7 @@ static ChannelWidget *
channel_widget_get_ID (Channel *channel) channel_widget_get_ID (Channel *channel)
{ {
ChannelWidget *lw; ChannelWidget *lw;
link_ptr list; GSList *list;
if (!channelsD) if (!channelsD)
return NULL; return NULL;
@ -933,7 +933,7 @@ channel_widget_get_ID (Channel *channel)
if (lw->channel == channel) if (lw->channel == channel)
return lw; return lw;
list = next_item(list); list = g_slist_next (list);
} }
return NULL; return NULL;
@ -1042,7 +1042,7 @@ channel_widget_delete (ChannelWidget *channel_widget)
gdk_pixmap_unref (channel_widget->channel_pixmap); gdk_pixmap_unref (channel_widget->channel_pixmap);
/* Remove the channel widget from the list */ /* Remove the channel widget from the list */
channelsD->channel_widgets = remove_from_list (channelsD->channel_widgets, channel_widget); channelsD->channel_widgets = g_slist_remove (channelsD->channel_widgets, channel_widget);
/* Free the widget */ /* Free the widget */
g_free (channel_widget); g_free (channel_widget);
@ -1476,7 +1476,7 @@ channel_widget_eye_redraw (ChannelWidget *channel_widget)
static void static void
channel_widget_exclusive_visible (ChannelWidget *channel_widget) channel_widget_exclusive_visible (ChannelWidget *channel_widget)
{ {
link_ptr list; GSList *list;
ChannelWidget *cw; ChannelWidget *cw;
int visible = FALSE; int visible = FALSE;
@ -1501,7 +1501,7 @@ channel_widget_exclusive_visible (ChannelWidget *channel_widget)
} }
} }
list = next_item (list); list = g_slist_next (list);
} }
/* Now, toggle the visibility for all channels except the specified one */ /* Now, toggle the visibility for all channels except the specified one */
@ -1532,7 +1532,7 @@ channel_widget_exclusive_visible (ChannelWidget *channel_widget)
channel_widget_eye_redraw (cw); channel_widget_eye_redraw (cw);
list = next_item (list); list = g_slist_next (list);
} }
} }

View File

@ -157,7 +157,6 @@
#include "gimprc.h" #include "gimprc.h"
#include "gradient.h" #include "gradient.h"
#include "interface.h" #include "interface.h"
#include "linked.h"
#include "palette.h" #include "palette.h"
@ -556,7 +555,7 @@ static Argument *gradients_sample_custom_invoker(Argument *args);
/***** Local variables *****/ /***** Local variables *****/
static int num_gradients = 0; static int num_gradients = 0;
static link_ptr gradients_list = NULL; /* The list of gradients */ static GSList *gradients_list = NULL; /* The list of gradients */
static gradient_t *curr_gradient = NULL; /* The active gradient */ static gradient_t *curr_gradient = NULL; /* The active gradient */
static gradient_t *grad_default_gradient = NULL; static gradient_t *grad_default_gradient = NULL;
@ -1088,7 +1087,7 @@ ed_set_hint(char *str)
static void static void
ed_set_list_of_gradients(void) ed_set_list_of_gradients(void)
{ {
link_ptr list; GSList *list;
gradient_t *grad; gradient_t *grad;
int n; int n;
@ -1103,7 +1102,7 @@ ed_set_list_of_gradients(void)
else else
ed_insert_in_gradients_listbox(grad, n, 0); ed_insert_in_gradients_listbox(grad, n, 0);
list = next_item(list); list = g_slist_next(list);
n++; n++;
} /* while */ } /* while */
} /* ed_set_list_of_gradients */ } /* ed_set_list_of_gradients */
@ -1436,7 +1435,7 @@ static void
ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data) ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
{ {
GList *list; GList *list;
link_ptr tmp; GSList *tmp;
int n; int n;
gradient_t *g; gradient_t *g;
GtkWidget *list_item; GtkWidget *list_item;
@ -1460,7 +1459,7 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
} /* if */ } /* if */
n++; /* Next gradient */ n++; /* Next gradient */
tmp = next_item(tmp); tmp = g_slist_next(tmp);
} /* while */ } /* while */
if (tmp == NULL) if (tmp == NULL)
@ -1470,7 +1469,7 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
list_item = curr_gradient->list_item; /* Remember list item to delete it later */ list_item = curr_gradient->list_item; /* Remember list item to delete it later */
gradients_list = remove_from_list(gradients_list, curr_gradient); gradients_list = g_slist_remove(gradients_list, curr_gradient);
/* Delete file and free gradient */ /* Delete file and free gradient */
@ -1484,7 +1483,7 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
/* Select new gradient */ /* Select new gradient */
curr_gradient = nth_item(gradients_list, n)->data; curr_gradient = g_slist_nth(gradients_list, n)->data;
gtk_list_select_item(GTK_LIST(g_editor->list), n); gtk_list_select_item(GTK_LIST(g_editor->list), n);
/* Update! */ /* Update! */
@ -1531,13 +1530,13 @@ ed_save_pov_callback(GtkWidget *widget, gpointer client_data)
static void static void
ed_refresh_callback(GtkWidget *widget, gpointer client_data) ed_refresh_callback(GtkWidget *widget, gpointer client_data)
{ {
link_ptr node; GSList *node;
gradient_t *grad; gradient_t *grad;
GList *list; GList *list;
list = NULL; list = NULL;
for (node = gradients_list; node; node = next_item(node)) { for (node = gradients_list; node; node = g_slist_next(node)) {
grad = node->data; grad = node->data;
list = g_list_append(list, grad->list_item); list = g_list_append(list, grad->list_item);
} }
@ -5054,7 +5053,7 @@ grad_free_gradient(gradient_t *grad)
static void static void
grad_free_gradients(void) grad_free_gradients(void)
{ {
link_ptr node; GSList *node;
gradient_t *grad; gradient_t *grad;
node = gradients_list; node = gradients_list;
@ -5069,10 +5068,10 @@ grad_free_gradients(void)
grad_free_gradient(grad); grad_free_gradient(grad);
node = next_item(node); node = g_slist_next(node);
} /* while */ } /* while */
free_list(gradients_list); g_slist_free(gradients_list);
num_gradients = 0; num_gradients = 0;
gradients_list = NULL; gradients_list = NULL;
@ -5236,7 +5235,7 @@ grad_create_default_gradient(void)
static int static int
grad_insert_in_gradients_list(gradient_t *grad) grad_insert_in_gradients_list(gradient_t *grad)
{ {
link_ptr tmp; GSList *tmp;
gradient_t *g; gradient_t *g;
int n; int n;
@ -5254,11 +5253,11 @@ grad_insert_in_gradients_list(gradient_t *grad)
break; /* We found the one we want */ break; /* We found the one we want */
n++; n++;
tmp = next_item(tmp); tmp = g_slist_next(tmp);
} /* while */ } /* while */
num_gradients++; num_gradients++;
gradients_list = insert_in_list(gradients_list, grad, n); gradients_list = g_slist_insert(gradients_list, grad, n);
return n; return n;
} /* grad_insert_in_gradients_list */ } /* grad_insert_in_gradients_list */
@ -5731,7 +5730,7 @@ gradients_get_list_invoker(Argument *args)
{ {
Argument *return_args; Argument *return_args;
gradient_t *grad; gradient_t *grad;
link_ptr list; GSList *list;
char **gradients; char **gradients;
int i; int i;
int success; int success;
@ -5747,7 +5746,7 @@ gradients_get_list_invoker(Argument *args)
while (list) { while (list) {
grad = list->data; grad = list->data;
gradients[i++] = g_strdup(grad->name); gradients[i++] = g_strdup(grad->name);
list = next_item(list); list = g_slist_next(list);
} /* while */ } /* while */
return_args = procedural_db_return_args(&gradients_get_list_proc, success); return_args = procedural_db_return_args(&gradients_get_list_proc, success);
@ -5857,7 +5856,7 @@ Argument *
gradients_set_active_invoker(Argument *args) gradients_set_active_invoker(Argument *args)
{ {
char *name; char *name;
link_ptr list; GSList *list;
gradient_t *grad; gradient_t *grad;
int success; int success;
@ -5890,7 +5889,7 @@ gradients_set_active_invoker(Argument *args)
break; break;
} /* if */ } /* if */
list = next_item(list); list = g_slist_next(list);
} /* while */ } /* while */
} /* if */ } /* if */

View File

@ -122,7 +122,7 @@ info_dialog_new (char *title)
void void
info_dialog_free (InfoDialog *idialog) info_dialog_free (InfoDialog *idialog)
{ {
link_ptr list; GSList *list;
if (!idialog) if (!idialog)
return; return;
@ -133,11 +133,11 @@ info_dialog_free (InfoDialog *idialog)
while (list) while (list)
{ {
g_free (list->data); g_free (list->data);
list = next_item (list); list = g_slist_next (list);
} }
/* Free the actual field linked list */ /* Free the actual field linked list */
free_list (idialog->field_list); g_slist_free (idialog->field_list);
/* Destroy the associated widgets */ /* Destroy the associated widgets */
gtk_widget_destroy (idialog->shell); gtk_widget_destroy (idialog->shell);
@ -157,7 +157,7 @@ info_dialog_add_field (InfoDialog *idialog,
return; return;
new_field = info_field_new (idialog, title, text_ptr); new_field = info_field_new (idialog, title, text_ptr);
idialog->field_list = add_to_list (idialog->field_list, (void *) new_field); idialog->field_list = g_slist_prepend (idialog->field_list, (void *) new_field);
} }
void void
@ -183,7 +183,7 @@ info_dialog_popdown (InfoDialog *idialog)
void void
info_dialog_update (InfoDialog *idialog) info_dialog_update (InfoDialog *idialog)
{ {
link_ptr list; GSList *list;
if (!idialog) if (!idialog)
return; return;
@ -193,7 +193,7 @@ info_dialog_update (InfoDialog *idialog)
while (list) while (list)
{ {
update_field ((InfoField *) list->data); update_field ((InfoField *) list->data);
list = next_item (list); list = g_slist_next (list);
} }
} }

View File

@ -19,7 +19,6 @@
#define __INFO_DIALOG_H__ #define __INFO_DIALOG_H__
#include "gtk/gtk.h" #include "gtk/gtk.h"
#include "linked.h"
typedef struct _info_field InfoField; typedef struct _info_field InfoField;
@ -40,7 +39,7 @@ struct _info_dialog
GtkWidget *labels; GtkWidget *labels;
GtkWidget *values; GtkWidget *values;
link_ptr field_list; GSList *field_list;
void *user_data; void *user_data;
}; };

View File

@ -179,8 +179,8 @@ layer_select_advance (LayerSelect *layer_select,
int index; int index;
int length; int length;
int count; int count;
link_ptr list; GSList *list;
link_ptr nth; GSList *nth;
Layer *layer; Layer *layer;
index = 0; index = 0;
@ -197,17 +197,17 @@ layer_select_advance (LayerSelect *layer_select,
if (layer == layer_select->current_layer) if (layer == layer_select->current_layer)
index = count; index = count;
count++; count++;
list = next_item (list); list = g_slist_next (list);
} }
length = list_length (layer_select->gimage->layer_stack); length = g_slist_length (layer_select->gimage->layer_stack);
if (dir == 1) if (dir == 1)
index = (index == length - 1) ? 0 : (index + 1); index = (index == length - 1) ? 0 : (index + 1);
else else
index = (index == 0) ? (length - 1) : (index - 1); index = (index == 0) ? (length - 1) : (index - 1);
nth = nth_item (layer_select->gimage->layer_stack, index); nth = g_slist_nth (layer_select->gimage->layer_stack, index);
if (nth) if (nth)
{ {

View File

@ -87,7 +87,7 @@ struct _LayersDialog {
Layer * active_layer; Layer * active_layer;
Channel * active_channel; Channel * active_channel;
Layer * floating_sel; Layer * floating_sel;
link_ptr layer_widgets; GSList * layer_widgets;
}; };
typedef struct _LayerWidget LayerWidget; typedef struct _LayerWidget LayerWidget;
@ -445,7 +445,7 @@ layers_dialog_flush ()
GImage *gimage; GImage *gimage;
Layer *layer; Layer *layer;
LayerWidget *lw; LayerWidget *lw;
link_ptr list; GSList *list;
int gimage_pos; int gimage_pos;
int pos; int pos;
@ -469,7 +469,7 @@ layers_dialog_flush ()
{ {
lw = (LayerWidget *) list->data; lw = (LayerWidget *) list->data;
lw->visited = FALSE; lw->visited = FALSE;
list = next_item (list); list = g_slist_next (list);
} }
/* Add any missing layers */ /* Add any missing layers */
@ -485,7 +485,7 @@ layers_dialog_flush ()
else else
lw->visited = TRUE; lw->visited = TRUE;
list = next_item (list); list = g_slist_next (list);
} }
/* Remove any extraneous layers */ /* Remove any extraneous layers */
@ -493,7 +493,7 @@ layers_dialog_flush ()
while (list) while (list)
{ {
lw = (LayerWidget *) list->data; lw = (LayerWidget *) list->data;
list = next_item (list); list = g_slist_next (list);
if (lw->visited == FALSE) if (lw->visited == FALSE)
layers_dialog_remove_layer ((lw->layer)); layers_dialog_remove_layer ((lw->layer));
} }
@ -504,7 +504,7 @@ layers_dialog_flush ()
while (list) while (list)
{ {
lw = (LayerWidget *) list->data; lw = (LayerWidget *) list->data;
list = next_item (list); list = g_slist_next (list);
if ((gimage_pos = gimage_get_layer_index (gimage, lw->layer)) != pos) if ((gimage_pos = gimage_get_layer_index (gimage, lw->layer)) != pos)
layers_dialog_position_layer ((lw->layer), gimage_pos); layers_dialog_position_layer ((lw->layer), gimage_pos);
@ -541,7 +541,7 @@ layers_dialog_flush ()
void void
layers_dialog_free () layers_dialog_free ()
{ {
link_ptr list; GSList *list;
LayerWidget *lw; LayerWidget *lw;
if (layersD == NULL) if (layersD == NULL)
@ -554,7 +554,7 @@ layers_dialog_free ()
while (list) while (list)
{ {
lw = (LayerWidget *) list->data; lw = (LayerWidget *) list->data;
list = next_item(list); list = g_slist_next(list);
layer_widget_delete (lw); layer_widget_delete (lw);
} }
layersD->layer_widgets = NULL; layersD->layer_widgets = NULL;
@ -696,14 +696,14 @@ create_image_menu (int *default_id,
int *default_index, int *default_index,
MenuItemCallback callback) MenuItemCallback callback)
{ {
extern link_ptr image_list; extern GSList *image_list;
GImage *gimage; GImage *gimage;
GtkWidget *menu_item; GtkWidget *menu_item;
GtkWidget *menu; GtkWidget *menu;
char *menu_item_label; char *menu_item_label;
char *image_name; char *image_name;
link_ptr tmp; GSList *tmp;
int num_items = 0; int num_items = 0;
int id; int id;
@ -716,7 +716,7 @@ create_image_menu (int *default_id,
while (tmp) while (tmp)
{ {
gimage = tmp->data; gimage = tmp->data;
tmp = next_item (tmp); tmp = g_slist_next (tmp);
/* make sure the default index gets set to _something_, if possible */ /* make sure the default index gets set to _something_, if possible */
if (*default_index == -1) if (*default_index == -1)
@ -764,7 +764,7 @@ layers_dialog_update (int gimage_id)
GImage *gimage; GImage *gimage;
Layer *layer; Layer *layer;
LayerWidget *lw; LayerWidget *lw;
link_ptr list; GSList *list;
GList *item_list; GList *item_list;
if (!layersD) if (!layersD)
@ -783,10 +783,10 @@ layers_dialog_update (int gimage_id)
while (list) while (list)
{ {
lw = (LayerWidget *) list->data; lw = (LayerWidget *) list->data;
list = next_item(list); list = g_slist_next(list);
layer_widget_delete (lw); layer_widget_delete (lw);
} }
free_list (layersD->layer_widgets); g_slist_free (layersD->layer_widgets);
layersD->layer_widgets = NULL; layersD->layer_widgets = NULL;
if (! (gimage = gimage_get_ID (layersD->gimage_id))) if (! (gimage = gimage_get_ID (layersD->gimage_id)))
@ -807,10 +807,10 @@ layers_dialog_update (int gimage_id)
/* create a layer list item */ /* create a layer list item */
layer = (Layer *) list->data; layer = (Layer *) list->data;
lw = create_layer_widget (gimage, layer); lw = create_layer_widget (gimage, layer);
layersD->layer_widgets = append_to_list (layersD->layer_widgets, lw); layersD->layer_widgets = g_slist_append (layersD->layer_widgets, lw);
item_list = g_list_append (item_list, lw->list_item); item_list = g_list_append (item_list, lw->list_item);
list = next_item (list); list = g_slist_next (list);
} }
/* get the index of the active layer */ /* get the index of the active layer */
@ -1233,13 +1233,13 @@ layers_dialog_position_layer (Layer * layer,
/* Remove the layer from the dialog */ /* Remove the layer from the dialog */
list = g_list_append (list, layer_widget->list_item); list = g_list_append (list, layer_widget->list_item);
gtk_list_remove_items (GTK_LIST (layersD->layer_list), list); gtk_list_remove_items (GTK_LIST (layersD->layer_list), list);
layersD->layer_widgets = remove_from_list (layersD->layer_widgets, layer_widget); layersD->layer_widgets = g_slist_remove (layersD->layer_widgets, layer_widget);
suspend_gimage_notify--; suspend_gimage_notify--;
/* Add it back at the proper index */ /* Add it back at the proper index */
gtk_list_insert_items (GTK_LIST (layersD->layer_list), list, new_index); gtk_list_insert_items (GTK_LIST (layersD->layer_list), list, new_index);
layersD->layer_widgets = insert_in_list (layersD->layer_widgets, layer_widget, new_index); layersD->layer_widgets = g_slist_insert (layersD->layer_widgets, layer_widget, new_index);
} }
@ -1262,7 +1262,7 @@ layers_dialog_add_layer (Layer *layer)
item_list = g_list_append (item_list, layer_widget->list_item); item_list = g_list_append (item_list, layer_widget->list_item);
position = gimage_get_layer_index (gimage, layer); position = gimage_get_layer_index (gimage, layer);
layersD->layer_widgets = insert_in_list (layersD->layer_widgets, layer_widget, position); layersD->layer_widgets = g_slist_insert (layersD->layer_widgets, layer_widget, position);
gtk_list_insert_items (GTK_LIST (layersD->layer_list), item_list, position); gtk_list_insert_items (GTK_LIST (layersD->layer_list), item_list, position);
} }
@ -1825,7 +1825,7 @@ static LayerWidget *
layer_widget_get_ID (Layer * ID) layer_widget_get_ID (Layer * ID)
{ {
LayerWidget *lw; LayerWidget *lw;
link_ptr list; GSList *list;
if (!layersD) if (!layersD)
return NULL; return NULL;
@ -1838,7 +1838,7 @@ layer_widget_get_ID (Layer * ID)
if (lw->layer == ID) if (lw->layer == ID)
return lw; return lw;
list = next_item(list); list = g_slist_next(list);
} }
return NULL; return NULL;
@ -1990,7 +1990,7 @@ layer_widget_delete (LayerWidget *layer_widget)
gdk_pixmap_unref (layer_widget->mask_pixmap); gdk_pixmap_unref (layer_widget->mask_pixmap);
/* Remove the layer widget from the list */ /* Remove the layer widget from the list */
layersD->layer_widgets = remove_from_list (layersD->layer_widgets, layer_widget); layersD->layer_widgets = g_slist_remove (layersD->layer_widgets, layer_widget);
/* Free the widget */ /* Free the widget */
g_free (layer_widget); g_free (layer_widget);
@ -2668,7 +2668,7 @@ layer_widget_clip_redraw (LayerWidget *layer_widget)
static void static void
layer_widget_exclusive_visible (LayerWidget *layer_widget) layer_widget_exclusive_visible (LayerWidget *layer_widget)
{ {
link_ptr list; GSList *list;
LayerWidget *lw; LayerWidget *lw;
int visible = FALSE; int visible = FALSE;
@ -2683,7 +2683,7 @@ layer_widget_exclusive_visible (LayerWidget *layer_widget)
if (lw != layer_widget) if (lw != layer_widget)
visible |= GIMP_DRAWABLE(lw->layer)->visible; visible |= GIMP_DRAWABLE(lw->layer)->visible;
list = next_item (list); list = g_slist_next (list);
} }
/* Now, toggle the visibility for all layers except the specified one */ /* Now, toggle the visibility for all layers except the specified one */
@ -2698,7 +2698,7 @@ layer_widget_exclusive_visible (LayerWidget *layer_widget)
layer_widget_eye_redraw (lw); layer_widget_eye_redraw (lw);
list = next_item (list); list = g_slist_next (list);
} }
} }

View File

@ -32,7 +32,6 @@
#include "errors.h" #include "errors.h"
#include "general.h" #include "general.h"
#include "gimprc.h" #include "gimprc.h"
#include "linked.h"
#include "interface.h" #include "interface.h"
#include "palette.h" #include "palette.h"
@ -74,7 +73,7 @@ static void palette_delete_entry (PaletteP);
static void palette_calc_scrollbar (PaletteP); static void palette_calc_scrollbar (PaletteP);
static void palette_entries_load (char *); static void palette_entries_load (char *);
static link_ptr palette_entries_insert_list (link_ptr, PaletteEntriesP); static GSList * palette_entries_insert_list (GSList *, PaletteEntriesP);
static void palette_entries_delete (char *); static void palette_entries_delete (char *);
static void palette_entries_save (PaletteEntriesP, char *); static void palette_entries_save (PaletteEntriesP, char *);
static void palette_entries_free (PaletteEntriesP); static void palette_entries_free (PaletteEntriesP);
@ -100,7 +99,7 @@ static void palette_draw_entries (PaletteP);
static void palette_draw_current_entry (PaletteP); static void palette_draw_current_entry (PaletteP);
static void palette_update_current_entry (PaletteP); static void palette_update_current_entry (PaletteP);
link_ptr palette_entries_list = NULL; GSList *palette_entries_list = NULL;
static PaletteP palette = NULL; static PaletteP palette = NULL;
static PaletteEntriesP default_palette_entries = NULL; static PaletteEntriesP default_palette_entries = NULL;
@ -368,7 +367,7 @@ palette_init_palettes (void)
void void
palette_free_palettes (void) palette_free_palettes (void)
{ {
link_ptr list; GSList *list;
PaletteEntriesP entries; PaletteEntriesP entries;
list = palette_entries_list; list = palette_entries_list;
@ -383,9 +382,9 @@ palette_free_palettes (void)
palette_entries_save (entries, entries->filename); palette_entries_save (entries, entries->filename);
palette_entries_free (entries); palette_entries_free (entries);
list = next_item (list); list = g_slist_next (list);
} }
free_list (palette_entries_list); g_slist_free (palette_entries_list);
if (palette) if (palette)
{ {
@ -409,7 +408,7 @@ palette_create_palette_menu (PaletteP palette,
PaletteEntriesP default_entries) PaletteEntriesP default_entries)
{ {
GtkWidget *menu_item; GtkWidget *menu_item;
link_ptr list; GSList *list;
PaletteEntriesP p_entries = NULL; PaletteEntriesP p_entries = NULL;
PaletteEntriesP found_entries = NULL; PaletteEntriesP found_entries = NULL;
int i = 0; int i = 0;
@ -421,7 +420,7 @@ palette_create_palette_menu (PaletteP palette,
while (list) while (list)
{ {
p_entries = (PaletteEntriesP) list->data; p_entries = (PaletteEntriesP) list->data;
list = next_item (list); list = g_slist_next (list);
/* to make sure we get something! */ /* to make sure we get something! */
if (p_entries == NULL) if (p_entries == NULL)
@ -559,13 +558,13 @@ palette_entries_delete (char *filename)
unlink (filename); unlink (filename);
} }
static link_ptr static GSList *
palette_entries_insert_list (link_ptr list, palette_entries_insert_list (GSList * list,
PaletteEntriesP entries) PaletteEntriesP entries)
{ {
/* add it to the list */ /* add it to the list */
num_palette_entries++; num_palette_entries++;
return append_to_list (list, (void *) entries); return g_slist_append (list, (void *) entries);
} }
static void static void
@ -573,7 +572,7 @@ palette_entries_save (PaletteEntriesP palette,
char *filename) char *filename)
{ {
FILE * fp; FILE * fp;
link_ptr list; GSList * list;
PaletteEntryP entry; PaletteEntryP entry;
if (! filename) if (! filename)
@ -595,7 +594,7 @@ palette_entries_save (PaletteEntriesP palette,
entry = (PaletteEntryP) list->data; entry = (PaletteEntryP) list->data;
fprintf (fp, "%d %d %d\t%s\n", entry->color[0], entry->color[1], fprintf (fp, "%d %d %d\t%s\n", entry->color[0], entry->color[1],
entry->color[2], entry->name); entry->color[2], entry->name);
list = next_item (list); list = g_slist_next (list);
} }
/* Clean up */ /* Clean up */
@ -606,7 +605,7 @@ static void
palette_entries_free (PaletteEntriesP entries) palette_entries_free (PaletteEntriesP entries)
{ {
PaletteEntryP entry; PaletteEntryP entry;
link_ptr list; GSList * list;
list = entries->colors; list = entries->colors;
while (list) while (list)
@ -722,7 +721,7 @@ palette_color_area_events (GtkWidget *widget,
PaletteP palette) PaletteP palette)
{ {
GdkEventButton *bevent; GdkEventButton *bevent;
link_ptr tmp_link; GSList *tmp_link;
int r, g, b; int r, g, b;
int width, height; int width, height;
int entry_width; int entry_width;
@ -746,7 +745,7 @@ palette_color_area_events (GtkWidget *widget,
row = (palette->scroll_offset + bevent->y - 1) / entry_height; row = (palette->scroll_offset + bevent->y - 1) / entry_height;
pos = row * COLUMNS + col; pos = row * COLUMNS + col;
tmp_link = nth_item (palette->entries->colors, pos); tmp_link = g_slist_nth (palette->entries->colors, pos);
if (tmp_link) if (tmp_link)
{ {
palette_draw_current_entry (palette); palette_draw_current_entry (palette);
@ -1158,7 +1157,7 @@ palette_draw_entries (PaletteP palette)
PaletteEntryP entry; PaletteEntryP entry;
unsigned char *buffer; unsigned char *buffer;
unsigned char *colors[COLUMNS]; unsigned char *colors[COLUMNS];
link_ptr tmp_link; GSList *tmp_link;
int width, height; int width, height;
int entry_width; int entry_width;
int entry_height; int entry_height;
@ -1293,7 +1292,7 @@ palette_add_entry (PaletteEntriesP entries,
entry->name = g_strdup ("Untitled"); entry->name = g_strdup ("Untitled");
entry->position = entries->n_colors; entry->position = entries->n_colors;
entries->colors = append_to_list (entries->colors, entry); entries->colors = g_slist_append (entries->colors, entry);
entries->n_colors += 1; entries->n_colors += 1;
entries->changed = 1; entries->changed = 1;
@ -1308,20 +1307,20 @@ static void
palette_delete_entry (PaletteP palette) palette_delete_entry (PaletteP palette)
{ {
PaletteEntryP entry; PaletteEntryP entry;
link_ptr tmp_link; GSList *tmp_link;
int pos; int pos;
if (palette && palette->entries && palette->color) if (palette && palette->entries && palette->color)
{ {
entry = palette->color; entry = palette->color;
palette->entries->colors = remove_from_list (palette->entries->colors, entry); palette->entries->colors = g_slist_remove (palette->entries->colors, entry);
palette->entries->n_colors--; palette->entries->n_colors--;
palette->entries->changed = 1; palette->entries->changed = 1;
pos = entry->position; pos = entry->position;
palette_entry_free (entry); palette_entry_free (entry);
tmp_link = nth_item (palette->entries->colors, pos); tmp_link = g_slist_nth (palette->entries->colors, pos);
if (tmp_link) if (tmp_link)
{ {
@ -1336,7 +1335,7 @@ palette_delete_entry (PaletteP palette)
} }
else else
{ {
tmp_link = nth_item (palette->entries->colors, pos - 1); tmp_link = g_slist_nth (palette->entries->colors, pos - 1);
if (tmp_link) if (tmp_link)
palette->color = tmp_link->data; palette->color = tmp_link->data;
} }

View File

@ -18,6 +18,9 @@
#ifndef __PALETTE_H__ #ifndef __PALETTE_H__
#define __PALETTE_H__ #define __PALETTE_H__
#include <glib.h>
#include "procedural_db.h"
#define FOREGROUND 0 #define FOREGROUND 0
#define BACKGROUND 1 #define BACKGROUND 1
@ -39,7 +42,7 @@ void palette_set_active_color (int, int, int, int);
struct _PaletteEntries { struct _PaletteEntries {
char *name; char *name;
char *filename; char *filename;
link_ptr colors; GSList *colors;
int n_colors; int n_colors;
int changed; int changed;
}; };
@ -52,12 +55,10 @@ struct _PaletteEntry {
}; };
typedef struct _PaletteEntry _PaletteEntry, *PaletteEntryP; typedef struct _PaletteEntry _PaletteEntry, *PaletteEntryP;
extern link_ptr palette_entries_list; extern GSList * palette_entries_list;
void palette_init_palettes (void); void palette_init_palettes (void);
void palette_free_palettes (void); void palette_free_palettes (void);
#include "procedural_db.h"
/* Procedure definition and marshalling function */ /* Procedure definition and marshalling function */
extern ProcRecord palette_get_foreground_proc; extern ProcRecord palette_get_foreground_proc;
extern ProcRecord palette_get_background_proc; extern ProcRecord palette_get_background_proc;

View File

@ -373,7 +373,7 @@ display_setup (PatternSelectP psp)
static void static void
display_patterns (PatternSelectP psp) display_patterns (PatternSelectP psp)
{ {
link_ptr list = pattern_list; /* the global pattern list */ GSList *list = pattern_list; /* the global pattern list */
int row, col; int row, col;
GPatternP pattern; GPatternP pattern;
@ -405,7 +405,7 @@ display_patterns (PatternSelectP psp)
col = 0; col = 0;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }

View File

@ -475,14 +475,14 @@ create_image_menu (int *default_id,
int *default_index, int *default_index,
MenuItemCallback callback) MenuItemCallback callback)
{ {
extern link_ptr image_list; extern GSList *image_list;
GImage *gimage; GImage *gimage;
GtkWidget *menu_item; GtkWidget *menu_item;
GtkWidget *menu; GtkWidget *menu;
char *menu_item_label; char *menu_item_label;
char *image_name; char *image_name;
link_ptr tmp; GSList *tmp;
int num_items = 0; int num_items = 0;
int id; int id;
@ -495,7 +495,7 @@ create_image_menu (int *default_id,
while (tmp) while (tmp)
{ {
gimage = tmp->data; gimage = tmp->data;
tmp = next_item (tmp); tmp = g_slist_next (tmp);
if (gimage_base_type (gimage) == INDEXED) if (gimage_base_type (gimage) == INDEXED)
{ {

View File

@ -122,7 +122,7 @@ info_dialog_new (char *title)
void void
info_dialog_free (InfoDialog *idialog) info_dialog_free (InfoDialog *idialog)
{ {
link_ptr list; GSList *list;
if (!idialog) if (!idialog)
return; return;
@ -133,11 +133,11 @@ info_dialog_free (InfoDialog *idialog)
while (list) while (list)
{ {
g_free (list->data); g_free (list->data);
list = next_item (list); list = g_slist_next (list);
} }
/* Free the actual field linked list */ /* Free the actual field linked list */
free_list (idialog->field_list); g_slist_free (idialog->field_list);
/* Destroy the associated widgets */ /* Destroy the associated widgets */
gtk_widget_destroy (idialog->shell); gtk_widget_destroy (idialog->shell);
@ -157,7 +157,7 @@ info_dialog_add_field (InfoDialog *idialog,
return; return;
new_field = info_field_new (idialog, title, text_ptr); new_field = info_field_new (idialog, title, text_ptr);
idialog->field_list = add_to_list (idialog->field_list, (void *) new_field); idialog->field_list = g_slist_prepend (idialog->field_list, (void *) new_field);
} }
void void
@ -183,7 +183,7 @@ info_dialog_popdown (InfoDialog *idialog)
void void
info_dialog_update (InfoDialog *idialog) info_dialog_update (InfoDialog *idialog)
{ {
link_ptr list; GSList *list;
if (!idialog) if (!idialog)
return; return;
@ -193,7 +193,7 @@ info_dialog_update (InfoDialog *idialog)
while (list) while (list)
{ {
update_field ((InfoField *) list->data); update_field ((InfoField *) list->data);
list = next_item (list); list = g_slist_next (list);
} }
} }

View File

@ -19,7 +19,6 @@
#define __INFO_DIALOG_H__ #define __INFO_DIALOG_H__
#include "gtk/gtk.h" #include "gtk/gtk.h"
#include "linked.h"
typedef struct _info_field InfoField; typedef struct _info_field InfoField;
@ -40,7 +39,7 @@ struct _info_dialog
GtkWidget *labels; GtkWidget *labels;
GtkWidget *values; GtkWidget *values;
link_ptr field_list; GSList *field_list;
void *user_data; void *user_data;
}; };

View File

@ -31,7 +31,6 @@
#include "gimprc.h" #include "gimprc.h"
#include "general.h" #include "general.h"
#include "interface.h" #include "interface.h"
#include "linked.h"
#include "menus.h" #include "menus.h"
#include "tools.h" #include "tools.h"

View File

@ -26,6 +26,8 @@
#include "appenv.h" #include "appenv.h"
#include "bezier_selectP.h" #include "bezier_selectP.h"
#include "draw_core.h" #include "draw_core.h"
#include "channel_pvt.h"
#include "drawable.h"
#include "errors.h" #include "errors.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gimage_mask.h" #include "gimage_mask.h"
@ -229,8 +231,8 @@ static void make_curve_d (int *, int *, double, int);
/* Catmull-Rom boundary conversion */ /* Catmull-Rom boundary conversion */
static void CR_convert (Iscissors * , GDisplay *, int); static void CR_convert (Iscissors * , GDisplay *, int);
static void CR_convert_points (GdkPoint *, int); static void CR_convert_points (GdkPoint *, int);
static void CR_convert_line (link_ptr *, int, int, int, int); static void CR_convert_line (GSList **, int, int, int, int);
static link_ptr CR_insert_in_list (link_ptr, int); static GSList * CR_insert_in_list (GSList *, int);
/*******************************************************/ /*******************************************************/
@ -441,12 +443,12 @@ iscissors_button_press (Tool *tool,
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
iscissors = (Iscissors *) tool->private; iscissors = (Iscissors *) tool->private;
message_box ("Intelligent Scissors is currently not enabled\nfor use with the tile-based GIMP", /* message_box ("Intelligent Scissors is currently not enabled\nfor use with the tile-based GIMP",
NULL, NULL); NULL, NULL);
return; return;*/
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, gdisplay_untransform_coords (gdisp, bevent->x, bevent->y,
&iscissors->x, &iscissors->y, FALSE, 1); &iscissors->x, &iscissors->y, FALSE, TRUE);
/* If the tool was being used in another image...reset it */ /* If the tool was being used in another image...reset it */
if (tool->state == ACTIVE && gdisp_ptr != tool->gdisp_ptr) if (tool->state == ACTIVE && gdisp_ptr != tool->gdisp_ptr)
@ -484,11 +486,11 @@ iscissors_button_press (Tool *tool,
} }
/* If the edge map blocks haven't been allocated, do so now */ /* If the edge map blocks haven't been allocated, do so now */
/*FIX if (!edge_map_blocks) if (!edge_map_blocks)
allocate_edge_map_blocks (BLOCK_WIDTH, BLOCK_HEIGHT, allocate_edge_map_blocks (BLOCK_WIDTH, BLOCK_HEIGHT,
gimage_width (gdisp->gimage), gdisp->gimage->width,
gimage_height (gdisp->gimage)); gdisp->gimage->height);
*/
iscissors->num_segs = 0; iscissors->num_segs = 0;
add_segment (&(iscissors->num_segs), bevent->x, bevent->y); add_segment (&(iscissors->num_segs), bevent->x, bevent->y);
@ -497,7 +499,7 @@ iscissors_button_press (Tool *tool,
tool); tool);
break; break;
case BOUNDARY_MODE: case BOUNDARY_MODE:
if (channel_value (iscissors->mask, iscissors->x, iscissors->y)) if (/*channel_value (iscissors->mask, iscissors->x, iscissors->y)*/ TRUE)
{ {
replace = 0; replace = 0;
if (bevent->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) if (bevent->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK))
@ -560,7 +562,7 @@ iscissors_button_release (Tool *tool,
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
iscissors = (Iscissors *) tool->private; iscissors = (Iscissors *) tool->private;
return; /*return;*/
gdk_pointer_ungrab (bevent->time); gdk_pointer_ungrab (bevent->time);
gdk_flush (); gdk_flush ();
@ -696,7 +698,7 @@ iscissors_draw_CR (GDisplay *gdisp,
break; break;
case SCREEN_COORDS: case SCREEN_COORDS:
gdisplay_transform_coords_f (gdisp, (int) pts[indices[i]].dx, gdisplay_transform_coords_f (gdisp, (int) pts[indices[i]].dx,
(int) pts[indices[i]].dy, &x, &y, FALSE); (int) pts[indices[i]].dy, &x, &y, TRUE);
geometry[i][0] = x; geometry[i][0] = x;
geometry[i][1] = y; geometry[i][1] = y;
break; break;
@ -987,6 +989,7 @@ get_kink (Kink *kinks,
return kinks + index; return kinks + index;
} }
/* I don't think this ever gets called -- Rockwalrus */
return NULL; return NULL;
} }
@ -1311,9 +1314,9 @@ process_kinks (Tool *tool)
{ {
/* transform from screen to image coordinates */ /* transform from screen to image coordinates */
gdisplay_untransform_coords (gdisp, kinks[i].x, kinks[i].y, gdisplay_untransform_coords (gdisp, kinks[i].x, kinks[i].y,
&x, &y, FALSE, FALSE); &x, &y, FALSE, TRUE);
/*FIXkinks[i].x = BOUNDS (x, 0, (gimage_width (gdisp->gimage) - 1)); kinks[i].x = BOUNDS (x, 0, (gdisp->gimage->width - 1));
kinks[i].y = BOUNDS (y, 0, (gimage_height (gdisp->gimage) - 1));*/ kinks[i].y = BOUNDS (y, 0, (gdisp->gimage->height - 1));
/* get local maximums */ /* get local maximums */
k_left = get_kink (kinks, i-1, iscissors->num_kinks); k_left = get_kink (kinks, i-1, iscissors->num_kinks);
@ -1398,21 +1401,21 @@ edge_map_from_boundary (Tool *tool)
x = y = w = h = x1 = y1 = x2 = y2 = 0; x = y = w = h = x1 = y1 = x2 = y2 = 0;
/*FIXx1 = gimage_width (gdisp->gimage); x1 = gdisp->gimage->width;
y1 = gimage_height (gdisp->gimage);*/ y1 = gdisp->gimage->height;
/* Find the edge map extents */ /* Find the edge map extents */
for (i = 0; i < iscissors->num_pts; i++) for (i = 0; i < iscissors->num_pts; i++)
{ {
/*FIX x = BOUNDS (pts[i].x - LOCALIZE_RADIUS, 0, x = BOUNDS (pts[i].x - LOCALIZE_RADIUS, 0,
gimage_width (gdisp->gimage)); gdisp->gimage->width);
y = BOUNDS (pts[i].y - LOCALIZE_RADIUS, 0, y = BOUNDS (pts[i].y - LOCALIZE_RADIUS, 0,
gimage_height (gdisp->gimage)); gdisp->gimage->height);
w = BOUNDS (pts[i].x + LOCALIZE_RADIUS, 0, w = BOUNDS (pts[i].x + LOCALIZE_RADIUS, 0,
gimage_width (gdisp->gimage)); gdisp->gimage->width);
h = BOUNDS (pts[i].y + LOCALIZE_RADIUS, 0, h = BOUNDS (pts[i].y + LOCALIZE_RADIUS, 0,
gimage_height (gdisp->gimage)); gdisp->gimage->height);
*/
w -= x; w -= x;
h -= y; h -= y;
@ -1444,7 +1447,7 @@ orient_boundary (Tool *tool)
double edge1[EDGE_WIDTH], edge2[EDGE_WIDTH]; double edge1[EDGE_WIDTH], edge2[EDGE_WIDTH];
double max; double max;
double angle; double angle;
int dir; int dir = 0;
int i, j; int i, j;
int max_dir; int max_dir;
int max_orient; int max_orient;
@ -1746,7 +1749,13 @@ calculate_edge_map (GImage *gimage,
int xx, yy; int xx, yy;
unsigned char *gr, * dh, * dv, * cm; unsigned char *gr, * dh, * dv, * cm;
int hmax, vmax; int hmax, vmax;
int b;
double prev, next; double prev, next;
GimpDrawable *drawable;
void *pr;
FILE *dump;
drawable = gimage_active_drawable (gimage);
x1 = y1 = x2 = y2 = 0; x1 = y1 = x2 = y2 = 0;
@ -1754,31 +1763,38 @@ calculate_edge_map (GImage *gimage,
edge_map = temp_buf_new (w, h, EDGE_WIDTH, x, y, NULL); edge_map = temp_buf_new (w, h, EDGE_WIDTH, x, y, NULL);
/* calculate the extent of the search make a 1 pixel border */ /* calculate the extent of the search make a 1 pixel border */
/*FIXx1 = BOUNDS (x, 0, gimage_width (gimage)); x1 = BOUNDS (x, 0, gimage->width);
y1 = BOUNDS (y, 0, gimage_height (gimage)); y1 = BOUNDS (y, 0, gimage->height);
x2 = BOUNDS (x + w, 0, gimage_width (gimage)); x2 = BOUNDS (x + w, 0, gimage->width);
y2 = BOUNDS (y + h, 0, gimage_height (gimage));*/ y2 = BOUNDS (y + h, 0, gimage->height);
width = x2 - x1; width = x2 - x1;
height = y2 - y1; height = y2 - y1;
offx = (x - x1); offx = (x - x1);
offy = (y - y1); offy = (y - y1);
/* Set the gimage up as the source pixel region */ /* Set the drawable up as the source pixel region */
/* FIX srcPR.bytes = gimage_bytes (gimage);*/ /*srcPR.bytes = drawable_bytes (drawable);
srcPR.w = width; srcPR.w = width;
srcPR.h = height; srcPR.h = height;
/* FIX srcPR.rowstride = gimage_width (gimage) * gimage_bytes (gimage);*/ srcPR.rowstride = gimage->width * drawable_bytes (drawable);
/*FIXsrcPR.data = gimage_data (gimage) + y1 * srcPR.rowstride + x1 * srcPR.bytes;*/ srcPR.data = drawable_data (drawable) + y1 * srcPR.rowstride + x1 * srcPR.bytes;*/
pixel_region_init(&srcPR, drawable_data(drawable), x1, y1, width, height, 1);
/* Get the horizontal derivative */ /* Get the horizontal derivative */
destPR.data = conv1 + MAX_CHANNELS * (CONV_WIDTH * offy + offx); destPR.data = conv1 + MAX_CHANNELS * (CONV_WIDTH * offy + offx);
destPR.rowstride = CONV_WIDTH * MAX_CHANNELS; destPR.rowstride = CONV_WIDTH * MAX_CHANNELS;
gaussian_deriv (&srcPR, &destPR, HORIZONTAL, std_dev); destPR.tiles = NULL;
for (pr =pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr))
gaussian_deriv (&srcPR, &destPR, HORIZONTAL, std_dev);
/* Get the vertical derivative */ /* Get the vertical derivative */
destPR.data = conv2 + MAX_CHANNELS * (CONV_WIDTH * offy + offx); destPR.data = conv2 + MAX_CHANNELS * (CONV_WIDTH * offy + offx);
gaussian_deriv (&srcPR, &destPR, VERTICAL, std_dev);
for (pr =pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr))
gaussian_deriv (&srcPR, &destPR, VERTICAL, std_dev);
/* fill in the edge map */ /* fill in the edge map */
@ -1792,11 +1808,13 @@ calculate_edge_map (GImage *gimage,
{ {
hmax = dh[0] - 128; hmax = dh[0] - 128;
vmax = dv[0] - 128; vmax = dv[0] - 128;
/*FIX for (b = 1; b < gimage_bytes (gimage); b++) for (b = 1; b < drawable_bytes (drawable); b++)
{ {
if (abs (dh[b] - 128) > abs (hmax)) hmax = dh[b] - 128; if (abs (dh[b] - 128) > abs (hmax))
if (abs (dv[b] - 128) > abs (vmax)) vmax = dv[b] - 128; hmax = dh[b] - 128;
}*/ if (abs (dv[b] - 128) > abs (vmax))
vmax = dv[b] - 128;
}
/* store the information in the edge map */ /* store the information in the edge map */
dh[0] = hmax + 128; dh[0] = hmax + 128;
@ -1819,7 +1837,7 @@ calculate_edge_map (GImage *gimage,
} }
/* Make the edge gradient map extend one row further */ /* Make the edge gradient map extend one row further */
memcpy (grad, grad + (CONV_WIDTH+2), (CONV_WIDTH+2)); memcpy (grad, grad + (CONV_WIDTH+2), (CONV_WIDTH+2));
memcpy (grad + (CONV_WIDTH+2) * (CONV_HEIGHT+1), memcpy (grad + (CONV_WIDTH+2) * (CONV_HEIGHT+1),
grad + (CONV_WIDTH+2) * (CONV_HEIGHT), grad + (CONV_WIDTH+2) * (CONV_HEIGHT),
(CONV_WIDTH+2)); (CONV_WIDTH+2));
@ -1851,16 +1869,20 @@ calculate_edge_map (GImage *gimage,
else else
*cm++ = 0; *cm++ = 0;
/*
*cm++ = dh[0]; /*cm++ = dh[0];*/
*cm++ = dv[0]; /*cm++ = dv[0];*/
*/
dh += srcPR.bytes; dh += srcPR.bytes;
dv += srcPR.bytes; dv += srcPR.bytes;
gr ++; gr ++;
} }
} }
/* dump=fopen("/ugrad/summersn/dump", "w"); */
/* fprintf(dump, "P5\n%d %d\n255\n", edge_map->width, edge_map->height); */
/* fwrite(edge_map->data, edge_map->width * edge_map->height, sizeof (guchar), dump); */
/* fclose (dump); */
return edge_map; return edge_map;
} }
@ -1877,10 +1899,17 @@ construct_edge_map (Tool *tool,
int offx, offy; int offx, offy;
int x2, y2; int x2, y2;
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
FILE *dump;
/* init some variables */ /* init some variables */
srcPR.bytes = edge_buf->bytes; srcPR.bytes = edge_buf->bytes;
destPR.rowstride = edge_buf->bytes * edge_buf->width; destPR.rowstride = edge_buf->bytes * edge_buf->width;
destPR.x = edge_buf->x;
destPR.y = edge_buf->y;
destPR.h = edge_buf->height;
destPR.w = edge_buf -> width;
destPR.bytes = edge_buf->bytes;
srcPR.tiles = destPR.tiles = NULL;
y = edge_buf->y; y = edge_buf->y;
endx = edge_buf->x + edge_buf->width; endx = edge_buf->x + edge_buf->width;
@ -1906,7 +1935,7 @@ construct_edge_map (Tool *tool,
/* If the block exists, patch it into buf */ /* If the block exists, patch it into buf */
if (block) if (block)
{ {
/* calculate x offset into the block */ /* calculate x offset into the block */
offx = (x - col * BLOCK_WIDTH); offx = (x - col * BLOCK_WIDTH);
x2 = (col + 1) * BLOCK_WIDTH; x2 = (col + 1) * BLOCK_WIDTH;
if (x2 > endx) x2 = endx; if (x2 > endx) x2 = endx;
@ -1929,8 +1958,12 @@ construct_edge_map (Tool *tool,
y = row * BLOCK_HEIGHT; y = row * BLOCK_HEIGHT;
} }
/* show the edge buffer */ /* dump the edge buffer for debugging*/
/* temp_buf_to_gdisplay (edge_buf);*/
/* dump=fopen("/ugrad/summersn/dump", "w");
fprintf(dump, "P5\n%d %d\n255\n", edge_buf->width, edge_buf->height);
fwrite(edge_buf->data, edge_buf->width * edge_buf->height, sizeof (guchar), dump);
fclose (dump); */
} }
@ -1955,8 +1988,8 @@ set_edge_map_blocks (void *gimage_ptr,
width = height = 0; width = height = 0;
gimage = (GImage *) gimage_ptr; gimage = (GImage *) gimage_ptr;
/*FIXwidth = gimage_width (gimage);*/ width = gimage->width;
/*FIXheight = gimage_height (gimage);*/ height = gimage->height;
startx = x; startx = x;
endx = x + w; endx = x + w;
@ -2327,7 +2360,7 @@ make_curve_d (int *curve,
/* Functions for Catmull-Rom area conversion */ /* Functions for Catmull-Rom area conversion */
/***********************************************/ /***********************************************/
static link_ptr * CR_scanlines; static GSList **CR_scanlines;
static int start_convert; static int start_convert;
static int width, height; static int width, height;
static int lastx; static int lastx;
@ -2339,12 +2372,13 @@ CR_convert (Iscissors *iscissors,
int antialias) int antialias)
{ {
int indices[4]; int indices[4];
link_ptr list; GSList *list;
unsigned char *dest;
int draw_type; int draw_type;
int * vals, val; int * vals, val;
int x, w; int x, w;
int i, j; int i, j;
PixelRegion maskPR;
unsigned char *buf, *b;
vals = NULL; vals = NULL;
@ -2363,12 +2397,15 @@ CR_convert (Iscissors *iscissors,
draw_type = AA_IMAGE_COORDS; draw_type = AA_IMAGE_COORDS;
/* allocate value array */ /* allocate value array */
vals = (int *) g_malloc (sizeof (int) * width); vals = (int *) g_malloc (sizeof (int) * width);
buf = (unsigned char *) g_malloc (sizeof(unsigned char *) * width);
} }
else else
{ {
width = gdisp->gimage->width; width = gdisp->gimage->width;
height = gdisp->gimage->height; height = gdisp->gimage->height;
draw_type = IMAGE_COORDS; draw_type = IMAGE_COORDS;
buf = NULL;
vals = NULL;
} }
/* create a new mask */ /* create a new mask */
@ -2376,7 +2413,7 @@ CR_convert (Iscissors *iscissors,
gdisp->gimage->height); gdisp->gimage->height);
/* allocate room for the scanlines */ /* allocate room for the scanlines */
CR_scanlines = g_malloc (sizeof (link_ptr) * height); CR_scanlines = g_malloc (sizeof (GSList *) * height);
/* zero out the scanlines */ /* zero out the scanlines */
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
@ -2394,7 +2431,9 @@ CR_convert (Iscissors *iscissors,
iscissors_draw_CR (gdisp, iscissors, pts, indices, draw_type); iscissors_draw_CR (gdisp, iscissors, pts, indices, draw_type);
} }
dest = channel_data (iscissors->mask); pixel_region_init (&maskPR, iscissors->mask->drawable.tiles, 0, 0,
iscissors->mask->drawable.width,
iscissors->mask->drawable.height, TRUE);
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
{ {
@ -2418,21 +2457,25 @@ CR_convert (Iscissors *iscissors,
for (j = 0; j < w; j++) for (j = 0; j < w; j++)
vals[j + x] += 255; vals[j + x] += 255;
list = next_item (list); list = g_slist_next (list);
} }
} }
if (antialias && !((i+1) % SUPERSAMPLE)) if (antialias && !((i+1) % SUPERSAMPLE))
for (j = 0; j < width; j += SUPERSAMPLE) {
{ b = buf;
val = 0; for (j = 0; j < width; j += SUPERSAMPLE)
for (x = 0; x < SUPERSAMPLE; x++) {
val += vals[j + x]; val = 0;
for (x = 0; x < SUPERSAMPLE; x++)
val += vals[j + x];
*dest++ = val / SUPERSAMPLE2; *b++ = (unsigned char) (val / SUPERSAMPLE2);
} }
pixel_region_set_row (&maskPR, 0, (i / SUPERSAMPLE), iscissors->mask->drawable.width, buf);
}
free_list (CR_scanlines[i]); g_slist_free (CR_scanlines[i]);
} }
if (antialias) if (antialias)
@ -2465,11 +2508,11 @@ CR_convert_points (GdkPoint *points,
} }
static void static void
CR_convert_line (link_ptr *scanlines, CR_convert_line (GSList **scanlines,
int x1, int x1,
int y1, int y1,
int x2, int x2,
int y2) int y2)
{ {
int dx, dy; int dx, dy;
int error, inc; int error, inc;
@ -2581,32 +2624,32 @@ CR_convert_line (link_ptr *scanlines,
} }
} }
static link_ptr static GSList *
CR_insert_in_list (link_ptr list, CR_insert_in_list (GSList *list,
int x) int x)
{ {
link_ptr orig = list; GSList *orig = list;
link_ptr rest; GSList *rest;
if (!list) if (!list)
return add_to_list (list, (gpointer) ((long) x)); return g_slist_prepend (list, (gpointer) ((long) x));
while (list) while (list)
{ {
rest = next_item (list); rest = g_slist_next (list);
if (x < (long) list->data) if (x < (long) list->data)
{ {
rest = add_to_list (rest, list->data); rest = g_slist_prepend (rest, list->data);
list->next = rest; list->next = rest;
list->data = (gpointer) ((long) x); list->data = (gpointer) ((long) x);
return orig; return orig;
} }
else if (!rest) else if (!rest)
{ {
append_to_list (list, (gpointer) ((long) x)); g_slist_append (list, (gpointer) ((long) x));
return orig; return orig;
} }
list = next_item (list); list = g_slist_next (list);
} }
return orig; return orig;

View File

@ -31,7 +31,6 @@
#include "interface.h" #include "interface.h"
#include "layer.h" #include "layer.h"
#include "layers_dialog.h" #include "layers_dialog.h"
#include "linked.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "undo.h" #include "undo.h"
@ -1119,7 +1118,7 @@ void
layer_invalidate_previews (gimage_id) layer_invalidate_previews (gimage_id)
int gimage_id; int gimage_id;
{ {
link_ptr tmp; GSList * tmp;
Layer * layer; Layer * layer;
GImage * gimage; GImage * gimage;
@ -1132,7 +1131,7 @@ layer_invalidate_previews (gimage_id)
{ {
layer = (Layer *) tmp->data; layer = (Layer *) tmp->data;
drawable_invalidate_preview (GIMP_DRAWABLE(layer)); drawable_invalidate_preview (GIMP_DRAWABLE(layer));
tmp = next_item (tmp); tmp = g_slist_next (tmp);
} }
} }

View File

@ -602,7 +602,7 @@ layer_translate_invoker (Argument *args)
Layer *layer, *tmp_layer; Layer *layer, *tmp_layer;
Layer *floating_layer; Layer *floating_layer;
GImage *gimage; GImage *gimage;
link_ptr layer_list; GSList *layer_list;
int offx, offy; int offx, offy;
success = TRUE; success = TRUE;
@ -635,7 +635,7 @@ layer_translate_invoker (Argument *args)
tmp_layer = (Layer *) layer_list->data; tmp_layer = (Layer *) layer_list->data;
if ((tmp_layer == layer) || tmp_layer->linked) if ((tmp_layer == layer) || tmp_layer->linked)
layer_translate (tmp_layer, offx, offy); layer_translate (tmp_layer, offx, offy);
layer_list = next_item (layer_list); layer_list = g_slist_next (layer_list);
} }
if (floating_layer) if (floating_layer)

View File

@ -179,8 +179,8 @@ layer_select_advance (LayerSelect *layer_select,
int index; int index;
int length; int length;
int count; int count;
link_ptr list; GSList *list;
link_ptr nth; GSList *nth;
Layer *layer; Layer *layer;
index = 0; index = 0;
@ -197,17 +197,17 @@ layer_select_advance (LayerSelect *layer_select,
if (layer == layer_select->current_layer) if (layer == layer_select->current_layer)
index = count; index = count;
count++; count++;
list = next_item (list); list = g_slist_next (list);
} }
length = list_length (layer_select->gimage->layer_stack); length = g_slist_length (layer_select->gimage->layer_stack);
if (dir == 1) if (dir == 1)
index = (index == length - 1) ? 0 : (index + 1); index = (index == length - 1) ? 0 : (index + 1);
else else
index = (index == 0) ? (length - 1) : (index - 1); index = (index == 0) ? (length - 1) : (index - 1);
nth = nth_item (layer_select->gimage->layer_stack, index); nth = g_slist_nth (layer_select->gimage->layer_stack, index);
if (nth) if (nth)
{ {

View File

@ -87,7 +87,7 @@ struct _LayersDialog {
Layer * active_layer; Layer * active_layer;
Channel * active_channel; Channel * active_channel;
Layer * floating_sel; Layer * floating_sel;
link_ptr layer_widgets; GSList * layer_widgets;
}; };
typedef struct _LayerWidget LayerWidget; typedef struct _LayerWidget LayerWidget;
@ -445,7 +445,7 @@ layers_dialog_flush ()
GImage *gimage; GImage *gimage;
Layer *layer; Layer *layer;
LayerWidget *lw; LayerWidget *lw;
link_ptr list; GSList *list;
int gimage_pos; int gimage_pos;
int pos; int pos;
@ -469,7 +469,7 @@ layers_dialog_flush ()
{ {
lw = (LayerWidget *) list->data; lw = (LayerWidget *) list->data;
lw->visited = FALSE; lw->visited = FALSE;
list = next_item (list); list = g_slist_next (list);
} }
/* Add any missing layers */ /* Add any missing layers */
@ -485,7 +485,7 @@ layers_dialog_flush ()
else else
lw->visited = TRUE; lw->visited = TRUE;
list = next_item (list); list = g_slist_next (list);
} }
/* Remove any extraneous layers */ /* Remove any extraneous layers */
@ -493,7 +493,7 @@ layers_dialog_flush ()
while (list) while (list)
{ {
lw = (LayerWidget *) list->data; lw = (LayerWidget *) list->data;
list = next_item (list); list = g_slist_next (list);
if (lw->visited == FALSE) if (lw->visited == FALSE)
layers_dialog_remove_layer ((lw->layer)); layers_dialog_remove_layer ((lw->layer));
} }
@ -504,7 +504,7 @@ layers_dialog_flush ()
while (list) while (list)
{ {
lw = (LayerWidget *) list->data; lw = (LayerWidget *) list->data;
list = next_item (list); list = g_slist_next (list);
if ((gimage_pos = gimage_get_layer_index (gimage, lw->layer)) != pos) if ((gimage_pos = gimage_get_layer_index (gimage, lw->layer)) != pos)
layers_dialog_position_layer ((lw->layer), gimage_pos); layers_dialog_position_layer ((lw->layer), gimage_pos);
@ -541,7 +541,7 @@ layers_dialog_flush ()
void void
layers_dialog_free () layers_dialog_free ()
{ {
link_ptr list; GSList *list;
LayerWidget *lw; LayerWidget *lw;
if (layersD == NULL) if (layersD == NULL)
@ -554,7 +554,7 @@ layers_dialog_free ()
while (list) while (list)
{ {
lw = (LayerWidget *) list->data; lw = (LayerWidget *) list->data;
list = next_item(list); list = g_slist_next(list);
layer_widget_delete (lw); layer_widget_delete (lw);
} }
layersD->layer_widgets = NULL; layersD->layer_widgets = NULL;
@ -696,14 +696,14 @@ create_image_menu (int *default_id,
int *default_index, int *default_index,
MenuItemCallback callback) MenuItemCallback callback)
{ {
extern link_ptr image_list; extern GSList *image_list;
GImage *gimage; GImage *gimage;
GtkWidget *menu_item; GtkWidget *menu_item;
GtkWidget *menu; GtkWidget *menu;
char *menu_item_label; char *menu_item_label;
char *image_name; char *image_name;
link_ptr tmp; GSList *tmp;
int num_items = 0; int num_items = 0;
int id; int id;
@ -716,7 +716,7 @@ create_image_menu (int *default_id,
while (tmp) while (tmp)
{ {
gimage = tmp->data; gimage = tmp->data;
tmp = next_item (tmp); tmp = g_slist_next (tmp);
/* make sure the default index gets set to _something_, if possible */ /* make sure the default index gets set to _something_, if possible */
if (*default_index == -1) if (*default_index == -1)
@ -764,7 +764,7 @@ layers_dialog_update (int gimage_id)
GImage *gimage; GImage *gimage;
Layer *layer; Layer *layer;
LayerWidget *lw; LayerWidget *lw;
link_ptr list; GSList *list;
GList *item_list; GList *item_list;
if (!layersD) if (!layersD)
@ -783,10 +783,10 @@ layers_dialog_update (int gimage_id)
while (list) while (list)
{ {
lw = (LayerWidget *) list->data; lw = (LayerWidget *) list->data;
list = next_item(list); list = g_slist_next(list);
layer_widget_delete (lw); layer_widget_delete (lw);
} }
free_list (layersD->layer_widgets); g_slist_free (layersD->layer_widgets);
layersD->layer_widgets = NULL; layersD->layer_widgets = NULL;
if (! (gimage = gimage_get_ID (layersD->gimage_id))) if (! (gimage = gimage_get_ID (layersD->gimage_id)))
@ -807,10 +807,10 @@ layers_dialog_update (int gimage_id)
/* create a layer list item */ /* create a layer list item */
layer = (Layer *) list->data; layer = (Layer *) list->data;
lw = create_layer_widget (gimage, layer); lw = create_layer_widget (gimage, layer);
layersD->layer_widgets = append_to_list (layersD->layer_widgets, lw); layersD->layer_widgets = g_slist_append (layersD->layer_widgets, lw);
item_list = g_list_append (item_list, lw->list_item); item_list = g_list_append (item_list, lw->list_item);
list = next_item (list); list = g_slist_next (list);
} }
/* get the index of the active layer */ /* get the index of the active layer */
@ -1233,13 +1233,13 @@ layers_dialog_position_layer (Layer * layer,
/* Remove the layer from the dialog */ /* Remove the layer from the dialog */
list = g_list_append (list, layer_widget->list_item); list = g_list_append (list, layer_widget->list_item);
gtk_list_remove_items (GTK_LIST (layersD->layer_list), list); gtk_list_remove_items (GTK_LIST (layersD->layer_list), list);
layersD->layer_widgets = remove_from_list (layersD->layer_widgets, layer_widget); layersD->layer_widgets = g_slist_remove (layersD->layer_widgets, layer_widget);
suspend_gimage_notify--; suspend_gimage_notify--;
/* Add it back at the proper index */ /* Add it back at the proper index */
gtk_list_insert_items (GTK_LIST (layersD->layer_list), list, new_index); gtk_list_insert_items (GTK_LIST (layersD->layer_list), list, new_index);
layersD->layer_widgets = insert_in_list (layersD->layer_widgets, layer_widget, new_index); layersD->layer_widgets = g_slist_insert (layersD->layer_widgets, layer_widget, new_index);
} }
@ -1262,7 +1262,7 @@ layers_dialog_add_layer (Layer *layer)
item_list = g_list_append (item_list, layer_widget->list_item); item_list = g_list_append (item_list, layer_widget->list_item);
position = gimage_get_layer_index (gimage, layer); position = gimage_get_layer_index (gimage, layer);
layersD->layer_widgets = insert_in_list (layersD->layer_widgets, layer_widget, position); layersD->layer_widgets = g_slist_insert (layersD->layer_widgets, layer_widget, position);
gtk_list_insert_items (GTK_LIST (layersD->layer_list), item_list, position); gtk_list_insert_items (GTK_LIST (layersD->layer_list), item_list, position);
} }
@ -1825,7 +1825,7 @@ static LayerWidget *
layer_widget_get_ID (Layer * ID) layer_widget_get_ID (Layer * ID)
{ {
LayerWidget *lw; LayerWidget *lw;
link_ptr list; GSList *list;
if (!layersD) if (!layersD)
return NULL; return NULL;
@ -1838,7 +1838,7 @@ layer_widget_get_ID (Layer * ID)
if (lw->layer == ID) if (lw->layer == ID)
return lw; return lw;
list = next_item(list); list = g_slist_next(list);
} }
return NULL; return NULL;
@ -1990,7 +1990,7 @@ layer_widget_delete (LayerWidget *layer_widget)
gdk_pixmap_unref (layer_widget->mask_pixmap); gdk_pixmap_unref (layer_widget->mask_pixmap);
/* Remove the layer widget from the list */ /* Remove the layer widget from the list */
layersD->layer_widgets = remove_from_list (layersD->layer_widgets, layer_widget); layersD->layer_widgets = g_slist_remove (layersD->layer_widgets, layer_widget);
/* Free the widget */ /* Free the widget */
g_free (layer_widget); g_free (layer_widget);
@ -2668,7 +2668,7 @@ layer_widget_clip_redraw (LayerWidget *layer_widget)
static void static void
layer_widget_exclusive_visible (LayerWidget *layer_widget) layer_widget_exclusive_visible (LayerWidget *layer_widget)
{ {
link_ptr list; GSList *list;
LayerWidget *lw; LayerWidget *lw;
int visible = FALSE; int visible = FALSE;
@ -2683,7 +2683,7 @@ layer_widget_exclusive_visible (LayerWidget *layer_widget)
if (lw != layer_widget) if (lw != layer_widget)
visible |= GIMP_DRAWABLE(lw->layer)->visible; visible |= GIMP_DRAWABLE(lw->layer)->visible;
list = next_item (list); list = g_slist_next (list);
} }
/* Now, toggle the visibility for all layers except the specified one */ /* Now, toggle the visibility for all layers except the specified one */
@ -2698,7 +2698,7 @@ layer_widget_exclusive_visible (LayerWidget *layer_widget)
layer_widget_eye_redraw (lw); layer_widget_eye_redraw (lw);
list = next_item (list); list = g_slist_next (list);
} }
} }

View File

@ -1,199 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdlib.h>
#include <stdio.h>
#include <glib.h>
#include "linked.h"
static GMemChunk *list_mem_chunk = NULL;
static link_ptr free_list_list = NULL;
link_ptr
alloc_list ()
{
link_ptr new_list;
if (!list_mem_chunk)
list_mem_chunk = g_mem_chunk_new ("gimp list mem chunk",
sizeof (struct _link),
1024, G_ALLOC_ONLY);
if (free_list_list)
{
new_list = free_list_list;
free_list_list = free_list_list->next;
}
else
{
new_list = g_mem_chunk_alloc (list_mem_chunk);
}
new_list->data = NULL;
new_list->next = NULL;
return new_list;
}
link_ptr
free_list (l)
link_ptr l;
{
link_ptr temp_list;
if (!l)
return NULL;
temp_list = l;
while (temp_list->next)
temp_list = temp_list->next;
temp_list->next = free_list_list;
free_list_list = l;
return NULL;
}
link_ptr
append_to_list (list, data)
link_ptr list;
void *data;
{
link_ptr new_link;
link_ptr head = list;
new_link = alloc_list ();
new_link->data = data;
new_link->next = NULL;
if (!list)
return new_link;
while (list->next)
list = next_item (list);
list->next = new_link;
return head;
}
link_ptr
insert_in_list (list, data, index)
link_ptr list;
void *data;
int index;
{
link_ptr new_link;
link_ptr head = list;
link_ptr prev = NULL;
int count = 0;
new_link = alloc_list ();
new_link->data = data;
new_link->next = NULL;
if (!list)
return new_link;
while (list && (count < index))
{
count++;
prev = list;
list = next_item (list);
}
new_link->next = list;
if (prev)
prev->next = new_link;
else
head = new_link;
return head;
}
link_ptr
add_to_list (list, data)
link_ptr list;
void *data;
{
link_ptr new_link;
new_link = alloc_list ();
new_link->data = data;
new_link->next = list;
return new_link;
}
link_ptr
remove_from_list (list, data)
link_ptr list;
void *data;
{
link_ptr tmp;
if (!list)
return NULL;
if (list->data == data)
{
tmp = list->next;
list->next = NULL;
free_list (list);
return tmp;
}
else
list->next = remove_from_list (list->next, data);
return list;
}
link_ptr
next_item (list)
link_ptr list;
{
if (!list)
return NULL;
else
return list->next;
}
link_ptr
nth_item (list, n)
link_ptr list;
int n;
{
if (list && (n > 0))
return nth_item (next_item (list), n - 1);
return list;
}
int
list_length (list)
link_ptr list;
{
int n;
n = 0;
while (list)
{
n += 1;
list = list->next;
}
return n;
}

View File

@ -1,56 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __LINKED_H__
#define __LINKED_H__
#ifndef USE_GSLIST_VERSION
typedef struct _link
{
void *data;
struct _link *next;
} *link_ptr;
extern link_ptr alloc_list (void);
extern link_ptr free_list (link_ptr);
extern link_ptr add_to_list (link_ptr, void *);
extern link_ptr append_to_list (link_ptr, void *);
extern link_ptr insert_in_list (link_ptr, void *, int);
extern link_ptr remove_from_list (link_ptr, void *);
extern link_ptr next_item (link_ptr);
extern link_ptr nth_item (link_ptr, int);
extern int list_length (link_ptr);
#else /* USE_GSLIST_VERSION */
#include <glib.h>
typedef GSList * link_ptr;
#define alloc_list() g_slist_alloc()
#define free_list(x) g_slist_free((x)), NULL
#define add_to_list(x, y) g_slist_prepend((x), (y))
#define append_to_list(x, y) g_slist_append((x), (y))
#define insert_in_list(x, y, z) g_slist_insert((x), (y), (z))
#define remove_from_list(x, y) g_slist_remove((x), (y))
#define next_item(x) (x)?g_slist_next((x)):NULL
#define nth_item(x, y) g_slist_nth((x), (y))
#define list_length(x) g_slist_length((x))
#endif /* USE_GSLIST_VERSION */
#endif

View File

@ -24,7 +24,6 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gdisplay_ops.h" #include "gdisplay_ops.h"
#include "linked.h"
#include "move.h" #include "move.h"
#include "undo.h" #include "undo.h"

View File

@ -32,7 +32,6 @@
#include "errors.h" #include "errors.h"
#include "general.h" #include "general.h"
#include "gimprc.h" #include "gimprc.h"
#include "linked.h"
#include "interface.h" #include "interface.h"
#include "palette.h" #include "palette.h"
@ -74,7 +73,7 @@ static void palette_delete_entry (PaletteP);
static void palette_calc_scrollbar (PaletteP); static void palette_calc_scrollbar (PaletteP);
static void palette_entries_load (char *); static void palette_entries_load (char *);
static link_ptr palette_entries_insert_list (link_ptr, PaletteEntriesP); static GSList * palette_entries_insert_list (GSList *, PaletteEntriesP);
static void palette_entries_delete (char *); static void palette_entries_delete (char *);
static void palette_entries_save (PaletteEntriesP, char *); static void palette_entries_save (PaletteEntriesP, char *);
static void palette_entries_free (PaletteEntriesP); static void palette_entries_free (PaletteEntriesP);
@ -100,7 +99,7 @@ static void palette_draw_entries (PaletteP);
static void palette_draw_current_entry (PaletteP); static void palette_draw_current_entry (PaletteP);
static void palette_update_current_entry (PaletteP); static void palette_update_current_entry (PaletteP);
link_ptr palette_entries_list = NULL; GSList *palette_entries_list = NULL;
static PaletteP palette = NULL; static PaletteP palette = NULL;
static PaletteEntriesP default_palette_entries = NULL; static PaletteEntriesP default_palette_entries = NULL;
@ -368,7 +367,7 @@ palette_init_palettes (void)
void void
palette_free_palettes (void) palette_free_palettes (void)
{ {
link_ptr list; GSList *list;
PaletteEntriesP entries; PaletteEntriesP entries;
list = palette_entries_list; list = palette_entries_list;
@ -383,9 +382,9 @@ palette_free_palettes (void)
palette_entries_save (entries, entries->filename); palette_entries_save (entries, entries->filename);
palette_entries_free (entries); palette_entries_free (entries);
list = next_item (list); list = g_slist_next (list);
} }
free_list (palette_entries_list); g_slist_free (palette_entries_list);
if (palette) if (palette)
{ {
@ -409,7 +408,7 @@ palette_create_palette_menu (PaletteP palette,
PaletteEntriesP default_entries) PaletteEntriesP default_entries)
{ {
GtkWidget *menu_item; GtkWidget *menu_item;
link_ptr list; GSList *list;
PaletteEntriesP p_entries = NULL; PaletteEntriesP p_entries = NULL;
PaletteEntriesP found_entries = NULL; PaletteEntriesP found_entries = NULL;
int i = 0; int i = 0;
@ -421,7 +420,7 @@ palette_create_palette_menu (PaletteP palette,
while (list) while (list)
{ {
p_entries = (PaletteEntriesP) list->data; p_entries = (PaletteEntriesP) list->data;
list = next_item (list); list = g_slist_next (list);
/* to make sure we get something! */ /* to make sure we get something! */
if (p_entries == NULL) if (p_entries == NULL)
@ -559,13 +558,13 @@ palette_entries_delete (char *filename)
unlink (filename); unlink (filename);
} }
static link_ptr static GSList *
palette_entries_insert_list (link_ptr list, palette_entries_insert_list (GSList * list,
PaletteEntriesP entries) PaletteEntriesP entries)
{ {
/* add it to the list */ /* add it to the list */
num_palette_entries++; num_palette_entries++;
return append_to_list (list, (void *) entries); return g_slist_append (list, (void *) entries);
} }
static void static void
@ -573,7 +572,7 @@ palette_entries_save (PaletteEntriesP palette,
char *filename) char *filename)
{ {
FILE * fp; FILE * fp;
link_ptr list; GSList * list;
PaletteEntryP entry; PaletteEntryP entry;
if (! filename) if (! filename)
@ -595,7 +594,7 @@ palette_entries_save (PaletteEntriesP palette,
entry = (PaletteEntryP) list->data; entry = (PaletteEntryP) list->data;
fprintf (fp, "%d %d %d\t%s\n", entry->color[0], entry->color[1], fprintf (fp, "%d %d %d\t%s\n", entry->color[0], entry->color[1],
entry->color[2], entry->name); entry->color[2], entry->name);
list = next_item (list); list = g_slist_next (list);
} }
/* Clean up */ /* Clean up */
@ -606,7 +605,7 @@ static void
palette_entries_free (PaletteEntriesP entries) palette_entries_free (PaletteEntriesP entries)
{ {
PaletteEntryP entry; PaletteEntryP entry;
link_ptr list; GSList * list;
list = entries->colors; list = entries->colors;
while (list) while (list)
@ -722,7 +721,7 @@ palette_color_area_events (GtkWidget *widget,
PaletteP palette) PaletteP palette)
{ {
GdkEventButton *bevent; GdkEventButton *bevent;
link_ptr tmp_link; GSList *tmp_link;
int r, g, b; int r, g, b;
int width, height; int width, height;
int entry_width; int entry_width;
@ -746,7 +745,7 @@ palette_color_area_events (GtkWidget *widget,
row = (palette->scroll_offset + bevent->y - 1) / entry_height; row = (palette->scroll_offset + bevent->y - 1) / entry_height;
pos = row * COLUMNS + col; pos = row * COLUMNS + col;
tmp_link = nth_item (palette->entries->colors, pos); tmp_link = g_slist_nth (palette->entries->colors, pos);
if (tmp_link) if (tmp_link)
{ {
palette_draw_current_entry (palette); palette_draw_current_entry (palette);
@ -1158,7 +1157,7 @@ palette_draw_entries (PaletteP palette)
PaletteEntryP entry; PaletteEntryP entry;
unsigned char *buffer; unsigned char *buffer;
unsigned char *colors[COLUMNS]; unsigned char *colors[COLUMNS];
link_ptr tmp_link; GSList *tmp_link;
int width, height; int width, height;
int entry_width; int entry_width;
int entry_height; int entry_height;
@ -1293,7 +1292,7 @@ palette_add_entry (PaletteEntriesP entries,
entry->name = g_strdup ("Untitled"); entry->name = g_strdup ("Untitled");
entry->position = entries->n_colors; entry->position = entries->n_colors;
entries->colors = append_to_list (entries->colors, entry); entries->colors = g_slist_append (entries->colors, entry);
entries->n_colors += 1; entries->n_colors += 1;
entries->changed = 1; entries->changed = 1;
@ -1308,20 +1307,20 @@ static void
palette_delete_entry (PaletteP palette) palette_delete_entry (PaletteP palette)
{ {
PaletteEntryP entry; PaletteEntryP entry;
link_ptr tmp_link; GSList *tmp_link;
int pos; int pos;
if (palette && palette->entries && palette->color) if (palette && palette->entries && palette->color)
{ {
entry = palette->color; entry = palette->color;
palette->entries->colors = remove_from_list (palette->entries->colors, entry); palette->entries->colors = g_slist_remove (palette->entries->colors, entry);
palette->entries->n_colors--; palette->entries->n_colors--;
palette->entries->changed = 1; palette->entries->changed = 1;
pos = entry->position; pos = entry->position;
palette_entry_free (entry); palette_entry_free (entry);
tmp_link = nth_item (palette->entries->colors, pos); tmp_link = g_slist_nth (palette->entries->colors, pos);
if (tmp_link) if (tmp_link)
{ {
@ -1336,7 +1335,7 @@ palette_delete_entry (PaletteP palette)
} }
else else
{ {
tmp_link = nth_item (palette->entries->colors, pos - 1); tmp_link = g_slist_nth (palette->entries->colors, pos - 1);
if (tmp_link) if (tmp_link)
palette->color = tmp_link->data; palette->color = tmp_link->data;
} }

View File

@ -18,6 +18,9 @@
#ifndef __PALETTE_H__ #ifndef __PALETTE_H__
#define __PALETTE_H__ #define __PALETTE_H__
#include <glib.h>
#include "procedural_db.h"
#define FOREGROUND 0 #define FOREGROUND 0
#define BACKGROUND 1 #define BACKGROUND 1
@ -39,7 +42,7 @@ void palette_set_active_color (int, int, int, int);
struct _PaletteEntries { struct _PaletteEntries {
char *name; char *name;
char *filename; char *filename;
link_ptr colors; GSList *colors;
int n_colors; int n_colors;
int changed; int changed;
}; };
@ -52,12 +55,10 @@ struct _PaletteEntry {
}; };
typedef struct _PaletteEntry _PaletteEntry, *PaletteEntryP; typedef struct _PaletteEntry _PaletteEntry, *PaletteEntryP;
extern link_ptr palette_entries_list; extern GSList * palette_entries_list;
void palette_init_palettes (void); void palette_init_palettes (void);
void palette_free_palettes (void); void palette_free_palettes (void);
#include "procedural_db.h"
/* Procedure definition and marshalling function */ /* Procedure definition and marshalling function */
extern ProcRecord palette_get_foreground_proc; extern ProcRecord palette_get_foreground_proc;
extern ProcRecord palette_get_background_proc; extern ProcRecord palette_get_background_proc;

View File

@ -373,7 +373,7 @@ display_setup (PatternSelectP psp)
static void static void
display_patterns (PatternSelectP psp) display_patterns (PatternSelectP psp)
{ {
link_ptr list = pattern_list; /* the global pattern list */ GSList *list = pattern_list; /* the global pattern list */
int row, col; int row, col;
GPatternP pattern; GPatternP pattern;
@ -405,7 +405,7 @@ display_patterns (PatternSelectP psp)
col = 0; col = 0;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }

View File

@ -33,13 +33,12 @@
#include "errors.h" #include "errors.h"
#include "general.h" #include "general.h"
#include "gimprc.h" #include "gimprc.h"
#include "linked.h"
#include "menus.h" #include "menus.h"
/* global variables */ /* global variables */
GPatternP active_pattern = NULL; GPatternP active_pattern = NULL;
link_ptr pattern_list = NULL; GSList * pattern_list = NULL;
int num_patterns = 0; int num_patterns = 0;
PatternSelectP pattern_select_dialog = NULL; PatternSelectP pattern_select_dialog = NULL;
@ -50,15 +49,18 @@ static Argument *return_args;
static int have_default_pattern = 0; static int have_default_pattern = 0;
/* static function prototypes */ /* static function prototypes */
static link_ptr insert_pattern_in_list (link_ptr, GPatternP); static GSList * insert_pattern_in_list (GSList *, GPatternP);
static void load_pattern (char *filename); static void load_pattern (char *filename);
static void free_pattern (GPatternP); static void free_pattern (GPatternP);
static void pattern_free_one (gpointer, gpointer);
static gint pattern_compare_func (gpointer, gpointer);
/* function declarations */ /* function declarations */
void void
patterns_init () patterns_init ()
{ {
link_ptr list; GSList *list;
if (pattern_list) if (pattern_list)
patterns_free (); patterns_free ();
@ -75,32 +77,33 @@ patterns_init ()
list = pattern_list; list = pattern_list;
while (list) while (list) {
{
/* Set the pattern index */ /* Set the pattern index */
((GPattern *) list->data)->index = num_patterns++; ((GPattern *) list->data)->index = num_patterns++;
list = next_item (list); list = g_slist_next (list);
} /* while */ }
} }
static void
pattern_free_one (gpointer data, gpointer dummy)
{
free_pattern ((GPatternP) data);
}
static gint
pattern_compare_func(gpointer first, gpointer second)
{
return strcmp (((GPatternP)first)->name, ((GPatternP)second)->name);
}
void void
patterns_free () patterns_free ()
{ {
link_ptr list; if (pattern_list) {
GPatternP pattern; g_slist_foreach (pattern_list, pattern_free_one, NULL);
g_slist_free (pattern_list);
list = pattern_list; }
while (list)
{
pattern = (GPatternP) list->data;
free_pattern (pattern);
list = next_item (list);
}
free_list (list);
have_default_pattern = 0; have_default_pattern = 0;
active_pattern = NULL; active_pattern = NULL;
@ -137,67 +140,10 @@ get_active_pattern ()
} }
static link_ptr static GSList *
insert_pattern_in_list (list, pattern) insert_pattern_in_list (GSList *list, GPatternP pattern)
link_ptr list;
GPatternP pattern;
{ {
link_ptr tmp; return g_slist_insert_sorted (list, pattern, pattern_compare_func);
link_ptr prev;
link_ptr new_link;
GPatternP b;
int val;
/* Insert the item in the list */
if (list)
{
prev = NULL;
tmp = list;
do {
if (tmp)
{
b = (GPatternP) tmp->data;
/* do the comparison needed for the insertion sort */
val = strcmp (pattern->name, b->name);
}
else
val = -1;
if (val <= 0)
{
/* this is the place the item goes */
/* Insert the item into the list. We'll have to create
* a new link and then do a little insertion.
*/
new_link = alloc_list ();
if (!new_link)
fatal_error ("Unable to allocate memory");
new_link->data = pattern;
new_link->next = tmp;
if (prev)
prev->next = new_link;
if (tmp == list)
list = new_link;
return list;
}
/* Advance to the next item in the list.
*/
prev = tmp;
tmp = next_item (tmp);
} while (prev);
}
else
/* There are no items in the pattern list, so we'll just start
* one right now.
*/
list = add_to_list (list, pattern);
return list;
} }
@ -302,23 +248,16 @@ load_pattern (char *filename)
GPatternP GPatternP
get_pattern_by_index (index) get_pattern_by_index (int index)
int index;
{ {
link_ptr list; GSList *list;
GPatternP pattern; GPatternP pattern = NULL;
list = pattern_list; list = g_slist_nth (pattern_list, index);
if (list)
pattern = (GPatternP) list->data;
while (list) return pattern;
{
pattern = (GPatternP) list->data;
if (pattern->index == index)
return pattern;
list = next_item (list);
}
return NULL;
} }
@ -441,7 +380,7 @@ static Argument *
patterns_set_pattern_invoker (Argument *args) patterns_set_pattern_invoker (Argument *args)
{ {
GPatternP patternp; GPatternP patternp;
link_ptr list; GSList *list;
char *name; char *name;
success = (name = (char *) args[0].value.pdb_pointer) != NULL; success = (name = (char *) args[0].value.pdb_pointer) != NULL;
@ -462,7 +401,7 @@ patterns_set_pattern_invoker (Argument *args)
break; break;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -508,7 +447,7 @@ static Argument *
patterns_list_invoker (Argument *args) patterns_list_invoker (Argument *args)
{ {
GPatternP patternp; GPatternP patternp;
link_ptr list; GSList *list;
char **patterns; char **patterns;
int i; int i;
@ -522,7 +461,7 @@ patterns_list_invoker (Argument *args)
patternp = (GPatternP) list->data; patternp = (GPatternP) list->data;
patterns[i++] = g_strdup (patternp->name); patterns[i++] = g_strdup (patternp->name);
list = next_item (list); list = g_slist_next (list);
} }
return_args = procedural_db_return_args (&patterns_list_proc, success); return_args = procedural_db_return_args (&patterns_list_proc, success);

View File

@ -18,7 +18,7 @@
#ifndef __PATTERNS_H__ #ifndef __PATTERNS_H__
#define __PATTERNS_H__ #define __PATTERNS_H__
#include "linked.h" #include <glib.h>
#include "temp_buf.h" #include "temp_buf.h"
#include "procedural_db.h" #include "procedural_db.h"
@ -42,7 +42,7 @@ GPatternP get_active_pattern (void);
void create_pattern_dialog (void); void create_pattern_dialog (void);
/* global variables */ /* global variables */
extern link_ptr pattern_list; extern GSList * pattern_list;
extern int num_patterns; extern int num_patterns;
/* Pattern procedures */ /* Pattern procedures */

View File

@ -20,7 +20,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include "appenv.h" #include "appenv.h"
#include "linked.h"
#include "pixel_region.h" #include "pixel_region.h"
#include "tile_manager_pvt.h" #include "tile_manager_pvt.h"
@ -40,7 +39,7 @@ typedef struct _PixelRegionIterator PixelRegionIterator;
struct _PixelRegionIterator struct _PixelRegionIterator
{ {
link_ptr pixel_regions; GSList *pixel_regions;
int region_width; int region_width;
int region_height; int region_height;
int portion_width; int portion_width;
@ -292,7 +291,7 @@ pixel_regions_register (int num_regions, ...)
} }
/* Add the pixel region holder to the list */ /* Add the pixel region holder to the list */
PRI->pixel_regions = add_to_list (PRI->pixel_regions, PRH); PRI->pixel_regions = g_slist_prepend (PRI->pixel_regions, PRH);
} }
va_end (ap); va_end (ap);
@ -305,7 +304,7 @@ void *
pixel_regions_process (PRI_ptr) pixel_regions_process (PRI_ptr)
void *PRI_ptr; void *PRI_ptr;
{ {
link_ptr list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
PixelRegionIterator *PRI; PixelRegionIterator *PRI;
@ -342,7 +341,7 @@ pixel_regions_process (PRI_ptr)
} }
} }
list = next_item (list); list = g_slist_next (list);
} }
return pixel_regions_configure (PRI); return pixel_regions_configure (PRI);
@ -352,7 +351,7 @@ void
pixel_regions_process_stop (PRI_ptr) pixel_regions_process_stop (PRI_ptr)
void *PRI_ptr; void *PRI_ptr;
{ {
link_ptr list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
PixelRegionIterator *PRI; PixelRegionIterator *PRI;
@ -381,7 +380,7 @@ pixel_regions_process_stop (PRI_ptr)
} }
} }
list = next_item (list); list = g_slist_next (list);
} }
if (PRI->pixel_regions) if (PRI->pixel_regions)
@ -390,9 +389,9 @@ pixel_regions_process_stop (PRI_ptr)
while (list) while (list)
{ {
g_free (list->data); g_free (list->data);
list = next_item (list); list = g_slist_next (list);
} }
free_list (PRI->pixel_regions); g_slist_free (PRI->pixel_regions);
g_free (PRI); g_free (PRI);
} }
} }
@ -405,7 +404,7 @@ static int
get_portion_height (PRI) get_portion_height (PRI)
PixelRegionIterator *PRI; PixelRegionIterator *PRI;
{ {
link_ptr list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
int min_height = G_MAXINT; int min_height = G_MAXINT;
int height; int height;
@ -437,7 +436,7 @@ get_portion_height (PRI)
min_height = height; min_height = height;
} }
list = next_item (list); list = g_slist_next (list);
} }
return min_height; return min_height;
@ -448,7 +447,7 @@ static int
get_portion_width (PRI) get_portion_width (PRI)
PixelRegionIterator *PRI; PixelRegionIterator *PRI;
{ {
link_ptr list; GSList *list;
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
int min_width = G_MAXINT; int min_width = G_MAXINT;
int width; int width;
@ -480,7 +479,7 @@ get_portion_width (PRI)
min_width = width; min_width = width;
} }
list = next_item (list); list = g_slist_next (list);
} }
return min_width; return min_width;
@ -492,7 +491,7 @@ pixel_regions_configure (PRI)
PixelRegionIterator *PRI; PixelRegionIterator *PRI;
{ {
PixelRegionHolder *PRH; PixelRegionHolder *PRH;
link_ptr list; GSList *list;
/* Determine the portion width and height */ /* Determine the portion width and height */
PRI->portion_width = get_portion_width (PRI); PRI->portion_width = get_portion_width (PRI);
@ -507,9 +506,9 @@ pixel_regions_configure (PRI)
while (list) while (list)
{ {
g_free (list->data); g_free (list->data);
list = next_item (list); list = g_slist_next (list);
} }
free_list (PRI->pixel_regions); g_slist_free (PRI->pixel_regions);
g_free (PRI); g_free (PRI);
} }
@ -529,7 +528,7 @@ pixel_regions_configure (PRI)
pixel_region_configure (PRH, PRI); pixel_region_configure (PRH, PRI);
} }
list = next_item (list); list = g_slist_next (list);
} }
return PRI; return PRI;

View File

@ -100,7 +100,7 @@ struct _FontInfo
int *spacings; /* An array of valid spacings */ int *spacings; /* An array of valid spacings */
int **combos; /* An array of valid combinations of the above 5 items */ int **combos; /* An array of valid combinations of the above 5 items */
int ncombos; /* The number of elements in the "combos" array */ int ncombos; /* The number of elements in the "combos" array */
link_ptr fontnames; /* An list of valid fontnames. GSList *fontnames; /* An list of valid fontnames.
* This is used to make sure a family/foundry/weight/slant/set_width * This is used to make sure a family/foundry/weight/slant/set_width
* combination is valid. * combination is valid.
*/ */
@ -131,7 +131,7 @@ static void text_validate_combo (TextTool *, int);
static void text_get_fonts (void); static void text_get_fonts (void);
static void text_insert_font (FontInfo **, int *, char *); static void text_insert_font (FontInfo **, int *, char *);
static link_ptr text_insert_field (link_ptr, char *, int); static GSList* text_insert_field (GSList *, char *, int);
static char* text_get_field (char *, int); static char* text_get_field (char *, int);
static int text_field_to_index (char **, int, char *); static int text_field_to_index (char **, int, char *);
static int text_is_xlfd_font_name (char *); static int text_is_xlfd_font_name (char *);
@ -144,6 +144,8 @@ static void text_gdk_image_to_region (GdkImage *, int, PixelRegion *);
static int text_get_extents (char *, char *, int *, int *, int *, int *); static int text_get_extents (char *, char *, int *, int *, int *, int *);
static Layer * text_render (GImage *, GimpDrawable *, int, int, char *, char *, int, int); static Layer * text_render (GImage *, GimpDrawable *, int, int, char *, char *, int, int);
static int font_compare_func (gpointer, gpointer);
static Argument * text_tool_invoker (Argument *); static Argument * text_tool_invoker (Argument *);
static Argument * text_tool_get_extents_invoker (Argument *); static Argument * text_tool_get_extents_invoker (Argument *);
@ -164,11 +166,11 @@ static TextTool *the_text_tool = NULL;
static FontInfo **font_info; static FontInfo **font_info;
static int nfonts = -1; static int nfonts = -1;
static link_ptr foundries = NULL; static GSList *foundries = NULL;
static link_ptr weights = NULL; static GSList *weights = NULL;
static link_ptr slants = NULL; static GSList *slants = NULL;
static link_ptr set_widths = NULL; static GSList *set_widths = NULL;
static link_ptr spacings = NULL; static GSList *spacings = NULL;
static char **foundry_array = NULL; static char **foundry_array = NULL;
static char **weight_array = NULL; static char **weight_array = NULL;
@ -970,7 +972,7 @@ text_get_fonts ()
char **fontnames; char **fontnames;
char *fontname; char *fontname;
char *field; char *field;
link_ptr temp_list; GSList *temp_list;
int num_fonts; int num_fonts;
int index; int index;
int i, j; int i, j;
@ -998,11 +1000,11 @@ text_get_fonts ()
XFreeFontNames (fontnames); XFreeFontNames (fontnames);
nfoundries = list_length (foundries) + 1; nfoundries = g_slist_length (foundries) + 1;
nweights = list_length (weights) + 1; nweights = g_slist_length (weights) + 1;
nslants = list_length (slants) + 1; nslants = g_slist_length (slants) + 1;
nset_widths = list_length (set_widths) + 1; nset_widths = g_slist_length (set_widths) + 1;
nspacings = list_length (spacings) + 1; nspacings = g_slist_length (spacings) + 1;
foundry_array = g_malloc (sizeof (char*) * nfoundries); foundry_array = g_malloc (sizeof (char*) * nfoundries);
weight_array = g_malloc (sizeof (char*) * nweights); weight_array = g_malloc (sizeof (char*) * nweights);
@ -1063,7 +1065,7 @@ text_get_fonts ()
font_info[i]->slants = g_malloc (sizeof (int) * nslants); font_info[i]->slants = g_malloc (sizeof (int) * nslants);
font_info[i]->set_widths = g_malloc (sizeof (int) * nset_widths); font_info[i]->set_widths = g_malloc (sizeof (int) * nset_widths);
font_info[i]->spacings = g_malloc (sizeof (int) * nspacings); font_info[i]->spacings = g_malloc (sizeof (int) * nspacings);
font_info[i]->ncombos = list_length (font_info[i]->fontnames); font_info[i]->ncombos = g_slist_length (font_info[i]->fontnames);
font_info[i]->combos = g_malloc (sizeof (int*) * font_info[i]->ncombos); font_info[i]->combos = g_malloc (sizeof (int*) * font_info[i]->ncombos);
for (j = 0; j < nfoundries; j++) for (j = 0; j < nfoundries; j++)
@ -1156,7 +1158,7 @@ text_insert_font (FontInfo **table,
cmp = strcmp (family, table[middle]->family); cmp = strcmp (family, table[middle]->family);
if (cmp == 0) if (cmp == 0)
{ {
table[middle]->fontnames = add_to_list (table[middle]->fontnames, g_strdup (fontname)); table[middle]->fontnames = g_slist_prepend (table[middle]->fontnames, g_strdup (fontname));
return; return;
} }
else if (cmp < 0) else if (cmp < 0)
@ -1174,7 +1176,7 @@ text_insert_font (FontInfo **table,
table[*ntable]->slants = NULL; table[*ntable]->slants = NULL;
table[*ntable]->set_widths = NULL; table[*ntable]->set_widths = NULL;
table[*ntable]->fontnames = NULL; table[*ntable]->fontnames = NULL;
table[*ntable]->fontnames = add_to_list (table[*ntable]->fontnames, g_strdup (fontname)); table[*ntable]->fontnames = g_slist_prepend (table[*ntable]->fontnames, g_strdup (fontname));
(*ntable)++; (*ntable)++;
/* Quickly insert the entry into the table in sorted order /* Quickly insert the entry into the table in sorted order
@ -1198,62 +1200,24 @@ text_insert_font (FontInfo **table,
} }
} }
static link_ptr static int
text_insert_field (link_ptr list, font_compare_func (gpointer a, gpointer b)
char *fontname, {
int field_num) return strcmp (a, b);
}
static GSList *
text_insert_field (GSList *list,
char *fontname,
int field_num)
{ {
link_ptr temp_list;
link_ptr prev_list;
link_ptr new_list;
char *field; char *field;
int cmp;
field = text_get_field (fontname, field_num); field = text_get_field (fontname, field_num);
if (!field) if (!field)
return list; return list;
temp_list = list; return g_slist_insert_sorted (list, field, font_compare_func);
prev_list = NULL;
while (temp_list)
{
cmp = strcmp (field, temp_list->data);
if (cmp == 0)
{
free (field);
return list;
}
else if (cmp < 0)
{
new_list = alloc_list ();
new_list->data = field;
new_list->next = temp_list;
if (prev_list)
{
prev_list->next = new_list;
return list;
}
else
return new_list;
}
else
{
prev_list = temp_list;
temp_list = temp_list->next;
}
}
new_list = alloc_list ();
new_list->data = field;
new_list->next = NULL;
if (prev_list)
{
prev_list->next = new_list;
return list;
}
else
return new_list;
} }
static char* static char*

View File

@ -25,7 +25,6 @@
#include "errors.h" #include "errors.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "linked.h"
#include "rect_select.h" #include "rect_select.h"
#define BEZIER_START 1 #define BEZIER_START 1
@ -71,7 +70,7 @@ struct _bezier_select
BezierPoint *last_point; /* the last point on the curve */ BezierPoint *last_point; /* the last point on the curve */
int num_points; /* number of points in the curve */ int num_points; /* number of points in the curve */
Channel *mask; /* null if the curve is open */ Channel *mask; /* null if the curve is open */
link_ptr *scanlines; /* used in converting a curve */ GSList **scanlines; /* used in converting a curve */
}; };
static void bezier_select_reset (BezierSelect *); static void bezier_select_reset (BezierSelect *);
@ -95,8 +94,8 @@ static void bezier_compose (BezierMatrix, BezierMatrix, BezierMa
static void bezier_convert (BezierSelect *, GDisplay *, int, int); static void bezier_convert (BezierSelect *, GDisplay *, int, int);
static void bezier_convert_points (BezierSelect *, GdkPoint *, int); static void bezier_convert_points (BezierSelect *, GdkPoint *, int);
static void bezier_convert_line (link_ptr *, int, int, int, int); static void bezier_convert_line (GSList **, int, int, int, int);
static link_ptr bezier_insert_in_list (link_ptr, int); static GSList * bezier_insert_in_list (GSList *, int);
static BezierMatrix basis = static BezierMatrix basis =
{ {
@ -1042,7 +1041,7 @@ bezier_convert (BezierSelect *bezier_sel,
PixelRegion maskPR; PixelRegion maskPR;
BezierPoint * points; BezierPoint * points;
BezierPoint * start_pt; BezierPoint * start_pt;
link_ptr list; GSList * list;
unsigned char *buf, *b; unsigned char *buf, *b;
int draw_type; int draw_type;
int * vals, val; int * vals, val;
@ -1084,7 +1083,7 @@ bezier_convert (BezierSelect *bezier_sel,
gdisp->gimage->height); gdisp->gimage->height);
/* allocate room for the scanlines */ /* allocate room for the scanlines */
bezier_sel->scanlines = g_malloc (sizeof (link_ptr) * height); bezier_sel->scanlines = g_malloc (sizeof (GSList *) * height);
/* zero out the scanlines */ /* zero out the scanlines */
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
@ -1146,7 +1145,7 @@ bezier_convert (BezierSelect *bezier_sel,
for (j = 0; j < w; j++) for (j = 0; j < w; j++)
vals[j + x] += 255; vals[j + x] += 255;
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -1168,7 +1167,7 @@ bezier_convert (BezierSelect *bezier_sel,
drawable_width (GIMP_DRAWABLE(bezier_sel->mask)), buf); drawable_width (GIMP_DRAWABLE(bezier_sel->mask)), buf);
} }
free_list (bezier_sel->scanlines[i]); g_slist_free (bezier_sel->scanlines[i]);
} }
if (antialias) if (antialias)
@ -1207,7 +1206,7 @@ bezier_convert_points (BezierSelect *bezier_sel,
} }
static void static void
bezier_convert_line (link_ptr *scanlines, bezier_convert_line (GSList ** scanlines,
int x1, int x1,
int y1, int y1,
int x2, int x2,
@ -1323,32 +1322,32 @@ bezier_convert_line (link_ptr *scanlines,
} }
} }
static link_ptr static GSList *
bezier_insert_in_list (link_ptr list, bezier_insert_in_list (GSList * list,
int x) int x)
{ {
link_ptr orig = list; GSList * orig = list;
link_ptr rest; GSList * rest;
if (!list) if (!list)
return add_to_list (list, (void *) ((long) x)); return g_slist_prepend (list, (void *) ((long) x));
while (list) while (list)
{ {
rest = next_item (list); rest = g_slist_next (list);
if (x < (long) list->data) if (x < (long) list->data)
{ {
rest = add_to_list (rest, list->data); rest = g_slist_prepend (rest, list->data);
list->next = rest; list->next = rest;
list->data = (void *) ((long) x); list->data = (void *) ((long) x);
return orig; return orig;
} }
else if (!rest) else if (!rest)
{ {
append_to_list (list, (void *) ((long) x)); g_slist_append (list, (void *) ((long) x));
return orig; return orig;
} }
list = next_item (list); list = g_slist_next (list);
} }
return orig; return orig;

View File

@ -560,7 +560,7 @@ crop_image (GImage *gimage,
Layer *floating_layer; Layer *floating_layer;
Channel *channel; Channel *channel;
GList *guide_list_ptr; GList *guide_list_ptr;
link_ptr list; GSList *list;
int width, height; int width, height;
int lx1, ly1, lx2, ly2; int lx1, ly1, lx2, ly2;
int off_x, off_y; int off_x, off_y;
@ -592,7 +592,7 @@ crop_image (GImage *gimage,
{ {
channel = (Channel *) list->data; channel = (Channel *) list->data;
channel_resize (channel, width, height, -x1, -y1); channel_resize (channel, width, height, -x1, -y1);
list = next_item (list); list = g_slist_next (list);
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
@ -616,7 +616,7 @@ crop_image (GImage *gimage,
width = lx2 - lx1; width = lx2 - lx1;
height = ly2 - ly1; height = ly2 - ly1;
list = next_item (list); list = g_slist_next (list);
if (width && height) if (width && height)
layer_resize (layer, width, height, layer_resize (layer, width, height,

View File

@ -161,7 +161,7 @@ edit_selection_button_release (Tool *tool,
GDisplay * gdisp; GDisplay * gdisp;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
link_ptr layer_list; GSList *layer_list;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -223,7 +223,7 @@ edit_selection_button_release (Tool *tool,
if (layer == gdisp->gimage->active_layer || if (layer == gdisp->gimage->active_layer ||
layer_linked (layer)) layer_linked (layer))
layer_translate (layer, (x - edit_select.origx), (y - edit_select.origy)); layer_translate (layer, (x - edit_select.origx), (y - edit_select.origy));
layer_list = next_item (layer_list); layer_list = g_slist_next (layer_list);
} }
if (floating_layer) if (floating_layer)
@ -296,7 +296,7 @@ edit_selection_draw (Tool *tool)
GdkSegment * seg; GdkSegment * seg;
Selection * select; Selection * select;
Layer *layer; Layer *layer;
link_ptr layer_list; GSList *layer_list;
int floating_sel; int floating_sel;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int x3, y3, x4, y4; int x3, y3, x4, y4;
@ -404,7 +404,7 @@ edit_selection_draw (Tool *tool)
if (y4 > y2) if (y4 > y2)
y2 = y4; y2 = y4;
} }
layer_list = next_item (layer_list); layer_list = g_slist_next (layer_list);
} }
gdk_draw_rectangle (edit_select.core->win, gdk_draw_rectangle (edit_select.core->win,
@ -485,7 +485,7 @@ edit_sel_arrow_keys_func (Tool *tool,
GDisplay *gdisp; GDisplay *gdisp;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
link_ptr layer_list; GSList *layer_list;
EditType edit_type; EditType edit_type;
layer = NULL; layer = NULL;
@ -547,7 +547,7 @@ edit_sel_arrow_keys_func (Tool *tool,
layer = (Layer *) layer_list->data; layer = (Layer *) layer_list->data;
if (((layer) == gdisp->gimage->active_layer) || layer_linked (layer)) if (((layer) == gdisp->gimage->active_layer) || layer_linked (layer))
layer_translate (layer, inc_x, inc_y); layer_translate (layer, inc_x, inc_y);
layer_list = next_item (layer_list); layer_list = g_slist_next (layer_list);
} }
if (floating_layer) if (floating_layer)

View File

@ -24,7 +24,6 @@
#include "free_select.h" #include "free_select.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "linked.h"
#include "rect_select.h" #include "rect_select.h"
typedef struct _free_select FreeSelect; typedef struct _free_select FreeSelect;
@ -80,38 +79,38 @@ add_point (int num_pts, int x, int y)
/* Routines to scan convert the polygon */ /* Routines to scan convert the polygon */
static link_ptr static GSList *
insert_into_sorted_list (link_ptr list, int x) insert_into_sorted_list (GSList *list, int x)
{ {
link_ptr orig = list; GSList *orig = list;
link_ptr rest; GSList *rest;
if (!list) if (!list)
return add_to_list (list, (gpointer) ((long) x)); return g_slist_prepend (list, (gpointer) ((long) x));
while (list) while (list)
{ {
rest = next_item (list); rest = g_slist_next (list);
if (x < (long) list->data) if (x < (long) list->data)
{ {
rest = add_to_list (rest, list->data); rest = g_slist_prepend (rest, list->data);
list->next = rest; list->next = rest;
list->data = (gpointer) ((long) x); list->data = (gpointer) ((long) x);
return orig; return orig;
} }
else if (!rest) else if (!rest)
{ {
append_to_list (list, (gpointer) ((long) x)); g_slist_append (list, (gpointer) ((long) x));
return orig; return orig;
} }
list = next_item (list); list = g_slist_next (list);
} }
return orig; return orig;
} }
static void static void
convert_segment (link_ptr *scanlines, int width, int height, convert_segment (GSList **scanlines, int width, int height,
int x1, int y1, int x2, int y2) int x1, int y1, int x2, int y2)
{ {
int ydiff, y, tmp; int ydiff, y, tmp;
@ -141,8 +140,8 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
{ {
PixelRegion maskPR; PixelRegion maskPR;
Channel * mask; Channel * mask;
link_ptr * scanlines; GSList **scanlines;
link_ptr list; GSList *list;
unsigned char *buf, *b; unsigned char *buf, *b;
int * vals, val; int * vals, val;
int start, end; int start, end;
@ -166,7 +165,7 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
vals = (int *) g_malloc (sizeof (int) * width); vals = (int *) g_malloc (sizeof (int) * width);
} }
scanlines = (link_ptr *) g_malloc (sizeof (link_ptr) * height); scanlines = (GSList **) g_malloc (sizeof (GSList *) * height);
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
scanlines[i] = NULL; scanlines[i] = NULL;
@ -211,7 +210,7 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
while (list) while (list)
{ {
x = (long) list->data; x = (long) list->data;
list = next_item(list); list = g_slist_next(list);
if (!list) if (!list)
warning ("Cannot properly scanline convert polygon!\n"); warning ("Cannot properly scanline convert polygon!\n");
else else
@ -230,7 +229,7 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
for (j = 0; j < w; j++) for (j = 0; j < w; j++)
vals[j + x] += 255; vals[j + x] += 255;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -252,7 +251,7 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
drawable_width (GIMP_DRAWABLE(mask)), buf); drawable_width (GIMP_DRAWABLE(mask)), buf);
} }
free_list (scanlines[i]); g_slist_free (scanlines[i]);
} }
if (antialias) if (antialias)

View File

@ -560,7 +560,7 @@ crop_image (GImage *gimage,
Layer *floating_layer; Layer *floating_layer;
Channel *channel; Channel *channel;
GList *guide_list_ptr; GList *guide_list_ptr;
link_ptr list; GSList *list;
int width, height; int width, height;
int lx1, ly1, lx2, ly2; int lx1, ly1, lx2, ly2;
int off_x, off_y; int off_x, off_y;
@ -592,7 +592,7 @@ crop_image (GImage *gimage,
{ {
channel = (Channel *) list->data; channel = (Channel *) list->data;
channel_resize (channel, width, height, -x1, -y1); channel_resize (channel, width, height, -x1, -y1);
list = next_item (list); list = g_slist_next (list);
} }
/* Don't forget the selection mask! */ /* Don't forget the selection mask! */
@ -616,7 +616,7 @@ crop_image (GImage *gimage,
width = lx2 - lx1; width = lx2 - lx1;
height = ly2 - ly1; height = ly2 - ly1;
list = next_item (list); list = g_slist_next (list);
if (width && height) if (width && height)
layer_resize (layer, width, height, layer_resize (layer, width, height,

View File

@ -161,7 +161,7 @@ edit_selection_button_release (Tool *tool,
GDisplay * gdisp; GDisplay * gdisp;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
link_ptr layer_list; GSList *layer_list;
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
@ -223,7 +223,7 @@ edit_selection_button_release (Tool *tool,
if (layer == gdisp->gimage->active_layer || if (layer == gdisp->gimage->active_layer ||
layer_linked (layer)) layer_linked (layer))
layer_translate (layer, (x - edit_select.origx), (y - edit_select.origy)); layer_translate (layer, (x - edit_select.origx), (y - edit_select.origy));
layer_list = next_item (layer_list); layer_list = g_slist_next (layer_list);
} }
if (floating_layer) if (floating_layer)
@ -296,7 +296,7 @@ edit_selection_draw (Tool *tool)
GdkSegment * seg; GdkSegment * seg;
Selection * select; Selection * select;
Layer *layer; Layer *layer;
link_ptr layer_list; GSList *layer_list;
int floating_sel; int floating_sel;
int x1, y1, x2, y2; int x1, y1, x2, y2;
int x3, y3, x4, y4; int x3, y3, x4, y4;
@ -404,7 +404,7 @@ edit_selection_draw (Tool *tool)
if (y4 > y2) if (y4 > y2)
y2 = y4; y2 = y4;
} }
layer_list = next_item (layer_list); layer_list = g_slist_next (layer_list);
} }
gdk_draw_rectangle (edit_select.core->win, gdk_draw_rectangle (edit_select.core->win,
@ -485,7 +485,7 @@ edit_sel_arrow_keys_func (Tool *tool,
GDisplay *gdisp; GDisplay *gdisp;
Layer *layer; Layer *layer;
Layer *floating_layer; Layer *floating_layer;
link_ptr layer_list; GSList *layer_list;
EditType edit_type; EditType edit_type;
layer = NULL; layer = NULL;
@ -547,7 +547,7 @@ edit_sel_arrow_keys_func (Tool *tool,
layer = (Layer *) layer_list->data; layer = (Layer *) layer_list->data;
if (((layer) == gdisp->gimage->active_layer) || layer_linked (layer)) if (((layer) == gdisp->gimage->active_layer) || layer_linked (layer))
layer_translate (layer, inc_x, inc_y); layer_translate (layer, inc_x, inc_y);
layer_list = next_item (layer_list); layer_list = g_slist_next (layer_list);
} }
if (floating_layer) if (floating_layer)

View File

@ -24,7 +24,6 @@
#include "free_select.h" #include "free_select.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "linked.h"
#include "rect_select.h" #include "rect_select.h"
typedef struct _free_select FreeSelect; typedef struct _free_select FreeSelect;
@ -80,38 +79,38 @@ add_point (int num_pts, int x, int y)
/* Routines to scan convert the polygon */ /* Routines to scan convert the polygon */
static link_ptr static GSList *
insert_into_sorted_list (link_ptr list, int x) insert_into_sorted_list (GSList *list, int x)
{ {
link_ptr orig = list; GSList *orig = list;
link_ptr rest; GSList *rest;
if (!list) if (!list)
return add_to_list (list, (gpointer) ((long) x)); return g_slist_prepend (list, (gpointer) ((long) x));
while (list) while (list)
{ {
rest = next_item (list); rest = g_slist_next (list);
if (x < (long) list->data) if (x < (long) list->data)
{ {
rest = add_to_list (rest, list->data); rest = g_slist_prepend (rest, list->data);
list->next = rest; list->next = rest;
list->data = (gpointer) ((long) x); list->data = (gpointer) ((long) x);
return orig; return orig;
} }
else if (!rest) else if (!rest)
{ {
append_to_list (list, (gpointer) ((long) x)); g_slist_append (list, (gpointer) ((long) x));
return orig; return orig;
} }
list = next_item (list); list = g_slist_next (list);
} }
return orig; return orig;
} }
static void static void
convert_segment (link_ptr *scanlines, int width, int height, convert_segment (GSList **scanlines, int width, int height,
int x1, int y1, int x2, int y2) int x1, int y1, int x2, int y2)
{ {
int ydiff, y, tmp; int ydiff, y, tmp;
@ -141,8 +140,8 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
{ {
PixelRegion maskPR; PixelRegion maskPR;
Channel * mask; Channel * mask;
link_ptr * scanlines; GSList **scanlines;
link_ptr list; GSList *list;
unsigned char *buf, *b; unsigned char *buf, *b;
int * vals, val; int * vals, val;
int start, end; int start, end;
@ -166,7 +165,7 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
vals = (int *) g_malloc (sizeof (int) * width); vals = (int *) g_malloc (sizeof (int) * width);
} }
scanlines = (link_ptr *) g_malloc (sizeof (link_ptr) * height); scanlines = (GSList **) g_malloc (sizeof (GSList *) * height);
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
scanlines[i] = NULL; scanlines[i] = NULL;
@ -211,7 +210,7 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
while (list) while (list)
{ {
x = (long) list->data; x = (long) list->data;
list = next_item(list); list = g_slist_next(list);
if (!list) if (!list)
warning ("Cannot properly scanline convert polygon!\n"); warning ("Cannot properly scanline convert polygon!\n");
else else
@ -230,7 +229,7 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
for (j = 0; j < w; j++) for (j = 0; j < w; j++)
vals[j + x] += 255; vals[j + x] += 255;
} }
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -252,7 +251,7 @@ scan_convert (int gimage_ID, int num_pts, FreeSelectPoint *pts,
drawable_width (GIMP_DRAWABLE(mask)), buf); drawable_width (GIMP_DRAWABLE(mask)), buf);
} }
free_list (scanlines[i]); g_slist_free (scanlines[i]);
} }
if (antialias) if (antialias)

View File

@ -26,6 +26,8 @@
#include "appenv.h" #include "appenv.h"
#include "bezier_selectP.h" #include "bezier_selectP.h"
#include "draw_core.h" #include "draw_core.h"
#include "channel_pvt.h"
#include "drawable.h"
#include "errors.h" #include "errors.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gimage_mask.h" #include "gimage_mask.h"
@ -229,8 +231,8 @@ static void make_curve_d (int *, int *, double, int);
/* Catmull-Rom boundary conversion */ /* Catmull-Rom boundary conversion */
static void CR_convert (Iscissors * , GDisplay *, int); static void CR_convert (Iscissors * , GDisplay *, int);
static void CR_convert_points (GdkPoint *, int); static void CR_convert_points (GdkPoint *, int);
static void CR_convert_line (link_ptr *, int, int, int, int); static void CR_convert_line (GSList **, int, int, int, int);
static link_ptr CR_insert_in_list (link_ptr, int); static GSList * CR_insert_in_list (GSList *, int);
/*******************************************************/ /*******************************************************/
@ -441,12 +443,12 @@ iscissors_button_press (Tool *tool,
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
iscissors = (Iscissors *) tool->private; iscissors = (Iscissors *) tool->private;
message_box ("Intelligent Scissors is currently not enabled\nfor use with the tile-based GIMP", /* message_box ("Intelligent Scissors is currently not enabled\nfor use with the tile-based GIMP",
NULL, NULL); NULL, NULL);
return; return;*/
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, gdisplay_untransform_coords (gdisp, bevent->x, bevent->y,
&iscissors->x, &iscissors->y, FALSE, 1); &iscissors->x, &iscissors->y, FALSE, TRUE);
/* If the tool was being used in another image...reset it */ /* If the tool was being used in another image...reset it */
if (tool->state == ACTIVE && gdisp_ptr != tool->gdisp_ptr) if (tool->state == ACTIVE && gdisp_ptr != tool->gdisp_ptr)
@ -484,11 +486,11 @@ iscissors_button_press (Tool *tool,
} }
/* If the edge map blocks haven't been allocated, do so now */ /* If the edge map blocks haven't been allocated, do so now */
/*FIX if (!edge_map_blocks) if (!edge_map_blocks)
allocate_edge_map_blocks (BLOCK_WIDTH, BLOCK_HEIGHT, allocate_edge_map_blocks (BLOCK_WIDTH, BLOCK_HEIGHT,
gimage_width (gdisp->gimage), gdisp->gimage->width,
gimage_height (gdisp->gimage)); gdisp->gimage->height);
*/
iscissors->num_segs = 0; iscissors->num_segs = 0;
add_segment (&(iscissors->num_segs), bevent->x, bevent->y); add_segment (&(iscissors->num_segs), bevent->x, bevent->y);
@ -497,7 +499,7 @@ iscissors_button_press (Tool *tool,
tool); tool);
break; break;
case BOUNDARY_MODE: case BOUNDARY_MODE:
if (channel_value (iscissors->mask, iscissors->x, iscissors->y)) if (/*channel_value (iscissors->mask, iscissors->x, iscissors->y)*/ TRUE)
{ {
replace = 0; replace = 0;
if (bevent->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) if (bevent->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK))
@ -560,7 +562,7 @@ iscissors_button_release (Tool *tool,
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
iscissors = (Iscissors *) tool->private; iscissors = (Iscissors *) tool->private;
return; /*return;*/
gdk_pointer_ungrab (bevent->time); gdk_pointer_ungrab (bevent->time);
gdk_flush (); gdk_flush ();
@ -696,7 +698,7 @@ iscissors_draw_CR (GDisplay *gdisp,
break; break;
case SCREEN_COORDS: case SCREEN_COORDS:
gdisplay_transform_coords_f (gdisp, (int) pts[indices[i]].dx, gdisplay_transform_coords_f (gdisp, (int) pts[indices[i]].dx,
(int) pts[indices[i]].dy, &x, &y, FALSE); (int) pts[indices[i]].dy, &x, &y, TRUE);
geometry[i][0] = x; geometry[i][0] = x;
geometry[i][1] = y; geometry[i][1] = y;
break; break;
@ -987,6 +989,7 @@ get_kink (Kink *kinks,
return kinks + index; return kinks + index;
} }
/* I don't think this ever gets called -- Rockwalrus */
return NULL; return NULL;
} }
@ -1311,9 +1314,9 @@ process_kinks (Tool *tool)
{ {
/* transform from screen to image coordinates */ /* transform from screen to image coordinates */
gdisplay_untransform_coords (gdisp, kinks[i].x, kinks[i].y, gdisplay_untransform_coords (gdisp, kinks[i].x, kinks[i].y,
&x, &y, FALSE, FALSE); &x, &y, FALSE, TRUE);
/*FIXkinks[i].x = BOUNDS (x, 0, (gimage_width (gdisp->gimage) - 1)); kinks[i].x = BOUNDS (x, 0, (gdisp->gimage->width - 1));
kinks[i].y = BOUNDS (y, 0, (gimage_height (gdisp->gimage) - 1));*/ kinks[i].y = BOUNDS (y, 0, (gdisp->gimage->height - 1));
/* get local maximums */ /* get local maximums */
k_left = get_kink (kinks, i-1, iscissors->num_kinks); k_left = get_kink (kinks, i-1, iscissors->num_kinks);
@ -1398,21 +1401,21 @@ edge_map_from_boundary (Tool *tool)
x = y = w = h = x1 = y1 = x2 = y2 = 0; x = y = w = h = x1 = y1 = x2 = y2 = 0;
/*FIXx1 = gimage_width (gdisp->gimage); x1 = gdisp->gimage->width;
y1 = gimage_height (gdisp->gimage);*/ y1 = gdisp->gimage->height;
/* Find the edge map extents */ /* Find the edge map extents */
for (i = 0; i < iscissors->num_pts; i++) for (i = 0; i < iscissors->num_pts; i++)
{ {
/*FIX x = BOUNDS (pts[i].x - LOCALIZE_RADIUS, 0, x = BOUNDS (pts[i].x - LOCALIZE_RADIUS, 0,
gimage_width (gdisp->gimage)); gdisp->gimage->width);
y = BOUNDS (pts[i].y - LOCALIZE_RADIUS, 0, y = BOUNDS (pts[i].y - LOCALIZE_RADIUS, 0,
gimage_height (gdisp->gimage)); gdisp->gimage->height);
w = BOUNDS (pts[i].x + LOCALIZE_RADIUS, 0, w = BOUNDS (pts[i].x + LOCALIZE_RADIUS, 0,
gimage_width (gdisp->gimage)); gdisp->gimage->width);
h = BOUNDS (pts[i].y + LOCALIZE_RADIUS, 0, h = BOUNDS (pts[i].y + LOCALIZE_RADIUS, 0,
gimage_height (gdisp->gimage)); gdisp->gimage->height);
*/
w -= x; w -= x;
h -= y; h -= y;
@ -1444,7 +1447,7 @@ orient_boundary (Tool *tool)
double edge1[EDGE_WIDTH], edge2[EDGE_WIDTH]; double edge1[EDGE_WIDTH], edge2[EDGE_WIDTH];
double max; double max;
double angle; double angle;
int dir; int dir = 0;
int i, j; int i, j;
int max_dir; int max_dir;
int max_orient; int max_orient;
@ -1746,7 +1749,13 @@ calculate_edge_map (GImage *gimage,
int xx, yy; int xx, yy;
unsigned char *gr, * dh, * dv, * cm; unsigned char *gr, * dh, * dv, * cm;
int hmax, vmax; int hmax, vmax;
int b;
double prev, next; double prev, next;
GimpDrawable *drawable;
void *pr;
FILE *dump;
drawable = gimage_active_drawable (gimage);
x1 = y1 = x2 = y2 = 0; x1 = y1 = x2 = y2 = 0;
@ -1754,31 +1763,38 @@ calculate_edge_map (GImage *gimage,
edge_map = temp_buf_new (w, h, EDGE_WIDTH, x, y, NULL); edge_map = temp_buf_new (w, h, EDGE_WIDTH, x, y, NULL);
/* calculate the extent of the search make a 1 pixel border */ /* calculate the extent of the search make a 1 pixel border */
/*FIXx1 = BOUNDS (x, 0, gimage_width (gimage)); x1 = BOUNDS (x, 0, gimage->width);
y1 = BOUNDS (y, 0, gimage_height (gimage)); y1 = BOUNDS (y, 0, gimage->height);
x2 = BOUNDS (x + w, 0, gimage_width (gimage)); x2 = BOUNDS (x + w, 0, gimage->width);
y2 = BOUNDS (y + h, 0, gimage_height (gimage));*/ y2 = BOUNDS (y + h, 0, gimage->height);
width = x2 - x1; width = x2 - x1;
height = y2 - y1; height = y2 - y1;
offx = (x - x1); offx = (x - x1);
offy = (y - y1); offy = (y - y1);
/* Set the gimage up as the source pixel region */ /* Set the drawable up as the source pixel region */
/* FIX srcPR.bytes = gimage_bytes (gimage);*/ /*srcPR.bytes = drawable_bytes (drawable);
srcPR.w = width; srcPR.w = width;
srcPR.h = height; srcPR.h = height;
/* FIX srcPR.rowstride = gimage_width (gimage) * gimage_bytes (gimage);*/ srcPR.rowstride = gimage->width * drawable_bytes (drawable);
/*FIXsrcPR.data = gimage_data (gimage) + y1 * srcPR.rowstride + x1 * srcPR.bytes;*/ srcPR.data = drawable_data (drawable) + y1 * srcPR.rowstride + x1 * srcPR.bytes;*/
pixel_region_init(&srcPR, drawable_data(drawable), x1, y1, width, height, 1);
/* Get the horizontal derivative */ /* Get the horizontal derivative */
destPR.data = conv1 + MAX_CHANNELS * (CONV_WIDTH * offy + offx); destPR.data = conv1 + MAX_CHANNELS * (CONV_WIDTH * offy + offx);
destPR.rowstride = CONV_WIDTH * MAX_CHANNELS; destPR.rowstride = CONV_WIDTH * MAX_CHANNELS;
gaussian_deriv (&srcPR, &destPR, HORIZONTAL, std_dev); destPR.tiles = NULL;
for (pr =pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr))
gaussian_deriv (&srcPR, &destPR, HORIZONTAL, std_dev);
/* Get the vertical derivative */ /* Get the vertical derivative */
destPR.data = conv2 + MAX_CHANNELS * (CONV_WIDTH * offy + offx); destPR.data = conv2 + MAX_CHANNELS * (CONV_WIDTH * offy + offx);
gaussian_deriv (&srcPR, &destPR, VERTICAL, std_dev);
for (pr =pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr))
gaussian_deriv (&srcPR, &destPR, VERTICAL, std_dev);
/* fill in the edge map */ /* fill in the edge map */
@ -1792,11 +1808,13 @@ calculate_edge_map (GImage *gimage,
{ {
hmax = dh[0] - 128; hmax = dh[0] - 128;
vmax = dv[0] - 128; vmax = dv[0] - 128;
/*FIX for (b = 1; b < gimage_bytes (gimage); b++) for (b = 1; b < drawable_bytes (drawable); b++)
{ {
if (abs (dh[b] - 128) > abs (hmax)) hmax = dh[b] - 128; if (abs (dh[b] - 128) > abs (hmax))
if (abs (dv[b] - 128) > abs (vmax)) vmax = dv[b] - 128; hmax = dh[b] - 128;
}*/ if (abs (dv[b] - 128) > abs (vmax))
vmax = dv[b] - 128;
}
/* store the information in the edge map */ /* store the information in the edge map */
dh[0] = hmax + 128; dh[0] = hmax + 128;
@ -1819,7 +1837,7 @@ calculate_edge_map (GImage *gimage,
} }
/* Make the edge gradient map extend one row further */ /* Make the edge gradient map extend one row further */
memcpy (grad, grad + (CONV_WIDTH+2), (CONV_WIDTH+2)); memcpy (grad, grad + (CONV_WIDTH+2), (CONV_WIDTH+2));
memcpy (grad + (CONV_WIDTH+2) * (CONV_HEIGHT+1), memcpy (grad + (CONV_WIDTH+2) * (CONV_HEIGHT+1),
grad + (CONV_WIDTH+2) * (CONV_HEIGHT), grad + (CONV_WIDTH+2) * (CONV_HEIGHT),
(CONV_WIDTH+2)); (CONV_WIDTH+2));
@ -1851,16 +1869,20 @@ calculate_edge_map (GImage *gimage,
else else
*cm++ = 0; *cm++ = 0;
/*
*cm++ = dh[0]; /*cm++ = dh[0];*/
*cm++ = dv[0]; /*cm++ = dv[0];*/
*/
dh += srcPR.bytes; dh += srcPR.bytes;
dv += srcPR.bytes; dv += srcPR.bytes;
gr ++; gr ++;
} }
} }
/* dump=fopen("/ugrad/summersn/dump", "w"); */
/* fprintf(dump, "P5\n%d %d\n255\n", edge_map->width, edge_map->height); */
/* fwrite(edge_map->data, edge_map->width * edge_map->height, sizeof (guchar), dump); */
/* fclose (dump); */
return edge_map; return edge_map;
} }
@ -1877,10 +1899,17 @@ construct_edge_map (Tool *tool,
int offx, offy; int offx, offy;
int x2, y2; int x2, y2;
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
FILE *dump;
/* init some variables */ /* init some variables */
srcPR.bytes = edge_buf->bytes; srcPR.bytes = edge_buf->bytes;
destPR.rowstride = edge_buf->bytes * edge_buf->width; destPR.rowstride = edge_buf->bytes * edge_buf->width;
destPR.x = edge_buf->x;
destPR.y = edge_buf->y;
destPR.h = edge_buf->height;
destPR.w = edge_buf -> width;
destPR.bytes = edge_buf->bytes;
srcPR.tiles = destPR.tiles = NULL;
y = edge_buf->y; y = edge_buf->y;
endx = edge_buf->x + edge_buf->width; endx = edge_buf->x + edge_buf->width;
@ -1906,7 +1935,7 @@ construct_edge_map (Tool *tool,
/* If the block exists, patch it into buf */ /* If the block exists, patch it into buf */
if (block) if (block)
{ {
/* calculate x offset into the block */ /* calculate x offset into the block */
offx = (x - col * BLOCK_WIDTH); offx = (x - col * BLOCK_WIDTH);
x2 = (col + 1) * BLOCK_WIDTH; x2 = (col + 1) * BLOCK_WIDTH;
if (x2 > endx) x2 = endx; if (x2 > endx) x2 = endx;
@ -1929,8 +1958,12 @@ construct_edge_map (Tool *tool,
y = row * BLOCK_HEIGHT; y = row * BLOCK_HEIGHT;
} }
/* show the edge buffer */ /* dump the edge buffer for debugging*/
/* temp_buf_to_gdisplay (edge_buf);*/
/* dump=fopen("/ugrad/summersn/dump", "w");
fprintf(dump, "P5\n%d %d\n255\n", edge_buf->width, edge_buf->height);
fwrite(edge_buf->data, edge_buf->width * edge_buf->height, sizeof (guchar), dump);
fclose (dump); */
} }
@ -1955,8 +1988,8 @@ set_edge_map_blocks (void *gimage_ptr,
width = height = 0; width = height = 0;
gimage = (GImage *) gimage_ptr; gimage = (GImage *) gimage_ptr;
/*FIXwidth = gimage_width (gimage);*/ width = gimage->width;
/*FIXheight = gimage_height (gimage);*/ height = gimage->height;
startx = x; startx = x;
endx = x + w; endx = x + w;
@ -2327,7 +2360,7 @@ make_curve_d (int *curve,
/* Functions for Catmull-Rom area conversion */ /* Functions for Catmull-Rom area conversion */
/***********************************************/ /***********************************************/
static link_ptr * CR_scanlines; static GSList **CR_scanlines;
static int start_convert; static int start_convert;
static int width, height; static int width, height;
static int lastx; static int lastx;
@ -2339,12 +2372,13 @@ CR_convert (Iscissors *iscissors,
int antialias) int antialias)
{ {
int indices[4]; int indices[4];
link_ptr list; GSList *list;
unsigned char *dest;
int draw_type; int draw_type;
int * vals, val; int * vals, val;
int x, w; int x, w;
int i, j; int i, j;
PixelRegion maskPR;
unsigned char *buf, *b;
vals = NULL; vals = NULL;
@ -2363,12 +2397,15 @@ CR_convert (Iscissors *iscissors,
draw_type = AA_IMAGE_COORDS; draw_type = AA_IMAGE_COORDS;
/* allocate value array */ /* allocate value array */
vals = (int *) g_malloc (sizeof (int) * width); vals = (int *) g_malloc (sizeof (int) * width);
buf = (unsigned char *) g_malloc (sizeof(unsigned char *) * width);
} }
else else
{ {
width = gdisp->gimage->width; width = gdisp->gimage->width;
height = gdisp->gimage->height; height = gdisp->gimage->height;
draw_type = IMAGE_COORDS; draw_type = IMAGE_COORDS;
buf = NULL;
vals = NULL;
} }
/* create a new mask */ /* create a new mask */
@ -2376,7 +2413,7 @@ CR_convert (Iscissors *iscissors,
gdisp->gimage->height); gdisp->gimage->height);
/* allocate room for the scanlines */ /* allocate room for the scanlines */
CR_scanlines = g_malloc (sizeof (link_ptr) * height); CR_scanlines = g_malloc (sizeof (GSList *) * height);
/* zero out the scanlines */ /* zero out the scanlines */
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
@ -2394,7 +2431,9 @@ CR_convert (Iscissors *iscissors,
iscissors_draw_CR (gdisp, iscissors, pts, indices, draw_type); iscissors_draw_CR (gdisp, iscissors, pts, indices, draw_type);
} }
dest = channel_data (iscissors->mask); pixel_region_init (&maskPR, iscissors->mask->drawable.tiles, 0, 0,
iscissors->mask->drawable.width,
iscissors->mask->drawable.height, TRUE);
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
{ {
@ -2418,21 +2457,25 @@ CR_convert (Iscissors *iscissors,
for (j = 0; j < w; j++) for (j = 0; j < w; j++)
vals[j + x] += 255; vals[j + x] += 255;
list = next_item (list); list = g_slist_next (list);
} }
} }
if (antialias && !((i+1) % SUPERSAMPLE)) if (antialias && !((i+1) % SUPERSAMPLE))
for (j = 0; j < width; j += SUPERSAMPLE) {
{ b = buf;
val = 0; for (j = 0; j < width; j += SUPERSAMPLE)
for (x = 0; x < SUPERSAMPLE; x++) {
val += vals[j + x]; val = 0;
for (x = 0; x < SUPERSAMPLE; x++)
val += vals[j + x];
*dest++ = val / SUPERSAMPLE2; *b++ = (unsigned char) (val / SUPERSAMPLE2);
} }
pixel_region_set_row (&maskPR, 0, (i / SUPERSAMPLE), iscissors->mask->drawable.width, buf);
}
free_list (CR_scanlines[i]); g_slist_free (CR_scanlines[i]);
} }
if (antialias) if (antialias)
@ -2465,11 +2508,11 @@ CR_convert_points (GdkPoint *points,
} }
static void static void
CR_convert_line (link_ptr *scanlines, CR_convert_line (GSList **scanlines,
int x1, int x1,
int y1, int y1,
int x2, int x2,
int y2) int y2)
{ {
int dx, dy; int dx, dy;
int error, inc; int error, inc;
@ -2581,32 +2624,32 @@ CR_convert_line (link_ptr *scanlines,
} }
} }
static link_ptr static GSList *
CR_insert_in_list (link_ptr list, CR_insert_in_list (GSList *list,
int x) int x)
{ {
link_ptr orig = list; GSList *orig = list;
link_ptr rest; GSList *rest;
if (!list) if (!list)
return add_to_list (list, (gpointer) ((long) x)); return g_slist_prepend (list, (gpointer) ((long) x));
while (list) while (list)
{ {
rest = next_item (list); rest = g_slist_next (list);
if (x < (long) list->data) if (x < (long) list->data)
{ {
rest = add_to_list (rest, list->data); rest = g_slist_prepend (rest, list->data);
list->next = rest; list->next = rest;
list->data = (gpointer) ((long) x); list->data = (gpointer) ((long) x);
return orig; return orig;
} }
else if (!rest) else if (!rest)
{ {
append_to_list (list, (gpointer) ((long) x)); g_slist_append (list, (gpointer) ((long) x));
return orig; return orig;
} }
list = next_item (list); list = g_slist_next (list);
} }
return orig; return orig;

View File

@ -24,7 +24,6 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gdisplay_ops.h" #include "gdisplay_ops.h"
#include "linked.h"
#include "move.h" #include "move.h"
#include "undo.h" #include "undo.h"

View File

@ -100,7 +100,7 @@ struct _FontInfo
int *spacings; /* An array of valid spacings */ int *spacings; /* An array of valid spacings */
int **combos; /* An array of valid combinations of the above 5 items */ int **combos; /* An array of valid combinations of the above 5 items */
int ncombos; /* The number of elements in the "combos" array */ int ncombos; /* The number of elements in the "combos" array */
link_ptr fontnames; /* An list of valid fontnames. GSList *fontnames; /* An list of valid fontnames.
* This is used to make sure a family/foundry/weight/slant/set_width * This is used to make sure a family/foundry/weight/slant/set_width
* combination is valid. * combination is valid.
*/ */
@ -131,7 +131,7 @@ static void text_validate_combo (TextTool *, int);
static void text_get_fonts (void); static void text_get_fonts (void);
static void text_insert_font (FontInfo **, int *, char *); static void text_insert_font (FontInfo **, int *, char *);
static link_ptr text_insert_field (link_ptr, char *, int); static GSList* text_insert_field (GSList *, char *, int);
static char* text_get_field (char *, int); static char* text_get_field (char *, int);
static int text_field_to_index (char **, int, char *); static int text_field_to_index (char **, int, char *);
static int text_is_xlfd_font_name (char *); static int text_is_xlfd_font_name (char *);
@ -144,6 +144,8 @@ static void text_gdk_image_to_region (GdkImage *, int, PixelRegion *);
static int text_get_extents (char *, char *, int *, int *, int *, int *); static int text_get_extents (char *, char *, int *, int *, int *, int *);
static Layer * text_render (GImage *, GimpDrawable *, int, int, char *, char *, int, int); static Layer * text_render (GImage *, GimpDrawable *, int, int, char *, char *, int, int);
static int font_compare_func (gpointer, gpointer);
static Argument * text_tool_invoker (Argument *); static Argument * text_tool_invoker (Argument *);
static Argument * text_tool_get_extents_invoker (Argument *); static Argument * text_tool_get_extents_invoker (Argument *);
@ -164,11 +166,11 @@ static TextTool *the_text_tool = NULL;
static FontInfo **font_info; static FontInfo **font_info;
static int nfonts = -1; static int nfonts = -1;
static link_ptr foundries = NULL; static GSList *foundries = NULL;
static link_ptr weights = NULL; static GSList *weights = NULL;
static link_ptr slants = NULL; static GSList *slants = NULL;
static link_ptr set_widths = NULL; static GSList *set_widths = NULL;
static link_ptr spacings = NULL; static GSList *spacings = NULL;
static char **foundry_array = NULL; static char **foundry_array = NULL;
static char **weight_array = NULL; static char **weight_array = NULL;
@ -970,7 +972,7 @@ text_get_fonts ()
char **fontnames; char **fontnames;
char *fontname; char *fontname;
char *field; char *field;
link_ptr temp_list; GSList *temp_list;
int num_fonts; int num_fonts;
int index; int index;
int i, j; int i, j;
@ -998,11 +1000,11 @@ text_get_fonts ()
XFreeFontNames (fontnames); XFreeFontNames (fontnames);
nfoundries = list_length (foundries) + 1; nfoundries = g_slist_length (foundries) + 1;
nweights = list_length (weights) + 1; nweights = g_slist_length (weights) + 1;
nslants = list_length (slants) + 1; nslants = g_slist_length (slants) + 1;
nset_widths = list_length (set_widths) + 1; nset_widths = g_slist_length (set_widths) + 1;
nspacings = list_length (spacings) + 1; nspacings = g_slist_length (spacings) + 1;
foundry_array = g_malloc (sizeof (char*) * nfoundries); foundry_array = g_malloc (sizeof (char*) * nfoundries);
weight_array = g_malloc (sizeof (char*) * nweights); weight_array = g_malloc (sizeof (char*) * nweights);
@ -1063,7 +1065,7 @@ text_get_fonts ()
font_info[i]->slants = g_malloc (sizeof (int) * nslants); font_info[i]->slants = g_malloc (sizeof (int) * nslants);
font_info[i]->set_widths = g_malloc (sizeof (int) * nset_widths); font_info[i]->set_widths = g_malloc (sizeof (int) * nset_widths);
font_info[i]->spacings = g_malloc (sizeof (int) * nspacings); font_info[i]->spacings = g_malloc (sizeof (int) * nspacings);
font_info[i]->ncombos = list_length (font_info[i]->fontnames); font_info[i]->ncombos = g_slist_length (font_info[i]->fontnames);
font_info[i]->combos = g_malloc (sizeof (int*) * font_info[i]->ncombos); font_info[i]->combos = g_malloc (sizeof (int*) * font_info[i]->ncombos);
for (j = 0; j < nfoundries; j++) for (j = 0; j < nfoundries; j++)
@ -1156,7 +1158,7 @@ text_insert_font (FontInfo **table,
cmp = strcmp (family, table[middle]->family); cmp = strcmp (family, table[middle]->family);
if (cmp == 0) if (cmp == 0)
{ {
table[middle]->fontnames = add_to_list (table[middle]->fontnames, g_strdup (fontname)); table[middle]->fontnames = g_slist_prepend (table[middle]->fontnames, g_strdup (fontname));
return; return;
} }
else if (cmp < 0) else if (cmp < 0)
@ -1174,7 +1176,7 @@ text_insert_font (FontInfo **table,
table[*ntable]->slants = NULL; table[*ntable]->slants = NULL;
table[*ntable]->set_widths = NULL; table[*ntable]->set_widths = NULL;
table[*ntable]->fontnames = NULL; table[*ntable]->fontnames = NULL;
table[*ntable]->fontnames = add_to_list (table[*ntable]->fontnames, g_strdup (fontname)); table[*ntable]->fontnames = g_slist_prepend (table[*ntable]->fontnames, g_strdup (fontname));
(*ntable)++; (*ntable)++;
/* Quickly insert the entry into the table in sorted order /* Quickly insert the entry into the table in sorted order
@ -1198,62 +1200,24 @@ text_insert_font (FontInfo **table,
} }
} }
static link_ptr static int
text_insert_field (link_ptr list, font_compare_func (gpointer a, gpointer b)
char *fontname, {
int field_num) return strcmp (a, b);
}
static GSList *
text_insert_field (GSList *list,
char *fontname,
int field_num)
{ {
link_ptr temp_list;
link_ptr prev_list;
link_ptr new_list;
char *field; char *field;
int cmp;
field = text_get_field (fontname, field_num); field = text_get_field (fontname, field_num);
if (!field) if (!field)
return list; return list;
temp_list = list; return g_slist_insert_sorted (list, field, font_compare_func);
prev_list = NULL;
while (temp_list)
{
cmp = strcmp (field, temp_list->data);
if (cmp == 0)
{
free (field);
return list;
}
else if (cmp < 0)
{
new_list = alloc_list ();
new_list->data = field;
new_list->next = temp_list;
if (prev_list)
{
prev_list->next = new_list;
return list;
}
else
return new_list;
}
else
{
prev_list = temp_list;
temp_list = temp_list->next;
}
}
new_list = alloc_list ();
new_list->data = field;
new_list->next = NULL;
if (prev_list)
{
prev_list->next = new_list;
return list;
}
else
return new_list;
} }
static char* static char*

View File

@ -26,6 +26,8 @@
#include "appenv.h" #include "appenv.h"
#include "bezier_selectP.h" #include "bezier_selectP.h"
#include "draw_core.h" #include "draw_core.h"
#include "channel_pvt.h"
#include "drawable.h"
#include "errors.h" #include "errors.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gimage_mask.h" #include "gimage_mask.h"
@ -229,8 +231,8 @@ static void make_curve_d (int *, int *, double, int);
/* Catmull-Rom boundary conversion */ /* Catmull-Rom boundary conversion */
static void CR_convert (Iscissors * , GDisplay *, int); static void CR_convert (Iscissors * , GDisplay *, int);
static void CR_convert_points (GdkPoint *, int); static void CR_convert_points (GdkPoint *, int);
static void CR_convert_line (link_ptr *, int, int, int, int); static void CR_convert_line (GSList **, int, int, int, int);
static link_ptr CR_insert_in_list (link_ptr, int); static GSList * CR_insert_in_list (GSList *, int);
/*******************************************************/ /*******************************************************/
@ -441,12 +443,12 @@ iscissors_button_press (Tool *tool,
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
iscissors = (Iscissors *) tool->private; iscissors = (Iscissors *) tool->private;
message_box ("Intelligent Scissors is currently not enabled\nfor use with the tile-based GIMP", /* message_box ("Intelligent Scissors is currently not enabled\nfor use with the tile-based GIMP",
NULL, NULL); NULL, NULL);
return; return;*/
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, gdisplay_untransform_coords (gdisp, bevent->x, bevent->y,
&iscissors->x, &iscissors->y, FALSE, 1); &iscissors->x, &iscissors->y, FALSE, TRUE);
/* If the tool was being used in another image...reset it */ /* If the tool was being used in another image...reset it */
if (tool->state == ACTIVE && gdisp_ptr != tool->gdisp_ptr) if (tool->state == ACTIVE && gdisp_ptr != tool->gdisp_ptr)
@ -484,11 +486,11 @@ iscissors_button_press (Tool *tool,
} }
/* If the edge map blocks haven't been allocated, do so now */ /* If the edge map blocks haven't been allocated, do so now */
/*FIX if (!edge_map_blocks) if (!edge_map_blocks)
allocate_edge_map_blocks (BLOCK_WIDTH, BLOCK_HEIGHT, allocate_edge_map_blocks (BLOCK_WIDTH, BLOCK_HEIGHT,
gimage_width (gdisp->gimage), gdisp->gimage->width,
gimage_height (gdisp->gimage)); gdisp->gimage->height);
*/
iscissors->num_segs = 0; iscissors->num_segs = 0;
add_segment (&(iscissors->num_segs), bevent->x, bevent->y); add_segment (&(iscissors->num_segs), bevent->x, bevent->y);
@ -497,7 +499,7 @@ iscissors_button_press (Tool *tool,
tool); tool);
break; break;
case BOUNDARY_MODE: case BOUNDARY_MODE:
if (channel_value (iscissors->mask, iscissors->x, iscissors->y)) if (/*channel_value (iscissors->mask, iscissors->x, iscissors->y)*/ TRUE)
{ {
replace = 0; replace = 0;
if (bevent->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) if (bevent->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK))
@ -560,7 +562,7 @@ iscissors_button_release (Tool *tool,
gdisp = (GDisplay *) gdisp_ptr; gdisp = (GDisplay *) gdisp_ptr;
iscissors = (Iscissors *) tool->private; iscissors = (Iscissors *) tool->private;
return; /*return;*/
gdk_pointer_ungrab (bevent->time); gdk_pointer_ungrab (bevent->time);
gdk_flush (); gdk_flush ();
@ -696,7 +698,7 @@ iscissors_draw_CR (GDisplay *gdisp,
break; break;
case SCREEN_COORDS: case SCREEN_COORDS:
gdisplay_transform_coords_f (gdisp, (int) pts[indices[i]].dx, gdisplay_transform_coords_f (gdisp, (int) pts[indices[i]].dx,
(int) pts[indices[i]].dy, &x, &y, FALSE); (int) pts[indices[i]].dy, &x, &y, TRUE);
geometry[i][0] = x; geometry[i][0] = x;
geometry[i][1] = y; geometry[i][1] = y;
break; break;
@ -987,6 +989,7 @@ get_kink (Kink *kinks,
return kinks + index; return kinks + index;
} }
/* I don't think this ever gets called -- Rockwalrus */
return NULL; return NULL;
} }
@ -1311,9 +1314,9 @@ process_kinks (Tool *tool)
{ {
/* transform from screen to image coordinates */ /* transform from screen to image coordinates */
gdisplay_untransform_coords (gdisp, kinks[i].x, kinks[i].y, gdisplay_untransform_coords (gdisp, kinks[i].x, kinks[i].y,
&x, &y, FALSE, FALSE); &x, &y, FALSE, TRUE);
/*FIXkinks[i].x = BOUNDS (x, 0, (gimage_width (gdisp->gimage) - 1)); kinks[i].x = BOUNDS (x, 0, (gdisp->gimage->width - 1));
kinks[i].y = BOUNDS (y, 0, (gimage_height (gdisp->gimage) - 1));*/ kinks[i].y = BOUNDS (y, 0, (gdisp->gimage->height - 1));
/* get local maximums */ /* get local maximums */
k_left = get_kink (kinks, i-1, iscissors->num_kinks); k_left = get_kink (kinks, i-1, iscissors->num_kinks);
@ -1398,21 +1401,21 @@ edge_map_from_boundary (Tool *tool)
x = y = w = h = x1 = y1 = x2 = y2 = 0; x = y = w = h = x1 = y1 = x2 = y2 = 0;
/*FIXx1 = gimage_width (gdisp->gimage); x1 = gdisp->gimage->width;
y1 = gimage_height (gdisp->gimage);*/ y1 = gdisp->gimage->height;
/* Find the edge map extents */ /* Find the edge map extents */
for (i = 0; i < iscissors->num_pts; i++) for (i = 0; i < iscissors->num_pts; i++)
{ {
/*FIX x = BOUNDS (pts[i].x - LOCALIZE_RADIUS, 0, x = BOUNDS (pts[i].x - LOCALIZE_RADIUS, 0,
gimage_width (gdisp->gimage)); gdisp->gimage->width);
y = BOUNDS (pts[i].y - LOCALIZE_RADIUS, 0, y = BOUNDS (pts[i].y - LOCALIZE_RADIUS, 0,
gimage_height (gdisp->gimage)); gdisp->gimage->height);
w = BOUNDS (pts[i].x + LOCALIZE_RADIUS, 0, w = BOUNDS (pts[i].x + LOCALIZE_RADIUS, 0,
gimage_width (gdisp->gimage)); gdisp->gimage->width);
h = BOUNDS (pts[i].y + LOCALIZE_RADIUS, 0, h = BOUNDS (pts[i].y + LOCALIZE_RADIUS, 0,
gimage_height (gdisp->gimage)); gdisp->gimage->height);
*/
w -= x; w -= x;
h -= y; h -= y;
@ -1444,7 +1447,7 @@ orient_boundary (Tool *tool)
double edge1[EDGE_WIDTH], edge2[EDGE_WIDTH]; double edge1[EDGE_WIDTH], edge2[EDGE_WIDTH];
double max; double max;
double angle; double angle;
int dir; int dir = 0;
int i, j; int i, j;
int max_dir; int max_dir;
int max_orient; int max_orient;
@ -1746,7 +1749,13 @@ calculate_edge_map (GImage *gimage,
int xx, yy; int xx, yy;
unsigned char *gr, * dh, * dv, * cm; unsigned char *gr, * dh, * dv, * cm;
int hmax, vmax; int hmax, vmax;
int b;
double prev, next; double prev, next;
GimpDrawable *drawable;
void *pr;
FILE *dump;
drawable = gimage_active_drawable (gimage);
x1 = y1 = x2 = y2 = 0; x1 = y1 = x2 = y2 = 0;
@ -1754,31 +1763,38 @@ calculate_edge_map (GImage *gimage,
edge_map = temp_buf_new (w, h, EDGE_WIDTH, x, y, NULL); edge_map = temp_buf_new (w, h, EDGE_WIDTH, x, y, NULL);
/* calculate the extent of the search make a 1 pixel border */ /* calculate the extent of the search make a 1 pixel border */
/*FIXx1 = BOUNDS (x, 0, gimage_width (gimage)); x1 = BOUNDS (x, 0, gimage->width);
y1 = BOUNDS (y, 0, gimage_height (gimage)); y1 = BOUNDS (y, 0, gimage->height);
x2 = BOUNDS (x + w, 0, gimage_width (gimage)); x2 = BOUNDS (x + w, 0, gimage->width);
y2 = BOUNDS (y + h, 0, gimage_height (gimage));*/ y2 = BOUNDS (y + h, 0, gimage->height);
width = x2 - x1; width = x2 - x1;
height = y2 - y1; height = y2 - y1;
offx = (x - x1); offx = (x - x1);
offy = (y - y1); offy = (y - y1);
/* Set the gimage up as the source pixel region */ /* Set the drawable up as the source pixel region */
/* FIX srcPR.bytes = gimage_bytes (gimage);*/ /*srcPR.bytes = drawable_bytes (drawable);
srcPR.w = width; srcPR.w = width;
srcPR.h = height; srcPR.h = height;
/* FIX srcPR.rowstride = gimage_width (gimage) * gimage_bytes (gimage);*/ srcPR.rowstride = gimage->width * drawable_bytes (drawable);
/*FIXsrcPR.data = gimage_data (gimage) + y1 * srcPR.rowstride + x1 * srcPR.bytes;*/ srcPR.data = drawable_data (drawable) + y1 * srcPR.rowstride + x1 * srcPR.bytes;*/
pixel_region_init(&srcPR, drawable_data(drawable), x1, y1, width, height, 1);
/* Get the horizontal derivative */ /* Get the horizontal derivative */
destPR.data = conv1 + MAX_CHANNELS * (CONV_WIDTH * offy + offx); destPR.data = conv1 + MAX_CHANNELS * (CONV_WIDTH * offy + offx);
destPR.rowstride = CONV_WIDTH * MAX_CHANNELS; destPR.rowstride = CONV_WIDTH * MAX_CHANNELS;
gaussian_deriv (&srcPR, &destPR, HORIZONTAL, std_dev); destPR.tiles = NULL;
for (pr =pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr))
gaussian_deriv (&srcPR, &destPR, HORIZONTAL, std_dev);
/* Get the vertical derivative */ /* Get the vertical derivative */
destPR.data = conv2 + MAX_CHANNELS * (CONV_WIDTH * offy + offx); destPR.data = conv2 + MAX_CHANNELS * (CONV_WIDTH * offy + offx);
gaussian_deriv (&srcPR, &destPR, VERTICAL, std_dev);
for (pr =pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr))
gaussian_deriv (&srcPR, &destPR, VERTICAL, std_dev);
/* fill in the edge map */ /* fill in the edge map */
@ -1792,11 +1808,13 @@ calculate_edge_map (GImage *gimage,
{ {
hmax = dh[0] - 128; hmax = dh[0] - 128;
vmax = dv[0] - 128; vmax = dv[0] - 128;
/*FIX for (b = 1; b < gimage_bytes (gimage); b++) for (b = 1; b < drawable_bytes (drawable); b++)
{ {
if (abs (dh[b] - 128) > abs (hmax)) hmax = dh[b] - 128; if (abs (dh[b] - 128) > abs (hmax))
if (abs (dv[b] - 128) > abs (vmax)) vmax = dv[b] - 128; hmax = dh[b] - 128;
}*/ if (abs (dv[b] - 128) > abs (vmax))
vmax = dv[b] - 128;
}
/* store the information in the edge map */ /* store the information in the edge map */
dh[0] = hmax + 128; dh[0] = hmax + 128;
@ -1819,7 +1837,7 @@ calculate_edge_map (GImage *gimage,
} }
/* Make the edge gradient map extend one row further */ /* Make the edge gradient map extend one row further */
memcpy (grad, grad + (CONV_WIDTH+2), (CONV_WIDTH+2)); memcpy (grad, grad + (CONV_WIDTH+2), (CONV_WIDTH+2));
memcpy (grad + (CONV_WIDTH+2) * (CONV_HEIGHT+1), memcpy (grad + (CONV_WIDTH+2) * (CONV_HEIGHT+1),
grad + (CONV_WIDTH+2) * (CONV_HEIGHT), grad + (CONV_WIDTH+2) * (CONV_HEIGHT),
(CONV_WIDTH+2)); (CONV_WIDTH+2));
@ -1851,16 +1869,20 @@ calculate_edge_map (GImage *gimage,
else else
*cm++ = 0; *cm++ = 0;
/*
*cm++ = dh[0]; /*cm++ = dh[0];*/
*cm++ = dv[0]; /*cm++ = dv[0];*/
*/
dh += srcPR.bytes; dh += srcPR.bytes;
dv += srcPR.bytes; dv += srcPR.bytes;
gr ++; gr ++;
} }
} }
/* dump=fopen("/ugrad/summersn/dump", "w"); */
/* fprintf(dump, "P5\n%d %d\n255\n", edge_map->width, edge_map->height); */
/* fwrite(edge_map->data, edge_map->width * edge_map->height, sizeof (guchar), dump); */
/* fclose (dump); */
return edge_map; return edge_map;
} }
@ -1877,10 +1899,17 @@ construct_edge_map (Tool *tool,
int offx, offy; int offx, offy;
int x2, y2; int x2, y2;
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
FILE *dump;
/* init some variables */ /* init some variables */
srcPR.bytes = edge_buf->bytes; srcPR.bytes = edge_buf->bytes;
destPR.rowstride = edge_buf->bytes * edge_buf->width; destPR.rowstride = edge_buf->bytes * edge_buf->width;
destPR.x = edge_buf->x;
destPR.y = edge_buf->y;
destPR.h = edge_buf->height;
destPR.w = edge_buf -> width;
destPR.bytes = edge_buf->bytes;
srcPR.tiles = destPR.tiles = NULL;
y = edge_buf->y; y = edge_buf->y;
endx = edge_buf->x + edge_buf->width; endx = edge_buf->x + edge_buf->width;
@ -1906,7 +1935,7 @@ construct_edge_map (Tool *tool,
/* If the block exists, patch it into buf */ /* If the block exists, patch it into buf */
if (block) if (block)
{ {
/* calculate x offset into the block */ /* calculate x offset into the block */
offx = (x - col * BLOCK_WIDTH); offx = (x - col * BLOCK_WIDTH);
x2 = (col + 1) * BLOCK_WIDTH; x2 = (col + 1) * BLOCK_WIDTH;
if (x2 > endx) x2 = endx; if (x2 > endx) x2 = endx;
@ -1929,8 +1958,12 @@ construct_edge_map (Tool *tool,
y = row * BLOCK_HEIGHT; y = row * BLOCK_HEIGHT;
} }
/* show the edge buffer */ /* dump the edge buffer for debugging*/
/* temp_buf_to_gdisplay (edge_buf);*/
/* dump=fopen("/ugrad/summersn/dump", "w");
fprintf(dump, "P5\n%d %d\n255\n", edge_buf->width, edge_buf->height);
fwrite(edge_buf->data, edge_buf->width * edge_buf->height, sizeof (guchar), dump);
fclose (dump); */
} }
@ -1955,8 +1988,8 @@ set_edge_map_blocks (void *gimage_ptr,
width = height = 0; width = height = 0;
gimage = (GImage *) gimage_ptr; gimage = (GImage *) gimage_ptr;
/*FIXwidth = gimage_width (gimage);*/ width = gimage->width;
/*FIXheight = gimage_height (gimage);*/ height = gimage->height;
startx = x; startx = x;
endx = x + w; endx = x + w;
@ -2327,7 +2360,7 @@ make_curve_d (int *curve,
/* Functions for Catmull-Rom area conversion */ /* Functions for Catmull-Rom area conversion */
/***********************************************/ /***********************************************/
static link_ptr * CR_scanlines; static GSList **CR_scanlines;
static int start_convert; static int start_convert;
static int width, height; static int width, height;
static int lastx; static int lastx;
@ -2339,12 +2372,13 @@ CR_convert (Iscissors *iscissors,
int antialias) int antialias)
{ {
int indices[4]; int indices[4];
link_ptr list; GSList *list;
unsigned char *dest;
int draw_type; int draw_type;
int * vals, val; int * vals, val;
int x, w; int x, w;
int i, j; int i, j;
PixelRegion maskPR;
unsigned char *buf, *b;
vals = NULL; vals = NULL;
@ -2363,12 +2397,15 @@ CR_convert (Iscissors *iscissors,
draw_type = AA_IMAGE_COORDS; draw_type = AA_IMAGE_COORDS;
/* allocate value array */ /* allocate value array */
vals = (int *) g_malloc (sizeof (int) * width); vals = (int *) g_malloc (sizeof (int) * width);
buf = (unsigned char *) g_malloc (sizeof(unsigned char *) * width);
} }
else else
{ {
width = gdisp->gimage->width; width = gdisp->gimage->width;
height = gdisp->gimage->height; height = gdisp->gimage->height;
draw_type = IMAGE_COORDS; draw_type = IMAGE_COORDS;
buf = NULL;
vals = NULL;
} }
/* create a new mask */ /* create a new mask */
@ -2376,7 +2413,7 @@ CR_convert (Iscissors *iscissors,
gdisp->gimage->height); gdisp->gimage->height);
/* allocate room for the scanlines */ /* allocate room for the scanlines */
CR_scanlines = g_malloc (sizeof (link_ptr) * height); CR_scanlines = g_malloc (sizeof (GSList *) * height);
/* zero out the scanlines */ /* zero out the scanlines */
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
@ -2394,7 +2431,9 @@ CR_convert (Iscissors *iscissors,
iscissors_draw_CR (gdisp, iscissors, pts, indices, draw_type); iscissors_draw_CR (gdisp, iscissors, pts, indices, draw_type);
} }
dest = channel_data (iscissors->mask); pixel_region_init (&maskPR, iscissors->mask->drawable.tiles, 0, 0,
iscissors->mask->drawable.width,
iscissors->mask->drawable.height, TRUE);
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
{ {
@ -2418,21 +2457,25 @@ CR_convert (Iscissors *iscissors,
for (j = 0; j < w; j++) for (j = 0; j < w; j++)
vals[j + x] += 255; vals[j + x] += 255;
list = next_item (list); list = g_slist_next (list);
} }
} }
if (antialias && !((i+1) % SUPERSAMPLE)) if (antialias && !((i+1) % SUPERSAMPLE))
for (j = 0; j < width; j += SUPERSAMPLE) {
{ b = buf;
val = 0; for (j = 0; j < width; j += SUPERSAMPLE)
for (x = 0; x < SUPERSAMPLE; x++) {
val += vals[j + x]; val = 0;
for (x = 0; x < SUPERSAMPLE; x++)
val += vals[j + x];
*dest++ = val / SUPERSAMPLE2; *b++ = (unsigned char) (val / SUPERSAMPLE2);
} }
pixel_region_set_row (&maskPR, 0, (i / SUPERSAMPLE), iscissors->mask->drawable.width, buf);
}
free_list (CR_scanlines[i]); g_slist_free (CR_scanlines[i]);
} }
if (antialias) if (antialias)
@ -2465,11 +2508,11 @@ CR_convert_points (GdkPoint *points,
} }
static void static void
CR_convert_line (link_ptr *scanlines, CR_convert_line (GSList **scanlines,
int x1, int x1,
int y1, int y1,
int x2, int x2,
int y2) int y2)
{ {
int dx, dy; int dx, dy;
int error, inc; int error, inc;
@ -2581,32 +2624,32 @@ CR_convert_line (link_ptr *scanlines,
} }
} }
static link_ptr static GSList *
CR_insert_in_list (link_ptr list, CR_insert_in_list (GSList *list,
int x) int x)
{ {
link_ptr orig = list; GSList *orig = list;
link_ptr rest; GSList *rest;
if (!list) if (!list)
return add_to_list (list, (gpointer) ((long) x)); return g_slist_prepend (list, (gpointer) ((long) x));
while (list) while (list)
{ {
rest = next_item (list); rest = g_slist_next (list);
if (x < (long) list->data) if (x < (long) list->data)
{ {
rest = add_to_list (rest, list->data); rest = g_slist_prepend (rest, list->data);
list->next = rest; list->next = rest;
list->data = (gpointer) ((long) x); list->data = (gpointer) ((long) x);
return orig; return orig;
} }
else if (!rest) else if (!rest)
{ {
append_to_list (list, (gpointer) ((long) x)); g_slist_append (list, (gpointer) ((long) x));
return orig; return orig;
} }
list = next_item (list); list = g_slist_next (list);
} }
return orig; return orig;

View File

@ -24,7 +24,6 @@
#include "gimage_mask.h" #include "gimage_mask.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gdisplay_ops.h" #include "gdisplay_ops.h"
#include "linked.h"
#include "move.h" #include "move.h"
#include "undo.h" #include "undo.h"

View File

@ -100,7 +100,7 @@ struct _FontInfo
int *spacings; /* An array of valid spacings */ int *spacings; /* An array of valid spacings */
int **combos; /* An array of valid combinations of the above 5 items */ int **combos; /* An array of valid combinations of the above 5 items */
int ncombos; /* The number of elements in the "combos" array */ int ncombos; /* The number of elements in the "combos" array */
link_ptr fontnames; /* An list of valid fontnames. GSList *fontnames; /* An list of valid fontnames.
* This is used to make sure a family/foundry/weight/slant/set_width * This is used to make sure a family/foundry/weight/slant/set_width
* combination is valid. * combination is valid.
*/ */
@ -131,7 +131,7 @@ static void text_validate_combo (TextTool *, int);
static void text_get_fonts (void); static void text_get_fonts (void);
static void text_insert_font (FontInfo **, int *, char *); static void text_insert_font (FontInfo **, int *, char *);
static link_ptr text_insert_field (link_ptr, char *, int); static GSList* text_insert_field (GSList *, char *, int);
static char* text_get_field (char *, int); static char* text_get_field (char *, int);
static int text_field_to_index (char **, int, char *); static int text_field_to_index (char **, int, char *);
static int text_is_xlfd_font_name (char *); static int text_is_xlfd_font_name (char *);
@ -144,6 +144,8 @@ static void text_gdk_image_to_region (GdkImage *, int, PixelRegion *);
static int text_get_extents (char *, char *, int *, int *, int *, int *); static int text_get_extents (char *, char *, int *, int *, int *, int *);
static Layer * text_render (GImage *, GimpDrawable *, int, int, char *, char *, int, int); static Layer * text_render (GImage *, GimpDrawable *, int, int, char *, char *, int, int);
static int font_compare_func (gpointer, gpointer);
static Argument * text_tool_invoker (Argument *); static Argument * text_tool_invoker (Argument *);
static Argument * text_tool_get_extents_invoker (Argument *); static Argument * text_tool_get_extents_invoker (Argument *);
@ -164,11 +166,11 @@ static TextTool *the_text_tool = NULL;
static FontInfo **font_info; static FontInfo **font_info;
static int nfonts = -1; static int nfonts = -1;
static link_ptr foundries = NULL; static GSList *foundries = NULL;
static link_ptr weights = NULL; static GSList *weights = NULL;
static link_ptr slants = NULL; static GSList *slants = NULL;
static link_ptr set_widths = NULL; static GSList *set_widths = NULL;
static link_ptr spacings = NULL; static GSList *spacings = NULL;
static char **foundry_array = NULL; static char **foundry_array = NULL;
static char **weight_array = NULL; static char **weight_array = NULL;
@ -970,7 +972,7 @@ text_get_fonts ()
char **fontnames; char **fontnames;
char *fontname; char *fontname;
char *field; char *field;
link_ptr temp_list; GSList *temp_list;
int num_fonts; int num_fonts;
int index; int index;
int i, j; int i, j;
@ -998,11 +1000,11 @@ text_get_fonts ()
XFreeFontNames (fontnames); XFreeFontNames (fontnames);
nfoundries = list_length (foundries) + 1; nfoundries = g_slist_length (foundries) + 1;
nweights = list_length (weights) + 1; nweights = g_slist_length (weights) + 1;
nslants = list_length (slants) + 1; nslants = g_slist_length (slants) + 1;
nset_widths = list_length (set_widths) + 1; nset_widths = g_slist_length (set_widths) + 1;
nspacings = list_length (spacings) + 1; nspacings = g_slist_length (spacings) + 1;
foundry_array = g_malloc (sizeof (char*) * nfoundries); foundry_array = g_malloc (sizeof (char*) * nfoundries);
weight_array = g_malloc (sizeof (char*) * nweights); weight_array = g_malloc (sizeof (char*) * nweights);
@ -1063,7 +1065,7 @@ text_get_fonts ()
font_info[i]->slants = g_malloc (sizeof (int) * nslants); font_info[i]->slants = g_malloc (sizeof (int) * nslants);
font_info[i]->set_widths = g_malloc (sizeof (int) * nset_widths); font_info[i]->set_widths = g_malloc (sizeof (int) * nset_widths);
font_info[i]->spacings = g_malloc (sizeof (int) * nspacings); font_info[i]->spacings = g_malloc (sizeof (int) * nspacings);
font_info[i]->ncombos = list_length (font_info[i]->fontnames); font_info[i]->ncombos = g_slist_length (font_info[i]->fontnames);
font_info[i]->combos = g_malloc (sizeof (int*) * font_info[i]->ncombos); font_info[i]->combos = g_malloc (sizeof (int*) * font_info[i]->ncombos);
for (j = 0; j < nfoundries; j++) for (j = 0; j < nfoundries; j++)
@ -1156,7 +1158,7 @@ text_insert_font (FontInfo **table,
cmp = strcmp (family, table[middle]->family); cmp = strcmp (family, table[middle]->family);
if (cmp == 0) if (cmp == 0)
{ {
table[middle]->fontnames = add_to_list (table[middle]->fontnames, g_strdup (fontname)); table[middle]->fontnames = g_slist_prepend (table[middle]->fontnames, g_strdup (fontname));
return; return;
} }
else if (cmp < 0) else if (cmp < 0)
@ -1174,7 +1176,7 @@ text_insert_font (FontInfo **table,
table[*ntable]->slants = NULL; table[*ntable]->slants = NULL;
table[*ntable]->set_widths = NULL; table[*ntable]->set_widths = NULL;
table[*ntable]->fontnames = NULL; table[*ntable]->fontnames = NULL;
table[*ntable]->fontnames = add_to_list (table[*ntable]->fontnames, g_strdup (fontname)); table[*ntable]->fontnames = g_slist_prepend (table[*ntable]->fontnames, g_strdup (fontname));
(*ntable)++; (*ntable)++;
/* Quickly insert the entry into the table in sorted order /* Quickly insert the entry into the table in sorted order
@ -1198,62 +1200,24 @@ text_insert_font (FontInfo **table,
} }
} }
static link_ptr static int
text_insert_field (link_ptr list, font_compare_func (gpointer a, gpointer b)
char *fontname, {
int field_num) return strcmp (a, b);
}
static GSList *
text_insert_field (GSList *list,
char *fontname,
int field_num)
{ {
link_ptr temp_list;
link_ptr prev_list;
link_ptr new_list;
char *field; char *field;
int cmp;
field = text_get_field (fontname, field_num); field = text_get_field (fontname, field_num);
if (!field) if (!field)
return list; return list;
temp_list = list; return g_slist_insert_sorted (list, field, font_compare_func);
prev_list = NULL;
while (temp_list)
{
cmp = strcmp (field, temp_list->data);
if (cmp == 0)
{
free (field);
return list;
}
else if (cmp < 0)
{
new_list = alloc_list ();
new_list->data = field;
new_list->next = temp_list;
if (prev_list)
{
prev_list->next = new_list;
return list;
}
else
return new_list;
}
else
{
prev_list = temp_list;
temp_list = temp_list->next;
}
}
new_list = alloc_list ();
new_list->data = field;
new_list->next = NULL;
if (prev_list)
{
prev_list->next = new_list;
return list;
}
else
return new_list;
} }
static char* static char*

View File

@ -30,7 +30,6 @@
#include "gimprc.h" #include "gimprc.h"
#include "indexed_palette.h" #include "indexed_palette.h"
#include "layer.h" #include "layer.h"
#include "linked.h"
#include "paint_core.h" #include "paint_core.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "tools.h" #include "tools.h"
@ -135,9 +134,9 @@ channel_size (Channel *channel)
static void static void
undo_free_list (GImage *gimage, undo_free_list (GImage *gimage,
int state, int state,
link_ptr list) GSList *list)
{ {
link_ptr orig; GSList * orig;
Undo * undo; Undo * undo;
orig = list; orig = list;
@ -151,17 +150,18 @@ undo_free_list (GImage *gimage,
gimage->undo_bytes -= undo->bytes; gimage->undo_bytes -= undo->bytes;
g_free (undo); g_free (undo);
} }
list = next_item (list); list = g_slist_next (list);
} }
free_list (orig); g_slist_free (orig);
} }
static link_ptr static GSList *
remove_stack_bottom (GImage *gimage) remove_stack_bottom (GImage *gimage)
{ {
link_ptr list, last; GSList *list;
GSList *last;
int in_group = 0; int in_group = 0;
list = gimage->undo_stack; list = gimage->undo_stack;
@ -193,7 +193,7 @@ remove_stack_bottom (GImage *gimage)
(!list->data && !in_group)) (!list->data && !in_group))
last = list; last = list;
list = next_item (list); list = g_slist_next (list);
} }
} }
@ -258,21 +258,21 @@ undo_push (GImage *gimage,
else else
new->type = gimage->pushing_undo_group; new->type = gimage->pushing_undo_group;
gimage->undo_stack = add_to_list (gimage->undo_stack, (void *) new); gimage->undo_stack = g_slist_prepend (gimage->undo_stack, (void *) new);
return new; return new;
} }
static int static int
pop_stack (GImage *gimage, pop_stack (GImage *gimage,
link_ptr *stack_ptr, GSList **stack_ptr,
link_ptr *unstack_ptr, GSList **unstack_ptr,
int state) int state)
{ {
Undo * object; Undo * object;
link_ptr stack; GSList *stack;
link_ptr tmp; GSList *tmp;
int status = 0; int status = 0;
int in_group = 0; int in_group = 0;
@ -302,12 +302,12 @@ pop_stack (GImage *gimage,
gimage->undo_levels += (state == UNDO) ? -1 : 1; gimage->undo_levels += (state == UNDO) ? -1 : 1;
} }
*unstack_ptr = add_to_list (*unstack_ptr, (void *) object); *unstack_ptr = g_slist_prepend (*unstack_ptr, (void *) object);
tmp = stack; tmp = stack;
*stack_ptr = next_item (*stack_ptr); *stack_ptr = g_slist_next (*stack_ptr);
tmp->next = NULL; tmp->next = NULL;
free_list (tmp); g_slist_free (tmp);
if (status && !in_group) if (status && !in_group)
{ {
@ -381,7 +381,7 @@ undo_push_group_start (GImage *gimage,
return FALSE; return FALSE;
gimage->pushing_undo_group = type; gimage->pushing_undo_group = type;
gimage->undo_stack = add_to_list (gimage->undo_stack, NULL); gimage->undo_stack = g_slist_prepend (gimage->undo_stack, NULL);
gimage->undo_levels++; gimage->undo_levels++;
return TRUE; return TRUE;
@ -399,7 +399,7 @@ undo_push_group_end (GImage *gimage)
if (group_count == 0) if (group_count == 0)
{ {
gimage->pushing_undo_group = 0; gimage->pushing_undo_group = 0;
gimage->undo_stack = add_to_list (gimage->undo_stack, NULL); gimage->undo_stack = g_slist_prepend (gimage->undo_stack, NULL);
} }
return TRUE; return TRUE;
@ -1072,8 +1072,8 @@ undo_pop_layer (GImage *gimage,
gimage_set_active_layer (gimage, lu->prev_layer); gimage_set_active_layer (gimage, lu->prev_layer);
/* remove the layer */ /* remove the layer */
gimage->layers = remove_from_list (gimage->layers, lu->layer); gimage->layers = g_slist_remove (gimage->layers, lu->layer);
gimage->layer_stack = remove_from_list (gimage->layer_stack, lu->layer); gimage->layer_stack = g_slist_remove (gimage->layer_stack, lu->layer);
/* reset the gimage values */ /* reset the gimage values */
if (layer_is_floating_sel (lu->layer)) if (layer_is_floating_sel (lu->layer))
@ -1100,8 +1100,8 @@ undo_pop_layer (GImage *gimage,
gimage->floating_sel = lu->layer; gimage->floating_sel = lu->layer;
/* add the new layer */ /* add the new layer */
gimage->layers = insert_in_list (gimage->layers, lu->layer, lu->prev_position); gimage->layers = g_slist_insert (gimage->layers, lu->layer, lu->prev_position);
gimage->layer_stack = add_to_list (gimage->layer_stack, lu->layer); gimage->layer_stack = g_slist_prepend (gimage->layer_stack, lu->layer);
gimage->active_layer = lu->layer; gimage->active_layer = lu->layer;
drawable_update (GIMP_DRAWABLE(lu->layer), 0, 0, GIMP_DRAWABLE(lu->layer)->width, GIMP_DRAWABLE(lu->layer)->height); drawable_update (GIMP_DRAWABLE(lu->layer), 0, 0, GIMP_DRAWABLE(lu->layer)->width, GIMP_DRAWABLE(lu->layer)->height);
} }
@ -1443,7 +1443,7 @@ undo_pop_channel (GImage *gimage,
cu->prev_position = gimage_get_channel_index (gimage, cu->channel); cu->prev_position = gimage_get_channel_index (gimage, cu->channel);
/* remove the channel */ /* remove the channel */
gimage->channels = remove_from_list (gimage->channels, cu->channel); gimage->channels = g_slist_remove (gimage->channels, cu->channel);
/* set the previous channel */ /* set the previous channel */
gimage_set_active_channel (gimage, cu->prev_channel); gimage_set_active_channel (gimage, cu->prev_channel);
@ -1458,7 +1458,7 @@ undo_pop_channel (GImage *gimage,
cu->prev_channel = gimage->active_channel; cu->prev_channel = gimage->active_channel;
/* add the new channel */ /* add the new channel */
gimage->channels = insert_in_list (gimage->channels, cu->channel, cu->prev_position); gimage->channels = g_slist_insert (gimage->channels, cu->channel, cu->prev_position);
/* set the new channel */ /* set the new channel */
gimage_set_active_channel (gimage, cu->channel); gimage_set_active_channel (gimage, cu->channel);

View File

@ -157,7 +157,6 @@
#include "gimprc.h" #include "gimprc.h"
#include "gradient.h" #include "gradient.h"
#include "interface.h" #include "interface.h"
#include "linked.h"
#include "palette.h" #include "palette.h"
@ -556,7 +555,7 @@ static Argument *gradients_sample_custom_invoker(Argument *args);
/***** Local variables *****/ /***** Local variables *****/
static int num_gradients = 0; static int num_gradients = 0;
static link_ptr gradients_list = NULL; /* The list of gradients */ static GSList *gradients_list = NULL; /* The list of gradients */
static gradient_t *curr_gradient = NULL; /* The active gradient */ static gradient_t *curr_gradient = NULL; /* The active gradient */
static gradient_t *grad_default_gradient = NULL; static gradient_t *grad_default_gradient = NULL;
@ -1088,7 +1087,7 @@ ed_set_hint(char *str)
static void static void
ed_set_list_of_gradients(void) ed_set_list_of_gradients(void)
{ {
link_ptr list; GSList *list;
gradient_t *grad; gradient_t *grad;
int n; int n;
@ -1103,7 +1102,7 @@ ed_set_list_of_gradients(void)
else else
ed_insert_in_gradients_listbox(grad, n, 0); ed_insert_in_gradients_listbox(grad, n, 0);
list = next_item(list); list = g_slist_next(list);
n++; n++;
} /* while */ } /* while */
} /* ed_set_list_of_gradients */ } /* ed_set_list_of_gradients */
@ -1436,7 +1435,7 @@ static void
ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data) ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
{ {
GList *list; GList *list;
link_ptr tmp; GSList *tmp;
int n; int n;
gradient_t *g; gradient_t *g;
GtkWidget *list_item; GtkWidget *list_item;
@ -1460,7 +1459,7 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
} /* if */ } /* if */
n++; /* Next gradient */ n++; /* Next gradient */
tmp = next_item(tmp); tmp = g_slist_next(tmp);
} /* while */ } /* while */
if (tmp == NULL) if (tmp == NULL)
@ -1470,7 +1469,7 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
list_item = curr_gradient->list_item; /* Remember list item to delete it later */ list_item = curr_gradient->list_item; /* Remember list item to delete it later */
gradients_list = remove_from_list(gradients_list, curr_gradient); gradients_list = g_slist_remove(gradients_list, curr_gradient);
/* Delete file and free gradient */ /* Delete file and free gradient */
@ -1484,7 +1483,7 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
/* Select new gradient */ /* Select new gradient */
curr_gradient = nth_item(gradients_list, n)->data; curr_gradient = g_slist_nth(gradients_list, n)->data;
gtk_list_select_item(GTK_LIST(g_editor->list), n); gtk_list_select_item(GTK_LIST(g_editor->list), n);
/* Update! */ /* Update! */
@ -1531,13 +1530,13 @@ ed_save_pov_callback(GtkWidget *widget, gpointer client_data)
static void static void
ed_refresh_callback(GtkWidget *widget, gpointer client_data) ed_refresh_callback(GtkWidget *widget, gpointer client_data)
{ {
link_ptr node; GSList *node;
gradient_t *grad; gradient_t *grad;
GList *list; GList *list;
list = NULL; list = NULL;
for (node = gradients_list; node; node = next_item(node)) { for (node = gradients_list; node; node = g_slist_next(node)) {
grad = node->data; grad = node->data;
list = g_list_append(list, grad->list_item); list = g_list_append(list, grad->list_item);
} }
@ -5054,7 +5053,7 @@ grad_free_gradient(gradient_t *grad)
static void static void
grad_free_gradients(void) grad_free_gradients(void)
{ {
link_ptr node; GSList *node;
gradient_t *grad; gradient_t *grad;
node = gradients_list; node = gradients_list;
@ -5069,10 +5068,10 @@ grad_free_gradients(void)
grad_free_gradient(grad); grad_free_gradient(grad);
node = next_item(node); node = g_slist_next(node);
} /* while */ } /* while */
free_list(gradients_list); g_slist_free(gradients_list);
num_gradients = 0; num_gradients = 0;
gradients_list = NULL; gradients_list = NULL;
@ -5236,7 +5235,7 @@ grad_create_default_gradient(void)
static int static int
grad_insert_in_gradients_list(gradient_t *grad) grad_insert_in_gradients_list(gradient_t *grad)
{ {
link_ptr tmp; GSList *tmp;
gradient_t *g; gradient_t *g;
int n; int n;
@ -5254,11 +5253,11 @@ grad_insert_in_gradients_list(gradient_t *grad)
break; /* We found the one we want */ break; /* We found the one we want */
n++; n++;
tmp = next_item(tmp); tmp = g_slist_next(tmp);
} /* while */ } /* while */
num_gradients++; num_gradients++;
gradients_list = insert_in_list(gradients_list, grad, n); gradients_list = g_slist_insert(gradients_list, grad, n);
return n; return n;
} /* grad_insert_in_gradients_list */ } /* grad_insert_in_gradients_list */
@ -5731,7 +5730,7 @@ gradients_get_list_invoker(Argument *args)
{ {
Argument *return_args; Argument *return_args;
gradient_t *grad; gradient_t *grad;
link_ptr list; GSList *list;
char **gradients; char **gradients;
int i; int i;
int success; int success;
@ -5747,7 +5746,7 @@ gradients_get_list_invoker(Argument *args)
while (list) { while (list) {
grad = list->data; grad = list->data;
gradients[i++] = g_strdup(grad->name); gradients[i++] = g_strdup(grad->name);
list = next_item(list); list = g_slist_next(list);
} /* while */ } /* while */
return_args = procedural_db_return_args(&gradients_get_list_proc, success); return_args = procedural_db_return_args(&gradients_get_list_proc, success);
@ -5857,7 +5856,7 @@ Argument *
gradients_set_active_invoker(Argument *args) gradients_set_active_invoker(Argument *args)
{ {
char *name; char *name;
link_ptr list; GSList *list;
gradient_t *grad; gradient_t *grad;
int success; int success;
@ -5890,7 +5889,7 @@ gradients_set_active_invoker(Argument *args)
break; break;
} /* if */ } /* if */
list = next_item(list); list = g_slist_next(list);
} /* while */ } /* while */
} /* if */ } /* if */

View File

@ -32,7 +32,6 @@
#include "errors.h" #include "errors.h"
#include "general.h" #include "general.h"
#include "gimprc.h" #include "gimprc.h"
#include "linked.h"
#include "interface.h" #include "interface.h"
#include "palette.h" #include "palette.h"
@ -74,7 +73,7 @@ static void palette_delete_entry (PaletteP);
static void palette_calc_scrollbar (PaletteP); static void palette_calc_scrollbar (PaletteP);
static void palette_entries_load (char *); static void palette_entries_load (char *);
static link_ptr palette_entries_insert_list (link_ptr, PaletteEntriesP); static GSList * palette_entries_insert_list (GSList *, PaletteEntriesP);
static void palette_entries_delete (char *); static void palette_entries_delete (char *);
static void palette_entries_save (PaletteEntriesP, char *); static void palette_entries_save (PaletteEntriesP, char *);
static void palette_entries_free (PaletteEntriesP); static void palette_entries_free (PaletteEntriesP);
@ -100,7 +99,7 @@ static void palette_draw_entries (PaletteP);
static void palette_draw_current_entry (PaletteP); static void palette_draw_current_entry (PaletteP);
static void palette_update_current_entry (PaletteP); static void palette_update_current_entry (PaletteP);
link_ptr palette_entries_list = NULL; GSList *palette_entries_list = NULL;
static PaletteP palette = NULL; static PaletteP palette = NULL;
static PaletteEntriesP default_palette_entries = NULL; static PaletteEntriesP default_palette_entries = NULL;
@ -368,7 +367,7 @@ palette_init_palettes (void)
void void
palette_free_palettes (void) palette_free_palettes (void)
{ {
link_ptr list; GSList *list;
PaletteEntriesP entries; PaletteEntriesP entries;
list = palette_entries_list; list = palette_entries_list;
@ -383,9 +382,9 @@ palette_free_palettes (void)
palette_entries_save (entries, entries->filename); palette_entries_save (entries, entries->filename);
palette_entries_free (entries); palette_entries_free (entries);
list = next_item (list); list = g_slist_next (list);
} }
free_list (palette_entries_list); g_slist_free (palette_entries_list);
if (palette) if (palette)
{ {
@ -409,7 +408,7 @@ palette_create_palette_menu (PaletteP palette,
PaletteEntriesP default_entries) PaletteEntriesP default_entries)
{ {
GtkWidget *menu_item; GtkWidget *menu_item;
link_ptr list; GSList *list;
PaletteEntriesP p_entries = NULL; PaletteEntriesP p_entries = NULL;
PaletteEntriesP found_entries = NULL; PaletteEntriesP found_entries = NULL;
int i = 0; int i = 0;
@ -421,7 +420,7 @@ palette_create_palette_menu (PaletteP palette,
while (list) while (list)
{ {
p_entries = (PaletteEntriesP) list->data; p_entries = (PaletteEntriesP) list->data;
list = next_item (list); list = g_slist_next (list);
/* to make sure we get something! */ /* to make sure we get something! */
if (p_entries == NULL) if (p_entries == NULL)
@ -559,13 +558,13 @@ palette_entries_delete (char *filename)
unlink (filename); unlink (filename);
} }
static link_ptr static GSList *
palette_entries_insert_list (link_ptr list, palette_entries_insert_list (GSList * list,
PaletteEntriesP entries) PaletteEntriesP entries)
{ {
/* add it to the list */ /* add it to the list */
num_palette_entries++; num_palette_entries++;
return append_to_list (list, (void *) entries); return g_slist_append (list, (void *) entries);
} }
static void static void
@ -573,7 +572,7 @@ palette_entries_save (PaletteEntriesP palette,
char *filename) char *filename)
{ {
FILE * fp; FILE * fp;
link_ptr list; GSList * list;
PaletteEntryP entry; PaletteEntryP entry;
if (! filename) if (! filename)
@ -595,7 +594,7 @@ palette_entries_save (PaletteEntriesP palette,
entry = (PaletteEntryP) list->data; entry = (PaletteEntryP) list->data;
fprintf (fp, "%d %d %d\t%s\n", entry->color[0], entry->color[1], fprintf (fp, "%d %d %d\t%s\n", entry->color[0], entry->color[1],
entry->color[2], entry->name); entry->color[2], entry->name);
list = next_item (list); list = g_slist_next (list);
} }
/* Clean up */ /* Clean up */
@ -606,7 +605,7 @@ static void
palette_entries_free (PaletteEntriesP entries) palette_entries_free (PaletteEntriesP entries)
{ {
PaletteEntryP entry; PaletteEntryP entry;
link_ptr list; GSList * list;
list = entries->colors; list = entries->colors;
while (list) while (list)
@ -722,7 +721,7 @@ palette_color_area_events (GtkWidget *widget,
PaletteP palette) PaletteP palette)
{ {
GdkEventButton *bevent; GdkEventButton *bevent;
link_ptr tmp_link; GSList *tmp_link;
int r, g, b; int r, g, b;
int width, height; int width, height;
int entry_width; int entry_width;
@ -746,7 +745,7 @@ palette_color_area_events (GtkWidget *widget,
row = (palette->scroll_offset + bevent->y - 1) / entry_height; row = (palette->scroll_offset + bevent->y - 1) / entry_height;
pos = row * COLUMNS + col; pos = row * COLUMNS + col;
tmp_link = nth_item (palette->entries->colors, pos); tmp_link = g_slist_nth (palette->entries->colors, pos);
if (tmp_link) if (tmp_link)
{ {
palette_draw_current_entry (palette); palette_draw_current_entry (palette);
@ -1158,7 +1157,7 @@ palette_draw_entries (PaletteP palette)
PaletteEntryP entry; PaletteEntryP entry;
unsigned char *buffer; unsigned char *buffer;
unsigned char *colors[COLUMNS]; unsigned char *colors[COLUMNS];
link_ptr tmp_link; GSList *tmp_link;
int width, height; int width, height;
int entry_width; int entry_width;
int entry_height; int entry_height;
@ -1293,7 +1292,7 @@ palette_add_entry (PaletteEntriesP entries,
entry->name = g_strdup ("Untitled"); entry->name = g_strdup ("Untitled");
entry->position = entries->n_colors; entry->position = entries->n_colors;
entries->colors = append_to_list (entries->colors, entry); entries->colors = g_slist_append (entries->colors, entry);
entries->n_colors += 1; entries->n_colors += 1;
entries->changed = 1; entries->changed = 1;
@ -1308,20 +1307,20 @@ static void
palette_delete_entry (PaletteP palette) palette_delete_entry (PaletteP palette)
{ {
PaletteEntryP entry; PaletteEntryP entry;
link_ptr tmp_link; GSList *tmp_link;
int pos; int pos;
if (palette && palette->entries && palette->color) if (palette && palette->entries && palette->color)
{ {
entry = palette->color; entry = palette->color;
palette->entries->colors = remove_from_list (palette->entries->colors, entry); palette->entries->colors = g_slist_remove (palette->entries->colors, entry);
palette->entries->n_colors--; palette->entries->n_colors--;
palette->entries->changed = 1; palette->entries->changed = 1;
pos = entry->position; pos = entry->position;
palette_entry_free (entry); palette_entry_free (entry);
tmp_link = nth_item (palette->entries->colors, pos); tmp_link = g_slist_nth (palette->entries->colors, pos);
if (tmp_link) if (tmp_link)
{ {
@ -1336,7 +1335,7 @@ palette_delete_entry (PaletteP palette)
} }
else else
{ {
tmp_link = nth_item (palette->entries->colors, pos - 1); tmp_link = g_slist_nth (palette->entries->colors, pos - 1);
if (tmp_link) if (tmp_link)
palette->color = tmp_link->data; palette->color = tmp_link->data;
} }

View File

@ -18,6 +18,9 @@
#ifndef __PALETTE_H__ #ifndef __PALETTE_H__
#define __PALETTE_H__ #define __PALETTE_H__
#include <glib.h>
#include "procedural_db.h"
#define FOREGROUND 0 #define FOREGROUND 0
#define BACKGROUND 1 #define BACKGROUND 1
@ -39,7 +42,7 @@ void palette_set_active_color (int, int, int, int);
struct _PaletteEntries { struct _PaletteEntries {
char *name; char *name;
char *filename; char *filename;
link_ptr colors; GSList *colors;
int n_colors; int n_colors;
int changed; int changed;
}; };
@ -52,12 +55,10 @@ struct _PaletteEntry {
}; };
typedef struct _PaletteEntry _PaletteEntry, *PaletteEntryP; typedef struct _PaletteEntry _PaletteEntry, *PaletteEntryP;
extern link_ptr palette_entries_list; extern GSList * palette_entries_list;
void palette_init_palettes (void); void palette_init_palettes (void);
void palette_free_palettes (void); void palette_free_palettes (void);
#include "procedural_db.h"
/* Procedure definition and marshalling function */ /* Procedure definition and marshalling function */
extern ProcRecord palette_get_foreground_proc; extern ProcRecord palette_get_foreground_proc;
extern ProcRecord palette_get_background_proc; extern ProcRecord palette_get_background_proc;

View File

@ -418,7 +418,7 @@ xcf_save_image (XcfInfo *info,
guint32 offset; guint32 offset;
guint nlayers; guint nlayers;
guint nchannels; guint nchannels;
link_ptr list; GSList *list;
int have_selection; int have_selection;
int t1, t2, t3, t4; int t1, t2, t3, t4;
char version_tag[14]; char version_tag[14];
@ -444,8 +444,8 @@ xcf_save_image (XcfInfo *info,
info->cp += xcf_write_int32 (info->fp, (guint32*) &gimage->base_type, 1); info->cp += xcf_write_int32 (info->fp, (guint32*) &gimage->base_type, 1);
/* determine the number of layers and channels in the image */ /* determine the number of layers and channels in the image */
nlayers = (guint) list_length (gimage->layers); nlayers = (guint) g_slist_length (gimage->layers);
nchannels = (guint) list_length (gimage->channels); nchannels = (guint) g_slist_length (gimage->channels);
/* check and see if we have to save out the selection */ /* check and see if we have to save out the selection */
have_selection = gimage_mask_bounds (gimage, &t1, &t2, &t3, &t4); have_selection = gimage_mask_bounds (gimage, &t1, &t2, &t3, &t4);
@ -835,7 +835,7 @@ xcf_save_prop (XcfInfo *info,
int nguides; int nguides;
guides = va_arg (args, GList*); guides = va_arg (args, GList*);
nguides = g_list_length (guides); nguides = g_slist_length (guides);
size = nguides * (4 + 1); size = nguides * (4 + 1);
@ -1276,7 +1276,7 @@ xcf_load_image (XcfInfo *info)
/* add the layer to the image if its not the floating selection */ /* add the layer to the image if its not the floating selection */
if (layer != info->floating_sel) if (layer != info->floating_sel)
gimage_add_layer (gimage, layer, list_length (gimage->layers)); gimage_add_layer (gimage, layer, g_slist_length (gimage->layers));
/* restore the saved position so we'll be ready to /* restore the saved position so we'll be ready to
* read the next offset. * read the next offset.

View File

@ -418,7 +418,7 @@ xcf_save_image (XcfInfo *info,
guint32 offset; guint32 offset;
guint nlayers; guint nlayers;
guint nchannels; guint nchannels;
link_ptr list; GSList *list;
int have_selection; int have_selection;
int t1, t2, t3, t4; int t1, t2, t3, t4;
char version_tag[14]; char version_tag[14];
@ -444,8 +444,8 @@ xcf_save_image (XcfInfo *info,
info->cp += xcf_write_int32 (info->fp, (guint32*) &gimage->base_type, 1); info->cp += xcf_write_int32 (info->fp, (guint32*) &gimage->base_type, 1);
/* determine the number of layers and channels in the image */ /* determine the number of layers and channels in the image */
nlayers = (guint) list_length (gimage->layers); nlayers = (guint) g_slist_length (gimage->layers);
nchannels = (guint) list_length (gimage->channels); nchannels = (guint) g_slist_length (gimage->channels);
/* check and see if we have to save out the selection */ /* check and see if we have to save out the selection */
have_selection = gimage_mask_bounds (gimage, &t1, &t2, &t3, &t4); have_selection = gimage_mask_bounds (gimage, &t1, &t2, &t3, &t4);
@ -835,7 +835,7 @@ xcf_save_prop (XcfInfo *info,
int nguides; int nguides;
guides = va_arg (args, GList*); guides = va_arg (args, GList*);
nguides = g_list_length (guides); nguides = g_slist_length (guides);
size = nguides * (4 + 1); size = nguides * (4 + 1);
@ -1276,7 +1276,7 @@ xcf_load_image (XcfInfo *info)
/* add the layer to the image if its not the floating selection */ /* add the layer to the image if its not the floating selection */
if (layer != info->floating_sel) if (layer != info->floating_sel)
gimage_add_layer (gimage, layer, list_length (gimage->layers)); gimage_add_layer (gimage, layer, g_slist_length (gimage->layers));
/* restore the saved position so we'll be ready to /* restore the saved position so we'll be ready to
* read the next offset. * read the next offset.