Commit 0302ed0a authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/brush_select.[ch] app/gradient.c app/gradient_select.[ch]

1999-11-03  Michael Natterer  <mitch@gimp.org>

	* app/brush_select.[ch]
	* app/gradient.c
	* app/gradient_select.[ch]
	* app/interface.[ch]
	* app/palette.c
	* app/pattern_select.[ch]: allow dragging a brush/pattern/... from
	the selections with mouse2 without changing the active element in
	the dialog.

	* app/channels_dialog.c
	* app/color_area.c
	* app/color_panel.c
	* app/color_select.c
	* app/colormap_dialog.i.c
	* app/devices.c
	* app/gimpcontextpreview.[ch]
	* app/gimphelp.[ch]
	* app/gimpui.[ch]
	* app/indicator_area.c
	* app/interface.[ch]
	* app/layers_dialog.c
	* app/lc_dialog.c
	* app/ops_buttons.[ch]
	* app/paths_dialog.c
	* app/preferences_dialog.c
	* app/tools.[ch]: wrapped gtk_tooltips_set_tip() with
	gimp_help_set_help_data() and moved it to gimphelp.[ch].

	This should (hopefully) be the final state of the help system. The
	New function allows a "private tip" to be set without a visible
	tooltip. This way the tooltips inspector (shift+F1) can search for
	help data in the parent containers of the clicked widget. E.g. the
	ops buttons in the layers dialog have private tips like
	"#new_layer" which gets composed with the help data of the layers
	dialog notebook page resulting in a complete help path.

	Allow mouse2 for all dnd operations. Mouse1 still works like before.
parent 46c8110f
1999-11-03 Michael Natterer <mitch@gimp.org>
* app/brush_select.[ch]
* app/gradient.c
* app/gradient_select.[ch]
* app/interface.[ch]
* app/palette.c
* app/pattern_select.[ch]: allow dragging a brush/pattern/... from
the selections with mouse2 without changing the active element in
the dialog.
* app/channels_dialog.c
* app/color_area.c
* app/color_panel.c
* app/color_select.c
* app/colormap_dialog.i.c
* app/devices.c
* app/gimpcontextpreview.[ch]
* app/gimphelp.[ch]
* app/gimpui.[ch]
* app/indicator_area.c
* app/interface.[ch]
* app/layers_dialog.c
* app/lc_dialog.c
* app/ops_buttons.[ch]
* app/paths_dialog.c
* app/preferences_dialog.c
* app/tools.[ch]: wrapped gtk_tooltips_set_tip() with
gimp_help_set_help_data() and moved it to gimphelp.[ch].
This should (hopefully) be the final state of the help system. The
New function allows a "private tip" to be set without a visible
tooltip. This way the tooltips inspector (shift+F1) can search for
help data in the parent containers of the clicked widget. E.g. the
ops buttons in the layers dialog have private tips like
"#new_layer" which gets composed with the help data of the layers
dialog notebook page resulting in a complete help path.
Allow mouse2 for all dnd operations. Mouse1 still works like before.
Tue Nov 2 17:36:21 PST 1999 Manish Singh <yosh@gimp.org> Tue Nov 2 17:36:21 PST 1999 Manish Singh <yosh@gimp.org>
* pixmaps/question.xpm: fake one from alt's screenshot since he * pixmaps/question.xpm: fake one from alt's screenshot since he
......
...@@ -68,6 +68,8 @@ ...@@ -68,6 +68,8 @@
static void brush_change_callbacks (BrushSelect *bsp, static void brush_change_callbacks (BrushSelect *bsp,
gboolean closing); gboolean closing);
static GimpBrush * brush_select_drag_brush (GtkWidget *widget,
gpointer data);
static void brush_select_drop_brush (GtkWidget *widget, static void brush_select_drop_brush (GtkWidget *widget,
GimpBrush *brush, GimpBrush *brush,
gpointer data); gpointer data);
...@@ -252,6 +254,7 @@ brush_select_new (gchar *title, ...@@ -252,6 +254,7 @@ brush_select_new (gchar *title,
bsp = g_new (BrushSelect, 1); bsp = g_new (BrushSelect, 1);
bsp->callback_name = NULL; bsp->callback_name = NULL;
bsp->dnd_brush = NULL;
bsp->brush_popup = NULL; bsp->brush_popup = NULL;
bsp->popup_timeout_tag = 0; bsp->popup_timeout_tag = 0;
bsp->popup_anim_timeout_tag = 0; bsp->popup_anim_timeout_tag = 0;
...@@ -371,6 +374,12 @@ brush_select_new (gchar *title, ...@@ -371,6 +374,12 @@ brush_select_new (gchar *title,
bsp); bsp);
/* dnd stuff */ /* dnd stuff */
gtk_drag_source_set (bsp->preview,
GDK_BUTTON2_MASK,
preview_target_table, preview_n_targets,
GDK_ACTION_COPY);
gimp_dnd_brush_source_set (bsp->preview, brush_select_drag_brush, bsp);
gtk_drag_dest_set (bsp->preview, gtk_drag_dest_set (bsp->preview,
GTK_DEST_DEFAULT_ALL, GTK_DEST_DEFAULT_ALL,
preview_target_table, preview_n_targets, preview_target_table, preview_n_targets,
...@@ -736,6 +745,17 @@ brushes_check_dialogs (void) ...@@ -736,6 +745,17 @@ brushes_check_dialogs (void)
* Local functions * Local functions
*/ */
static GimpBrush *
brush_select_drag_brush (GtkWidget *widget,
gpointer data)
{
BrushSelect *bsp;
bsp = (BrushSelect *) data;
return bsp->dnd_brush;
}
static void static void
brush_select_drop_brush (GtkWidget *widget, brush_select_drop_brush (GtkWidget *widget,
GimpBrush *brush, GimpBrush *brush,
...@@ -1502,14 +1522,21 @@ brush_select_events (GtkWidget *widget, ...@@ -1502,14 +1522,21 @@ brush_select_events (GtkWidget *widget,
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
bevent = (GdkEventButton *) event; bevent = (GdkEventButton *) event;
col = bevent->x / bsp->cell_width;
row = (bevent->y + bsp->scroll_offset) / bsp->cell_height;
index = row * bsp->NUM_BRUSH_COLUMNS + col;
brush = gimp_brush_list_get_brush_by_index (brush_list, index);
if (brush)
bsp->dnd_brush = brush;
else
bsp->dnd_brush = gimp_context_get_brush (bsp->context);
if (bevent->button == 1) if (bevent->button == 1)
{ {
col = bevent->x / bsp->cell_width;
row = (bevent->y + bsp->scroll_offset) / bsp->cell_height;
index = row * bsp->NUM_BRUSH_COLUMNS + col;
/* Get the brush and display the popup brush preview */ /* Get the brush and display the popup brush preview */
if ((brush = gimp_brush_list_get_brush_by_index (brush_list, index))) if (brush)
{ {
gdk_pointer_grab (bsp->preview->window, FALSE, gdk_pointer_grab (bsp->preview->window, FALSE,
(GDK_POINTER_MOTION_HINT_MASK | (GDK_POINTER_MOTION_HINT_MASK |
......
...@@ -62,6 +62,8 @@ struct _BrushSelect ...@@ -62,6 +62,8 @@ struct _BrushSelect
GimpContext *context; GimpContext *context;
gint spacing_value; gint spacing_value;
GimpBrush *dnd_brush;
/* Some variables to keep the GUI consistent */ /* Some variables to keep the GUI consistent */
gint cell_width; gint cell_width;
gint cell_height; gint cell_height;
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "gimpdnd.h" #include "gimpdnd.h"
#include "gimprc.h" #include "gimprc.h"
#include "gimpui.h" #include "gimpui.h"
#include "interface.h"
#include "layers_dialogP.h" #include "layers_dialogP.h"
#include "lc_dialogP.h" #include "lc_dialogP.h"
#include "menus.h" #include "menus.h"
...@@ -174,7 +173,7 @@ static GdkPixmap *channel_pixmap[] = { NULL, NULL, NULL }; ...@@ -174,7 +173,7 @@ static GdkPixmap *channel_pixmap[] = { NULL, NULL, NULL };
static gint suspend_gimage_notify = 0; static gint suspend_gimage_notify = 0;
/* the ops buttons */ /* the ops buttons */
static OpsButtonCallback to_selection_ext_callbacks[] = static GtkSignalFunc to_selection_ext_callbacks[] =
{ {
channels_dialog_add_channel_to_sel_callback, /* SHIFT */ channels_dialog_add_channel_to_sel_callback, /* SHIFT */
channels_dialog_sub_channel_from_sel_callback, /* CTRL */ channels_dialog_sub_channel_from_sel_callback, /* CTRL */
...@@ -268,8 +267,14 @@ channels_dialog_create (void) ...@@ -268,8 +267,14 @@ channels_dialog_create (void)
} }
/* The main vbox */ /* The main vbox */
channelsD->vbox = vbox = gtk_vbox_new (FALSE, 1); channelsD->vbox = gtk_event_box_new ();
gimp_help_set_help_data (channelsD->vbox, NULL,
"dialogs/channels/channels.html");
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2); gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_container_add (GTK_CONTAINER (channelsD->vbox), vbox);
/* The channels commands pulldown menu */ /* The channels commands pulldown menu */
menus_get_channels_menu (&channelsD->ops_menu, &channelsD->accel_group); menus_get_channels_menu (&channelsD->ops_menu, &channelsD->accel_group);
...@@ -298,8 +303,8 @@ channels_dialog_create (void) ...@@ -298,8 +303,8 @@ channels_dialog_create (void)
gtk_widget_show (channelsD->scrolled_win); gtk_widget_show (channelsD->scrolled_win);
/* The ops buttons */ /* The ops buttons */
button_box = ops_button_box_new (lc_dialog->shell, tool_tips, button_box = ops_button_box_new (lc_dialog->shell, channels_ops_buttons,
channels_ops_buttons, OPS_BUTTON_NORMAL); OPS_BUTTON_NORMAL);
gtk_box_pack_start (GTK_BOX (vbox), button_box, FALSE, FALSE, 2); gtk_box_pack_start (GTK_BOX (vbox), button_box, FALSE, FALSE, 2);
gtk_widget_show (button_box); gtk_widget_show (button_box);
...@@ -348,6 +353,7 @@ channels_dialog_create (void) ...@@ -348,6 +353,7 @@ channels_dialog_create (void)
NULL); NULL);
gtk_widget_show (vbox); gtk_widget_show (vbox);
gtk_widget_show (channelsD->vbox);
return channelsD->vbox; return channelsD->vbox;
} }
...@@ -1432,7 +1438,7 @@ channel_widget_create (GImage *gimage, ...@@ -1432,7 +1438,7 @@ channel_widget_create (GImage *gimage,
/* dnd source */ /* dnd source */
gtk_drag_source_set (list_item, gtk_drag_source_set (list_item,
GDK_BUTTON1_MASK, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
channel_target_table, n_channel_targets, channel_target_table, n_channel_targets,
GDK_ACTION_MOVE | GDK_ACTION_COPY); GDK_ACTION_MOVE | GDK_ACTION_COPY);
...@@ -1447,7 +1453,7 @@ channel_widget_create (GImage *gimage, ...@@ -1447,7 +1453,7 @@ channel_widget_create (GImage *gimage,
{ {
/* dnd source */ /* dnd source */
gtk_drag_source_set (list_item, gtk_drag_source_set (list_item,
GDK_BUTTON1_MASK, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
component_target_table, n_component_targets, component_target_table, n_component_targets,
GDK_ACTION_MOVE | GDK_ACTION_COPY); GDK_ACTION_MOVE | GDK_ACTION_COPY);
......
...@@ -402,7 +402,7 @@ color_area_create (gint width, ...@@ -402,7 +402,7 @@ color_area_create (gint width,
/* dnd stuff */ /* dnd stuff */
gtk_drag_source_set (color_area, gtk_drag_source_set (color_area,
GDK_BUTTON1_MASK | GDK_BUTTON3_MASK, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
color_area_target_table, n_color_area_targets, color_area_target_table, n_color_area_targets,
GDK_ACTION_COPY | GDK_ACTION_MOVE); GDK_ACTION_COPY | GDK_ACTION_MOVE);
gimp_dnd_color_source_set (color_area, color_area_drag_color, NULL); gimp_dnd_color_source_set (color_area, color_area_drag_color, NULL);
......
...@@ -102,7 +102,7 @@ color_panel_new (guchar *initial, ...@@ -102,7 +102,7 @@ color_panel_new (guchar *initial,
/* dnd stuff */ /* dnd stuff */
gtk_drag_source_set (private->drawing_area, gtk_drag_source_set (private->drawing_area,
GDK_BUTTON1_MASK | GDK_BUTTON3_MASK, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
color_panel_target_table, n_color_panel_targets, color_panel_target_table, n_color_panel_targets,
GDK_ACTION_COPY | GDK_ACTION_MOVE); GDK_ACTION_COPY | GDK_ACTION_MOVE);
gimp_dnd_color_source_set (private->drawing_area, gimp_dnd_color_source_set (private->drawing_area,
......
...@@ -338,7 +338,7 @@ color_select_widget_new (ColorSelect *csp, ...@@ -338,7 +338,7 @@ color_select_widget_new (ColorSelect *csp,
/* dnd stuff */ /* dnd stuff */
gtk_drag_source_set (csp->new_color, gtk_drag_source_set (csp->new_color,
GDK_BUTTON1_MASK | GDK_BUTTON3_MASK, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
color_select_target_table, n_color_select_targets, color_select_target_table, n_color_select_targets,
GDK_ACTION_COPY | GDK_ACTION_MOVE); GDK_ACTION_COPY | GDK_ACTION_MOVE);
gimp_dnd_color_source_set (csp->new_color, color_select_drag_new_color, csp); gimp_dnd_color_source_set (csp->new_color, color_select_drag_new_color, csp);
...@@ -365,7 +365,7 @@ color_select_widget_new (ColorSelect *csp, ...@@ -365,7 +365,7 @@ color_select_widget_new (ColorSelect *csp,
/* dnd stuff */ /* dnd stuff */
gtk_drag_source_set (csp->orig_color, gtk_drag_source_set (csp->orig_color,
GDK_BUTTON1_MASK | GDK_BUTTON3_MASK, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
color_select_target_table, n_color_select_targets, color_select_target_table, n_color_select_targets,
GDK_ACTION_COPY | GDK_ACTION_MOVE); GDK_ACTION_COPY | GDK_ACTION_MOVE);
gimp_dnd_color_source_set (csp->orig_color, color_select_drag_old_color, csp); gimp_dnd_color_source_set (csp->orig_color, color_select_drag_old_color, csp);
......
...@@ -243,7 +243,7 @@ ipal_create (GimpSet* context) ...@@ -243,7 +243,7 @@ ipal_create (GimpSet* context)
/* dnd stuff */ /* dnd stuff */
gtk_drag_source_set (GTK_WIDGET(ipal->palette), gtk_drag_source_set (GTK_WIDGET(ipal->palette),
GDK_BUTTON1_MASK | GDK_BUTTON3_MASK, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
color_palette_target_table, n_color_palette_targets, color_palette_target_table, n_color_palette_targets,
GDK_ACTION_COPY | GDK_ACTION_MOVE); GDK_ACTION_COPY | GDK_ACTION_MOVE);
gimp_dnd_color_source_set (GTK_WIDGET (ipal->palette), gimp_dnd_color_source_set (GTK_WIDGET (ipal->palette),
......
...@@ -21,19 +21,19 @@ ...@@ -21,19 +21,19 @@
#include <stdio.h> #include <stdio.h>
#include "appenv.h" #include "appenv.h"
#include "devices.h"
#include "dialog_handler.h"
#include "gimpcontextpreview.h" #include "gimpcontextpreview.h"
#include "gimpdnd.h" #include "gimpdnd.h"
#include "devices.h"
#include "interface.h"
#include "gimpbrushlist.h" #include "gimpbrushlist.h"
#include "gimpcontext.h" #include "gimpcontext.h"
#include "gimprc.h" #include "gimprc.h"
#include "gimpui.h" #include "gimpui.h"
#include "gradient.h" #include "gradient.h"
#include "gradient_header.h" #include "gradient_header.h"
#include "interface.h"
#include "session.h" #include "session.h"
#include "tools.h" #include "tools.h"
#include "dialog_handler.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"
#include "libgimp/gimpenv.h" #include "libgimp/gimpenv.h"
...@@ -798,7 +798,7 @@ device_status_create (void) ...@@ -798,7 +798,7 @@ device_status_create (void)
gtk_pixmap_new (create_tool_pixmap (deviceD->table, RECT_SELECT), gtk_pixmap_new (create_tool_pixmap (deviceD->table, RECT_SELECT),
NULL); NULL);
gtk_drag_source_set (deviceD->eventboxes[i], gtk_drag_source_set (deviceD->eventboxes[i],
GDK_BUTTON1_MASK, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
tool_target_table, n_tool_targets, tool_target_table, n_tool_targets,
GDK_ACTION_COPY); GDK_ACTION_COPY);
gimp_dnd_tool_source_set (deviceD->eventboxes[i], gimp_dnd_tool_source_set (deviceD->eventboxes[i],
...@@ -826,7 +826,7 @@ device_status_create (void) ...@@ -826,7 +826,7 @@ device_status_create (void)
gtk_preview_size (GTK_PREVIEW (deviceD->colors[i]), gtk_preview_size (GTK_PREVIEW (deviceD->colors[i]),
CELL_SIZE, CELL_SIZE); CELL_SIZE, CELL_SIZE);
gtk_drag_source_set (deviceD->colors[i], gtk_drag_source_set (deviceD->colors[i],
GDK_BUTTON1_MASK, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
color_area_target_table, n_color_area_targets, color_area_target_table, n_color_area_targets,
GDK_ACTION_COPY); GDK_ACTION_COPY);
gimp_dnd_color_source_set (deviceD->colors[i], gimp_dnd_color_source_set (deviceD->colors[i],
...@@ -849,7 +849,7 @@ device_status_create (void) ...@@ -849,7 +849,7 @@ device_status_create (void)
deviceD->brushes[i] = deviceD->brushes[i] =
gimp_context_preview_new (GCP_BRUSH, gimp_context_preview_new (GCP_BRUSH,
CELL_SIZE, CELL_SIZE, CELL_SIZE, CELL_SIZE,
FALSE, TRUE, TRUE, FALSE, TRUE,
GTK_SIGNAL_FUNC (device_status_drop_brush), GTK_SIGNAL_FUNC (device_status_drop_brush),
GUINT_TO_POINTER (device_info->device)); GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->brushes[i], gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->brushes[i],
...@@ -861,7 +861,7 @@ device_status_create (void) ...@@ -861,7 +861,7 @@ device_status_create (void)
deviceD->patterns[i] = deviceD->patterns[i] =
gimp_context_preview_new (GCP_PATTERN, gimp_context_preview_new (GCP_PATTERN,
CELL_SIZE, CELL_SIZE, CELL_SIZE, CELL_SIZE,
FALSE, TRUE, TRUE, FALSE, TRUE,
GTK_SIGNAL_FUNC (device_status_drop_pattern), GTK_SIGNAL_FUNC (device_status_drop_pattern),
GUINT_TO_POINTER (device_info->device)); GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->patterns[i], gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->patterns[i],
...@@ -873,7 +873,7 @@ device_status_create (void) ...@@ -873,7 +873,7 @@ device_status_create (void)
deviceD->gradients[i] = deviceD->gradients[i] =
gimp_context_preview_new (GCP_GRADIENT, gimp_context_preview_new (GCP_GRADIENT,
CELL_SIZE * 2, CELL_SIZE, CELL_SIZE * 2, CELL_SIZE,
FALSE, TRUE, TRUE, FALSE, TRUE,
GTK_SIGNAL_FUNC (device_status_drop_gradient), GTK_SIGNAL_FUNC (device_status_drop_gradient),
GUINT_TO_POINTER (device_info->device)); GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->gradients[i], gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->gradients[i],
...@@ -1009,9 +1009,9 @@ device_status_update (guint32 deviceid) ...@@ -1009,9 +1009,9 @@ device_status_update (guint32 deviceid)
gtk_widget_show (deviceD->tools[i]); gtk_widget_show (deviceD->tools[i]);
gtk_widget_show (deviceD->eventboxes[i]); gtk_widget_show (deviceD->eventboxes[i]);
gtk_tooltips_set_tip (tool_tips,deviceD->eventboxes[i], gimp_help_set_help_data (deviceD->eventboxes[i],
tool_info[(int) gimp_context_get_tool (device_info->context)].tool_desc, tool_info[(gint) gimp_context_get_tool (device_info->context)].tool_desc,
NULL); tool_info[(gint) gimp_context_get_tool (device_info->context)].private_tip);
for (j = 0; j < CELL_SIZE * 3; j += 3) for (j = 0; j < CELL_SIZE * 3; j += 3)
{ {
...@@ -1033,7 +1033,7 @@ device_status_update (guint32 deviceid) ...@@ -1033,7 +1033,7 @@ device_status_update (guint32 deviceid)
buffer[j+1], buffer[j+1],
buffer[j+2]); buffer[j+2]);
gtk_tooltips_set_tip (tool_tips, deviceD->colors[i], ttbuf, NULL); gimp_help_set_help_data (deviceD->colors[i], ttbuf, NULL);
if (gimp_context_get_brush (device_info->context)) if (gimp_context_get_brush (device_info->context))
{ {
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "gimprc.h" #include "gimprc.h"
#include "gimpui.h" #include "gimpui.h"
#include "image_render.h" #include "image_render.h"
#include "interface.h"
#include "lc_dialog.h" #include "lc_dialog.h"
#include "layer_select.h" #include "layer_select.h"
#include "session.h" #include "session.h"
...@@ -279,9 +278,9 @@ file_prefs_ok_callback (GtkWidget *widget, ...@@ -279,9 +278,9 @@ file_prefs_ok_callback (GtkWidget *widget,
prefs_dlg = NULL; prefs_dlg = NULL;
if (show_tool_tips) if (show_tool_tips)
gtk_tooltips_enable (tool_tips); gimp_help_enable_tooltips ();
else else
gtk_tooltips_disable (tool_tips); gimp_help_disable_tooltips ();
/* This needs modification to notify the user of which simply cannot be /* This needs modification to notify the user of which simply cannot be
* changed on the fly. Currently it ignores these options if only OK is * changed on the fly. Currently it ignores these options if only OK is
......
...@@ -90,6 +90,8 @@ static gboolean toolbox_drag_drop (GtkWidget *, ...@@ -90,6 +90,8 @@ static gboolean toolbox_drag_drop (GtkWidget *,
gint, gint,
gint, gint,
guint); guint);
static ToolType toolbox_drag_tool (GtkWidget *,
gpointer);
static void toolbox_drop_tool (GtkWidget *, static void toolbox_drop_tool (GtkWidget *,
ToolType, ToolType,
gpointer); gpointer);
...@@ -111,11 +113,8 @@ static int pixmap_colors[8][3] = ...@@ -111,11 +113,8 @@ static int pixmap_colors[8][3] =
#define ROWS 8 #define ROWS 8
#define MARGIN 2 #define MARGIN 2
/* global variables */
GtkTooltips * tool_tips;
/* local variables */ /* local variables */
static GdkColor colors[12]; static GdkColor colors[11];
static GtkWidget * toolbox_shell = NULL; static GtkWidget * toolbox_shell = NULL;
static GtkTargetEntry toolbox_target_table[] = static GtkTargetEntry toolbox_target_table[] =
...@@ -131,6 +130,13 @@ static GtkTargetEntry toolbox_target_table[] = ...@@ -131,6 +130,13 @@ static GtkTargetEntry toolbox_target_table[] =
static guint toolbox_n_targets = (sizeof (toolbox_target_table) / static guint toolbox_n_targets = (sizeof (toolbox_target_table) /
sizeof (toolbox_target_table[0])); sizeof (toolbox_target_table[0]));
static GtkTargetEntry tool_target_table[] =
{
GIMP_TARGET_TOOL
};
static guint tool_n_targets = (sizeof (tool_target_table) /
sizeof (tool_target_table[0]));
static GtkTargetEntry display_target_table[] = static GtkTargetEntry display_target_table[] =
{ {
GIMP_TARGET_LAYER, GIMP_TARGET_LAYER,
...@@ -237,12 +243,6 @@ allocate_colors (GtkWidget *parent) ...@@ -237,12 +243,6 @@ allocate_colors (GtkWidget *parent)
colors[10] = parent->style->bg[GTK_STATE_PRELIGHT]; colors[10] = parent->style->bg[GTK_STATE_PRELIGHT];
gdk_color_alloc (colormap, &colors[10]); gdk_color_alloc (colormap, &colors[10]);
/* postit yellow (khaki) as background for tooltips */
colors[11].red = 61669;
colors[11].green = 59113;
colors[11].blue = 35979;
gdk_color_alloc (colormap, &colors[11]);
} }
static void static void
...@@ -263,6 +263,8 @@ create_indicator_area (GtkWidget *parent) ...@@ -263,6 +263,8 @@ create_indicator_area (GtkWidget *parent)
gtk_container_set_border_width (GTK_CONTAINER (alignment), 3); gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
gtk_container_add (GTK_CONTAINER (frame), alignment); gtk_container_add (GTK_CONTAINER (frame), alignment);
gimp_help_set_help_data (alignment, NULL, "#indicator_area");
ind_area = indicator_area_create (); ind_area = indicator_area_create ();
gtk_container_add (GTK_CONTAINER (alignment), ind_area); gtk_container_add (GTK_CONTAINER (alignment), ind_area);
gtk_widget_show (ind_area); gtk_widget_show (ind_area);
...@@ -295,13 +297,15 @@ create_color_area (GtkWidget *parent) ...@@ -295,13 +297,15 @@ create_color_area (GtkWidget *parent)
gtk_container_set_border_width (GTK_CONTAINER (alignment), 3); gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
gtk_container_add (GTK_CONTAINER (frame), alignment); gtk_container_add (GTK_CONTAINER (frame), alignment);
gimp_help_set_help_data (alignment, NULL, "#color_area");
col_area = color_area_create (54, 42, default_pixmap, swap_pixmap); col_area = color_area_create (54, 42, default_pixmap, swap_pixmap);
gtk_container_add (GTK_CONTAINER (alignment), col_area); gtk_container_add (GTK_CONTAINER (alignment), col_area);
gtk_tooltips_set_tip (tool_tips, col_area, gimp_help_set_help_data
_("Foreground & background colors. The black " (col_area,
"and white squares reset colors. The arrows swap colors. Double " _("Foreground & background colors. The black "
"click to select a color from a colorrequester."), "and white squares reset colors. The arrows swap colors. Double "
NULL); "click to select a color from a colorrequester."), NULL);
gtk_widget_show (col_area); gtk_widget_show (col_area);
gtk_widget_show (alignment); gtk_widget_show (alignment);
gtk_widget_show (frame); gtk_widget_show (frame);
...@@ -381,9 +385,17 @@ create_tools (GtkWidget *parent) ...@@ -381,9 +385,17 @@ create_tools (GtkWidget *parent)
GTK_SIGNAL_FUNC (tools_button_press), GTK_SIGNAL_FUNC (tools_button_press),
(gpointer) tool_info[j].tool_id); (gpointer) tool_info[j].tool_id);
gtk_tooltips_set_tip (tool_tips, button, /* dnd stuff */
gettext(tool_info[j].tool_desc), gtk_drag_source_set (tool_info[j].tool_widget,
tool_info[j].private_tip); GDK_BUTTON2_MASK,
tool_target_table, tool_n_targets,
GDK_ACTION_COPY);
gimp_dnd_tool_source_set (tool_info[j].tool_widget,
toolbox_drag_tool, (gpointer) j);
gimp_help_set_help_data (button,
gettext(tool_info[j].tool_desc),
tool_info[j].private_tip);
gtk_widget_show (pixmap); gtk_widget_show (pixmap);
gtk_widget_show (alignment); gtk_widget_show (alignment);
...@@ -563,12 +575,9 @@ create_toolbox (void) ...@@ -563,12 +575,9 @@ create_toolbox (void)
allocate_colors (main_vbox); allocate_colors (main_vbox);
/* tooltips */ /* tooltips */
tool_tips = gtk_tooltips_new (); gimp_help_init ();
gtk_tooltips_set_colors (tool_tips,
&colors[11],
&main_vbox->style->fg[GTK_STATE_NORMAL]);
if (!show_tool_tips) if (!show_tool_tips)
gtk_tooltips_disable (tool_tips); gimp_help_disable_tooltips ();
/* Build the menu bar with menus */ /* Build the menu bar with menus */
menus_get_toolbox_menubar (&menubar, &table); menus_get_toolbox_menubar (&menubar, &table);
...@@ -592,7 +601,7 @@ create_toolbox (void) ...@@ -592,7 +601,7 @@ create_toolbox (void)
create_tools (wbox); create_tools (wbox);
create_color_area (wbox); create_color_area (wbox);
if (show_indicators && (!no_data) ) if (show_indicators && (!no_data) )
create_indicator_area (wbox); create_indicator_area (wbox);
gtk_widget_show (window); gtk_widget_show (window);
toolbox_set_drag_dest (window); toolbox_set_drag_dest (window);
...@@ -612,8 +621,7 @@ toolbox_free (void) ...@@ -612,8 +621,7 @@ toolbox_free (void)
if (!tool_info[i].icon_data) if (!tool_info[i].icon_data)
gtk_object_sink (GTK_OBJECT (tool_info[i].tool_widget)); gtk_object_sink (GTK_OBJECT (tool_info[i].tool_widget));
}