mirror of https://github.com/GNOME/gimp.git
bumped version number
2005-01-02 Maurits Rijk <m.rijk@chello.nl> * plug-ins/imagemap/imap_about.c: bumped version number * plug-ins/imagemap/AUTHORS * plug-ins/imagemap/NEWS * plug-ins/imagemap/README * plug-ins/imagemap/TODO: removed since they don't contain relevant information anymore. * plug-ins/imagemap/imap_popup.[ch]: removed * plug-ins/imagemap/Makefile.am * po-plug-ins/POTFILES.in: changed accordingly * plug-ins/imagemap/imap_grid.c * plug-ins/imagemap/imap_main.[ch] * plug-ins/imagemap/imap_menu.[ch] * plug-ins/imagemap/imap_object_popup.c * plug-ins/imagemap/imap_preview.c * plug-ins/imagemap/imap_toolbar.[ch] * plug-ins/imagemap/imap_tools.[ch]: first set of changes to fix #138841 (Use action based menus in Imagemap plug-in).
This commit is contained in:
parent
9dc239a433
commit
f7fa12f7d0
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,27 @@
|
|||
2005-01-02 Maurits Rijk <m.rijk@chello.nl>
|
||||
|
||||
* plug-ins/imagemap/imap_about.c: bumped version number
|
||||
|
||||
* plug-ins/imagemap/AUTHORS
|
||||
* plug-ins/imagemap/NEWS
|
||||
* plug-ins/imagemap/README
|
||||
* plug-ins/imagemap/TODO: removed since they don't contain relevant
|
||||
information anymore.
|
||||
|
||||
* plug-ins/imagemap/imap_popup.[ch]: removed
|
||||
|
||||
* plug-ins/imagemap/Makefile.am
|
||||
* po-plug-ins/POTFILES.in: changed accordingly
|
||||
|
||||
* plug-ins/imagemap/imap_grid.c
|
||||
* plug-ins/imagemap/imap_main.[ch]
|
||||
* plug-ins/imagemap/imap_menu.[ch]
|
||||
* plug-ins/imagemap/imap_object_popup.c
|
||||
* plug-ins/imagemap/imap_preview.c
|
||||
* plug-ins/imagemap/imap_toolbar.[ch]
|
||||
* plug-ins/imagemap/imap_tools.[ch]: first set of changes to fix
|
||||
#138841 (Use action based menus in Imagemap plug-in).
|
||||
|
||||
2005-01-02 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/gui/splash.c (splash_update): fixed display of progress
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Maurits Rijk <lpeek.mrijk@consunet.nl>
|
|
@ -19,10 +19,6 @@ libexecdir = $(gimpplugindir)/plug-ins
|
|||
libexec_PROGRAMS = imagemap
|
||||
|
||||
EXTRA_DIST = \
|
||||
AUTHORS \
|
||||
NEWS \
|
||||
README \
|
||||
TODO \
|
||||
imap_cern.l \
|
||||
imap_csim.l \
|
||||
imap_ncsa.l \
|
||||
|
@ -103,8 +99,6 @@ imagemap_SOURCES = \
|
|||
imap_object_popup.h \
|
||||
imap_polygon.c \
|
||||
imap_polygon.h \
|
||||
imap_popup.c \
|
||||
imap_popup.h \
|
||||
imap_preferences.c \
|
||||
imap_preferences.h \
|
||||
imap_preview.c \
|
||||
|
|
|
@ -1,128 +0,0 @@
|
|||
What's new in GIMP Imagemap plug-in 1.3
|
||||
|
||||
* 'Follow' mode to dynamically update object dimensions.
|
||||
* Added 'Most recently used' and 'Number of Undo levels' to Preferences menu.
|
||||
* Movement of objects with cursor keys (left/right/up/down). Select next/prev
|
||||
object with TAB key.
|
||||
* Double-click in selection brings up Area dialog.
|
||||
* Drop links (e.g. from Netscape) into the selection list updates the URL.
|
||||
* Drop links (e.g. from Netscape) onto an object in the preview window updates
|
||||
the URL.
|
||||
* A few bug fixes.
|
||||
* Lot's of internationalization preparations.
|
||||
* Grid can be dynamically updated when changing grid parameters.
|
||||
|
||||
What's new in GIMP Imagemap plug-in 1.2
|
||||
|
||||
* Implemented Undo/Redo
|
||||
* User defineable image URL in settings dialog.
|
||||
* A few bug fixes.
|
||||
|
||||
What's new in GIMP Imagemap plug-in 1.1
|
||||
|
||||
* Rescale objects after rescaling of image.
|
||||
* Added 2 new HTML 4.0 tags (ONFOCUS, ONBLUR)
|
||||
* Option to make image gray to allow easier editing of images with lots of
|
||||
colors.
|
||||
* Most recently used list.
|
||||
* Rectangular selection of objects.
|
||||
* Drag and drop of links (e.g. from Netscape) to URL field.
|
||||
* Usage of shift + left mousebutton during rectangle drawing makes width and
|
||||
height equal.
|
||||
* Usage of shift + left mousebutton at start of circle drawing defines 2 points
|
||||
on circle side.
|
||||
|
||||
What's new in GIMP Imagemap plug-in 1.0
|
||||
|
||||
* Code cleanup
|
||||
* Memory leaks fixed.
|
||||
* All (?) bugs fixed.
|
||||
* Use right mousebutton to cancel drawing operation of circle, rectangle or
|
||||
polygon.
|
||||
|
||||
What's new in GIMP Imagemap plug-in 0.9
|
||||
|
||||
* Added list of standard prefixes (http://, news:, ftp://, gopher://, etc.)
|
||||
before URL in settings dialog.
|
||||
* Invalid input in dialogs (area settings, numeric values) is now handled
|
||||
correctly.
|
||||
* Add 'Apply' button to some dialogs.
|
||||
* Default author field in settings dialog with user name.
|
||||
* Show resulting source in 'View Source' dialog to allow copy/paste of
|
||||
generated code to other programs.
|
||||
|
||||
What's new in GIMP Imagemap plug-in 0.7
|
||||
|
||||
* Plug-in now works correctly for GIF and grayscale images.
|
||||
* Finished implementation of NCSA and CERN mapfiles.
|
||||
* Implemented 'Close'.
|
||||
* The usual bug fixes.
|
||||
|
||||
What's new in GIMP Imagemap plug-in 0.6
|
||||
|
||||
* Implemented 'Preferences' dialog:
|
||||
* Dropped support for GTK 1.0.6. Support for GTK 1.2 and GIMP 1.1.x or
|
||||
GIMP 1.0.4 has greatly improved.
|
||||
* Synchronized Mapping menu items and toolbar items (arrow, rectangle, circle
|
||||
and polygon)
|
||||
* Synchronized zoom icon and 'Zoom To' menu item.
|
||||
* synchronize grid icon and 'snap to grid' toggle button in 'grid settings'
|
||||
dialog.
|
||||
* Warn against overwriting of existing files.
|
||||
* Lots of serious and cosmetic bug fixes.
|
||||
|
||||
What's new in GIMP Imagemap plug-in 0.5
|
||||
|
||||
* New better looking icons (thanks Mete Cirali!)
|
||||
* Implemented 'Map Info' dialog.
|
||||
* Add/remove polygon points by clicking with right mousebutton on edges/sashes.
|
||||
* Added icon showing type (arrow, rectangle, circle) in selection.
|
||||
* Implemented pop-up menu when right-button is pressed.
|
||||
* Restrict size of preview window for large images.
|
||||
* Shapes cannot be moved outside the picture anymore.
|
||||
* Use hourglass cursor for lengthy operations (e.g. zooming, saving, loading).
|
||||
* Show resulting dimension in 'guides' dialog.
|
||||
* Added "cut/copy/paste/select all" functionality.
|
||||
* You can now select multiple objects.
|
||||
* Lots of bug fixes.
|
||||
|
||||
What's new in GIMP Imagemap plug-in 0.4
|
||||
|
||||
* Ported to Gimp 1.1.x and GTK 1.2
|
||||
* Implemented zooming
|
||||
* Removed C++ stuff. The binary immediately shrunk from 140 to 90k!
|
||||
* Objects that are currently being edited cannot be deleted anymore.
|
||||
* Show area info in statusbar when moving mouse over areas.
|
||||
* Added warning dialog for unsaved changes when quiting.
|
||||
|
||||
What's new in GIMP Imagemap plug-in 0.3
|
||||
|
||||
* You can now load a CSIM file that was saved by this plug-in. Files saved by
|
||||
other programs may cause problems. I haven't tested this yet.
|
||||
* Accelerators in menus
|
||||
* Selection operations (move up/down, delete, edit).
|
||||
* Warning/error dialog for file operations
|
||||
* Map-name in title in main dialog
|
||||
* 'target frame name' in area settings.
|
||||
* JavaScript (onMouseover, onMouseout) in area settings.
|
||||
* Doubleclick on shape pops up area settings dialog.
|
||||
* Browse button in URL field in area settings dialog.
|
||||
* Fixed size of statusbar fields.
|
||||
* Move to front/send to back
|
||||
* Write image size in HTML file
|
||||
* Deselect all if clicked in area with no object.
|
||||
* Implement statusbar dimension field
|
||||
* Added 4 extra handles to rectangular selection.
|
||||
|
||||
What's new in GIMP Imagemap plug-in 0.2
|
||||
|
||||
* Implementation of grid
|
||||
* Properties tabs for rectangles, circles and polygons.
|
||||
* Resizing of objects
|
||||
* Moving objects
|
||||
* Guide creation
|
||||
* GUI for 'Map info' dialog
|
||||
* 'Save' menu now popups 'Save As' dialog if no file is selected yet.
|
||||
* Several minor cosmetic changes
|
||||
|
||||
GIMP Imagemap plug-in 0.1 released.
|
|
@ -1,10 +0,0 @@
|
|||
This is the GIMP Imagemap plug-in version 1.3. See the INSTALL file for
|
||||
build instructions.
|
||||
|
||||
More information can be found on my homepage at
|
||||
|
||||
http://home-2.consunet.nl/~cb007736/imagemap.html
|
||||
|
||||
Have fun,
|
||||
|
||||
Maurits Rijk (lpeek.mrijk@consunet.nl)
|
|
@ -1,47 +0,0 @@
|
|||
Version 1.4
|
||||
|
||||
* Snap to grid during resize.
|
||||
* 'Divider' object.
|
||||
* Move polygon sides.
|
||||
* Gimp style guides.
|
||||
|
||||
Version 1.5
|
||||
|
||||
* Standalone version
|
||||
* Configuration script
|
||||
* Warning icon for area's without URL.
|
||||
* Add HTML 4.0 tags (TABINDEX, ACCESKEY)
|
||||
* User-definable tags
|
||||
* Use shift mousebutton to restrict polygon drawing direction.
|
||||
|
||||
Version 1.9
|
||||
|
||||
* Freehand drawing of polygon
|
||||
* 'Morph to' functions (Polygon <-> circle <-> Rectangle)
|
||||
* Write manual
|
||||
|
||||
Version 2.0
|
||||
|
||||
* Same as 1.9 with bugs fixed
|
||||
* Code cleanup
|
||||
|
||||
|
||||
|
||||
BUGS
|
||||
|
||||
* Polygon not limited to 100 points (Is this really neccessary?)
|
||||
* Rulers move when scrolling in preview window (see interface.c in Gimp).
|
||||
* 'Move' only moves current object.
|
||||
|
||||
Miscellaneous
|
||||
|
||||
* Zooming performance is poor
|
||||
* Compare image-name in HTML file with loaded image and issue warning
|
||||
if different.
|
||||
* Restrict to screen size for large images.
|
||||
* Don't redraw complete polygon while moving a sash.
|
||||
* Compliancy with GIMP 1.1.x:
|
||||
- Use GIMP's 1.1.x new help system
|
||||
- Tear-off menu's
|
||||
- Arrow button with similar action as pop-up in upper left of preview window
|
||||
- Paner widget in lower right of preview window for fast navigation.
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Generates clickable image maps.
|
||||
*
|
||||
* Copyright (C) 1998-2004 Maurits Rijk m.rijk@chello.nl
|
||||
* Copyright (C) 1998-2005 Maurits Rijk m.rijk@chello.nl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,8 +40,8 @@ do_about_dialog(void)
|
|||
default_dialog_hide_cancel_button (dialog);
|
||||
default_dialog_hide_apply_button (dialog);
|
||||
default_dialog_hide_help_button (dialog);
|
||||
default_dialog_set_label (dialog, _("Imagemap plug-in 2.2"));
|
||||
default_dialog_set_label (dialog, _("Copyright(c) 1999-2004 by Maurits Rijk"));
|
||||
default_dialog_set_label (dialog, _("Imagemap plug-in 2.3"));
|
||||
default_dialog_set_label (dialog, _("Copyright(c) 1999-2005 by Maurits Rijk"));
|
||||
default_dialog_set_label (dialog, "m.rijk@chello.nl");
|
||||
default_dialog_set_label (dialog, _("Released under the GNU General Public License"));
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "imap_grid.h"
|
||||
#include "imap_main.h"
|
||||
#include "imap_menu.h"
|
||||
#include "imap_popup.h"
|
||||
#include "imap_preview.h"
|
||||
#include "imap_table.h"
|
||||
#include "imap_toolbar.h"
|
||||
|
@ -89,8 +88,6 @@ grid_settings_ok_cb(gpointer data)
|
|||
|
||||
if (grid_snap != new_snap) {
|
||||
grid_snap = new_snap;
|
||||
main_toolbar_set_grid(grid_snap);
|
||||
popup_check_grid(grid_snap);
|
||||
menu_check_grid(grid_snap);
|
||||
}
|
||||
redraw_preview();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Generates clickable image maps.
|
||||
*
|
||||
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
|
||||
* Copyright (C) 1998-2005 Maurits Rijk m.rijk@chello.nl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -46,7 +46,6 @@
|
|||
#include "imap_misc.h"
|
||||
#include "imap_object.h"
|
||||
#include "imap_polygon.h"
|
||||
#include "imap_popup.h"
|
||||
#include "imap_preview.h"
|
||||
#include "imap_rectangle.h"
|
||||
#include "imap_selection.h"
|
||||
|
@ -284,7 +283,7 @@ zoom_in(void)
|
|||
return _zoom_factor;
|
||||
}
|
||||
|
||||
static gint
|
||||
gint
|
||||
zoom_out(void)
|
||||
{
|
||||
if (_zoom_factor > 1) {
|
||||
|
@ -299,18 +298,11 @@ set_zoom(gint zoom_factor)
|
|||
{
|
||||
set_busy_cursor();
|
||||
_zoom_factor = zoom_factor;
|
||||
toolbar_set_zoom_sensitivity(_toolbar, zoom_factor);
|
||||
preview_zoom(_preview, zoom_factor);
|
||||
statusbar_set_zoom(_statusbar, zoom_factor);
|
||||
remove_busy_cursor();
|
||||
}
|
||||
|
||||
void
|
||||
main_toolbar_set_grid(gboolean active)
|
||||
{
|
||||
toolbar_set_grid(_toolbar, active);
|
||||
}
|
||||
|
||||
gint
|
||||
get_real_coord(gint coord)
|
||||
{
|
||||
|
@ -522,21 +514,27 @@ set_object_func(gboolean (*func)(GtkWidget*, GdkEventButton*,
|
|||
}
|
||||
|
||||
void
|
||||
set_rectangle_func(void)
|
||||
set_func(GtkRadioAction *action, GtkRadioAction *current,
|
||||
gpointer user_data)
|
||||
{
|
||||
set_object_func(object_on_button_press, get_rectangle_factory);
|
||||
}
|
||||
|
||||
void
|
||||
set_circle_func(void)
|
||||
{
|
||||
set_object_func(object_on_button_press, get_circle_factory);
|
||||
}
|
||||
|
||||
void
|
||||
set_polygon_func(void)
|
||||
{
|
||||
set_object_func(object_on_button_press, get_polygon_factory);
|
||||
gint value = gtk_radio_action_get_current_value (current);
|
||||
switch (value)
|
||||
{
|
||||
case 0:
|
||||
set_arrow_func();
|
||||
break;
|
||||
case 1:
|
||||
set_object_func(object_on_button_press, get_rectangle_factory);
|
||||
break;
|
||||
case 2:
|
||||
set_object_func(object_on_button_press, get_circle_factory);
|
||||
break;
|
||||
case 3:
|
||||
set_object_func(object_on_button_press, get_polygon_factory);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -581,8 +579,6 @@ set_all_sensitivities(void)
|
|||
{
|
||||
gint count = object_list_nr_selected(_shapes);
|
||||
menu_shapes_selected(count);
|
||||
toolbar_shapes_selected(_toolbar, count);
|
||||
tools_set_sensitive(count);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -688,20 +684,11 @@ edit_shape(gint x, gint y)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
toolbar_grid(void)
|
||||
{
|
||||
gint grid = toggle_grid();
|
||||
popup_check_grid(grid);
|
||||
menu_check_grid(grid);
|
||||
}
|
||||
|
||||
static void
|
||||
menu_zoom_in(void)
|
||||
{
|
||||
gint factor = zoom_in();
|
||||
menu_set_zoom_sensitivity(factor);
|
||||
popup_set_zoom_sensitivity(factor);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -709,7 +696,6 @@ menu_zoom_out(void)
|
|||
{
|
||||
gint factor = zoom_out();
|
||||
menu_set_zoom_sensitivity(factor);
|
||||
popup_set_zoom_sensitivity(factor);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -779,7 +765,7 @@ really_close(gpointer data)
|
|||
close_current();
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
do_close(void)
|
||||
{
|
||||
check_if_changed(really_close, NULL);
|
||||
|
@ -793,7 +779,7 @@ really_quit(gpointer data)
|
|||
gtk_widget_destroy(_dlg);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
do_quit(void)
|
||||
{
|
||||
check_if_changed(really_quit, NULL);
|
||||
|
@ -819,7 +805,7 @@ do_redo(void)
|
|||
preview_thaw();
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
save(void)
|
||||
{
|
||||
if (_filename)
|
||||
|
@ -1207,49 +1193,18 @@ data_selected(Object_t *obj, gpointer data)
|
|||
set_all_sensitivities();
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_file_open_dialog(void)
|
||||
{
|
||||
return command_new(do_file_open_dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
imap_help (void)
|
||||
{
|
||||
gimp_standard_help_func ("plug-in-imagemap", NULL);
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_save(void)
|
||||
{
|
||||
return command_new(save);
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_save_as(void)
|
||||
{
|
||||
return command_new(do_file_save_as_dialog);
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_preferences_dialog(void)
|
||||
{
|
||||
return command_new(do_preferences_dialog);
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_close(void)
|
||||
{
|
||||
return command_new(do_close);
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_quit(void)
|
||||
{
|
||||
return command_new(do_quit);
|
||||
}
|
||||
|
||||
|
||||
static Command_t*
|
||||
factory_undo(void)
|
||||
{
|
||||
|
@ -1262,40 +1217,40 @@ factory_redo(void)
|
|||
return command_new(do_redo);
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_cut(void)
|
||||
void
|
||||
do_cut (void)
|
||||
{
|
||||
return cut_command_new(_shapes);
|
||||
command_execute (cut_command_new (_shapes));
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_copy(void)
|
||||
void
|
||||
do_copy (void)
|
||||
{
|
||||
return copy_command_new(_shapes);
|
||||
command_execute (copy_command_new (_shapes));
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_paste(void)
|
||||
void
|
||||
do_paste (void)
|
||||
{
|
||||
return paste_command_new(_shapes);
|
||||
command_execute (paste_command_new (_shapes));
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_select_all(void)
|
||||
void
|
||||
do_select_all(void)
|
||||
{
|
||||
return select_all_command_new(_shapes);
|
||||
command_execute (select_all_command_new (_shapes));
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_deselect_all(void)
|
||||
void
|
||||
do_deselect_all(void)
|
||||
{
|
||||
return unselect_all_command_new(_shapes, NULL);
|
||||
command_execute (unselect_all_command_new (_shapes, NULL));
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_clear(void)
|
||||
void
|
||||
do_clear(void)
|
||||
{
|
||||
return clear_command_new(_shapes);
|
||||
command_execute (clear_command_new(_shapes));
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
|
@ -1370,18 +1325,6 @@ factory_send_to_back(void)
|
|||
return send_to_back_command_new(_shapes);
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_toolbar_grid(void)
|
||||
{
|
||||
return command_new(toolbar_grid);
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_grid_settings_dialog(void)
|
||||
{
|
||||
return command_new(do_grid_settings_dialog);
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_create_guides_dialog(void)
|
||||
{
|
||||
|
@ -1394,18 +1337,6 @@ factory_use_gimp_guides_dialog(void)
|
|||
return gimp_guides_command_new(_shapes, _drawable);
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_help(void)
|
||||
{
|
||||
return command_new(imap_help);
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_about_dialog(void)
|
||||
{
|
||||
return command_new(do_about_dialog);
|
||||
}
|
||||
|
||||
static Command_t*
|
||||
factory_move_up(void)
|
||||
{
|
||||
|
@ -1428,7 +1359,6 @@ dialog(GimpDrawable *drawable)
|
|||
GtkWidget *main_vbox;
|
||||
Tools_t *tools;
|
||||
Menu_t *menu;
|
||||
PopupMenu_t *popup;
|
||||
|
||||
gimp_ui_init ("imagemap", TRUE);
|
||||
|
||||
|
@ -1460,59 +1390,9 @@ dialog(GimpDrawable *drawable)
|
|||
|
||||
/* Create menu */
|
||||
menu = make_menu(main_vbox, dlg);
|
||||
menu_set_open_command(menu, factory_file_open_dialog);
|
||||
menu_set_save_command(menu, factory_save);
|
||||
menu_set_save_as_command(menu, factory_save_as);
|
||||
menu_set_preferences_command(menu, factory_preferences_dialog);
|
||||
menu_set_close_command(menu, factory_close);
|
||||
menu_set_quit_command(menu, factory_quit);
|
||||
menu_set_undo_command(menu, factory_undo);
|
||||
menu_set_redo_command(menu, factory_redo);
|
||||
menu_set_cut_command(menu, factory_cut);
|
||||
menu_set_copy_command(menu, factory_copy);
|
||||
menu_set_paste_command(menu, factory_paste);
|
||||
menu_set_select_all_command(menu, factory_select_all);
|
||||
menu_set_deselect_all_command(menu, factory_deselect_all);
|
||||
menu_set_clear_command(menu, factory_clear);
|
||||
menu_set_edit_erea_info_command(menu, factory_edit);
|
||||
menu_set_area_list_command(menu, factory_toggle_area_list);
|
||||
menu_set_source_command(menu, factory_source_dialog);
|
||||
menu_set_color_command(menu, factory_preview_color);
|
||||
menu_set_gray_command(menu, factory_preview_gray);
|
||||
menu_set_zoom_in_command(menu, factory_menu_zoom_in);
|
||||
menu_set_zoom_out_command(menu, factory_menu_zoom_out);
|
||||
menu_set_edit_map_info_command(menu, factory_settings_dialog);
|
||||
menu_set_grid_settings_command(menu, factory_grid_settings_dialog);
|
||||
menu_set_create_guides_command(menu, factory_create_guides_dialog);
|
||||
menu_set_use_gimp_guides_command(menu, factory_use_gimp_guides_dialog);
|
||||
menu_set_help_command(menu, factory_help);
|
||||
menu_set_about_command(menu, factory_about_dialog);
|
||||
|
||||
/* Create popup */
|
||||
popup = create_main_popup_menu();
|
||||
popup_set_zoom_in_command(popup, factory_zoom_in);
|
||||
popup_set_zoom_out_command(popup, factory_zoom_out);
|
||||
popup_set_edit_map_info_command(popup, factory_settings_dialog);
|
||||
popup_set_grid_settings_command(popup, factory_grid_settings_dialog);
|
||||
popup_set_create_guides_command(popup, factory_create_guides_dialog);
|
||||
popup_set_paste_command(popup, factory_paste);
|
||||
|
||||
/* Create toolbar */
|
||||
_toolbar = make_toolbar(main_vbox, dlg);
|
||||
toolbar_set_open_command(_toolbar, factory_file_open_dialog);
|
||||
toolbar_set_save_command(_toolbar, factory_save);
|
||||
toolbar_set_preferences_command(_toolbar, factory_preferences_dialog);
|
||||
toolbar_set_undo_command(_toolbar, factory_undo);
|
||||
toolbar_set_redo_command(_toolbar, factory_redo);
|
||||
toolbar_set_cut_command(_toolbar, factory_cut);
|
||||
toolbar_set_copy_command(_toolbar, factory_copy);
|
||||
toolbar_set_paste_command(_toolbar, factory_paste);
|
||||
toolbar_set_zoom_in_command(_toolbar, factory_zoom_in);
|
||||
toolbar_set_zoom_out_command(_toolbar, factory_zoom_out);
|
||||
toolbar_set_edit_map_info_command(_toolbar, factory_settings_dialog);
|
||||
toolbar_set_move_to_front_command(_toolbar, factory_move_to_front);
|
||||
toolbar_set_send_to_back_command(_toolbar, factory_send_to_back);
|
||||
toolbar_set_grid_command(_toolbar, factory_toolbar_grid);
|
||||
|
||||
/* Dialog area */
|
||||
hbox = gtk_hbox_new(FALSE, 1);
|
||||
|
@ -1520,8 +1400,7 @@ dialog(GimpDrawable *drawable)
|
|||
gtk_widget_show(hbox);
|
||||
|
||||
tools = make_tools(dlg);
|
||||
selection_set_delete_command(tools, factory_clear);
|
||||
selection_set_edit_command(tools, factory_edit);
|
||||
// selection_set_edit_command(tools, factory_edit);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), tools->container, FALSE, FALSE, 0);
|
||||
|
||||
_preview = make_preview(drawable);
|
||||
|
@ -1542,8 +1421,6 @@ dialog(GimpDrawable *drawable)
|
|||
_selection = make_selection(_shapes);
|
||||
selection_set_move_up_command(_selection, factory_move_up);
|
||||
selection_set_move_down_command(_selection, factory_move_down);
|
||||
selection_set_delete_command(_selection, factory_clear);
|
||||
selection_set_edit_command(_selection, factory_edit);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), _selection->container, FALSE, FALSE, 0);
|
||||
|
||||
_statusbar = make_statusbar(main_vbox, dlg);
|
||||
|
|
|
@ -75,12 +75,6 @@ void draw_polygon(GdkWindow *window, GdkGC *gc, GList *list);
|
|||
|
||||
const char *get_filename(void);
|
||||
|
||||
void set_arrow_func(void);
|
||||
void set_fuzzy_select_func(void);
|
||||
void set_rectangle_func(void);
|
||||
void set_circle_func(void);
|
||||
void set_polygon_func(void);
|
||||
|
||||
ObjectList_t *get_shapes(void);
|
||||
void add_shape(Object_t *obj);
|
||||
void update_shape(Object_t *obj);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Generates clickable image maps.
|
||||
*
|
||||
* Copyright (C) 1998-2004 Maurits Rijk m.rijk@chello.nl
|
||||
* Copyright (C) 1998-2005 Maurits Rijk m.rijk@chello.nl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,6 +26,7 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include "imap_about.h"
|
||||
#include "imap_circle.h"
|
||||
#include "imap_file.h"
|
||||
#include "imap_grid.h"
|
||||
|
@ -33,7 +34,6 @@
|
|||
#include "imap_menu.h"
|
||||
#include "imap_menu_funcs.h"
|
||||
#include "imap_polygon.h"
|
||||
#include "imap_popup.h"
|
||||
#include "imap_preferences.h"
|
||||
#include "imap_rectangle.h"
|
||||
#include "imap_settings.h"
|
||||
|
@ -42,15 +42,29 @@
|
|||
#include "imap_tools.h"
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
#include "libgimpwidgets/gimpstock.h"
|
||||
|
||||
void save();
|
||||
void do_close();
|
||||
void do_quit();
|
||||
void do_cut();
|
||||
void do_copy();
|
||||
void do_paste();
|
||||
void do_clear();
|
||||
void do_select_all();
|
||||
void do_deselect_all();
|
||||
void do_grid_settings_dialog();
|
||||
void imap_help();
|
||||
void set_func(int func);
|
||||
|
||||
static gint _menu_callback_lock;
|
||||
static Menu_t _menu;
|
||||
GtkUIManager *ui_manager;
|
||||
|
||||
static void
|
||||
menu_select(GtkWidget *item)
|
||||
static void
|
||||
set_sensitive (const gchar *path, gboolean sensitive)
|
||||
{
|
||||
_menu_callback_lock = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
|
||||
GtkAction *action = gtk_ui_manager_get_action (ui_manager, path);
|
||||
g_object_set (action, "sensitive", sensitive, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -71,135 +85,25 @@ menu_mru(GtkWidget *widget, gpointer data)
|
|||
void
|
||||
menu_set_zoom_sensitivity(gint factor)
|
||||
{
|
||||
gtk_widget_set_sensitive(_menu.zoom_in, factor < 8);
|
||||
gtk_widget_set_sensitive(_menu.zoom_out, factor > 1);
|
||||
set_sensitive ("/MainMenu/ViewMenu/ZoomIn", factor < 8);
|
||||
set_sensitive ("/MainMenu/ViewMenu/ZoomOut", factor > 1);
|
||||
}
|
||||
|
||||
void
|
||||
menu_shapes_selected(gint count)
|
||||
{
|
||||
gboolean sensitive = (count > 0);
|
||||
gtk_widget_set_sensitive(_menu.cut, sensitive);
|
||||
gtk_widget_set_sensitive(_menu.copy, sensitive);
|
||||
gtk_widget_set_sensitive(_menu.clear, sensitive);
|
||||
gtk_widget_set_sensitive(_menu.edit, sensitive);
|
||||
gtk_widget_set_sensitive(_menu.deselect_all, sensitive);
|
||||
}
|
||||
|
||||
static void
|
||||
menu_zoom_to(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
|
||||
gint factor = GPOINTER_TO_INT (data);
|
||||
|
||||
if (_menu_callback_lock) {
|
||||
_menu_callback_lock--;
|
||||
} else {
|
||||
set_zoom(factor);
|
||||
}
|
||||
menu_set_zoom_sensitivity(factor);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
menu_rectangle(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_menu_callback_lock) {
|
||||
_menu_callback_lock = FALSE;
|
||||
} else {
|
||||
set_rectangle_func();
|
||||
tools_select_rectangle();
|
||||
popup_select_rectangle();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
menu_circle(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_menu_callback_lock) {
|
||||
_menu_callback_lock = FALSE;
|
||||
} else {
|
||||
set_circle_func();
|
||||
tools_select_circle();
|
||||
popup_select_circle();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
menu_polygon(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_menu_callback_lock) {
|
||||
_menu_callback_lock = FALSE;
|
||||
} else {
|
||||
set_polygon_func();
|
||||
tools_select_polygon();
|
||||
popup_select_polygon();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
menu_arrow(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_menu_callback_lock) {
|
||||
_menu_callback_lock = FALSE;
|
||||
} else {
|
||||
set_arrow_func();
|
||||
tools_select_arrow();
|
||||
popup_select_arrow();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
menu_fuzzy_select(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_menu_callback_lock) {
|
||||
_menu_callback_lock = FALSE;
|
||||
} else {
|
||||
/*
|
||||
set_fuzzy_select_func();
|
||||
tools_select_fuzzy();
|
||||
popup_select_fuzzy();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
menu_grid(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_menu_callback_lock) {
|
||||
_menu_callback_lock = FALSE;
|
||||
} else {
|
||||
gint grid = toggle_grid();
|
||||
popup_check_grid(grid);
|
||||
main_toolbar_set_grid(grid);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
make_file_menu(GtkWidget *menu_bar)
|
||||
{
|
||||
GtkWidget *file_menu = make_menu_bar_item(menu_bar, _("_File"));
|
||||
GtkWidget *item;
|
||||
|
||||
_menu.file_menu = file_menu;
|
||||
make_item_with_image(file_menu, GTK_STOCK_OPEN, menu_command,
|
||||
&_menu.cmd_open);
|
||||
_menu.open_recent = make_sub_menu(file_menu, _("Open recent"));
|
||||
make_item_with_image(file_menu, GTK_STOCK_SAVE, menu_command,
|
||||
&_menu.cmd_save);
|
||||
item = make_item_with_image(file_menu, GTK_STOCK_SAVE_AS, menu_command,
|
||||
&_menu.cmd_save_as);
|
||||
add_accelerator(item, 'S', GDK_SHIFT_MASK|GDK_CONTROL_MASK);
|
||||
make_separator(file_menu);
|
||||
make_item_with_image(file_menu, GTK_STOCK_CLOSE, menu_command,
|
||||
&_menu.cmd_close);
|
||||
make_item_with_image(file_menu, GTK_STOCK_QUIT, menu_command,
|
||||
&_menu.cmd_quit);
|
||||
gboolean sensitive = (count > 0);
|
||||
set_sensitive ("/MainMenu/EditMenu/Cut", sensitive);
|
||||
set_sensitive ("/MainMenu/EditMenu/Copy", sensitive);
|
||||
set_sensitive ("/MainMenu/EditMenu/Clear", sensitive);
|
||||
set_sensitive ("/MainMenu/EditMenu/EditAreaInfo", sensitive);
|
||||
set_sensitive ("/MainMenu/EditMenu/DeselectAll", sensitive);
|
||||
}
|
||||
|
||||
static void
|
||||
command_list_changed(Command_t *command, gpointer data)
|
||||
{
|
||||
#ifdef _NOT_READY_YET_
|
||||
gchar *scratch;
|
||||
GtkWidget *icon;
|
||||
|
||||
|
@ -233,204 +137,278 @@ command_list_changed(Command_t *command, gpointer data)
|
|||
icon = gtk_image_new_from_stock(GTK_STOCK_REDO, GTK_ICON_SIZE_MENU);
|
||||
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(_menu.redo), icon);
|
||||
gtk_widget_show(icon);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
paste_buffer_added(Object_t *obj, gpointer data)
|
||||
{
|
||||
gtk_widget_set_sensitive((GtkWidget*) data, TRUE);
|
||||
set_sensitive("/MainMenu/EditMenu/Paste", TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
paste_buffer_removed(Object_t *obj, gpointer data)
|
||||
{
|
||||
gtk_widget_set_sensitive((GtkWidget*) data, FALSE);
|
||||
set_sensitive("/MainMenu/EditMenu/Paste", FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
make_edit_menu(GtkWidget *menu_bar)
|
||||
{
|
||||
GtkWidget *edit_menu = make_menu_bar_item(menu_bar, _("_Edit"));
|
||||
GtkWidget *item, *paste;
|
||||
/* Normal items */
|
||||
static GtkActionEntry entries[] = {
|
||||
{ "FileMenu", NULL, "_File" },
|
||||
{ "Open", GTK_STOCK_OPEN, "_Open...", NULL, "Open", do_file_open_dialog},
|
||||
{ "OpenRecentMenu", NULL, "Open Recent" },
|
||||
{ "Save", GTK_STOCK_SAVE, "_Save...", NULL, "Save", save},
|
||||
{ "SaveAs", GTK_STOCK_SAVE_AS, "Save _as...", NULL, NULL,
|
||||
do_file_save_as_dialog},
|
||||
{ "Close", GTK_STOCK_CLOSE, NULL, NULL, NULL, do_close},
|
||||
{ "Quit", GTK_STOCK_QUIT, NULL, NULL, NULL, do_quit},
|
||||
|
||||
_menu.edit_menu = edit_menu;
|
||||
command_list_changed(NULL, NULL);
|
||||
{ "EditMenu", NULL, "_Edit" },
|
||||
{ "Undo", GTK_STOCK_UNDO, NULL, NULL, "Undo", NULL},
|
||||
{ "Redo", GTK_STOCK_REDO, NULL, NULL, "Redo", NULL},
|
||||
{ "Cut", GTK_STOCK_CUT, NULL, NULL, "Cut", do_cut},
|
||||
{ "Copy", GTK_STOCK_COPY, NULL, NULL, "Copy", do_copy},
|
||||
{ "Paste", GTK_STOCK_PASTE, NULL, NULL, "Paste", do_paste},
|
||||
{ "Clear", GTK_STOCK_CLEAR, NULL, "<control>K", NULL, do_clear},
|
||||
{ "SelectAll", NULL, "Select _All", "<control>A", NULL, do_select_all},
|
||||
{ "DeselectAll", NULL, "Deselect _All", "<shift><control>A", NULL,
|
||||
do_deselect_all},
|
||||
{ "EditAreaInfo", NULL, "Edit Area Info...", NULL, NULL, NULL},
|
||||
{ "Preferences", GTK_STOCK_PREFERENCES, NULL, NULL, "Preferences", NULL},
|
||||
{ "MoveToFront", IMAP_STOCK_TO_FRONT, NULL, NULL, "Move to Front", NULL},
|
||||
{ "SendToBack", IMAP_STOCK_TO_BACK, NULL, NULL, "Send to Back", NULL},
|
||||
{ "DeleteArea", NULL, "Delete Area", NULL, NULL, NULL},
|
||||
{ "MoveUp", NULL, "Move Up", NULL, NULL, NULL},
|
||||
{ "MoveDown", NULL, "Move Down", NULL, NULL, NULL},
|
||||
|
||||
make_separator(edit_menu);
|
||||
_menu.cut = make_item_with_image(edit_menu, GTK_STOCK_CUT, menu_command,
|
||||
&_menu.cmd_cut);
|
||||
_menu.copy = make_item_with_image(edit_menu, GTK_STOCK_COPY, menu_command,
|
||||
&_menu.cmd_copy);
|
||||
paste = make_item_with_image(edit_menu, GTK_STOCK_PASTE, menu_command,
|
||||
&_menu.cmd_paste);
|
||||
gtk_widget_set_sensitive(paste, FALSE);
|
||||
_menu.clear = make_item_with_image(edit_menu, GTK_STOCK_CLEAR, menu_command,
|
||||
&_menu.cmd_clear);
|
||||
add_accelerator(_menu.clear, 'K', GDK_CONTROL_MASK);
|
||||
make_separator(edit_menu);
|
||||
item = make_item_with_label(edit_menu, _("Select _all"), menu_command,
|
||||
&_menu.cmd_select_all);
|
||||
add_accelerator(item, 'A', GDK_CONTROL_MASK);
|
||||
_menu.deselect_all = make_item_with_label(edit_menu, _("Deselect _all"),
|
||||
menu_command,
|
||||
&_menu.cmd_deselect_all);
|
||||
add_accelerator(_menu.deselect_all, 'A', GDK_SHIFT_MASK|GDK_CONTROL_MASK);
|
||||
make_separator(edit_menu);
|
||||
_menu.edit = make_item_with_label(edit_menu, _("Edit area info..."),
|
||||
menu_command, &_menu.cmd_edit_area_info);
|
||||
make_separator(edit_menu);
|
||||
make_item_with_image(edit_menu, GTK_STOCK_PREFERENCES, menu_command,
|
||||
&_menu.cmd_preferences);
|
||||
{ "ViewMenu", NULL, "_View" },
|
||||
{ "Source", NULL, "Source...", NULL, NULL, NULL},
|
||||
{ "ZoomIn", GTK_STOCK_ZOOM_IN, NULL, NULL, "Zoom in", NULL},
|
||||
{ "ZoomOut", GTK_STOCK_ZOOM_OUT, NULL, NULL, "Zoom out", NULL},
|
||||
{ "ZoomToMenu", NULL, "_Zoom To" },
|
||||
|
||||
paste_buffer_add_add_cb(paste_buffer_added, (gpointer) paste);
|
||||
paste_buffer_add_remove_cb(paste_buffer_removed, (gpointer) paste);
|
||||
{ "MappingMenu", NULL, "_Mapping" },
|
||||
{ "EditMapInfo", IMAP_STOCK_MAP_INFO, "Edit Map Info...", NULL, NULL, NULL},
|
||||
|
||||
{ "ToolsMenu", NULL, "_Tools" },
|
||||
{ "GridSettings", NULL, "Grid Settings...", NULL, NULL,
|
||||
do_grid_settings_dialog},
|
||||
{ "UseGimpGuides", NULL, "Use GIMP Guides...", NULL, NULL, NULL},
|
||||
{ "CreateGuides", NULL, "Create Guides...", NULL, NULL, NULL},
|
||||
|
||||
command_list_add_update_cb(command_list_changed, NULL);
|
||||
}
|
||||
{ "HelpMenu", NULL, "_Help" },
|
||||
{ "Contents", NULL, "_Contents", NULL, NULL, imap_help},
|
||||
{ "About", NULL, "_About ImageMap...", NULL, NULL, do_about_dialog},
|
||||
|
||||
static void
|
||||
make_view_menu(GtkWidget *menu_bar)
|
||||
{
|
||||
GtkWidget *view_menu = make_menu_bar_item(menu_bar, _("_View"));
|
||||
GtkWidget *zoom_menu, *item;
|
||||
GSList *group = NULL;
|
||||
{ "ZoomMenu", NULL, "_Zoom" },
|
||||
};
|
||||
|
||||
item = make_check_item(view_menu, _("Area list"), menu_command,
|
||||
&_menu.cmd_area_list);
|
||||
GTK_CHECK_MENU_ITEM(item)->active = TRUE;
|
||||
/* Toggle items */
|
||||
static GtkToggleActionEntry toggle_entries[] = {
|
||||
{ "AreaList", NULL, "Area List", NULL, NULL, NULL, TRUE },
|
||||
{ "Grid", GIMP_STOCK_GRID, "_Grid", NULL, "Grid", NULL, FALSE }
|
||||
};
|
||||
|
||||
make_item_with_label(view_menu, _("Source..."), menu_command,
|
||||
&_menu.cmd_source);
|
||||
make_separator(view_menu);
|
||||
static GtkRadioActionEntry color_entries[] = {
|
||||
{ "Color", NULL, "Color", NULL, NULL, 0},
|
||||
{ "Gray", NULL, "Gray", NULL, NULL, 1},
|
||||
};
|
||||
|
||||
_menu.color = make_radio_item(view_menu, NULL, _("Color"), menu_command,
|
||||
&_menu.cmd_color);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.color));
|
||||
static GtkRadioActionEntry mapping_entries[] = {
|
||||
{ "Arrow", IMAP_STOCK_ARROW, "Arrow", NULL, "Select existing area", 0},
|
||||
{ "Rectangle", IMAP_STOCK_RECTANGLE, "Rectangle", NULL,
|
||||
"Define Rectangle area", 1},
|
||||
{ "Circle", IMAP_STOCK_CIRCLE, "Circle", NULL, "Define Circle/Oval area", 2},
|
||||
{ "Polygon", IMAP_STOCK_POLYGON, "Polygon", NULL, "Define Polygon area", 3},
|
||||
};
|
||||
|
||||
_menu.gray = make_radio_item(view_menu, group, _("Grayscale"), menu_command,
|
||||
&_menu.cmd_gray);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.gray));
|
||||
static GtkRadioActionEntry zoom_entries[] = {
|
||||
{ "Zoom1:1", NULL, "1:1", NULL, NULL, 0},
|
||||
{ "Zoom1:2", NULL, "1:2", NULL, NULL, 1},
|
||||
{ "Zoom1:3", NULL, "1:3", NULL, NULL, 2},
|
||||
{ "Zoom1:4", NULL, "1:4", NULL, NULL, 3},
|
||||
{ "Zoom1:5", NULL, "1:5", NULL, NULL, 4},
|
||||
{ "Zoom1:6", NULL, "1:6", NULL, NULL, 5},
|
||||
{ "Zoom1:7", NULL, "1:7", NULL, NULL, 6},
|
||||
{ "Zoom1:8", NULL, "1:8", NULL, NULL, 7},
|
||||
};
|
||||
|
||||
if (!get_map_info()->color) { /* Gray image */
|
||||
gtk_widget_set_sensitive(_menu.color, FALSE);
|
||||
GTK_CHECK_MENU_ITEM(_menu.color)->active = FALSE;
|
||||
GTK_CHECK_MENU_ITEM(_menu.gray)->active = TRUE;
|
||||
}
|
||||
|
||||
make_separator(view_menu);
|
||||
|
||||
_menu.zoom_in = make_item_with_image(view_menu, GTK_STOCK_ZOOM_IN,
|
||||
menu_command, &_menu.cmd_zoom_in);
|
||||
_menu.zoom_out = make_item_with_image(view_menu, GTK_STOCK_ZOOM_OUT,
|
||||
menu_command, &_menu.cmd_zoom_out);
|
||||
gtk_widget_set_sensitive(_menu.zoom_out, FALSE);
|
||||
|
||||
zoom_menu = make_sub_menu(view_menu, _("Zoom to"));
|
||||
|
||||
_menu.zoom[0] = make_radio_item(zoom_menu, NULL, "1:1", menu_zoom_to,
|
||||
(gpointer) 1);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[0]));
|
||||
_menu.zoom[1] = make_radio_item(zoom_menu, group, "1:2", menu_zoom_to,
|
||||
(gpointer) 2);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[1]));
|
||||
_menu.zoom[2] = make_radio_item(zoom_menu, group, "1:3", menu_zoom_to,
|
||||
(gpointer) 3);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[2]));
|
||||
_menu.zoom[3] = make_radio_item(zoom_menu, group, "1:4", menu_zoom_to,
|
||||
(gpointer) 4);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[3]));
|
||||
_menu.zoom[4] = make_radio_item(zoom_menu, group, "1:5", menu_zoom_to,
|
||||
(gpointer) 5);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[4]));
|
||||
_menu.zoom[5] = make_radio_item(zoom_menu, group, "1:6", menu_zoom_to,
|
||||
(gpointer) 6);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[5]));
|
||||
_menu.zoom[6] = make_radio_item(zoom_menu, group, "1:7", menu_zoom_to,
|
||||
(gpointer) 7);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[6]));
|
||||
_menu.zoom[7] = make_radio_item(zoom_menu, group, "1:8", menu_zoom_to,
|
||||
(gpointer) 8);
|
||||
}
|
||||
|
||||
static void
|
||||
make_mapping_menu(GtkWidget *menu_bar)
|
||||
{
|
||||
GtkWidget *menu = make_menu_bar_item(menu_bar, _("_Mapping"));
|
||||
GSList *group;
|
||||
|
||||
_menu.arrow = make_radio_item(menu, NULL, _("Arrow"), menu_arrow, NULL);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.arrow));
|
||||
#ifdef _NOT_READY_YET_
|
||||
_menu.fuzzy_select = make_radio_item(menu, group,
|
||||
_("Select contiguous region"),
|
||||
menu_fuzzy_select, NULL);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.fuzzy_select));
|
||||
#endif
|
||||
_menu.rectangle = make_radio_item(menu, group, _("Rectangle"),
|
||||
menu_rectangle, NULL);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.rectangle));
|
||||
_menu.circle = make_radio_item(menu, group, _("Circle"), menu_circle, NULL);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.circle));
|
||||
_menu.polygon = make_radio_item(menu, group, _("Polygon"), menu_polygon,
|
||||
NULL);
|
||||
make_separator(menu);
|
||||
make_item_with_image(menu, IMAP_STOCK_MAP_INFO, menu_command,
|
||||
&_menu.cmd_edit_map_info);
|
||||
}
|
||||
|
||||
static void
|
||||
make_tools_menu(GtkWidget *menu_bar)
|
||||
{
|
||||
GtkWidget *tools_menu = make_menu_bar_item(menu_bar, _("_Tools"));
|
||||
_menu.grid = make_check_item(tools_menu, _("Grid"), menu_grid, NULL);
|
||||
make_item_with_label(tools_menu, _("Grid settings..."), menu_command,
|
||||
&_menu.cmd_grid_settings);
|
||||
make_separator(tools_menu);
|
||||
make_item_with_label(tools_menu, _("Use GIMP guides..."), menu_command,
|
||||
&_menu.cmd_use_gimp_guides);
|
||||
make_item_with_label(tools_menu, _("Create guides..."), menu_command,
|
||||
&_menu.cmd_create_guides);
|
||||
}
|
||||
|
||||
static void
|
||||
make_help_menu(GtkWidget *menu_bar)
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *help_menu = make_menu_bar_item(menu_bar, _("_Help"));
|
||||
|
||||
item = make_item_with_label(help_menu, _("_Contents"), menu_command,
|
||||
&_menu.cmd_help);
|
||||
add_accelerator(item, GDK_F1, 0);
|
||||
|
||||
make_item_with_label(help_menu, _("_About ImageMap"), menu_command,
|
||||
&_menu.cmd_about);
|
||||
}
|
||||
static const char *ui_description =
|
||||
"<ui>"
|
||||
" <menubar name='MainMenu'>"
|
||||
" <menu action='FileMenu'>"
|
||||
" <menuitem action='Open'/>"
|
||||
" <menuitem action='Save'/>"
|
||||
" <menuitem action='SaveAs'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='Close'/>"
|
||||
" <menuitem action='Quit'/>"
|
||||
" </menu>"
|
||||
" <menu action='EditMenu'>"
|
||||
" <menuitem action='Cut'/>"
|
||||
" <menuitem action='Copy'/>"
|
||||
" <menuitem action='Paste'/>"
|
||||
" <menuitem action='Clear'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='SelectAll'/>"
|
||||
" <menuitem action='DeselectAll'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='EditAreaInfo'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='Preferences'/>"
|
||||
" </menu>"
|
||||
" <menu action='ViewMenu'>"
|
||||
" <menuitem action='AreaList'/>"
|
||||
" <menuitem action='Source'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='Color'/>"
|
||||
" <menuitem action='Gray'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='ZoomIn'/>"
|
||||
" <menuitem action='ZoomOut'/>"
|
||||
" <menu action='ZoomToMenu'>"
|
||||
" <menuitem action='Zoom1:1'/>"
|
||||
" <menuitem action='Zoom1:2'/>"
|
||||
" <menuitem action='Zoom1:3'/>"
|
||||
" <menuitem action='Zoom1:4'/>"
|
||||
" <menuitem action='Zoom1:5'/>"
|
||||
" <menuitem action='Zoom1:6'/>"
|
||||
" <menuitem action='Zoom1:7'/>"
|
||||
" <menuitem action='Zoom1:8'/>"
|
||||
" </menu>"
|
||||
" </menu>"
|
||||
" <menu action='MappingMenu'>"
|
||||
" <menuitem action='Arrow'/>"
|
||||
" <menuitem action='Rectangle'/>"
|
||||
" <menuitem action='Circle'/>"
|
||||
" <menuitem action='Polygon'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='EditMapInfo'/>"
|
||||
" </menu>"
|
||||
" <menu action='ToolsMenu'>"
|
||||
" <menuitem action='Grid'/>"
|
||||
" <menuitem action='GridSettings'/>"
|
||||
" <separator/>"
|
||||
" <menuitem action='UseGimpGuides'/>"
|
||||
" <menuitem action='CreateGuides'/>"
|
||||
" </menu>"
|
||||
" <menu action='HelpMenu'>"
|
||||
" <menuitem action='Contents'/>"
|
||||
" <menuitem action='About'/>"
|
||||
" </menu>"
|
||||
" </menubar>"
|
||||
""
|
||||
" <popup name='PopupMenu'>"
|
||||
" <menuitem action='EditMapInfo'/>"
|
||||
" <menu action='ToolsMenu'>"
|
||||
" <menuitem action='Arrow'/>"
|
||||
" <menuitem action='Rectangle'/>"
|
||||
" <menuitem action='Circle'/>"
|
||||
" <menuitem action='Polygon'/>"
|
||||
" </menu>"
|
||||
" <menu action='ZoomMenu'>"
|
||||
" <menuitem action='ZoomIn'/>"
|
||||
" <menuitem action='ZoomOut'/>"
|
||||
" </menu>"
|
||||
" <menuitem action='Grid'/>"
|
||||
" <menuitem action='GridSettings'/>"
|
||||
" <menuitem action='CreateGuides'/>"
|
||||
" <menuitem action='Paste'/>"
|
||||
" </popup>"
|
||||
""
|
||||
" <popup name='ObjectPopupMenu'>"
|
||||
" <menuitem action='EditAreaInfo'/>"
|
||||
" <menuitem action='DeleteArea'/>"
|
||||
" <menuitem action='MoveUp'/>"
|
||||
" <menuitem action='MoveDown'/>"
|
||||
" <menuitem action='Cut'/>"
|
||||
" <menuitem action='Copy'/>"
|
||||
" </popup>"
|
||||
""
|
||||
" <toolbar name='Toolbar'>"
|
||||
" <toolitem action='Open'/>"
|
||||
" <toolitem action='Save'/>"
|
||||
" <separator/>"
|
||||
" <toolitem action='Preferences'/>"
|
||||
" <separator/>"
|
||||
" <toolitem action='Undo'/>"
|
||||
" <toolitem action='Redo'/>"
|
||||
" <separator/>"
|
||||
" <toolitem action='Cut'/>"
|
||||
" <toolitem action='Copy'/>"
|
||||
" <toolitem action='Paste'/>"
|
||||
" <separator/>"
|
||||
" <toolitem action='ZoomIn'/>"
|
||||
" <toolitem action='ZoomOut'/>"
|
||||
" <separator/>"
|
||||
" <toolitem action='EditMapInfo'/>"
|
||||
" <separator/>"
|
||||
" <toolitem action='Grid'/>"
|
||||
" </toolbar>"
|
||||
""
|
||||
" <toolbar name='Tools'>"
|
||||
" <toolitem action='Arrow'/>"
|
||||
" <toolitem action='Rectangle'/>"
|
||||
" <toolitem action='Circle'/>"
|
||||
" <toolitem action='Polygon'/>"
|
||||
" </toolbar>"
|
||||
"</ui>";
|
||||
|
||||
Menu_t*
|
||||
make_menu(GtkWidget *main_vbox, GtkWidget *window)
|
||||
{
|
||||
GtkWidget *menu_bar = gtk_menu_bar_new();
|
||||
GtkWidget *menubar;
|
||||
GtkActionGroup *action_group;
|
||||
GtkAccelGroup *accel_group;
|
||||
GError *error;
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(main_vbox), menu_bar, FALSE, TRUE, 0);
|
||||
gtk_widget_show(menu_bar);
|
||||
action_group = gtk_action_group_new ("MenuActions");
|
||||
gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries),
|
||||
window);
|
||||
gtk_action_group_add_toggle_actions (action_group, toggle_entries,
|
||||
G_N_ELEMENTS (toggle_entries), window);
|
||||
gtk_action_group_add_radio_actions (action_group, color_entries,
|
||||
G_N_ELEMENTS (color_entries), 0,
|
||||
NULL, window);
|
||||
gtk_action_group_add_radio_actions (action_group, zoom_entries,
|
||||
G_N_ELEMENTS (zoom_entries), 0,
|
||||
NULL, window);
|
||||
gtk_action_group_add_radio_actions (action_group, mapping_entries,
|
||||
G_N_ELEMENTS (mapping_entries), 0,
|
||||
G_CALLBACK (set_func), window);
|
||||
|
||||
init_accel_group(window);
|
||||
ui_manager = gtk_ui_manager_new ();
|
||||
gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
|
||||
|
||||
accel_group = gtk_ui_manager_get_accel_group (ui_manager);
|
||||
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
|
||||
|
||||
error = NULL;
|
||||
if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1,
|
||||
&error))
|
||||
{
|
||||
g_message ("building menus failed: %s", error->message);
|
||||
g_error_free (error);
|
||||
/* exit (EXIT_FAILURE); */
|
||||
}
|
||||
|
||||
menubar = gtk_ui_manager_get_widget (ui_manager, "/MainMenu");
|
||||
gtk_widget_show (menubar);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, FALSE, 0);
|
||||
|
||||
make_file_menu(menu_bar);
|
||||
make_edit_menu(menu_bar);
|
||||
make_view_menu(menu_bar);
|
||||
make_mapping_menu(menu_bar);
|
||||
make_tools_menu(menu_bar);
|
||||
make_help_menu(menu_bar);
|
||||
paste_buffer_add_add_cb(paste_buffer_added, NULL);
|
||||
paste_buffer_add_remove_cb(paste_buffer_removed, NULL);
|
||||
|
||||
menu_shapes_selected(0);
|
||||
set_sensitive ("/MainMenu/EditMenu/Paste", FALSE);
|
||||
menu_shapes_selected (0);
|
||||
|
||||
return &_menu;
|
||||
return &_menu;
|
||||
}
|
||||
|
||||
void
|
||||
menu_build_mru_items(MRU_t *mru)
|
||||
{
|
||||
return;
|
||||
GList *p;
|
||||
gint position = 0;
|
||||
int i;
|
||||
|
@ -460,47 +438,24 @@ menu_build_mru_items(MRU_t *mru)
|
|||
}
|
||||
|
||||
void
|
||||
menu_select_arrow(void)
|
||||
do_main_popup_menu(GdkEventButton *event)
|
||||
{
|
||||
menu_select(_menu.arrow);
|
||||
GtkWidget *popup = gtk_ui_manager_get_widget (ui_manager, "/PopupMenu");
|
||||
gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL,
|
||||
event->button, event->time);
|
||||
}
|
||||
|
||||
void
|
||||
menu_select_fuzzy_select(void)
|
||||
menu_check_grid(gboolean check)
|
||||
{
|
||||
menu_select(_menu.fuzzy_select);
|
||||
}
|
||||
|
||||
void
|
||||
menu_select_rectangle(void)
|
||||
{
|
||||
menu_select(_menu.rectangle);
|
||||
}
|
||||
|
||||
void
|
||||
menu_select_circle(void)
|
||||
{
|
||||
menu_select(_menu.circle);
|
||||
}
|
||||
|
||||
void
|
||||
menu_select_polygon(void)
|
||||
{
|
||||
menu_select(_menu.polygon);
|
||||
}
|
||||
|
||||
void
|
||||
menu_check_grid(gint check)
|
||||
{
|
||||
_menu_callback_lock = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(_menu.grid), check);
|
||||
GtkAction *action = gtk_ui_manager_get_action (ui_manager,
|
||||
"/MainMenu/ToolsMenu/Grid");
|
||||
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), check);
|
||||
}
|
||||
|
||||
void
|
||||
menu_set_zoom(gint factor)
|
||||
{
|
||||
_menu_callback_lock = 2;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(_menu.zoom[factor - 1]),
|
||||
TRUE);
|
||||
menu_set_zoom_sensitivity(factor);
|
||||
menu_set_zoom_sensitivity (factor);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Generates clickable image maps.
|
||||
*
|
||||
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
|
||||
* Copyright (C) 1998-2005 Maurits Rijk m.rijk@chello.nl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -33,11 +33,6 @@ typedef struct {
|
|||
GtkWidget *open_recent;
|
||||
GtkWidget *undo;
|
||||
GtkWidget *redo;
|
||||
GtkWidget *cut;
|
||||
GtkWidget *copy;
|
||||
GtkWidget *clear;
|
||||
GtkWidget *edit;
|
||||
GtkWidget *deselect_all;
|
||||
GtkWidget *arrow;
|
||||
GtkWidget *fuzzy_select;
|
||||
GtkWidget *rectangle;
|
||||
|
@ -51,107 +46,17 @@ typedef struct {
|
|||
GtkWidget *zoom_out;
|
||||
|
||||
gint nr_off_mru_items;
|
||||
|
||||
CommandFactory_t cmd_open;
|
||||
CommandFactory_t cmd_save;
|
||||
CommandFactory_t cmd_save_as;
|
||||
CommandFactory_t cmd_preferences;
|
||||
CommandFactory_t cmd_close;
|
||||
CommandFactory_t cmd_quit;
|
||||
|
||||
CommandFactory_t cmd_undo;
|
||||
CommandFactory_t cmd_redo;
|
||||
CommandFactory_t cmd_cut;
|
||||
CommandFactory_t cmd_copy;
|
||||
CommandFactory_t cmd_paste;
|
||||
CommandFactory_t cmd_select_all;
|
||||
CommandFactory_t cmd_deselect_all;
|
||||
CommandFactory_t cmd_clear;
|
||||
CommandFactory_t cmd_edit_area_info;
|
||||
|
||||
CommandFactory_t cmd_area_list;
|
||||
CommandFactory_t cmd_source;
|
||||
CommandFactory_t cmd_color;
|
||||
CommandFactory_t cmd_gray;
|
||||
CommandFactory_t cmd_zoom_in;
|
||||
CommandFactory_t cmd_zoom_out;
|
||||
|
||||
CommandFactory_t cmd_edit_map_info;
|
||||
|
||||
CommandFactory_t cmd_grid_settings;
|
||||
CommandFactory_t cmd_create_guides;
|
||||
CommandFactory_t cmd_use_gimp_guides;
|
||||
|
||||
CommandFactory_t cmd_help;
|
||||
CommandFactory_t cmd_about;
|
||||
} Menu_t;
|
||||
|
||||
#define menu_set_open_command(menu, command) \
|
||||
((menu)->cmd_open = (command))
|
||||
#define menu_set_save_command(menu, command) \
|
||||
((menu)->cmd_save = (command))
|
||||
#define menu_set_save_as_command(menu, command) \
|
||||
((menu)->cmd_save_as = (command))
|
||||
#define menu_set_preferences_command(menu, command) \
|
||||
((menu)->cmd_preferences = (command))
|
||||
#define menu_set_close_command(menu, command) \
|
||||
((menu)->cmd_close = (command))
|
||||
#define menu_set_quit_command(menu, command) \
|
||||
((menu)->cmd_quit = (command))
|
||||
#define menu_set_undo_command(menu, command) \
|
||||
((menu)->cmd_undo = (command))
|
||||
#define menu_set_redo_command(menu, command) \
|
||||
((menu)->cmd_redo = (command))
|
||||
#define menu_set_cut_command(menu, command) \
|
||||
((menu)->cmd_cut = (command))
|
||||
#define menu_set_copy_command(menu, command) \
|
||||
((menu)->cmd_copy = (command))
|
||||
#define menu_set_paste_command(menu, command) \
|
||||
((menu)->cmd_paste = (command))
|
||||
#define menu_set_select_all_command(menu, command) \
|
||||
((menu)->cmd_select_all = (command))
|
||||
#define menu_set_deselect_all_command(menu, command) \
|
||||
((menu)->cmd_deselect_all = (command))
|
||||
#define menu_set_clear_command(menu, command) \
|
||||
((menu)->cmd_clear = (command))
|
||||
#define menu_set_edit_erea_info_command(menu, command) \
|
||||
((menu)->cmd_edit_area_info = (command))
|
||||
#define menu_set_area_list_command(menu, command) \
|
||||
((menu)->cmd_area_list = (command))
|
||||
#define menu_set_source_command(menu, command) \
|
||||
((menu)->cmd_source = (command))
|
||||
#define menu_set_color_command(menu, command) \
|
||||
((menu)->cmd_color = (command))
|
||||
#define menu_set_gray_command(menu, command) \
|
||||
((menu)->cmd_gray = (command))
|
||||
#define menu_set_zoom_in_command(menu, command) \
|
||||
((menu)->cmd_zoom_in = (command))
|
||||
#define menu_set_zoom_out_command(menu, command) \
|
||||
((menu)->cmd_zoom_out = (command))
|
||||
#define menu_set_edit_map_info_command(popup, command) \
|
||||
((menu)->cmd_edit_map_info = (command))
|
||||
#define menu_set_grid_settings_command(menu, command) \
|
||||
((menu)->cmd_grid_settings = (command))
|
||||
#define menu_set_create_guides_command(menu, command) \
|
||||
((menu)->cmd_create_guides = (command))
|
||||
#define menu_set_use_gimp_guides_command(menu, command) \
|
||||
((menu)->cmd_use_gimp_guides = (command))
|
||||
#define menu_set_help_command(menu, command) \
|
||||
((menu)->cmd_help = (command))
|
||||
#define menu_set_about_command(menu, command) \
|
||||
((menu)->cmd_about = (command))
|
||||
|
||||
Menu_t *make_menu(GtkWidget *main_vbox, GtkWidget *window);
|
||||
void menu_build_mru_items(MRU_t *mru);
|
||||
void menu_set_zoom_sensitivity(gint factor);
|
||||
|
||||
void menu_select_arrow(void);
|
||||
void menu_select_fuzzy_select(void);
|
||||
void menu_select_rectangle(void);
|
||||
void menu_select_circle(void);
|
||||
void menu_select_polygon(void);
|
||||
void menu_set_zoom(gint factor);
|
||||
void menu_check_grid(gboolean check);
|
||||
void menu_shapes_selected(gint count);
|
||||
|
||||
void do_main_popup_menu(GdkEventButton *event);
|
||||
|
||||
#endif /* _IMAP_MENU_H */
|
||||
|
|
|
@ -92,26 +92,13 @@ popup_copy(GtkWidget *widget, gpointer data)
|
|||
command_execute(command);
|
||||
}
|
||||
|
||||
extern GtkUIManager *ui_manager;
|
||||
|
||||
ObjectPopup_t*
|
||||
make_object_popup(void)
|
||||
{
|
||||
ObjectPopup_t *popup = g_new (ObjectPopup_t, 1);
|
||||
GtkWidget *menu;
|
||||
|
||||
popup->menu = menu = gtk_menu_new ();
|
||||
make_item_with_label (menu,
|
||||
_("Edit Area Info..."), popup_edit_area_info, NULL);
|
||||
make_item_with_label (menu,
|
||||
_("Delete Area"), popup_delete_area, NULL);
|
||||
popup->up = make_item_with_label (menu,
|
||||
_("Move Up"), popup_move_up, NULL);
|
||||
popup->down = make_item_with_label (menu,
|
||||
_("Move Down"), popup_move_down, NULL);
|
||||
make_item_with_label (menu,
|
||||
_("Cut"), popup_cut, NULL);
|
||||
make_item_with_label (menu,
|
||||
_("Copy"), popup_copy, NULL);
|
||||
|
||||
popup->menu = gtk_ui_manager_get_widget (ui_manager, "/ObjectPopupMenu");
|
||||
return popup;
|
||||
}
|
||||
|
||||
|
@ -128,11 +115,12 @@ object_handle_popup(ObjectPopup_t *popup, Object_t *obj, GdkEventButton *event)
|
|||
int position = object_get_position_in_list(obj) + 1;
|
||||
|
||||
_current_obj = popup->obj = obj;
|
||||
#ifdef _TEMP_
|
||||
gtk_widget_set_sensitive(popup->up, (position > 1) ? TRUE : FALSE);
|
||||
gtk_widget_set_sensitive(popup->down,
|
||||
(position < g_list_length(obj->list->list))
|
||||
? TRUE : FALSE);
|
||||
|
||||
#endif
|
||||
gtk_menu_popup(GTK_MENU(popup->menu), NULL, NULL, NULL, NULL,
|
||||
event->button, event->time);
|
||||
}
|
||||
|
|
|
@ -1,210 +0,0 @@
|
|||
/*
|
||||
* This is a plug-in for the GIMP.
|
||||
*
|
||||
* Generates clickable image maps.
|
||||
*
|
||||
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "imap_edit_area_info.h"
|
||||
#include "imap_grid.h"
|
||||
#include "imap_main.h"
|
||||
#include "imap_menu.h"
|
||||
#include "imap_menu_funcs.h"
|
||||
#include "imap_popup.h"
|
||||
#include "imap_stock.h"
|
||||
#include "imap_tools.h"
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
static gint _popup_callback_lock;
|
||||
static PopupMenu_t _popup;
|
||||
|
||||
void
|
||||
popup_set_zoom_sensitivity(gint factor)
|
||||
{
|
||||
gtk_widget_set_sensitive(_popup.zoom_in, factor < 8);
|
||||
gtk_widget_set_sensitive(_popup.zoom_out, factor > 1);
|
||||
}
|
||||
|
||||
static void
|
||||
popup_rectangle(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_popup_callback_lock) {
|
||||
_popup_callback_lock = FALSE;
|
||||
} else {
|
||||
set_rectangle_func();
|
||||
tools_select_rectangle();
|
||||
menu_select_rectangle();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
popup_circle(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_popup_callback_lock) {
|
||||
_popup_callback_lock = FALSE;
|
||||
} else {
|
||||
set_circle_func();
|
||||
tools_select_circle();
|
||||
menu_select_circle();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
popup_polygon(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_popup_callback_lock) {
|
||||
_popup_callback_lock = FALSE;
|
||||
} else {
|
||||
set_polygon_func();
|
||||
tools_select_polygon();
|
||||
menu_select_polygon();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
popup_arrow(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_popup_callback_lock) {
|
||||
_popup_callback_lock = FALSE;
|
||||
} else {
|
||||
set_arrow_func();
|
||||
tools_select_arrow();
|
||||
menu_select_arrow();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
popup_grid(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_popup_callback_lock) {
|
||||
_popup_callback_lock = FALSE;
|
||||
} else {
|
||||
gint grid = toggle_grid();
|
||||
menu_check_grid(grid);
|
||||
main_toolbar_set_grid(grid);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
paste_buffer_added(Object_t *obj, gpointer data)
|
||||
{
|
||||
gtk_widget_set_sensitive((GtkWidget*) data, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
paste_buffer_removed(Object_t *obj, gpointer data)
|
||||
{
|
||||
gtk_widget_set_sensitive((GtkWidget*) data, TRUE);
|
||||
}
|
||||
|
||||
PopupMenu_t*
|
||||
create_main_popup_menu(void)
|
||||
{
|
||||
GtkWidget *popup_menu, *sub_menu;
|
||||
GtkWidget *paste;
|
||||
GSList *group;
|
||||
|
||||
_popup.main = popup_menu = gtk_menu_new();
|
||||
|
||||
make_item_with_image(popup_menu, IMAP_STOCK_MAP_INFO, menu_command,
|
||||
&_popup.cmd_edit_map_info);
|
||||
|
||||
sub_menu = make_sub_menu(popup_menu, _("Tools"));
|
||||
_popup.arrow = make_radio_item(sub_menu, NULL, _("Arrow"), popup_arrow,
|
||||
NULL);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_popup.arrow));
|
||||
_popup.rectangle = make_radio_item(sub_menu, group, _("Rectangle"),
|
||||
popup_rectangle, NULL);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_popup.rectangle));
|
||||
_popup.circle = make_radio_item(sub_menu, group, _("Circle"),
|
||||
popup_circle, NULL);
|
||||
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_popup.circle));
|
||||
_popup.polygon = make_radio_item(sub_menu, group, _("Polygon"),
|
||||
popup_polygon, NULL);
|
||||
|
||||
sub_menu = make_sub_menu(popup_menu, _("Zoom"));
|
||||
_popup.zoom_in = make_item_with_image(sub_menu, GTK_STOCK_ZOOM_IN,
|
||||
menu_command, &_popup.cmd_zoom_in);
|
||||
_popup.zoom_out = make_item_with_image(sub_menu, GTK_STOCK_ZOOM_OUT,
|
||||
menu_command, &_popup.cmd_zoom_out);
|
||||
gtk_widget_set_sensitive(_popup.zoom_out, FALSE);
|
||||
|
||||
_popup.grid = make_check_item(popup_menu, _("Grid"), popup_grid, NULL);
|
||||
make_item_with_label(popup_menu, _("Grid Settings..."), menu_command,
|
||||
&_popup.cmd_grid_settings);
|
||||
make_item_with_label(popup_menu, _("Guides..."), menu_command,
|
||||
&_popup.cmd_create_guides);
|
||||
paste = make_item_with_image(popup_menu, GTK_STOCK_PASTE, menu_command,
|
||||
&_popup.cmd_paste);
|
||||
gtk_widget_set_sensitive(paste, FALSE);
|
||||
paste_buffer_add_add_cb(paste_buffer_added, (gpointer) paste);
|
||||
paste_buffer_add_remove_cb(paste_buffer_removed, (gpointer) paste);
|
||||
|
||||
return &_popup;
|
||||
}
|
||||
|
||||
void
|
||||
do_main_popup_menu(GdkEventButton *event)
|
||||
{
|
||||
gtk_menu_popup(GTK_MENU(_popup.main), NULL, NULL, NULL, NULL,
|
||||
event->button, event->time);
|
||||
}
|
||||
|
||||
static void
|
||||
popup_select(GtkWidget *item)
|
||||
{
|
||||
_popup_callback_lock = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
popup_select_arrow(void)
|
||||
{
|
||||
popup_select(_popup.arrow);
|
||||
}
|
||||
|
||||
void
|
||||
popup_select_rectangle(void)
|
||||
{
|
||||
popup_select(_popup.rectangle);
|
||||
}
|
||||
|
||||
void
|
||||
popup_select_circle(void)
|
||||
{
|
||||
popup_select(_popup.circle);
|
||||
}
|
||||
|
||||
void
|
||||
popup_select_polygon(void)
|
||||
{
|
||||
popup_select(_popup.polygon);
|
||||
}
|
||||
|
||||
void
|
||||
popup_check_grid(gboolean check)
|
||||
{
|
||||
_popup_callback_lock = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(_popup.grid), check);
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* This is a plug-in for the GIMP.
|
||||
*
|
||||
* Generates clickable image maps.
|
||||
*
|
||||
* Copyright (C) 1998-1999 Maurits Rijk lpeek.mrijk@consunet.nl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _IMAP_POPUP_H
|
||||
#define _IMAP_POPUP_H
|
||||
|
||||
#include "imap_command.h"
|
||||
|
||||
typedef struct {
|
||||
GtkWidget *main;
|
||||
|
||||
GtkWidget *arrow;
|
||||
GtkWidget *rectangle;
|
||||
GtkWidget *circle;
|
||||
GtkWidget *polygon;
|
||||
GtkWidget *grid;
|
||||
GtkWidget *zoom_in;
|
||||
GtkWidget *zoom_out;
|
||||
|
||||
CommandFactory_t cmd_zoom_in;
|
||||
CommandFactory_t cmd_zoom_out;
|
||||
CommandFactory_t cmd_edit_map_info;
|
||||
CommandFactory_t cmd_grid_settings;
|
||||
CommandFactory_t cmd_create_guides;
|
||||
CommandFactory_t cmd_paste;
|
||||
} PopupMenu_t;
|
||||
|
||||
|
||||
#define popup_set_zoom_in_command(popup, command) \
|
||||
((popup)->cmd_zoom_in = (command))
|
||||
#define popup_set_zoom_out_command(popup, command) \
|
||||
((popup)->cmd_zoom_out = (command))
|
||||
#define popup_set_edit_map_info_command(popup, command) \
|
||||
((popup)->cmd_edit_map_info = (command))
|
||||
#define popup_set_grid_settings_command(popup, command) \
|
||||
((popup)->cmd_grid_settings = (command))
|
||||
#define popup_set_create_guides_command(popup, command) \
|
||||
((popup)->cmd_create_guides = (command))
|
||||
#define popup_set_paste_command(popup, command) \
|
||||
((popup)->cmd_paste = (command))
|
||||
|
||||
PopupMenu_t *create_main_popup_menu(void);
|
||||
void do_main_popup_menu(GdkEventButton *event);
|
||||
void popup_set_zoom_sensitivity(gint factor);
|
||||
void popup_select_arrow(void);
|
||||
void popup_select_rectangle(void);
|
||||
void popup_select_circle(void);
|
||||
void popup_select_polygon(void);
|
||||
void popup_check_grid(gint check);
|
||||
|
||||
#endif /* _IMAP_POPUP_H */
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Generates clickable image maps.
|
||||
*
|
||||
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
|
||||
* Copyright (C) 1998-2005 Maurits Rijk m.rijk@chello.nl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,7 +32,7 @@
|
|||
#include "imap_commands.h"
|
||||
#include "imap_grid.h"
|
||||
#include "imap_main.h"
|
||||
#include "imap_popup.h"
|
||||
#include "imap_menu.h"
|
||||
#include "imap_preview.h"
|
||||
|
||||
#define PREVIEW_MASK (GDK_EXPOSURE_MASK | \
|
||||
|
|
|
@ -33,153 +33,27 @@
|
|||
#include "libgimp/stdplugins-intl.h"
|
||||
#include "libgimpwidgets/gimpstock.h"
|
||||
|
||||
static gboolean _command_lock;
|
||||
|
||||
static void
|
||||
toolbar_command(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_command_lock) {
|
||||
_command_lock = FALSE;
|
||||
} else {
|
||||
CommandFactory_t *factory = (CommandFactory_t*) data;
|
||||
Command_t *command = (*factory)();
|
||||
command_execute(command);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
paste_buffer_added(Object_t *obj, gpointer data)
|
||||
{
|
||||
gtk_widget_set_sensitive((GtkWidget*) data, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
paste_buffer_removed(Object_t *obj, gpointer data)
|
||||
{
|
||||
gtk_widget_set_sensitive((GtkWidget*) data, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
command_list_changed(Command_t *command, gpointer data)
|
||||
{
|
||||
ToolBar_t *toolbar = (ToolBar_t*) data;
|
||||
|
||||
/* Set undo entry */
|
||||
gtk_widget_set_sensitive(toolbar->undo, (command != NULL));
|
||||
|
||||
/* Set redo entry */
|
||||
command = command_list_get_redo_command();
|
||||
gtk_widget_set_sensitive(toolbar->redo, (command != NULL));
|
||||
}
|
||||
|
||||
void
|
||||
toolbar_shapes_selected(ToolBar_t *toolbar, gint count)
|
||||
{
|
||||
gboolean sensitive = (count > 0);
|
||||
gtk_widget_set_sensitive(toolbar->cut, sensitive);
|
||||
gtk_widget_set_sensitive(toolbar->copy, sensitive);
|
||||
gtk_widget_set_sensitive(toolbar->to_front, sensitive);
|
||||
gtk_widget_set_sensitive(toolbar->to_back, sensitive);
|
||||
}
|
||||
extern GtkUIManager *ui_manager;
|
||||
|
||||
ToolBar_t*
|
||||
make_toolbar(GtkWidget *main_vbox, GtkWidget *window)
|
||||
{
|
||||
ToolBar_t *data = g_new(ToolBar_t, 1);
|
||||
GtkWidget *handlebox, *toolbar, *paste;
|
||||
GtkWidget *handlebox, *toolbar;
|
||||
ToolBar_t *data = g_new(ToolBar_t, 1);
|
||||
|
||||
handlebox = gtk_handle_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(main_vbox), handlebox, FALSE, FALSE, 0);
|
||||
data->toolbar = toolbar = gtk_ui_manager_get_widget (ui_manager, "/Toolbar");
|
||||
|
||||
handlebox = gtk_handle_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(main_vbox), handlebox, FALSE, FALSE, 0);
|
||||
data->toolbar = toolbar = gtk_toolbar_new();
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
|
||||
gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar),
|
||||
GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(toolbar), 0);
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
|
||||
gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar),
|
||||
GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(toolbar), 0);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(handlebox), toolbar);
|
||||
gtk_container_add(GTK_CONTAINER(handlebox), toolbar);
|
||||
|
||||
make_toolbar_stock_icon(toolbar, GTK_STOCK_OPEN, "Open",
|
||||
_("Open"), toolbar_command, &data->cmd_open);
|
||||
make_toolbar_stock_icon(toolbar, GTK_STOCK_SAVE, "Save",
|
||||
_("Save"), toolbar_command, &data->cmd_save);
|
||||
toolbar_add_space(toolbar);
|
||||
make_toolbar_stock_icon(toolbar, GTK_STOCK_PREFERENCES, "Preferences",
|
||||
_("Preferences"), toolbar_command,
|
||||
&data->cmd_preferences);
|
||||
|
||||
toolbar_add_space(toolbar);
|
||||
data->undo = make_toolbar_stock_icon(toolbar, GTK_STOCK_UNDO, "Undo",
|
||||
_("Undo"), toolbar_command,
|
||||
&data->cmd_undo);
|
||||
gtk_widget_set_sensitive(data->undo, FALSE);
|
||||
data->redo = make_toolbar_stock_icon(toolbar, GTK_STOCK_REDO, "Redo",
|
||||
_("Redo"), toolbar_command,
|
||||
&data->cmd_redo);
|
||||
gtk_widget_set_sensitive(data->redo, FALSE);
|
||||
command_list_add_update_cb(command_list_changed, data);
|
||||
|
||||
toolbar_add_space(toolbar);
|
||||
data->cut = make_toolbar_stock_icon(toolbar, GTK_STOCK_CUT, "Cut",
|
||||
_("Cut"), toolbar_command, &data->cmd_cut);
|
||||
gtk_widget_set_sensitive(data->cut, FALSE);
|
||||
data->copy = make_toolbar_stock_icon(toolbar, GTK_STOCK_COPY, "Copy",
|
||||
_("Copy"), toolbar_command, &data->cmd_copy);
|
||||
gtk_widget_set_sensitive(data->copy, FALSE);
|
||||
paste = make_toolbar_stock_icon(toolbar, GTK_STOCK_PASTE, "Paste",
|
||||
_("Paste"), toolbar_command,
|
||||
&data->cmd_paste);
|
||||
gtk_widget_set_sensitive(paste, FALSE);
|
||||
paste_buffer_add_add_cb(paste_buffer_added, (gpointer) paste);
|
||||
paste_buffer_add_remove_cb(paste_buffer_removed, (gpointer) paste);
|
||||
|
||||
toolbar_add_space(toolbar);
|
||||
data->zoom_in = make_toolbar_stock_icon(toolbar, GTK_STOCK_ZOOM_IN,
|
||||
"ZoomIn", _("Zoom in"),
|
||||
toolbar_command,
|
||||
&data->cmd_zoom_in);
|
||||
data->zoom_out = make_toolbar_stock_icon(toolbar, GTK_STOCK_ZOOM_OUT,
|
||||
"ZoomOut",
|
||||
_("Zoom out"), toolbar_command,
|
||||
&data->cmd_zoom_out);
|
||||
gtk_widget_set_sensitive(data->zoom_out, FALSE);
|
||||
toolbar_add_space(toolbar);
|
||||
make_toolbar_stock_icon(toolbar, IMAP_STOCK_MAP_INFO, "EditMapInfo",
|
||||
_("Edit map info"), toolbar_command,
|
||||
&data->cmd_edit_map_info);
|
||||
toolbar_add_space(toolbar);
|
||||
data->to_front = make_toolbar_stock_icon(toolbar, IMAP_STOCK_TO_FRONT,
|
||||
"ToFront", _("Move To Front"),
|
||||
toolbar_command,
|
||||
&data->cmd_move_to_front);
|
||||
gtk_widget_set_sensitive(data->to_front, FALSE);
|
||||
data->to_back = make_toolbar_stock_icon(toolbar, IMAP_STOCK_TO_BACK,
|
||||
"ToBack",
|
||||
_("Send To Back"), toolbar_command,
|
||||
&data->cmd_send_to_back);
|
||||
gtk_widget_set_sensitive(data->to_back, FALSE);
|
||||
toolbar_add_space(toolbar);
|
||||
|
||||
data->grid = make_toolbar_toggle_icon(toolbar, GIMP_STOCK_GRID, "Grid",
|
||||
_("Grid"), toolbar_command,
|
||||
&data->cmd_grid);
|
||||
|
||||
gtk_widget_show(toolbar);
|
||||
gtk_widget_show(handlebox);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void
|
||||
toolbar_set_zoom_sensitivity(ToolBar_t *toolbar, gint factor)
|
||||
{
|
||||
gtk_widget_set_sensitive(toolbar->zoom_in, factor < 8);
|
||||
gtk_widget_set_sensitive(toolbar->zoom_out, factor > 1);
|
||||
}
|
||||
|
||||
void
|
||||
toolbar_set_grid(ToolBar_t *toolbar, gboolean active)
|
||||
{
|
||||
_command_lock = TRUE;
|
||||
gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (toolbar->grid),
|
||||
active);
|
||||
gtk_widget_show(toolbar);
|
||||
gtk_widget_show(handlebox);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
|
@ -24,68 +24,10 @@
|
|||
#ifndef _IMAP_TOOLBAR_H
|
||||
#define _IMAP_TOOLBAR_H
|
||||
|
||||
#include "imap_command.h"
|
||||
|
||||
typedef struct {
|
||||
GtkWidget *toolbar;
|
||||
GtkWidget *undo;
|
||||
GtkWidget *redo;
|
||||
GtkWidget *cut;
|
||||
GtkWidget *copy;
|
||||
GtkWidget *to_front;
|
||||
GtkWidget *to_back;
|
||||
GtkWidget *zoom_in;
|
||||
GtkWidget *zoom_out;
|
||||
GtkWidget *grid;
|
||||
|
||||
CommandFactory_t cmd_open;
|
||||
CommandFactory_t cmd_save;
|
||||
CommandFactory_t cmd_preferences;
|
||||
CommandFactory_t cmd_redo;
|
||||
CommandFactory_t cmd_undo;
|
||||
CommandFactory_t cmd_cut;
|
||||
CommandFactory_t cmd_copy;
|
||||
CommandFactory_t cmd_paste;
|
||||
CommandFactory_t cmd_zoom_in;
|
||||
CommandFactory_t cmd_zoom_out;
|
||||
CommandFactory_t cmd_edit_map_info;
|
||||
CommandFactory_t cmd_move_to_front;
|
||||
CommandFactory_t cmd_send_to_back;
|
||||
CommandFactory_t cmd_grid;
|
||||
} ToolBar_t;
|
||||
|
||||
ToolBar_t *make_toolbar(GtkWidget *main_vbox, GtkWidget *window);
|
||||
void toolbar_set_zoom_sensitivity(ToolBar_t *toolbar, gint factor);
|
||||
void toolbar_set_grid(ToolBar_t *toolbar, gboolean active);
|
||||
void toolbar_shapes_selected(ToolBar_t *toolbar, gint count);
|
||||
|
||||
#define toolbar_set_open_command(toolbar, command) \
|
||||
((toolbar)->cmd_open = (command))
|
||||
#define toolbar_set_save_command(toolbar, command) \
|
||||
((toolbar)->cmd_save = (command))
|
||||
#define toolbar_set_preferences_command(toolbar, command) \
|
||||
((toolbar)->cmd_preferences = (command))
|
||||
#define toolbar_set_redo_command(toolbar, command) \
|
||||
((toolbar)->cmd_redo = (command))
|
||||
#define toolbar_set_undo_command(toolbar, command) \
|
||||
((toolbar)->cmd_undo = (command))
|
||||
#define toolbar_set_cut_command(toolbar, command) \
|
||||
((toolbar)->cmd_cut = (command))
|
||||
#define toolbar_set_copy_command(toolbar, command) \
|
||||
((toolbar)->cmd_copy= (command))
|
||||
#define toolbar_set_paste_command(toolbar, command) \
|
||||
((toolbar)->cmd_paste = (command))
|
||||
#define toolbar_set_zoom_in_command(toolbar, command) \
|
||||
((toolbar)->cmd_zoom_in = (command))
|
||||
#define toolbar_set_zoom_out_command(toolbar, command) \
|
||||
((toolbar)->cmd_zoom_out = (command))
|
||||
#define toolbar_set_edit_map_info_command(toolbar, command) \
|
||||
((toolbar)->cmd_edit_map_info = (command))
|
||||
#define toolbar_set_move_to_front_command(toolbar, command) \
|
||||
((toolbar)->cmd_move_to_front = (command))
|
||||
#define toolbar_set_send_to_back_command(toolbar, command) \
|
||||
((toolbar)->cmd_send_to_back = (command))
|
||||
#define toolbar_set_grid_command(toolbar, command) \
|
||||
((toolbar)->cmd_grid = (command))
|
||||
|
||||
#endif /* _IMAP_TOOLBAR_H */
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Generates clickable image maps.
|
||||
*
|
||||
* Copyright (C) 1998-2004 Maurits Rijk m.rijk@chello.nl
|
||||
* Copyright (C) 1998-2005 Maurits Rijk m.rijk@chello.nl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,26 +30,13 @@
|
|||
#include "imap_main.h"
|
||||
#include "imap_menu.h"
|
||||
#include "imap_misc.h"
|
||||
#include "imap_polygon.h"
|
||||
#include "imap_popup.h"
|
||||
#include "imap_rectangle.h"
|
||||
#include "imap_stock.h"
|
||||
#include "imap_tools.h"
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
#include "libgimpwidgets/gimpstock.h"
|
||||
|
||||
static gboolean _callback_lock;
|
||||
static Tools_t _tools;
|
||||
|
||||
static void
|
||||
tools_command(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
CommandFactory_t *factory = (CommandFactory_t*) data;
|
||||
Command_t *command = (*factory)();
|
||||
command_execute(command);
|
||||
}
|
||||
|
||||
gboolean
|
||||
arrow_on_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
|
||||
{
|
||||
|
@ -64,160 +51,22 @@ arrow_on_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
arrow_clicked(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_callback_lock) {
|
||||
_callback_lock = FALSE;
|
||||
} else {
|
||||
set_arrow_func();
|
||||
menu_select_arrow();
|
||||
popup_select_arrow();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _NOT_READY_YET_
|
||||
static void
|
||||
fuzzy_select_clicked(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_callback_lock) {
|
||||
_callback_lock = FALSE;
|
||||
} else {
|
||||
set_fuzzy_select_func();
|
||||
menu_select_fuzzy_select();
|
||||
popup_select_fuzzy_select();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
rectangle_clicked(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_callback_lock) {
|
||||
_callback_lock = FALSE;
|
||||
} else {
|
||||
set_rectangle_func();
|
||||
menu_select_rectangle();
|
||||
popup_select_rectangle();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
circle_clicked(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_callback_lock) {
|
||||
_callback_lock = FALSE;
|
||||
} else {
|
||||
set_circle_func();
|
||||
menu_select_circle();
|
||||
popup_select_circle();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
polygon_clicked(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (_callback_lock) {
|
||||
_callback_lock = FALSE;
|
||||
} else {
|
||||
set_polygon_func();
|
||||
menu_select_polygon();
|
||||
popup_select_polygon();
|
||||
}
|
||||
}
|
||||
extern GtkUIManager *ui_manager;
|
||||
|
||||
Tools_t*
|
||||
make_tools(GtkWidget *window)
|
||||
{
|
||||
GtkWidget *handlebox;
|
||||
GtkWidget *toolbar;
|
||||
GtkWidget *handlebox, *toolbar;
|
||||
|
||||
toolbar = gtk_toolbar_new();
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
|
||||
_tools.container = handlebox = gtk_handle_box_new();
|
||||
gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar), GTK_ORIENTATION_VERTICAL);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(toolbar), 0);
|
||||
_tools.container = handlebox = gtk_handle_box_new();
|
||||
toolbar = gtk_ui_manager_get_widget (ui_manager, "/Tools");
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
|
||||
gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar), GTK_ORIENTATION_VERTICAL);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(toolbar), 0);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(handlebox), toolbar);
|
||||
gtk_container_add(GTK_CONTAINER(handlebox), toolbar);
|
||||
gtk_widget_show(toolbar);
|
||||
gtk_widget_show(handlebox);
|
||||
|
||||
_tools.arrow = make_toolbar_radio_icon(toolbar, IMAP_STOCK_ARROW,
|
||||
NULL, _("Select"),
|
||||
_("Select existing area"),
|
||||
arrow_clicked, NULL);
|
||||
#ifdef _NOT_READY_YET_
|
||||
_tools.fuzzy_select =
|
||||
make_toolbar_radio_icon(toolbar, GIMP_STOCK_TOOL_FUZZY_SELECT,
|
||||
_tools.arrow, _("Fuzzy Select"),
|
||||
_("Select contiguous regions"),
|
||||
fuzzy_select_clicked, NULL);
|
||||
#endif
|
||||
_tools.rectangle = make_toolbar_radio_icon(toolbar, IMAP_STOCK_RECTANGLE,
|
||||
_tools.arrow,
|
||||
_("Rectangle"),
|
||||
_("Define Rectangle area"),
|
||||
rectangle_clicked, NULL);
|
||||
_tools.circle = make_toolbar_radio_icon(toolbar, IMAP_STOCK_CIRCLE,
|
||||
_tools.rectangle, _("Circle"),
|
||||
_("Define Circle/Oval area"),
|
||||
circle_clicked, NULL);
|
||||
_tools.polygon = make_toolbar_radio_icon(toolbar, IMAP_STOCK_POLYGON,
|
||||
_tools.circle, _("Polygon"),
|
||||
_("Define Polygon area"),
|
||||
polygon_clicked, NULL);
|
||||
toolbar_add_space(toolbar);
|
||||
_tools.edit = make_toolbar_stock_icon(toolbar, GTK_STOCK_PROPERTIES,
|
||||
_("Edit"),
|
||||
_("Edit selected area info"), tools_command,
|
||||
&_tools.cmd_edit);
|
||||
toolbar_add_space(toolbar);
|
||||
_tools.delete = make_toolbar_stock_icon(toolbar, GTK_STOCK_DELETE,
|
||||
_("Delete"),
|
||||
_("Delete selected area"), tools_command,
|
||||
&_tools.cmd_delete);
|
||||
gtk_widget_show(toolbar);
|
||||
gtk_widget_show(handlebox);
|
||||
|
||||
tools_set_sensitive(FALSE);
|
||||
set_arrow_func();
|
||||
|
||||
return &_tools;
|
||||
}
|
||||
|
||||
static void
|
||||
tools_select(GtkWidget *widget)
|
||||
{
|
||||
_callback_lock = TRUE;
|
||||
gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (widget), TRUE);
|
||||
gtk_widget_grab_focus(widget);
|
||||
}
|
||||
|
||||
void
|
||||
tools_select_arrow(void)
|
||||
{
|
||||
tools_select(_tools.arrow);
|
||||
}
|
||||
|
||||
void
|
||||
tools_select_rectangle(void)
|
||||
{
|
||||
tools_select(_tools.rectangle);
|
||||
}
|
||||
|
||||
void
|
||||
tools_select_circle(void)
|
||||
{
|
||||
tools_select(_tools.circle);
|
||||
}
|
||||
|
||||
void
|
||||
tools_select_polygon(void)
|
||||
{
|
||||
tools_select(_tools.polygon);
|
||||
}
|
||||
|
||||
void
|
||||
tools_set_sensitive(gboolean sensitive)
|
||||
{
|
||||
gtk_widget_set_sensitive(_tools.edit, sensitive);
|
||||
gtk_widget_set_sensitive(_tools.delete, sensitive);
|
||||
return &_tools;
|
||||
}
|
||||
|
|
|
@ -28,31 +28,11 @@
|
|||
|
||||
typedef struct {
|
||||
GtkWidget *container;
|
||||
GtkWidget *arrow;
|
||||
GtkWidget *fuzzy_select;
|
||||
GtkWidget *rectangle;
|
||||
GtkWidget *circle;
|
||||
GtkWidget *polygon;
|
||||
GtkWidget *edit;
|
||||
GtkWidget *delete;
|
||||
|
||||
CommandFactory_t cmd_delete;
|
||||
CommandFactory_t cmd_edit;
|
||||
} Tools_t;
|
||||
|
||||
Tools_t *make_tools(GtkWidget *window);
|
||||
void tools_select_arrow(void);
|
||||
void tools_select_rectangle(void);
|
||||
void tools_select_circle(void);
|
||||
void tools_select_polygon(void);
|
||||
void tools_set_sensitive(gboolean sensitive);
|
||||
|
||||
gboolean arrow_on_button_press(GtkWidget *widget, GdkEventButton *event,
|
||||
gpointer data);
|
||||
|
||||
#define tools_set_delete_command(tools, command) \
|
||||
((tools)->cmd_delete = (command))
|
||||
#define tools_set_edit_command(tools, command) \
|
||||
((tools)->cmd_edit = (command))
|
||||
|
||||
#endif /* _IMAP_TOOLS_H */
|
||||
|
|
|
@ -231,7 +231,6 @@ plug-ins/imagemap/imap_main.c
|
|||
plug-ins/imagemap/imap_menu.c
|
||||
plug-ins/imagemap/imap_object_popup.c
|
||||
plug-ins/imagemap/imap_polygon.c
|
||||
plug-ins/imagemap/imap_popup.c
|
||||
plug-ins/imagemap/imap_preferences.c
|
||||
plug-ins/imagemap/imap_rectangle.c
|
||||
plug-ins/imagemap/imap_selection.c
|
||||
|
|
Loading…
Reference in New Issue