gimp/app/widgets/gimpdialogfactory.h
Michael Natterer fefaf61b28 added new function gimp_dialog_factory_add_foreign() which adds a dialog
2003-05-02  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpdialogfactory.[ch]: added new function
	gimp_dialog_factory_add_foreign() which adds a dialog that was not
	created by the factory itself. Its identifier however must be
	registered with the factory. Connect to all toplevel dialogs'
	"configure_event" and remember the resulting window geometry so we
	get session management for *all* dialogs, not only for those which
	were open on exit.

	* app/gui/dialogs.c: added the "File New" dialog. Added foreign
	entries (without constructor) for all dialogs opened by tools.

	* app/gui/dialogs-constructors.[ch]: added a constructor for
	the file_new dialog.

	* app/gui/file-new-dialog.[ch]: renamed file_new_dialog_create()
	to file_new_dialog_new() and removed the gimage and template
	paramaters. Adder new function file_new_dialog_set() to set
	gimage and template after creation.

	* app/gui/file-commands.c
	* app/gui/templates-commands.c: changed accordingly.

	* app/tools/gimpimagemaptool.[ch]
	* app/tools/gimptransformtool.[ch]: added
	"const gchar *shell_identifier" to the tool structs. Register the
	tool dialogs using gimp_dialog_factory_add_foreign().

	* app/tools/gimpbrightnesscontrasttool.c
	* app/tools/gimpcolorbalancetool.c
	* app/tools/gimpcurvestool.c
	* app/tools/gimphuesaturationtool.c
	* app/tools/gimplevelstool.c
	* app/tools/gimpperspectivetool.c
	* app/tools/gimpposterizetool.c
	* app/tools/gimprotatetool.c
	* app/tools/gimpscaletool.c
	* app/tools/gimpsheartool.c
	* app/tools/gimpthresholdtool.c: set "shell_identifier" so the
	dialogs become session managed. Fixes bug #61091.

	* app/tools/gimpcroptool.c: register the crop dialog with the
	dialog factory. Fixes bug #52849.

	* app/tools/gimpcolorpickertool.c: ditto.

	Unrelated:

	* app/tools/gimptool.c: no need to cast the return value of
	g_object_new().
2003-05-02 18:43:15 +00:00

160 lines
5.9 KiB
C

/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpdialogfactory.h
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_DIALOG_FACTORY_H__
#define __GIMP_DIALOG_FACTORY_H__
#include "core/gimpobject.h"
typedef GtkWidget * (* GimpDialogNewFunc) (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
typedef struct _GimpDialogFactoryEntry GimpDialogFactoryEntry;
typedef struct _GimpSessionInfo GimpSessionInfo;
struct _GimpDialogFactoryEntry
{
gchar *identifier;
GimpDialogNewFunc new_func;
gint preview_size;
gboolean singleton;
gboolean session_managed;
gboolean remember_size;
gboolean remember_if_open;
};
struct _GimpSessionInfo
{
gint x;
gint y;
gint width;
gint height;
GtkWidget *widget;
/* only valid while restoring and saving the session */
gboolean open;
/* GList of gchar* of optional additional dialog specific info */
GList *aux_info;
/* only one of these is valid */
GimpDialogFactoryEntry *toplevel_entry;
GimpDialogFactoryEntry *dockable_entry;
GList *sub_dialogs; /* GList of GLists of entries */
};
#define GIMP_TYPE_DIALOG_FACTORY (gimp_dialog_factory_get_type ())
#define GIMP_DIALOG_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DIALOG_FACTORY, GimpDialogFactory))
#define GIMP_DIALOG_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DIALOG_FACTORY, GimpDialogFactoryClass))
#define GIMP_IS_DIALOG_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DIALOG_FACTORY))
#define GIMP_IS_DIALOG_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DIALOG_FACTORY))
#define GIMP_DIALOG_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DIALOG_FACTORY, GimpDialogFactoryClass))
typedef struct _GimpDialogFactoryClass GimpDialogFactoryClass;
struct _GimpDialogFactory
{
GimpObject parent_instance;
GimpContext *context;
GimpMenuFactory *menu_factory;
/*< private >*/
GimpDialogNewFunc new_dock_func;
GList *registered_dialogs;
GList *session_infos;
GList *open_dialogs;
};
struct _GimpDialogFactoryClass
{
GimpObjectClass parent_class;
GHashTable *factories;
};
GType gimp_dialog_factory_get_type (void) G_GNUC_CONST;
GimpDialogFactory * gimp_dialog_factory_new (const gchar *name,
GimpContext *context,
GimpMenuFactory *menu_factory,
GimpDialogNewFunc new_dock_func);
GimpDialogFactory * gimp_dialog_factory_from_name (const gchar *name);
void gimp_dialog_factory_register_entry (GimpDialogFactory *factory,
const gchar *identifier,
GimpDialogNewFunc new_func,
gint preview_size,
gboolean singleton,
gboolean session_managed,
gboolean remember_size,
gboolean remember_if_open);
GimpDialogFactoryEntry * gimp_dialog_factory_find_entry
(GimpDialogFactory *factory,
const gchar *identifier);
GimpSessionInfo * gimp_dialog_factory_find_session_info
(GimpDialogFactory *factory,
const gchar *identifier);
GtkWidget * gimp_dialog_factory_dialog_new (GimpDialogFactory *factory,
const gchar *identifier,
gint preview_size);
GtkWidget * gimp_dialog_factory_dialog_raise (GimpDialogFactory *factory,
const gchar *identifier,
gint preview_size);
GtkWidget * gimp_dialog_factory_dockable_new (GimpDialogFactory *factory,
GimpDock *dock,
const gchar *identifier,
gint preview_size);
GtkWidget * gimp_dialog_factory_dock_new (GimpDialogFactory *factory);
void gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
GtkWidget *dialog);
void gimp_dialog_factory_add_foreign (GimpDialogFactory *factory,
const gchar *identifier,
GtkWidget *dialog);
void gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
GtkWidget *dialog);
void gimp_dialog_factories_session_save (GimpConfigWriter *writer);
void gimp_dialog_factories_session_restore (void);
void gimp_dialog_factories_session_clear (void);
void gimp_dialog_factories_toggle (GimpDialogFactory *toolbox_factory);
void gimp_dialog_factories_idle (void);
void gimp_dialog_factories_unidle (void);
#endif /* __GIMP_DIALOG_FACTORY_H__ */