2
* This is a plug-in for the GIMP.
4
* Generates clickable image maps.
6
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28
#include "imap_commands.h"
29
#include "imap_main.h"
30
#include "imap_object_popup.h"
32
#include "libgimp/stdplugins-intl.h"
35
/* Current object with popup menu */
36
static Object_t *_current_obj;
39
get_popup_object(void)
45
popup_edit_area_info(GtkWidget *widget, gpointer data)
47
object_edit(_current_obj, TRUE);
51
popup_delete_area(GtkWidget *widget, gpointer data)
53
if (_current_obj->locked) {
54
do_object_locked_dialog();
56
object_remove(_current_obj);
62
popup_move_up(GtkWidget *widget, gpointer data)
64
Command_t *command = object_up_command_new(_current_obj->list,
66
command_execute(command);
70
popup_move_down(GtkWidget *widget, gpointer data)
72
Command_t *command = object_down_command_new(_current_obj->list,
74
command_execute(command);
78
popup_cut(GtkWidget *widget, gpointer data)
80
if (_current_obj->locked) {
81
do_object_locked_dialog();
83
Command_t *command = cut_object_command_new(_current_obj);
84
command_execute(command);
89
popup_copy(GtkWidget *widget, gpointer data)
91
Command_t *command = copy_object_command_new(_current_obj);
92
command_execute(command);
96
make_object_popup(void)
98
ObjectPopup_t *popup = g_new (ObjectPopup_t, 1);
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);
119
object_popup_prepend_menu(ObjectPopup_t *popup, gchar *label,
120
MenuCallback activate, gpointer data)
122
return prepend_item_with_label(popup->menu, label, activate, data);
126
object_handle_popup(ObjectPopup_t *popup, Object_t *obj, GdkEventButton *event)
128
int position = object_get_position_in_list(obj) + 1;
130
_current_obj = popup->obj = obj;
131
gtk_widget_set_sensitive(popup->up, (position > 1) ? TRUE : FALSE);
132
gtk_widget_set_sensitive(popup->down,
133
(position < g_list_length(obj->list->list))
136
gtk_menu_popup(GTK_MENU(popup->menu), NULL, NULL, NULL, NULL,
137
event->button, event->time);
141
object_do_popup(Object_t *obj, GdkEventButton *event)
143
static ObjectPopup_t *popup;
146
popup = make_object_popup();
147
object_handle_popup(popup, obj, event);