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

« back to all changes in this revision

Viewing changes to plug-ins/imagemap/imap_object_popup.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-2005 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
27
27
 
28
28
#include "imap_commands.h"
29
29
#include "imap_main.h"
 
30
#include "imap_menu.h"
30
31
#include "imap_object_popup.h"
31
32
 
32
33
#include "libgimp/stdplugins-intl.h"
33
34
 
34
 
 
35
 
/* Current object with popup menu */
36
 
static Object_t *_current_obj;
37
 
 
38
 
Object_t*
39
 
get_popup_object(void)
40
 
{
41
 
   return _current_obj;
42
 
}
43
 
 
44
 
static void
45
 
popup_edit_area_info(GtkWidget *widget, gpointer data)
46
 
{
47
 
   object_edit(_current_obj, TRUE);
48
 
}
49
 
 
50
 
static void
51
 
popup_delete_area(GtkWidget *widget, gpointer data)
52
 
{
53
 
   if (_current_obj->locked) {
54
 
      do_object_locked_dialog();
55
 
   } else {
56
 
      object_remove(_current_obj);
57
 
      redraw_preview();
58
 
   }
59
 
}
60
 
 
61
 
static void
62
 
popup_move_up(GtkWidget *widget, gpointer data)
63
 
{
64
 
   Command_t *command = object_up_command_new(_current_obj->list,
65
 
                                              _current_obj);
66
 
   command_execute(command);
67
 
}
68
 
 
69
 
static void
70
 
popup_move_down(GtkWidget *widget, gpointer data)
71
 
{
72
 
   Command_t *command = object_down_command_new(_current_obj->list,
73
 
                                                _current_obj);
74
 
   command_execute(command);
75
 
}
76
 
 
77
 
static void
78
 
popup_cut(GtkWidget *widget, gpointer data)
79
 
{
80
 
   if (_current_obj->locked) {
81
 
      do_object_locked_dialog();
82
 
   } else {
83
 
      Command_t *command = cut_object_command_new(_current_obj);
84
 
      command_execute(command);
85
 
   }
86
 
}
87
 
 
88
 
static void
89
 
popup_copy(GtkWidget *widget, gpointer data)
90
 
{
91
 
   Command_t *command = copy_object_command_new(_current_obj);
92
 
   command_execute(command);
93
 
}
94
 
 
95
 
ObjectPopup_t*
96
 
make_object_popup(void)
97
 
{
98
 
   ObjectPopup_t *popup = g_new (ObjectPopup_t, 1);
99
 
   GtkWidget     *menu;
100
 
 
101
 
   popup->menu = menu = gtk_menu_new ();
102
 
   make_item_with_label (menu,
103
 
                        _("Edit Area Info..."), popup_edit_area_info, NULL);
104
 
   make_item_with_label (menu,
105
 
                         _("Delete Area"), popup_delete_area, NULL);
106
 
   popup->up = make_item_with_label (menu,
107
 
                                     _("Move Up"), popup_move_up, NULL);
108
 
   popup->down = make_item_with_label (menu,
109
 
                                       _("Move Down"), popup_move_down, NULL);
110
 
   make_item_with_label (menu,
111
 
                         _("Cut"), popup_cut, NULL);
112
 
   make_item_with_label (menu,
113
 
                         _("Copy"), popup_copy, NULL);
114
 
 
115
 
   return popup;
116
 
}
117
 
 
118
 
GtkWidget*
119
 
object_popup_prepend_menu(ObjectPopup_t *popup, gchar *label,
120
 
                          MenuCallback activate, gpointer data)
121
 
{
122
 
   return prepend_item_with_label(popup->menu, label, activate, data);
123
 
}
124
 
 
125
35
void
126
36
object_handle_popup(ObjectPopup_t *popup, Object_t *obj, GdkEventButton *event)
127
37
{
128
 
   int position = object_get_position_in_list(obj) + 1;
 
38
  /* int position = object_get_position_in_list(obj) + 1; */
129
39
 
130
 
   _current_obj = popup->obj = obj;
 
40
#ifdef _TEMP_
131
41
   gtk_widget_set_sensitive(popup->up, (position > 1) ? TRUE : FALSE);
132
42
   gtk_widget_set_sensitive(popup->down,
133
43
                            (position < g_list_length(obj->list->list))
134
44
                            ? TRUE : FALSE);
135
 
 
 
45
#endif
136
46
   gtk_menu_popup(GTK_MENU(popup->menu), NULL, NULL, NULL, NULL,
137
47
                  event->button, event->time);
138
48
}
143
53
   static ObjectPopup_t *popup;
144
54
 
145
55
   if (!popup)
146
 
      popup = make_object_popup();
147
 
   object_handle_popup(popup, obj, event);
 
56
     {
 
57
       popup = g_new (ObjectPopup_t, 1);
 
58
       popup->menu = menu_get_widget ("/ObjectPopupMenu");
 
59
     }
 
60
   object_handle_popup (popup, obj, event);
148
61
}