Commit 4c070aff authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/widgets/gimppaletteeditor.[ch] app/gui/palette-editor-commands.[ch]

2003-05-26  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimppaletteeditor.[ch]
	* app/gui/palette-editor-commands.[ch]
	* app/gui/palette-editor-menu.c: started to clean up the palette
	editor: added buttons for all menu items and menu items for all
	buttons. Improved selected palette entry handling. Moved all code
	to gimppaletteeditor.c and call it from the menu callbacks.  Lots
	of cleanup (unfinished).
parent 2f31d12f
2003-05-26 Michael Natterer <mitch@gimp.org>
* app/widgets/gimppaletteeditor.[ch]
* app/gui/palette-editor-commands.[ch]
* app/gui/palette-editor-menu.c: started to clean up the palette
editor: added buttons for all menu items and menu items for all
buttons. Improved selected palette entry handling. Moved all code
to gimppaletteeditor.c and call it from the menu callbacks. Lots
of cleanup (unfinished).
2003-05-26 Pedro Gimeno <pggimeno@wanadoo.es>
* app/tools/gimpeditselectiontool.c (selection_transform_segs):
......@@ -20,31 +20,12 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimppalette.h"
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimptoolbox-color-area.h"
#include "color-notebook.h"
#include "dialogs.h"
#include "palette-editor-commands.h"
#include "gimp-intl.h"
/* local function prototypes */
static void palette_editor_color_notebook_callback (ColorNotebook *color_notebook,
const GimpRGB *color,
ColorNotebookState state,
gpointer data);
/* public functions */
......@@ -53,26 +34,10 @@ palette_editor_new_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor;
GimpPalette *palette;
GimpContext *user_context;
GimpRGB color;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
if (! palette)
return;
user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->gimp);
if (active_color == FOREGROUND)
gimp_context_get_foreground (user_context, &color);
else if (active_color == BACKGROUND)
gimp_context_get_background (user_context, &color);
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
editor->color = gimp_palette_add_entry (palette, NULL, &color);
if (GTK_WIDGET_SENSITIVE (editor->edit_button))
gtk_button_clicked (GTK_BUTTON (editor->edit_button));
}
void
......@@ -80,44 +45,10 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor;
GimpPalette *palette;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
if (! (palette && editor->color))
return;
if (! editor->color_notebook)
{
editor->color_notebook =
color_notebook_viewable_new (GIMP_VIEWABLE (palette),
_("Edit Palette Color"),
GTK_STOCK_SELECT_COLOR,
_("Edit Color Palette Entry"),
global_dialog_factory,
"gimp-palette-editor-color-dialog",
(const GimpRGB *) &editor->color->color,
palette_editor_color_notebook_callback,
editor,
FALSE, FALSE);
editor->color_notebook_active = TRUE;
}
else
{
if (! editor->color_notebook_active)
{
color_notebook_set_viewable (editor->color_notebook,
GIMP_VIEWABLE (palette));
color_notebook_show (editor->color_notebook);
editor->color_notebook_active = TRUE;
}
color_notebook_set_color (editor->color_notebook,
&editor->color->color);
}
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->edit_button))
gtk_button_clicked (GTK_BUTTON (editor->edit_button));
}
void
......@@ -125,64 +56,41 @@ palette_editor_delete_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor;
GimpPalette *palette;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->delete_button))
gtk_button_clicked (GTK_BUTTON (editor->delete_button));
}
if (! (palette && editor->color))
return;
void
palette_editor_zoom_in_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
gimp_palette_delete_entry (palette, editor->color);
if (GTK_WIDGET_SENSITIVE (editor->zoom_in_button))
gtk_button_clicked (GTK_BUTTON (editor->zoom_in_button));
}
void
palette_editor_zoom_out_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
/* private functions */
if (GTK_WIDGET_SENSITIVE (editor->zoom_out_button))
gtk_button_clicked (GTK_BUTTON (editor->zoom_out_button));
}
static void
palette_editor_color_notebook_callback (ColorNotebook *color_notebook,
const GimpRGB *color,
ColorNotebookState state,
gpointer data)
void
palette_editor_zoom_all_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor;
GimpPalette *palette;
GimpContext *user_context;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->gimp);
switch (state)
{
case COLOR_NOTEBOOK_UPDATE:
break;
case COLOR_NOTEBOOK_OK:
if (editor->color)
{
editor->color->color = *color;
/* Update either foreground or background colors */
if (active_color == FOREGROUND)
gimp_context_set_foreground (user_context, color);
else if (active_color == BACKGROUND)
gimp_context_set_background (user_context, color);
gimp_data_dirty (GIMP_DATA (palette));
}
/* Fallthrough */
case COLOR_NOTEBOOK_CANCEL:
if (editor->color_notebook_active)
{
color_notebook_hide (editor->color_notebook);
editor->color_notebook_active = FALSE;
}
}
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->zoom_all_button))
gtk_button_clicked (GTK_BUTTON (editor->zoom_all_button));
}
......@@ -30,5 +30,15 @@ void palette_editor_delete_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void palette_editor_zoom_in_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void palette_editor_zoom_out_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void palette_editor_zoom_all_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __PALETTE_EDITOR_COMMANDS_H__ */
......@@ -20,31 +20,12 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimppalette.h"
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimptoolbox-color-area.h"
#include "color-notebook.h"
#include "dialogs.h"
#include "palette-editor-commands.h"
#include "gimp-intl.h"
/* local function prototypes */
static void palette_editor_color_notebook_callback (ColorNotebook *color_notebook,
const GimpRGB *color,
ColorNotebookState state,
gpointer data);
/* public functions */
......@@ -53,26 +34,10 @@ palette_editor_new_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor;
GimpPalette *palette;
GimpContext *user_context;
GimpRGB color;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
if (! palette)
return;
user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->gimp);
if (active_color == FOREGROUND)
gimp_context_get_foreground (user_context, &color);
else if (active_color == BACKGROUND)
gimp_context_get_background (user_context, &color);
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
editor->color = gimp_palette_add_entry (palette, NULL, &color);
if (GTK_WIDGET_SENSITIVE (editor->edit_button))
gtk_button_clicked (GTK_BUTTON (editor->edit_button));
}
void
......@@ -80,44 +45,10 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor;
GimpPalette *palette;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
if (! (palette && editor->color))
return;
if (! editor->color_notebook)
{
editor->color_notebook =
color_notebook_viewable_new (GIMP_VIEWABLE (palette),
_("Edit Palette Color"),
GTK_STOCK_SELECT_COLOR,
_("Edit Color Palette Entry"),
global_dialog_factory,
"gimp-palette-editor-color-dialog",
(const GimpRGB *) &editor->color->color,
palette_editor_color_notebook_callback,
editor,
FALSE, FALSE);
editor->color_notebook_active = TRUE;
}
else
{
if (! editor->color_notebook_active)
{
color_notebook_set_viewable (editor->color_notebook,
GIMP_VIEWABLE (palette));
color_notebook_show (editor->color_notebook);
editor->color_notebook_active = TRUE;
}
color_notebook_set_color (editor->color_notebook,
&editor->color->color);
}
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->edit_button))
gtk_button_clicked (GTK_BUTTON (editor->edit_button));
}
void
......@@ -125,64 +56,41 @@ palette_editor_delete_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor;
GimpPalette *palette;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->delete_button))
gtk_button_clicked (GTK_BUTTON (editor->delete_button));
}
if (! (palette && editor->color))
return;
void
palette_editor_zoom_in_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
gimp_palette_delete_entry (palette, editor->color);
if (GTK_WIDGET_SENSITIVE (editor->zoom_in_button))
gtk_button_clicked (GTK_BUTTON (editor->zoom_in_button));
}
void
palette_editor_zoom_out_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
/* private functions */
if (GTK_WIDGET_SENSITIVE (editor->zoom_out_button))
gtk_button_clicked (GTK_BUTTON (editor->zoom_out_button));
}
static void
palette_editor_color_notebook_callback (ColorNotebook *color_notebook,
const GimpRGB *color,
ColorNotebookState state,
gpointer data)
void
palette_editor_zoom_all_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpPaletteEditor *editor;
GimpPalette *palette;
GimpContext *user_context;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->gimp);
switch (state)
{
case COLOR_NOTEBOOK_UPDATE:
break;
case COLOR_NOTEBOOK_OK:
if (editor->color)
{
editor->color->color = *color;
/* Update either foreground or background colors */
if (active_color == FOREGROUND)
gimp_context_set_foreground (user_context, color);
else if (active_color == BACKGROUND)
gimp_context_set_background (user_context, color);
gimp_data_dirty (GIMP_DATA (palette));
}
/* Fallthrough */
case COLOR_NOTEBOOK_CANCEL:
if (editor->color_notebook_active)
{
color_notebook_hide (editor->color_notebook);
editor->color_notebook_active = FALSE;
}
}
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
if (GTK_WIDGET_SENSITIVE (editor->zoom_all_button))
gtk_button_clicked (GTK_BUTTON (editor->zoom_all_button));
}
......@@ -30,5 +30,15 @@ void palette_editor_delete_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void palette_editor_zoom_in_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void palette_editor_zoom_out_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void palette_editor_zoom_all_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __PALETTE_EDITOR_COMMANDS_H__ */
......@@ -35,21 +35,33 @@
GimpItemFactoryEntry palette_editor_menu_entries[] =
{
{ { N_("/New Color"), NULL,
{ { N_("/New Color"), "",
palette_editor_new_color_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL,
NULL, NULL },
{ { N_("/Edit Color..."), NULL,
NULL, NULL, NULL },
{ { N_("/Edit Color..."), "",
palette_editor_edit_color_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_EDIT },
NULL,
NULL, NULL },
{ { N_("/Delete Color"), NULL,
NULL, NULL, NULL },
{ { N_("/Delete Color"), "",
palette_editor_delete_color_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL,
NULL, NULL }
NULL, NULL, NULL },
{ { "/---", NULL, NULL, 0, "<Separator>", NULL }, NULL, NULL, NULL },
{ { N_("/Zoom In"), "",
palette_editor_zoom_in_cmd_callback, 0,
"<StockItem>", GTK_STOCK_ZOOM_IN },
NULL, NULL, NULL },
{ { N_("/Zoom Out"), "",
palette_editor_zoom_out_cmd_callback, 0,
"<StockItem>", GTK_STOCK_ZOOM_OUT },
NULL, NULL, NULL },
{ { N_("/Zoom All"), "",
palette_editor_zoom_all_cmd_callback, 0,
"<StockItem>", GTK_STOCK_ZOOM_FIT },
NULL, NULL, NULL }
};
gint n_palette_editor_menu_entries = G_N_ELEMENTS (palette_editor_menu_entries);
......@@ -60,15 +72,25 @@ palette_editor_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpPaletteEditor *editor;
GimpDataEditor *data_editor;
gboolean editable = FALSE;
editor = GIMP_PALETTE_EDITOR (data);
editor = GIMP_PALETTE_EDITOR (data);
data_editor = GIMP_DATA_EDITOR (data);
if (data_editor->data && data_editor->data_editable)
editable = TRUE;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Color", TRUE);
SET_SENSITIVE ("/Edit Color...", editor->color);
SET_SENSITIVE ("/Delete Color", editor->color);
SET_SENSITIVE ("/New Color", editable);
SET_SENSITIVE ("/Edit Color...", editable && editor->color);
SET_SENSITIVE ("/Delete Color", editable && editor->color);
SET_SENSITIVE ("/Zoom In", data_editor->data);
SET_SENSITIVE ("/Zoom Out", data_editor->data);
SET_SENSITIVE ("/Zoom All", data_editor->data);
#undef SET_SENSITIVE
}
......@@ -44,6 +44,7 @@
#include "gimptoolbox-color-area.h"
#include "gui/color-notebook.h"
#include "gui/dialogs.h"
#include "gimp-intl.h"
......@@ -85,15 +86,24 @@ static void palette_editor_draw_entries (GimpPaletteEditor *editor,
static void palette_editor_redraw (GimpPaletteEditor *editor);
static void palette_editor_scroll_top_left (GimpPaletteEditor *editor);
static void palette_editor_select_entry (GimpPaletteEditor *editor,
GimpPaletteEntry *entry);
static void palette_editor_color_name_changed (GtkWidget *widget,
GimpPaletteEditor *editor);
static void palette_editor_columns_changed (GtkAdjustment *adj,
GimpPaletteEditor *editor);
static void palette_editor_zoom_in_callback (GtkWidget *widget,
static void palette_editor_new_clicked (GtkWidget *widget,
GimpPaletteEditor *editor);
static void palette_editor_edit_clicked (GtkWidget *widget,
GimpPaletteEditor *editor);
static void palette_editor_delete_clicked (GtkWidget *widget,
GimpPaletteEditor *editor);
static void palette_editor_zoom_out_callback (GtkWidget *widget,
static void palette_editor_zoom_in_clicked (GtkWidget *widget,
GimpPaletteEditor *editor);
static void palette_editor_zoom_all_callback (GtkWidget *widget,
static void palette_editor_zoom_out_clicked (GtkWidget *widget,
GimpPaletteEditor *editor);
static void palette_editor_zoom_all_clicked (GtkWidget *widget,
GimpPaletteEditor *editor);
static void palette_editor_redraw_zoom (GimpPaletteEditor *editor);
......@@ -108,6 +118,10 @@ static void palette_editor_drop_palette (GtkWidget *widget,
gpointer data);
static void palette_editor_invalidate_preview (GimpPalette *palette,
GimpPaletteEditor *editor);
static void palette_editor_color_notebook_callback (ColorNotebook *color_notebook,
const GimpRGB *color,
ColorNotebookState state,
gpointer data);
/* dnd stuff */
......@@ -181,7 +195,6 @@ gimp_palette_editor_init (GimpPaletteEditor *editor)
editor->zoom_factor = 1.0;
editor->columns = COLUMNS;
editor->columns_valid = TRUE;
editor->freeze_update = FALSE;
editor->scrolled_window = scrolledwindow =
gtk_scrolled_window_new (NULL, NULL);
......@@ -244,10 +257,9 @@ gimp_palette_editor_init (GimpPaletteEditor *editor)
gtk_widget_set_sensitive (editor->color_name, FALSE);
gtk_widget_show (editor->color_name);
editor->entry_sig_id =
g_signal_connect (editor->color_name, "changed",
G_CALLBACK (palette_editor_color_name_changed),
editor);
g_signal_connect (editor->color_name, "changed",
G_CALLBACK (palette_editor_color_name_changed),
editor);
label = gtk_label_new (_("Columns:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
......@@ -262,27 +274,53 @@ gimp_palette_editor_init (GimpPaletteEditor *editor)
G_CALLBACK (palette_editor_columns_changed),
editor);
/* + and - buttons */
gimp_editor_add_button (GIMP_EDITOR (editor),
GTK_STOCK_ZOOM_FIT,
_("Zoom All"), NULL,
G_CALLBACK (palette_editor_zoom_all_callback),
NULL,
editor);
gimp_editor_add_button (GIMP_EDITOR (editor),
GTK_STOCK_ZOOM_IN,
_("Zoom In"), NULL,
G_CALLBACK (palette_editor_zoom_in_callback),
NULL,
editor);
gimp_editor_add_button (GIMP_EDITOR (editor),
GTK_STOCK_ZOOM_OUT,
_("Zoom Out"), NULL,
G_CALLBACK (palette_editor_zoom_out_callback),
NULL,
editor);
editor->new_button =
gimp_editor_add_button (GIMP_EDITOR (editor),
GTK_STOCK_NEW,
_("New Color"), NULL,
G_CALLBACK (palette_editor_new_clicked),
NULL,
editor);
editor->edit_button =
gimp_editor_add_button (GIMP_EDITOR (editor),
GIMP_STOCK_EDIT,
_("Edit Color"), NULL,
G_CALLBACK (palette_editor_edit_clicked),
NULL,
editor);
editor->delete_button =
gimp_editor_add_button (GIMP_EDITOR (editor),
GTK_STOCK_DELETE,
_("Delete Color"), NULL,
G_CALLBACK (palette_editor_delete_clicked),
NULL,
editor);
editor->zoom_in_button =
gimp_editor_add_button (GIMP_EDITOR (editor),
GTK_STOCK_ZOOM_IN,
_("Zoom In"), NULL,
G_CALLBACK (palette_editor_zoom_in_clicked),
NULL,
editor);
editor->zoom_out_button =
gimp_editor_add_button (GIMP_EDITOR (editor),
GTK_STOCK_ZOOM_OUT,
_("Zoom Out"), NULL,
G_CALLBACK (palette_editor_zoom_out_clicked),
NULL,
editor);
editor->zoom_all_button =
gimp_editor_add_button (GIMP_EDITOR (editor),
GTK_STOCK_ZOOM_FIT,
_("Zoom All"), NULL,
G_CALLBACK (palette_editor_zoom_all_clicked),
NULL,
editor);
}
static void
......@@ -295,8 +333,7 @@ gimp_palette_editor_destroy (GtkObject *object)
if (editor->color_notebook)
{
color_notebook_free (editor->color_notebook);
editor->color_notebook = NULL;
editor->color_notebook_active = FALSE;
editor->color_notebook = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
......@@ -309,11 +346,8 @@ gimp_palette_editor_unmap (GtkWidget *widget)
editor = GIMP_PALETTE_EDITOR (widget);
if (editor->color_notebook_active)
{
color_notebook_hide (editor->color_notebook);
editor->color_notebook_active = FALSE;
}
if (editor->color_notebook)
color_notebook_hide (editor->color_notebook);
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
}
......@@ -326,8 +360,6 @@ gimp_palette_editor_set_data (GimpDataEditor *editor,
palette_editor = GIMP_PALETTE_EDITOR (editor);
g_signal_handler_block (palette_editor->color_name,
palette_editor->entry_sig_id);
g_signal_handlers_block_by_func (palette_editor->columns_data,
palette_editor_columns_changed,
editor);
......@@ -337,8 +369,7 @@ gimp_palette_editor_set_data (GimpDataEditor *editor,
if (palette_editor->color_notebook)
{
color_notebook_free (palette_editor->color_notebook);
palette_editor->color_notebook = NULL;
palette_editor->color_notebook_active = FALSE;
palette_editor->color_notebook = NULL;
}
g_signal_handlers_disconnect_by_func (editor->data,
......@@ -346,12 +377,8 @@ gimp_palette_editor_set_data (GimpDataEditor *editor,
editor);
palette_editor->columns_valid = FALSE;
palette_editor->color = NULL;
gtk_entry_set_text (GTK_ENTRY (palette_editor->color_name),
_("Undefined"));
gtk_widget_set_sensitive (palette_editor->color_name, FALSE);
palette_editor_select_entry (palette_editor, NULL);
gtk_adjustment_set_value (palette_editor->columns_data, 0);
}
......@@ -380,8 +407,18 @@ gimp_palette_editor_set_data (GimpDataEditor *editor,
g_signal_handlers_unblock_by_func (palette_editor->columns_data,
palette_editor_columns_changed,
editor);
g_signal_handler_unblock (palette_editor->color_name,
palette_editor->entry_sig_id);
gtk_widget_set_sensitive (palette_editor->new_button,
editor->data_editable);
gtk_widget_set_sensitive (palette_editor->edit_button, FALSE);
gtk_widget_set_sensitive (palette_editor->delete_button, FALSE);
gtk_widget_set_sensitive (palette_editor->zoom_in_button,
editor->data != NULL);
gtk_widget_set_sensitive (palette_editor->zoom_out_but