2
* This is a plug-in for the GIMP.
4
* Generates clickable image maps.
6
* Copyright (C) 1998-2002 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_edit_area_info.h"
29
#include "imap_grid.h"
30
#include "imap_main.h"
31
#include "imap_menu.h"
32
#include "imap_menu_funcs.h"
33
#include "imap_popup.h"
34
#include "imap_stock.h"
35
#include "imap_tools.h"
37
#include "libgimp/stdplugins-intl.h"
39
static gint _popup_callback_lock;
40
static PopupMenu_t _popup;
43
popup_set_zoom_sensitivity(gint factor)
45
gtk_widget_set_sensitive(_popup.zoom_in, factor < 8);
46
gtk_widget_set_sensitive(_popup.zoom_out, factor > 1);
50
popup_rectangle(GtkWidget *widget, gpointer data)
52
if (_popup_callback_lock) {
53
_popup_callback_lock = FALSE;
56
tools_select_rectangle();
57
menu_select_rectangle();
62
popup_circle(GtkWidget *widget, gpointer data)
64
if (_popup_callback_lock) {
65
_popup_callback_lock = FALSE;
68
tools_select_circle();
74
popup_polygon(GtkWidget *widget, gpointer data)
76
if (_popup_callback_lock) {
77
_popup_callback_lock = FALSE;
80
tools_select_polygon();
81
menu_select_polygon();
86
popup_arrow(GtkWidget *widget, gpointer data)
88
if (_popup_callback_lock) {
89
_popup_callback_lock = FALSE;
98
popup_grid(GtkWidget *widget, gpointer data)
100
if (_popup_callback_lock) {
101
_popup_callback_lock = FALSE;
103
gint grid = toggle_grid();
104
menu_check_grid(grid);
105
main_toolbar_set_grid(grid);
110
paste_buffer_added(Object_t *obj, gpointer data)
112
gtk_widget_set_sensitive((GtkWidget*) data, TRUE);
116
paste_buffer_removed(Object_t *obj, gpointer data)
118
gtk_widget_set_sensitive((GtkWidget*) data, TRUE);
122
create_main_popup_menu(void)
124
GtkWidget *popup_menu, *sub_menu;
128
_popup.main = popup_menu = gtk_menu_new();
130
make_item_with_image(popup_menu, IMAP_STOCK_MAP_INFO, menu_command,
131
&_popup.cmd_edit_map_info);
133
sub_menu = make_sub_menu(popup_menu, _("Tools"));
134
_popup.arrow = make_radio_item(sub_menu, NULL, _("Arrow"), popup_arrow,
136
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_popup.arrow));
137
_popup.rectangle = make_radio_item(sub_menu, group, _("Rectangle"),
138
popup_rectangle, NULL);
139
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_popup.rectangle));
140
_popup.circle = make_radio_item(sub_menu, group, _("Circle"),
142
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_popup.circle));
143
_popup.polygon = make_radio_item(sub_menu, group, _("Polygon"),
144
popup_polygon, NULL);
146
sub_menu = make_sub_menu(popup_menu, _("Zoom"));
147
_popup.zoom_in = make_item_with_image(sub_menu, GTK_STOCK_ZOOM_IN,
148
menu_command, &_popup.cmd_zoom_in);
149
_popup.zoom_out = make_item_with_image(sub_menu, GTK_STOCK_ZOOM_OUT,
150
menu_command, &_popup.cmd_zoom_out);
151
gtk_widget_set_sensitive(_popup.zoom_out, FALSE);
153
_popup.grid = make_check_item(popup_menu, _("Grid"), popup_grid, NULL);
154
make_item_with_label(popup_menu, _("Grid Settings..."), menu_command,
155
&_popup.cmd_grid_settings);
156
make_item_with_label(popup_menu, _("Guides..."), menu_command,
157
&_popup.cmd_create_guides);
158
paste = make_item_with_image(popup_menu, GTK_STOCK_PASTE, menu_command,
160
gtk_widget_set_sensitive(paste, FALSE);
161
paste_buffer_add_add_cb(paste_buffer_added, (gpointer) paste);
162
paste_buffer_add_remove_cb(paste_buffer_removed, (gpointer) paste);
168
do_main_popup_menu(GdkEventButton *event)
170
gtk_menu_popup(GTK_MENU(_popup.main), NULL, NULL, NULL, NULL,
171
event->button, event->time);
175
popup_select(GtkWidget *item)
177
_popup_callback_lock = TRUE;
178
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
182
popup_select_arrow(void)
184
popup_select(_popup.arrow);
188
popup_select_rectangle(void)
190
popup_select(_popup.rectangle);
194
popup_select_circle(void)
196
popup_select(_popup.circle);
200
popup_select_polygon(void)
202
popup_select(_popup.polygon);
206
popup_check_grid(gboolean check)
208
_popup_callback_lock = TRUE;
209
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(_popup.grid), check);