Commit b280b493 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

don't use the global "the_gimp" variable.

2001-07-15  Michael Natterer  <mitch@gimp.org>

	* app/core/gimp.c: don't use the global "the_gimp" variable.

	* app/core/gimpimage-convert.c: don't update the display here.

	* app/gui/gui.c: connect to the images' "mode_changed" signal
	and update here.

	* app/gui/brush-editor.[ch]
	* app/gui/gradient-editor.[ch]
	* app/gui/palette-editor.[ch]: pass a "Gimp" pointer to all
	editors. Added an palette_name entry to the palette editor.

	* app/gui/colormap-dialog.[ch]: removed all the dialog stuff and
	made the constructor return a vbox so it can be integrated in a
	dockable. Lots of cleanup and removal of anqiuqe aretfacts.

	* app/gui/dialogs-constructors.[ch]: wrap the colormap dialog in
	a dockable.

	* app/gui/dialogs-commands.[ch]
	* app/gui/dialogs.c
	* app/gui/menus.c: integrate the new dockable, made the "Brushes.."
	etc. menu entries create dockbles. Moved the old dialogs and the
	test menu entries to "Old + Testing" and removed N_() so the .po
	files stay cruft-free.

	* app/gui/test-commands.[ch]: removed lots of stuff which is not
	"testing" any more.
parent de1202c7
2001-07-15 Michael Natterer <mitch@gimp.org>
* app/core/gimp.c: don't use the global "the_gimp" variable.
* app/core/gimpimage-convert.c: don't update the display here.
* app/gui/gui.c: connect to the images' "mode_changed" signal
and update here.
* app/gui/brush-editor.[ch]
* app/gui/gradient-editor.[ch]
* app/gui/palette-editor.[ch]: pass a "Gimp" pointer to all
editors. Added an palette_name entry to the palette editor.
* app/gui/colormap-dialog.[ch]: removed all the dialog stuff and
made the constructor return a vbox so it can be integrated in a
dockable. Lots of cleanup and removal of anqiuqe aretfacts.
* app/gui/dialogs-constructors.[ch]: wrap the colormap dialog in
a dockable.
* app/gui/dialogs-commands.[ch]
* app/gui/dialogs.c
* app/gui/menus.c: integrate the new dockable, made the "Brushes.."
etc. menu entries create dockbles. Moved the old dialogs and the
test menu entries to "Old + Testing" and removed N_() so the .po
files stay cruft-free.
* app/gui/test-commands.[ch]: removed lots of stuff which is not
"testing" any more.
2001-07-14 Sven Neumann <sven@gimp.org>
* app/pdb/display_cmds.c
......
......@@ -48,6 +48,22 @@ dialogs_create_toplevel_cmd_callback (GtkWidget *widget,
}
}
void
dialogs_create_dockable_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
if (action)
{
gchar *identifier;
identifier = g_quark_to_string ((GQuark) action);
if (identifier)
gimp_dialog_factory_dialog_raise (global_dock_factory, identifier);
}
}
void
dialogs_add_tab_cmd_callback (GtkWidget *widget,
gpointer data,
......
......@@ -23,6 +23,9 @@
void dialogs_create_toplevel_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_create_dockable_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_add_tab_cmd_callback (GtkWidget *widget,
gpointer data,
......
......@@ -412,7 +412,7 @@ gimp_set_busy (Gimp *gimp)
gimp->busy = TRUE;
if (gimp->gui_set_busy_func)
gimp->gui_set_busy_func (the_gimp);
gimp->gui_set_busy_func (gimp);
}
static gboolean
......@@ -452,7 +452,7 @@ gimp_unset_busy (Gimp *gimp)
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->gui_unset_busy_func)
gimp->gui_unset_busy_func (the_gimp);
gimp->gui_unset_busy_func (gimp);
/* FIXME: gimp_busy HACK */
gimp->busy = FALSE;
......
......@@ -117,7 +117,6 @@
#include "gimppalette.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "undo.h"
......@@ -757,10 +756,10 @@ gimp_image_convert (GimpImage *gimage,
}
if (
(old_type == RGB) &&
(!needs_quantize) &&
(palette_type == MAKE_PALETTE)
)
(old_type == RGB) &&
(!needs_quantize) &&
(palette_type == MAKE_PALETTE)
)
{
/* If this is an RGB image, and the user wanted a custom-built
......@@ -936,14 +935,6 @@ gimp_image_convert (GimpImage *gimage,
undo_push_group_end (gimage);
/* shrink wrap and update all views */
gimp_image_invalidate_layer_previews (gimage);
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gimage));
gdisplays_update_title (gimage);
gdisplays_update_full (gimage);
gimp_image_colormap_changed (gimage, -1);
gimp_image_mode_changed (gimage);
gimp_unset_busy (gimage->gimp);
......
......@@ -91,7 +91,7 @@
static void dialogs_indexed_palette_selected (GimpColormapDialog *dialog,
GimpContext *context);
GimpDockable *dockable);
static GtkWidget * dialogs_brush_tab_func (GimpDockable *dockable,
GimpDockbook *dockbook,
......@@ -117,6 +117,8 @@ static void dialogs_set_drawable_context_func (GimpDockable *dockable,
GimpContext *context);
static void dialogs_set_path_context_func (GimpDockable *dockable,
GimpContext *context);
static void dialogs_set_indexed_palette_context_func (GimpDockable *dockable,
GimpContext *context);
static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
const gchar *name,
......@@ -130,6 +132,9 @@ static void dialogs_drawable_view_image_changed (GimpContext *context,
static void dialogs_path_view_image_changed (GimpContext *context,
GimpImage *gimage,
GtkWidget *view);
static void dialogs_indexed_palette_image_changed (GimpContext *context,
GimpImage *gimage,
GimpColormapDialog *ipal);
/* public functions */
......@@ -218,21 +223,6 @@ dialogs_module_browser_get (GimpDialogFactory *factory,
return module_db_browser_new ();
}
GtkWidget *
dialogs_indexed_palette_get (GimpDialogFactory *factory,
GimpContext *context)
{
GimpColormapDialog *cmap_dlg;
cmap_dlg = gimp_colormap_dialog_create (context->gimp->images);
gtk_signal_connect (GTK_OBJECT (cmap_dlg), "selected",
GTK_SIGNAL_FUNC (dialogs_indexed_palette_selected),
factory->context);
return GTK_WIDGET (cmap_dlg);
}
GtkWidget *
dialogs_undo_history_get (GimpDialogFactory *factory,
GimpContext *context)
......@@ -288,6 +278,29 @@ dialogs_about_get (GimpDialogFactory *factory,
return about_dialog_create ();
}
GtkWidget *
dialogs_brush_editor_get (GimpDialogFactory *factory,
GimpContext *context)
{
return NULL;
}
GtkWidget *
dialogs_gradient_editor_get (GimpDialogFactory *factory,
GimpContext *context)
{
return NULL;
}
GtkWidget *
dialogs_palette_editor_get (GimpDialogFactory *factory,
GimpContext *context)
{
return NULL;
}
/* docks */
GtkWidget *
dialogs_dock_new (GimpDialogFactory *factory,
......@@ -672,6 +685,32 @@ dialogs_path_list_view_new (GimpDialogFactory *factory,
return dockable;
}
GtkWidget *
dialogs_indexed_palette_new (GimpDialogFactory *factory,
GimpContext *context)
{
GimpImage *gimage;
GtkWidget *view;
GtkWidget *dockable;
gimage = gimp_context_get_image (context);
view = gimp_colormap_dialog_new (gimage);
dockable = dialogs_dockable_new (view,
"Indexed Palette", "Colormap",
NULL,
dialogs_set_indexed_palette_context_func);
dialogs_set_indexed_palette_context_func (GIMP_DOCKABLE (dockable), context);
gtk_signal_connect (GTK_OBJECT (view), "selected",
GTK_SIGNAL_FUNC (dialogs_indexed_palette_selected),
dockable);
return dockable;
}
/* editor dialogs */
......@@ -688,7 +727,7 @@ dialogs_edit_brush_func (GimpData *data)
{
if (! brush_editor_dialog)
{
brush_editor_dialog = brush_editor_new ();
brush_editor_dialog = brush_editor_new (the_gimp);
}
brush_editor_set_brush (brush_editor_dialog, brush);
......@@ -710,7 +749,7 @@ dialogs_edit_gradient_func (GimpData *data)
if (! gradient_editor_dialog)
{
gradient_editor_dialog = gradient_editor_new ();
gradient_editor_dialog = gradient_editor_new (the_gimp);
}
gradient_editor_set_gradient (gradient_editor_dialog, gradient);
......@@ -727,7 +766,7 @@ dialogs_edit_palette_func (GimpData *data)
if (! palette_editor_dialog)
{
palette_editor_dialog = palette_editor_new ();
palette_editor_dialog = palette_editor_new (the_gimp);
}
palette_editor_set_palette (palette_editor_dialog, palette);
......@@ -738,25 +777,33 @@ dialogs_edit_palette_func (GimpData *data)
static void
dialogs_indexed_palette_selected (GimpColormapDialog *dialog,
GimpContext *context)
GimpDockable *dockable)
{
GimpImage *gimage;
GimpRGB color;
gint index;
gimage = gimp_colormap_dialog_image (dialog);
index = gimp_colormap_dialog_col_index (dialog);
gimp_rgba_set_uchar (&color,
gimage->cmap[index * 3],
gimage->cmap[index * 3 + 1],
gimage->cmap[index * 3 + 2],
255);
if (active_color == FOREGROUND)
gimp_context_set_foreground (context, &color);
else if (active_color == BACKGROUND)
gimp_context_set_background (context, &color);
GimpContext *context;
context = (GimpContext *) gtk_object_get_data (GTK_OBJECT (dialog),
"gimp-dialogs-context");
if (context)
{
GimpImage *gimage;
GimpRGB color;
gint index;
gimage = gimp_colormap_dialog_get_image (dialog);
index = gimp_colormap_dialog_col_index (dialog);
gimp_rgba_set_uchar (&color,
gimage->cmap[index * 3],
gimage->cmap[index * 3 + 1],
gimage->cmap[index * 3 + 2],
255);
if (active_color == FOREGROUND)
gimp_context_set_foreground (context, &color);
else if (active_color == BACKGROUND)
gimp_context_set_background (context, &color);
}
}
static GtkWidget *
......@@ -989,6 +1036,48 @@ dialogs_set_path_context_func (GimpDockable *dockable,
}
}
static void
dialogs_set_indexed_palette_context_func (GimpDockable *dockable,
GimpContext *context)
{
GimpColormapDialog *view;
view = (GimpColormapDialog *) gtk_object_get_data (GTK_OBJECT (dockable),
"gimp-dialogs-view");
if (view)
{
GimpContext *old_context;
old_context = (GimpContext *) gtk_object_get_data (GTK_OBJECT (view),
"gimp-dialogs-context");
if (old_context)
{
gtk_signal_disconnect_by_func (GTK_OBJECT (old_context),
GTK_SIGNAL_FUNC (dialogs_indexed_palette_image_changed),
view);
}
if (context)
{
gtk_signal_connect (GTK_OBJECT (context), "image_changed",
GTK_SIGNAL_FUNC (dialogs_indexed_palette_image_changed),
view);
dialogs_indexed_palette_image_changed (context,
gimp_context_get_image (context),
view);
}
else
{
dialogs_indexed_palette_image_changed (NULL, NULL, view);
}
gtk_object_set_data (GTK_OBJECT (view), "gimp-dialogs-context", context);
}
}
static GtkWidget *
dialogs_dockable_new (GtkWidget *widget,
const gchar *name,
......@@ -1025,3 +1114,11 @@ dialogs_path_view_image_changed (GimpContext *context,
{
paths_dialog_update (gimage);
}
static void
dialogs_indexed_palette_image_changed (GimpContext *context,
GimpImage *gimage,
GimpColormapDialog *ipal)
{
gimp_colormap_dialog_set_image (ipal, gimage);
}
......@@ -46,8 +46,6 @@ GtkWidget * dialogs_input_devices_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_module_browser_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_indexed_palette_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_undo_history_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_display_filters_get (GimpDialogFactory *factory,
......@@ -57,6 +55,13 @@ GtkWidget * dialogs_tips_get (GimpDialogFactory *factory,
GtkWidget * dialogs_about_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_brush_editor_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_gradient_editor_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_palette_editor_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_dock_new (GimpDialogFactory *factory,
GimpContext *context);
......@@ -96,6 +101,8 @@ GtkWidget * dialogs_channel_list_view_new (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_path_list_view_new (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_indexed_palette_new (GimpDialogFactory *factory,
GimpContext *context);
void dialogs_edit_brush_func (GimpData *data);
void dialogs_edit_gradient_func (GimpData *data);
......
......@@ -50,36 +50,40 @@ static const GimpDialogFactoryEntry toplevel_entries[] =
{ "gimp:preferences-dialog", dialogs_preferences_get, TRUE, FALSE, FALSE },
{ "gimp:input-devices-dialog", dialogs_input_devices_get, TRUE, FALSE, FALSE },
{ "gimp:module-browser-dialog", dialogs_module_browser_get, TRUE, FALSE, FALSE },
{ "gimp:indexed-palette-dialog", dialogs_indexed_palette_get, TRUE, FALSE, FALSE },
{ "gimp:undo-history-dialog", dialogs_undo_history_get, FALSE, FALSE, FALSE },
{ "gimp:display-filters-dialog", dialogs_display_filters_get, FALSE, FALSE, FALSE },
{ "gimp:tips-dialog", dialogs_tips_get, TRUE, FALSE, FALSE },
{ "gimp:about-dialog", dialogs_about_get, TRUE, FALSE, FALSE }
{ "gimp:about-dialog", dialogs_about_get, TRUE, FALSE, FALSE },
{ "gimp:brush-editor", dialogs_brush_editor_get, TRUE, TRUE, TRUE },
{ "gimp:gradient-editor", dialogs_gradient_editor_get, TRUE, TRUE, TRUE },
{ "gimp:palette-editor", dialogs_palette_editor_get, TRUE, TRUE, TRUE }
};
static const gint n_toplevel_entries = (sizeof (toplevel_entries) /
sizeof (toplevel_entries[0]));
static const GimpDialogFactoryEntry dock_entries[] =
{
{ "gimp:image-list", dialogs_image_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:brush-list", dialogs_brush_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:pattern-list", dialogs_pattern_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:gradient-list", dialogs_gradient_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:palette-list", dialogs_palette_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:tool-list", dialogs_tool_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:buffer-list", dialogs_buffer_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:image-grid", dialogs_image_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:brush-grid", dialogs_brush_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:pattern-grid", dialogs_pattern_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:gradient-grid", dialogs_gradient_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:palette-grid", dialogs_palette_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:tool-grid", dialogs_tool_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:buffer-grid", dialogs_buffer_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:layer-list", dialogs_layer_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:channel-list", dialogs_channel_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:path-list", dialogs_path_list_view_new, TRUE, FALSE, FALSE }
{ "gimp:image-list", dialogs_image_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:brush-list", dialogs_brush_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:pattern-list", dialogs_pattern_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:gradient-list", dialogs_gradient_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:palette-list", dialogs_palette_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:tool-list", dialogs_tool_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:buffer-list", dialogs_buffer_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:image-grid", dialogs_image_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:brush-grid", dialogs_brush_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:pattern-grid", dialogs_pattern_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:gradient-grid", dialogs_gradient_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:palette-grid", dialogs_palette_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:tool-grid", dialogs_tool_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:buffer-grid", dialogs_buffer_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:layer-list", dialogs_layer_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:channel-list", dialogs_channel_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:path-list", dialogs_path_list_view_new, TRUE, FALSE, FALSE },
{ "gimp:indexed-palette", dialogs_indexed_palette_new, FALSE, FALSE, FALSE }
};
static const gint n_dock_entries = (sizeof (dock_entries) /
sizeof (dock_entries[0]));
......
......@@ -82,7 +82,7 @@ static void brush_editor_brush_name_changed (GtkWidget *widget,
/* public functions */
BrushEditor *
brush_editor_new (void)
brush_editor_new (Gimp *gimp)
{
BrushEditor *brush_editor;
GtkWidget *vbox;
......
......@@ -26,7 +26,7 @@
typedef struct _BrushEditor BrushEditor;
BrushEditor * brush_editor_new (void);
BrushEditor * brush_editor_new (Gimp *gimp);
void brush_editor_set_brush (BrushEditor *brush_editor,
GimpBrush *brush);
......
......@@ -67,50 +67,36 @@ enum
static void gimp_colormap_dialog_class_init (GimpColormapDialogClass *klass);
static void gimp_colormap_dialog_init (GimpColormapDialog *colormap_dialog);
static void ipal_create_popup_menu (GimpColormapDialog *ipal);
static void ipal_create_popup_menu (GimpColormapDialog *ipal);
/* indexed palette routines */
static void ipal_draw (GimpColormapDialog *ipal);
static void ipal_clear (GimpColormapDialog *ipal);
static void ipal_set_image (GimpColormapDialog *ipal,
GimpImage *gimage);
static void ipal_clear (GimpColormapDialog *ipal,
gint start_row);
static void ipal_update_entries (GimpColormapDialog *ipal);
static void ipal_set_index (GimpColormapDialog *ipal,
gint i);
static void ipal_draw_cell (GimpColormapDialog *ipal,
gint col);
static void ipal_update_image_list (GimpColormapDialog *ipal);
/* indexed palette menu callbacks */
static void ipal_add_callback (GtkWidget *widget,
gpointer data);
static void ipal_edit_callback (GtkWidget *widget,
gpointer data);
static void ipal_close_callback (GtkWidget *widget,
gpointer data);
static void ipal_select_callback (ColorNotebook *color_notebook,
const GimpRGB *color,
ColorNotebookState state,
gpointer data);
/* event callback */
static gint ipal_area_events (GtkWidget *widget,
GdkEvent *event,
static gint ipal_area_button_press (GtkWidget *widget,
GdkEventButton *bevent,
GimpColormapDialog *ipal);
/* create image menu */
static void image_menu_callback (GtkWidget *widget,
gpointer data);
static GtkWidget * create_image_menu (GimpColormapDialog *ipal,
GimpImage **image,
gint *,
GtkSignalFunc );
static void frame_size_alloc_cb (GtkFrame *frame,
GtkAllocation *alloc,
GimpColormapDialog *ipal);
static void window_size_req_cb (GtkWindow *win,
GtkRequisition *req,
static void ipal_area_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
GimpColormapDialog *ipal);
static void index_adjustment_change_cb (GtkAdjustment *adjustment,
......@@ -118,26 +104,23 @@ static void index_adjustment_change_cb (GtkAdjustment *adjustment,
static void hex_entry_change_cb (GtkEntry *entry,
GimpColormapDialog *ipal);
static void container_addrem_cb (GimpContainer *container,
GimpImage *image,
static void image_mode_changed_cb (GimpImage *gimage,
GimpColormapDialog *ipal);
static void image_rename_cb (GimpImage *img,
GimpColormapDialog *ipal);
static void image_cmap_change_cb (GimpImage *img,
static void image_colormap_changed_cb (GimpImage *gimage,
gint ncol,
GimpColormapDialog *ipal);
static void palette_drag_color (GtkWidget *widget,
static void ipal_drag_color (GtkWidget *widget,
GimpRGB *color,
gpointer data);
static void palette_drop_color (GtkWidget *widget,
static void ipal_drop_color (GtkWidget *widget,
const GimpRGB *color,
gpointer data);
static guint gimp_colormap_dialog_signals[LAST_SIGNAL] = { 0 };
static GtkDialogClass *parent_class = NULL;
static GtkVBoxClass *parent_class = NULL;
/* dnd stuff */
......@@ -152,7 +135,7 @@ static guint n_color_palette_targets = (sizeof (color_palette_target_table) /
GtkType
gimp_colormap_dialog_get_type (void)
{
GtkType gimp_colormap_dialog_type = 0;
static GtkType gimp_colormap_dialog_type = 0;
if (! gimp_colormap_dialog_type)
{
......@@ -168,7 +151,7 @@ gimp_colormap_dialog_get_type (void)
NULL,
};
gimp_colormap_dialog_type = gtk_type_unique (GTK_TYPE_DIALOG, &info);
gimp_colormap_dialog_type = gtk_type_unique (GTK_TYPE_VBOX, &info);
}
return gimp_colormap_dialog_type;
......@@ -181,7 +164,7 @@ gimp_colormap_dialog_class_init (GimpColormapDialogClass* klass)
object_class = (GtkObjectClass*) klass;
parent_class = gtk_type_class (GTK_TYPE_DIALOG);
parent_class = gtk_type_class (GTK_TYPE_VBOX);
gimp_colormap_dialog_signals[SELECTED] =
gtk_signal_new ("selected",
......@@ -201,206 +184,105 @@ gimp_colormap_dialog_class_init (GimpColormapDialogClass* klass)
static void
gimp_colormap_dialog_init (GimpColormapDialog *colormap_dialog)
{
colormap_dialog->image = NULL;
colormap_dialog->col_index = 0;
colormap_dialog->dnd_col_index = 0;
colormap_dialog->vbox = NULL;
colormap_dialog->palette = NULL;
colormap_dialog->image_menu = NULL;
colormap_dialog->popup_menu = NULL;
colormap_dialog->option_menu = NULL;
colormap_dialog->context = NULL;
colormap_dialog->event_handler = 0;
colormap_dialog->xn = 0;
colormap_dialog->yn = 0;
colormap_dialog->cellsize = 0;
colormap_dialog->index_spinbutton = NULL;
colormap_dialog->index_adjustment = NULL;
colormap_dialog->color_entry = NULL;
colormap_dialog->rename_handler_id = 0;
colormap_dialog->cmap_changed_handler_id = 0;
colormap_dialog->add_item = NULL;
colormap_dialog->color_notebook = NULL;
colormap_dialog->image = NULL;
colormap_dialog->col_index = 0;
colormap_dialog->dnd_col_index = 0;
colormap_dialog->palette = NULL;
colormap_dialog->image_menu = NULL;
colormap_dialog->popup_menu = NULL;
colormap_dialog->option_menu = NULL;
colormap_dialog->xn = 0;
colormap_dialog->yn = 0;
colormap_dialog->cellsize = 0;
colormap_dialog->index_adjustment = NULL;
colormap_dialog->index_spinbutton = NULL;
colormap_dialog->color_entry = NULL;
colormap_dialog->add_item = NULL;
colormap_dialog->color_notebook = NULL;
}
GimpColormapDialog *
gimp_colormap_dialog_create (GimpContainer *context)
GtkWidget *
gimp_colormap_dialog_new (GimpImage *gimage)
{
GimpColormapDialog *ipal;
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *util_box;
GtkWidget *label;
GtkWidget *hbox;
GtkWidget *hbox2;
GtkWidget *entry;
GtkWidget *evbox;
GtkAccelGroup *accel_group;
g_return_val_if_fail (context != NULL, NULL);
g_return_val_if_fail (GIMP_IS_CONTAINER (context), NULL);
GtkWidget *frame;
GtkWidget *table;
g_return_val_if_fail (! gimage || GIMP_IS_IMAGE (gimage), NULL);
ipal = gtk_type_new (GIMP_TYPE_COLORMAP_DIALOG);
/* The action area */
gimp_dialog_create_action_area (GTK_DIALOG (ipal),
_("Close"), ipal_close_callback,
ipal, NULL, NULL, TRUE, TRUE,
NULL);
ipal->image = NULL;
ipal->context = context;
ipal->cmap_changed_handler_id =
gimp_container_add_handler (context,
"colormap_changed",
image_cmap_change_cb,
ipal);
ipal->rename_handler_id =
gimp_container_add_handler (context,
"name_changed",
image_rename_cb,
ipal);
accel_group = gtk_accel_group_new ();
gtk_window_set_wmclass (GTK_WINDOW (ipal), "indexed_color_palette", "Gimp");
dialog_register (GTK_WIDGET (ipal));
gtk_window_set_policy (GTK_WINDOW (ipal), TRUE, TRUE, TRUE);
gtk_window_set_title (GTK_WINDOW (ipal), _("Indexed Color Palette"));
gtk_window_add_accel_group (GTK_WINDOW (ipal), accel_group);
gtk_signal_connect (GTK_OBJECT (ipal), "delete_event",
GTK_SIGNAL_FUNC (gtk_widget_hide_on_delete),
NULL);
ipal->vbox = vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (ipal)->vbox), vbox);
/* The hbox to hold the command menu and image option menu box */
util_box = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (vbox), util_box, FALSE, FALSE, 0);
/* The GIMP image option menu */
label = gtk_label_new (_("Image:"));
gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 0);
ipal->option_menu = GTK_OPTION_MENU (gtk_option_menu_new ());
gtk_box_pack_start (GTK_BOX (util_box),
GTK_WIDGET (ipal->option_menu),
TRUE, TRUE, 0);
hbox2 = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox2, TRUE, TRUE, 0);
gtk_box_set_spacing (GTK_BOX (ipal), 2);
ipal_create_popup_menu (ipal);
/* The palette frame */