gimp/app/gimpdnd.h
Michael Natterer 99c5201870 Made the tool system work again and integrated it back with the
2001-02-21  Michael Natterer  <mitch@gimp.org>

	Made the tool system work again and integrated it back with the
	GimpContext. It's a hack between old, new and freshly hacked
	stuff. There are still lots of warnings but at least we can switch
	tools again.

	* app/tools/Makefile.am
	* app/tools/gimptoolinfo.[ch]: resurrected as real object.
	The GimpToolInfo objects are derived from GimpData, which gives
	us the tool icon stuff for free. Also, we need a list of _objects_
	which is allocated all the time. All tools are required to have
	a "register" function which registers themselves with the list
	of GimpToolInfo objects which is maintained by the tool manager.

	* app/tools/tool.[ch]: made a real GtkObject with properly named
	functions out of it. The former "active_tool_control" is of
	course not the default implementation of the tool's "control"
	method but a hack _around_ it, so it went to the tool manager.

	* app/tools/color_picker.[ch]
	* app/tools/measure.[ch]: ditto. Added "register" functions and
	"destroy" implementations so the tools go away after use.

	* app/tools/tool_manager.[ch]: badly hacked at the moment to keep
	both the list of class structures _and_ the tool info list.

	* app/tools/tools.c: call the tools' register functions.

	* app/gimpcontext.[ch]: store a pointer to a GimpToolInfo object
	as "active_tool" in the context, so we're independent of tools
	being allocated or not. It's treated just like a brush or pattern
	now.

	* app/gimpdnd.[ch]: made tool DND work like all other DND types.

	* app/devices.[ch]: also here: the tool is just a normal data object
	now, resulting in removal of lots of code.

	* app/commands.c
	* app/context_manager.c: updated the tool select and context stuff
	to work again.

	* app/toolbox.c: removed the old pixmap buttons and put GimpPreviews
	inside the tool buttons. Still needs an own preview type to
	look nice.

	* app/disp_callbacks.c
	* app/about_dialog.c
	* app/app_procs.c
	* app/appenums.h
	* app/apptypes.h
	* app/gimage.c
	* app/gimppalette.c
	* app/gimppreview.c
	* app/gimprc.c
	* app/info_window.c
	* app/menus.c
	* app/palette_select.h
	* app/scale.c
	* app/scroll.c: lots of changes to make it work again.
2001-02-21 12:18:09 +00:00

156 lines
4.7 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__
enum
{
GIMP_DND_TYPE_URI_LIST,
GIMP_DND_TYPE_TEXT_PLAIN,
GIMP_DND_TYPE_NETSCAPE_URL,
GIMP_DND_TYPE_IMAGE,
GIMP_DND_TYPE_LAYER,
GIMP_DND_TYPE_CHANNEL,
GIMP_DND_TYPE_LAYER_MASK,
GIMP_DND_TYPE_COMPONENT,
GIMP_DND_TYPE_PATH,
GIMP_DND_TYPE_COLOR,
GIMP_DND_TYPE_BRUSH,
GIMP_DND_TYPE_PATTERN,
GIMP_DND_TYPE_GRADIENT,
GIMP_DND_TYPE_PALETTE,
GIMP_DND_TYPE_TOOL
};
typedef enum
{
GIMP_DROP_NONE,
GIMP_DROP_ABOVE,
GIMP_DROP_BELOW
} GimpDropType;
#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_PATH \
{ "GIMP_PATH", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_PATH }
#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_TOOL \
{ "GIMP_TOOL", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_TOOL }
/* 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_set (GtkWidget *widget,
GimpDndDropColorFunc set_color_func,
gpointer data);
void gimp_dnd_color_dest_unset (GtkWidget *widget);
/* GimpViewable (by GtkType) dnd functions */
typedef void (* GimpDndDropViewableFunc) (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
typedef GimpViewable * (* GimpDndDragViewableFunc) (GtkWidget *widget,
gpointer data);
void gimp_gtk_drag_source_set_by_type (GtkWidget *widget,
GdkModifierType start_button_mask,
GtkType type,
GdkDragAction actions);
void gimp_gtk_drag_dest_set_by_type (GtkWidget *widget,
GtkDestDefaults flags,
GtkType type,
GdkDragAction actions);
void gimp_dnd_viewable_source_set (GtkWidget *widget,
GtkType type,
GimpDndDragViewableFunc get_viewable_func,
gpointer data);
void gimp_dnd_viewable_dest_set (GtkWidget *widget,
GtkType type,
GimpDndDropViewableFunc set_viewable_func,
gpointer data);
void gimp_dnd_viewable_dest_unset (GtkWidget *widget,
GtkType type);
/* OLD drawable dnd functions */
void gimp_dnd_set_drawable_preview_icon (GtkWidget *widget,
GdkDragContext *context,
GimpDrawable *drawable);
/* file / url dnd functions */
void gimp_dnd_file_dest_set (GtkWidget *widget);
#endif /* __GIMP_DND_H__ */