svg text alignment
[dia.git] / app / interface.c
blob5ac7c2861529f324781914f53c6a86232f9158be
1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1998 Alexander Larsson
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 /* $Header: /cvs/gnome/dia/app/interface.c,v 1.61 2002/01/19 11:22:24 sdteffen Exp $ */
20 #include <config.h>
22 #include <stdio.h>
23 #include <string.h>
25 #include "diagram.h"
26 #include "layer_dialog.h"
27 #include "interface.h"
28 #include "display.h"
29 #include "pixmaps.h"
30 #include "preferences.h"
31 #include "commands.h"
32 #include "dia_dirs.h"
33 #include "diagram_tree_window.h"
34 #include <gdk-pixbuf/gdk-pixbuf.h>
36 static const GtkTargetEntry create_object_targets[] = {
37 { "application/x-dia-object", 0, 0 },
40 ToolButton tool_data[] =
42 { (char **) arrow_xpm,
43 N_("Modify object(s)"),
44 N_("Modify"),
45 { MODIFY_TOOL, NULL, NULL}
47 { (char **) magnify_xpm,
48 N_("Magnify"),
49 N_("Magnify"),
50 { MAGNIFY_TOOL, NULL, NULL}
52 { (char **) scroll_xpm,
53 N_("Scroll around the diagram"),
54 N_("Scroll"),
55 { SCROLL_TOOL, NULL, NULL}
57 { NULL,
58 N_("Create Text"),
59 N_("Text"),
60 { CREATE_OBJECT_TOOL, "Standard - Text", NULL }
62 { NULL,
63 N_("Create Box"),
64 N_("Box"),
65 { CREATE_OBJECT_TOOL, "Standard - Box", NULL }
67 { NULL,
68 N_("Create Ellipse"),
69 N_("Ellipse"),
70 { CREATE_OBJECT_TOOL, "Standard - Ellipse", NULL }
72 { NULL,
73 N_("Create Polygon"),
74 N_("Polygon"),
75 { CREATE_OBJECT_TOOL, "Standard - Polygon", NULL }
77 { NULL,
78 N_("Create Beziergon"),
79 N_("Beziergon"),
80 { CREATE_OBJECT_TOOL, "Standard - Beziergon", NULL }
82 { NULL,
83 N_("Create Line"),
84 N_("Line"),
85 { CREATE_OBJECT_TOOL, "Standard - Line", NULL }
87 { NULL,
88 N_("Create Arc"),
89 N_("Arc"),
90 { CREATE_OBJECT_TOOL, "Standard - Arc", NULL }
92 { NULL,
93 N_("Create Zigzagline"),
94 N_("Zigzagline"),
95 { CREATE_OBJECT_TOOL, "Standard - ZigZagLine", NULL }
97 { NULL,
98 N_("Create Polyline"),
99 N_("Polyline"),
100 { CREATE_OBJECT_TOOL, "Standard - PolyLine", NULL }
102 { NULL,
103 N_("Create Bezierline"),
104 N_("Bezierline"),
105 { CREATE_OBJECT_TOOL, "Standard - BezierLine", NULL }
107 { NULL,
108 N_("Create Image"),
109 N_("Image"),
110 { CREATE_OBJECT_TOOL, "Standard - Image", NULL }
114 #define NUM_TOOLS (sizeof (tool_data) / sizeof (ToolButton))
115 const int num_tools = NUM_TOOLS;
117 #define COLUMNS 4
118 #define ROWS 3
120 static GtkWidget *toolbox_shell = NULL;
121 static GtkWidget *tool_widgets[NUM_TOOLS];
122 static GtkTooltips *tool_tips;
123 static GSList *tool_group = NULL;
125 GtkWidget *modify_tool_button;
127 /* The popup shell is a pointer to the display shell that posted the latest
128 * popup menu. When this is null, and a command is invoked, then the
129 * assumption is that the command was a result of a keyboard accelerator
131 GtkWidget *popup_shell = NULL;
133 static gint
134 origin_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
136 DDisplay *ddisp = (DDisplay *)data;
138 display_set_active(ddisp);
139 ddisplay_popup_menu(ddisp, event);
141 /* stop the signal emission so the button doesn't grab the
142 * pointer from us */
143 gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "button_press_event");
145 return FALSE;
148 #ifndef WITHOUT_ZOOM_COMBO
149 static void
150 zoom_activate_callback(GtkWidget *dummy, gpointer user_data) {
151 DDisplay *ddisp = (DDisplay *)user_data;
152 gchar *zoom_text = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(ddisp->zoom_status)->entry));
153 float zoom_amount, magnify;
155 if (sscanf(zoom_text, "%f", &zoom_amount)) {
156 Point middle;
157 Rectangle *visible;
159 magnify = (zoom_amount*DDISPLAY_NORMAL_ZOOM/100.0)/ddisp->zoom_factor;
160 if (fabs(magnify - 1.0) > 0.000001) {
161 visible = &ddisp->visible;
162 middle.x = visible->left*0.5 + visible->right*0.5;
163 middle.y = visible->top*0.5 + visible->bottom*0.5;
164 ddisplay_zoom(ddisp, &middle, magnify);
170 static GtkWidget*
171 create_zoom_widget(DDisplay *ddisp) {
172 GtkWidget *combo = NULL;
173 GList *items = NULL;
175 combo = gtk_combo_new();
176 items = g_list_append(items, "400%");
177 items = g_list_append(items, "283%");
178 items = g_list_append(items, "200%");
179 items = g_list_append(items, "141%");
180 items = g_list_append(items, "100%");
181 items = g_list_append(items, "85%");
182 items = g_list_append(items, "70.7%");
183 items = g_list_append(items, "50%");
184 items = g_list_append(items, "35.4%");
185 items = g_list_append(items, "25%");
186 gtk_combo_set_popdown_strings (GTK_COMBO(combo), items);
187 gtk_combo_set_value_in_list(GTK_COMBO(combo), FALSE, FALSE);
188 gtk_combo_disable_activate(GTK_COMBO(combo));
190 gtk_signal_connect (GTK_OBJECT (GTK_COMBO(combo)->entry), "activate",
191 (GtkSignalFunc) zoom_activate_callback,
192 ddisp);
194 gtk_signal_connect (GTK_OBJECT (GTK_COMBO(combo)->list), "unmap",
195 (GtkSignalFunc) zoom_activate_callback,
196 ddisp);
198 gtk_signal_connect (GTK_OBJECT (GTK_COMBO(combo)->list), "selection-changed",
199 (GtkSignalFunc) zoom_activate_callback,
200 ddisp);
202 return combo;
204 #endif
206 static gboolean
207 display_drop_callback(GtkWidget *widget, GdkDragContext *context,
208 gint x, gint y, guint time)
210 if (gtk_drag_get_source_widget(context) != NULL) {
211 /* we only accept drops from the same instance of the application,
212 * as the drag data is a pointer in our address space */
213 return TRUE;
215 gtk_drag_finish (context, FALSE, FALSE, time);
216 return FALSE;
219 static void
220 display_data_received_callback (GtkWidget *widget, GdkDragContext *context,
221 gint x, gint y, GtkSelectionData *data,
222 guint info, guint time, DDisplay *ddisp)
224 if (data->format == 8 && data->length == sizeof(ToolButtonData *) &&
225 gtk_drag_get_source_widget(context) != NULL) {
226 ToolButtonData *tooldata = *(ToolButtonData **)data->data;
228 /* g_message("Tool drop %s at (%d, %d)", (gchar *)tooldata->extra_data, x, y);*/
229 ddisplay_drop_object(ddisp, x, y,
230 object_get_type((gchar *)tooldata->extra_data),
231 tooldata->user_data);
232 gtk_drag_finish (context, TRUE, FALSE, time);
233 } else
234 gtk_drag_finish (context, FALSE, FALSE, time);
237 void
238 create_display_shell(DDisplay *ddisp,
239 int width, int height,
240 char *title, int use_mbar, int top_level_window)
242 GtkWidget *table, *widget;
243 GtkWidget *status_hbox;
244 GtkWidget *root_vbox = NULL;
245 #ifndef WITHOUT_ZOOM_COMBO
246 GtkWidget *zoom_hbox, *zoom_label;
247 #endif
248 int s_width, s_height;
250 s_width = gdk_screen_width ();
251 s_height = gdk_screen_height ();
252 if (width > s_width)
253 width = s_width;
254 if (height > s_height)
255 width = s_width;
257 /* The adjustment datums */
258 ddisp->hsbdata = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, width, 1, (width-1)/4, width-1));
259 ddisp->vsbdata = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, height, 1, (height-1)/4, height-1));
261 /* The toplevel shell */
262 if (top_level_window) {
263 ddisp->shell = gtk_window_new (GTK_WINDOW_TOPLEVEL);
264 gtk_window_set_title (GTK_WINDOW (ddisp->shell), title);
265 gtk_window_set_wmclass (GTK_WINDOW (ddisp->shell), "diagram_window",
266 "Dia");
267 gtk_window_set_policy (GTK_WINDOW (ddisp->shell), TRUE, TRUE, TRUE);
268 } else {
269 ddisp->shell = gtk_event_box_new ();
272 gtk_object_set_user_data (GTK_OBJECT (ddisp->shell), (gpointer) ddisp);
274 gtk_widget_set_events (ddisp->shell,
275 GDK_POINTER_MOTION_MASK |
276 GDK_POINTER_MOTION_HINT_MASK |
277 GDK_FOCUS_CHANGE_MASK);
278 /* GDK_ALL_EVENTS_MASK */
280 gtk_signal_connect (GTK_OBJECT (ddisp->shell), "delete_event",
281 GTK_SIGNAL_FUNC (ddisplay_delete),
282 ddisp);
283 gtk_signal_connect (GTK_OBJECT (ddisp->shell), "destroy",
284 GTK_SIGNAL_FUNC (ddisplay_destroy),
285 ddisp);
286 gtk_signal_connect (GTK_OBJECT (ddisp->shell), "focus_out_event",
287 GTK_SIGNAL_FUNC (ddisplay_focus_out_event),
288 ddisp);
289 gtk_signal_connect (GTK_OBJECT (ddisp->shell), "focus_in_event",
290 GTK_SIGNAL_FUNC (ddisplay_focus_in_event),
291 ddisp);
292 gtk_signal_connect (GTK_OBJECT (ddisp->shell), "realize",
293 GTK_SIGNAL_FUNC (ddisplay_realize),
294 ddisp);
295 gtk_signal_connect (GTK_OBJECT (ddisp->shell), "unrealize",
296 GTK_SIGNAL_FUNC (ddisplay_unrealize),
297 ddisp);
299 /* Clipboard handling signals */
300 gtk_signal_connect (GTK_OBJECT(ddisp->shell), "selection_get",
301 GTK_SIGNAL_FUNC (get_selection_handler), NULL);
302 gtk_signal_connect (GTK_OBJECT(ddisp->shell), "selection_received",
303 GTK_SIGNAL_FUNC (received_selection_handler), NULL);
305 /* the table containing all widgets */
306 table = gtk_table_new (4, 3, FALSE);
307 gtk_table_set_col_spacing (GTK_TABLE (table), 0, 1);
308 gtk_table_set_col_spacing (GTK_TABLE (table), 1, 2);
309 gtk_table_set_row_spacing (GTK_TABLE (table), 0, 1);
310 gtk_table_set_row_spacing (GTK_TABLE (table), 1, 2);
311 gtk_container_set_border_width (GTK_CONTAINER (table), 2);
312 if (use_mbar)
314 root_vbox = gtk_vbox_new (FALSE, 1);
315 gtk_container_add (GTK_CONTAINER (ddisp->shell), root_vbox);
316 gtk_box_pack_end (GTK_BOX (root_vbox), table, TRUE, TRUE, 0);
318 else
320 gtk_container_add (GTK_CONTAINER (ddisp->shell), table);
324 /* scrollbars, rulers, canvas, menu popup button */
325 if (!use_mbar) {
326 ddisp->origin = gtk_button_new();
327 GTK_WIDGET_UNSET_FLAGS(ddisp->origin, GTK_CAN_FOCUS);
328 widget = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
329 gtk_container_add(GTK_CONTAINER(ddisp->origin), widget);
330 gtk_widget_show(widget);
331 gtk_signal_connect(GTK_OBJECT(ddisp->origin), "button_press_event",
332 GTK_SIGNAL_FUNC(origin_button_press), ddisp);
334 else {
335 ddisp->origin = gtk_frame_new (NULL);
336 gtk_frame_set_shadow_type (GTK_FRAME (ddisp->origin), GTK_SHADOW_OUT);
340 ddisp->hrule = gtk_hruler_new ();
341 gtk_signal_connect_object (GTK_OBJECT (ddisp->shell), "motion_notify_event",
342 (GtkSignalFunc) GTK_WIDGET_CLASS (GTK_OBJECT (ddisp->hrule)->klass)->motion_notify_event,
343 GTK_OBJECT (ddisp->hrule));
345 ddisp->vrule = gtk_vruler_new ();
346 gtk_signal_connect_object (GTK_OBJECT (ddisp->shell), "motion_notify_event",
347 (GtkSignalFunc) GTK_WIDGET_CLASS (GTK_OBJECT (ddisp->vrule)->klass)->motion_notify_event,
348 GTK_OBJECT (ddisp->vrule));
350 ddisp->hsb = gtk_hscrollbar_new (ddisp->hsbdata);
351 GTK_WIDGET_UNSET_FLAGS (ddisp->hsb, GTK_CAN_FOCUS);
352 ddisp->vsb = gtk_vscrollbar_new (ddisp->vsbdata);
353 GTK_WIDGET_UNSET_FLAGS (ddisp->vsb, GTK_CAN_FOCUS);
356 /* set up the scrollbar observers */
357 gtk_signal_connect (GTK_OBJECT (ddisp->hsbdata), "value_changed",
358 (GtkSignalFunc) ddisplay_hsb_update,
359 ddisp);
360 gtk_signal_connect (GTK_OBJECT (ddisp->vsbdata), "value_changed",
361 (GtkSignalFunc) ddisplay_vsb_update,
362 ddisp);
364 ddisp->canvas = gtk_drawing_area_new ();
365 gtk_drawing_area_size (GTK_DRAWING_AREA (ddisp->canvas), width, height);
366 gtk_widget_set_events (ddisp->canvas, CANVAS_EVENT_MASK);
367 GTK_WIDGET_SET_FLAGS (ddisp->canvas, GTK_CAN_FOCUS);
368 gtk_signal_connect (GTK_OBJECT (ddisp->canvas), "event",
369 (GtkSignalFunc) ddisplay_canvas_events,
370 ddisp);
372 gtk_drag_dest_set(ddisp->canvas, GTK_DEST_DEFAULT_ALL,
373 create_object_targets, 1, GDK_ACTION_COPY);
374 gtk_signal_connect (GTK_OBJECT (ddisp->canvas), "drag_drop",
375 GTK_SIGNAL_FUNC(display_drop_callback), NULL);
376 gtk_signal_connect (GTK_OBJECT (ddisp->canvas), "drag_data_received",
377 GTK_SIGNAL_FUNC(display_data_received_callback), ddisp);
379 gtk_object_set_user_data (GTK_OBJECT (ddisp->canvas), (gpointer) ddisp);
380 /* pack all the widgets */
381 gtk_table_attach (GTK_TABLE (table), ddisp->origin, 0, 1, 0, 1,
382 GTK_FILL, GTK_FILL, 0, 0);
383 gtk_table_attach (GTK_TABLE (table), ddisp->hrule, 1, 2, 0, 1,
384 GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
385 gtk_table_attach (GTK_TABLE (table), ddisp->vrule, 0, 1, 1, 2,
386 GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
387 gtk_table_attach (GTK_TABLE (table), ddisp->canvas, 1, 2, 1, 2,
388 GTK_EXPAND | GTK_SHRINK | GTK_FILL,
389 GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
390 gtk_table_attach (GTK_TABLE (table), ddisp->hsb, 0, 2, 2, 3,
391 GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
392 gtk_table_attach (GTK_TABLE (table), ddisp->vsb, 2, 3, 0, 2,
393 GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
395 menus_get_image_menu (NULL, &ddisp->accel_group);
396 if (top_level_window)
397 gtk_window_add_accel_group(GTK_WINDOW(ddisp->shell), ddisp->accel_group);
398 if (use_mbar)
400 GString *path;
401 char *display = "<DisplayMBar>";
403 menus_get_image_menubar(&ddisp->menu_bar, &ddisp->mbar_item_factory);
404 gtk_box_pack_start (GTK_BOX (root_vbox), ddisp->menu_bar, FALSE, TRUE, 0);
406 path = g_string_new (display);
407 g_string_append (path,"/View/Show Rulers");
408 ddisp->rulers = menus_get_item_from_path(path->str, ddisp->mbar_item_factory);
409 g_string_append (g_string_assign(path, display),"/View/Visible Grid");
410 ddisp->visible_grid = menus_get_item_from_path(path->str, ddisp->mbar_item_factory);
411 g_string_append (g_string_assign(path, display),"/View/Snap To Grid");
412 ddisp->snap_to_grid = menus_get_item_from_path(path->str, ddisp->mbar_item_factory);
413 g_string_append (g_string_assign(path, display),"/View/Show Connection Points");
414 ddisp->show_cx_pts_mitem = menus_get_item_from_path(path->str, ddisp->mbar_item_factory);
415 #ifdef HAVE_LIBART
416 g_string_append(g_string_assign(path, display),"/View/AntiAliased");
417 ddisp->antialiased = menus_get_item_from_path(path->str, ddisp->mbar_item_factory);
418 #endif
420 menus_initialize_updatable_items (&ddisp->updatable_menu_items, ddisp->mbar_item_factory, display);
421 g_string_free (path,FALSE);
424 /* the statusbars */
425 status_hbox = gtk_hbox_new (FALSE, 2);
428 ddisp->snap_status = snap_status_load_images(ddisp->shell);
430 widget = gtk_button_new ();
431 gtk_container_add(GTK_CONTAINER(widget), ddisp->snap_status);
432 gtk_widget_show(ddisp->snap_status);
435 gtk_signal_connect(GTK_OBJECT(ddisp->origin), "button_press_event",
436 GTK_SIGNAL_FUNC(origin_button_press), ddisp);
438 #ifdef WITHOUT_ZOOM_COMBO
439 ddisp->zoom_status = gtk_statusbar_new ();
440 ddisp->modified_status = gtk_statusbar_new ();
441 gtk_box_pack_start (GTK_BOX (status_hbox), ddisp->zoom_status,
442 FALSE, FALSE, 0);
443 #else
444 ddisp->zoom_status = create_zoom_widget(ddisp);
445 ddisp->modified_status = gtk_statusbar_new ();
447 zoom_hbox = gtk_hbox_new(FALSE, 0);
448 zoom_label = gtk_label_new(_("Zoom"));
449 gtk_box_pack_start (GTK_BOX(zoom_hbox), zoom_label,
450 FALSE, FALSE, 0);
451 gtk_box_pack_start (GTK_BOX(zoom_hbox), ddisp->zoom_status,
452 FALSE, FALSE, 0);
454 gtk_box_pack_start (GTK_BOX (status_hbox), zoom_hbox, FALSE, FALSE, 0);
456 #endif
457 gtk_table_attach (GTK_TABLE (table), status_hbox, 0, 3, 3, 4,
458 GTK_FILL, GTK_FILL, 0, 0);
460 gtk_box_pack_start (GTK_BOX (status_hbox), ddisp->modified_status,
461 TRUE, TRUE, 0);
463 gtk_widget_show (ddisp->hsb);
464 gtk_widget_show (ddisp->vsb);
465 gtk_widget_show (ddisp->origin);
466 gtk_widget_show (ddisp->hrule);
467 gtk_widget_show (ddisp->vrule);
468 gtk_widget_show (ddisp->canvas);
469 gtk_widget_show (ddisp->zoom_status);
470 #ifndef WITHOUT_ZOOM_COMBO
471 gtk_widget_show (zoom_hbox);
472 gtk_widget_show (zoom_label);
473 #endif
474 gtk_widget_show (ddisp->modified_status);
475 gtk_widget_show (status_hbox);
476 gtk_widget_show (table);
477 if (use_mbar)
479 gtk_widget_show (ddisp->menu_bar);
480 gtk_widget_show (root_vbox);
482 gtk_widget_show (ddisp->shell);
484 /* set the focus to the canvas area */
485 gtk_widget_grab_focus (ddisp->canvas);
488 void
489 tool_select_update (GtkWidget *w,
490 gpointer data)
492 ToolButtonData *tooldata = (ToolButtonData *) data;
494 if (tooldata == NULL) {
495 g_warning(_("NULL tooldata in tool_select_update"));
496 return;
499 if (tooldata->type != -1) {
500 tool_select (tooldata->type, tooldata->extra_data, tooldata->user_data,
505 static gint
506 tool_button_press (GtkWidget *w,
507 GdkEventButton *event,
508 gpointer data)
510 ToolButtonData *tooldata = (ToolButtonData *) data;
512 if ((event->type == GDK_2BUTTON_PRESS) &&
513 (event->button == 1)) {
514 tool_options_dialog_show (tooldata->type, tooldata->extra_data,
515 tooldata->user_data, w);
516 return TRUE;
519 return FALSE;
522 static void
523 tool_drag_data_get (GtkWidget *widget, GdkDragContext *context,
524 GtkSelectionData *selection_data, guint info,
525 guint32 time, ToolButtonData *tooldata)
527 if (info == 0) {
528 gtk_selection_data_set(selection_data, selection_data->target,
529 8, (guchar *)&tooldata, sizeof(ToolButtonData *));
533 static void
534 tool_setup_drag_source(GtkWidget *button, ToolButtonData *tooldata,
535 GdkPixmap *pixmap, GdkBitmap *mask)
537 g_return_if_fail(tooldata->type == CREATE_OBJECT_TOOL);
539 gtk_drag_source_set(button, GDK_BUTTON1_MASK,
540 create_object_targets, 1,
541 GDK_ACTION_DEFAULT|GDK_ACTION_COPY);
542 gtk_signal_connect(GTK_OBJECT(button), "drag_data_get",
543 GTK_SIGNAL_FUNC(tool_drag_data_get), tooldata);
544 if (pixmap)
545 gtk_drag_source_set_icon(button, gtk_widget_get_colormap(button),
546 pixmap, mask);
549 void
550 tool_select_callback(GtkWidget *widget, gpointer data) {
551 ToolButtonData *tooldata = (ToolButtonData *)data;
553 if (tooldata == NULL) {
554 g_warning("NULL tooldata in tool_select_callback");
555 return;
558 if (tooldata->type != -1) {
559 tool_select (tooldata->type, tooldata->extra_data,
560 tooldata->user_data,widget);
564 static void
565 create_tools(GtkWidget *parent)
567 GtkWidget *button;
568 GtkWidget *pixmapwidget;
569 GdkPixmap *pixmap;
570 GdkBitmap *mask;
571 GtkStyle *style;
573 char **pixmap_data;
574 int i;
576 for (i = 0; i < NUM_TOOLS; i++) {
577 tool_widgets[i] = button = gtk_radio_button_new (tool_group);
578 gtk_container_set_border_width (GTK_CONTAINER (button), 0);
579 tool_group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
580 gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
582 gtk_wrap_box_pack(GTK_WRAP_BOX(parent), button,
583 TRUE, TRUE, FALSE, TRUE);
585 if (tool_data[i].callback_data.type == MODIFY_TOOL) {
586 modify_tool_button = GTK_WIDGET(button);
589 if (tool_data[i].icon_data==NULL) {
590 ObjectType *type;
591 type =
592 object_get_type((char *)tool_data[i].callback_data.extra_data);
593 if (type == NULL)
594 pixmap_data = tool_data[0].icon_data;
595 else
596 pixmap_data = type->pixmap;
597 } else {
598 pixmap_data = tool_data[i].icon_data;
601 style = gtk_widget_get_style(button);
602 pixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL,
603 gtk_widget_get_colormap(button), &mask,
604 &style->bg[GTK_STATE_NORMAL], pixmap_data);
606 pixmapwidget = gtk_pixmap_new(pixmap, mask);
608 gtk_misc_set_padding(GTK_MISC(pixmapwidget), 4, 4);
610 gtk_container_add (GTK_CONTAINER (button), pixmapwidget);
612 gtk_signal_connect (GTK_OBJECT (button), "toggled",
613 GTK_SIGNAL_FUNC (tool_select_update),
614 &tool_data[i].callback_data);
616 gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
617 GTK_SIGNAL_FUNC (tool_button_press),
618 &tool_data[i].callback_data);
620 if (tool_data[i].callback_data.type == CREATE_OBJECT_TOOL)
621 tool_setup_drag_source(button, &tool_data[i].callback_data,
622 pixmap, mask);
624 gdk_pixmap_unref(pixmap);
625 if (mask) gdk_bitmap_unref(mask);
627 tool_data[i].callback_data.widget = button;
629 gtk_tooltips_set_tip (tool_tips, button,
630 gettext(tool_data[i].tool_desc), NULL);
632 gtk_widget_show (pixmapwidget);
633 gtk_widget_show (button);
637 static GtkWidget *sheet_option_menu;
638 static GtkWidget *sheet_menu;
639 static GtkWidget *sheet_wbox;
641 #if 0
642 static GtkWidget *
643 create_sheet_page(GtkWidget *parent, Sheet *sheet)
645 GSList *list;
646 SheetObject *sheet_obj;
647 GtkWidget *table;
648 GtkWidget *button;
649 GtkWidget *pixmapwidget;
650 GdkPixmap *pixmap;
651 GdkBitmap *mask;
652 ToolButtonData *data;
653 GtkStyle *style;
654 GtkWidget *scrolled_window;
655 int i;
656 int rows;
658 scrolled_window = gtk_scrolled_window_new(NULL, NULL);
659 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(scrolled_window),
660 GTK_POLICY_AUTOMATIC,
661 GTK_POLICY_AUTOMATIC);
663 rows = (g_slist_length(sheet->objects) - 1) / COLUMNS + 1;
664 if (rows<1)
665 rows = 1;
667 table = gtk_hwrap_box_new(FALSE);
668 gtk_wrap_box_set_aspect_ratio(GTK_WRAP_BOX(table), COLUMNS * 1.0 / rows);
669 gtk_wrap_box_set_justify(GTK_WRAP_BOX(table), GTK_JUSTIFY_TOP);
670 gtk_wrap_box_set_line_justify(GTK_WRAP_BOX(table), GTK_JUSTIFY_LEFT);
672 style = gtk_widget_get_style(parent);
674 i = 0;
675 list = sheet->objects;
676 while (list != NULL) {
677 sheet_obj = (SheetObject *) list->data;
680 if (sheet_obj->pixmap != NULL) {
681 pixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL,
682 gtk_widget_get_colormap(parent), &mask,
683 &style->bg[GTK_STATE_NORMAL], sheet_obj->pixmap);
684 } else if (sheet_obj->pixmap_file != NULL) {
685 pixmap = gdk_pixmap_colormap_create_from_xpm(NULL,
686 gtk_widget_get_colormap(parent), &mask,
687 &style->bg[GTK_STATE_NORMAL], sheet_obj->pixmap_file);
688 } else {
689 ObjectType *type;
690 type = object_get_type(sheet_obj->object_type);
691 pixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL,
692 gtk_widget_get_colormap(parent), &mask,
693 &style->bg[GTK_STATE_NORMAL], type->pixmap);
696 pixmapwidget = gtk_pixmap_new(pixmap, mask);
699 button = gtk_radio_button_new (tool_group);
700 gtk_container_set_border_width (GTK_CONTAINER (button), 0);
701 tool_group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
703 gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
706 gtk_container_add (GTK_CONTAINER (button), pixmapwidget);
707 gtk_wrap_box_pack(GTK_WRAP_BOX(table), button,
708 FALSE, TRUE, FALSE, TRUE);
709 if (sheet_obj->line_break)
710 gtk_wrap_box_set_child_forced_break(GTK_WRAP_BOX(table),button,TRUE);
712 /* This is a Memory leak, these can't be freed.
713 Doesn't matter much anyway... */
715 data = g_new(ToolButtonData, 1);
716 data->type = CREATE_OBJECT_TOOL;
717 data->extra_data = sheet_obj->object_type;
718 data->user_data = sheet_obj->user_data;
720 gtk_signal_connect (GTK_OBJECT (button), "toggled",
721 GTK_SIGNAL_FUNC (tool_select_update),
722 data);
724 gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
725 GTK_SIGNAL_FUNC (tool_button_press),
726 data);
728 gtk_tooltips_set_tip (tool_tips, button,
729 gettext(sheet_obj->description), NULL);
731 list = g_slist_next(list);
732 i++;
735 gtk_widget_show(table);
736 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), table);
738 return scrolled_window;
740 #endif
742 static void
743 fill_sheet_wbox(GtkWidget *menu_item, Sheet *sheet)
745 int rows;
746 GtkStyle *style;
747 GSList *tmp;
749 gtk_container_foreach(GTK_CONTAINER(sheet_wbox),
750 (GtkCallback)gtk_widget_destroy, NULL);
751 tool_group = gtk_radio_button_group(GTK_RADIO_BUTTON(tool_widgets[0]));
753 /* set the aspect ratio on the wbox */
754 rows = (g_slist_length(sheet->objects) - 1) / COLUMNS + 1;
755 if (rows<1) rows = 1;
756 gtk_wrap_box_set_aspect_ratio(GTK_WRAP_BOX(sheet_wbox),
757 COLUMNS * 1.0 / rows);
758 style = gtk_widget_get_style(sheet_wbox);
759 for (tmp = sheet->objects; tmp != NULL; tmp = tmp->next) {
760 SheetObject *sheet_obj = tmp->data;
761 GdkPixmap *pixmap;
762 GdkBitmap *mask;
763 GtkWidget *pixmapwidget;
764 GtkWidget *button;
765 ToolButtonData *data;
767 if (sheet_obj->pixmap != NULL) {
768 pixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL,
769 gtk_widget_get_colormap(sheet_wbox), &mask,
770 &style->bg[GTK_STATE_NORMAL], sheet_obj->pixmap);
771 } else if (sheet_obj->pixmap_file != NULL) {
772 GdkPixbuf *pixbuf;
774 pixbuf = gdk_pixbuf_new_from_file(sheet_obj->pixmap_file);
775 if (pixbuf != NULL) {
776 gdk_pixbuf_render_pixmap_and_mask(pixbuf, &pixmap, &mask, 1.0);
777 gdk_pixbuf_unref(pixbuf);
779 } else {
780 ObjectType *type;
781 type = object_get_type(sheet_obj->object_type);
782 pixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL,
783 gtk_widget_get_colormap(sheet_wbox), &mask,
784 &style->bg[GTK_STATE_NORMAL], type->pixmap);
786 if (pixmap) {
787 pixmapwidget = gtk_pixmap_new(pixmap, mask);
788 gdk_pixmap_unref(pixmap);
789 if (mask) gdk_bitmap_unref(mask);
790 } else
791 pixmapwidget = gtk_type_new(gtk_pixmap_get_type());
793 button = gtk_radio_button_new (tool_group);
794 gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
795 gtk_container_set_border_width (GTK_CONTAINER (button), 0);
796 tool_group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
798 gtk_container_add (GTK_CONTAINER (button), pixmapwidget);
799 gtk_widget_show(pixmapwidget);
801 gtk_wrap_box_pack(GTK_WRAP_BOX(sheet_wbox), button,
802 FALSE, TRUE, FALSE, TRUE);
803 gtk_widget_show(button);
804 if (sheet_obj->line_break)
805 gtk_wrap_box_set_child_forced_break(GTK_WRAP_BOX(sheet_wbox),
806 button, TRUE);
808 data = g_new(ToolButtonData, 1);
809 data->type = CREATE_OBJECT_TOOL;
810 data->extra_data = sheet_obj->object_type;
811 data->user_data = sheet_obj->user_data;
812 gtk_object_set_data_full(GTK_OBJECT(button), "Dia::ToolButtonData",
813 data, (GdkDestroyNotify)g_free);
815 gtk_signal_connect (GTK_OBJECT (button), "toggled",
816 GTK_SIGNAL_FUNC (tool_select_update), data);
817 gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
818 GTK_SIGNAL_FUNC (tool_button_press), data);
820 tool_setup_drag_source(button, data, pixmap, mask);
822 gtk_tooltips_set_tip (tool_tips, button,
823 gettext(sheet_obj->description), NULL);
827 static void
828 fill_sheet_menu(void)
830 GSList *tmp;
832 gtk_container_foreach(GTK_CONTAINER(sheet_menu),
833 (GtkCallback)gtk_widget_destroy, NULL);
834 gtk_widget_ref(sheet_menu);
835 gtk_option_menu_remove_menu(GTK_OPTION_MENU(sheet_option_menu));
836 for (tmp = get_sheets_list(); tmp != NULL; tmp = tmp->next) {
837 Sheet *sheet = tmp->data;
838 GtkWidget *menuitem;
840 if (sheet->objects == NULL)
841 continue;
843 menuitem = gtk_menu_item_new_with_label(gettext(sheet->name));
844 gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
845 GTK_SIGNAL_FUNC(fill_sheet_wbox), sheet);
846 gtk_container_add(GTK_CONTAINER(sheet_menu), menuitem);
847 gtk_widget_show(menuitem);
849 gtk_option_menu_set_menu(GTK_OPTION_MENU(sheet_option_menu), sheet_menu);
850 gtk_widget_unref(sheet_menu);
851 gtk_menu_item_activate(
852 GTK_MENU_ITEM(GTK_OPTION_MENU(sheet_option_menu)->menu_item));
855 static void
856 create_sheets(GtkWidget *parent)
858 GtkWidget *separator;
859 GtkWidget *label;
860 GtkWidget *swin;
862 separator = gtk_hseparator_new ();
863 /* add a bit of padding around the separator */
864 label = gtk_vbox_new(FALSE, 0);
865 gtk_box_pack_start(GTK_BOX(label), separator, TRUE, TRUE, 3);
866 gtk_widget_show(label);
868 gtk_wrap_box_pack (GTK_WRAP_BOX(parent), label, TRUE,TRUE, FALSE,FALSE);
869 gtk_wrap_box_set_child_forced_break(GTK_WRAP_BOX(parent), label, TRUE);
870 gtk_widget_show(separator);
872 sheet_option_menu = gtk_option_menu_new();
873 gtk_widget_set_usize(sheet_option_menu, 20, -1);
874 sheet_menu = gtk_menu_new();
875 gtk_option_menu_set_menu(GTK_OPTION_MENU(sheet_option_menu), sheet_menu);
876 gtk_wrap_box_pack(GTK_WRAP_BOX(parent), sheet_option_menu,
877 TRUE, TRUE, FALSE, FALSE);
878 gtk_wrap_box_set_child_forced_break(GTK_WRAP_BOX(parent), sheet_option_menu,
879 TRUE);
880 gtk_widget_show(sheet_option_menu);
882 swin = gtk_scrolled_window_new(NULL, NULL);
883 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
884 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
885 gtk_wrap_box_pack(GTK_WRAP_BOX(parent), swin, TRUE, TRUE, TRUE, TRUE);
886 gtk_wrap_box_set_child_forced_break(GTK_WRAP_BOX(parent), swin, TRUE);
887 gtk_widget_show(swin);
889 sheet_wbox = gtk_hwrap_box_new(FALSE);
890 gtk_wrap_box_set_justify(GTK_WRAP_BOX(sheet_wbox), GTK_JUSTIFY_TOP);
891 gtk_wrap_box_set_line_justify(GTK_WRAP_BOX(sheet_wbox), GTK_JUSTIFY_LEFT);
892 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swin), sheet_wbox);
893 gtk_widget_show(sheet_wbox);
895 fill_sheet_menu();
898 static void
899 create_color_area (GtkWidget *parent)
901 GtkWidget *frame;
902 GtkWidget *alignment;
903 GtkWidget *col_area;
904 GtkWidget *line_area;
905 GdkPixmap *default_pixmap;
906 GdkPixmap *swap_pixmap;
907 GdkBitmap *mask;
908 GtkStyle *style;
909 GtkWidget *hbox;
911 gtk_widget_ensure_style(parent);
912 style = gtk_widget_get_style(parent);
914 default_pixmap =
915 gdk_pixmap_colormap_create_from_xpm_d(NULL,
916 gtk_widget_get_colormap(parent), &mask,
917 &style->bg[GTK_STATE_NORMAL], default_xpm);
918 swap_pixmap =
919 gdk_pixmap_colormap_create_from_xpm_d(NULL,
920 gtk_widget_get_colormap(parent), &mask,
921 &style->bg[GTK_STATE_NORMAL], swap_xpm);
923 frame = gtk_frame_new (NULL);
924 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
925 gtk_wrap_box_pack(GTK_WRAP_BOX(parent), frame, TRUE, TRUE, FALSE, FALSE);
926 gtk_wrap_box_set_child_forced_break(GTK_WRAP_BOX(parent), frame, TRUE);
927 gtk_widget_realize (frame);
929 hbox = gtk_hbox_new (FALSE, 1);
930 gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
931 gtk_container_add (GTK_CONTAINER (frame), hbox);
933 /* Color area: */
934 alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
935 gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
937 col_area = color_area_create (54, 42, default_pixmap, swap_pixmap);
938 gtk_container_add (GTK_CONTAINER (alignment), col_area);
941 gtk_box_pack_start (GTK_BOX (hbox), alignment, TRUE, TRUE, 0);
943 gtk_tooltips_set_tip (tool_tips, col_area, _("Foreground & background colors. The small black "
944 "and white squares reset colors. The small arrows swap colors. Double "
945 "click to change colors."),
946 NULL);
948 gtk_widget_show (alignment);
950 /* Linewidth area: */
951 alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
952 gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
954 line_area = linewidth_area_create ();
955 gtk_container_add (GTK_CONTAINER (alignment), line_area);
956 gtk_box_pack_start (GTK_BOX (hbox), alignment, TRUE, TRUE, 0);
958 gtk_widget_show (alignment);
960 gtk_widget_show (col_area);
961 gtk_widget_show (line_area);
962 gtk_widget_show (hbox);
963 gtk_widget_show (frame);
966 static void
967 change_start_arrow_style(Arrow arrow, gpointer user_data)
969 attributes_set_default_start_arrow(arrow);
971 static void
972 change_end_arrow_style(Arrow arrow, gpointer user_data)
974 attributes_set_default_end_arrow(arrow);
976 static void
977 change_line_style(LineStyle lstyle, real dash_length, gpointer user_data)
979 attributes_set_default_line_style(lstyle, dash_length);
982 static void
983 create_lineprops_area(GtkWidget *parent)
985 GtkWidget *chooser;
987 chooser = dia_arrow_chooser_new(TRUE, change_start_arrow_style, NULL);
988 gtk_wrap_box_pack(GTK_WRAP_BOX(parent), chooser, FALSE, TRUE, FALSE, TRUE);
989 gtk_wrap_box_set_child_forced_break(GTK_WRAP_BOX(parent), chooser, TRUE);
990 gtk_widget_show(chooser);
992 chooser = dia_line_chooser_new(change_line_style, NULL);
993 gtk_wrap_box_pack(GTK_WRAP_BOX(parent), chooser, TRUE, TRUE, FALSE, TRUE);
994 gtk_widget_show(chooser);
996 chooser = dia_arrow_chooser_new(FALSE, change_end_arrow_style, NULL);
997 gtk_wrap_box_pack(GTK_WRAP_BOX(parent), chooser, FALSE, TRUE, FALSE, TRUE);
998 gtk_widget_show(chooser);
1001 static void
1002 toolbox_delete (GtkWidget *widget, gpointer data)
1004 if (!app_is_embedded())
1005 app_exit();
1008 static void
1009 toolbox_destroy (GtkWidget *widget, gpointer data)
1011 app_exit();
1014 /* HB: file dnd stuff lent by The Gimp, not fully understood but working ...
1016 enum
1018 DIA_DND_TYPE_URI_LIST,
1019 DIA_DND_TYPE_TEXT_PLAIN,
1022 static GtkTargetEntry toolbox_target_table[] =
1024 { "text/uri-list", 0, DIA_DND_TYPE_URI_LIST },
1025 { "text/plain", 0, DIA_DND_TYPE_TEXT_PLAIN }
1028 static guint toolbox_n_targets = (sizeof (toolbox_target_table) /
1029 sizeof (toolbox_target_table[0]));
1031 static void
1032 dia_dnd_file_drag_data_received (GtkWidget *widget,
1033 GdkDragContext *context,
1034 gint x,
1035 gint y,
1036 GtkSelectionData *data,
1037 guint info,
1038 guint time)
1040 switch (context->action)
1042 case GDK_ACTION_DEFAULT:
1043 case GDK_ACTION_COPY:
1044 case GDK_ACTION_MOVE:
1045 case GDK_ACTION_LINK:
1046 case GDK_ACTION_ASK:
1047 default:
1049 Diagram *diagram = NULL;
1050 DDisplay *ddisp;
1051 gchar *sPath = NULL, *pFrom, *pTo;
1053 pFrom = strstr((gchar *) data->data, "file:");
1054 while (pFrom) {
1055 pFrom += 5; /* remove 'file:' */
1056 pTo = pFrom;
1057 while (*pTo != 0 && *pTo != 0xd && *pTo != 0xa) pTo ++;
1058 sPath = g_strndup(pFrom, pTo - pFrom);
1060 diagram = diagram_load (sPath, NULL);
1061 g_free(sPath);
1063 if (diagram != NULL) {
1064 diagram_update_extents(diagram);
1065 layer_dialog_set_diagram(diagram);
1067 ddisp = new_display(diagram);
1070 pFrom = strstr(pTo, "file:");
1071 } /* while */
1072 gtk_drag_finish (context, TRUE, FALSE, time);
1074 break;
1076 return;
1079 void
1080 create_toolbox ()
1082 GtkWidget *window;
1083 GtkWidget *main_vbox;
1084 GtkWidget *wrapbox;
1085 GtkWidget *menubar;
1086 GtkAccelGroup *accel_group;
1088 #ifdef GNOME
1089 window = gnome_app_new ("Dia", _("Diagram Editor"));
1090 #else
1091 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
1092 gtk_widget_ref (window);
1093 gtk_window_set_title (GTK_WINDOW (window), "Dia v" VERSION);
1094 #endif
1095 gtk_window_set_wmclass (GTK_WINDOW (window), "toolbox_window",
1096 "Dia");
1097 gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
1098 gtk_window_set_default_size(GTK_WINDOW(window), 146, 349);
1100 gtk_signal_connect (GTK_OBJECT (window), "delete_event",
1101 GTK_SIGNAL_FUNC (toolbox_delete),
1102 NULL);
1104 gtk_signal_connect (GTK_OBJECT (window), "destroy",
1105 GTK_SIGNAL_FUNC (toolbox_destroy),
1106 NULL);
1108 main_vbox = gtk_vbox_new (FALSE, 1);
1109 gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 1);
1110 #ifdef GNOME
1111 gnome_app_set_contents(GNOME_APP(window), main_vbox);
1112 #else
1113 gtk_container_add (GTK_CONTAINER (window), main_vbox);
1114 #endif
1115 gtk_widget_show (main_vbox);
1117 /* tooltips */
1118 tool_tips = gtk_tooltips_new ();
1120 /* gtk_tooltips_set_colors (tool_tips,
1121 &colors[11],
1122 &main_vbox->style->fg[GTK_STATE_NORMAL]);*/
1124 wrapbox = gtk_hwrap_box_new(FALSE);
1125 gtk_wrap_box_set_aspect_ratio(GTK_WRAP_BOX(wrapbox), 144.0 / 318.0);
1126 gtk_wrap_box_set_justify(GTK_WRAP_BOX(wrapbox), GTK_JUSTIFY_TOP);
1127 gtk_wrap_box_set_line_justify(GTK_WRAP_BOX(wrapbox), GTK_JUSTIFY_LEFT);
1130 /* pack the rest of the stuff */
1131 gtk_box_pack_end (GTK_BOX (main_vbox), wrapbox, TRUE, TRUE, 0);
1132 gtk_container_set_border_width (GTK_CONTAINER (wrapbox), 0);
1133 gtk_widget_show (wrapbox);
1135 create_tools (wrapbox);
1136 create_sheets (wrapbox);
1137 create_color_area (wrapbox);
1138 create_lineprops_area (wrapbox);
1140 /* Setup toolbox area as file drop destination */
1141 gtk_drag_dest_set (wrapbox,
1142 GTK_DEST_DEFAULT_ALL,
1143 toolbox_target_table, toolbox_n_targets,
1144 GDK_ACTION_COPY);
1145 gtk_signal_connect (GTK_OBJECT (wrapbox), "drag_data_received",
1146 GTK_SIGNAL_FUNC (dia_dnd_file_drag_data_received),
1147 wrapbox);
1149 /* menus -- initialised afterwards, because initing the display menus
1150 * uses the tool buttons*/
1151 menus_get_toolbox_menubar(&menubar, &accel_group);
1152 gtk_accel_group_attach (accel_group, GTK_OBJECT (window));
1153 #ifdef GNOME
1154 gnome_app_set_menus(GNOME_APP(window), GTK_MENU_BAR(menubar));
1155 #else
1156 gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0);
1157 gtk_widget_show (menubar);
1158 #endif
1160 toolbox_shell = window;
1163 void
1164 toolbox_show(void)
1166 gtk_widget_show(toolbox_shell);
1169 void
1170 toolbox_hide(void)
1172 gtk_widget_hide(toolbox_shell);
1175 void
1176 create_tree_window(void)
1178 GtkCheckMenuItem *item = GTK_CHECK_MENU_ITEM
1179 (menus_get_item_from_path("<Toolbox>/File/Diagram tree", NULL));
1180 create_diagram_tree_window(&prefs.dia_tree, GTK_WIDGET(item));
1183 GtkWidget *
1184 interface_get_toolbox_shell(void)
1186 return toolbox_shell;