Commit 1d591e95 authored by GMT 1998 Andy Thomas's avatar GMT 1998 Andy Thomas Committed by Andy Thomas

Changed the palette dialog. New functionality. Better previews. Can


Fri Dec 18 23:46:11 GMT 1998 Andy Thomas <alt@picnic.demon.co.uk>

	Changed the palette dialog. New functionality. Better previews.
	Can display larger palettes. Can import palettes from images and from
	gradients. Fixed colour selection so that the hightlighted
	square says in sync on redraws.

	* app/convert.h
	* app/palette.h
	* app/palette.c
	* app/gradient.c
	* app/gradient_select.c
	* app/gimage.c
	* app/gimpimage.c
	* app/gimpimage.h

	New file:-

	* app/palette_entries.h
parent c848afaf
Fri Dec 18 23:46:11 GMT 1998 Andy Thomas <alt@picnic.demon.co.uk>
Changed the palette dialog. New functionality. Better previews.
Can display larger palettes. Can import palettes from images and from
gradients. Fixed colour selection so that the hightlighted
square says in sync on redraws.
* app/convert.h
* app/palette.h
* app/palette.c
* app/gradient.c
* app/gradient_select.c
* app/gimage.c
* app/gimpimage.c
* app/gimpimage.h
New file:-
* app/palette_entries.h
Thu Dec 17 03:50:51 PST 1998 Manish Singh <yosh@gimp.org>
* app/Makefile.am: added some missing files
......
......@@ -20,6 +20,8 @@
#include "procedural_db.h"
#include "gimpimageF.h"
#include "palette_entries.h"
/* convert functions */
void convert_to_rgb (GimpImage *);
void convert_to_grayscale (GimpImage *);
......
......@@ -20,6 +20,8 @@
#include "procedural_db.h"
#include "gimpimageF.h"
#include "palette_entries.h"
/* convert functions */
void convert_to_rgb (GimpImage *);
void convert_to_grayscale (GimpImage *);
......
......@@ -2894,7 +2894,7 @@ gimp_image_composite_bytes (GimpImage *gimage)
return gimp_image_projection_bytes (gimage);
}
static TempBuf *
TempBuf *
gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height)
{
Layer * layer;
......
......@@ -223,5 +223,6 @@ int gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height);
#endif
......@@ -2894,7 +2894,7 @@ gimp_image_composite_bytes (GimpImage *gimage)
return gimp_image_projection_bytes (gimage);
}
static TempBuf *
TempBuf *
gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height)
{
Layer * layer;
......
......@@ -223,5 +223,6 @@ int gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height);
#endif
......@@ -2894,7 +2894,7 @@ gimp_image_composite_bytes (GimpImage *gimage)
return gimp_image_projection_bytes (gimage);
}
static TempBuf *
TempBuf *
gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height)
{
Layer * layer;
......
......@@ -223,5 +223,6 @@ int gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height);
#endif
......@@ -2894,7 +2894,7 @@ gimp_image_composite_bytes (GimpImage *gimage)
return gimp_image_projection_bytes (gimage);
}
static TempBuf *
TempBuf *
gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height)
{
Layer * layer;
......
......@@ -223,5 +223,6 @@ int gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height);
#endif
......@@ -2894,7 +2894,7 @@ gimp_image_composite_bytes (GimpImage *gimage)
return gimp_image_projection_bytes (gimage);
}
static TempBuf *
TempBuf *
gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height)
{
Layer * layer;
......
......@@ -223,5 +223,6 @@ int gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height);
#endif
......@@ -2894,7 +2894,7 @@ gimp_image_composite_bytes (GimpImage *gimage)
return gimp_image_projection_bytes (gimage);
}
static TempBuf *
TempBuf *
gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height)
{
Layer * layer;
......
......@@ -223,5 +223,6 @@ int gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height);
#endif
......@@ -2894,7 +2894,7 @@ gimp_image_composite_bytes (GimpImage *gimage)
return gimp_image_projection_bytes (gimage);
}
static TempBuf *
TempBuf *
gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height)
{
Layer * layer;
......
......@@ -223,5 +223,6 @@ int gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height);
#endif
......@@ -53,6 +53,8 @@ gimage_new(int width, int height, GimpImageBaseType base_type)
gimp_set_add(image_context, gimage);
indexed_palette_update_image_list ();
palette_import_image_new(gimage);
return gimage;
}
......@@ -107,6 +109,8 @@ gimage_destroy_handler (GimpImage* gimage)
undo_free (gimage);
indexed_palette_update_image_list ();
palette_import_image_destroyed(gimage);
}
static void
......@@ -115,6 +119,8 @@ gimage_rename_handler (GimpImage* gimage)
gdisplays_update_title (gimage);
lc_dialog_update_image_list ();
indexed_palette_update_image_list ();
palette_import_image_renamed(gimage);
}
static void
......
......@@ -20,6 +20,8 @@
#include "procedural_db.h"
#include "gimpimageF.h"
#include "palette_entries.h"
/* convert functions */
void convert_to_rgb (GimpImage *);
void convert_to_grayscale (GimpImage *);
......
......@@ -2894,7 +2894,7 @@ gimp_image_composite_bytes (GimpImage *gimage)
return gimp_image_projection_bytes (gimage);
}
static TempBuf *
TempBuf *
gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height)
{
Layer * layer;
......
......@@ -223,5 +223,6 @@ int gimp_image_preview_valid (GimpImage *, ChannelType);
void gimp_image_invalidate_preview (GimpImage *);
void gimp_image_invalidate_previews (void);
TempBuf * gimp_image_construct_composite_preview (GimpImage *gimage, int width, int height);
#endif
......@@ -80,6 +80,8 @@ static Argument *return_args;
static void grad_select_close_callback (GtkWidget *, gpointer);
static void grad_select_edit_callback (GtkWidget *, gpointer);
static void grad_change_callbacks(GradSelectP gsp, gint closing);
extern void import_palette_grad_update(gradient_t *); /* ALT Hmm... */
static ActionAreaItem action_items[2] =
{
......@@ -253,6 +255,7 @@ sel_update_dialogs(gint row, gradient_t *grad)
if(gradient_select_dialog)
gtk_clist_set_text(GTK_CLIST(gradient_select_dialog->clist),row,1,grad->name);
import_palette_grad_update(grad);
}
static void
......@@ -271,6 +274,7 @@ sel_list_item_update(GtkWidget *widget,
if(gsp == gradient_select_dialog)
{
grad_set_grad_to_name(gsp->grad->name);
import_palette_grad_update(gsp->grad);
}
else
{
......
......@@ -80,6 +80,8 @@ static Argument *return_args;
static void grad_select_close_callback (GtkWidget *, gpointer);
static void grad_select_edit_callback (GtkWidget *, gpointer);
static void grad_change_callbacks(GradSelectP gsp, gint closing);
extern void import_palette_grad_update(gradient_t *); /* ALT Hmm... */
static ActionAreaItem action_items[2] =
{
......@@ -253,6 +255,7 @@ sel_update_dialogs(gint row, gradient_t *grad)
if(gradient_select_dialog)
gtk_clist_set_text(GTK_CLIST(gradient_select_dialog->clist),row,1,grad->name);
import_palette_grad_update(grad);
}
static void
......@@ -271,6 +274,7 @@ sel_list_item_update(GtkWidget *widget,
if(gsp == gradient_select_dialog)
{
grad_set_grad_to_name(gsp->grad->name);
import_palette_grad_update(gsp->grad);
}
else
{
......
......@@ -33,8 +33,11 @@
#include "errors.h"
#include "general.h"
#include "gimprc.h"
#include "gradient_header.h"
#include "gradient.h"
#include "interface.h"
#include "palette.h"
#include "palette_entries.h"
#include "session.h"
#include "libgimp/gimpintl.h"
......@@ -50,88 +53,120 @@
#define PALETTE_EVENT_MASK GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_ENTER_NOTIFY_MASK
/* New palette code... */
#define SM_PREVIEW_WIDTH (96 + 2)
#define SM_PREVIEW_HEIGHT (33 + 2)
#define IMPORT_PREVIEW_WIDTH 80
#define IMPORT_PREVIEW_HEIGHT 80
#define MAX_IMAGE_COLOURS (10000*2)
typedef enum
{
GRAD_IMPORT = 0,
IMAGE_IMPORT = 1,
} ImportType;
struct _ImportDialog {
GtkWidget *dialog;
GtkWidget *preview;
GtkWidget *entry;
GtkWidget *select_area;
GtkWidget *select;
GtkWidget *image_list;
GtkWidget *image_menu_item_image;
GtkWidget *image_menu_item_gradient;
GtkWidget *optionmenu1_menu;
GtkWidget *type_option;
GtkWidget *threshold_scale;
GtkWidget *threshold_text;
GtkAdjustment *threshold;
GtkAdjustment *sample;
ImportType import_type;
GimpImage *gimage;
};
typedef struct _ImportDialog ImportDialog ,*ImportDialogP;
typedef struct _Palette _Palette, *PaletteP;
struct _Palette {
GtkWidget *shell;
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *menu;
GtkWidget *option_menu;
GtkWidget *color_area;
GtkWidget *scrolled_window;
GtkWidget *color_name;
GtkWidget *palette_ops;
GdkGC *gc;
GtkAdjustment *sbar_data;
PaletteEntriesP entries;
PaletteEntryP color;
GtkWidget *clist;
GtkWidget *popup_menu;
GtkWidget *popup_small_menu;
ColorSelectP color_select;
int color_select_active;
int scroll_offset;
int updating;
PaletteEntriesP entries;
PaletteEntryP color;
GdkGC *gc;
guint entry_sig_id;
gfloat zoom_factor; /* range from 0.1 to 4.0 */
gint columns;
gint freeze_update;
};
static void palette_create_palette_menu (PaletteP, PaletteEntriesP);
static PaletteEntryP palette_add_entry (PaletteEntriesP, char *, int, int, int);
static void palette_delete_entry (PaletteP);
static void palette_calc_scrollbar (PaletteP);
static void palette_entries_load (char *);
static GSList * palette_entries_insert_list (GSList *, PaletteEntriesP);
static void palette_entries_delete (char *);
static void palette_entries_save (PaletteEntriesP, char *);
static void palette_entries_free (PaletteEntriesP);
static void palette_entry_free (PaletteEntryP);
static void palette_entries_set_callback (GtkWidget *, gpointer);
static void palette_change_color (int, int, int, int);
static gint palette_color_area_expose (GtkWidget *, GdkEventExpose *, PaletteP);
static gint palette_color_area_events (GtkWidget *, GdkEvent *, PaletteP);
static void palette_scroll_update (GtkAdjustment *, gpointer);
static void palette_new_callback (GtkWidget *, gpointer);
static void palette_delete_callback (GtkWidget *, gpointer);
static void palette_refresh_callback (GtkWidget *, gpointer);
static void palette_edit_callback (GtkWidget *, gpointer);
static void palette_close_callback (GtkWidget *, gpointer);
static gint palette_dialog_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void palette_new_entries_callback (GtkWidget *, gpointer);
static void palette_add_entries_callback (GtkWidget *, gpointer, gpointer);
/* static void palette_merge_entries_callback (GtkWidget *, gpointer); */
static void palette_delete_entries_callback (GtkWidget *, gpointer);
static void palette_select_callback (int, int, int, ColorSelectState, void *);
static void palette_draw_entries (PaletteP);
static void palette_draw_current_entry (PaletteP);
static void palette_update_current_entry (PaletteP);
GSList *palette_entries_list = NULL;
static PaletteP palette = NULL;
static void palette_entries_free (PaletteEntriesP);
static void palette_entries_load (char *);
static void palette_entry_free (PaletteEntryP);
static void palette_entries_save (PaletteEntriesP, char *);
PaletteP create_palette_dialog ();
static void palette_draw_entries (PaletteP palette,gint row_start, gint column_highlight);
static void palette_insert_clist(PaletteP palette,PaletteEntriesP p_entries,gint pos);
static void redraw_palette(PaletteP palette);
static GSList * palette_entries_insert_list (GSList *list,PaletteEntriesP entries,gint pos);
void palette_clist_init(PaletteP palette);
static void palette_draw_small_preview(GdkGC *gc, PaletteEntriesP p_entry);
static void palette_scroll_clist_to_current(PaletteP palette);
static void palette_update_small_preview(PaletteP palette);
static void palette_scroll_top_left(PaletteP palette);
static ImportDialogP palette_import_dialog(PaletteP palette);
static void palette_import_dialog_callback (GtkWidget *w,gpointer client_data);
static void import_palette_create_from_image (GImage *gimage,guchar *pname,PaletteP palette);
static void palette_merge_dialog_callback (GtkWidget *w,gpointer client_data);
GSList *palette_entries_list = NULL;
static PaletteEntriesP default_palette_entries = NULL;
static int num_palette_entries = 0;
static unsigned char foreground[3] = { 0, 0, 0 };
static unsigned char background[3] = { 255, 255, 255 };
static ImportDialogP import_dialog = NULL;
static PaletteP top_level_palette = NULL;
/* Color select dialog */
/* static ColorSelectP color_select = NULL;
static int color_select_active = 0; */
static ActionAreaItem action_items[] =
static void
palette_entries_free (PaletteEntriesP entries)
{
{ N_("New"), palette_new_callback, NULL, NULL },
{ N_("Edit"), palette_edit_callback, NULL, NULL },
{ N_("Delete"), palette_delete_callback, NULL, NULL },
{ N_("Close"), palette_close_callback, NULL, NULL },
};
PaletteEntryP entry;
GSList * list;
list = entries->colors;
while (list)
{
entry = (PaletteEntryP) list->data;
palette_entry_free (entry);
list = list->next;
}
g_free (entries->name);
if (entries->filename)
g_free (entries->filename);
g_free (entries);
}
static MenuItem palette_ops[] =
static void
palette_entries_delete (char *filename)
{
{ N_("New Palette"), 0, 0, palette_new_entries_callback, NULL, NULL, NULL },
{ N_("Delete Palette"), 0, 0, palette_delete_entries_callback, NULL, NULL, NULL },
{ N_("Refresh Palettes"), 0, 0, palette_refresh_callback, NULL, NULL, NULL },
{ N_("Close"), 0, 0, palette_close_callback, NULL, NULL, NULL },
{ NULL, 0, 0, NULL, NULL, NULL, NULL },
};
if (filename)
unlink (filename);
}
void
palettes_init (int no_data)
......@@ -140,172 +175,36 @@ palettes_init (int no_data)
}
void
palettes_free ()
palette_free_palettes (void)
{
palette_free_palettes ();
}
GSList *list;
PaletteEntriesP entries;
void
palette_create ()
{
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *sbar;
GtkWidget *frame;
GtkWidget *options_box;
GtkWidget *arrow_hbox;
GtkWidget *label;
GtkWidget *arrow;
GtkWidget *menu_bar;
GtkWidget *menu_bar_item;
int i;
if (!palette)
{
palette = g_malloc (sizeof (_Palette));
list = palette_entries_list;
palette->entries = default_palette_entries;
palette->color = NULL;
palette->color_select = NULL;
palette->color_select_active = 0;
palette->scroll_offset = 0;
palette->gc = NULL;
palette->updating = FALSE;
/* The shell and main vbox */
palette->shell = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (palette->shell), "color_palette", "Gimp");
session_set_window_geometry (palette->shell, &palette_session_info, FALSE);
gtk_window_set_policy (GTK_WINDOW (palette->shell), FALSE, FALSE, FALSE);
gtk_window_set_title (GTK_WINDOW (palette->shell), _("Color Palette"));
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_border_width (GTK_CONTAINER (vbox), 1);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (palette->shell)->vbox), vbox, TRUE, TRUE, 0);
/* handle the wm close event */
gtk_signal_connect (GTK_OBJECT (palette->shell), "delete_event",
GTK_SIGNAL_FUNC (palette_dialog_delete_callback),
palette);
/* The palette options box */
options_box = gtk_hbox_new (FALSE, 1);
gtk_box_pack_start (GTK_BOX (vbox), options_box, FALSE, FALSE, 0);
/* The popup menu -- palette_ops */
for (i = 0; palette_ops[i].label; i++)
palette_ops[i].user_data = palette;
palette->palette_ops = build_menu (palette_ops, NULL);
/* The palette commands pulldown menu */
menu_bar = gtk_menu_bar_new ();
gtk_box_pack_start (GTK_BOX (options_box), menu_bar, FALSE, FALSE, 0);
menu_bar_item = gtk_menu_item_new ();
gtk_container_add (GTK_CONTAINER (menu_bar), menu_bar_item);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_bar_item), palette->palette_ops);
arrow_hbox = gtk_hbox_new (FALSE, 1);
gtk_container_add (GTK_CONTAINER (menu_bar_item), arrow_hbox);
label = gtk_label_new (_("Ops"));
arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
gtk_box_pack_start (GTK_BOX (arrow_hbox), arrow, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (arrow_hbox), label, FALSE, FALSE, 4);
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
gtk_misc_set_alignment (GTK_MISC (arrow), 0.5, 0.5);
gtk_widget_show (arrow);
gtk_widget_show (label);
gtk_widget_show (arrow_hbox);
gtk_widget_show (menu_bar_item);
gtk_widget_show (menu_bar);
/* The option menu */
palette->option_menu = gtk_option_menu_new ();
gtk_box_pack_start (GTK_BOX (options_box), palette->option_menu, TRUE, TRUE, 0);
gtk_widget_show (palette->option_menu);
gtk_widget_show (options_box);
/* The active color name */
palette->color_name = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (palette->color_name), _("Active Color Name"));
gtk_box_pack_start (GTK_BOX (vbox), palette->color_name, FALSE, FALSE, 0);
gtk_widget_show (palette->color_name);
/* The horizontal box containing preview & scrollbar */
hbox = gtk_hbox_new (FALSE, 1);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
palette->sbar_data = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, PREVIEW_HEIGHT, 1, 1, PREVIEW_HEIGHT));
gtk_signal_connect (GTK_OBJECT (palette->sbar_data), "value_changed",
(GtkSignalFunc) palette_scroll_update,
palette);
sbar = gtk_vscrollbar_new (palette->sbar_data);
gtk_box_pack_start (GTK_BOX (hbox), sbar, FALSE, FALSE, 0);
/* Create the color area window and the underlying image */
palette->color_area = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_size (GTK_PREVIEW (palette->color_area), PREVIEW_WIDTH, PREVIEW_HEIGHT);
gtk_widget_set_events (palette->color_area, PALETTE_EVENT_MASK);
gtk_signal_connect_after (GTK_OBJECT (palette->color_area), "expose_event",
(GtkSignalFunc) palette_color_area_expose,
palette);
gtk_signal_connect (GTK_OBJECT (palette->color_area), "event",
(GtkSignalFunc) palette_color_area_events,
palette);
gtk_container_add (GTK_CONTAINER (frame), palette->color_area);
gtk_widget_show (palette->color_area);
gtk_widget_show (sbar);
gtk_widget_show (frame);
gtk_widget_show (hbox);
if(no_data)
palettes_init(FALSE);
/* The action area */
action_items[0].user_data = palette;
action_items[1].user_data = palette;
action_items[2].user_data = palette;
action_items[3].user_data = palette;
build_action_area (GTK_DIALOG (palette->shell), action_items, 4, 0);
gtk_widget_show (vbox);
gtk_widget_show (palette->shell);
palette_create_palette_menu (palette, default_palette_entries);
palette_calc_scrollbar (palette);
}
else
while (list)
{
if (!GTK_WIDGET_VISIBLE (palette->shell))
{
gtk_widget_show (palette->shell);
}
else
{
gdk_window_raise(palette->shell->window);
}
}
}
entries = (PaletteEntriesP) list->data;
void
palette_free ()
{
if (palette)
{
gdk_gc_destroy (palette->gc);
/* If the palette has been changed, save it, if possible */
if (entries->changed)
/* save the palette */
palette_entries_save (entries, entries->filename);
if (palette->color_select)
color_select_free (palette->color_select);
palette_entries_free (entries);
list = g_slist_next (list);
}
g_slist_free (palette_entries_list);
session_get_window_info (palette->shell, &palette_session_info);
num_palette_entries = 0;
palette_entries_list = NULL;
}
g_free (palette);
palette = NULL;
}
void
palettes_free ()
{
palette_free_palettes ();
}
void
......@@ -398,9 +297,8 @@ palette_init_palettes (int no_data)
}
void
palette_free_palettes (void)
static void
palette_save_palettes()
{
GSList *list;
PaletteEntriesP entries;
......@@ -416,190 +314,49 @@ palette_free_palettes (void)
/* save the palette */
palette_entries_save (entries, entries->filename);
palette_entries_free (entries);
list = g_slist_next (list);
}
g_slist_free (palette_entries_list);
if (palette)
{
palette->entries = NULL;
palette->color = NULL;
palette->color_select = NULL;
palette->color_select_active = 0;
palette->scroll_offset = 0;
}
num_palette_entries = 0;
palette_entries_list = NULL;
}
/*****************************************/
/* Local functions */
/*****************************************/
static void
palette_create_palette_menu (PaletteP palette,
PaletteEntriesP default_entries)
palette_save_palettes_callback(GtkWidget *w,
gpointer client_data)
{
GtkWidget *menu_item;
GSList *list;
PaletteEntriesP p_entries = NULL;
PaletteEntriesP found_entries = NULL;
int i = 0;
int default_index = -1;
palette->menu = gtk_menu_new ();
list = palette_entries_list;
while (list)
{
p_entries = (PaletteEntriesP) list->data;
list = g_slist_next (list);
/* to make sure we get something! */
if (p_entries == NULL)
{
found_entries = p_entries;
default_index = i;
}
if (p_entries == default_entries)
{
found_entries = default_entries;
default_index = i;
}
menu_item = gtk_menu_item_new_with_label (p_entries->name);
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
(GtkSignalFunc) palette_entries_set_callback,