gimp/app/widgets/gimpdnd.h
Michael Natterer c8b4394d71 Reimplemented the undo history:
2003-02-20  Michael Natterer  <mitch@gimp.org>

	Reimplemented the undo history:

	* app/Makefile.am
	* app/undo_history.[ch]: removed.

	Changes/cleanups to the undo system to enable/simplify the new
	undo history implementation:

	* app/core/core-types.h: removed enum undo_event_t. Removed the
	GimpImage parameter from GimpUndoPopFunc and GimpUndoFreeFunc
	because GimpUndo has a GimpImage pointer now (see below).

	* app/core/core-enums.[ch]: added enum GimpUndoEvent. Added an
	enum value for REDO_EXPIRED.

	* app/core/gimpimage.[ch]: added a GimpUndo pointer to the
	"undo_event" signal which needs to be passed for all events except
	UNDO_FREE.

	* app/display/gimpdisplayshell-handlers.c: changed accordingly.

	* app/core/gimpundo.[ch]: added a GimpImage pointer to the
	GimpUndo struct. Removed GimpImage parameters all over the
	place. Added preview stuff. The preview creation needs to be
	triggered explicitly using gimp_undo_create_preview() because the
	GimpUndo can't know when it's possible to create the preview.

	* app/core/gimpimage-undo-push.c
	* app/paint/gimppaintcore-undo.c
	* app/tools/gimptransformtool-undo.c: changed accordingly, cleanup.

	* app/core/gimpundostack.[ch]: ditto. Return the freed undo from
	gimp_undo_stack_free_bottom(). Removed unused container signal
	handlers.

	* app/core/gimpimage-undo.c: free the redo stack the same way old
	undos are freed (from bottom up). Emit "undo_event" with event ==
	REDO_EXPIRED for each removed redo.

	* app/core/gimpmarshal.list: added new marshallers.

	New undo history implementation:

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimpundoeditor.[ch]
	* app/widgets/gimpundopreview.[ch]: new widgets for the undo
	step previews and the history itself.

	* app/widgets/gimppreview-utils.c: added GimpUndoPreview to the
	list of possible preview types.

	* app/gui/dialogs-constructors.[ch]
	* app/gui/dialogs-menu.c
	* app/gui/dialogs.c
	* app/gui/image-menu.c
	* app/gui/toolbox-menu.c: removed the old and added the new undo
	history to the dialog factory and the various dialog menus.

	* app/widgets/gimpdnd.[ch]: don't warn if a GType has no
	corresponding DND type. Instead, return FALSE from the function
	that failed.

	* app/widgets/gimppreview.c: check the return value of gimpdnd
	functions.  Not only add drag sources but also remove them when no
	longer needed.

	* app/widgets/gimpselectioneditor.h: removed unneeded inclusion of
	"gui/gui-types.h".
2003-02-20 12:47:42 +00:00

175 lines
6.4 KiB
C

/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* 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_DND_H__
#define __GIMP_DND_H__
typedef enum
{
GIMP_DND_TYPE_NONE = 0,
GIMP_DND_TYPE_URI_LIST = 1,
GIMP_DND_TYPE_TEXT_PLAIN = 2,
GIMP_DND_TYPE_NETSCAPE_URL = 3,
GIMP_DND_TYPE_COLOR = 4,
GIMP_DND_TYPE_IMAGE = 5,
GIMP_DND_TYPE_LAYER = 6,
GIMP_DND_TYPE_CHANNEL = 7,
GIMP_DND_TYPE_LAYER_MASK = 8,
GIMP_DND_TYPE_COMPONENT = 9,
GIMP_DND_TYPE_VECTORS = 10,
GIMP_DND_TYPE_BRUSH = 11,
GIMP_DND_TYPE_PATTERN = 12,
GIMP_DND_TYPE_GRADIENT = 13,
GIMP_DND_TYPE_PALETTE = 14,
GIMP_DND_TYPE_BUFFER = 15,
GIMP_DND_TYPE_IMAGEFILE = 16,
GIMP_DND_TYPE_TOOL = 17,
GIMP_DND_TYPE_DIALOG = 18,
GIMP_DND_TYPE_LAST = GIMP_DND_TYPE_DIALOG
} GimpDndType;
#define GIMP_TARGET_URI_LIST \
{ "text/uri-list", 0, GIMP_DND_TYPE_URI_LIST }
#define GIMP_TARGET_TEXT_PLAIN \
{ "text/plain", 0, GIMP_DND_TYPE_TEXT_PLAIN }
#define GIMP_TARGET_NETSCAPE_URL \
{ "_NETSCAPE_URL", 0, GIMP_DND_TYPE_NETSCAPE_URL }
#define GIMP_TARGET_IMAGE \
{ "GIMP_IMAGE", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_IMAGE }
#define GIMP_TARGET_LAYER \
{ "GIMP_LAYER", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_LAYER }
#define GIMP_TARGET_CHANNEL \
{ "GIMP_CHANNEL", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_CHANNEL }
#define GIMP_TARGET_LAYER_MASK \
{ "GIMP_LAYER_MASK", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_LAYER_MASK }
#define GIMP_TARGET_COMPONENT \
{ "GIMP_COMPONENT", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_COMPONENT }
#define GIMP_TARGET_VECTORS \
{ "GIMP_VECTORS", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_VECTORS }
#define GIMP_TARGET_COLOR \
{ "application/x-color", 0, GIMP_DND_TYPE_COLOR }
#define GIMP_TARGET_BRUSH \
{ "GIMP_BRUSH", 0, GIMP_DND_TYPE_BRUSH }
#define GIMP_TARGET_PATTERN \
{ "GIMP_PATTERN", 0, GIMP_DND_TYPE_PATTERN }
#define GIMP_TARGET_GRADIENT \
{ "GIMP_GRADIENT", 0, GIMP_DND_TYPE_GRADIENT }
#define GIMP_TARGET_PALETTE \
{ "GIMP_PALETTE", 0, GIMP_DND_TYPE_PALETTE }
#define GIMP_TARGET_BUFFER \
{ "GIMP_BUFFER", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_BUFFER }
#define GIMP_TARGET_IMAGEFILE \
{ "GIMP_IMAGEFILE", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_IMAGEFILE }
#define GIMP_TARGET_TOOL \
{ "GIMP_TOOL", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_TOOL }
#define GIMP_TARGET_DIALOG \
{ "GIMP_DIALOG", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_DIALOG }
/* file / url dnd functions */
typedef void (* GimpDndDropFileFunc) (GtkWidget *widget,
GList *files,
gpointer data);
void gimp_dnd_file_dest_add (GtkWidget *widget,
GimpDndDropFileFunc set_file_func,
gpointer data);
void gimp_dnd_file_dest_remove (GtkWidget *widget);
/* standard callback */
void gimp_dnd_open_files (GtkWidget *widget,
GList *files,
gpointer data);
/* color dnd functions */
typedef void (* GimpDndDropColorFunc) (GtkWidget *widget,
const GimpRGB *color,
gpointer data);
typedef void (* GimpDndDragColorFunc) (GtkWidget *widget,
GimpRGB *color,
gpointer data);
void gimp_dnd_color_source_set (GtkWidget *widget,
GimpDndDragColorFunc get_color_func,
gpointer data);
void gimp_dnd_color_dest_add (GtkWidget *widget,
GimpDndDropColorFunc set_color_func,
gpointer data);
void gimp_dnd_color_dest_remove (GtkWidget *widget);
/* GimpViewable (by GType) dnd functions */
typedef void (* GimpDndDropViewableFunc) (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
typedef GimpViewable * (* GimpDndDragViewableFunc) (GtkWidget *widget,
gpointer data);
gboolean gimp_dnd_drag_source_set_by_type (GtkWidget *widget,
GdkModifierType start_button_mask,
GType type,
GdkDragAction actions);
gboolean gimp_dnd_viewable_source_set (GtkWidget *widget,
GType type,
GimpDndDragViewableFunc get_viewable_func,
gpointer data);
gboolean gimp_dnd_viewable_source_unset (GtkWidget *widget,
GType type);
gboolean gimp_dnd_drag_dest_set_by_type (GtkWidget *widget,
GtkDestDefaults flags,
GType type,
GdkDragAction actions);
gboolean gimp_dnd_viewable_dest_add (GtkWidget *widget,
GType type,
GimpDndDropViewableFunc set_viewable_func,
gpointer data);
gboolean gimp_dnd_viewable_dest_remove (GtkWidget *widget,
GType type);
GimpViewable * gimp_dnd_get_drag_data (GtkWidget *widget);
#endif /* __GIMP_DND_H__ */