72
75
static MRU_t *_mru;
74
77
static GimpDrawable *_drawable;
75
static GdkCursorType _cursor;
76
static gboolean _show_url = TRUE;
77
static gchar *_filename = NULL;
78
static char *_image_name;
79
static gint _image_width;
80
static gint _image_height;
78
static GdkCursorType _cursor = GDK_TOP_LEFT_ARROW;
79
static gboolean _show_url = TRUE;
80
static gchar *_filename = NULL;
81
static gchar *_image_name;
82
static gint _image_width;
83
static gint _image_height;
81
84
static GtkWidget *_dlg;
82
85
static Preview_t *_preview;
83
86
static Selection_t *_selection;
84
87
static StatusBar_t *_statusbar;
85
static ToolBar_t *_toolbar;
86
88
static ObjectList_t *_shapes;
87
static gint _zoom_factor = 1;
89
static gint _zoom_factor = 1;
88
90
static gboolean (*_button_press_func)(GtkWidget*, GdkEventButton*, gpointer);
89
91
static gpointer _button_press_param;
91
93
/* Declare local functions. */
92
94
static void query (void);
93
95
static void run (const gchar *name,
95
const GimpParam *param,
97
GimpParam **return_vals);
97
const GimpParam *param,
99
GimpParam **return_vals);
98
100
static gint dialog (GimpDrawable *drawable);
100
GimpPlugInInfo PLUG_IN_INFO = {
101
NULL, /* init_proc */
102
NULL, /* quit_proc */
103
query, /* query_proc */
102
const GimpPlugInInfo PLUG_IN_INFO = {
103
NULL, /* init_proc */
104
NULL, /* quit_proc */
105
query, /* query_proc */
107
109
static int run_flag = 0;
112
114
static void query(void)
114
static GimpParamDef args[] = {
115
{GIMP_PDB_INT32, "run_mode", "Interactive"},
116
{GIMP_PDB_IMAGE, "image", "Input image (unused)"},
116
static const GimpParamDef args[] = {
117
{GIMP_PDB_INT32, "run-mode", "Interactive"},
118
{GIMP_PDB_IMAGE, "image", "Input image (unused)"},
117
119
{GIMP_PDB_DRAWABLE, "drawable", "Input drawable"},
119
static GimpParamDef *return_vals = NULL;
121
static const GimpParamDef *return_vals = NULL;
120
122
static int nreturn_vals = 0;
122
gimp_install_procedure("plug_in_imagemap",
123
"Creates a clickable imagemap.",
129
"RGB*, GRAY*, INDEXED*",
131
G_N_ELEMENTS (args), nreturn_vals,
124
gimp_install_procedure(PLUG_IN_PROC,
125
N_("Create a clickable imagemap"),
131
"RGB*, GRAY*, INDEXED*",
133
G_N_ELEMENTS (args), nreturn_vals,
134
gimp_plugin_menu_register ("plug_in_imagemap", "<Image>/Filters/Web");
136
gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Filters/Web");
236
238
_preferences.selected_gc = gdk_gc_new(_preview->preview->window);
238
240
gdk_gc_set_line_attributes(_preferences.normal_gc, 1, GDK_LINE_DOUBLE_DASH,
239
GDK_CAP_BUTT, GDK_JOIN_BEVEL);
241
GDK_CAP_BUTT, GDK_JOIN_BEVEL);
240
242
gdk_gc_set_line_attributes(_preferences.selected_gc, 1,
241
GDK_LINE_DOUBLE_DASH, GDK_CAP_BUTT,
243
GDK_LINE_DOUBLE_DASH, GDK_CAP_BUTT,
244
246
gdk_gc_set_foreground(_preferences.normal_gc, &colors->normal_fg);
245
247
gdk_gc_set_background(_preferences.normal_gc, &colors->normal_bg);
327
draw_rectangle(GdkWindow *window, GdkGC *gc, gint filled, gint x, gint y,
328
gint width, gint height)
322
draw_rectangle(GdkWindow *window, GdkGC *gc, gint filled, gint x, gint y,
323
gint width, gint height)
330
325
gdk_draw_rectangle(window, gc, filled, ZOOMED(x), ZOOMED(y),
331
ZOOMED(width), ZOOMED(height));
326
ZOOMED(width), ZOOMED(height));
335
330
draw_arc(GdkWindow *window, GdkGC *gc, gint filled, gint x, gint y,
336
gint width, gint height, gint angle1, gint angle2)
331
gint width, gint height, gint angle1, gint angle2)
338
333
gdk_draw_arc(window, gc, filled, ZOOMED(x), ZOOMED(y),
339
ZOOMED(width), ZOOMED(height), angle1, angle2);
334
ZOOMED(width), ZOOMED(height), angle1, angle2);
416
413
return _filename;
417
arrow_on_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
419
if (event->button == 1) {
420
if (event->type == GDK_2BUTTON_PRESS)
421
edit_shape((gint) event->x, (gint) event->y);
423
select_shape(widget, event);
425
do_popup_menu(event);
420
431
set_arrow_func(void)
422
433
_button_press_func = arrow_on_button_press;
423
434
_cursor = GDK_TOP_LEFT_ARROW;
427
fuzzy_select_on_button_press (GtkWidget *widget,
428
GdkEventButton *event,
431
if (event->button == 1) {
432
gdouble rx = get_real_coord((gint) event->x);
433
gdouble ry = get_real_coord((gint) event->y);
434
gint32 image_ID = gimp_drawable_get_image (_drawable->drawable_id);
437
/* Save the old selection first */
438
channel_ID = gimp_selection_save(image_ID);
440
if (gimp_fuzzy_select(_drawable->drawable_id, rx, ry,
442
GIMP_CHANNEL_OP_REPLACE,
443
FALSE, FALSE, 0, FALSE)) {
444
GimpParam *return_vals;
447
return_vals = gimp_run_procedure ("plug_in_sel2path",
449
GIMP_PDB_INT32, TRUE,
450
GIMP_PDB_IMAGE, image_ID,
451
GIMP_PDB_DRAWABLE, -1,
454
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
457
gchar *path_name = gimp_path_get_current(image_ID);
458
Object_t *object = create_polygon(NULL);
459
Polygon_t *polygon = ObjectToPolygon(object);
464
x0 = gimp_path_get_point_at_dist(image_ID, 0.0, &y0, &grad0);
465
polygon_append_point(polygon, x0, y0);
467
for (distance = 1.0;; distance += 1.0) {
471
x1 = gimp_path_get_point_at_dist(image_ID, distance, &y1,
477
if (abs(x1 - x0) <= 1 || abs(y1 - y0) <= 1) {
481
diff = (grad1 - grad0) / grad0;
485
if (fabs(diff) > 0.1) {
486
polygon_append_point(polygon, x1, y1);
493
gimp_path_delete(image_ID, path_name);
496
printf("Damn %d\n", return_vals[0].data.d_status);
498
gimp_destroy_params(return_vals, nreturn_vals);
501
/* Restore old selection */
502
(void) gimp_selection_load(channel_ID);
503
(void) gimp_image_remove_channel(image_ID, channel_ID);
509
set_fuzzy_select_func(void)
511
_button_press_func = fuzzy_select_on_button_press;
512
_cursor = GDK_TOP_LEFT_ARROW; /* Fix me! */
516
438
set_object_func(gboolean (*func)(GtkWidget*, GdkEventButton*,
517
gpointer), gpointer param)
439
gpointer), gpointer param)
519
441
_button_press_func = func;
520
442
_button_press_param = param;
525
set_rectangle_func(void)
527
set_object_func(object_on_button_press, get_rectangle_factory);
531
set_circle_func(void)
533
set_object_func(object_on_button_press, get_circle_factory);
537
set_polygon_func(void)
539
set_object_func(object_on_button_press, get_polygon_factory);
447
set_func(GtkRadioAction *action, GtkRadioAction *current,
450
gint value = gtk_radio_action_get_current_value (current);
457
set_object_func(object_on_button_press, get_rectangle_factory);
460
set_object_func(object_on_button_press, get_circle_factory);
463
set_object_func(object_on_button_press, get_polygon_factory);
643
569
obj = object_list_find(_shapes, x, y);
645
if (event->state & GDK_SHIFT_MASK) {
647
command = unselect_command_new(obj);
649
command = select_command_new(obj);
650
} else { /* No Shift key pressed */
652
command = unselect_all_command_new(_shapes, obj);
654
Command_t *sub_command;
656
command = subcommand_start(NULL);
657
sub_command = unselect_all_command_new(_shapes, NULL);
658
command_add_subcommand(command, sub_command);
659
sub_command = select_command_new(obj);
660
command_add_subcommand(command, sub_command);
661
command_set_name(command, sub_command->name);
665
command_execute(command);
667
command = move_command_new(_preview, obj, x, y);
668
command_execute(command);
571
if (event->state & GDK_SHIFT_MASK) {
573
command = unselect_command_new(obj);
575
command = select_command_new(obj);
576
} else { /* No Shift key pressed */
578
command = unselect_all_command_new(_shapes, obj);
580
Command_t *sub_command;
582
command = subcommand_start(NULL);
583
sub_command = unselect_all_command_new(_shapes, NULL);
584
command_add_subcommand(command, sub_command);
585
sub_command = select_command_new(obj);
586
command_add_subcommand(command, sub_command);
587
command_set_name(command, sub_command->name);
591
command_execute(command);
593
command = move_command_new(_preview, obj, x, y);
594
command_execute(command);
669
595
} else { /* Start selection rectangle */
670
command = select_region_command_new(widget, _shapes, x, y);
671
command_execute(command);
596
command = select_region_command_new(widget, _shapes, x, y);
597
command_execute(command);
740
656
do_data_changed_dialog(void (*continue_cb)(gpointer), gpointer param)
742
static Alert_t *alert;
745
alert = create_confirm_alert(GTK_STOCK_DIALOG_WARNING);
746
alert_set_text(alert, _("Some data has been changed!"),
747
_("Do you really want to discard your changes?"));
749
default_dialog_set_ok_cb(alert->dialog, continue_cb, param);
750
default_dialog_show(alert->dialog);
658
GtkWidget *dialog = gtk_message_dialog_new
660
GTK_DIALOG_DESTROY_WITH_PARENT,
661
GTK_MESSAGE_QUESTION,
663
_("Some data has been changed!"));
664
gtk_message_dialog_format_secondary_text
665
(GTK_MESSAGE_DIALOG (dialog),
666
_("Do you really want to discard your changes?"));
668
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
671
gtk_widget_destroy (dialog);
754
675
check_if_changed(void (*func)(gpointer), gpointer param)
756
if (object_list_get_changed(_shapes))
757
do_data_changed_dialog(func, param);
677
if (object_list_get_changed (_shapes))
678
do_data_changed_dialog (func, param);
842
765
gchar *next_token;
844
767
write_cern_comment(param, output);
845
output(param, "-:Image Map file created by GIMP Imagemap Plugin\n");
768
output(param, "-:Image map file created by GIMP Image Map plug-in\n");
846
769
write_cern_comment(param, output);
847
output(param, "-:GIMP Imagemap Plugin by Maurits Rijk\n");
770
output(param, "-:GIMP Image Map plug-in by Maurits Rijk\n");
848
771
write_cern_comment(param, output);
849
772
output(param, "-:Please do not edit lines starting with \"#$\"\n");
850
773
write_cern_comment(param, output);
851
output(param, "VERSION:2.0\n");
774
output(param, "VERSION:2.3\n");
852
775
write_cern_comment(param, output);
853
776
output(param, "TITLE:%s\n", _map_info.title);
854
777
write_cern_comment(param, output);
876
799
gchar *description;
878
801
output(param, "<img src=\"%s\" width=\"%d\" height=\"%d\" border=\"0\" "
879
"usemap=\"#%s\" />\n\n", _map_info.image_name,
880
_image_width, _image_height, _map_info.title);
802
"usemap=\"#%s\" />\n\n", _map_info.image_name,
803
_image_width, _image_height, _map_info.title);
881
804
output(param, "<map name=\"%s\">\n", _map_info.title);
883
"<!-- #$-:Image Map file created by GIMP Imagemap Plugin -->\n");
884
output(param, "<!-- #$-:GIMP Imagemap Plugin by Maurits Rijk -->\n");
806
"<!-- #$-:Image map file created by GIMP Image Map plug-in -->\n");
807
output(param, "<!-- #$-:GIMP Image Map plug-in by Maurits Rijk -->\n");
886
"<!-- #$-:Please do not edit lines starting with \"#$\" -->\n");
887
output(param, "<!-- #$VERSION:2.0 -->\n");
809
"<!-- #$-:Please do not edit lines starting with \"#$\" -->\n");
810
output(param, "<!-- #$VERSION:2.3 -->\n");
888
811
output(param, "<!-- #$AUTHOR:%s -->\n", _map_info.author);
890
813
description = g_strdup(_map_info.description);
906
829
gchar *description;
908
output(param, "#$-:Image Map file created by GIMP Imagemap Plugin\n");
909
output(param, "#$-:GIMP Imagemap Plugin by Maurits Rijk\n");
831
output(param, "#$-:Image map file created by GIMP Image Map plug-in\n");
832
output(param, "#$-:GIMP Image Map plug-in by Maurits Rijk\n");
910
833
output(param, "#$-:Please do not edit lines starting with \"#$\"\n");
911
output(param, "#$VERSION:2.0\n");
834
output(param, "#$VERSION:2.3\n");
912
835
output(param, "#$TITLE:%s\n", _map_info.title);
913
836
output(param, "#$AUTHOR:%s\n", _map_info.author);
914
837
output(param, "#$FORMAT:ncsa\n");
964
resize_image_ok_cb(gpointer data)
966
gint per_x = _image_width * 100 / _map_info.old_image_width;
967
gint per_y = _image_height * 100 / _map_info.old_image_height;
968
object_list_resize(_shapes, per_x, per_y);
973
resize_image_cancel_cb(gpointer data)
979
887
do_image_size_changed_dialog(void)
981
static Alert_t *alert;
984
alert = create_confirm_alert(GTK_STOCK_DIALOG_WARNING);
985
alert_set_text(alert, _("Image size has changed."),
986
_("Resize area's?"));
988
default_dialog_set_ok_cb(alert->dialog, resize_image_ok_cb, NULL);
989
default_dialog_set_cancel_cb(alert->dialog, resize_image_cancel_cb, NULL);
990
default_dialog_show(alert->dialog);
889
GtkWidget *dialog = gtk_message_dialog_new_with_markup
891
GTK_DIALOG_DESTROY_WITH_PARENT,
892
GTK_MESSAGE_QUESTION,
894
"<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
895
_("Image size has changed."),
896
_("Resize area's?"));
898
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
900
gint per_x = _image_width * 100 / _map_info.old_image_width;
901
gint per_y = _image_height * 100 / _map_info.old_image_height;
902
object_list_resize(_shapes, per_x, per_y);
906
gtk_widget_destroy (dialog);
1058
974
if (obj != prev_obj) {
1060
976
if (obj && _show_url) {
1061
statusbar_set_status(_statusbar, _("URL: %s"), obj->url);
977
statusbar_set_status(_statusbar, _("URL: %s"), obj->url);
1063
statusbar_clear_status(_statusbar);
979
statusbar_clear_status(_statusbar);
1066
982
#ifdef _NOT_READY_YET_
1068
984
if (grid_near_x(x)) {
1069
preview_set_cursor(_preview, GDK_SB_H_DOUBLE_ARROW);
985
preview_set_cursor(_preview, GDK_SB_H_DOUBLE_ARROW);
1070
986
} else if (grid_near_y(y)) {
1071
preview_set_cursor(_preview, GDK_SB_V_DOUBLE_ARROW);
987
preview_set_cursor(_preview, GDK_SB_V_DOUBLE_ARROW);
1073
preview_set_cursor(_preview, _cursor);
989
preview_set_cursor(_preview, _cursor);
1210
1126
set_all_sensitivities();
1214
factory_file_open_dialog(void)
1216
return command_new(do_file_open_dialog);
1220
1130
imap_help (void)
1222
1132
gimp_standard_help_func ("plug-in-imagemap", NULL);
1228
return command_new(save);
1232
factory_save_as(void)
1234
return command_new(do_file_save_as_dialog);
1238
factory_preferences_dialog(void)
1240
return command_new(do_preferences_dialog);
1246
return command_new(do_close);
1252
return command_new(do_quit);
1259
return command_new(do_undo);
1265
return command_new(do_redo);
1271
return cut_command_new(_shapes);
1277
return copy_command_new(_shapes);
1283
return paste_command_new(_shapes);
1287
factory_select_all(void)
1289
return select_all_command_new(_shapes);
1293
factory_deselect_all(void)
1295
return unselect_all_command_new(_shapes, NULL);
1301
return clear_command_new(_shapes);
1307
return command_new(edit_selected_shape);
1311
factory_toggle_area_list(void)
1313
return command_new(toggle_area_list);
1317
factory_source_dialog(void)
1319
return command_new(do_source_dialog);
1323
factory_preview_color(void)
1325
return command_new(set_preview_color);
1329
factory_preview_gray(void)
1331
return command_new(set_preview_gray);
1335
factory_menu_zoom_in(void)
1337
return command_new(menu_zoom_in);
1341
factory_menu_zoom_out(void)
1343
return command_new(menu_zoom_out);
1347
factory_zoom_in(void)
1349
return command_new((void (*)(void)) zoom_in);
1353
factory_zoom_out(void)
1355
return command_new((void (*)(void)) zoom_out);
1359
factory_settings_dialog(void)
1361
return command_new(do_settings_dialog);
1365
factory_move_to_front(void)
1367
return move_to_front_command_new(_shapes);
1371
factory_send_to_back(void)
1373
return send_to_back_command_new(_shapes);
1377
factory_toolbar_grid(void)
1379
return command_new(toolbar_grid);
1383
factory_grid_settings_dialog(void)
1385
return command_new(do_grid_settings_dialog);
1389
factory_create_guides_dialog(void)
1391
return guides_command_new(_shapes);
1395
factory_use_gimp_guides_dialog(void)
1397
return gimp_guides_command_new(_shapes, _drawable);
1403
return command_new(imap_help);
1407
factory_about_dialog(void)
1409
return command_new(do_about_dialog);
1138
command_execute (cut_command_new (_shapes));
1144
command_execute (copy_command_new (_shapes));
1150
command_execute (paste_command_new (_shapes));
1156
command_execute (select_all_command_new (_shapes));
1160
do_deselect_all(void)
1162
command_execute (unselect_all_command_new (_shapes, NULL));
1168
command_execute (clear_command_new(_shapes));
1175
Command_t *command = object_up_command_new(_current_obj->list,
1177
command_execute(command);
1185
Command_t *command = object_down_command_new(_current_obj->list,
1187
command_execute(command);
1192
do_move_to_front(void)
1194
command_execute(move_to_front_command_new(_shapes));
1198
do_send_to_back(void)
1200
command_execute(send_to_back_command_new(_shapes));
1204
do_use_gimp_guides_dialog(void)
1206
command_execute (gimp_guides_command_new (_shapes, _drawable));
1210
do_create_guides_dialog(void)
1212
command_execute (guides_command_new (_shapes));
1412
1215
static Command_t*
1444
1246
gimp_help_connect (dlg, gimp_standard_help_func, "plug-in-imagemap", NULL);
1446
1248
gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_MOUSE);
1447
g_signal_connect(dlg, "delete_event",
1448
G_CALLBACK(close_callback), NULL);
1449
g_signal_connect(dlg, "key_press_event",
1450
G_CALLBACK(key_press_cb), NULL);
1250
gimp_window_set_transient (GTK_WINDOW (dlg));
1252
g_signal_connect(dlg, "delete-event",
1253
G_CALLBACK(close_callback), NULL);
1254
g_signal_connect(dlg, "key-press-event",
1255
G_CALLBACK(key_press_cb), NULL);
1451
1256
g_signal_connect(dlg, "key_release_event",
1452
G_CALLBACK(key_release_cb), NULL);
1257
G_CALLBACK(key_release_cb), NULL);
1454
1259
g_signal_connect (dlg, "destroy",
1455
G_CALLBACK (gtk_main_quit),
1260
G_CALLBACK (gtk_main_quit),
1458
1263
main_vbox = gtk_vbox_new(FALSE, 0);
1464
1269
/* Create menu */
1465
1270
menu = make_menu(main_vbox, dlg);
1466
menu_set_open_command(menu, factory_file_open_dialog);
1467
menu_set_save_command(menu, factory_save);
1468
menu_set_save_as_command(menu, factory_save_as);
1469
menu_set_preferences_command(menu, factory_preferences_dialog);
1470
menu_set_close_command(menu, factory_close);
1471
menu_set_quit_command(menu, factory_quit);
1472
menu_set_undo_command(menu, factory_undo);
1473
menu_set_redo_command(menu, factory_redo);
1474
menu_set_cut_command(menu, factory_cut);
1475
menu_set_copy_command(menu, factory_copy);
1476
menu_set_paste_command(menu, factory_paste);
1477
menu_set_select_all_command(menu, factory_select_all);
1478
menu_set_deselect_all_command(menu, factory_deselect_all);
1479
menu_set_clear_command(menu, factory_clear);
1480
menu_set_edit_erea_info_command(menu, factory_edit);
1481
menu_set_area_list_command(menu, factory_toggle_area_list);
1482
menu_set_source_command(menu, factory_source_dialog);
1483
menu_set_color_command(menu, factory_preview_color);
1484
menu_set_gray_command(menu, factory_preview_gray);
1485
menu_set_zoom_in_command(menu, factory_menu_zoom_in);
1486
menu_set_zoom_out_command(menu, factory_menu_zoom_out);
1487
menu_set_edit_map_info_command(menu, factory_settings_dialog);
1488
menu_set_grid_settings_command(menu, factory_grid_settings_dialog);
1489
menu_set_create_guides_command(menu, factory_create_guides_dialog);
1490
menu_set_use_gimp_guides_command(menu, factory_use_gimp_guides_dialog);
1491
menu_set_help_command(menu, factory_help);
1492
menu_set_about_command(menu, factory_about_dialog);
1495
popup = create_main_popup_menu();
1496
popup_set_zoom_in_command(popup, factory_zoom_in);
1497
popup_set_zoom_out_command(popup, factory_zoom_out);
1498
popup_set_edit_map_info_command(popup, factory_settings_dialog);
1499
popup_set_grid_settings_command(popup, factory_grid_settings_dialog);
1500
popup_set_create_guides_command(popup, factory_create_guides_dialog);
1501
popup_set_paste_command(popup, factory_paste);
1503
1272
/* Create toolbar */
1504
_toolbar = make_toolbar(main_vbox, dlg);
1505
toolbar_set_open_command(_toolbar, factory_file_open_dialog);
1506
toolbar_set_save_command(_toolbar, factory_save);
1507
toolbar_set_preferences_command(_toolbar, factory_preferences_dialog);
1508
toolbar_set_undo_command(_toolbar, factory_undo);
1509
toolbar_set_redo_command(_toolbar, factory_redo);
1510
toolbar_set_cut_command(_toolbar, factory_cut);
1511
toolbar_set_copy_command(_toolbar, factory_copy);
1512
toolbar_set_paste_command(_toolbar, factory_paste);
1513
toolbar_set_zoom_in_command(_toolbar, factory_zoom_in);
1514
toolbar_set_zoom_out_command(_toolbar, factory_zoom_out);
1515
toolbar_set_edit_map_info_command(_toolbar, factory_settings_dialog);
1516
toolbar_set_move_to_front_command(_toolbar, factory_move_to_front);
1517
toolbar_set_send_to_back_command(_toolbar, factory_send_to_back);
1518
toolbar_set_grid_command(_toolbar, factory_toolbar_grid);
1273
make_toolbar(main_vbox, dlg);
1520
1275
/* Dialog area */
1521
1276
hbox = gtk_hbox_new(FALSE, 1);
1523
1278
gtk_widget_show(hbox);
1525
1280
tools = make_tools(dlg);
1526
selection_set_delete_command(tools, factory_clear);
1527
selection_set_edit_command(tools, factory_edit);
1528
gtk_box_pack_start(GTK_BOX(hbox), tools->container, FALSE, FALSE, 0);
1281
/* selection_set_edit_command(tools, factory_edit); */
1282
gtk_box_pack_start(GTK_BOX(hbox), tools, FALSE, FALSE, 0);
1530
1284
_preview = make_preview(drawable);
1531
1285
add_preview_motion_event(_preview, (GtkSignalFunc) preview_move);