~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/imagemap/imap_main.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *
4
4
 * Generates clickable image maps.
5
5
 *
6
 
 * Copyright (C) 1998-2003 Maurits Rijk  lpeek.mrijk@consunet.nl
 
6
 * Copyright (C) 1998-2006 Maurits Rijk  m.rijk@chello.nl
7
7
 *
8
8
 * This program is free software; you can redistribute it and/or modify
9
9
 * it under the terms of the GNU General Public License as published by
25
25
 
26
26
#include <stdarg.h>
27
27
#include <stdlib.h>
28
 
#include <stdio.h>
29
28
#include <string.h>
30
29
 
 
30
#include <glib/gstdio.h>
 
31
 
31
32
#include <gtk/gtk.h>
32
33
#include <gdk/gdkkeysyms.h> /* for keyboard values */
33
34
 
40
41
#include "imap_default_dialog.h"
41
42
#include "imap_edit_area_info.h"
42
43
#include "imap_file.h"
43
 
#include "imap_grid.h"
44
44
#include "imap_main.h"
45
45
#include "imap_menu.h"
46
46
#include "imap_misc.h"
47
47
#include "imap_object.h"
48
48
#include "imap_polygon.h"
49
 
#include "imap_popup.h"
50
49
#include "imap_preview.h"
51
50
#include "imap_rectangle.h"
52
51
#include "imap_selection.h"
55
54
#include "imap_statusbar.h"
56
55
#include "imap_stock.h"
57
56
#include "imap_string.h"
58
 
#include "imap_toolbar.h"
59
 
#include "imap_tools.h"
60
57
 
61
58
#include "libgimp/stdplugins-intl.h"
62
59
 
65
62
#define ZOOMED(x) (_zoom_factor * (x))
66
63
#define GET_REAL_COORD(x) ((x) / _zoom_factor)
67
64
 
 
65
#define PLUG_IN_PROC "plug-in-imagemap"
 
66
 
 
67
static gint             zoom_in         (void);
 
68
static gint             zoom_out        (void);
 
69
 
 
70
 
68
71
/* Global variables */
69
72
static MapInfo_t   _map_info;
70
73
static PreferencesData_t _preferences = {CSIM, TRUE, FALSE, TRUE, TRUE, FALSE,
72
75
static MRU_t *_mru;
73
76
 
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;
90
92
 
91
93
/* Declare local functions. */
92
94
static void  query  (void);
93
95
static void  run    (const gchar      *name,
94
 
                     gint              nparams,
95
 
                     const GimpParam  *param,
96
 
                     gint             *nreturn_vals,
97
 
                     GimpParam       **return_vals);
 
96
                     gint              nparams,
 
97
                     const GimpParam  *param,
 
98
                     gint             *nreturn_vals,
 
99
                     GimpParam       **return_vals);
98
100
static gint  dialog (GimpDrawable     *drawable);
99
101
 
100
 
GimpPlugInInfo PLUG_IN_INFO = {
101
 
   NULL,                        /* init_proc */
102
 
   NULL,                        /* quit_proc */
103
 
   query,                       /* query_proc */
104
 
   run,                         /* run_proc */
 
102
const GimpPlugInInfo PLUG_IN_INFO = {
 
103
   NULL,                        /* init_proc */
 
104
   NULL,                        /* quit_proc */
 
105
   query,                       /* query_proc */
 
106
   run,                         /* run_proc */
105
107
};
106
108
 
107
109
static int run_flag = 0;
111
113
 
112
114
static void query(void)
113
115
{
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"},
118
120
   };
119
 
   static GimpParamDef *return_vals = NULL;
 
121
   static const GimpParamDef *return_vals = NULL;
120
122
   static int nreturn_vals = 0;
121
123
 
122
 
   gimp_install_procedure("plug_in_imagemap",
123
 
                          "Creates a clickable imagemap.",
124
 
                          "",
125
 
                          "Maurits Rijk",
126
 
                          "Maurits Rijk",
127
 
                          "1998-2002",
128
 
                          N_("_ImageMap..."),
129
 
                          "RGB*, GRAY*, INDEXED*",
130
 
                          GIMP_PLUGIN,
131
 
                          G_N_ELEMENTS (args), nreturn_vals,
132
 
                          args, return_vals);
 
124
   gimp_install_procedure(PLUG_IN_PROC,
 
125
                          N_("Create a clickable imagemap"),
 
126
                          "",
 
127
                          "Maurits Rijk",
 
128
                          "Maurits Rijk",
 
129
                          "1998-2005",
 
130
                          N_("_Image Map..."),
 
131
                          "RGB*, GRAY*, INDEXED*",
 
132
                          GIMP_PLUGIN,
 
133
                          G_N_ELEMENTS (args), nreturn_vals,
 
134
                          args, return_vals);
133
135
 
134
 
   gimp_plugin_menu_register ("plug_in_imagemap", "<Image>/Filters/Web");
 
136
   gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Filters/Web");
135
137
}
136
138
 
137
139
static void
164
166
 
165
167
   if (run_mode == GIMP_RUN_INTERACTIVE) {
166
168
      if (!dialog(drawable)) {
167
 
         /* The dialog was closed, or something similarly evil happened. */
168
 
         status = GIMP_PDB_EXECUTION_ERROR;
 
169
         /* The dialog was closed, or something similarly evil happened. */
 
170
         status = GIMP_PDB_EXECUTION_ERROR;
169
171
      }
170
172
   }
171
173
 
236
238
   _preferences.selected_gc = gdk_gc_new(_preview->preview->window);
237
239
 
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,
242
 
                              GDK_JOIN_BEVEL);
 
243
                              GDK_LINE_DOUBLE_DASH, GDK_CAP_BUTT,
 
244
                              GDK_JOIN_BEVEL);
243
245
 
244
246
   gdk_gc_set_foreground(_preferences.normal_gc, &colors->normal_fg);
245
247
   gdk_gc_set_background(_preferences.normal_gc, &colors->normal_bg);
299
301
{
300
302
   set_busy_cursor();
301
303
   _zoom_factor = zoom_factor;
302
 
   toolbar_set_zoom_sensitivity(_toolbar, zoom_factor);
303
304
   preview_zoom(_preview, zoom_factor);
304
305
   statusbar_set_zoom(_statusbar, zoom_factor);
305
306
   remove_busy_cursor();
306
307
}
307
308
 
308
 
void
309
 
main_toolbar_set_grid(gboolean active)
310
 
{
311
 
   toolbar_set_grid(_toolbar, active);
312
 
}
313
 
 
314
309
gint
315
310
get_real_coord(gint coord)
316
311
{
324
319
}
325
320
 
326
321
void
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)
329
324
{
330
325
   gdk_draw_rectangle(window, gc, filled, ZOOMED(x), ZOOMED(y),
331
 
                      ZOOMED(width), ZOOMED(height));
 
326
                      ZOOMED(width), ZOOMED(height));
332
327
}
333
328
 
334
329
void
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)
337
332
{
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);
340
335
}
341
336
 
342
337
void
390
385
      preview_redraw(_preview);
391
386
}
392
387
 
393
 
static void
394
 
set_preview_gray(void)
395
 
{
396
 
   _map_info.show_gray = TRUE;
397
 
   set_zoom(_zoom_factor);
398
 
}
399
 
 
400
 
static void
401
 
set_preview_color(void)
402
 
{
403
 
   _map_info.show_gray = FALSE;
404
 
   set_zoom(_zoom_factor);
405
 
}
406
 
 
407
 
const char*
 
388
void
 
389
set_preview_color (GtkRadioAction *action, GtkRadioAction *current,
 
390
                   gpointer user_data)
 
391
{
 
392
  _map_info.show_gray = (gtk_radio_action_get_current_value (current) == 1);
 
393
   set_zoom(_zoom_factor);
 
394
}
 
395
 
 
396
void
 
397
set_zoom_factor (GtkRadioAction *action, GtkRadioAction *current,
 
398
                 gpointer user_data)
 
399
{
 
400
  gint factor = gtk_radio_action_get_current_value (current);
 
401
  set_zoom (factor + 1);
 
402
}
 
403
 
 
404
const gchar *
408
405
get_image_name(void)
409
406
{
410
407
   return _image_name;
416
413
   return _filename;
417
414
}
418
415
 
419
 
void
 
416
static gboolean
 
417
arrow_on_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
 
418
{
 
419
   if (event->button == 1) {
 
420
      if (event->type == GDK_2BUTTON_PRESS)
 
421
         edit_shape((gint) event->x, (gint) event->y);
 
422
      else
 
423
         select_shape(widget, event);
 
424
   } else {
 
425
      do_popup_menu(event);
 
426
   }
 
427
   return FALSE;
 
428
}
 
429
 
 
430
static void
420
431
set_arrow_func(void)
421
432
{
422
433
   _button_press_func = arrow_on_button_press;
423
434
   _cursor = GDK_TOP_LEFT_ARROW;
424
435
}
425
436
 
426
 
static gboolean
427
 
fuzzy_select_on_button_press (GtkWidget      *widget,
428
 
                              GdkEventButton *event,
429
 
                              gpointer        data)
430
 
{
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);
435
 
      gint32 channel_ID;
436
 
 
437
 
      /* Save the old selection first */
438
 
      channel_ID = gimp_selection_save(image_ID);
439
 
 
440
 
      if (gimp_fuzzy_select(_drawable->drawable_id, rx, ry,
441
 
                            10, /* Treshold */
442
 
                            GIMP_CHANNEL_OP_REPLACE,
443
 
                            FALSE, FALSE, 0, FALSE)) {
444
 
         GimpParam *return_vals;
445
 
         gint       nreturn_vals;
446
 
 
447
 
         return_vals = gimp_run_procedure ("plug_in_sel2path",
448
 
                                           &nreturn_vals,
449
 
                                           GIMP_PDB_INT32,    TRUE,
450
 
                                           GIMP_PDB_IMAGE,    image_ID,
451
 
                                           GIMP_PDB_DRAWABLE, -1,
452
 
                                           GIMP_PDB_END);
453
 
 
454
 
         if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
455
 
           {
456
 
            gdouble distance;
457
 
            gchar *path_name = gimp_path_get_current(image_ID);
458
 
            Object_t *object = create_polygon(NULL);
459
 
            Polygon_t *polygon = ObjectToPolygon(object);
460
 
            gint x0, y0;
461
 
            gdouble grad0;
462
 
 
463
 
            add_shape(object);
464
 
            x0 = gimp_path_get_point_at_dist(image_ID, 0.0, &y0, &grad0);
465
 
            polygon_append_point(polygon, x0, y0);
466
 
 
467
 
            for (distance = 1.0;; distance += 1.0) {
468
 
               gint x1, y1 = -1;
469
 
               gdouble grad1;
470
 
 
471
 
               x1 = gimp_path_get_point_at_dist(image_ID, distance, &y1,
472
 
                                                &grad1);
473
 
 
474
 
               if (y1 == -1)
475
 
                  break;
476
 
 
477
 
               if (abs(x1 - x0) <= 1 || abs(y1 - y0) <= 1) {
478
 
                  gdouble diff;
479
 
 
480
 
                  if (grad0 != 0.0)
481
 
                     diff = (grad1 - grad0) / grad0;
482
 
                  else
483
 
                     diff = grad1;
484
 
 
485
 
                  if (fabs(diff) > 0.1) {
486
 
                     polygon_append_point(polygon, x1, y1);
487
 
                     grad0 = grad1;
488
 
                  }
489
 
                  x0 = x1;
490
 
                  y0 = y1;
491
 
               }
492
 
            }
493
 
            gimp_path_delete(image_ID, path_name);
494
 
            g_free(path_name);
495
 
         } else {
496
 
            printf("Damn %d\n", return_vals[0].data.d_status);
497
 
         }
498
 
         gimp_destroy_params(return_vals, nreturn_vals);
499
 
      }
500
 
 
501
 
      /* Restore old selection */
502
 
      (void) gimp_selection_load(channel_ID);
503
 
      (void) gimp_image_remove_channel(image_ID, channel_ID);
504
 
   }
505
 
   return FALSE;
506
 
}
507
 
 
508
 
void
509
 
set_fuzzy_select_func(void)
510
 
{
511
 
   _button_press_func = fuzzy_select_on_button_press;
512
 
   _cursor = GDK_TOP_LEFT_ARROW; /* Fix me! */
513
 
}
514
 
 
515
437
static void
516
438
set_object_func(gboolean (*func)(GtkWidget*, GdkEventButton*,
517
 
                                 gpointer), gpointer param)
 
439
                                 gpointer), gpointer param)
518
440
{
519
441
   _button_press_func = func;
520
442
   _button_press_param = param;
522
444
}
523
445
 
524
446
void
525
 
set_rectangle_func(void)
526
 
{
527
 
   set_object_func(object_on_button_press, get_rectangle_factory);
528
 
}
529
 
 
530
 
void
531
 
set_circle_func(void)
532
 
{
533
 
   set_object_func(object_on_button_press, get_circle_factory);
534
 
}
535
 
 
536
 
void
537
 
set_polygon_func(void)
538
 
{
539
 
   set_object_func(object_on_button_press, get_polygon_factory);
 
447
set_func(GtkRadioAction *action, GtkRadioAction *current,
 
448
         gpointer user_data)
 
449
{
 
450
  gint value = gtk_radio_action_get_current_value (current);
 
451
  switch (value)
 
452
    {
 
453
    case 0:
 
454
      set_arrow_func();
 
455
      break;
 
456
    case 1:
 
457
      set_object_func(object_on_button_press, get_rectangle_factory);
 
458
      break;
 
459
    case 2:
 
460
      set_object_func(object_on_button_press, get_circle_factory);
 
461
      break;
 
462
    case 3:
 
463
      set_object_func(object_on_button_press, get_polygon_factory);
 
464
      break;
 
465
    default:
 
466
      break;
 
467
    }
540
468
}
541
469
 
542
470
void
557
485
   object_list_update(_shapes, obj);
558
486
}
559
487
 
560
 
static void
561
 
edit_selected_shape(void)
 
488
void
 
489
do_edit_selected_shape(void)
562
490
{
563
491
   object_list_edit_selected(_shapes);
564
492
}
581
509
{
582
510
   gint count = object_list_nr_selected(_shapes);
583
511
   menu_shapes_selected(count);
584
 
   toolbar_shapes_selected(_toolbar, count);
585
 
   tools_set_sensitive(count);
586
512
}
587
513
 
588
514
static void
592
518
 
593
519
   g_strreplace(&_filename, filename);
594
520
   p = (filename) ? g_path_get_basename(filename) : _("<Untitled>");
595
 
   title = g_strdup_printf("%s - ImageMap", p);
 
521
   title = g_strdup_printf("%s - Image Map", p);
596
522
   if (filename)
597
523
     g_free (p);
598
524
   gtk_window_set_title(GTK_WINDOW(_dlg), title);
602
528
void
603
529
main_set_dimension(gint width, gint height)
604
530
{
605
 
   statusbar_set_dimension(_statusbar, width / _zoom_factor,
606
 
                           height / _zoom_factor);
 
531
   statusbar_set_dimension(_statusbar,
 
532
                           width / _zoom_factor, height / _zoom_factor);
607
533
}
608
534
 
609
535
void
634
560
   MoveSashFunc_t sash_func;
635
561
 
636
562
   obj = object_list_near_sash(_shapes, x, y, &sash_func);
637
 
   if (obj) {                   /* Start resizing */
 
563
   if (obj) {                   /* Start resizing */
638
564
      Command_t *command = move_sash_command_new(widget, obj, x, y, sash_func);
639
565
      command_execute(command);
640
566
   } else {
642
568
 
643
569
      obj = object_list_find(_shapes, x, y);
644
570
      if (obj) {
645
 
         if (event->state & GDK_SHIFT_MASK) {
646
 
            if (obj->selected)
647
 
               command = unselect_command_new(obj);
648
 
            else
649
 
               command = select_command_new(obj);
650
 
         } else {               /* No Shift key pressed */
651
 
            if (obj->selected) {
652
 
               command = unselect_all_command_new(_shapes, obj);
653
 
            } else {
654
 
               Command_t *sub_command;
655
 
 
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);
662
 
               subcommand_end();
663
 
            }
664
 
         }
665
 
         command_execute(command);
666
 
 
667
 
         command = move_command_new(_preview, obj, x, y);
668
 
         command_execute(command);
 
571
         if (event->state & GDK_SHIFT_MASK) {
 
572
            if (obj->selected)
 
573
               command = unselect_command_new(obj);
 
574
            else
 
575
               command = select_command_new(obj);
 
576
         } else {               /* No Shift key pressed */
 
577
            if (obj->selected) {
 
578
               command = unselect_all_command_new(_shapes, obj);
 
579
            } else {
 
580
               Command_t *sub_command;
 
581
 
 
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);
 
588
               subcommand_end();
 
589
            }
 
590
         }
 
591
         command_execute(command);
 
592
 
 
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);
672
598
      }
673
599
   }
674
600
}
688
614
   }
689
615
}
690
616
 
691
 
static void
692
 
toolbar_grid(void)
693
 
{
694
 
   gint grid = toggle_grid();
695
 
   popup_check_grid(grid);
696
 
   menu_check_grid(grid);
697
 
}
698
 
 
699
 
static void
700
 
menu_zoom_in(void)
 
617
void
 
618
do_zoom_in(void)
701
619
{
702
620
   gint factor = zoom_in();
703
621
   menu_set_zoom_sensitivity(factor);
704
 
   popup_set_zoom_sensitivity(factor);
705
622
}
706
623
 
707
 
static void
708
 
menu_zoom_out(void)
 
624
void
 
625
do_zoom_out(void)
709
626
{
710
627
   gint factor = zoom_out();
711
628
   menu_set_zoom_sensitivity(factor);
712
 
   popup_set_zoom_sensitivity(factor);
713
629
}
714
630
 
715
631
void
739
655
static void
740
656
do_data_changed_dialog(void (*continue_cb)(gpointer), gpointer param)
741
657
{
742
 
   static Alert_t *alert;
743
 
 
744
 
   if (!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?"));
748
 
   }
749
 
   default_dialog_set_ok_cb(alert->dialog, continue_cb, param);
750
 
   default_dialog_show(alert->dialog);
 
658
   GtkWidget *dialog = gtk_message_dialog_new
 
659
     (NULL,
 
660
      GTK_DIALOG_DESTROY_WITH_PARENT,
 
661
      GTK_MESSAGE_QUESTION,
 
662
      GTK_BUTTONS_YES_NO,
 
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?"));
 
667
 
 
668
   if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
 
669
     continue_cb (param);
 
670
 
 
671
   gtk_widget_destroy (dialog);
751
672
}
752
673
 
753
674
static void
754
675
check_if_changed(void (*func)(gpointer), gpointer param)
755
676
{
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);
758
679
   else
759
 
      func(param);
 
680
     func (param);
760
681
}
761
682
 
762
683
static void
779
700
   close_current();
780
701
}
781
702
 
782
 
static void
 
703
void
783
704
do_close(void)
784
705
{
785
706
   check_if_changed(really_close, NULL);
793
714
   gtk_widget_destroy(_dlg);
794
715
}
795
716
 
796
 
static void
 
717
void
797
718
do_quit(void)
798
719
{
799
720
   check_if_changed(really_quit, NULL);
800
721
}
801
722
 
 
723
#ifdef _NOT_READY_YET_
802
724
static void
803
725
do_undo(void)
804
726
{
818
740
   selection_thaw(_selection);
819
741
   preview_thaw();
820
742
}
 
743
#endif
821
744
 
822
 
static void
 
745
void
823
746
save(void)
824
747
{
825
748
   if (_filename)
842
765
   gchar *next_token;
843
766
 
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;
877
800
 
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);
882
805
   output(param,
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");
885
808
   output(param,
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);
889
812
 
890
813
   description = g_strdup(_map_info.description);
895
818
   object_list_write_csim(_shapes, param, output);
896
819
   if (*_map_info.default_url)
897
820
      output(param, "<area shape=\"default\" href=\"%s\" />\n",
898
 
             _map_info.default_url);
 
821
             _map_info.default_url);
899
822
   output(param, "</map>\n");
900
823
}
901
824
 
905
828
   char *p;
906
829
   gchar *description;
907
830
 
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");
947
870
void
948
871
save_as(const gchar *filename)
949
872
{
950
 
   FILE *out = fopen(filename, "w");
 
873
   FILE *out = g_fopen(filename, "w");
951
874
   if (out) {
952
875
      dump_output(out, save_to_file);
953
876
      fclose(out);
961
884
}
962
885
 
963
886
static void
964
 
resize_image_ok_cb(gpointer data)
965
 
{
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);
969
 
   preview_thaw();
970
 
}
971
 
 
972
 
static void
973
 
resize_image_cancel_cb(gpointer data)
974
 
{
975
 
   preview_thaw();
976
 
}
977
 
 
978
 
static void
979
887
do_image_size_changed_dialog(void)
980
888
{
981
 
   static Alert_t *alert;
982
 
 
983
 
   if (!alert) {
984
 
     alert = create_confirm_alert(GTK_STOCK_DIALOG_WARNING);
985
 
     alert_set_text(alert, _("Image size has changed."),
986
 
                    _("Resize area's?"));
987
 
   }
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
 
890
     (NULL,
 
891
      GTK_DIALOG_DESTROY_WITH_PARENT,
 
892
      GTK_MESSAGE_QUESTION,
 
893
      GTK_BUTTONS_YES_NO,
 
894
      "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
 
895
      _("Image size has changed."),
 
896
      _("Resize area's?"));
 
897
 
 
898
   if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
 
899
     {
 
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);
 
903
     }
 
904
 
 
905
   preview_thaw();
 
906
   gtk_widget_destroy (dialog);
991
907
}
992
908
 
993
909
static void
1002
918
   if (load_csim(filename)) {
1003
919
      _map_info.map_format = CSIM;
1004
920
      if (_image_width != _map_info.old_image_width ||
1005
 
          _image_height != _map_info.old_image_height) {
1006
 
         preview_freeze();
1007
 
         do_image_size_changed_dialog();
 
921
          _image_height != _map_info.old_image_height) {
 
922
         preview_freeze();
 
923
         do_image_size_changed_dialog();
1008
924
      }
1009
925
   } else if (load_ncsa(filename)) {
1010
926
      _map_info.map_format = NCSA;
1033
949
   check_if_changed(really_load, (gpointer) tmp_filename);
1034
950
}
1035
951
 
1036
 
static void
 
952
void
1037
953
toggle_area_list(void)
1038
954
{
1039
955
   selection_toggle_visibility(_selection);
1058
974
   if (obj != prev_obj) {
1059
975
      prev_obj = 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);
1062
978
      } else {
1063
 
         statusbar_clear_status(_statusbar);
 
979
         statusbar_clear_status(_statusbar);
1064
980
      }
1065
981
   }
1066
982
#ifdef _NOT_READY_YET_
1067
983
   if (!obj) {
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);
1072
988
      } else {
1073
 
         preview_set_cursor(_preview, _cursor);
 
989
         preview_set_cursor(_preview, _cursor);
1074
990
      }
1075
991
   }
1076
992
#endif
1115
1031
   _dx += dx;
1116
1032
   _dy += dy;
1117
1033
 
1118
 
   gdk_gc_set_function(_preferences.normal_gc, GDK_EQUIV);
1119
 
   gdk_gc_set_function(_preferences.selected_gc, GDK_EQUIV);
 
1034
   gdk_gc_set_function(_preferences.normal_gc, GDK_XOR);
 
1035
   gdk_gc_set_function(_preferences.selected_gc, GDK_XOR);
1120
1036
   object_list_draw_selected(_shapes, _preview->preview->window);
1121
1037
   object_list_move_selected(_shapes, dx, dy);
1122
1038
   object_list_draw_selected(_shapes, _preview->preview->window);
1170
1086
      break;
1171
1087
   case GDK_Tab:
1172
1088
      if (shift)
1173
 
         command = select_prev_command_new(_shapes);
 
1089
         command = select_prev_command_new(_shapes);
1174
1090
      else
1175
 
         command = select_next_command_new(_shapes);
 
1091
         command = select_next_command_new(_shapes);
1176
1092
      command_execute(command);
1177
1093
      handled = TRUE;
1178
1094
      break;
1179
1095
   }
1180
1096
   if (handled)
1181
 
      g_signal_stop_emission_by_name(widget, "key_press_event");
 
1097
      g_signal_stop_emission_by_name(widget, "key-press-event");
1182
1098
 
1183
1099
   return handled;
1184
1100
}
1210
1126
   set_all_sensitivities();
1211
1127
}
1212
1128
 
1213
 
static Command_t*
1214
 
factory_file_open_dialog(void)
1215
 
{
1216
 
   return command_new(do_file_open_dialog);
1217
 
}
1218
 
 
1219
 
static void
 
1129
void
1220
1130
imap_help (void)
1221
1131
{
1222
1132
  gimp_standard_help_func ("plug-in-imagemap", NULL);
1223
1133
}
1224
1134
 
1225
 
static Command_t*
1226
 
factory_save(void)
1227
 
{
1228
 
   return command_new(save);
1229
 
}
1230
 
 
1231
 
static Command_t*
1232
 
factory_save_as(void)
1233
 
{
1234
 
   return command_new(do_file_save_as_dialog);
1235
 
}
1236
 
 
1237
 
static Command_t*
1238
 
factory_preferences_dialog(void)
1239
 
{
1240
 
   return command_new(do_preferences_dialog);
1241
 
}
1242
 
 
1243
 
static Command_t*
1244
 
factory_close(void)
1245
 
{
1246
 
   return command_new(do_close);
1247
 
}
1248
 
 
1249
 
static Command_t*
1250
 
factory_quit(void)
1251
 
{
1252
 
   return command_new(do_quit);
1253
 
}
1254
 
 
1255
 
 
1256
 
static Command_t*
1257
 
factory_undo(void)
1258
 
{
1259
 
   return command_new(do_undo);
1260
 
}
1261
 
 
1262
 
static Command_t*
1263
 
factory_redo(void)
1264
 
{
1265
 
   return command_new(do_redo);
1266
 
}
1267
 
 
1268
 
static Command_t*
1269
 
factory_cut(void)
1270
 
{
1271
 
   return cut_command_new(_shapes);
1272
 
}
1273
 
 
1274
 
static Command_t*
1275
 
factory_copy(void)
1276
 
{
1277
 
   return copy_command_new(_shapes);
1278
 
}
1279
 
 
1280
 
static Command_t*
1281
 
factory_paste(void)
1282
 
{
1283
 
   return paste_command_new(_shapes);
1284
 
}
1285
 
 
1286
 
static Command_t*
1287
 
factory_select_all(void)
1288
 
{
1289
 
   return select_all_command_new(_shapes);
1290
 
}
1291
 
 
1292
 
static Command_t*
1293
 
factory_deselect_all(void)
1294
 
{
1295
 
   return unselect_all_command_new(_shapes, NULL);
1296
 
}
1297
 
 
1298
 
static Command_t*
1299
 
factory_clear(void)
1300
 
{
1301
 
   return clear_command_new(_shapes);
1302
 
}
1303
 
 
1304
 
static Command_t*
1305
 
factory_edit(void)
1306
 
{
1307
 
   return command_new(edit_selected_shape);
1308
 
}
1309
 
 
1310
 
static Command_t*
1311
 
factory_toggle_area_list(void)
1312
 
{
1313
 
   return command_new(toggle_area_list);
1314
 
}
1315
 
 
1316
 
static Command_t*
1317
 
factory_source_dialog(void)
1318
 
{
1319
 
   return command_new(do_source_dialog);
1320
 
}
1321
 
 
1322
 
static Command_t*
1323
 
factory_preview_color(void)
1324
 
{
1325
 
   return command_new(set_preview_color);
1326
 
}
1327
 
 
1328
 
static Command_t*
1329
 
factory_preview_gray(void)
1330
 
{
1331
 
   return command_new(set_preview_gray);
1332
 
}
1333
 
 
1334
 
static Command_t*
1335
 
factory_menu_zoom_in(void)
1336
 
{
1337
 
   return command_new(menu_zoom_in);
1338
 
}
1339
 
 
1340
 
static Command_t*
1341
 
factory_menu_zoom_out(void)
1342
 
{
1343
 
   return command_new(menu_zoom_out);
1344
 
}
1345
 
 
1346
 
static Command_t*
1347
 
factory_zoom_in(void)
1348
 
{
1349
 
  return command_new((void (*)(void)) zoom_in);
1350
 
}
1351
 
 
1352
 
static Command_t*
1353
 
factory_zoom_out(void)
1354
 
{
1355
 
   return command_new((void (*)(void)) zoom_out);
1356
 
}
1357
 
 
1358
 
static Command_t*
1359
 
factory_settings_dialog(void)
1360
 
{
1361
 
   return command_new(do_settings_dialog);
1362
 
}
1363
 
 
1364
 
static Command_t*
1365
 
factory_move_to_front(void)
1366
 
{
1367
 
   return move_to_front_command_new(_shapes);
1368
 
}
1369
 
 
1370
 
static Command_t*
1371
 
factory_send_to_back(void)
1372
 
{
1373
 
   return send_to_back_command_new(_shapes);
1374
 
}
1375
 
 
1376
 
static Command_t*
1377
 
factory_toolbar_grid(void)
1378
 
{
1379
 
   return command_new(toolbar_grid);
1380
 
}
1381
 
 
1382
 
static Command_t*
1383
 
factory_grid_settings_dialog(void)
1384
 
{
1385
 
   return command_new(do_grid_settings_dialog);
1386
 
}
1387
 
 
1388
 
static Command_t*
1389
 
factory_create_guides_dialog(void)
1390
 
{
1391
 
   return guides_command_new(_shapes);
1392
 
}
1393
 
 
1394
 
static Command_t*
1395
 
factory_use_gimp_guides_dialog(void)
1396
 
{
1397
 
   return gimp_guides_command_new(_shapes, _drawable);
1398
 
}
1399
 
 
1400
 
static Command_t*
1401
 
factory_help(void)
1402
 
{
1403
 
   return command_new(imap_help);
1404
 
}
1405
 
 
1406
 
static Command_t*
1407
 
factory_about_dialog(void)
1408
 
{
1409
 
   return command_new(do_about_dialog);
 
1135
void
 
1136
do_cut (void)
 
1137
{
 
1138
  command_execute (cut_command_new (_shapes));
 
1139
}
 
1140
 
 
1141
void
 
1142
do_copy (void)
 
1143
{
 
1144
  command_execute (copy_command_new (_shapes));
 
1145
}
 
1146
 
 
1147
void
 
1148
do_paste (void)
 
1149
{
 
1150
  command_execute (paste_command_new (_shapes));
 
1151
}
 
1152
 
 
1153
void
 
1154
do_select_all(void)
 
1155
{
 
1156
  command_execute (select_all_command_new (_shapes));
 
1157
}
 
1158
 
 
1159
void
 
1160
do_deselect_all(void)
 
1161
{
 
1162
  command_execute (unselect_all_command_new (_shapes, NULL));
 
1163
}
 
1164
 
 
1165
void
 
1166
do_clear(void)
 
1167
{
 
1168
  command_execute (clear_command_new(_shapes));
 
1169
}
 
1170
 
 
1171
void
 
1172
do_move_up(void)
 
1173
{
 
1174
  /* Fix me!
 
1175
   Command_t *command = object_up_command_new(_current_obj->list,
 
1176
                                              _current_obj);
 
1177
   command_execute(command);
 
1178
  */
 
1179
}
 
1180
 
 
1181
void
 
1182
do_move_down(void)
 
1183
{
 
1184
  /* Fix me!
 
1185
   Command_t *command = object_down_command_new(_current_obj->list,
 
1186
                                                _current_obj);
 
1187
   command_execute(command);
 
1188
  */
 
1189
}
 
1190
 
 
1191
void
 
1192
do_move_to_front(void)
 
1193
{
 
1194
  command_execute(move_to_front_command_new(_shapes));
 
1195
}
 
1196
 
 
1197
void
 
1198
do_send_to_back(void)
 
1199
{
 
1200
  command_execute(send_to_back_command_new(_shapes));
 
1201
}
 
1202
 
 
1203
void
 
1204
do_use_gimp_guides_dialog(void)
 
1205
{
 
1206
  command_execute (gimp_guides_command_new (_shapes, _drawable));
 
1207
}
 
1208
 
 
1209
void
 
1210
do_create_guides_dialog(void)
 
1211
{
 
1212
  command_execute (guides_command_new (_shapes));
1410
1213
}
1411
1214
 
1412
1215
static Command_t*
1421
1224
   return move_down_command_new(_shapes);
1422
1225
}
1423
1226
 
1424
 
 
1425
 
 
1426
1227
static gint
1427
1228
dialog(GimpDrawable *drawable)
1428
1229
{
1429
 
   GtkWidget    *dlg;
1430
 
   GtkWidget    *hbox;
1431
 
   GtkWidget    *main_vbox;
1432
 
   Tools_t      *tools;
1433
 
   Menu_t       *menu;
1434
 
   PopupMenu_t  *popup;
 
1230
   GtkWidget    *dlg;
 
1231
   GtkWidget    *hbox;
 
1232
   GtkWidget    *main_vbox;
 
1233
   GtkWidget    *tools;
 
1234
   Menu_t       *menu;
1435
1235
 
1436
1236
   gimp_ui_init ("imagemap", TRUE);
1437
1237
 
 
1238
   set_arrow_func ();
 
1239
 
1438
1240
   _shapes = make_object_list();
1439
1241
 
1440
1242
   _dlg = dlg = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1444
1246
   gimp_help_connect (dlg, gimp_standard_help_func, "plug-in-imagemap", NULL);
1445
1247
 
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);
 
1249
 
 
1250
   gimp_window_set_transient (GTK_WINDOW (dlg));
 
1251
 
 
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);
1453
1258
 
1454
1259
   g_signal_connect (dlg, "destroy",
1455
 
                     G_CALLBACK (gtk_main_quit),
 
1260
                     G_CALLBACK (gtk_main_quit),
1456
1261
                     NULL);
1457
1262
 
1458
1263
   main_vbox = gtk_vbox_new(FALSE, 0);
1463
1268
 
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);
1493
 
 
1494
 
   /* Create popup */
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);
1502
1271
 
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);
1519
1274
 
1520
1275
   /*  Dialog area  */
1521
1276
   hbox = gtk_hbox_new(FALSE, 1);
1523
1278
   gtk_widget_show(hbox);
1524
1279
 
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);
1529
1283
 
1530
1284
   _preview = make_preview(drawable);
1531
1285
   add_preview_motion_event(_preview, (GtkSignalFunc) preview_move);
1545
1299
   _selection = make_selection(_shapes);
1546
1300
   selection_set_move_up_command(_selection, factory_move_up);
1547
1301
   selection_set_move_down_command(_selection, factory_move_down);
1548
 
   selection_set_delete_command(_selection, factory_clear);
1549
 
   selection_set_edit_command(_selection, factory_edit);
1550
1302
   gtk_box_pack_start(GTK_BOX(hbox), _selection->container, FALSE, FALSE, 0);
1551
1303
 
1552
1304
   _statusbar = make_statusbar(main_vbox, dlg);