added a (commented out) function to open files (to get rid of including

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

	* app/core/gimp.[ch]: added a (commented out) function to open
	files (to get rid of including gui/file-open-dialog.h)

	* app/gui/file-open-dialog.[ch]
	* app/gui/file-save-dialog.[ch]: renamed all functions because they
	are no callbacks any more. Removed the _by_extension() callbacks.

	* app/gui/file-commands.[ch]: added the
	file_[open|save]_by_extension() callbaks here along with some
	other stuff which has nothing to do with the file dialogs.

	* app/gui/menus.c: added a helper function to create an item
	factory, cleanup.

	* app/gui/palette-editor.[ch]: contains only the editor for a
	single palette now (removed the notebook and the palette list).
	Renamed all functions to palette_editor_*(). Will be made a
	dockable later.

	* app/gui/palette-select.[ch]: made it work like the other
	selection dialogs.

	* app/app_procs.c
	* app/docindex.c
	* app/gui/dialogs-constructors.[ch]
	* app/gui/dialogs.c
	* app/gui/gradient-select.c
	* app/gui/gui.c
	* app/widgets/gimpdnd.c: changed accordingly.
This commit is contained in:
Michael Natterer 2001-07-09 17:58:56 +00:00 committed by Michael Natterer
parent c56094201d
commit b54b5ed6a0
35 changed files with 2050 additions and 2246 deletions

View File

@ -1,3 +1,35 @@
2001-07-09 Michael Natterer <mitch@gimp.org>
* app/core/gimp.[ch]: added a (commented out) function to open
files (to get rid of including gui/file-open-dialog.h)
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.[ch]: renamed all functions because they
are no callbacks any more. Removed the _by_extension() callbacks.
* app/gui/file-commands.[ch]: added the
file_[open|save]_by_extension() callbaks here along with some
other stuff which has nothing to do with the file dialogs.
* app/gui/menus.c: added a helper function to create an item
factory, cleanup.
* app/gui/palette-editor.[ch]: contains only the editor for a
single palette now (removed the notebook and the palette list).
Renamed all functions to palette_editor_*(). Will be made a
dockable later.
* app/gui/palette-select.[ch]: made it work like the other
selection dialogs.
* app/app_procs.c
* app/docindex.c
* app/gui/dialogs-constructors.[ch]
* app/gui/dialogs.c
* app/gui/gradient-select.c
* app/gui/gui.c
* app/widgets/gimpdnd.c: changed accordingly.
2001-07-08 Michael Natterer <mitch@gimp.org>
* app/disp_callbacks.c: the active_tool may change in the middle

View File

@ -20,26 +20,46 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "core/core-types.h"
#include "core/gimpimage.h"
#include "core/gimpobject.h"
#include "file-commands.h"
#include "file-new-dialog.h"
#include "file-open-dialog.h"
#include "file-save-dialog.h"
#include "menus.h"
#include "app_procs.h"
#include "file-open.h"
#include "file-save.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "menus.h"
#include "gimprc.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
#define REVERT_DATA_KEY "revert-confirm-dialog"
#define return_if_no_display(gdisp) \
gdisp = gdisplay_active (); \
if (!gdisp) return
/* local function prototypes */
static void file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data);
/* public functions */
void
file_new_cmd_callback (GtkWidget *widget,
gpointer data,
@ -62,11 +82,18 @@ file_new_cmd_callback (GtkWidget *widget,
file_new_dialog_create (gimage);
}
void
file_open_by_extension_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_open_dialog_menu_reset ();
}
void
file_open_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_open_callback (widget, data);
file_open_dialog_show ();
}
void
@ -86,7 +113,7 @@ file_last_opened_cmd_callback (GtkWidget *widget,
filename =
((GString *) g_slist_nth_data (last_opened_raw_filenames, action))->str;
status = file_open_with_display (filename, filename);
status = file_open_with_display (filename);
if (status != GIMP_PDB_SUCCESS &&
status != GIMP_PDB_CANCEL)
@ -95,32 +122,129 @@ file_last_opened_cmd_callback (GtkWidget *widget,
}
}
void
file_save_by_extension_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_save_dialog_menu_reset ();
}
void
file_save_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_save_callback (widget, data);
GDisplay *gdisp;
return_if_no_display (gdisp);
if (! gimp_image_active_drawable (gdisp->gimage))
return;
/* Only save if the gimage has been modified */
if (! gimprc.trust_dirty_flag || gdisp->gimage->dirty != 0)
{
gchar *filename;
filename = g_strdup (gimp_object_get_name (GIMP_OBJECT (gdisp->gimage)));
if (! filename)
{
file_save_as_cmd_callback (widget, data);
}
else
{
gchar *raw_filename;
gint status;
raw_filename = g_basename (filename);
status = file_save (gdisp->gimage,
filename,
raw_filename,
RUN_WITH_LAST_VALS,
TRUE);
if (status != GIMP_PDB_SUCCESS &&
status != GIMP_PDB_CANCEL)
{
g_message (_("Save failed.\n%s"), filename);
}
}
g_free (filename);
}
}
void
file_save_as_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_save_as_callback (widget, data);
GDisplay *gdisp;
return_if_no_display (gdisp);
file_save_dialog_show (gdisp->gimage);
}
void
file_save_a_copy_as_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_save_a_copy_as_callback (widget, data);
GDisplay *gdisp;
return_if_no_display (gdisp);
file_save_a_copy_dialog_show (gdisp->gimage);
}
void
file_revert_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_revert_callback (widget, data);
GDisplay *gdisp;
GtkWidget *query_box;
const gchar *filename;
return_if_no_display (gdisp);
filename = gimp_object_get_name (GIMP_OBJECT (gdisp->gimage));
query_box = gtk_object_get_data (GTK_OBJECT (gdisp->gimage), REVERT_DATA_KEY);
if (! filename)
{
g_message (_("Revert failed.\n"
"No filename associated with this image."));
}
else if (query_box)
{
gdk_window_raise (query_box->window);
}
else
{
gchar *text;
text = g_strdup_printf (_("Reverting %s to\n"
"%s\n\n"
"(You will lose all your changes\n"
"including all undo information)"),
g_basename (filename),
filename);
query_box = gimp_query_boolean_box (_("Revert Image?"),
gimp_standard_help_func,
"file/revert.html",
FALSE,
text,
_("Yes"), _("No"),
GTK_OBJECT (gdisp->gimage), "destroy",
file_revert_confirm_callback,
gdisp->gimage);
g_free (text);
gtk_object_set_data (GTK_OBJECT (gdisp->gimage), REVERT_DATA_KEY,
query_box);
gtk_widget_show (query_box);
}
}
void
@ -139,3 +263,48 @@ file_quit_cmd_callback (GtkWidget *widget,
{
app_exit (FALSE);
}
/* private functions */
static void
file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data)
{
GimpImage *old_gimage;
old_gimage = (GimpImage *) data;
gtk_object_set_data (GTK_OBJECT (old_gimage), REVERT_DATA_KEY, NULL);
if (revert)
{
GimpImage *new_gimage;
const gchar *filename;
gint status;
filename = gimp_object_get_name (GIMP_OBJECT (old_gimage));
new_gimage = file_open_image (old_gimage->gimp,
filename, filename,
_("Revert"),
NULL,
RUN_INTERACTIVE,
&status);
if (new_gimage != NULL)
{
undo_free (new_gimage);
gdisplays_reconnect (old_gimage, new_gimage);
gdisplays_resize_cursor_label (new_gimage);
gdisplays_update_full (new_gimage);
gdisplays_shrink_wrap (new_gimage);
gimp_image_clean_all (new_gimage);
}
else if (status != GIMP_PDB_CANCEL)
{
g_message (_("Revert failed.\n%s"), filename);
}
}
}

View File

@ -20,28 +20,35 @@
#define __FILE_COMMANDS_H__
void file_new_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_open_cmd_callback (GtkWidget *widget,
gpointer data);
void file_last_opened_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_cmd_callback (GtkWidget *widget,
gpointer data);
void file_save_as_cmd_callback (GtkWidget *widget,
gpointer data);
void file_save_a_copy_as_cmd_callback (GtkWidget *widget,
gpointer data);
void file_revert_cmd_callback (GtkWidget *widget,
gpointer data);
void file_pref_cmd_callback (GtkWidget *widget,
gpointer data);
void file_close_cmd_callback (GtkWidget *widget,
gpointer data);
void file_quit_cmd_callback (GtkWidget *widget,
gpointer data);
void file_new_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_open_by_extension_cmd_callback (GtkWidget *widget,
gpointer data);
void file_open_cmd_callback (GtkWidget *widget,
gpointer data);
void file_last_opened_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_by_extension_cmd_callback (GtkWidget *widget,
gpointer data);
void file_save_cmd_callback (GtkWidget *widget,
gpointer data);
void file_save_as_cmd_callback (GtkWidget *widget,
gpointer data);
void file_save_a_copy_as_cmd_callback (GtkWidget *widget,
gpointer data);
void file_revert_cmd_callback (GtkWidget *widget,
gpointer data);
void file_pref_cmd_callback (GtkWidget *widget,
gpointer data);
void file_close_cmd_callback (GtkWidget *widget,
gpointer data);
void file_quit_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __FILE_COMMANDS_H__ */

View File

@ -197,7 +197,7 @@ app_init (gint gimp_argc,
while (gimp_argc--)
{
if (*gimp_argv)
file_open_with_display (*gimp_argv, *gimp_argv);
file_open_with_display (*gimp_argv);
gimp_argv++;
}

View File

@ -382,6 +382,50 @@ gimp_create_display (Gimp *gimp,
gimp->create_display_func (gimage);
}
/*
void
gimp_open_file (Gimp *gimp,
const gchar *filename,
gboolean with_display)
{
GimpImage *gimage;
gint status;
g_return_if_fail (gimp != NULL);
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (filename != NULL);
gimage = file_open_image (gimp,
filename,
filename,
_("Open"),
NULL,
RUN_INTERACTIVE,
&status);
if (gimage)
{
gchar *absolute;
* enable & clear all undo steps *
gimp_image_undo_enable (gimage);
* set the image to clean *
gimp_image_clean_all (gimage);
if (with_display)
gimp_create_display (gimage->gimp, gimage);
absolute = file_open_absolute_filename (filename);
document_index_add (absolute);
menus_last_opened_add (absolute);
g_free (absolute);
}
}
*/
GimpContext *
gimp_create_context (Gimp *gimp,
const gchar *name,

View File

@ -58,7 +58,7 @@ struct _Gimp
GimpContainer *tool_info_list;
/* image_new values */
/* image_new values */
GList *image_base_type_names;
GList *fill_type_names;
GimpImageNewValues image_new_last_values;
@ -101,6 +101,12 @@ GimpImage * gimp_create_image (Gimp *gimp,
void gimp_create_display (Gimp *gimp,
GimpImage *gimage);
/*
void gimp_open_file (Gimp *gimp,
const gchar *filename,
gboolean with_display);
*/
GimpContext * gimp_create_context (Gimp *gimp,
const gchar *name,
GimpContext *template);

View File

@ -33,6 +33,7 @@
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimppalette.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpbrushfactoryview.h"
@ -66,6 +67,7 @@
#include "layers-commands.h"
#include "menus.h"
#include "palette-editor.h"
#include "palette-select.h"
#include "palettes-commands.h"
#include "paths-dialog.h"
#include "pattern-select.h"
@ -175,8 +177,8 @@ dialogs_gradient_select_get (GimpDialogFactory *factory,
}
GtkWidget *
dialogs_palette_get (GimpDialogFactory *factory,
GimpContext *context)
dialogs_palette_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return palette_dialog_create ();
}
@ -717,7 +719,18 @@ dialogs_edit_gradient_func (GimpData *data)
void
dialogs_edit_palette_func (GimpData *data)
{
palette_dialog_edit_palette (data);
static PaletteEditor *palette_editor_dialog = NULL;
GimpPalette *palette;
palette = GIMP_PALETTE (data);
if (! palette_editor_dialog)
{
palette_editor_dialog = palette_editor_new ();
}
palette_editor_set_palette (palette_editor_dialog, palette);
}

View File

@ -34,7 +34,7 @@ GtkWidget * dialogs_pattern_select_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_gradient_select_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_palette_get (GimpDialogFactory *factory,
GtkWidget * dialogs_palette_select_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context);

View File

@ -44,7 +44,7 @@ static const GimpDialogFactoryEntry toplevel_entries[] =
{ "gimp:brush-select-dialog", dialogs_brush_select_get, TRUE, TRUE, FALSE },
{ "gimp:pattern-select-dialog", dialogs_pattern_select_get, TRUE, TRUE, FALSE },
{ "gimp:gradient-select-dialog", dialogs_gradient_select_get, TRUE, TRUE, FALSE },
{ "gimp:palette-dialog", dialogs_palette_get, TRUE, TRUE, FALSE },
{ "gimp:palette-select-dialog", dialogs_palette_select_get, TRUE, TRUE, FALSE },
{ "gimp:error-console-dialog", dialogs_error_console_get, TRUE, TRUE, TRUE },
{ "gimp:document-index-dialog", dialogs_document_index_get, TRUE, TRUE, TRUE },
{ "gimp:preferences-dialog", dialogs_preferences_get, TRUE, FALSE, FALSE },

View File

@ -54,7 +54,6 @@
#include "app_procs.h"
#include "dialog_handler.h"
#include "docindex.h"
#include "gdisplay.h"
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
@ -63,32 +62,21 @@
#include "libgimp/gimpintl.h"
#define REVERT_DATA_KEY "revert_confirm_dialog"
/* local function prototypes */
static int file_open_with_proc_and_display (gchar *filename,
gchar *raw_filename,
PlugInProcDef *file_proc);
static void file_open_dialog_create (void);
static void file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data);
static void file_open_genbutton_callback (GtkWidget *widget,
gpointer data);
static void file_open_clistrow_callback (GtkWidget *widget,
gint row);
static void file_open_ok_callback (GtkWidget *widget,
gpointer data);
static void file_open_type_callback (GtkWidget *widget,
gpointer data);
static GSList * clist_to_slist (GtkCList *file_list);
static gint file_open_with_proc_and_display (gchar *filename,
gchar *raw_filename,
PlugInProcDef *file_proc);
static void file_open_dialog_create (void);
static void file_open_genbutton_callback (GtkWidget *widget,
gpointer data);
static void file_open_clistrow_callback (GtkWidget *widget,
gint row);
static void file_open_ok_callback (GtkWidget *widget,
gpointer data);
static void file_open_type_callback (GtkWidget *widget,
gpointer data);
static GSList * clist_to_slist (GtkCList *file_list);
@ -112,7 +100,7 @@ extern GSList *display_list; /* from gdisplay.c */
/* public functions */
void
file_open_menu_init (void)
file_open_dialog_menu_init (void)
{
GimpItemFactoryEntry entry;
PlugInProcDef *file_proc;
@ -137,6 +125,7 @@ file_open_menu_init (void)
entry.entry.callback = file_open_type_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.quark_string = NULL;
entry.help_page = help_page;
entry.description = NULL;
@ -145,10 +134,15 @@ file_open_menu_init (void)
}
void
file_open_callback (GtkWidget *widget,
gpointer data)
file_open_dialog_menu_reset (void)
{
if (!fileload)
load_file_proc = NULL;
}
void
file_open_dialog_show (void)
{
if (! fileload)
file_open_dialog_create ();
gtk_widget_set_sensitive (GTK_WIDGET (fileload), TRUE);
@ -162,81 +156,16 @@ file_open_callback (GtkWidget *widget,
file_dialog_show (fileload);
}
void
file_revert_callback (GtkWidget *widget,
gpointer data)
{
GDisplay *gdisplay;
GimpImage *gimage;
GtkWidget *query_box;
const gchar *filename;
gdisplay = gdisplay_active ();
if (!gdisplay || !gdisplay->gimage)
return;
gimage = gdisplay->gimage;
filename = gimp_object_get_name (GIMP_OBJECT (gimage));
query_box = gtk_object_get_data (GTK_OBJECT (gimage), REVERT_DATA_KEY);
if (! filename)
{
g_message (_("Revert failed.\n"
"No filename associated with this image."));
}
else if (query_box)
{
gdk_window_raise (query_box->window);
}
else
{
gchar *text;
text = g_strdup_printf (_("Reverting %s to\n"
"%s\n\n"
"(You will lose all your changes\n"
"including all undo information)"),
g_basename (filename),
filename);
query_box = gimp_query_boolean_box (_("Revert Image?"),
gimp_standard_help_func,
"file/revert.html",
FALSE,
text,
_("Yes"), _("No"),
GTK_OBJECT (gimage), "destroy",
file_revert_confirm_callback,
gimage);
g_free (text);
gtk_object_set_data (GTK_OBJECT (gimage), REVERT_DATA_KEY, query_box);
gtk_widget_show (query_box);
}
}
void
file_open_by_extension_callback (GtkWidget *widget,
gpointer data)
{
load_file_proc = NULL;
}
gint
file_open_with_display (gchar *filename,
gchar *raw_filename)
file_open_with_display (gchar *filename)
{
return file_open_with_proc_and_display (filename, raw_filename, NULL);
return file_open_with_proc_and_display (filename, filename, NULL);
}
/* private functions */
static int
static gint
file_open_with_proc_and_display (gchar *filename,
gchar *raw_filename,
PlugInProcDef *file_proc)
@ -916,45 +845,3 @@ clist_to_slist (GtkCList *file_list)
return list;
}
static void
file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data)
{
GimpImage *old_gimage;
old_gimage = (GimpImage *) data;
gtk_object_set_data (GTK_OBJECT (old_gimage), REVERT_DATA_KEY, NULL);
if (revert)
{
GimpImage *new_gimage;
const gchar *filename;
gint status;
filename = gimp_object_get_name (GIMP_OBJECT (old_gimage));
new_gimage = file_open_image (old_gimage->gimp,
filename, filename,
_("Revert"),
NULL,
RUN_INTERACTIVE,
&status);
if (new_gimage != NULL)
{
undo_free (new_gimage);
gdisplays_reconnect (old_gimage, new_gimage);
gdisplays_resize_cursor_label (new_gimage);
gdisplays_update_full (new_gimage);
gdisplays_shrink_wrap (new_gimage);
gimp_image_clean_all (new_gimage);
}
else if (status != GIMP_PDB_CANCEL)
{
g_message (_("Revert failed.\n%s"), filename);
}
}
}

View File

@ -20,19 +20,12 @@
#define __FILE_OPEN_DIALOG_H__
void file_open_menu_init (void);
void file_open_dialog_menu_init (void);
void file_open_dialog_menu_reset (void);
void file_open_callback (GtkWidget *widget,
gpointer data);
void file_open_dialog_show (void);
void file_revert_callback (GtkWidget *widget,
gpointer data);
void file_open_by_extension_callback (GtkWidget *widget,
gpointer data);
gint file_open_with_display (gchar *filename,
gchar *raw_filename);
gint file_open_with_display (gchar *filename);
#endif /* __FILE_OPEN_DIALOG_H__ */

View File

@ -41,7 +41,6 @@
#include "docindex.h"
#include "file-dialog-utils.h"
#include "file-save-dialog.h"
#include "gdisplay.h"
#include "menus.h"
#include "app_procs.h"
@ -90,7 +89,7 @@ static gboolean set_filename = TRUE;
/* public functions */
void
file_save_menu_init (void)
file_save_dialog_menu_init (void)
{
GimpItemFactoryEntry entry;
PlugInProcDef *file_proc;
@ -115,6 +114,7 @@ file_save_menu_init (void)
entry.entry.callback = file_save_type_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.quark_string = NULL;
entry.help_page = help_page;
entry.description = NULL;
@ -123,70 +123,20 @@ file_save_menu_init (void)
}
void
file_save_callback (GtkWidget *widget,
gpointer data)
file_save_dialog_menu_reset (void)
{
GDisplay *gdisplay;
gdisplay = gdisplay_active ();
if (! gdisplay)
return;
if (! gimp_image_active_drawable (gdisplay->gimage))
return;
/* Only save if the gimage has been modified */
if (!gimprc.trust_dirty_flag || gdisplay->gimage->dirty != 0)
{
gchar *filename;
filename =
g_strdup (gimp_object_get_name (GIMP_OBJECT (gdisplay->gimage)));
if (! filename)
{
file_save_as_callback (widget, data);
}
else
{
gchar *raw_filename;
gint status;
raw_filename = g_basename (filename);
status = file_save (gdisplay->gimage,
filename,
raw_filename,
RUN_WITH_LAST_VALS,
TRUE);
if (status != GIMP_PDB_SUCCESS &&
status != GIMP_PDB_CANCEL)
{
g_message (_("Save failed.\n%s"), filename);
}
}
g_free (filename);
}
save_file_proc = NULL;
}
void
file_save_as_callback (GtkWidget *widget,
gpointer data)
file_save_dialog_show (GimpImage *gimage)
{
GDisplay *gdisplay;
const gchar *filename;
gdisplay = gdisplay_active ();
if (! gdisplay)
if (! gimp_image_active_drawable (gimage))
return;
if (! gimp_image_active_drawable (gdisplay->gimage))
return;
the_gimage = gdisplay->gimage;
the_gimage = gimage;
set_filename = TRUE;
@ -206,7 +156,7 @@ file_save_as_callback (GtkWidget *widget,
filename :
"." G_DIR_SEPARATOR_S);
switch (gimp_drawable_type (gimp_image_active_drawable (gdisplay->gimage)))
switch (gimp_drawable_type (gimp_image_active_drawable (gimage)))
{
case RGB_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_RGB_IMAGE);
@ -232,26 +182,20 @@ file_save_as_callback (GtkWidget *widget,
}
void
file_save_a_copy_as_callback (GtkWidget *widget,
gpointer data)
file_save_a_copy_dialog_show (GimpImage *gimage)
{
GDisplay *gdisplay;
const gchar *filename;
gdisplay = gdisplay_active ();
if (! gdisplay)
if (! gimp_image_active_drawable (gimage))
return;
if (! gimp_image_active_drawable (gdisplay->gimage))
return;
the_gimage = gdisplay->gimage;
the_gimage = gimage;
set_filename = FALSE;
filename = gimp_object_get_name (GIMP_OBJECT (the_gimage));
if (!filesave)
if (! filesave)
file_save_dialog_create ();
gtk_widget_set_sensitive (GTK_WIDGET (filesave), TRUE);
@ -265,7 +209,7 @@ file_save_a_copy_as_callback (GtkWidget *widget,
filename :
"." G_DIR_SEPARATOR_S);
switch (gimp_drawable_type (gimp_image_active_drawable (gdisplay->gimage)))
switch (gimp_drawable_type (gimp_image_active_drawable (gimage)))
{
case RGB_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_RGB_IMAGE);
@ -290,13 +234,6 @@ file_save_a_copy_as_callback (GtkWidget *widget,
file_dialog_show (filesave);
}
void
file_save_by_extension_callback (GtkWidget *widget,
gpointer data)
{
save_file_proc = NULL;
}
/* private functions */
@ -475,8 +412,8 @@ file_overwrite (gchar *filename,
gchar *raw_filename)
{
OverwriteData *overwrite_data;
GtkWidget *query_box;
gchar *overwrite_text;
GtkWidget *query_box;
gchar *overwrite_text;
overwrite_data = g_new (OverwriteData, 1);
overwrite_data->full_filename = filename;

View File

@ -20,16 +20,11 @@
#define __FILE_SAVE_DIALOG_H__
void file_save_menu_init (void);
void file_save_dialog_menu_init (void);
void file_save_dialog_menu_reset (void);
void file_save_callback (GtkWidget *widget,
gpointer data);
void file_save_as_callback (GtkWidget *widget,
gpointer data);
void file_save_a_copy_as_callback (GtkWidget *widget,
gpointer data);
void file_save_by_extension_callback (GtkWidget *widget,
gpointer data);
void file_save_dialog_show (GimpImage *gimage);
void file_save_a_copy_dialog_show (GimpImage *gimage);
#endif /* __FILE_SAVE_DIALOG_H__ */

View File

@ -31,6 +31,7 @@
#include "widgets/gimpdnd.h"
#include "gui/file-commands.h"
#include "gui/file-open-dialog.h"
#include "dialog_handler.h"
@ -102,7 +103,7 @@ static GList *idea_list = NULL;
/* the ops buttons */
static GtkSignalFunc open_ext_callbacks[] =
{
idea_open_or_raise_callback, file_open_callback, NULL, NULL
idea_open_or_raise_callback, file_open_cmd_callback, NULL, NULL
};
static GtkSignalFunc raise_ext_callbacks[] =
@ -515,12 +516,12 @@ open_or_raise (gchar *file_name,
if (! pair.boole)
{
file_open_with_display (file_name, file_name);
file_open_with_display (file_name);
}
}
else
{
file_open_with_display (file_name, file_name);
file_open_with_display (file_name);
}
}
@ -617,7 +618,7 @@ idea_open_callback (GtkWidget *widget,
}
else
{
file_open_callback (widget, data);
file_open_dialog_show ();
}
}
@ -634,7 +635,7 @@ idea_open_or_raise_callback (GtkWidget *widget,
}
else
{
file_open_callback (widget, data);
file_open_dialog_show ();
}
}

View File

@ -33,6 +33,7 @@
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimppalette.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpbrushfactoryview.h"
@ -66,6 +67,7 @@
#include "layers-commands.h"
#include "menus.h"
#include "palette-editor.h"
#include "palette-select.h"
#include "palettes-commands.h"
#include "paths-dialog.h"
#include "pattern-select.h"
@ -175,8 +177,8 @@ dialogs_gradient_select_get (GimpDialogFactory *factory,
}
GtkWidget *
dialogs_palette_get (GimpDialogFactory *factory,
GimpContext *context)
dialogs_palette_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return palette_dialog_create ();
}
@ -717,7 +719,18 @@ dialogs_edit_gradient_func (GimpData *data)
void
dialogs_edit_palette_func (GimpData *data)
{
palette_dialog_edit_palette (data);
static PaletteEditor *palette_editor_dialog = NULL;
GimpPalette *palette;
palette = GIMP_PALETTE (data);
if (! palette_editor_dialog)
{
palette_editor_dialog = palette_editor_new ();
}
palette_editor_set_palette (palette_editor_dialog, palette);
}

View File

@ -34,7 +34,7 @@ GtkWidget * dialogs_pattern_select_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_gradient_select_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_palette_get (GimpDialogFactory *factory,
GtkWidget * dialogs_palette_select_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context);

View File

@ -44,7 +44,7 @@ static const GimpDialogFactoryEntry toplevel_entries[] =
{ "gimp:brush-select-dialog", dialogs_brush_select_get, TRUE, TRUE, FALSE },
{ "gimp:pattern-select-dialog", dialogs_pattern_select_get, TRUE, TRUE, FALSE },
{ "gimp:gradient-select-dialog", dialogs_gradient_select_get, TRUE, TRUE, FALSE },
{ "gimp:palette-dialog", dialogs_palette_get, TRUE, TRUE, FALSE },
{ "gimp:palette-select-dialog", dialogs_palette_select_get, TRUE, TRUE, FALSE },
{ "gimp:error-console-dialog", dialogs_error_console_get, TRUE, TRUE, TRUE },
{ "gimp:document-index-dialog", dialogs_document_index_get, TRUE, TRUE, TRUE },
{ "gimp:preferences-dialog", dialogs_preferences_get, TRUE, FALSE, FALSE },

View File

@ -20,26 +20,46 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "core/core-types.h"
#include "core/gimpimage.h"
#include "core/gimpobject.h"
#include "file-commands.h"
#include "file-new-dialog.h"
#include "file-open-dialog.h"
#include "file-save-dialog.h"
#include "menus.h"
#include "app_procs.h"
#include "file-open.h"
#include "file-save.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "menus.h"
#include "gimprc.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
#define REVERT_DATA_KEY "revert-confirm-dialog"
#define return_if_no_display(gdisp) \
gdisp = gdisplay_active (); \
if (!gdisp) return
/* local function prototypes */
static void file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data);
/* public functions */
void
file_new_cmd_callback (GtkWidget *widget,
gpointer data,
@ -62,11 +82,18 @@ file_new_cmd_callback (GtkWidget *widget,
file_new_dialog_create (gimage);
}
void
file_open_by_extension_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_open_dialog_menu_reset ();
}
void
file_open_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_open_callback (widget, data);
file_open_dialog_show ();
}
void
@ -86,7 +113,7 @@ file_last_opened_cmd_callback (GtkWidget *widget,
filename =
((GString *) g_slist_nth_data (last_opened_raw_filenames, action))->str;
status = file_open_with_display (filename, filename);
status = file_open_with_display (filename);
if (status != GIMP_PDB_SUCCESS &&
status != GIMP_PDB_CANCEL)
@ -95,32 +122,129 @@ file_last_opened_cmd_callback (GtkWidget *widget,
}
}
void
file_save_by_extension_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_save_dialog_menu_reset ();
}
void
file_save_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_save_callback (widget, data);
GDisplay *gdisp;
return_if_no_display (gdisp);
if (! gimp_image_active_drawable (gdisp->gimage))
return;
/* Only save if the gimage has been modified */
if (! gimprc.trust_dirty_flag || gdisp->gimage->dirty != 0)
{
gchar *filename;
filename = g_strdup (gimp_object_get_name (GIMP_OBJECT (gdisp->gimage)));
if (! filename)
{
file_save_as_cmd_callback (widget, data);
}
else
{
gchar *raw_filename;
gint status;
raw_filename = g_basename (filename);
status = file_save (gdisp->gimage,
filename,
raw_filename,
RUN_WITH_LAST_VALS,
TRUE);
if (status != GIMP_PDB_SUCCESS &&
status != GIMP_PDB_CANCEL)
{
g_message (_("Save failed.\n%s"), filename);
}
}
g_free (filename);
}
}
void
file_save_as_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_save_as_callback (widget, data);
GDisplay *gdisp;
return_if_no_display (gdisp);
file_save_dialog_show (gdisp->gimage);
}
void
file_save_a_copy_as_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_save_a_copy_as_callback (widget, data);
GDisplay *gdisp;
return_if_no_display (gdisp);
file_save_a_copy_dialog_show (gdisp->gimage);
}
void
file_revert_cmd_callback (GtkWidget *widget,
gpointer data)
{
file_revert_callback (widget, data);
GDisplay *gdisp;
GtkWidget *query_box;
const gchar *filename;
return_if_no_display (gdisp);
filename = gimp_object_get_name (GIMP_OBJECT (gdisp->gimage));
query_box = gtk_object_get_data (GTK_OBJECT (gdisp->gimage), REVERT_DATA_KEY);
if (! filename)
{
g_message (_("Revert failed.\n"
"No filename associated with this image."));
}
else if (query_box)
{
gdk_window_raise (query_box->window);
}
else
{
gchar *text;
text = g_strdup_printf (_("Reverting %s to\n"
"%s\n\n"
"(You will lose all your changes\n"
"including all undo information)"),
g_basename (filename),
filename);
query_box = gimp_query_boolean_box (_("Revert Image?"),
gimp_standard_help_func,
"file/revert.html",
FALSE,
text,
_("Yes"), _("No"),
GTK_OBJECT (gdisp->gimage), "destroy",
file_revert_confirm_callback,
gdisp->gimage);
g_free (text);
gtk_object_set_data (GTK_OBJECT (gdisp->gimage), REVERT_DATA_KEY,
query_box);
gtk_widget_show (query_box);
}
}
void
@ -139,3 +263,48 @@ file_quit_cmd_callback (GtkWidget *widget,
{
app_exit (FALSE);
}
/* private functions */
static void
file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data)
{
GimpImage *old_gimage;
old_gimage = (GimpImage *) data;
gtk_object_set_data (GTK_OBJECT (old_gimage), REVERT_DATA_KEY, NULL);
if (revert)
{
GimpImage *new_gimage;
const gchar *filename;
gint status;
filename = gimp_object_get_name (GIMP_OBJECT (old_gimage));
new_gimage = file_open_image (old_gimage->gimp,
filename, filename,
_("Revert"),
NULL,
RUN_INTERACTIVE,
&status);
if (new_gimage != NULL)
{
undo_free (new_gimage);
gdisplays_reconnect (old_gimage, new_gimage);
gdisplays_resize_cursor_label (new_gimage);
gdisplays_update_full (new_gimage);
gdisplays_shrink_wrap (new_gimage);
gimp_image_clean_all (new_gimage);
}
else if (status != GIMP_PDB_CANCEL)
{
g_message (_("Revert failed.\n%s"), filename);
}
}
}

View File

@ -20,28 +20,35 @@
#define __FILE_COMMANDS_H__
void file_new_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_open_cmd_callback (GtkWidget *widget,
gpointer data);
void file_last_opened_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_cmd_callback (GtkWidget *widget,
gpointer data);
void file_save_as_cmd_callback (GtkWidget *widget,
gpointer data);
void file_save_a_copy_as_cmd_callback (GtkWidget *widget,
gpointer data);
void file_revert_cmd_callback (GtkWidget *widget,
gpointer data);
void file_pref_cmd_callback (GtkWidget *widget,
gpointer data);
void file_close_cmd_callback (GtkWidget *widget,
gpointer data);
void file_quit_cmd_callback (GtkWidget *widget,
gpointer data);
void file_new_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_open_by_extension_cmd_callback (GtkWidget *widget,
gpointer data);
void file_open_cmd_callback (GtkWidget *widget,
gpointer data);
void file_last_opened_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void file_save_by_extension_cmd_callback (GtkWidget *widget,
gpointer data);
void file_save_cmd_callback (GtkWidget *widget,
gpointer data);
void file_save_as_cmd_callback (GtkWidget *widget,
gpointer data);
void file_save_a_copy_as_cmd_callback (GtkWidget *widget,
gpointer data);
void file_revert_cmd_callback (GtkWidget *widget,
gpointer data);
void file_pref_cmd_callback (GtkWidget *widget,
gpointer data);
void file_close_cmd_callback (GtkWidget *widget,
gpointer data);
void file_quit_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __FILE_COMMANDS_H__ */

View File

@ -54,7 +54,6 @@
#include "app_procs.h"
#include "dialog_handler.h"
#include "docindex.h"
#include "gdisplay.h"
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
@ -63,32 +62,21 @@
#include "libgimp/gimpintl.h"
#define REVERT_DATA_KEY "revert_confirm_dialog"
/* local function prototypes */
static int file_open_with_proc_and_display (gchar *filename,
gchar *raw_filename,
PlugInProcDef *file_proc);
static void file_open_dialog_create (void);
static void file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data);
static void file_open_genbutton_callback (GtkWidget *widget,
gpointer data);
static void file_open_clistrow_callback (GtkWidget *widget,
gint row);
static void file_open_ok_callback (GtkWidget *widget,
gpointer data);
static void file_open_type_callback (GtkWidget *widget,
gpointer data);
static GSList * clist_to_slist (GtkCList *file_list);
static gint file_open_with_proc_and_display (gchar *filename,
gchar *raw_filename,
PlugInProcDef *file_proc);
static void file_open_dialog_create (void);
static void file_open_genbutton_callback (GtkWidget *widget,
gpointer data);
static void file_open_clistrow_callback (GtkWidget *widget,
gint row);
static void file_open_ok_callback (GtkWidget *widget,
gpointer data);
static void file_open_type_callback (GtkWidget *widget,
gpointer data);
static GSList * clist_to_slist (GtkCList *file_list);
@ -112,7 +100,7 @@ extern GSList *display_list; /* from gdisplay.c */
/* public functions */
void
file_open_menu_init (void)
file_open_dialog_menu_init (void)
{
GimpItemFactoryEntry entry;
PlugInProcDef *file_proc;
@ -137,6 +125,7 @@ file_open_menu_init (void)
entry.entry.callback = file_open_type_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.quark_string = NULL;
entry.help_page = help_page;
entry.description = NULL;
@ -145,10 +134,15 @@ file_open_menu_init (void)
}
void
file_open_callback (GtkWidget *widget,
gpointer data)
file_open_dialog_menu_reset (void)
{
if (!fileload)
load_file_proc = NULL;
}
void
file_open_dialog_show (void)
{
if (! fileload)
file_open_dialog_create ();
gtk_widget_set_sensitive (GTK_WIDGET (fileload), TRUE);
@ -162,81 +156,16 @@ file_open_callback (GtkWidget *widget,
file_dialog_show (fileload);
}
void
file_revert_callback (GtkWidget *widget,
gpointer data)
{
GDisplay *gdisplay;
GimpImage *gimage;
GtkWidget *query_box;
const gchar *filename;
gdisplay = gdisplay_active ();
if (!gdisplay || !gdisplay->gimage)
return;
gimage = gdisplay->gimage;
filename = gimp_object_get_name (GIMP_OBJECT (gimage));
query_box = gtk_object_get_data (GTK_OBJECT (gimage), REVERT_DATA_KEY);
if (! filename)
{
g_message (_("Revert failed.\n"
"No filename associated with this image."));
}
else if (query_box)
{
gdk_window_raise (query_box->window);
}
else
{
gchar *text;
text = g_strdup_printf (_("Reverting %s to\n"
"%s\n\n"
"(You will lose all your changes\n"
"including all undo information)"),
g_basename (filename),
filename);
query_box = gimp_query_boolean_box (_("Revert Image?"),
gimp_standard_help_func,
"file/revert.html",
FALSE,
text,
_("Yes"), _("No"),
GTK_OBJECT (gimage), "destroy",
file_revert_confirm_callback,
gimage);
g_free (text);
gtk_object_set_data (GTK_OBJECT (gimage), REVERT_DATA_KEY, query_box);
gtk_widget_show (query_box);
}
}
void
file_open_by_extension_callback (GtkWidget *widget,
gpointer data)
{
load_file_proc = NULL;
}
gint
file_open_with_display (gchar *filename,
gchar *raw_filename)
file_open_with_display (gchar *filename)
{
return file_open_with_proc_and_display (filename, raw_filename, NULL);
return file_open_with_proc_and_display (filename, filename, NULL);
}
/* private functions */
static int
static gint
file_open_with_proc_and_display (gchar *filename,
gchar *raw_filename,
PlugInProcDef *file_proc)
@ -916,45 +845,3 @@ clist_to_slist (GtkCList *file_list)
return list;
}
static void
file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data)
{
GimpImage *old_gimage;
old_gimage = (GimpImage *) data;
gtk_object_set_data (GTK_OBJECT (old_gimage), REVERT_DATA_KEY, NULL);
if (revert)
{
GimpImage *new_gimage;
const gchar *filename;
gint status;
filename = gimp_object_get_name (GIMP_OBJECT (old_gimage));
new_gimage = file_open_image (old_gimage->gimp,
filename, filename,
_("Revert"),
NULL,
RUN_INTERACTIVE,
&status);
if (new_gimage != NULL)
{
undo_free (new_gimage);
gdisplays_reconnect (old_gimage, new_gimage);
gdisplays_resize_cursor_label (new_gimage);
gdisplays_update_full (new_gimage);
gdisplays_shrink_wrap (new_gimage);
gimp_image_clean_all (new_gimage);
}
else if (status != GIMP_PDB_CANCEL)
{
g_message (_("Revert failed.\n%s"), filename);
}
}
}

View File

@ -20,19 +20,12 @@
#define __FILE_OPEN_DIALOG_H__
void file_open_menu_init (void);
void file_open_dialog_menu_init (void);
void file_open_dialog_menu_reset (void);
void file_open_callback (GtkWidget *widget,
gpointer data);
void file_open_dialog_show (void);
void file_revert_callback (GtkWidget *widget,
gpointer data);
void file_open_by_extension_callback (GtkWidget *widget,
gpointer data);
gint file_open_with_display (gchar *filename,
gchar *raw_filename);
gint file_open_with_display (gchar *filename);
#endif /* __FILE_OPEN_DIALOG_H__ */

View File

@ -41,7 +41,6 @@
#include "docindex.h"
#include "file-dialog-utils.h"
#include "file-save-dialog.h"
#include "gdisplay.h"
#include "menus.h"
#include "app_procs.h"
@ -90,7 +89,7 @@ static gboolean set_filename = TRUE;
/* public functions */
void
file_save_menu_init (void)
file_save_dialog_menu_init (void)
{
GimpItemFactoryEntry entry;
PlugInProcDef *file_proc;
@ -115,6 +114,7 @@ file_save_menu_init (void)
entry.entry.callback = file_save_type_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.quark_string = NULL;
entry.help_page = help_page;
entry.description = NULL;
@ -123,70 +123,20 @@ file_save_menu_init (void)
}
void
file_save_callback (GtkWidget *widget,
gpointer data)
file_save_dialog_menu_reset (void)
{
GDisplay *gdisplay;
gdisplay = gdisplay_active ();
if (! gdisplay)
return;
if (! gimp_image_active_drawable (gdisplay->gimage))
return;
/* Only save if the gimage has been modified */
if (!gimprc.trust_dirty_flag || gdisplay->gimage->dirty != 0)
{
gchar *filename;
filename =
g_strdup (gimp_object_get_name (GIMP_OBJECT (gdisplay->gimage)));
if (! filename)
{
file_save_as_callback (widget, data);
}
else
{
gchar *raw_filename;
gint status;
raw_filename = g_basename (filename);
status = file_save (gdisplay->gimage,
filename,
raw_filename,
RUN_WITH_LAST_VALS,
TRUE);
if (status != GIMP_PDB_SUCCESS &&
status != GIMP_PDB_CANCEL)
{
g_message (_("Save failed.\n%s"), filename);
}
}
g_free (filename);
}
save_file_proc = NULL;
}
void
file_save_as_callback (GtkWidget *widget,
gpointer data)
file_save_dialog_show (GimpImage *gimage)
{
GDisplay *gdisplay;
const gchar *filename;
gdisplay = gdisplay_active ();
if (! gdisplay)
if (! gimp_image_active_drawable (gimage))
return;
if (! gimp_image_active_drawable (gdisplay->gimage))
return;
the_gimage = gdisplay->gimage;
the_gimage = gimage;
set_filename = TRUE;
@ -206,7 +156,7 @@ file_save_as_callback (GtkWidget *widget,
filename :
"." G_DIR_SEPARATOR_S);
switch (gimp_drawable_type (gimp_image_active_drawable (gdisplay->gimage)))
switch (gimp_drawable_type (gimp_image_active_drawable (gimage)))
{
case RGB_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_RGB_IMAGE);
@ -232,26 +182,20 @@ file_save_as_callback (GtkWidget *widget,
}
void
file_save_a_copy_as_callback (GtkWidget *widget,
gpointer data)
file_save_a_copy_dialog_show (GimpImage *gimage)
{
GDisplay *gdisplay;
const gchar *filename;
gdisplay = gdisplay_active ();
if (! gdisplay)
if (! gimp_image_active_drawable (gimage))
return;
if (! gimp_image_active_drawable (gdisplay->gimage))
return;
the_gimage = gdisplay->gimage;
the_gimage = gimage;
set_filename = FALSE;
filename = gimp_object_get_name (GIMP_OBJECT (the_gimage));
if (!filesave)
if (! filesave)
file_save_dialog_create ();
gtk_widget_set_sensitive (GTK_WIDGET (filesave), TRUE);
@ -265,7 +209,7 @@ file_save_a_copy_as_callback (GtkWidget *widget,
filename :
"." G_DIR_SEPARATOR_S);
switch (gimp_drawable_type (gimp_image_active_drawable (gdisplay->gimage)))
switch (gimp_drawable_type (gimp_image_active_drawable (gimage)))
{
case RGB_GIMAGE:
file_dialog_update_menus (save_procs, PLUG_IN_RGB_IMAGE);
@ -290,13 +234,6 @@ file_save_a_copy_as_callback (GtkWidget *widget,
file_dialog_show (filesave);
}
void
file_save_by_extension_callback (GtkWidget *widget,
gpointer data)
{
save_file_proc = NULL;
}
/* private functions */
@ -475,8 +412,8 @@ file_overwrite (gchar *filename,
gchar *raw_filename)
{
OverwriteData *overwrite_data;
GtkWidget *query_box;
gchar *overwrite_text;
GtkWidget *query_box;
gchar *overwrite_text;
overwrite_data = g_new (OverwriteData, 1);
overwrite_data->full_filename = filename;

View File

@ -20,16 +20,11 @@
#define __FILE_SAVE_DIALOG_H__
void file_save_menu_init (void);
void file_save_dialog_menu_init (void);
void file_save_dialog_menu_reset (void);
void file_save_callback (GtkWidget *widget,
gpointer data);
void file_save_as_callback (GtkWidget *widget,
gpointer data);
void file_save_a_copy_as_callback (GtkWidget *widget,
gpointer data);
void file_save_by_extension_callback (GtkWidget *widget,
gpointer data);
void file_save_dialog_show (GimpImage *gimage);
void file_save_a_copy_dialog_show (GimpImage *gimage);
#endif /* __FILE_SAVE_DIALOG_H__ */

View File

@ -84,7 +84,6 @@ gradient_dialog_free (void)
{
gradient_select_free (gradient_select_dialog);
gradient_select_dialog = NULL;
}
}

View File

@ -48,7 +48,7 @@
#include "gximage.h"
#include "image_render.h"
#include "menus.h"
#include "palette-editor.h"
#include "palette-select.h"
#include "palette-import-dialog.h"
#include "pattern-select.h"
#include "session.h"
@ -165,8 +165,8 @@ gui_init (Gimp *gimp)
gimprc.using_xserver_resolution = TRUE;
}
file_open_menu_init ();
file_save_menu_init ();
file_open_dialog_menu_init ();
file_save_dialog_menu_init ();
menus_reorder_plugins ();

View File

@ -27,7 +27,6 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "core/gimp.h"
@ -50,8 +49,6 @@
#include "dialogs-commands.h"
#include "edit-commands.h"
#include "file-commands.h"
#include "file-open-dialog.h"
#include "file-save-dialog.h"
#include "gradients-commands.h"
#include "image-commands.h"
#include "layers-commands.h"
@ -71,47 +68,46 @@
#include "libgimp/gimpintl.h"
#define MRU_MENU_ENTRY_SIZE (strlen ("/File/MRU00 ") + 1)
#define MRU_MENU_ACCEL_SIZE sizeof ("<control>0")
/* local function prototypes */
static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
gpointer callback_data,
guint callback_type,
gboolean create_tearoff,
gboolean static_entry);
static void menus_create_items (GtkItemFactory *item_factory,
guint n_entries,
GimpItemFactoryEntry *entries,
gpointer callback_data,
guint callback_type,
gboolean create_tearoff,
gboolean static_entries);
static void menus_create_branches (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry);
static void menus_init (void);
static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
gpointer callback_data,
guint callback_type,
gboolean create_tearoff,
gboolean static_entry);
static void menus_create_items (GtkItemFactory *item_factory,
guint n_entries,
GimpItemFactoryEntry *entries,
gpointer callback_data,
guint callback_type,
gboolean create_tearoff,
gboolean static_entries);
static void menus_create_branches (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry);
static void menus_init (void);
#ifdef ENABLE_NLS
static gchar *menu_translate (const gchar *path,
gpointer data);
static gchar * menus_menu_translate_func (const gchar *path,
gpointer data);
#else
#define menu_translate NULL
#define menus_menu_translate_func (NULL)
#endif
static void tearoff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
static gint tearoff_delete_cb (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void menus_tearoff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
static gint menus_tearoff_delete_cb (GtkWidget *widget,
GdkEvent *event,
gpointer data);
#ifdef ENABLE_DEBUG_ENTRY
static void menus_debug_recurse_menu (GtkWidget *menu,
gint depth,
gchar *path);
static void menus_debug_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
static void menus_debug_recurse_menu (GtkWidget *menu,
gint depth,
gchar *path);
static void menus_debug_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* ENABLE_DEBUG_ENTRY */
@ -133,10 +129,12 @@ static GimpItemFactoryEntry toolbox_entries[] =
BRANCH (N_("/_File")),
{ { N_("/File/New..."), "<control>N", file_new_cmd_callback, 0 },
{ { N_("/File/New..."), "<control>N",
file_new_cmd_callback, 0 },
NULL,
"file/dialogs/file_new.html", NULL },
{ { N_("/File/Open..."), "<control>O", file_open_cmd_callback, 0 },
{ { N_("/File/Open..."), "<control>O",
file_open_cmd_callback, 0 },
NULL,
"file/dialogs/file_open.html", NULL },
@ -182,7 +180,7 @@ static GimpItemFactoryEntry toolbox_entries[] =
"file/dialogs/gradient_selection.html", NULL },
{ { N_("/File/Dialogs/Palette..."), "<control>P",
dialogs_create_toplevel_cmd_callback, 0 },
"gimp:palette-dialog",
"gimp:palette-select-dialog",
"file/dialogs/palette_selection.html", NULL },
{ { N_("/File/Dialogs/Indexed Palette..."), NULL,
dialogs_create_toplevel_cmd_callback, 0 },
@ -344,7 +342,7 @@ static GtkItemFactory *toolbox_factory = NULL;
static GimpItemFactoryEntry image_entries[] =
{
{ { "/tearoff1", NULL, tearoff_cmd_callback, 0, "<Tearoff>" },
{ { "/tearoff1", NULL, menus_tearoff_cmd_callback, 0, "<Tearoff>" },
NULL,
NULL, NULL },
@ -800,7 +798,7 @@ static GimpItemFactoryEntry image_entries[] =
"dialogs/gradient_selection.html", NULL },
{ { N_("/Dialogs/Palette..."), "<control>P",
dialogs_create_toplevel_cmd_callback, 0 },
"gimp:palette-dialog",
"gimp:palette-select-dialog",
"dialogs/palette_selection.html", NULL },
{ { N_("/Dialogs/Indexed Palette..."), NULL,
dialogs_create_toplevel_cmd_callback, 0 },
@ -891,7 +889,7 @@ static GtkItemFactory *image_factory = NULL;
static GimpItemFactoryEntry load_entries[] =
{
{ { N_("/Automatic"), NULL,
file_open_by_extension_callback, 0 },
file_open_by_extension_cmd_callback, 0 },
NULL,
"open_by_extension.html", NULL },
@ -907,7 +905,7 @@ static GtkItemFactory *load_factory = NULL;
static GimpItemFactoryEntry save_entries[] =
{
{ { N_("/By Extension"), NULL,
file_save_by_extension_callback, 0 },
file_save_by_extension_cmd_callback, 0 },
NULL,
"save_by_extension.html", NULL },
@ -1617,12 +1615,13 @@ menus_create_branches (GtkItemFactory *item_factory,
{
GimpItemFactoryEntry tearoff_entry =
{
{ NULL, NULL, tearoff_cmd_callback, 0, "<Tearoff>" },
{ NULL, NULL, menus_tearoff_cmd_callback, 0, "<Tearoff>" },
NULL,
NULL, NULL
};
tearoff_entry.entry.path = tearoff_path->str;
menus_create_item (item_factory, &tearoff_entry, NULL, 2, TRUE, FALSE);
}
@ -1974,6 +1973,10 @@ menus_quit (void)
gtk_object_unref (GTK_OBJECT (channels_factory));
gtk_object_unref (GTK_OBJECT (paths_factory));
gtk_object_unref (GTK_OBJECT (dialogs_factory));
gtk_object_unref (GTK_OBJECT (brushes_factory));
gtk_object_unref (GTK_OBJECT (patterns_factory));
gtk_object_unref (GTK_OBJECT (gradients_factory));
gtk_object_unref (GTK_OBJECT (palettes_factory));
}
}
@ -1991,7 +1994,7 @@ menus_last_opened_update_labels (void)
path = g_string_new ("");
filename_slist = last_opened_raw_filenames;
num_entries = g_slist_length (last_opened_raw_filenames);
num_entries = g_slist_length (last_opened_raw_filenames);
for (i = 1; i <= num_entries; i++)
{
@ -2007,9 +2010,11 @@ menus_last_opened_update_labels (void)
gtk_label_set_text (GTK_LABEL (GTK_BIN (widget)->child),
entry_filename->str);
gimp_help_set_help_data (widget,
((GString *) filename_slist->data)->str, NULL);
gimp_help_set_help_data (widget,
((GString *) filename_slist->data)->str,
NULL);
}
filename_slist = filename_slist->next;
}
@ -2027,19 +2032,23 @@ menus_last_opened_add (gchar *filename)
g_return_if_fail (filename != NULL);
/* do nothing if we've already got the filename on the list */
/* see if we've already got the filename on the list */
for (list = last_opened_raw_filenames; list; list = g_slist_next (list))
{
raw_filename = list->data;
raw_filename = (GString *) list->data;
if (strcmp (raw_filename->str, filename) == 0)
{
/* the following lines would move the entry to the top
*
* last_opened_raw_filenames = g_slist_remove_link (last_opened_raw_filenames, list);
* last_opened_raw_filenames = g_slist_concat (list, last_opened_raw_filenames);
* menus_last_opened_update_labels ();
*/
/* move the entry to the top */
last_opened_raw_filenames =
g_slist_remove_link (last_opened_raw_filenames, list);
last_opened_raw_filenames =
g_slist_concat (list, last_opened_raw_filenames);
menus_last_opened_update_labels ();
return;
}
}
@ -2048,12 +2057,16 @@ menus_last_opened_add (gchar *filename)
if (num_entries == gimprc.last_opened_size)
{
list = g_slist_last (last_opened_raw_filenames);
if (list)
GSList *oldest;
oldest = g_slist_last (last_opened_raw_filenames);
if (oldest)
{
g_string_free ((GString *)list->data, TRUE);
last_opened_raw_filenames =
g_slist_remove (last_opened_raw_filenames, list);
g_string_free ((GString *) oldest->data, TRUE);
last_opened_raw_filenames = g_slist_remove (last_opened_raw_filenames,
oldest);
}
}
@ -2076,43 +2089,33 @@ menus_init_mru (void)
{
GimpItemFactoryEntry *last_opened_entries;
GtkWidget *menu_item;
gchar *paths;
gchar *accelerators;
gint i;
last_opened_entries = g_new (GimpItemFactoryEntry, gimprc.last_opened_size);
paths = g_new (gchar, gimprc.last_opened_size * MRU_MENU_ENTRY_SIZE);
accelerators = g_new (gchar, 9 * MRU_MENU_ACCEL_SIZE);
for (i = 0; i < gimprc.last_opened_size; i++)
{
gchar *path, *accelerator;
last_opened_entries[i].entry.path =
g_strdup_printf ("/File/MRU%02d", i + 1);
path = &paths[i * MRU_MENU_ENTRY_SIZE];
if (i < 9)
accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE];
last_opened_entries[i].entry.accelerator =
g_strdup_printf ("<control>%d", i + 1);
else
accelerator = NULL;
last_opened_entries[i].entry.path = path;
last_opened_entries[i].entry.accelerator = accelerator;
last_opened_entries[i].entry.accelerator = NULL;
last_opened_entries[i].entry.callback = file_last_opened_cmd_callback;
last_opened_entries[i].entry.callback_action = i;
last_opened_entries[i].entry.item_type = NULL;
last_opened_entries[i].quark_string = NULL;
last_opened_entries[i].help_page = "file/last_opened.html";
last_opened_entries[i].description = NULL;
g_snprintf (path, MRU_MENU_ENTRY_SIZE, "/File/MRU%02d", i + 1);
if (accelerator != NULL)
g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "<control>%d", i + 1);
last_opened_entries[i].quark_string = NULL;
last_opened_entries[i].help_page = "file/last_opened.html";
last_opened_entries[i].description = NULL;
}
menus_create_items (toolbox_factory, gimprc.last_opened_size,
last_opened_entries, NULL, 2, TRUE, FALSE);
for (i=0; i < gimprc.last_opened_size; i++)
for (i = 0; i < gimprc.last_opened_size; i++)
{
menu_item =
gtk_item_factory_get_widget (toolbox_factory,
@ -2129,8 +2132,12 @@ menus_init_mru (void)
if (menu_item && menu_item->parent)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1);
g_free (paths);
g_free (accelerators);
for (i = 0; i < gimprc.last_opened_size; i++)
{
g_free (last_opened_entries[i].entry.path);
g_free (last_opened_entries[i].entry.accelerator);
}
g_free (last_opened_entries);
}
@ -2321,6 +2328,38 @@ menus_create_items (GtkItemFactory *item_factory,
}
}
static GtkItemFactory *
menus_item_factory_new (GtkType container_type,
const gchar *path,
const gchar *factory_path,
guint n_entries,
GimpItemFactoryEntry *entries,
gpointer callback_data,
gboolean create_tearoff)
{
GtkItemFactory *item_factory;
item_factory = gtk_item_factory_new (container_type, path, NULL);
gtk_item_factory_set_translate_func (item_factory,
menus_menu_translate_func,
(gpointer) path,
NULL);
gtk_object_set_data (GTK_OBJECT (item_factory), "factory_path",
(gpointer) factory_path);
menus_create_items (item_factory,
n_entries,
entries,
callback_data,
2,
create_tearoff,
TRUE);
return item_factory;
}
static void
menus_init (void)
{
@ -2334,151 +2373,91 @@ menus_init (void)
menus_initialized = TRUE;
toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<Toolbox>", NULL);
gtk_object_set_data (GTK_OBJECT (toolbox_factory), "factory_path",
(gpointer) "toolbox");
gtk_item_factory_set_translate_func (toolbox_factory, menu_translate,
"<Toolbox>", NULL);
menus_create_items (toolbox_factory,
n_toolbox_entries,
toolbox_entries,
NULL, 2,
TRUE,
TRUE);
toolbox_factory = menus_item_factory_new (GTK_TYPE_MENU_BAR,
"<Toolbox>", "toolbox",
n_toolbox_entries,
toolbox_entries,
NULL,
TRUE);
menus_init_mru ();
image_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Image>", NULL);
gtk_object_set_data (GTK_OBJECT (image_factory), "factory_path",
(gpointer) "image");
gtk_item_factory_set_translate_func (image_factory, menu_translate,
"<Image>", NULL);
menus_create_items (image_factory,
n_image_entries,
image_entries,
NULL, 2,
TRUE,
TRUE);
image_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Image>", "image",
n_image_entries,
image_entries,
NULL,
TRUE);
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
gtk_object_set_data (GTK_OBJECT (load_factory), "factory_path",
(gpointer) "open");
gtk_item_factory_set_translate_func (load_factory, menu_translate,
"<Load>", NULL);
menus_create_items (load_factory,
n_load_entries,
load_entries,
NULL, 2,
FALSE,
TRUE);
load_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Load>", "open",
n_load_entries,
load_entries,
NULL,
FALSE);
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
gtk_object_set_data (GTK_OBJECT (save_factory), "factory_path",
(gpointer) "save");
gtk_item_factory_set_translate_func (save_factory, menu_translate,
"<Save>", NULL);
menus_create_items (save_factory,
n_save_entries,
save_entries,
NULL, 2,
FALSE,
TRUE);
save_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Save>", "save",
n_save_entries,
save_entries,
NULL,
FALSE);
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
gtk_object_set_data (GTK_OBJECT (layers_factory), "factory_path",
(gpointer) "layers");
gtk_item_factory_set_translate_func (layers_factory, menu_translate,
"<Layers>", NULL);
menus_create_items (layers_factory,
n_layers_entries,
layers_entries,
NULL, 2,
FALSE,
TRUE);
layers_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Layers>", "layers",
n_layers_entries,
layers_entries,
NULL,
FALSE);
channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Channels>", NULL);
gtk_object_set_data (GTK_OBJECT (channels_factory), "factory_path",
(gpointer) "channels");
gtk_item_factory_set_translate_func (channels_factory, menu_translate,
"<Channels>", NULL);
menus_create_items (channels_factory,
n_channels_entries,
channels_entries,
NULL, 2,
FALSE,
TRUE);
channels_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Channels>", "channels",
n_channels_entries,
channels_entries,
NULL,
FALSE);
paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Paths>", NULL);
gtk_object_set_data (GTK_OBJECT (paths_factory), "factory_path",
(gpointer) "paths");
gtk_item_factory_set_translate_func (paths_factory, menu_translate,
"<Paths>", NULL);
menus_create_items (paths_factory,
n_paths_entries,
paths_entries,
NULL, 2,
FALSE,
TRUE);
paths_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Paths>", "paths",
n_paths_entries,
paths_entries,
NULL,
FALSE);
dialogs_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Dialogs>", NULL);
gtk_object_set_data (GTK_OBJECT (paths_factory), "factory_path",
(gpointer) "dialogs");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Dialogs>", NULL);
menus_create_items (dialogs_factory,
n_dialogs_entries,
dialogs_entries,
NULL, 2,
FALSE,
TRUE);
dialogs_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Dialogs>", "dialogs",
n_dialogs_entries,
dialogs_entries,
NULL,
FALSE);
brushes_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Brushes>", NULL);
gtk_object_set_data (GTK_OBJECT (brushes_factory), "factory_path",
"brushes");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Brushes>", NULL);
menus_create_items (brushes_factory,
n_brushes_entries,
brushes_entries,
NULL, 2,
FALSE,
TRUE);
brushes_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Brushes>", "brushes",
n_brushes_entries,
brushes_entries,
NULL,
FALSE);
patterns_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Patterns>", NULL);
gtk_object_set_data (GTK_OBJECT (patterns_factory), "factory_path",
"patterns");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Patterns>", NULL);
menus_create_items (patterns_factory,
n_patterns_entries,
patterns_entries,
NULL, 2,
FALSE,
TRUE);
patterns_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Patterns>", "patterns",
n_patterns_entries,
patterns_entries,
NULL,
FALSE);
gradients_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Gradients>", NULL);
gtk_object_set_data (GTK_OBJECT (gradients_factory), "factory_path",
"gradients");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Gradients>", NULL);
menus_create_items (gradients_factory,
n_gradients_entries,
gradients_entries,
NULL, 2,
FALSE,
TRUE);
gradients_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Gradients>", "gradients",
n_gradients_entries,
gradients_entries,
NULL,
FALSE);
palettes_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Palettes>", NULL);
gtk_object_set_data (GTK_OBJECT (palettes_factory), "factory_path",
"palettes");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Palettes>", NULL);
menus_create_items (palettes_factory,
n_palettes_entries,
palettes_entries,
NULL, 2,
FALSE,
TRUE);
palettes_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Palettes>", "palettes",
n_palettes_entries,
palettes_entries,
NULL,
FALSE);
for (list = GIMP_LIST (the_gimp->tool_info_list)->list;
@ -2523,6 +2502,7 @@ menus_init (void)
pos++;
}
}
if (menu_item && menu_item->parent)
{
separator = gtk_menu_item_new ();
@ -2539,8 +2519,8 @@ menus_init (void)
#ifdef ENABLE_NLS
static gchar *
menu_translate (const gchar *path,
gpointer data)
menus_menu_translate_func (const gchar *path,
gpointer data)
{
static gchar *menupath = NULL;
@ -2678,21 +2658,10 @@ menu_translate (const gchar *path,
#endif /* ENABLE_NLS */
static gint
tearoff_delete_cb (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
/* Unregister if dialog is deleted as well */
dialog_unregister (widget);
return TRUE;
}
static void
tearoff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
menus_tearoff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
if (GTK_IS_TEAROFF_MENU_ITEM (widget))
{
@ -2700,41 +2669,60 @@ tearoff_cmd_callback (GtkWidget *widget,
if (tomi->torn_off)
{
GtkWidget *top = gtk_widget_get_toplevel (widget);
GtkWidget *toplevel;
/* This should be a window */
if (! GTK_IS_WINDOW (top))
toplevel = gtk_widget_get_toplevel (widget);
if (! GTK_IS_WINDOW (toplevel))
{
g_message ("tearoff menu not in top level window");
g_warning ("menus_tearoff_cmd_callback(): tearoff menu not "
"in top level window");
}
else
{
dialog_register (top);
gtk_signal_connect (GTK_OBJECT (top), "delete_event",
GTK_SIGNAL_FUNC (tearoff_delete_cb),
dialog_register (toplevel);
gtk_signal_connect (GTK_OBJECT (toplevel), "delete_event",
GTK_SIGNAL_FUNC (menus_tearoff_delete_cb),
NULL);
gtk_object_set_data (GTK_OBJECT (widget), "tearoff_menu_top",
top);
gtk_object_set_data (GTK_OBJECT (widget), "tearoff-menu-toplevel",
toplevel);
gimp_dialog_set_icon (GTK_WINDOW (top));
gimp_dialog_set_icon (GTK_WINDOW (toplevel));
}
}
else
{
GtkWidget *top;
GtkWidget *toplevel;
top = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (widget),
"tearoff_menu_top");
toplevel = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (widget),
"tearoff-menu-toplevel");
if (! top)
g_message ("can't unregister tearoff menu top level window");
if (! toplevel)
{
g_warning ("menus_tearoff_cmd_callback(): can't unregister "
"tearoff menu top level window");
}
else
dialog_unregister (top);
{
dialog_unregister (toplevel);
}
}
}
}
static gint
menus_tearoff_delete_cb (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
/* Unregister if dialog is deleted as well */
dialog_unregister (widget);
return TRUE;
}
#ifdef ENABLE_DEBUG_ENTRY
#include <unistd.h>

File diff suppressed because it is too large Load Diff

View File

@ -16,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PALETTE_H__
#define __PALETTE_H__
#ifndef __PALETTE_EDITOR_H__
#define __PALETTE_EDITOR_H__
/* The states for updating a color in the palette via palette_set_* calls */
@ -26,15 +26,19 @@
#define COLOR_UPDATE 2
GtkWidget * palette_dialog_create (void);
void palette_dialog_free (void);
void palette_dialog_edit_palette (GimpData *data);
void palette_set_active_color (gint r,
gint g,
gint b,
gint state);
typedef struct _PaletteEditor PaletteEditor;
#endif /* __PALETTE_H__ */
PaletteEditor * palette_editor_new (void);
void palette_editor_set_palette (PaletteEditor *palette_editor,
GimpPalette *palette);
void palette_editor_free (PaletteEditor *palette_editor);
void palette_set_active_color (gint r,
gint g,
gint b,
gint state);
#endif /* __PALETTE_EDITOR_H__ */

View File

@ -64,9 +64,33 @@ static void palette_select_close_callback (GtkWidget *widget,
/* list of active dialogs */
static GSList *palette_active_dialogs = NULL;
/* the main palette selection dialog */
PaletteSelect *palette_select_dialog = NULL;
/* public functions */
GtkWidget *
palette_dialog_create (void)
{
if (! palette_select_dialog)
{
palette_select_dialog = palette_select_new (NULL, NULL);
}
return palette_select_dialog->shell;
}
void
palette_dialog_free (void)
{
if (palette_select_dialog)
{
palette_select_free (palette_select_dialog);
palette_select_dialog = NULL;
}
}
PaletteSelect *
palette_select_new (const gchar *title,
const gchar *initial_palette)
@ -169,22 +193,7 @@ palette_select_new (const gchar *title,
return psp;
}
/* local functions */
static void
palette_select_drop_palette (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
PaletteSelect *psp;
psp = (PaletteSelect *) data;
gimp_context_set_palette (psp->context, GIMP_PALETTE (viewable));
}
static void
void
palette_select_free (PaletteSelect *psp)
{
if (psp)
@ -201,6 +210,21 @@ palette_select_free (PaletteSelect *psp)
}
}
/* local functions */
static void
palette_select_drop_palette (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
PaletteSelect *psp;
psp = (PaletteSelect *) data;
gimp_context_set_palette (psp->context, GIMP_PALETTE (viewable));
}
static void
palette_select_close_callback (GtkWidget *widget,
gpointer data)

View File

@ -37,8 +37,14 @@ struct _PaletteSelect
};
PaletteSelect * palette_select_new (const gchar *title,
const gchar *initial_palette);
PaletteSelect * palette_select_new (const gchar *title,
const gchar *initial_palette);
void palette_select_free (PaletteSelect *palette_select);
/* the main palette selection */
GtkWidget * palette_dialog_create (void);
void palette_dialog_free (void);
#endif /* __PALETTE_SELECT_H__ */

View File

@ -27,7 +27,6 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "core/gimp.h"
@ -50,8 +49,6 @@
#include "dialogs-commands.h"
#include "edit-commands.h"
#include "file-commands.h"
#include "file-open-dialog.h"
#include "file-save-dialog.h"
#include "gradients-commands.h"
#include "image-commands.h"
#include "layers-commands.h"
@ -71,47 +68,46 @@
#include "libgimp/gimpintl.h"
#define MRU_MENU_ENTRY_SIZE (strlen ("/File/MRU00 ") + 1)
#define MRU_MENU_ACCEL_SIZE sizeof ("<control>0")
/* local function prototypes */
static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
gpointer callback_data,
guint callback_type,
gboolean create_tearoff,
gboolean static_entry);
static void menus_create_items (GtkItemFactory *item_factory,
guint n_entries,
GimpItemFactoryEntry *entries,
gpointer callback_data,
guint callback_type,
gboolean create_tearoff,
gboolean static_entries);
static void menus_create_branches (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry);
static void menus_init (void);
static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
gpointer callback_data,
guint callback_type,
gboolean create_tearoff,
gboolean static_entry);
static void menus_create_items (GtkItemFactory *item_factory,
guint n_entries,
GimpItemFactoryEntry *entries,
gpointer callback_data,
guint callback_type,
gboolean create_tearoff,
gboolean static_entries);
static void menus_create_branches (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry);
static void menus_init (void);
#ifdef ENABLE_NLS
static gchar *menu_translate (const gchar *path,
gpointer data);
static gchar * menus_menu_translate_func (const gchar *path,
gpointer data);
#else
#define menu_translate NULL
#define menus_menu_translate_func (NULL)
#endif
static void tearoff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
static gint tearoff_delete_cb (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void menus_tearoff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
static gint menus_tearoff_delete_cb (GtkWidget *widget,
GdkEvent *event,
gpointer data);
#ifdef ENABLE_DEBUG_ENTRY
static void menus_debug_recurse_menu (GtkWidget *menu,
gint depth,
gchar *path);
static void menus_debug_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
static void menus_debug_recurse_menu (GtkWidget *menu,
gint depth,
gchar *path);
static void menus_debug_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* ENABLE_DEBUG_ENTRY */
@ -133,10 +129,12 @@ static GimpItemFactoryEntry toolbox_entries[] =
BRANCH (N_("/_File")),
{ { N_("/File/New..."), "<control>N", file_new_cmd_callback, 0 },
{ { N_("/File/New..."), "<control>N",
file_new_cmd_callback, 0 },
NULL,
"file/dialogs/file_new.html", NULL },
{ { N_("/File/Open..."), "<control>O", file_open_cmd_callback, 0 },
{ { N_("/File/Open..."), "<control>O",
file_open_cmd_callback, 0 },
NULL,
"file/dialogs/file_open.html", NULL },
@ -182,7 +180,7 @@ static GimpItemFactoryEntry toolbox_entries[] =
"file/dialogs/gradient_selection.html", NULL },
{ { N_("/File/Dialogs/Palette..."), "<control>P",
dialogs_create_toplevel_cmd_callback, 0 },
"gimp:palette-dialog",
"gimp:palette-select-dialog",
"file/dialogs/palette_selection.html", NULL },
{ { N_("/File/Dialogs/Indexed Palette..."), NULL,
dialogs_create_toplevel_cmd_callback, 0 },
@ -344,7 +342,7 @@ static GtkItemFactory *toolbox_factory = NULL;
static GimpItemFactoryEntry image_entries[] =
{
{ { "/tearoff1", NULL, tearoff_cmd_callback, 0, "<Tearoff>" },
{ { "/tearoff1", NULL, menus_tearoff_cmd_callback, 0, "<Tearoff>" },
NULL,
NULL, NULL },
@ -800,7 +798,7 @@ static GimpItemFactoryEntry image_entries[] =
"dialogs/gradient_selection.html", NULL },
{ { N_("/Dialogs/Palette..."), "<control>P",
dialogs_create_toplevel_cmd_callback, 0 },
"gimp:palette-dialog",
"gimp:palette-select-dialog",
"dialogs/palette_selection.html", NULL },
{ { N_("/Dialogs/Indexed Palette..."), NULL,
dialogs_create_toplevel_cmd_callback, 0 },
@ -891,7 +889,7 @@ static GtkItemFactory *image_factory = NULL;
static GimpItemFactoryEntry load_entries[] =
{
{ { N_("/Automatic"), NULL,
file_open_by_extension_callback, 0 },
file_open_by_extension_cmd_callback, 0 },
NULL,
"open_by_extension.html", NULL },
@ -907,7 +905,7 @@ static GtkItemFactory *load_factory = NULL;
static GimpItemFactoryEntry save_entries[] =
{
{ { N_("/By Extension"), NULL,
file_save_by_extension_callback, 0 },
file_save_by_extension_cmd_callback, 0 },
NULL,
"save_by_extension.html", NULL },
@ -1617,12 +1615,13 @@ menus_create_branches (GtkItemFactory *item_factory,
{
GimpItemFactoryEntry tearoff_entry =
{
{ NULL, NULL, tearoff_cmd_callback, 0, "<Tearoff>" },
{ NULL, NULL, menus_tearoff_cmd_callback, 0, "<Tearoff>" },
NULL,
NULL, NULL
};
tearoff_entry.entry.path = tearoff_path->str;
menus_create_item (item_factory, &tearoff_entry, NULL, 2, TRUE, FALSE);
}
@ -1974,6 +1973,10 @@ menus_quit (void)
gtk_object_unref (GTK_OBJECT (channels_factory));
gtk_object_unref (GTK_OBJECT (paths_factory));
gtk_object_unref (GTK_OBJECT (dialogs_factory));
gtk_object_unref (GTK_OBJECT (brushes_factory));
gtk_object_unref (GTK_OBJECT (patterns_factory));
gtk_object_unref (GTK_OBJECT (gradients_factory));
gtk_object_unref (GTK_OBJECT (palettes_factory));
}
}
@ -1991,7 +1994,7 @@ menus_last_opened_update_labels (void)
path = g_string_new ("");
filename_slist = last_opened_raw_filenames;
num_entries = g_slist_length (last_opened_raw_filenames);
num_entries = g_slist_length (last_opened_raw_filenames);
for (i = 1; i <= num_entries; i++)
{
@ -2007,9 +2010,11 @@ menus_last_opened_update_labels (void)
gtk_label_set_text (GTK_LABEL (GTK_BIN (widget)->child),
entry_filename->str);
gimp_help_set_help_data (widget,
((GString *) filename_slist->data)->str, NULL);
gimp_help_set_help_data (widget,
((GString *) filename_slist->data)->str,
NULL);
}
filename_slist = filename_slist->next;
}
@ -2027,19 +2032,23 @@ menus_last_opened_add (gchar *filename)
g_return_if_fail (filename != NULL);
/* do nothing if we've already got the filename on the list */
/* see if we've already got the filename on the list */
for (list = last_opened_raw_filenames; list; list = g_slist_next (list))
{
raw_filename = list->data;
raw_filename = (GString *) list->data;
if (strcmp (raw_filename->str, filename) == 0)
{
/* the following lines would move the entry to the top
*
* last_opened_raw_filenames = g_slist_remove_link (last_opened_raw_filenames, list);
* last_opened_raw_filenames = g_slist_concat (list, last_opened_raw_filenames);
* menus_last_opened_update_labels ();
*/
/* move the entry to the top */
last_opened_raw_filenames =
g_slist_remove_link (last_opened_raw_filenames, list);
last_opened_raw_filenames =
g_slist_concat (list, last_opened_raw_filenames);
menus_last_opened_update_labels ();
return;
}
}
@ -2048,12 +2057,16 @@ menus_last_opened_add (gchar *filename)
if (num_entries == gimprc.last_opened_size)
{
list = g_slist_last (last_opened_raw_filenames);
if (list)
GSList *oldest;
oldest = g_slist_last (last_opened_raw_filenames);
if (oldest)
{
g_string_free ((GString *)list->data, TRUE);
last_opened_raw_filenames =
g_slist_remove (last_opened_raw_filenames, list);
g_string_free ((GString *) oldest->data, TRUE);
last_opened_raw_filenames = g_slist_remove (last_opened_raw_filenames,
oldest);
}
}
@ -2076,43 +2089,33 @@ menus_init_mru (void)
{
GimpItemFactoryEntry *last_opened_entries;
GtkWidget *menu_item;
gchar *paths;
gchar *accelerators;
gint i;
last_opened_entries = g_new (GimpItemFactoryEntry, gimprc.last_opened_size);
paths = g_new (gchar, gimprc.last_opened_size * MRU_MENU_ENTRY_SIZE);
accelerators = g_new (gchar, 9 * MRU_MENU_ACCEL_SIZE);
for (i = 0; i < gimprc.last_opened_size; i++)
{
gchar *path, *accelerator;
last_opened_entries[i].entry.path =
g_strdup_printf ("/File/MRU%02d", i + 1);
path = &paths[i * MRU_MENU_ENTRY_SIZE];
if (i < 9)
accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE];
last_opened_entries[i].entry.accelerator =
g_strdup_printf ("<control>%d", i + 1);
else
accelerator = NULL;
last_opened_entries[i].entry.path = path;
last_opened_entries[i].entry.accelerator = accelerator;
last_opened_entries[i].entry.accelerator = NULL;
last_opened_entries[i].entry.callback = file_last_opened_cmd_callback;
last_opened_entries[i].entry.callback_action = i;
last_opened_entries[i].entry.item_type = NULL;
last_opened_entries[i].quark_string = NULL;
last_opened_entries[i].help_page = "file/last_opened.html";
last_opened_entries[i].description = NULL;
g_snprintf (path, MRU_MENU_ENTRY_SIZE, "/File/MRU%02d", i + 1);
if (accelerator != NULL)
g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "<control>%d", i + 1);
last_opened_entries[i].quark_string = NULL;
last_opened_entries[i].help_page = "file/last_opened.html";
last_opened_entries[i].description = NULL;
}
menus_create_items (toolbox_factory, gimprc.last_opened_size,
last_opened_entries, NULL, 2, TRUE, FALSE);
for (i=0; i < gimprc.last_opened_size; i++)
for (i = 0; i < gimprc.last_opened_size; i++)
{
menu_item =
gtk_item_factory_get_widget (toolbox_factory,
@ -2129,8 +2132,12 @@ menus_init_mru (void)
if (menu_item && menu_item->parent)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1);
g_free (paths);
g_free (accelerators);
for (i = 0; i < gimprc.last_opened_size; i++)
{
g_free (last_opened_entries[i].entry.path);
g_free (last_opened_entries[i].entry.accelerator);
}
g_free (last_opened_entries);
}
@ -2321,6 +2328,38 @@ menus_create_items (GtkItemFactory *item_factory,
}
}
static GtkItemFactory *
menus_item_factory_new (GtkType container_type,
const gchar *path,
const gchar *factory_path,
guint n_entries,
GimpItemFactoryEntry *entries,
gpointer callback_data,
gboolean create_tearoff)
{
GtkItemFactory *item_factory;
item_factory = gtk_item_factory_new (container_type, path, NULL);
gtk_item_factory_set_translate_func (item_factory,
menus_menu_translate_func,
(gpointer) path,
NULL);
gtk_object_set_data (GTK_OBJECT (item_factory), "factory_path",
(gpointer) factory_path);
menus_create_items (item_factory,
n_entries,
entries,
callback_data,
2,
create_tearoff,
TRUE);
return item_factory;
}
static void
menus_init (void)
{
@ -2334,151 +2373,91 @@ menus_init (void)
menus_initialized = TRUE;
toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<Toolbox>", NULL);
gtk_object_set_data (GTK_OBJECT (toolbox_factory), "factory_path",
(gpointer) "toolbox");
gtk_item_factory_set_translate_func (toolbox_factory, menu_translate,
"<Toolbox>", NULL);
menus_create_items (toolbox_factory,
n_toolbox_entries,
toolbox_entries,
NULL, 2,
TRUE,
TRUE);
toolbox_factory = menus_item_factory_new (GTK_TYPE_MENU_BAR,
"<Toolbox>", "toolbox",
n_toolbox_entries,
toolbox_entries,
NULL,
TRUE);
menus_init_mru ();
image_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Image>", NULL);
gtk_object_set_data (GTK_OBJECT (image_factory), "factory_path",
(gpointer) "image");
gtk_item_factory_set_translate_func (image_factory, menu_translate,
"<Image>", NULL);
menus_create_items (image_factory,
n_image_entries,
image_entries,
NULL, 2,
TRUE,
TRUE);
image_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Image>", "image",
n_image_entries,
image_entries,
NULL,
TRUE);
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
gtk_object_set_data (GTK_OBJECT (load_factory), "factory_path",
(gpointer) "open");
gtk_item_factory_set_translate_func (load_factory, menu_translate,
"<Load>", NULL);
menus_create_items (load_factory,
n_load_entries,
load_entries,
NULL, 2,
FALSE,
TRUE);
load_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Load>", "open",
n_load_entries,
load_entries,
NULL,
FALSE);
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
gtk_object_set_data (GTK_OBJECT (save_factory), "factory_path",
(gpointer) "save");
gtk_item_factory_set_translate_func (save_factory, menu_translate,
"<Save>", NULL);
menus_create_items (save_factory,
n_save_entries,
save_entries,
NULL, 2,
FALSE,
TRUE);
save_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Save>", "save",
n_save_entries,
save_entries,
NULL,
FALSE);
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
gtk_object_set_data (GTK_OBJECT (layers_factory), "factory_path",
(gpointer) "layers");
gtk_item_factory_set_translate_func (layers_factory, menu_translate,
"<Layers>", NULL);
menus_create_items (layers_factory,
n_layers_entries,
layers_entries,
NULL, 2,
FALSE,
TRUE);
layers_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Layers>", "layers",
n_layers_entries,
layers_entries,
NULL,
FALSE);
channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Channels>", NULL);
gtk_object_set_data (GTK_OBJECT (channels_factory), "factory_path",
(gpointer) "channels");
gtk_item_factory_set_translate_func (channels_factory, menu_translate,
"<Channels>", NULL);
menus_create_items (channels_factory,
n_channels_entries,
channels_entries,
NULL, 2,
FALSE,
TRUE);
channels_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Channels>", "channels",
n_channels_entries,
channels_entries,
NULL,
FALSE);
paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Paths>", NULL);
gtk_object_set_data (GTK_OBJECT (paths_factory), "factory_path",
(gpointer) "paths");
gtk_item_factory_set_translate_func (paths_factory, menu_translate,
"<Paths>", NULL);
menus_create_items (paths_factory,
n_paths_entries,
paths_entries,
NULL, 2,
FALSE,
TRUE);
paths_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Paths>", "paths",
n_paths_entries,
paths_entries,
NULL,
FALSE);
dialogs_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Dialogs>", NULL);
gtk_object_set_data (GTK_OBJECT (paths_factory), "factory_path",
(gpointer) "dialogs");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Dialogs>", NULL);
menus_create_items (dialogs_factory,
n_dialogs_entries,
dialogs_entries,
NULL, 2,
FALSE,
TRUE);
dialogs_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Dialogs>", "dialogs",
n_dialogs_entries,
dialogs_entries,
NULL,
FALSE);
brushes_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Brushes>", NULL);
gtk_object_set_data (GTK_OBJECT (brushes_factory), "factory_path",
"brushes");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Brushes>", NULL);
menus_create_items (brushes_factory,
n_brushes_entries,
brushes_entries,
NULL, 2,
FALSE,
TRUE);
brushes_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Brushes>", "brushes",
n_brushes_entries,
brushes_entries,
NULL,
FALSE);
patterns_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Patterns>", NULL);
gtk_object_set_data (GTK_OBJECT (patterns_factory), "factory_path",
"patterns");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Patterns>", NULL);
menus_create_items (patterns_factory,
n_patterns_entries,
patterns_entries,
NULL, 2,
FALSE,
TRUE);
patterns_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Patterns>", "patterns",
n_patterns_entries,
patterns_entries,
NULL,
FALSE);
gradients_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Gradients>", NULL);
gtk_object_set_data (GTK_OBJECT (gradients_factory), "factory_path",
"gradients");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Gradients>", NULL);
menus_create_items (gradients_factory,
n_gradients_entries,
gradients_entries,
NULL, 2,
FALSE,
TRUE);
gradients_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Gradients>", "gradients",
n_gradients_entries,
gradients_entries,
NULL,
FALSE);
palettes_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Palettes>", NULL);
gtk_object_set_data (GTK_OBJECT (palettes_factory), "factory_path",
"palettes");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Palettes>", NULL);
menus_create_items (palettes_factory,
n_palettes_entries,
palettes_entries,
NULL, 2,
FALSE,
TRUE);
palettes_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Palettes>", "palettes",
n_palettes_entries,
palettes_entries,
NULL,
FALSE);
for (list = GIMP_LIST (the_gimp->tool_info_list)->list;
@ -2523,6 +2502,7 @@ menus_init (void)
pos++;
}
}
if (menu_item && menu_item->parent)
{
separator = gtk_menu_item_new ();
@ -2539,8 +2519,8 @@ menus_init (void)
#ifdef ENABLE_NLS
static gchar *
menu_translate (const gchar *path,
gpointer data)
menus_menu_translate_func (const gchar *path,
gpointer data)
{
static gchar *menupath = NULL;
@ -2678,21 +2658,10 @@ menu_translate (const gchar *path,
#endif /* ENABLE_NLS */
static gint
tearoff_delete_cb (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
/* Unregister if dialog is deleted as well */
dialog_unregister (widget);
return TRUE;
}
static void
tearoff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
menus_tearoff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
if (GTK_IS_TEAROFF_MENU_ITEM (widget))
{
@ -2700,41 +2669,60 @@ tearoff_cmd_callback (GtkWidget *widget,
if (tomi->torn_off)
{
GtkWidget *top = gtk_widget_get_toplevel (widget);
GtkWidget *toplevel;
/* This should be a window */
if (! GTK_IS_WINDOW (top))
toplevel = gtk_widget_get_toplevel (widget);
if (! GTK_IS_WINDOW (toplevel))
{
g_message ("tearoff menu not in top level window");
g_warning ("menus_tearoff_cmd_callback(): tearoff menu not "
"in top level window");
}
else
{
dialog_register (top);
gtk_signal_connect (GTK_OBJECT (top), "delete_event",
GTK_SIGNAL_FUNC (tearoff_delete_cb),
dialog_register (toplevel);
gtk_signal_connect (GTK_OBJECT (toplevel), "delete_event",
GTK_SIGNAL_FUNC (menus_tearoff_delete_cb),
NULL);
gtk_object_set_data (GTK_OBJECT (widget), "tearoff_menu_top",
top);
gtk_object_set_data (GTK_OBJECT (widget), "tearoff-menu-toplevel",
toplevel);
gimp_dialog_set_icon (GTK_WINDOW (top));
gimp_dialog_set_icon (GTK_WINDOW (toplevel));
}
}
else
{
GtkWidget *top;
GtkWidget *toplevel;
top = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (widget),
"tearoff_menu_top");
toplevel = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (widget),
"tearoff-menu-toplevel");
if (! top)
g_message ("can't unregister tearoff menu top level window");
if (! toplevel)
{
g_warning ("menus_tearoff_cmd_callback(): can't unregister "
"tearoff menu top level window");
}
else
dialog_unregister (top);
{
dialog_unregister (toplevel);
}
}
}
}
static gint
menus_tearoff_delete_cb (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
/* Unregister if dialog is deleted as well */
dialog_unregister (widget);
return TRUE;
}
#ifdef ENABLE_DEBUG_ENTRY
#include <unistd.h>

View File

@ -746,7 +746,7 @@ gimp_dnd_open_files (GtkWidget *widget,
{
gchar *filename = (gchar *) list->data;
file_open_with_display (filename, filename);
file_open_with_display (filename);
}
}

View File

@ -27,7 +27,6 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "core/gimp.h"
@ -50,8 +49,6 @@
#include "dialogs-commands.h"
#include "edit-commands.h"
#include "file-commands.h"
#include "file-open-dialog.h"
#include "file-save-dialog.h"
#include "gradients-commands.h"
#include "image-commands.h"
#include "layers-commands.h"
@ -71,47 +68,46 @@
#include "libgimp/gimpintl.h"
#define MRU_MENU_ENTRY_SIZE (strlen ("/File/MRU00 ") + 1)
#define MRU_MENU_ACCEL_SIZE sizeof ("<control>0")
/* local function prototypes */
static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
gpointer callback_data,
guint callback_type,
gboolean create_tearoff,
gboolean static_entry);
static void menus_create_items (GtkItemFactory *item_factory,
guint n_entries,
GimpItemFactoryEntry *entries,
gpointer callback_data,
guint callback_type,
gboolean create_tearoff,
gboolean static_entries);
static void menus_create_branches (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry);
static void menus_init (void);
static void menus_create_item (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry,
gpointer callback_data,
guint callback_type,
gboolean create_tearoff,
gboolean static_entry);
static void menus_create_items (GtkItemFactory *item_factory,
guint n_entries,
GimpItemFactoryEntry *entries,
gpointer callback_data,
guint callback_type,
gboolean create_tearoff,
gboolean static_entries);
static void menus_create_branches (GtkItemFactory *item_factory,
GimpItemFactoryEntry *entry);
static void menus_init (void);
#ifdef ENABLE_NLS
static gchar *menu_translate (const gchar *path,
gpointer data);
static gchar * menus_menu_translate_func (const gchar *path,
gpointer data);
#else
#define menu_translate NULL
#define menus_menu_translate_func (NULL)
#endif
static void tearoff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
static gint tearoff_delete_cb (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void menus_tearoff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
static gint menus_tearoff_delete_cb (GtkWidget *widget,
GdkEvent *event,
gpointer data);
#ifdef ENABLE_DEBUG_ENTRY
static void menus_debug_recurse_menu (GtkWidget *menu,
gint depth,
gchar *path);
static void menus_debug_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
static void menus_debug_recurse_menu (GtkWidget *menu,
gint depth,
gchar *path);
static void menus_debug_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* ENABLE_DEBUG_ENTRY */
@ -133,10 +129,12 @@ static GimpItemFactoryEntry toolbox_entries[] =
BRANCH (N_("/_File")),
{ { N_("/File/New..."), "<control>N", file_new_cmd_callback, 0 },
{ { N_("/File/New..."), "<control>N",
file_new_cmd_callback, 0 },
NULL,
"file/dialogs/file_new.html", NULL },
{ { N_("/File/Open..."), "<control>O", file_open_cmd_callback, 0 },
{ { N_("/File/Open..."), "<control>O",
file_open_cmd_callback, 0 },
NULL,
"file/dialogs/file_open.html", NULL },
@ -182,7 +180,7 @@ static GimpItemFactoryEntry toolbox_entries[] =
"file/dialogs/gradient_selection.html", NULL },
{ { N_("/File/Dialogs/Palette..."), "<control>P",
dialogs_create_toplevel_cmd_callback, 0 },
"gimp:palette-dialog",
"gimp:palette-select-dialog",
"file/dialogs/palette_selection.html", NULL },
{ { N_("/File/Dialogs/Indexed Palette..."), NULL,
dialogs_create_toplevel_cmd_callback, 0 },
@ -344,7 +342,7 @@ static GtkItemFactory *toolbox_factory = NULL;
static GimpItemFactoryEntry image_entries[] =
{
{ { "/tearoff1", NULL, tearoff_cmd_callback, 0, "<Tearoff>" },
{ { "/tearoff1", NULL, menus_tearoff_cmd_callback, 0, "<Tearoff>" },
NULL,
NULL, NULL },
@ -800,7 +798,7 @@ static GimpItemFactoryEntry image_entries[] =
"dialogs/gradient_selection.html", NULL },
{ { N_("/Dialogs/Palette..."), "<control>P",
dialogs_create_toplevel_cmd_callback, 0 },
"gimp:palette-dialog",
"gimp:palette-select-dialog",
"dialogs/palette_selection.html", NULL },
{ { N_("/Dialogs/Indexed Palette..."), NULL,
dialogs_create_toplevel_cmd_callback, 0 },
@ -891,7 +889,7 @@ static GtkItemFactory *image_factory = NULL;
static GimpItemFactoryEntry load_entries[] =
{
{ { N_("/Automatic"), NULL,
file_open_by_extension_callback, 0 },
file_open_by_extension_cmd_callback, 0 },
NULL,
"open_by_extension.html", NULL },
@ -907,7 +905,7 @@ static GtkItemFactory *load_factory = NULL;
static GimpItemFactoryEntry save_entries[] =
{
{ { N_("/By Extension"), NULL,
file_save_by_extension_callback, 0 },
file_save_by_extension_cmd_callback, 0 },
NULL,
"save_by_extension.html", NULL },
@ -1617,12 +1615,13 @@ menus_create_branches (GtkItemFactory *item_factory,
{
GimpItemFactoryEntry tearoff_entry =
{
{ NULL, NULL, tearoff_cmd_callback, 0, "<Tearoff>" },
{ NULL, NULL, menus_tearoff_cmd_callback, 0, "<Tearoff>" },
NULL,
NULL, NULL
};
tearoff_entry.entry.path = tearoff_path->str;
menus_create_item (item_factory, &tearoff_entry, NULL, 2, TRUE, FALSE);
}
@ -1974,6 +1973,10 @@ menus_quit (void)
gtk_object_unref (GTK_OBJECT (channels_factory));
gtk_object_unref (GTK_OBJECT (paths_factory));
gtk_object_unref (GTK_OBJECT (dialogs_factory));
gtk_object_unref (GTK_OBJECT (brushes_factory));
gtk_object_unref (GTK_OBJECT (patterns_factory));
gtk_object_unref (GTK_OBJECT (gradients_factory));
gtk_object_unref (GTK_OBJECT (palettes_factory));
}
}
@ -1991,7 +1994,7 @@ menus_last_opened_update_labels (void)
path = g_string_new ("");
filename_slist = last_opened_raw_filenames;
num_entries = g_slist_length (last_opened_raw_filenames);
num_entries = g_slist_length (last_opened_raw_filenames);
for (i = 1; i <= num_entries; i++)
{
@ -2007,9 +2010,11 @@ menus_last_opened_update_labels (void)
gtk_label_set_text (GTK_LABEL (GTK_BIN (widget)->child),
entry_filename->str);
gimp_help_set_help_data (widget,
((GString *) filename_slist->data)->str, NULL);
gimp_help_set_help_data (widget,
((GString *) filename_slist->data)->str,
NULL);
}
filename_slist = filename_slist->next;
}
@ -2027,19 +2032,23 @@ menus_last_opened_add (gchar *filename)
g_return_if_fail (filename != NULL);
/* do nothing if we've already got the filename on the list */
/* see if we've already got the filename on the list */
for (list = last_opened_raw_filenames; list; list = g_slist_next (list))
{
raw_filename = list->data;
raw_filename = (GString *) list->data;
if (strcmp (raw_filename->str, filename) == 0)
{
/* the following lines would move the entry to the top
*
* last_opened_raw_filenames = g_slist_remove_link (last_opened_raw_filenames, list);
* last_opened_raw_filenames = g_slist_concat (list, last_opened_raw_filenames);
* menus_last_opened_update_labels ();
*/
/* move the entry to the top */
last_opened_raw_filenames =
g_slist_remove_link (last_opened_raw_filenames, list);
last_opened_raw_filenames =
g_slist_concat (list, last_opened_raw_filenames);
menus_last_opened_update_labels ();
return;
}
}
@ -2048,12 +2057,16 @@ menus_last_opened_add (gchar *filename)
if (num_entries == gimprc.last_opened_size)
{
list = g_slist_last (last_opened_raw_filenames);
if (list)
GSList *oldest;
oldest = g_slist_last (last_opened_raw_filenames);
if (oldest)
{
g_string_free ((GString *)list->data, TRUE);
last_opened_raw_filenames =
g_slist_remove (last_opened_raw_filenames, list);
g_string_free ((GString *) oldest->data, TRUE);
last_opened_raw_filenames = g_slist_remove (last_opened_raw_filenames,
oldest);
}
}
@ -2076,43 +2089,33 @@ menus_init_mru (void)
{
GimpItemFactoryEntry *last_opened_entries;
GtkWidget *menu_item;
gchar *paths;
gchar *accelerators;
gint i;
last_opened_entries = g_new (GimpItemFactoryEntry, gimprc.last_opened_size);
paths = g_new (gchar, gimprc.last_opened_size * MRU_MENU_ENTRY_SIZE);
accelerators = g_new (gchar, 9 * MRU_MENU_ACCEL_SIZE);
for (i = 0; i < gimprc.last_opened_size; i++)
{
gchar *path, *accelerator;
last_opened_entries[i].entry.path =
g_strdup_printf ("/File/MRU%02d", i + 1);
path = &paths[i * MRU_MENU_ENTRY_SIZE];
if (i < 9)
accelerator = &accelerators[i * MRU_MENU_ACCEL_SIZE];
last_opened_entries[i].entry.accelerator =
g_strdup_printf ("<control>%d", i + 1);
else
accelerator = NULL;
last_opened_entries[i].entry.path = path;
last_opened_entries[i].entry.accelerator = accelerator;
last_opened_entries[i].entry.accelerator = NULL;
last_opened_entries[i].entry.callback = file_last_opened_cmd_callback;
last_opened_entries[i].entry.callback_action = i;
last_opened_entries[i].entry.item_type = NULL;
last_opened_entries[i].quark_string = NULL;
last_opened_entries[i].help_page = "file/last_opened.html";
last_opened_entries[i].description = NULL;
g_snprintf (path, MRU_MENU_ENTRY_SIZE, "/File/MRU%02d", i + 1);
if (accelerator != NULL)
g_snprintf (accelerator, MRU_MENU_ACCEL_SIZE, "<control>%d", i + 1);
last_opened_entries[i].quark_string = NULL;
last_opened_entries[i].help_page = "file/last_opened.html";
last_opened_entries[i].description = NULL;
}
menus_create_items (toolbox_factory, gimprc.last_opened_size,
last_opened_entries, NULL, 2, TRUE, FALSE);
for (i=0; i < gimprc.last_opened_size; i++)
for (i = 0; i < gimprc.last_opened_size; i++)
{
menu_item =
gtk_item_factory_get_widget (toolbox_factory,
@ -2129,8 +2132,12 @@ menus_init_mru (void)
if (menu_item && menu_item->parent)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, -1);
g_free (paths);
g_free (accelerators);
for (i = 0; i < gimprc.last_opened_size; i++)
{
g_free (last_opened_entries[i].entry.path);
g_free (last_opened_entries[i].entry.accelerator);
}
g_free (last_opened_entries);
}
@ -2321,6 +2328,38 @@ menus_create_items (GtkItemFactory *item_factory,
}
}
static GtkItemFactory *
menus_item_factory_new (GtkType container_type,
const gchar *path,
const gchar *factory_path,
guint n_entries,
GimpItemFactoryEntry *entries,
gpointer callback_data,
gboolean create_tearoff)
{
GtkItemFactory *item_factory;
item_factory = gtk_item_factory_new (container_type, path, NULL);
gtk_item_factory_set_translate_func (item_factory,
menus_menu_translate_func,
(gpointer) path,
NULL);
gtk_object_set_data (GTK_OBJECT (item_factory), "factory_path",
(gpointer) factory_path);
menus_create_items (item_factory,
n_entries,
entries,
callback_data,
2,
create_tearoff,
TRUE);
return item_factory;
}
static void
menus_init (void)
{
@ -2334,151 +2373,91 @@ menus_init (void)
menus_initialized = TRUE;
toolbox_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<Toolbox>", NULL);
gtk_object_set_data (GTK_OBJECT (toolbox_factory), "factory_path",
(gpointer) "toolbox");
gtk_item_factory_set_translate_func (toolbox_factory, menu_translate,
"<Toolbox>", NULL);
menus_create_items (toolbox_factory,
n_toolbox_entries,
toolbox_entries,
NULL, 2,
TRUE,
TRUE);
toolbox_factory = menus_item_factory_new (GTK_TYPE_MENU_BAR,
"<Toolbox>", "toolbox",
n_toolbox_entries,
toolbox_entries,
NULL,
TRUE);
menus_init_mru ();
image_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Image>", NULL);
gtk_object_set_data (GTK_OBJECT (image_factory), "factory_path",
(gpointer) "image");
gtk_item_factory_set_translate_func (image_factory, menu_translate,
"<Image>", NULL);
menus_create_items (image_factory,
n_image_entries,
image_entries,
NULL, 2,
TRUE,
TRUE);
image_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Image>", "image",
n_image_entries,
image_entries,
NULL,
TRUE);
load_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Load>", NULL);
gtk_object_set_data (GTK_OBJECT (load_factory), "factory_path",
(gpointer) "open");
gtk_item_factory_set_translate_func (load_factory, menu_translate,
"<Load>", NULL);
menus_create_items (load_factory,
n_load_entries,
load_entries,
NULL, 2,
FALSE,
TRUE);
load_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Load>", "open",
n_load_entries,
load_entries,
NULL,
FALSE);
save_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Save>", NULL);
gtk_object_set_data (GTK_OBJECT (save_factory), "factory_path",
(gpointer) "save");
gtk_item_factory_set_translate_func (save_factory, menu_translate,
"<Save>", NULL);
menus_create_items (save_factory,
n_save_entries,
save_entries,
NULL, 2,
FALSE,
TRUE);
save_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Save>", "save",
n_save_entries,
save_entries,
NULL,
FALSE);
layers_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Layers>", NULL);
gtk_object_set_data (GTK_OBJECT (layers_factory), "factory_path",
(gpointer) "layers");
gtk_item_factory_set_translate_func (layers_factory, menu_translate,
"<Layers>", NULL);
menus_create_items (layers_factory,
n_layers_entries,
layers_entries,
NULL, 2,
FALSE,
TRUE);
layers_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Layers>", "layers",
n_layers_entries,
layers_entries,
NULL,
FALSE);
channels_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Channels>", NULL);
gtk_object_set_data (GTK_OBJECT (channels_factory), "factory_path",
(gpointer) "channels");
gtk_item_factory_set_translate_func (channels_factory, menu_translate,
"<Channels>", NULL);
menus_create_items (channels_factory,
n_channels_entries,
channels_entries,
NULL, 2,
FALSE,
TRUE);
channels_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Channels>", "channels",
n_channels_entries,
channels_entries,
NULL,
FALSE);
paths_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Paths>", NULL);
gtk_object_set_data (GTK_OBJECT (paths_factory), "factory_path",
(gpointer) "paths");
gtk_item_factory_set_translate_func (paths_factory, menu_translate,
"<Paths>", NULL);
menus_create_items (paths_factory,
n_paths_entries,
paths_entries,
NULL, 2,
FALSE,
TRUE);
paths_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Paths>", "paths",
n_paths_entries,
paths_entries,
NULL,
FALSE);
dialogs_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Dialogs>", NULL);
gtk_object_set_data (GTK_OBJECT (paths_factory), "factory_path",
(gpointer) "dialogs");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Dialogs>", NULL);
menus_create_items (dialogs_factory,
n_dialogs_entries,
dialogs_entries,
NULL, 2,
FALSE,
TRUE);
dialogs_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Dialogs>", "dialogs",
n_dialogs_entries,
dialogs_entries,
NULL,
FALSE);
brushes_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Brushes>", NULL);
gtk_object_set_data (GTK_OBJECT (brushes_factory), "factory_path",
"brushes");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Brushes>", NULL);
menus_create_items (brushes_factory,
n_brushes_entries,
brushes_entries,
NULL, 2,
FALSE,
TRUE);
brushes_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Brushes>", "brushes",
n_brushes_entries,
brushes_entries,
NULL,
FALSE);
patterns_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Patterns>", NULL);
gtk_object_set_data (GTK_OBJECT (patterns_factory), "factory_path",
"patterns");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Patterns>", NULL);
menus_create_items (patterns_factory,
n_patterns_entries,
patterns_entries,
NULL, 2,
FALSE,
TRUE);
patterns_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Patterns>", "patterns",
n_patterns_entries,
patterns_entries,
NULL,
FALSE);
gradients_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Gradients>", NULL);
gtk_object_set_data (GTK_OBJECT (gradients_factory), "factory_path",
"gradients");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Gradients>", NULL);
menus_create_items (gradients_factory,
n_gradients_entries,
gradients_entries,
NULL, 2,
FALSE,
TRUE);
gradients_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Gradients>", "gradients",
n_gradients_entries,
gradients_entries,
NULL,
FALSE);
palettes_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<Palettes>", NULL);
gtk_object_set_data (GTK_OBJECT (palettes_factory), "factory_path",
"palettes");
gtk_item_factory_set_translate_func (dialogs_factory, menu_translate,
"<Palettes>", NULL);
menus_create_items (palettes_factory,
n_palettes_entries,
palettes_entries,
NULL, 2,
FALSE,
TRUE);
palettes_factory = menus_item_factory_new (GTK_TYPE_MENU,
"<Palettes>", "palettes",
n_palettes_entries,
palettes_entries,
NULL,
FALSE);
for (list = GIMP_LIST (the_gimp->tool_info_list)->list;
@ -2523,6 +2502,7 @@ menus_init (void)
pos++;
}
}
if (menu_item && menu_item->parent)
{
separator = gtk_menu_item_new ();
@ -2539,8 +2519,8 @@ menus_init (void)
#ifdef ENABLE_NLS
static gchar *
menu_translate (const gchar *path,
gpointer data)
menus_menu_translate_func (const gchar *path,
gpointer data)
{
static gchar *menupath = NULL;
@ -2678,21 +2658,10 @@ menu_translate (const gchar *path,
#endif /* ENABLE_NLS */
static gint
tearoff_delete_cb (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
/* Unregister if dialog is deleted as well */
dialog_unregister (widget);
return TRUE;
}
static void
tearoff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
menus_tearoff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
if (GTK_IS_TEAROFF_MENU_ITEM (widget))
{
@ -2700,41 +2669,60 @@ tearoff_cmd_callback (GtkWidget *widget,
if (tomi->torn_off)
{
GtkWidget *top = gtk_widget_get_toplevel (widget);
GtkWidget *toplevel;
/* This should be a window */
if (! GTK_IS_WINDOW (top))
toplevel = gtk_widget_get_toplevel (widget);
if (! GTK_IS_WINDOW (toplevel))
{
g_message ("tearoff menu not in top level window");
g_warning ("menus_tearoff_cmd_callback(): tearoff menu not "
"in top level window");
}
else
{
dialog_register (top);
gtk_signal_connect (GTK_OBJECT (top), "delete_event",
GTK_SIGNAL_FUNC (tearoff_delete_cb),
dialog_register (toplevel);
gtk_signal_connect (GTK_OBJECT (toplevel), "delete_event",
GTK_SIGNAL_FUNC (menus_tearoff_delete_cb),
NULL);
gtk_object_set_data (GTK_OBJECT (widget), "tearoff_menu_top",
top);
gtk_object_set_data (GTK_OBJECT (widget), "tearoff-menu-toplevel",
toplevel);
gimp_dialog_set_icon (GTK_WINDOW (top));
gimp_dialog_set_icon (GTK_WINDOW (toplevel));
}
}
else
{
GtkWidget *top;
GtkWidget *toplevel;
top = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (widget),
"tearoff_menu_top");
toplevel = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (widget),
"tearoff-menu-toplevel");
if (! top)
g_message ("can't unregister tearoff menu top level window");
if (! toplevel)
{
g_warning ("menus_tearoff_cmd_callback(): can't unregister "
"tearoff menu top level window");
}
else
dialog_unregister (top);
{
dialog_unregister (toplevel);
}
}
}
}
static gint
menus_tearoff_delete_cb (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
/* Unregister if dialog is deleted as well */
dialog_unregister (widget);
return TRUE;
}
#ifdef ENABLE_DEBUG_ENTRY
#include <unistd.h>

File diff suppressed because it is too large Load Diff

View File

@ -16,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PALETTE_H__
#define __PALETTE_H__
#ifndef __PALETTE_EDITOR_H__
#define __PALETTE_EDITOR_H__
/* The states for updating a color in the palette via palette_set_* calls */
@ -26,15 +26,19 @@
#define COLOR_UPDATE 2
GtkWidget * palette_dialog_create (void);
void palette_dialog_free (void);
void palette_dialog_edit_palette (GimpData *data);
void palette_set_active_color (gint r,
gint g,
gint b,
gint state);
typedef struct _PaletteEditor PaletteEditor;
#endif /* __PALETTE_H__ */
PaletteEditor * palette_editor_new (void);
void palette_editor_set_palette (PaletteEditor *palette_editor,
GimpPalette *palette);
void palette_editor_free (PaletteEditor *palette_editor);
void palette_set_active_color (gint r,
gint g,
gint b,
gint state);
#endif /* __PALETTE_EDITOR_H__ */