updated the imagemap plug-in

--Sven
This commit is contained in:
Sven Neumann 1999-10-24 20:57:17 +00:00
parent 88e0cc3155
commit ecfb8a1210
76 changed files with 2078 additions and 561 deletions

View file

@ -1,3 +1,7 @@
Sun Oct 24 22:53:17 MEST 1999 Sven Neumann <sven@gimp.org>
* plug-ins/imagemap/* updated imagemap to version 1.3
Sun Oct 24 16:49:13 CEST 1999 Marc Lehmann <pcg@goof.com> Sun Oct 24 16:49:13 CEST 1999 Marc Lehmann <pcg@goof.com>
* tools/pdbgen/pdb/drawable.pdb, all calls: fixed some improperly * tools/pdbgen/pdb/drawable.pdb, all calls: fixed some improperly

View file

@ -1,20 +1,55 @@
Sat Aug 28 16:32:03 1999 Maurits Rijk <maurits@frop.edu> Thu Oct 21 19:58:39 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* release version 1.3
Sat Oct 9 11:39:14 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* imap_main.c (dialog): removed some obsolete funcs.
Sun Oct 3 20:25:32 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* imap_grid.c: prepare for i8n
* imap_polygon.c (polygon_free_list): added
(polygon_assign): free list before adding new points
Sun Sep 26 13:44:15 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* imap_cmd_select_prev.c: created
* imap_cmd_select_prev.h: created
* imap_cmd_select_next.c: created
* imap_cmd_select_next.h: created
* imap_cmd_object_move.c: created
* imap_cmd_object_move.h: created
Wed Sep 8 19:07:19 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* imap_taglist.h: created
* imap_taglist.c: created
Sat Aug 28 16:32:03 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* release version 1.2 * release version 1.2
Sun Aug 15 16:54:43 1999 Maurits Rijk <maurits@frop.edu> Sun Aug 15 16:54:43 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* imap_cmd_select_region.h: created * imap_cmd_select_region.h: created
* imap_cmd_move_sash.c: created * imap_cmd_move_sash.c: created
Mon Aug 9 22:33:12 1999 Maurits Rijk <maurits@frop.edu> Mon Aug 9 22:33:12 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* imap_cmd_cut_object.c: created * imap_cmd_cut_object.c: created
* imap_cmd_cut_object.h: created * imap_cmd_cut_object.h: created
Sun Aug 8 12:54:44 1999 Maurits Rijk <maurits@frop.edu> Sun Aug 8 12:54:44 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* imap_cmd_cut.c: created * imap_cmd_cut.c: created
@ -26,26 +61,26 @@ Sun Aug 8 12:54:44 1999 Maurits Rijk <maurits@frop.edu>
* imap_object_popup.h: created * imap_object_popup.h: created
Sat Jul 31 12:34:00 1999 Maurits Rijk <maurits@frop.edu> Sat Jul 31 12:34:00 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* imap_toolbar.c: Added redo and undo button to toolbar. * imap_toolbar.c: Added redo and undo button to toolbar.
Wed Jul 28 22:17:09 1999 Maurits Rijk <maurits@frop.edu> Wed Jul 28 22:17:09 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* imap_object.c (object_on_button_press): fixed 'round to grid' bug * imap_object.c (object_on_button_press): fixed 'round to grid' bug
for polygons. for polygons.
Tue Jul 27 23:19:00 1999 Maurits Rijk <maurits@frop.edu> Tue Jul 27 23:19:00 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* imap_edit_area_info.c: use BrowseWidget_t for URL. * imap_edit_area_info.c: use BrowseWidget_t for URL.
Mon Jul 26 22:00:58 1999 Maurits Rijk <maurits@frop.edu> Mon Jul 26 22:00:58 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* imap_browse.c: created * imap_browse.c: created
* imap_object.c (object_list_move_selected_up): fixed move up/down bug. * imap_object.c (object_list_move_selected_up): fixed move up/down bug.
Mon Jun 28 18:05:24 1999 Maurits Rijk <maurits@frop.edu> Mon Jun 28 18:05:24 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
* imap_main.c (dialog): fixed annoying bug * imap_main.c (dialog): fixed annoying bug

View file

@ -73,12 +73,16 @@ imagemap_SOURCES = \
imap_cmd_move_down.h \ imap_cmd_move_down.h \
imap_cmd_move_sash.c \ imap_cmd_move_sash.c \
imap_cmd_move_sash.h \ imap_cmd_move_sash.h \
imap_cmd_move_selected.c \
imap_cmd_move_selected.h \
imap_cmd_move_to_front.c \ imap_cmd_move_to_front.c \
imap_cmd_move_to_front.h \ imap_cmd_move_to_front.h \
imap_cmd_move_up.c \ imap_cmd_move_up.c \
imap_cmd_move_up.h \ imap_cmd_move_up.h \
imap_cmd_object_down.c \ imap_cmd_object_down.c \
imap_cmd_object_down.h \ imap_cmd_object_down.h \
imap_cmd_object_move.c \
imap_cmd_object_move.h \
imap_cmd_object_up.c \ imap_cmd_object_up.c \
imap_cmd_object_up.h \ imap_cmd_object_up.h \
imap_cmd_paste.c \ imap_cmd_paste.c \
@ -87,6 +91,10 @@ imagemap_SOURCES = \
imap_cmd_select.h \ imap_cmd_select.h \
imap_cmd_select_all.c \ imap_cmd_select_all.c \
imap_cmd_select_all.h \ imap_cmd_select_all.h \
imap_cmd_select_next.c \
imap_cmd_select_next.h \
imap_cmd_select_prev.c \
imap_cmd_select_prev.h \
imap_cmd_select_region.c \ imap_cmd_select_region.c \
imap_cmd_select_region.h \ imap_cmd_select_region.h \
imap_cmd_send_to_back.c \ imap_cmd_send_to_back.c \
@ -147,6 +155,8 @@ imagemap_SOURCES = \
imap_string.h \ imap_string.h \
imap_table.c \ imap_table.c \
imap_table.h \ imap_table.h \
imap_taglist.c \
imap_taglist.h \
imap_toolbar.c \ imap_toolbar.c \
imap_toolbar.h \ imap_toolbar.h \
imap_tools.c \ imap_tools.c \

View file

@ -1,3 +1,17 @@
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 What's new in GIMP Imagemap plug-in 1.2
* Implemented Undo/Redo * Implemented Undo/Redo

View file

@ -1,4 +1,4 @@
This is the GIMP Imagemap plug-in version 1.2. See the INSTALL file for This is the GIMP Imagemap plug-in version 1.3. See the INSTALL file for
build instructions. build instructions.
More information can be found on my homepage at More information can be found on my homepage at

View file

@ -1,14 +1,6 @@
Version 1.3
* 'Follow' mode to dynamically update object dimensions.
* Configuration script
* Handle double-click in selection
* Movement/resizing of objects with cursor keys.
* implement dynamically adjustable grid.
* Snap to grid during resize.
Version 1.4 Version 1.4
* Snap to grid during resize.
* 'Divider' object. * 'Divider' object.
* Move polygon sides. * Move polygon sides.
* Gimp style guides. * Gimp style guides.
@ -16,6 +8,7 @@ Version 1.4
Version 1.5 Version 1.5
* Standalone version * Standalone version
* Configuration script
* Warning icon for area's without URL. * Warning icon for area's without URL.
* Add HTML 4.0 tags (TABINDEX, ACCESKEY) * Add HTML 4.0 tags (TABINDEX, ACCESKEY)
* User-definable tags * User-definable tags
@ -46,5 +39,9 @@ Miscellaneous
* Compare image-name in HTML file with loaded image and issue warning * Compare image-name in HTML file with loaded image and issue warning
if different. if different.
* Restrict to screen size for large images. * Restrict to screen size for large images.
* Internationalization * Don't redraw complete polygon while moving a sash.
* Drag & drop within selection * 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.

View file

@ -23,21 +23,22 @@
#include "imap_about.h" #include "imap_about.h"
#include "imap_default_dialog.h" #include "imap_default_dialog.h"
#include "libgimp/stdplugins-intl.h"
void void
do_about_dialog(void) do_about_dialog(void)
{ {
static DefaultDialog_t *dialog; static DefaultDialog_t *dialog;
if (!dialog) { if (!dialog) {
dialog = make_default_dialog("About"); dialog = make_default_dialog(_("About"));
default_dialog_hide_cancel_button(dialog); default_dialog_hide_cancel_button(dialog);
default_dialog_hide_apply_button(dialog); default_dialog_hide_apply_button(dialog);
default_dialog_set_label( default_dialog_set_label(
dialog, dialog,
"Imagemap plug-in 1.2\n\n" _("Imagemap plug-in 1.3\n\n"
"Copyright(c) 1999 by Maurits Rijk\n" "Copyright(c) 1999 by Maurits Rijk\n"
"lpeek.mrijk@consunet.nl \n\n" "lpeek.mrijk@consunet.nl \n\n"
" Released under the GNU General Public License "); " Released under the GNU General Public License "));
} }
default_dialog_show(dialog); default_dialog_show(dialog);
} }

View file

@ -22,7 +22,6 @@
*/ */
#include "imap_browse.h" #include "imap_browse.h"
#include "imap_main.h"
#include "open.xpm" #include "open.xpm"
@ -88,7 +87,6 @@ browse_widget_new(const gchar *name)
GdkPixmap *icon; GdkPixmap *icon;
GdkBitmap *mask; GdkBitmap *mask;
GtkStyle *style; GtkStyle *style;
GtkWidget *top = get_top_widget();
browse->file_selection = NULL; browse->file_selection = NULL;
browse->name = name; browse->name = name;
@ -107,10 +105,11 @@ browse_widget_new(const gchar *name)
gtk_widget_show(browse->file); gtk_widget_show(browse->file);
browse->button = button = gtk_button_new(); browse->button = button = gtk_button_new();
style = gtk_widget_get_style(top); style = gtk_widget_get_style(button);
icon = gdk_pixmap_create_from_xpm_d(top->window, &mask, icon = gdk_pixmap_colormap_create_from_xpm_d(
&style->bg[GTK_STATE_NORMAL], button->window, gtk_widget_get_colormap(button), &mask,
open_xpm); &style->bg[GTK_STATE_NORMAL], open_xpm);
iconw = gtk_pixmap_new(icon, mask); iconw = gtk_pixmap_new(icon, mask);
gtk_widget_show(iconw); gtk_widget_show(iconw);
gtk_container_add(GTK_CONTAINER(button), iconw); gtk_container_add(GTK_CONTAINER(button), iconw);

View file

@ -216,7 +216,7 @@ static const short yycheck[] = { 3,
0, 15, 12, 10, 0, 14, 12, 15 0, 15, 12, 10, 0, 14, 12, 15
}; };
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/lib/bison.simple" #line 3 "bison.simple"
/* Skeleton output parser for bison, /* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@ -409,7 +409,7 @@ __yy_memcpy (char *to, char *from, int count)
#endif #endif
#endif #endif
#line 196 "/usr/lib/bison.simple" #line 196 "bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed /* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *. into yyparse. The argument should have type void *.
@ -794,7 +794,7 @@ case 22:
break;} break;}
} }
/* the action file gets copied in in place of this dollarsign */ /* the action file gets copied in in place of this dollarsign */
#line 498 "/usr/lib/bison.simple" #line 498 "bison.simple"
yyvsp -= yylen; yyvsp -= yylen;
yyssp -= yylen; yyssp -= yylen;

View file

@ -24,6 +24,7 @@
#include <math.h> #include <math.h>
#include "imap_circle.h" #include "imap_circle.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_misc.h" #include "imap_misc.h"
#include "imap_object_popup.h" #include "imap_object_popup.h"
@ -33,7 +34,7 @@
static gboolean circle_is_valid(Object_t *obj); static gboolean circle_is_valid(Object_t *obj);
static Object_t *circle_clone(Object_t *obj); static Object_t *circle_clone(Object_t *obj);
static Object_t *circle_assign(Object_t *obj, Object_t *des); static void circle_assign(Object_t *obj, Object_t *des);
static void circle_draw(Object_t* obj, GdkWindow *window, GdkGC* gc); static void circle_draw(Object_t* obj, GdkWindow *window, GdkGC* gc);
static void circle_draw_sashes(Object_t* obj, GdkWindow *window, GdkGC* gc); static void circle_draw_sashes(Object_t* obj, GdkWindow *window, GdkGC* gc);
static MoveSashFunc_t circle_near_sash(Object_t *obj, gint x, gint y); static MoveSashFunc_t circle_near_sash(Object_t *obj, gint x, gint y);
@ -42,7 +43,7 @@ static void circle_get_dimensions(Object_t *obj, gint *x, gint *y,
gint *width, gint *height); gint *width, gint *height);
static void circle_resize(Object_t *obj, gint percentage_x, gint percentage_y); static void circle_resize(Object_t *obj, gint percentage_x, gint percentage_y);
static void circle_move(Object_t *obj, gint dx, gint dy); static void circle_move(Object_t *obj, gint dx, gint dy);
static gpointer circle_create_info_tab(GtkWidget *notebook); static gpointer circle_create_info_widget(GtkWidget *frame);
static void circle_fill_info_tab(Object_t *obj, gpointer data); static void circle_fill_info_tab(Object_t *obj, gpointer data);
static void circle_set_initial_focus(Object_t *obj, gpointer data); static void circle_set_initial_focus(Object_t *obj, gpointer data);
static void circle_update(Object_t* obj, gpointer data); static void circle_update(Object_t* obj, gpointer data);
@ -55,6 +56,7 @@ static void circle_write_ncsa(Object_t* obj, gpointer param,
static char** circle_get_icon_data(void); static char** circle_get_icon_data(void);
static ObjectClass_t circle_class = { static ObjectClass_t circle_class = {
"Circle",
NULL, /* info_dialog */ NULL, /* info_dialog */
NULL, /* icon */ NULL, /* icon */
NULL, /* mask */ NULL, /* mask */
@ -71,7 +73,8 @@ static ObjectClass_t circle_class = {
circle_get_dimensions, circle_get_dimensions,
circle_resize, circle_resize,
circle_move, circle_move,
circle_create_info_tab, circle_create_info_widget,
circle_fill_info_tab, /* circle_update_info_widget */
circle_fill_info_tab, circle_fill_info_tab,
circle_set_initial_focus, circle_set_initial_focus,
circle_update, circle_update,
@ -110,7 +113,7 @@ circle_clone(Object_t *obj)
return &clone->obj; return &clone->obj;
} }
static Object_t* static void
circle_assign(Object_t *obj, Object_t *des) circle_assign(Object_t *obj, Object_t *des)
{ {
Circle_t *src_circle = ObjectToCircle(obj); Circle_t *src_circle = ObjectToCircle(obj);
@ -118,7 +121,6 @@ circle_assign(Object_t *obj, Object_t *des)
des_circle->x = src_circle->x; des_circle->x = src_circle->x;
des_circle->y = src_circle->y; des_circle->y = src_circle->y;
des_circle->r = src_circle->r; des_circle->r = src_circle->r;
return object_copy(obj, des);
} }
static void static void
@ -206,45 +208,73 @@ circle_move(Object_t *obj, gint dx, gint dy)
} }
typedef struct { typedef struct {
Object_t *obj;
GtkWidget *x; GtkWidget *x;
GtkWidget *y; GtkWidget *y;
GtkWidget *r; GtkWidget *r;
} CircleProperties_t; } CircleProperties_t;
static void
x_changed_cb(GtkWidget *widget, gpointer data)
{
Object_t *obj = ((CircleProperties_t*) data)->obj;
gint x = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
ObjectToCircle(obj)->x = x;
edit_area_info_dialog_emit_geometry_signal(obj->class->info_dialog);
}
static void
y_changed_cb(GtkWidget *widget, gpointer data)
{
Object_t *obj = ((CircleProperties_t*) data)->obj;
gint y = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
ObjectToCircle(obj)->y = y;
edit_area_info_dialog_emit_geometry_signal(obj->class->info_dialog);
}
static void
r_changed_cb(GtkWidget *widget, gpointer data)
{
Object_t *obj = ((CircleProperties_t*) data)->obj;
gint r = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
ObjectToCircle(obj)->r = r;
edit_area_info_dialog_emit_geometry_signal(obj->class->info_dialog);
}
static gpointer static gpointer
circle_create_info_tab(GtkWidget *notebook) circle_create_info_widget(GtkWidget *frame)
{ {
CircleProperties_t *props = g_new(CircleProperties_t, 1); CircleProperties_t *props = g_new(CircleProperties_t, 1);
GtkWidget *vbox, *table, *label; GtkWidget *table;
gint max_width = get_image_width(); gint max_width = get_image_width();
gint max_height = get_image_height(); gint max_height = get_image_height();
vbox = gtk_vbox_new(FALSE, 1);
gtk_widget_show(vbox);
table = gtk_table_new(3, 3, FALSE); table = gtk_table_new(3, 3, FALSE);
gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), table);
gtk_container_set_border_width(GTK_CONTAINER(table), 10); gtk_container_set_border_width(GTK_CONTAINER(table), 10);
gtk_table_set_row_spacings(GTK_TABLE(table), 10); gtk_table_set_row_spacings(GTK_TABLE(table), 10);
gtk_table_set_col_spacings(GTK_TABLE(table), 10); gtk_table_set_col_spacings(GTK_TABLE(table), 10);
gtk_widget_show(table); gtk_widget_show(table);
create_label_in_table(table, 0, 0, "Center x:"); create_label_in_table(table, 0, 0, _("Center x:"));
props->x = create_spin_button_in_table(table, 0, 1, 1, 0, max_width - 1); props->x = create_spin_button_in_table(table, 0, 1, 1, 0, max_width - 1);
create_label_in_table(table, 0, 2, "pixels"); gtk_signal_connect(GTK_OBJECT(props->x), "changed",
(GtkSignalFunc) x_changed_cb, (gpointer) props);
create_label_in_table(table, 0, 2, _("pixels"));
create_label_in_table(table, 1, 0, "Center y:"); create_label_in_table(table, 1, 0, _("Center y:"));
props->y = create_spin_button_in_table(table, 1, 1, 1, 0, max_height - 1); props->y = create_spin_button_in_table(table, 1, 1, 1, 0, max_height - 1);
create_label_in_table(table, 1, 2, "pixels"); gtk_signal_connect(GTK_OBJECT(props->y), "changed",
(GtkSignalFunc) y_changed_cb, (gpointer) props);
create_label_in_table(table, 1, 2, _("pixels"));
create_label_in_table(table, 2, 0, "Radius:"); create_label_in_table(table, 2, 0, _("Radius:"));
props->r = create_spin_button_in_table(table, 2, 1, 1, 1, G_MAXINT); props->r = create_spin_button_in_table(table, 2, 1, 1, 1, G_MAXINT);
create_label_in_table(table, 2, 2, "pixels"); gtk_signal_connect(GTK_OBJECT(props->r), "changed",
(GtkSignalFunc) r_changed_cb, (gpointer) props);
create_label_in_table(table, 2, 2, _("pixels"));
label = gtk_label_new("Circle");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label);
return props; return props;
} }
@ -254,6 +284,7 @@ circle_fill_info_tab(Object_t *obj, gpointer data)
Circle_t *circle = ObjectToCircle(obj); Circle_t *circle = ObjectToCircle(obj);
CircleProperties_t *props = (CircleProperties_t*) data; CircleProperties_t *props = (CircleProperties_t*) data;
props->obj = obj;
gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->x), circle->x); gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->x), circle->x);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->y), circle->y); gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->y), circle->y);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->r), circle->r); gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->r), circle->r);

View file

@ -23,9 +23,10 @@
#include "imap_cmd_clear.h" #include "imap_cmd_clear.h"
#include "imap_cmd_delete.h" #include "imap_cmd_delete.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static gboolean clear_command_execute(Command_t *parent); static CmdExecuteValue_t clear_command_execute(Command_t *parent);
static void clear_command_undo(Command_t *parent); static void clear_command_undo(Command_t *parent);
static void clear_command_redo(Command_t *parent); static void clear_command_redo(Command_t *parent);
@ -46,7 +47,7 @@ clear_command_new(ObjectList_t *list)
{ {
ClearCommand_t *command = g_new(ClearCommand_t, 1); ClearCommand_t *command = g_new(ClearCommand_t, 1);
command->list = list; command->list = list;
return command_init(&command->parent, "Clear", &clear_command_class); return command_init(&command->parent, _("Clear"), &clear_command_class);
} }
static void static void
@ -57,7 +58,7 @@ remove_one_object(Object_t *obj, gpointer data)
delete_command_new(command->list, obj)); delete_command_new(command->list, obj));
} }
static gboolean static CmdExecuteValue_t
clear_command_execute(Command_t *parent) clear_command_execute(Command_t *parent)
{ {
ClearCommand_t *command = (ClearCommand_t*) parent; ClearCommand_t *command = (ClearCommand_t*) parent;
@ -68,7 +69,7 @@ clear_command_execute(Command_t *parent)
object_list_remove_remove_cb(command->list, id); object_list_remove_remove_cb(command->list, id);
redraw_preview(); /* Fix me! */ redraw_preview(); /* Fix me! */
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -21,10 +21,10 @@
* *
*/ */
#include <stdio.h>
#include "imap_cmd_copy.h" #include "imap_cmd_copy.h"
#include "libgimp/stdplugins-intl.h"
static gboolean copy_command_execute(Command_t *parent); static CmdExecuteValue_t copy_command_execute(Command_t *parent);
static void copy_command_undo(Command_t *parent); static void copy_command_undo(Command_t *parent);
static CommandClass_t copy_command_class = { static CommandClass_t copy_command_class = {
@ -46,17 +46,17 @@ copy_command_new(ObjectList_t *list)
CopyCommand_t *command = g_new(CopyCommand_t, 1); CopyCommand_t *command = g_new(CopyCommand_t, 1);
command->list = list; command->list = list;
command->paste_buffer = NULL; command->paste_buffer = NULL;
return command_init(&command->parent, "Copy", &copy_command_class); return command_init(&command->parent, _("Copy"), &copy_command_class);
} }
static gboolean static CmdExecuteValue_t
copy_command_execute(Command_t *parent) copy_command_execute(Command_t *parent)
{ {
CopyCommand_t *command = (CopyCommand_t*) parent; CopyCommand_t *command = (CopyCommand_t*) parent;
command->paste_buffer = object_list_copy(command->paste_buffer, command->paste_buffer = object_list_copy(command->paste_buffer,
get_paste_buffer()); get_paste_buffer());
object_list_copy_to_paste_buffer(command->list); object_list_copy_to_paste_buffer(command->list);
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -22,9 +22,10 @@
*/ */
#include "imap_cmd_copy_object.h" #include "imap_cmd_copy_object.h"
#include "libgimp/stdplugins-intl.h"
static void copy_object_command_destruct(Command_t *parent); static void copy_object_command_destruct(Command_t *parent);
static gboolean copy_object_command_execute(Command_t *parent); static CmdExecuteValue_t copy_object_command_execute(Command_t *parent);
static void copy_object_command_undo(Command_t *parent); static void copy_object_command_undo(Command_t *parent);
static CommandClass_t copy_object_command_class = { static CommandClass_t copy_object_command_class = {
@ -46,7 +47,8 @@ copy_object_command_new(Object_t *obj)
CopyObjectCommand_t *command = g_new(CopyObjectCommand_t, 1); CopyObjectCommand_t *command = g_new(CopyObjectCommand_t, 1);
command->obj = object_ref(obj); command->obj = object_ref(obj);
command->paste_buffer = NULL; command->paste_buffer = NULL;
return command_init(&command->parent, "Copy", &copy_object_command_class); return command_init(&command->parent, _("Copy"),
&copy_object_command_class);
} }
static void static void
@ -56,7 +58,7 @@ copy_object_command_destruct(Command_t *parent)
object_unref(command->obj); object_unref(command->obj);
} }
static gboolean static CmdExecuteValue_t
copy_object_command_execute(Command_t *parent) copy_object_command_execute(Command_t *parent)
{ {
CopyObjectCommand_t *command = (CopyObjectCommand_t*) parent; CopyObjectCommand_t *command = (CopyObjectCommand_t*) parent;
@ -67,7 +69,7 @@ copy_object_command_execute(Command_t *parent)
clear_paste_buffer(); clear_paste_buffer();
object_list_append(paste_buffer, object_clone(command->obj)); object_list_append(paste_buffer, object_clone(command->obj));
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -22,9 +22,10 @@
*/ */
#include "imap_cmd_create.h" #include "imap_cmd_create.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static gboolean create_command_execute(Command_t *parent); static CmdExecuteValue_t create_command_execute(Command_t *parent);
static void create_command_destruct(Command_t *parent); static void create_command_destruct(Command_t *parent);
static void create_command_undo(Command_t *parent); static void create_command_undo(Command_t *parent);
@ -48,7 +49,7 @@ create_command_new(ObjectList_t *list, Object_t *obj)
CreateCommand_t *command = g_new(CreateCommand_t, 1); CreateCommand_t *command = g_new(CreateCommand_t, 1);
command->list = list; command->list = list;
command->obj = object_ref(obj); command->obj = object_ref(obj);
return command_init(&command->parent, "Create", &create_command_class); return command_init(&command->parent, _("Create"), &create_command_class);
} }
static void static void
@ -58,14 +59,14 @@ create_command_destruct(Command_t *parent)
object_unref(command->obj); object_unref(command->obj);
} }
static gboolean static CmdExecuteValue_t
create_command_execute(Command_t *parent) create_command_execute(Command_t *parent)
{ {
CreateCommand_t *command = (CreateCommand_t*) parent; CreateCommand_t *command = (CreateCommand_t*) parent;
command->changed = object_list_get_changed(command->list); command->changed = object_list_get_changed(command->list);
object_list_append(command->list, object_ref(command->obj)); object_list_append(command->list, object_ref(command->obj));
redraw_preview(); /* fix me! */ redraw_preview(); /* fix me! */
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -23,10 +23,11 @@
#include "imap_cmd_delete.h" #include "imap_cmd_delete.h"
#include "imap_cmd_cut.h" #include "imap_cmd_cut.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static void cut_command_destruct(Command_t *parent); static void cut_command_destruct(Command_t *parent);
static gboolean cut_command_execute(Command_t *parent); static CmdExecuteValue_t cut_command_execute(Command_t *parent);
static void cut_command_undo(Command_t *parent); static void cut_command_undo(Command_t *parent);
static void cut_command_redo(Command_t *parent); static void cut_command_redo(Command_t *parent);
@ -49,7 +50,7 @@ cut_command_new(ObjectList_t *list)
CutCommand_t *command = g_new(CutCommand_t, 1); CutCommand_t *command = g_new(CutCommand_t, 1);
command->list = list; command->list = list;
command->paste_buffer = NULL; command->paste_buffer = NULL;
return command_init(&command->parent, "Cut", &cut_command_class); return command_init(&command->parent, _("Cut"), &cut_command_class);
} }
static void static void
@ -67,7 +68,7 @@ remove_one_object(Object_t *obj, gpointer data)
delete_command_new(command->list, obj)); delete_command_new(command->list, obj));
} }
static gboolean static CmdExecuteValue_t
cut_command_execute(Command_t *parent) cut_command_execute(Command_t *parent)
{ {
CutCommand_t *command = (CutCommand_t*) parent; CutCommand_t *command = (CutCommand_t*) parent;
@ -80,7 +81,7 @@ cut_command_execute(Command_t *parent)
object_list_remove_remove_cb(command->list, id); object_list_remove_remove_cb(command->list, id);
redraw_preview(); /* Fix me! */ redraw_preview(); /* Fix me! */
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -24,9 +24,10 @@
#include "imap_cmd_copy_object.h" #include "imap_cmd_copy_object.h"
#include "imap_cmd_cut_object.h" #include "imap_cmd_cut_object.h"
#include "imap_cmd_delete.h" #include "imap_cmd_delete.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static gboolean cut_object_command_execute(Command_t *parent); static CmdExecuteValue_t cut_object_command_execute(Command_t *parent);
static void cut_object_command_undo(Command_t *parent); static void cut_object_command_undo(Command_t *parent);
static void cut_object_command_redo(Command_t *parent); static void cut_object_command_redo(Command_t *parent);
@ -47,19 +48,19 @@ cut_object_command_new(Object_t *obj)
CutObjectCommand_t *command = g_new(CutObjectCommand_t, 1); CutObjectCommand_t *command = g_new(CutObjectCommand_t, 1);
Command_t *parent; Command_t *parent;
parent = command_init(&command->parent, "Cut", &cut_object_command_class); parent = command_init(&command->parent, _("Cut"),
&cut_object_command_class);
command_add_subcommand(parent, copy_object_command_new(obj)); command_add_subcommand(parent, copy_object_command_new(obj));
command_add_subcommand(parent, delete_command_new(obj->list, obj)); command_add_subcommand(parent, delete_command_new(obj->list, obj));
return parent; return parent;
} }
static gboolean static CmdExecuteValue_t
cut_object_command_execute(Command_t *parent) cut_object_command_execute(Command_t *parent)
{ {
redraw_preview(); /* fix me! */ redraw_preview(); /* fix me! */
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -22,11 +22,11 @@
*/ */
#include "imap_cmd_delete.h" #include "imap_cmd_delete.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static void delete_command_destruct(Command_t *parent); static void delete_command_destruct(Command_t *parent);
static gboolean delete_command_execute(Command_t *parent); static CmdExecuteValue_t delete_command_execute(Command_t *parent);
static void delete_command_undo(Command_t *parent); static void delete_command_undo(Command_t *parent);
static CommandClass_t delete_command_class = { static CommandClass_t delete_command_class = {
@ -50,7 +50,7 @@ delete_command_new(ObjectList_t *list, Object_t *obj)
DeleteCommand_t *command = g_new(DeleteCommand_t, 1); DeleteCommand_t *command = g_new(DeleteCommand_t, 1);
command->list = list; command->list = list;
command->obj = object_ref(obj); command->obj = object_ref(obj);
return command_init(&command->parent, "Delete", return command_init(&command->parent, _("Delete"),
&delete_command_class); &delete_command_class);
} }
@ -61,14 +61,14 @@ delete_command_destruct(Command_t *parent)
object_unref(command->obj); object_unref(command->obj);
} }
static gboolean static CmdExecuteValue_t
delete_command_execute(Command_t *parent) delete_command_execute(Command_t *parent)
{ {
DeleteCommand_t *command = (DeleteCommand_t*) parent; DeleteCommand_t *command = (DeleteCommand_t*) parent;
command->changed = object_list_get_changed(command->list); command->changed = object_list_get_changed(command->list);
command->position = object_get_position_in_list(command->obj); command->position = object_get_position_in_list(command->obj);
object_list_remove(command->list, command->obj); object_list_remove(command->list, command->obj);
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -22,10 +22,11 @@
*/ */
#include "imap_cmd_delete_point.h" #include "imap_cmd_delete_point.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_polygon.h" #include "imap_polygon.h"
static gboolean delete_point_command_execute(Command_t *parent); static CmdExecuteValue_t delete_point_command_execute(Command_t *parent);
static void delete_point_command_undo(Command_t *parent); static void delete_point_command_undo(Command_t *parent);
static CommandClass_t delete_point_command_class = { static CommandClass_t delete_point_command_class = {
@ -53,11 +54,11 @@ delete_point_command_new(Object_t *obj, GdkPoint *point)
command->copy = *point; command->copy = *point;
command->position = g_list_index(command->polygon->points, command->position = g_list_index(command->polygon->points,
(gpointer) point); (gpointer) point);
return command_init(&command->parent, "Delete Point", return command_init(&command->parent, _("Delete Point"),
&delete_point_command_class); &delete_point_command_class);
} }
static gboolean static CmdExecuteValue_t
delete_point_command_execute(Command_t *parent) delete_point_command_execute(Command_t *parent)
{ {
DeletePointCommand_t *command = (DeletePointCommand_t*) parent; DeletePointCommand_t *command = (DeletePointCommand_t*) parent;
@ -67,7 +68,7 @@ delete_point_command_execute(Command_t *parent)
g_free(p->data); g_free(p->data);
polygon->points = g_list_remove_link(polygon->points, p); polygon->points = g_list_remove_link(polygon->points, p);
redraw_preview(); /* Fix me! */ redraw_preview(); /* Fix me! */
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -22,7 +22,7 @@
*/ */
#include "imap_cmd_edit_object.h" #include "imap_cmd_edit_object.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static void edit_object_command_destruct(Command_t *parent); static void edit_object_command_destruct(Command_t *parent);
@ -47,7 +47,7 @@ edit_object_command_new(Object_t *obj)
EditObjectCommand_t *command = g_new(EditObjectCommand_t, 1); EditObjectCommand_t *command = g_new(EditObjectCommand_t, 1);
command->obj = object_ref(obj); command->obj = object_ref(obj);
command->copy = object_clone(obj); command->copy = object_clone(obj);
return command_init(&command->parent, "Edit Object", return command_init(&command->parent, _("Edit Object"),
&edit_object_command_class); &edit_object_command_class);
} }

View file

@ -26,6 +26,7 @@
#include "imap_cmd_create.h" #include "imap_cmd_create.h"
#include "imap_default_dialog.h" #include "imap_default_dialog.h"
#include "imap_cmd_guides.h" #include "imap_cmd_guides.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_rectangle.h" #include "imap_rectangle.h"
#include "imap_table.h" #include "imap_table.h"
@ -66,7 +67,7 @@ guides_ok_cb(gpointer data)
rows = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(param->no_down)); rows = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(param->no_down));
cols = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(param->no_across)); cols = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(param->no_across));
subcommand_start("Create Guides"); subcommand_start(_("Create Guides"));
y = top; y = top;
for (i = 0; i < rows; i++) { for (i = 0; i < rows; i++) {
gint x = left; gint x = left;
@ -106,7 +107,7 @@ recalc_bounds(GtkWidget *widget, gpointer data)
bound_w = (width + hspace) * cols - hspace; bound_w = (width + hspace) * cols - hspace;
bound_h = (height + vspace) * rows - vspace; bound_h = (height + vspace) * rows - vspace;
sprintf(bounds, "Resulting Guide Bounds: %d,%d to %d,%d (%d areas)", sprintf(bounds, _("Resulting Guide Bounds: %d,%d to %d,%d (%d areas)"),
left, top, left + bound_w, top + bound_h, rows * cols); left, top, left + bound_w, top + bound_h, rows * cols);
if (left + bound_w > get_image_width() || if (left + bound_w > get_image_width() ||
top + bound_h > get_image_height()) { top + bound_h > get_image_height()) {
@ -130,10 +131,10 @@ make_guides_dialog()
default_dialog_set_ok_cb(dialog, guides_ok_cb, data); default_dialog_set_ok_cb(dialog, guides_ok_cb, data);
label = gtk_label_new( label = gtk_label_new(
"Guides are pre-defined rectangles covering the image. You define\n" _("Guides are pre-defined rectangles covering the image. You define\n"
"them by their width, height, and spacing from each other. This\n" "them by their width, height, and spacing from each other. This\n"
"allows you to rapidly create the most common image map type -\n" "allows you to rapidly create the most common image map type -\n"
"image collection of \"thumbnails\", suitable for navigation bars."); "image collection of \"thumbnails\", suitable for navigation bars."));
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
gtk_container_set_border_width( gtk_container_set_border_width(
GTK_CONTAINER(GTK_DIALOG(dialog->dialog)->vbox), 10); GTK_CONTAINER(GTK_DIALOG(dialog->dialog)->vbox), 10);
@ -158,42 +159,42 @@ make_guides_dialog()
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog->dialog)->vbox), table); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog->dialog)->vbox), table);
gtk_widget_show(table); gtk_widget_show(table);
create_label_in_table(table, 0, 0, "Width"); create_label_in_table(table, 0, 0, _("Width"));
data->width = create_spin_button_in_table(table, 0, 1, 32, 1, 100); data->width = create_spin_button_in_table(table, 0, 1, 32, 1, 100);
gtk_signal_connect(GTK_OBJECT(data->width), "changed", gtk_signal_connect(GTK_OBJECT(data->width), "changed",
GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data); GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data);
create_label_in_table(table, 0, 2, "Left Start at"); create_label_in_table(table, 0, 2, _("Left Start at"));
data->left = create_spin_button_in_table(table, 0, 3, 0, 0, 100); data->left = create_spin_button_in_table(table, 0, 3, 0, 0, 100);
gtk_signal_connect(GTK_OBJECT(data->left), "changed", gtk_signal_connect(GTK_OBJECT(data->left), "changed",
GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data); GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data);
create_label_in_table(table, 1, 0, "Height"); create_label_in_table(table, 1, 0, _("Height"));
data->height = create_spin_button_in_table(table, 1, 1, 32, 1, 100); data->height = create_spin_button_in_table(table, 1, 1, 32, 1, 100);
gtk_signal_connect(GTK_OBJECT(data->height), "changed", gtk_signal_connect(GTK_OBJECT(data->height), "changed",
GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data); GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data);
create_label_in_table(table, 1, 2, "Top Start at"); create_label_in_table(table, 1, 2, _("Top Start at"));
data->top = create_spin_button_in_table(table, 1, 3, 0, 0, 100); data->top = create_spin_button_in_table(table, 1, 3, 0, 0, 100);
gtk_signal_connect(GTK_OBJECT(data->top), "changed", gtk_signal_connect(GTK_OBJECT(data->top), "changed",
GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data); GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data);
create_label_in_table(table, 2, 0, "Horz. Spacing"); create_label_in_table(table, 2, 0, _("Horz. Spacing"));
data->horz_spacing = create_spin_button_in_table(table, 2, 1, 0, 0, 100); data->horz_spacing = create_spin_button_in_table(table, 2, 1, 0, 0, 100);
gtk_signal_connect(GTK_OBJECT(data->horz_spacing), "changed", gtk_signal_connect(GTK_OBJECT(data->horz_spacing), "changed",
GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data); GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data);
create_label_in_table(table, 2, 2, "No. Across"); create_label_in_table(table, 2, 2, _("No. Across"));
data->no_across = create_spin_button_in_table(table, 2, 3, 0, 0, 100); data->no_across = create_spin_button_in_table(table, 2, 3, 0, 0, 100);
gtk_signal_connect(GTK_OBJECT(data->no_across), "changed", gtk_signal_connect(GTK_OBJECT(data->no_across), "changed",
GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data); GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data);
create_label_in_table(table, 3, 0, "Vert. Spacing"); create_label_in_table(table, 3, 0, _("Vert. Spacing"));
data->vert_spacing = create_spin_button_in_table(table, 3, 1, 0, 0, 100); data->vert_spacing = create_spin_button_in_table(table, 3, 1, 0, 0, 100);
gtk_signal_connect(GTK_OBJECT(data->vert_spacing), "changed", gtk_signal_connect(GTK_OBJECT(data->vert_spacing), "changed",
GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data); GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data);
create_label_in_table(table, 3, 2, "No. Down"); create_label_in_table(table, 3, 2, _("No. Down"));
data->no_down = create_spin_button_in_table(table, 3, 3, 0, 0, 100); data->no_down = create_spin_button_in_table(table, 3, 3, 0, 0, 100);
gtk_signal_connect(GTK_OBJECT(data->no_down), "changed", gtk_signal_connect(GTK_OBJECT(data->no_down), "changed",
GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data); GTK_SIGNAL_FUNC(recalc_bounds), (gpointer) data);
@ -218,11 +219,11 @@ init_guides_dialog(GuidesDialog_t *dialog, ObjectList_t *list)
char dimension[128]; char dimension[128];
dialog->list = list; dialog->list = list;
sprintf(dimension, "Image dimensions: %d x %d", get_image_width(), sprintf(dimension, _("Image dimensions: %d x %d"), get_image_width(),
get_image_height()); get_image_height());
gtk_label_set_text(GTK_LABEL(dialog->image_dimensions), dimension); gtk_label_set_text(GTK_LABEL(dialog->image_dimensions), dimension);
gtk_label_set_text(GTK_LABEL(dialog->guide_bounds), gtk_label_set_text(GTK_LABEL(dialog->guide_bounds),
"Resulting Guide Bounds: 0,0 to 0,0 (0 areas)"); _("Resulting Guide Bounds: 0,0 to 0,0 (0 areas)"));
gtk_widget_grab_focus(dialog->width); gtk_widget_grab_focus(dialog->width);
} }
@ -238,7 +239,7 @@ do_create_guides_dialog(ObjectList_t *list)
default_dialog_show(dialog->dialog); default_dialog_show(dialog->dialog);
} }
static gboolean guides_command_execute(Command_t *parent); static CmdExecuteValue_t guides_command_execute(Command_t *parent);
static CommandClass_t guides_command_class = { static CommandClass_t guides_command_class = {
NULL, /* guides_command_destruct */ NULL, /* guides_command_destruct */
@ -257,13 +258,13 @@ guides_command_new(ObjectList_t *list)
{ {
GuidesCommand_t *command = g_new(GuidesCommand_t, 1); GuidesCommand_t *command = g_new(GuidesCommand_t, 1);
command->list = list; command->list = list;
return command_init(&command->parent, "Guides", &guides_command_class); return command_init(&command->parent, _("Guides"), &guides_command_class);
} }
static gboolean static CmdExecuteValue_t
guides_command_execute(Command_t *parent) guides_command_execute(Command_t *parent)
{ {
GuidesCommand_t *command = (GuidesCommand_t*) parent; GuidesCommand_t *command = (GuidesCommand_t*) parent;
do_create_guides_dialog(command->list); do_create_guides_dialog(command->list);
return FALSE; return CMD_DESTRUCT;
} }

View file

@ -22,10 +22,11 @@
*/ */
#include "imap_cmd_insert_point.h" #include "imap_cmd_insert_point.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_polygon.h" #include "imap_polygon.h"
static gboolean insert_point_command_execute(Command_t *parent); static CmdExecuteValue_t insert_point_command_execute(Command_t *parent);
static void insert_point_command_undo(Command_t *parent); static void insert_point_command_undo(Command_t *parent);
static CommandClass_t insert_point_command_class = { static CommandClass_t insert_point_command_class = {
@ -53,11 +54,11 @@ insert_point_command_new(Object_t *obj, gint x, gint y, gint edge)
command->x = x; command->x = x;
command->y = y; command->y = y;
command->edge = edge; command->edge = edge;
return command_init(&command->parent, "Insert Point", return command_init(&command->parent, _("Insert Point"),
&insert_point_command_class); &insert_point_command_class);
} }
static gboolean static CmdExecuteValue_t
insert_point_command_execute(Command_t *parent) insert_point_command_execute(Command_t *parent)
{ {
InsertPointCommand_t *command = (InsertPointCommand_t*) parent; InsertPointCommand_t *command = (InsertPointCommand_t*) parent;
@ -75,7 +76,7 @@ insert_point_command_execute(Command_t *parent)
} }
redraw_preview(); redraw_preview();
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -21,35 +21,63 @@
* *
*/ */
#include "imap_cmd_copy.h" #include "imap_cmd_move.h"
#include "imap_cmd_object_move.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static void move_command_destruct(Command_t *parent); static void move_command_destruct(Command_t *parent);
static gboolean move_command_execute(Command_t *parent); static CmdExecuteValue_t move_command_execute(Command_t *parent);
static void move_command_undo(Command_t *parent);
CommandClass_t move_command_class = { CommandClass_t move_command_class = {
move_command_destruct, move_command_destruct,
move_command_execute, move_command_execute,
move_command_undo, NULL, /* move_command_undo */
NULL /* move_command_redo */ NULL /* move_command_redo */
}; };
typedef struct { typedef struct {
Command_t parent; Command_t parent;
PreferencesData_t *preferences;
Preview_t *preview;
Object_t *obj; Object_t *obj;
gint dx; gint start_x;
gint dy; gint start_y;
gint obj_start_x;
gint obj_start_y;
gint obj_x;
gint obj_y;
gint obj_width;
gint obj_height;
gint image_width;
gint image_height;
GdkCursorType cursor; /* Remember previous cursor */
gboolean moved_first_time;
} MoveCommand_t; } MoveCommand_t;
Command_t* Command_t*
move_command_new(Object_t *obj, gint dx, gint dy) move_command_new(Preview_t *preview, Object_t *obj, gint x, gint y)
{ {
MoveCommand_t *command = g_new(MoveCommand_t, 1); MoveCommand_t *command = g_new(MoveCommand_t, 1);
command->preferences = get_preferences();
command->preview = preview;
command->obj = object_ref(obj); command->obj = object_ref(obj);
command->dx = dx; command->start_x = x;
command->dy = dy; command->start_y = y;
return command_init(&command->parent, "Move", &move_command_class); object_get_dimensions(obj, &command->obj_x, &command->obj_y,
&command->obj_width, &command->obj_height);
command->obj_start_x = command->obj_x;
command->obj_start_y = command->obj_y;
command->image_width = get_image_width();
command->image_height = get_image_height();
command->moved_first_time = TRUE;
return command_init(&command->parent, _("Move"), &move_command_class);
} }
static void static void
@ -59,20 +87,79 @@ move_command_destruct(Command_t *parent)
object_unref(command->obj); object_unref(command->obj);
} }
static gboolean static void
move_command_execute(Command_t *parent) button_motion(GtkWidget *widget, GdkEventMotion *event, gpointer data)
{ {
MoveCommand_t *command = (MoveCommand_t*) parent; MoveCommand_t *command = (MoveCommand_t*) data;
object_move(command->obj, command->dx, command->dy); Object_t *obj = command->obj;
redraw_preview(); /* fix me! */ gint dx = get_real_coord((gint) event->x) - command->start_x;
return TRUE; gint dy = get_real_coord((gint) event->y) - command->start_y;
if (command->moved_first_time) {
command->moved_first_time = FALSE;
command->cursor = preview_set_cursor(command->preview, GDK_FLEUR);
gdk_gc_set_function(command->preferences->normal_gc, GDK_EQUIV);
gdk_gc_set_function(command->preferences->selected_gc, GDK_EQUIV);
hide_url();
}
if (command->obj_x + dx < 0)
dx = -command->obj_x;
if (command->obj_x + command->obj_width + dx > command->image_width)
dx = command->image_width - command->obj_width - command->obj_x;
if (command->obj_y + dy < 0)
dy = -command->obj_y;
if (command->obj_y + command->obj_height + dy > command->image_height)
dy = command->image_height - command->obj_height - command->obj_y;
if (dx || dy) {
command->start_x = get_real_coord((gint) event->x);
command->start_y = get_real_coord((gint) event->y);
command->obj_x += dx;
command->obj_y += dy;
object_draw(obj, widget->window);
object_move(obj, dx, dy);
object_draw(obj, widget->window);
}
} }
static void static void
move_command_undo(Command_t *parent) button_release(GtkWidget *widget, GdkEventButton *event, gpointer data)
{ {
MoveCommand_t *command = (MoveCommand_t*) parent; MoveCommand_t *command = (MoveCommand_t*) data;
object_move(command->obj, -command->dx, -command->dy);
redraw_preview(); /* fix me! */ gtk_signal_disconnect_by_func(GTK_OBJECT(widget),
(GtkSignalFunc) button_motion, data);
gtk_signal_disconnect_by_func(GTK_OBJECT(widget),
(GtkSignalFunc) button_release, data);
if (!command->moved_first_time) {
preview_set_cursor(command->preview, command->cursor);
gdk_gc_set_function(command->preferences->normal_gc, GDK_COPY);
gdk_gc_set_function(command->preferences->selected_gc, GDK_COPY);
show_url();
}
command->obj_x -= command->obj_start_x;
command->obj_y -= command->obj_start_y;
if (command->obj_x || command->obj_y)
command_list_add(object_move_command_new(command->obj, command->obj_x,
command->obj_y));
preview_thaw();
}
static CmdExecuteValue_t
move_command_execute(Command_t *parent)
{
MoveCommand_t *command = (MoveCommand_t*) parent;
GtkWidget *widget = command->preview->preview;
preview_freeze();
gtk_signal_connect(GTK_OBJECT(widget), "button_release_event",
(GtkSignalFunc) button_release, command);
gtk_signal_connect(GTK_OBJECT(widget), "motion_notify_event",
(GtkSignalFunc) button_motion, command);
return CMD_DESTRUCT;
} }

View file

@ -26,7 +26,8 @@
#include "imap_command.h" #include "imap_command.h"
#include "imap_object.h" #include "imap_object.h"
#include "imap_preview.h"
Command_t *move_command_new(Object_t *obj, gint x, gint y); Command_t *move_command_new(Preview_t *preview, Object_t *obj, gint x, gint y);
#endif /* _IMAP_CMD_MOVE_H */ #endif /* _IMAP_CMD_MOVE_H */

View file

@ -23,9 +23,10 @@
#include "imap_cmd_copy.h" #include "imap_cmd_copy.h"
#include "imap_cmd_object_down.h" #include "imap_cmd_object_down.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static gboolean move_down_command_execute(Command_t *parent); static CmdExecuteValue_t move_down_command_execute(Command_t *parent);
static void move_down_command_undo(Command_t *parent); static void move_down_command_undo(Command_t *parent);
static void move_down_command_redo(Command_t *parent); static void move_down_command_redo(Command_t *parent);
@ -48,7 +49,7 @@ move_down_command_new(ObjectList_t *list)
MoveDownCommand_t *command = g_new(MoveDownCommand_t, 1); MoveDownCommand_t *command = g_new(MoveDownCommand_t, 1);
command->list = list; command->list = list;
command->add = FALSE; command->add = FALSE;
return command_init(&command->parent, "Move Down", return command_init(&command->parent, _("Move Down"),
&move_down_command_class); &move_down_command_class);
} }
@ -67,7 +68,7 @@ move_down_one_object(Object_t *obj, gpointer data)
} }
} }
static gboolean static CmdExecuteValue_t
move_down_command_execute(Command_t *parent) move_down_command_execute(Command_t *parent)
{ {
MoveDownCommand_t *command = (MoveDownCommand_t*) parent; MoveDownCommand_t *command = (MoveDownCommand_t*) parent;
@ -78,7 +79,7 @@ move_down_command_execute(Command_t *parent)
object_list_remove_move_cb(command->list, id); object_list_remove_move_cb(command->list, id);
redraw_preview(); /* fix me! */ redraw_preview(); /* fix me! */
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -23,6 +23,7 @@
#include "imap_cmd_copy.h" #include "imap_cmd_copy.h"
#include "imap_cmd_edit_object.h" #include "imap_cmd_edit_object.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
COMMAND_PROTO(move_sash_command); COMMAND_PROTO(move_sash_command);
@ -60,7 +61,7 @@ move_sash_command_new(GtkWidget *widget, Object_t *obj,
command->image_height = get_image_height(); command->image_height = get_image_height();
command->sash_func = sash_func; command->sash_func = sash_func;
parent = command_init(&command->parent, "Move Sash", parent = command_init(&command->parent, _("Move Sash"),
&move_sash_command_class); &move_sash_command_class);
command_add_subcommand(parent, edit_object_command_new(obj)); command_add_subcommand(parent, edit_object_command_new(obj));
@ -105,6 +106,7 @@ sash_move(GtkWidget *widget, GdkEventMotion *event, gpointer data)
object_draw(obj, widget->window); object_draw(obj, widget->window);
command->sash_func(obj, dx, dy); command->sash_func(obj, dx, dy);
object_emit_geometry_signal(obj);
object_draw(obj, widget->window); object_draw(obj, widget->window);
} }
@ -121,23 +123,25 @@ sash_end(GtkWidget *widget, GdkEventButton *event, gpointer data)
if (obj->class->normalize) if (obj->class->normalize)
object_normalize(obj); object_normalize(obj);
gdk_gc_set_function(get_preferences()->selected_gc, GDK_COPY); gdk_gc_set_function(get_preferences()->selected_gc, GDK_COPY);
redraw_preview(); /* redraw_preview(); */
preview_thaw();
show_url(); show_url();
} }
static gboolean static CmdExecuteValue_t
move_sash_command_execute(Command_t *parent) move_sash_command_execute(Command_t *parent)
{ {
MoveSashCommand_t *command = (MoveSashCommand_t*) parent; MoveSashCommand_t *command = (MoveSashCommand_t*) parent;
hide_url(); hide_url();
preview_freeze();
gtk_signal_connect(GTK_OBJECT(command->widget), "button_release_event", gtk_signal_connect(GTK_OBJECT(command->widget), "button_release_event",
(GtkSignalFunc) sash_end, command); (GtkSignalFunc) sash_end, command);
gtk_signal_connect(GTK_OBJECT(command->widget), "motion_notify_event", gtk_signal_connect(GTK_OBJECT(command->widget), "motion_notify_event",
(GtkSignalFunc) sash_move, command); (GtkSignalFunc) sash_move, command);
gdk_gc_set_function(get_preferences()->selected_gc, GDK_EQUIV); gdk_gc_set_function(get_preferences()->selected_gc, GDK_EQUIV);
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -0,0 +1,76 @@
/*
* 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.
*
*/
#include "imap_cmd_move_selected.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h"
static CmdExecuteValue_t move_selected_command_execute(Command_t *parent);
static void move_selected_command_undo(Command_t *parent);
CommandClass_t move_selected_command_class = {
NULL, /* move_selected_command_destruct */
move_selected_command_execute,
move_selected_command_undo,
NULL /* move_selected_command_redo */
};
typedef struct {
Command_t parent;
ObjectList_t *list;
gint dx;
gint dy;
} MoveSelectedCommand_t;
Command_t*
move_selected_command_new(ObjectList_t *list, gint dx, gint dy)
{
MoveSelectedCommand_t *command = g_new(MoveSelectedCommand_t, 1);
command->list = list;
command->dx = dx;
command->dy = dy;
return command_init(&command->parent, _("Move Selected Objects"),
&move_selected_command_class);
}
static CmdExecuteValue_t
move_selected_command_execute(Command_t *parent)
{
MoveSelectedCommand_t *command = (MoveSelectedCommand_t*) parent;
object_list_move_selected(command->list, command->dx, command->dy);
#ifdef _OLD_
redraw_preview(); /* fix me! */
#endif
return CMD_APPEND;
}
static void
move_selected_command_undo(Command_t *parent)
{
MoveSelectedCommand_t *command = (MoveSelectedCommand_t*) parent;
object_list_move_selected(command->list, -command->dx, -command->dy);
#ifdef _OLD_
redraw_preview(); /* fix me! */
#endif
}

View file

@ -0,0 +1,32 @@
/*
* 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_CMD_MOVE_SELECTED_H
#define _IMAP_CMD_MOVE_SELECTED_H
#include "imap_command.h"
#include "imap_object.h"
Command_t *move_selected_command_new(ObjectList_t *list, gint dx, gint dy);
#endif /* _IMAP_CMD_MOVE_SELECTED_H */

View file

@ -26,7 +26,7 @@
#include "imap_cmd_move_to_front.h" #include "imap_cmd_move_to_front.h"
#include "imap_main.h" #include "imap_main.h"
static gboolean move_to_front_command_execute(Command_t *parent); static CmdExecuteValue_t move_to_front_command_execute(Command_t *parent);
static void move_to_front_command_undo(Command_t *parent); static void move_to_front_command_undo(Command_t *parent);
static void move_to_front_command_redo(Command_t *parent); static void move_to_front_command_redo(Command_t *parent);
@ -67,7 +67,7 @@ add_one_object(Object_t *obj, gpointer data)
create_command_new(command->list, obj)); create_command_new(command->list, obj));
} }
static gboolean static CmdExecuteValue_t
move_to_front_command_execute(Command_t *parent) move_to_front_command_execute(Command_t *parent)
{ {
MoveToFrontCommand_t *command = (MoveToFrontCommand_t*) parent; MoveToFrontCommand_t *command = (MoveToFrontCommand_t*) parent;
@ -80,7 +80,7 @@ move_to_front_command_execute(Command_t *parent)
redraw_preview(); /* Fix me! */ redraw_preview(); /* Fix me! */
object_list_remove_remove_cb(command->list, id1); object_list_remove_remove_cb(command->list, id1);
object_list_remove_add_cb(command->list, id2); object_list_remove_add_cb(command->list, id2);
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -23,9 +23,10 @@
#include "imap_cmd_move_up.h" #include "imap_cmd_move_up.h"
#include "imap_cmd_object_up.h" #include "imap_cmd_object_up.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static gboolean move_up_command_execute(Command_t *parent); static CmdExecuteValue_t move_up_command_execute(Command_t *parent);
static void move_up_command_undo(Command_t *parent); static void move_up_command_undo(Command_t *parent);
static void move_up_command_redo(Command_t *parent); static void move_up_command_redo(Command_t *parent);
@ -48,7 +49,7 @@ move_up_command_new(ObjectList_t *list)
MoveUpCommand_t *command = g_new(MoveUpCommand_t, 1); MoveUpCommand_t *command = g_new(MoveUpCommand_t, 1);
command->list = list; command->list = list;
command->add = FALSE; command->add = FALSE;
return command_init(&command->parent, "Move Up", &move_up_command_class); return command_init(&command->parent, _("Move Up"), &move_up_command_class);
} }
static void static void
@ -66,7 +67,7 @@ move_up_one_object(Object_t *obj, gpointer data)
} }
} }
static gboolean static CmdExecuteValue_t
move_up_command_execute(Command_t *parent) move_up_command_execute(Command_t *parent)
{ {
MoveUpCommand_t *command = (MoveUpCommand_t*) parent; MoveUpCommand_t *command = (MoveUpCommand_t*) parent;
@ -77,7 +78,7 @@ move_up_command_execute(Command_t *parent)
object_list_remove_move_cb(command->list, id); object_list_remove_move_cb(command->list, id);
redraw_preview(); /* fix me! */ redraw_preview(); /* fix me! */
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -22,10 +22,11 @@
*/ */
#include "imap_cmd_copy.h" #include "imap_cmd_copy.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static void object_down_command_destruct(Command_t *parent); static void object_down_command_destruct(Command_t *parent);
static gboolean object_down_command_execute(Command_t *parent); static CmdExecuteValue_t object_down_command_execute(Command_t *parent);
static void object_down_command_undo(Command_t *parent); static void object_down_command_undo(Command_t *parent);
CommandClass_t object_down_command_class = { CommandClass_t object_down_command_class = {
@ -47,7 +48,7 @@ object_down_command_new(ObjectList_t *list, Object_t *obj)
ObjectDownCommand_t *command = g_new(ObjectDownCommand_t, 1); ObjectDownCommand_t *command = g_new(ObjectDownCommand_t, 1);
command->list = list; command->list = list;
command->obj = object_ref(obj); command->obj = object_ref(obj);
return command_init(&command->parent, "Move Down", return command_init(&command->parent, _("Move Down"),
&object_down_command_class); &object_down_command_class);
} }
@ -58,13 +59,13 @@ object_down_command_destruct(Command_t *parent)
object_unref(command->obj); object_unref(command->obj);
} }
static gboolean static CmdExecuteValue_t
object_down_command_execute(Command_t *parent) object_down_command_execute(Command_t *parent)
{ {
ObjectDownCommand_t *command = (ObjectDownCommand_t*) parent; ObjectDownCommand_t *command = (ObjectDownCommand_t*) parent;
object_list_move_down(command->list, command->obj); object_list_move_down(command->list, command->obj);
redraw_preview(); /* fix me! */ redraw_preview(); /* fix me! */
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -0,0 +1,84 @@
/*
* 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.
*
*/
#include "imap_cmd_object_move.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h"
static void object_move_command_destruct(Command_t *parent);
static CmdExecuteValue_t object_move_command_execute(Command_t *parent);
static void object_move_command_undo(Command_t *parent);
CommandClass_t object_move_command_class = {
object_move_command_destruct,
object_move_command_execute,
object_move_command_undo,
NULL /* object_move_command_redo */
};
typedef struct {
Command_t parent;
Object_t *obj;
gint dx;
gint dy;
} ObjectMoveCommand_t;
Command_t*
object_move_command_new(Object_t *obj, gint dx, gint dy)
{
ObjectMoveCommand_t *command = g_new(ObjectMoveCommand_t, 1);
command->obj = object_ref(obj);
command->dx = dx;
command->dy = dy;
return command_init(&command->parent, _("Move"),
&object_move_command_class);
}
static void
object_move_command_destruct(Command_t *parent)
{
ObjectMoveCommand_t *command = (ObjectMoveCommand_t*) parent;
object_unref(command->obj);
}
static CmdExecuteValue_t
object_move_command_execute(Command_t *parent)
{
ObjectMoveCommand_t *command = (ObjectMoveCommand_t*) parent;
object_move(command->obj, command->dx, command->dy);
#ifdef _OLD_
redraw_preview(); /* fix me! */
#endif
return CMD_APPEND;
}
static void
object_move_command_undo(Command_t *parent)
{
ObjectMoveCommand_t *command = (ObjectMoveCommand_t*) parent;
object_move(command->obj, -command->dx, -command->dy);
#ifdef _OLD_
redraw_preview(); /* fix me! */
#endif
}

View file

@ -0,0 +1,32 @@
/*
* 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_CMD_OBJECT_MOVE_H
#define _IMAP_CMD_OBJECT_MOVE_H
#include "imap_command.h"
#include "imap_object.h"
Command_t *object_move_command_new(Object_t *obj, gint x, gint y);
#endif /* _IMAP_CMD_OBJECT_MOVE_H */

View file

@ -22,10 +22,11 @@
*/ */
#include "imap_cmd_copy.h" #include "imap_cmd_copy.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static void object_up_command_destruct(Command_t *parent); static void object_up_command_destruct(Command_t *parent);
static gboolean object_up_command_execute(Command_t *parent); static CmdExecuteValue_t object_up_command_execute(Command_t *parent);
static void object_up_command_undo(Command_t *parent); static void object_up_command_undo(Command_t *parent);
CommandClass_t object_up_command_class = { CommandClass_t object_up_command_class = {
@ -47,7 +48,7 @@ object_up_command_new(ObjectList_t *list, Object_t *obj)
ObjectUpCommand_t *command = g_new(ObjectUpCommand_t, 1); ObjectUpCommand_t *command = g_new(ObjectUpCommand_t, 1);
command->list = list; command->list = list;
command->obj = object_ref(obj); command->obj = object_ref(obj);
return command_init(&command->parent, "Move Up", return command_init(&command->parent, _("Move Up"),
&object_up_command_class); &object_up_command_class);
} }
@ -58,13 +59,13 @@ object_up_command_destruct(Command_t *parent)
object_unref(command->obj); object_unref(command->obj);
} }
static gboolean static CmdExecuteValue_t
object_up_command_execute(Command_t *parent) object_up_command_execute(Command_t *parent)
{ {
ObjectUpCommand_t *command = (ObjectUpCommand_t*) parent; ObjectUpCommand_t *command = (ObjectUpCommand_t*) parent;
object_list_move_up(command->list, command->obj); object_list_move_up(command->list, command->obj);
redraw_preview(); /* fix me! */ redraw_preview(); /* fix me! */
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -23,9 +23,10 @@
#include "imap_cmd_create.h" #include "imap_cmd_create.h"
#include "imap_cmd_paste.h" #include "imap_cmd_paste.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static gboolean paste_command_execute(Command_t *parent); static CmdExecuteValue_t paste_command_execute(Command_t *parent);
static CommandClass_t paste_command_class = { static CommandClass_t paste_command_class = {
NULL, /* paste_command_destruct, */ NULL, /* paste_command_destruct, */
@ -44,7 +45,7 @@ paste_command_new(ObjectList_t *list)
{ {
PasteCommand_t *command = g_new(PasteCommand_t, 1); PasteCommand_t *command = g_new(PasteCommand_t, 1);
command->list = list; command->list = list;
return command_init(&command->parent, "Paste", &paste_command_class); return command_init(&command->parent, _("Paste"), &paste_command_class);
} }
static void static void
@ -55,7 +56,7 @@ paste_one_object(Object_t *obj, gpointer data)
create_command_new(command->list, obj)); create_command_new(command->list, obj));
} }
static gboolean static CmdExecuteValue_t
paste_command_execute(Command_t *parent) paste_command_execute(Command_t *parent)
{ {
PasteCommand_t *command = (PasteCommand_t*) parent; PasteCommand_t *command = (PasteCommand_t*) parent;
@ -65,7 +66,7 @@ paste_command_execute(Command_t *parent)
object_list_paste(command->list); object_list_paste(command->list);
redraw_preview(); /* Fix me! */ redraw_preview(); /* Fix me! */
object_list_remove_add_cb(command->list, id); object_list_remove_add_cb(command->list, id);
return TRUE; return CMD_APPEND;
} }

View file

@ -22,11 +22,11 @@
*/ */
#include "imap_cmd_select.h" #include "imap_cmd_select.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static void select_command_destruct(Command_t *parent); static void select_command_destruct(Command_t *parent);
static gboolean select_command_execute(Command_t *parent); static CmdExecuteValue_t select_command_execute(Command_t *parent);
static void select_command_undo(Command_t *parent); static void select_command_undo(Command_t *parent);
static CommandClass_t select_command_class = { static CommandClass_t select_command_class = {
@ -46,7 +46,7 @@ select_command_new(Object_t *obj)
{ {
SelectCommand_t *command = g_new(SelectCommand_t, 1); SelectCommand_t *command = g_new(SelectCommand_t, 1);
command->obj = object_ref(obj); command->obj = object_ref(obj);
return command_init(&command->parent, "Select", &select_command_class); return command_init(&command->parent, _("Select"), &select_command_class);
} }
static void static void
@ -56,12 +56,12 @@ select_command_destruct(Command_t *parent)
object_unref(command->obj); object_unref(command->obj);
} }
static gboolean static CmdExecuteValue_t
select_command_execute(Command_t *parent) select_command_execute(Command_t *parent)
{ {
SelectCommand_t *command = (SelectCommand_t*) parent; SelectCommand_t *command = (SelectCommand_t*) parent;
object_select(command->obj); object_select(command->obj);
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -23,9 +23,10 @@
#include "imap_cmd_select.h" #include "imap_cmd_select.h"
#include "imap_cmd_select_all.h" #include "imap_cmd_select_all.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static gboolean select_all_command_execute(Command_t *parent); static CmdExecuteValue_t select_all_command_execute(Command_t *parent);
static void select_all_command_undo(Command_t *parent); static void select_all_command_undo(Command_t *parent);
static void select_all_command_redo(Command_t *parent); static void select_all_command_redo(Command_t *parent);
@ -46,7 +47,7 @@ select_all_command_new(ObjectList_t *list)
{ {
SelectAllCommand_t *command = g_new(SelectAllCommand_t, 1); SelectAllCommand_t *command = g_new(SelectAllCommand_t, 1);
command->list = list; command->list = list;
return command_init(&command->parent, "Select All", return command_init(&command->parent, _("Select All"),
&select_all_command_class); &select_all_command_class);
} }
@ -57,20 +58,20 @@ select_one_object(Object_t *obj, gpointer data)
command_add_subcommand(&command->parent, select_command_new(obj)); command_add_subcommand(&command->parent, select_command_new(obj));
} }
static gboolean static CmdExecuteValue_t
select_all_command_execute(Command_t *parent) select_all_command_execute(Command_t *parent)
{ {
SelectAllCommand_t *command = (SelectAllCommand_t*) parent; SelectAllCommand_t *command = (SelectAllCommand_t*) parent;
gpointer id; gpointer id;
gboolean rvalue; CmdExecuteValue_t rvalue;
id = object_list_add_select_cb(command->list, select_one_object, command); id = object_list_add_select_cb(command->list, select_one_object, command);
if (object_list_select_all(command->list)) { if (object_list_select_all(command->list)) {
redraw_preview(); /* Fix me! */ redraw_preview(); /* Fix me! */
rvalue = TRUE; rvalue = CMD_APPEND;
} else { } else {
rvalue = FALSE; rvalue = CMD_DESTRUCT;
} }
object_list_remove_select_cb(command->list, id); object_list_remove_select_cb(command->list, id);
return rvalue; return rvalue;

View file

@ -0,0 +1,91 @@
/*
* 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.
*
*/
#include "imap_cmd_select.h"
#include "imap_cmd_select_next.h"
#include "imap_cmd_unselect.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h"
static CmdExecuteValue_t select_next_command_execute(Command_t *parent);
static void select_next_command_undo(Command_t *command);
static void select_next_command_redo(Command_t *command);
static CommandClass_t select_next_command_class = {
NULL, /* select_next_command_destruct */
select_next_command_execute,
select_next_command_undo,
select_next_command_redo
};
typedef struct {
Command_t parent;
ObjectList_t *list;
} SelectNextCommand_t;
Command_t*
select_next_command_new(ObjectList_t *list)
{
SelectNextCommand_t *command = g_new(SelectNextCommand_t, 1);
command->list = list;
return command_init(&command->parent, _("Select Next"),
&select_next_command_class);
}
static void
select_one_object(Object_t *obj, gpointer data)
{
SelectNextCommand_t *command = (SelectNextCommand_t*) data;
Command_t *sub_command;
sub_command = (obj->selected)
? select_command_new(obj) : unselect_command_new(obj);
command_add_subcommand(&command->parent, sub_command);
}
static CmdExecuteValue_t
select_next_command_execute(Command_t *parent)
{
SelectNextCommand_t *command = (SelectNextCommand_t*) parent;
ObjectList_t *list = command->list;
gpointer id;
id = object_list_add_select_cb(list, select_one_object, command);
object_list_select_next(list);
object_list_remove_select_cb(list, id);
return CMD_APPEND;
}
static void
select_next_command_undo(Command_t *command)
{
redraw_preview(); /* Fix me! */
}
static void
select_next_command_redo(Command_t *command)
{
redraw_preview(); /* Fix me! */
}

View file

@ -0,0 +1,32 @@
/*
* 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_CMD_SELECT_NEXT_H
#define _IMAP_CMD_SELECT_NEXT_H
#include "imap_command.h"
#include "imap_object.h"
Command_t *select_next_command_new(ObjectList_t *list);
#endif /* _IMAP_CMD_SELECT_NEXT_H */

View file

@ -0,0 +1,90 @@
/*
* 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.
*
*/
#include "imap_cmd_select.h"
#include "imap_cmd_select_prev.h"
#include "imap_cmd_unselect.h"
#include "imap_main.h"
static CmdExecuteValue_t select_prev_command_execute(Command_t *parent);
static void select_prev_command_undo(Command_t *command);
static void select_prev_command_redo(Command_t *command);
static CommandClass_t select_prev_command_class = {
NULL, /* select_prev_command_destruct */
select_prev_command_execute,
select_prev_command_undo,
select_prev_command_redo
};
typedef struct {
Command_t parent;
ObjectList_t *list;
} SelectPrevCommand_t;
Command_t*
select_prev_command_new(ObjectList_t *list)
{
SelectPrevCommand_t *command = g_new(SelectPrevCommand_t, 1);
command->list = list;
return command_init(&command->parent, "Select Previous",
&select_prev_command_class);
}
static void
select_one_object(Object_t *obj, gpointer data)
{
SelectPrevCommand_t *command = (SelectPrevCommand_t*) data;
Command_t *sub_command;
sub_command = (obj->selected)
? select_command_new(obj) : unselect_command_new(obj);
command_add_subcommand(&command->parent, sub_command);
}
static CmdExecuteValue_t
select_prev_command_execute(Command_t *parent)
{
SelectPrevCommand_t *command = (SelectPrevCommand_t*) parent;
ObjectList_t *list = command->list;
gpointer id;
id = object_list_add_select_cb(list, select_one_object, command);
object_list_select_prev(list);
object_list_remove_select_cb(list, id);
return CMD_APPEND;
}
static void
select_prev_command_undo(Command_t *command)
{
redraw_preview(); /* Fix me! */
}
static void
select_prev_command_redo(Command_t *command)
{
redraw_preview(); /* Fix me! */
}

View file

@ -0,0 +1,32 @@
/*
* 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_CMD_SELECT_PREV_H
#define _IMAP_CMD_SELECT_PREV_H
#include "imap_command.h"
#include "imap_object.h"
Command_t *select_prev_command_new(ObjectList_t *list);
#endif /* _IMAP_CMD_SELECT_PREV_H */

View file

@ -25,9 +25,10 @@
#include "imap_cmd_select.h" #include "imap_cmd_select.h"
#include "imap_cmd_select_region.h" #include "imap_cmd_select_region.h"
#include "imap_cmd_unselect_all.h" #include "imap_cmd_unselect_all.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static gboolean select_region_command_execute(Command_t *parent); static CmdExecuteValue_t select_region_command_execute(Command_t *parent);
static void select_region_command_undo(Command_t *parent); static void select_region_command_undo(Command_t *parent);
static void select_region_command_redo(Command_t *parent); static void select_region_command_redo(Command_t *parent);
@ -45,6 +46,7 @@ typedef struct {
gint x; gint x;
gint y; gint y;
Object_t *obj; Object_t *obj;
Command_t *unselect_command;
} SelectRegionCommand_t; } SelectRegionCommand_t;
Command_t* Command_t*
@ -58,11 +60,12 @@ select_region_command_new(GtkWidget *widget, ObjectList_t *list, gint x,
command->list = list; command->list = list;
command->x = x; command->x = x;
command->y = y; command->y = y;
(void) command_init(&command->parent, "Select Region", (void) command_init(&command->parent, _("Select Region"),
&select_region_command_class); &select_region_command_class);
sub_command = unselect_all_command_new(list, NULL); sub_command = unselect_all_command_new(list, NULL);
command_add_subcommand(&command->parent, sub_command); command_add_subcommand(&command->parent, sub_command);
command->unselect_command = sub_command;
return &command->parent; return &command->parent;
} }
@ -96,6 +99,7 @@ select_release(GtkWidget *widget, GdkEventButton *event, gpointer data)
Object_t *obj = command->obj; Object_t *obj = command->obj;
Rectangle_t *rectangle = ObjectToRectangle(obj); Rectangle_t *rectangle = ObjectToRectangle(obj);
gpointer id; gpointer id;
gint count;
gtk_signal_disconnect_by_func(GTK_OBJECT(widget), gtk_signal_disconnect_by_func(GTK_OBJECT(widget),
(GtkSignalFunc) select_motion, data); (GtkSignalFunc) select_motion, data);
@ -107,19 +111,24 @@ select_release(GtkWidget *widget, GdkEventButton *event, gpointer data)
gdk_gc_set_function(get_preferences()->normal_gc, GDK_COPY); gdk_gc_set_function(get_preferences()->normal_gc, GDK_COPY);
id = object_list_add_select_cb(command->list, select_one_object, command); id = object_list_add_select_cb(command->list, select_one_object, command);
if (object_list_select_region(command->list, rectangle->x, rectangle->y, count = object_list_select_region(command->list, rectangle->x, rectangle->y,
rectangle->width, rectangle->height)) rectangle->width, rectangle->height);
redraw_preview();
object_list_remove_select_cb(command->list, id); object_list_remove_select_cb(command->list, id);
if (count) {
redraw_preview(); /* Fix me! */
command_list_add(&command->parent);
} else { /* Nothing selected */
if (command->unselect_command->sub_commands)
command_list_add(&command->parent);
}
object_unref(obj); object_unref(obj);
} }
static gboolean static CmdExecuteValue_t
select_region_command_execute(Command_t *parent) select_region_command_execute(Command_t *parent)
{ {
SelectRegionCommand_t *command = (SelectRegionCommand_t*) parent; SelectRegionCommand_t *command = (SelectRegionCommand_t*) parent;
/* Command_t *sub_command; */
command->obj = create_rectangle(command->x, command->y, 0, 0); command->obj = create_rectangle(command->x, command->y, 0, 0);
gtk_signal_connect(GTK_OBJECT(command->widget), "button_release_event", gtk_signal_connect(GTK_OBJECT(command->widget), "button_release_event",
@ -127,14 +136,9 @@ select_region_command_execute(Command_t *parent)
gtk_signal_connect(GTK_OBJECT(command->widget), "motion_notify_event", gtk_signal_connect(GTK_OBJECT(command->widget), "motion_notify_event",
(GtkSignalFunc) select_motion, command); (GtkSignalFunc) select_motion, command);
#ifdef _OLD_
sub_command = unselect_all_command_new(command->list, NULL);
command_add_subcommand(parent, sub_command);
command_execute(sub_command);
#endif
gdk_gc_set_function(get_preferences()->normal_gc, GDK_EQUIV); gdk_gc_set_function(get_preferences()->normal_gc, GDK_EQUIV);
return TRUE; return CMD_IGNORE;
} }
static void static void

View file

@ -24,9 +24,10 @@
#include "imap_cmd_create.h" #include "imap_cmd_create.h"
#include "imap_cmd_delete.h" #include "imap_cmd_delete.h"
#include "imap_cmd_send_to_back.h" #include "imap_cmd_send_to_back.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static gboolean send_to_back_command_execute(Command_t *parent); static CmdExecuteValue_t send_to_back_command_execute(Command_t *parent);
static void send_to_back_command_undo(Command_t *parent); static void send_to_back_command_undo(Command_t *parent);
static void send_to_back_command_redo(Command_t *parent); static void send_to_back_command_redo(Command_t *parent);
@ -47,7 +48,7 @@ send_to_back_command_new(ObjectList_t *list)
{ {
SendToBackCommand_t *command = g_new(SendToBackCommand_t, 1); SendToBackCommand_t *command = g_new(SendToBackCommand_t, 1);
command->list = list; command->list = list;
return command_init(&command->parent, "Send To Back", return command_init(&command->parent, _("Send To Back"),
&send_to_back_command_class); &send_to_back_command_class);
} }
@ -67,7 +68,7 @@ add_one_object(Object_t *obj, gpointer data)
create_command_new(command->list, obj)); create_command_new(command->list, obj));
} }
static gboolean static CmdExecuteValue_t
send_to_back_command_execute(Command_t *parent) send_to_back_command_execute(Command_t *parent)
{ {
SendToBackCommand_t *command = (SendToBackCommand_t*) parent; SendToBackCommand_t *command = (SendToBackCommand_t*) parent;
@ -80,7 +81,7 @@ send_to_back_command_execute(Command_t *parent)
redraw_preview(); /* Fix me! */ redraw_preview(); /* Fix me! */
object_list_remove_remove_cb(command->list, id1); object_list_remove_remove_cb(command->list, id1);
object_list_remove_add_cb(command->list, id2); object_list_remove_add_cb(command->list, id2);
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -22,11 +22,11 @@
*/ */
#include "imap_cmd_unselect.h" #include "imap_cmd_unselect.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
static void unselect_command_destruct(Command_t *parent); static void unselect_command_destruct(Command_t *parent);
static gboolean unselect_command_execute(Command_t *parent); static CmdExecuteValue_t unselect_command_execute(Command_t *parent);
static void unselect_command_undo(Command_t *parent); static void unselect_command_undo(Command_t *parent);
static CommandClass_t unselect_command_class = { static CommandClass_t unselect_command_class = {
@ -46,7 +46,7 @@ unselect_command_new(Object_t *obj)
{ {
UnselectCommand_t *command = g_new(UnselectCommand_t, 1); UnselectCommand_t *command = g_new(UnselectCommand_t, 1);
command->obj = object_ref(obj); command->obj = object_ref(obj);
return command_init(&command->parent, "Unselect", return command_init(&command->parent, _("Unselect"),
&unselect_command_class); &unselect_command_class);
} }
@ -57,12 +57,12 @@ unselect_command_destruct(Command_t *command)
object_unref(unselect_command->obj); object_unref(unselect_command->obj);
} }
static gboolean static CmdExecuteValue_t
unselect_command_execute(Command_t *command) unselect_command_execute(Command_t *command)
{ {
UnselectCommand_t *unselect_command = (UnselectCommand_t*) command; UnselectCommand_t *unselect_command = (UnselectCommand_t*) command;
object_unselect(unselect_command->obj); object_unselect(unselect_command->obj);
return TRUE; return CMD_APPEND;
} }
static void static void

View file

@ -23,6 +23,7 @@
#include "imap_cmd_unselect.h" #include "imap_cmd_unselect.h"
#include "imap_cmd_unselect_all.h" #include "imap_cmd_unselect_all.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
COMMAND_PROTO(unselect_all_command); COMMAND_PROTO(unselect_all_command);
@ -46,7 +47,7 @@ unselect_all_command_new(ObjectList_t *list, Object_t *exception)
UnselectAllCommand_t *command = g_new(UnselectAllCommand_t, 1); UnselectAllCommand_t *command = g_new(UnselectAllCommand_t, 1);
command->list = list; command->list = list;
command->exception = (exception) ? object_ref(exception) : exception; command->exception = (exception) ? object_ref(exception) : exception;
return command_init(&command->parent, "Unselect All", return command_init(&command->parent, _("Unselect All"),
&unselect_all_command_class); &unselect_all_command_class);
} }
@ -65,20 +66,20 @@ select_one_object(Object_t *obj, gpointer data)
command_add_subcommand(&command->parent, unselect_command_new(obj)); command_add_subcommand(&command->parent, unselect_command_new(obj));
} }
static gboolean static CmdExecuteValue_t
unselect_all_command_execute(Command_t *parent) unselect_all_command_execute(Command_t *parent)
{ {
UnselectAllCommand_t *command = (UnselectAllCommand_t*) parent; UnselectAllCommand_t *command = (UnselectAllCommand_t*) parent;
gpointer id; gpointer id;
gboolean rvalue; CmdExecuteValue_t rvalue;
id = object_list_add_select_cb(command->list, select_one_object, id = object_list_add_select_cb(command->list, select_one_object,
command); command);
if (object_list_deselect_all(command->list, command->exception)) { if (object_list_deselect_all(command->list, command->exception)) {
redraw_preview(); /* Fix me! */ redraw_preview(); /* Fix me! */
rvalue = TRUE; rvalue = CMD_APPEND;
} else { } else {
rvalue = FALSE; rvalue = CMD_DESTRUCT;
} }
object_list_remove_select_cb(command->list, id); object_list_remove_select_cb(command->list, id);
return rvalue; return rvalue;

View file

@ -24,7 +24,6 @@
#include <stdio.h> #include <stdio.h>
#include "imap_command.h" #include "imap_command.h"
#define DEFAULT_UNDO_LEVELS 10
#define INFINITE_UNDO_LEVELS -1 #define INFINITE_UNDO_LEVELS -1
static void command_destruct(Command_t *command); static void command_destruct(Command_t *command);
@ -169,10 +168,38 @@ subcommand_end(void)
command_list_end(_current_command_list); command_list_end(_current_command_list);
} }
static void
_command_list_set_undo_level(CommandList_t *list, gint level)
{
gint diff = g_list_length(list->list) - level;
if (diff > 0) {
GList *p, *q;
/* first remove data at the front */
for (p = list->list; diff && p != list->undo; p = q, diff--) {
Command_t *curr = (Command_t*) p->data;
q = p->next;
command_destruct(curr);
list->list = g_list_remove_link(list->list, p);
}
/* If still to long start removing redo levels at the end */
for (p = g_list_last(list->list); diff && p != list->undo; p = q,
diff--) {
Command_t *curr = (Command_t*) p->data;
q = p->prev;
command_destruct(curr);
list->list = g_list_remove_link(list->list, p);
}
command_list_callback_call(&list->update_cb,
(Command_t*) list->undo->data);
}
list->undo_levels = level;
}
void void
command_list_set_undo_level(gint level) command_list_set_undo_level(gint level)
{ {
/* Fix me */ _command_list_set_undo_level(&_command_list, level);
} }
Command_t* Command_t*
@ -219,9 +246,10 @@ command_execute(Command_t *command)
if (command->sub_commands) if (command->sub_commands)
command_list_execute(command->sub_commands); command_list_execute(command->sub_commands);
if (command->class->execute) { if (command->class->execute) {
if (command->class->execute(command)) CmdExecuteValue_t value = command->class->execute(command);
if (value == CMD_APPEND)
command_list_add(command); command_list_add(command);
else else if (value == CMD_DESTRUCT)
command_destruct(command); command_destruct(command);
} }
} }
@ -324,7 +352,7 @@ command_add_subcommand(Command_t *command, Command_t *sub_command)
subcommand_list_add(command->sub_commands, sub_command); subcommand_list_add(command->sub_commands, sub_command);
} }
static gboolean basic_command_execute(Command_t *command); static CmdExecuteValue_t basic_command_execute(Command_t *command);
static CommandClass_t basic_command_class = { static CommandClass_t basic_command_class = {
NULL, /* basic_command_destruct */ NULL, /* basic_command_destruct */
@ -346,11 +374,11 @@ command_new(void (*func)(void))
return command_init(&command->parent, "Unknown", &basic_command_class); return command_init(&command->parent, "Unknown", &basic_command_class);
} }
static gboolean static CmdExecuteValue_t
basic_command_execute(Command_t *command) basic_command_execute(Command_t *command)
{ {
((BasicCommand_t*) command)->func(); ((BasicCommand_t*) command)->func();
return FALSE; return CMD_DESTRUCT;
} }

View file

@ -26,19 +26,23 @@
#include "imap_object.h" #include "imap_object.h"
#define DEFAULT_UNDO_LEVELS 10
typedef struct CommandClass_t CommandClass_t; typedef struct CommandClass_t CommandClass_t;
typedef struct Command_t Command_t; typedef struct Command_t Command_t;
typedef struct CommandList_t CommandList_t; typedef struct CommandList_t CommandList_t;
typedef enum {CMD_APPEND, CMD_DESTRUCT, CMD_IGNORE} CmdExecuteValue_t;
#define COMMAND_PROTO(class) \ #define COMMAND_PROTO(class) \
static void class##_destruct(Command_t *command); \ static void class##_destruct(Command_t *command); \
static gboolean class##_execute(Command_t *command); \ static CmdExecuteValue_t class##_execute(Command_t *command); \
static void class##_undo(Command_t *command); \ static void class##_undo(Command_t *command); \
static void class##_redo(Command_t *command) static void class##_redo(Command_t *command)
struct CommandClass_t { struct CommandClass_t {
void (*destruct)(Command_t*); void (*destruct)(Command_t*);
gboolean (*execute)(Command_t*); CmdExecuteValue_t (*execute)(Command_t*);
void (*undo)(Command_t*); void (*undo)(Command_t*);
void (*redo)(Command_t*); void (*redo)(Command_t*);
}; };

View file

@ -157,16 +157,16 @@ tag : shape_tag
shape_tag : SHAPE '=' STRING shape_tag : SHAPE '=' STRING
{ {
if (!strcasecmp($3, "RECT")) { if (!g_strcasecmp($3, "RECT")) {
current_object = create_rectangle(0, 0, 0, 0); current_object = create_rectangle(0, 0, 0, 0);
current_type = RECTANGLE; current_type = RECTANGLE;
} else if (!strcasecmp($3, "CIRCLE")) { } else if (!g_strcasecmp($3, "CIRCLE")) {
current_object = create_circle(0, 0, 0); current_object = create_circle(0, 0, 0);
current_type = CIRCLE; current_type = CIRCLE;
} else if (!strcasecmp($3, "POLY")) { } else if (!g_strcasecmp($3, "POLY")) {
current_object = create_polygon(NULL); current_object = create_polygon(NULL);
current_type = POLYGON; current_type = POLYGON;
} else if (!strcasecmp($3, "DEFAULT")) { } else if (!g_strcasecmp($3, "DEFAULT")) {
current_type = UNDEFINED; current_type = UNDEFINED;
} }
} }

View file

@ -29,6 +29,7 @@
#include "imap_default_dialog.h" #include "imap_default_dialog.h"
#include "imap_edit_area_info.h" #include "imap_edit_area_info.h"
#include "imap_main.h" #include "imap_main.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_table.h" #include "imap_table.h"
static gint callback_lock; static gint callback_lock;
@ -163,7 +164,7 @@ create_link_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook)
gtk_table_set_row_spacings(GTK_TABLE(table), 10); gtk_table_set_row_spacings(GTK_TABLE(table), 10);
gtk_widget_show(table); gtk_widget_show(table);
frame = gtk_frame_new("Link Type"); frame = gtk_frame_new(_("Link Type"));
gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 2, 0, 1); gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 2, 0, 1);
gtk_widget_show(frame); gtk_widget_show(frame);
@ -172,53 +173,55 @@ create_link_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook)
gtk_widget_show(subtable); gtk_widget_show(subtable);
dialog->web_site = create_radio_button_in_table(subtable, NULL, 0, 0, dialog->web_site = create_radio_button_in_table(subtable, NULL, 0, 0,
"Web Site"); _("Web Site"));
gtk_signal_connect(GTK_OBJECT(dialog->web_site), "toggled", gtk_signal_connect(GTK_OBJECT(dialog->web_site), "toggled",
(GtkSignalFunc) select_web_cb, (gpointer) dialog); (GtkSignalFunc) select_web_cb, (gpointer) dialog);
group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->web_site)); group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->web_site));
dialog->ftp_site = create_radio_button_in_table(subtable, group, 0, 1, dialog->ftp_site = create_radio_button_in_table(subtable, group, 0, 1,
"Ftp Site"); _("Ftp Site"));
gtk_signal_connect(GTK_OBJECT(dialog->ftp_site), "toggled", gtk_signal_connect(GTK_OBJECT(dialog->ftp_site), "toggled",
(GtkSignalFunc) select_ftp_cb, (gpointer) dialog); (GtkSignalFunc) select_ftp_cb, (gpointer) dialog);
group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->ftp_site)); group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->ftp_site));
dialog->gopher = create_radio_button_in_table(subtable, group, 0, 2, dialog->gopher = create_radio_button_in_table(subtable, group, 0, 2,
"Gopher"); _("Gopher"));
gtk_signal_connect(GTK_OBJECT(dialog->gopher), "toggled", gtk_signal_connect(GTK_OBJECT(dialog->gopher), "toggled",
(GtkSignalFunc) select_gopher_cb, (gpointer) dialog); (GtkSignalFunc) select_gopher_cb, (gpointer) dialog);
group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->gopher)); group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->gopher));
dialog->other = create_radio_button_in_table(subtable, group, 0, 3, dialog->other = create_radio_button_in_table(subtable, group, 0, 3,
"Other"); _("Other"));
gtk_signal_connect(GTK_OBJECT(dialog->other), "toggled", gtk_signal_connect(GTK_OBJECT(dialog->other), "toggled",
(GtkSignalFunc) select_other_cb, (gpointer) dialog); (GtkSignalFunc) select_other_cb, (gpointer) dialog);
group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->other)); group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->other));
dialog->file = create_radio_button_in_table(subtable, group, 1, 0, "File"); dialog->file = create_radio_button_in_table(subtable, group, 1, 0,
_("File"));
gtk_signal_connect(GTK_OBJECT(dialog->file), "toggled", gtk_signal_connect(GTK_OBJECT(dialog->file), "toggled",
(GtkSignalFunc) select_file_cb, (gpointer) dialog); (GtkSignalFunc) select_file_cb, (gpointer) dialog);
group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->file)); group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->file));
dialog->wais = create_radio_button_in_table(subtable, group, 1, 1, "WAIS"); dialog->wais = create_radio_button_in_table(subtable, group, 1, 1,
_("WAIS"));
gtk_signal_connect(GTK_OBJECT(dialog->wais), "toggled", gtk_signal_connect(GTK_OBJECT(dialog->wais), "toggled",
(GtkSignalFunc) select_wais_cb, (gpointer) dialog); (GtkSignalFunc) select_wais_cb, (gpointer) dialog);
group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->wais)); group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->wais));
dialog->telnet = create_radio_button_in_table(subtable, group, 1, 2, dialog->telnet = create_radio_button_in_table(subtable, group, 1, 2,
"Telnet"); _("Telnet"));
gtk_signal_connect(GTK_OBJECT(dialog->telnet), "toggled", gtk_signal_connect(GTK_OBJECT(dialog->telnet), "toggled",
(GtkSignalFunc) select_telnet_cb, (gpointer) dialog); (GtkSignalFunc) select_telnet_cb, (gpointer) dialog);
group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->telnet)); group = gtk_radio_button_group(GTK_RADIO_BUTTON(dialog->telnet));
dialog->email = create_radio_button_in_table(subtable, group, 1, 3, dialog->email = create_radio_button_in_table(subtable, group, 1, 3,
"e-mail"); _("e-mail"));
gtk_signal_connect(GTK_OBJECT(dialog->email), "toggled", gtk_signal_connect(GTK_OBJECT(dialog->email), "toggled",
(GtkSignalFunc) select_email_cb, (gpointer) dialog); (GtkSignalFunc) select_email_cb, (gpointer) dialog);
create_label_in_table( create_label_in_table(
table, 2, 0, table, 2, 0,
"URL to activate when this area is clicked: (required)"); _("URL to activate when this area is clicked: (required)"));
browse = browse_widget_new("Select HTML file"); browse = browse_widget_new("Select HTML file");
browse_widget_set_filter(browse, relative_filter, (gpointer) dialog); browse_widget_set_filter(browse, relative_filter, (gpointer) dialog);
@ -228,23 +231,70 @@ create_link_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook)
GTK_SIGNAL_FUNC(url_changed), dialog); GTK_SIGNAL_FUNC(url_changed), dialog);
dialog->relative_link = create_check_button_in_table(table, 4, 0, dialog->relative_link = create_check_button_in_table(table, 4, 0,
"Relative link"); _("Relative link"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->relative_link), gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->relative_link),
TRUE); TRUE);
create_label_in_table( create_label_in_table(
table, 6, 0, table, 6, 0,
"Target frame name/ID: (optional - used for FRAMES only)"); _("Target frame name/ID: (optional - used for FRAMES only)"));
dialog->target = create_entry_in_table(table, 7, 0); dialog->target = create_entry_in_table(table, 7, 0);
create_label_in_table(table, 9, 0, create_label_in_table(table, 9, 0,
"Comment about this area: (optional)"); _("Comment about this area: (optional)"));
dialog->comment = create_entry_in_table(table, 10, 0); dialog->comment = create_entry_in_table(table, 10, 0);
label = gtk_label_new("Link"); label = gtk_label_new(_("Link"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label);
} }
static void
geometry_changed(Object_t *obj, gpointer data)
{
AreaInfoDialog_t *dialog = (AreaInfoDialog_t*) data;
if (dialog->geometry_lock) {
dialog->geometry_lock = FALSE;
} else {
if (dialog->obj == obj) {
object_update_info_widget(obj, dialog->infotab);
obj->class->assign(obj, dialog->clone);
}
}
}
static void
toggle_preview_cb(GtkWidget *widget, AreaInfoDialog_t *param)
{
param->preview = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
edit_area_info_dialog_emit_geometry_signal(param);
}
static void
create_info_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook)
{
GtkWidget *vbox, *frame, *preview, *label;
Object_t *obj = dialog->obj;
vbox = gtk_vbox_new(FALSE, 1);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
gtk_widget_show(vbox);
frame = gtk_frame_new(_("Dimensions"));
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
gtk_widget_show(frame);
preview = gtk_check_button_new_with_label(_("Preview"));
gtk_signal_connect(GTK_OBJECT(preview), "toggled",
(GtkSignalFunc) toggle_preview_cb, (gpointer) dialog);
gtk_box_pack_start(GTK_BOX(vbox), preview, FALSE, FALSE, 0);
gtk_widget_show(preview);
dialog->infotab = obj->class->create_info_widget(frame);
label = gtk_label_new(obj->class->name);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label);
}
static void static void
create_java_script_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook) create_java_script_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook)
{ {
@ -271,24 +321,37 @@ create_java_script_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook)
create_label_in_table(table, 9, 0, "onBlur (HTML 4.0):"); create_label_in_table(table, 9, 0, "onBlur (HTML 4.0):");
dialog->blur = create_entry_in_table(table, 10, 0); dialog->blur = create_entry_in_table(table, 10, 0);
label = gtk_label_new("JavaScript"); label = gtk_label_new(_("JavaScript"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label);
} }
static gboolean
object_was_changed(AreaInfoDialog_t *dialog)
{
Object_t *clone = dialog->clone;
Object_t *obj = dialog->obj;
gint old_x, old_y, old_width, old_height;
gint new_x, new_y, new_width, new_height;
object_get_dimensions(clone, &old_x, &old_y, &old_width, &old_height);
object_get_dimensions(obj, &new_x, &new_y, &new_width, &new_height);
return new_x != old_x || new_y != old_y || new_width != old_width ||
new_height != old_height || clone->selected != obj->selected;
}
static void static void
edit_area_ok_cb(gpointer data) edit_area_ok_cb(gpointer data)
{ {
AreaInfoDialog_t *param = (AreaInfoDialog_t*) data; AreaInfoDialog_t *param = (AreaInfoDialog_t*) data;
Object_t *obj = param->obj; Object_t *obj = param->obj;
gint old_x, old_y, old_width, old_height;
gint new_x, new_y, new_width, new_height; object_list_remove_geometry_cb(obj->list, param->geometry_cb_id);
/* Fix me: nasty hack */ /* Fix me: nasty hack */
if (param->add) if (param->add)
command_list_add(edit_object_command_new(obj)); command_list_add(edit_object_command_new(obj));
object_get_dimensions(obj, &old_x, &old_y, &old_width, &old_height);
object_set_url(obj, gtk_entry_get_text(GTK_ENTRY(param->url))); object_set_url(obj, gtk_entry_get_text(GTK_ENTRY(param->url)));
object_set_target(obj, gtk_entry_get_text(GTK_ENTRY(param->target))); object_set_target(obj, gtk_entry_get_text(GTK_ENTRY(param->target)));
object_set_comment(obj, gtk_entry_get_text(GTK_ENTRY(param->comment))); object_set_comment(obj, gtk_entry_get_text(GTK_ENTRY(param->comment)));
@ -301,17 +364,27 @@ edit_area_ok_cb(gpointer data)
update_shape(obj); update_shape(obj);
object_unlock(obj); object_unlock(obj);
object_get_dimensions(obj, &new_x, &new_y, &new_width, &new_height); if (object_was_changed(param))
if (new_x != old_x || new_y != old_y || new_width != old_width ||
new_height != old_height)
redraw_preview(); redraw_preview();
object_unref(param->clone);
} }
static void static void
edit_area_cancel_cb(gpointer data) edit_area_cancel_cb(gpointer data)
{ {
Object_t *obj = ((AreaInfoDialog_t*) data)->obj; AreaInfoDialog_t *dialog = (AreaInfoDialog_t*) data;
Object_t *obj = dialog->obj;
gboolean changed = object_was_changed(dialog);
gboolean selected = obj->selected;
object_list_remove_geometry_cb(obj->list, dialog->geometry_cb_id);
object_unlock(obj); object_unlock(obj);
object_assign(dialog->clone, obj);
obj->selected = selected;
object_unref(dialog->clone);
if (changed)
redraw_preview();
} }
static void static void
@ -335,9 +408,11 @@ create_edit_area_info_dialog(Object_t *obj)
AreaInfoDialog_t *data = g_new(AreaInfoDialog_t, 1); AreaInfoDialog_t *data = g_new(AreaInfoDialog_t, 1);
GtkWidget *notebook; GtkWidget *notebook;
data->geometry_lock = FALSE;
data->preview = FALSE;
data->obj = obj; data->obj = obj;
data->browse = NULL; data->browse = NULL;
data->dialog = make_default_dialog("Area Settings"); data->dialog = make_default_dialog(_("Area Settings"));
default_dialog_set_ok_cb(data->dialog, edit_area_ok_cb, data); default_dialog_set_ok_cb(data->dialog, edit_area_ok_cb, data);
default_dialog_set_cancel_cb(data->dialog, edit_area_cancel_cb, data); default_dialog_set_cancel_cb(data->dialog, edit_area_cancel_cb, data);
@ -349,7 +424,7 @@ create_edit_area_info_dialog(Object_t *obj)
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(data->dialog->dialog)->vbox), gtk_box_pack_start(GTK_BOX(GTK_DIALOG(data->dialog->dialog)->vbox),
notebook, TRUE, TRUE, 10); notebook, TRUE, TRUE, 10);
create_link_tab(data, notebook); create_link_tab(data, notebook);
data->infotab = obj->class->create_info_tab(notebook); create_info_tab(data, notebook);
create_java_script_tab(data, notebook); create_java_script_tab(data, notebook);
gtk_widget_show(notebook); gtk_widget_show(notebook);
@ -365,8 +440,9 @@ edit_area_info_dialog_show(AreaInfoDialog_t *dialog, Object_t *obj,
object_unlock(dialog->obj); object_unlock(dialog->obj);
object_lock(obj); object_lock(obj);
dialog->obj = obj; dialog->obj = obj;
dialog->clone = object_clone(obj);
dialog->add = add; dialog->add = add;
obj->class->fill_info_tab(obj, dialog->infotab); object_fill_info_tab(obj, dialog->infotab);
gtk_entry_set_text(GTK_ENTRY(dialog->url), obj->url); gtk_entry_set_text(GTK_ENTRY(dialog->url), obj->url);
gtk_entry_set_text(GTK_ENTRY(dialog->target), obj->target); gtk_entry_set_text(GTK_ENTRY(dialog->target), obj->target);
gtk_entry_set_text(GTK_ENTRY(dialog->comment), obj->comment); gtk_entry_set_text(GTK_ENTRY(dialog->comment), obj->comment);
@ -376,9 +452,20 @@ edit_area_info_dialog_show(AreaInfoDialog_t *dialog, Object_t *obj,
gtk_entry_set_text(GTK_ENTRY(dialog->blur), obj->blur); gtk_entry_set_text(GTK_ENTRY(dialog->blur), obj->blur);
gtk_widget_grab_focus(dialog->url); gtk_widget_grab_focus(dialog->url);
sprintf(title, "Area #%d Settings", object_get_position_in_list(obj) + 1); dialog->geometry_cb_id =
object_list_add_geometry_cb(obj->list, geometry_changed, dialog);
sprintf(title, _("Area #%d Settings"),
object_get_position_in_list(obj) + 1);
default_dialog_set_title(dialog->dialog, title); default_dialog_set_title(dialog->dialog, title);
default_dialog_show(dialog->dialog); default_dialog_show(dialog->dialog);
} }
void
edit_area_info_dialog_emit_geometry_signal(AreaInfoDialog_t *dialog)
{
if (dialog->preview) {
dialog->geometry_lock = TRUE;
object_emit_geometry_signal(dialog->obj);
}
}

View file

@ -34,7 +34,10 @@ typedef struct AreaInfoDialog_t AreaInfoDialog_t;
struct AreaInfoDialog_t { struct AreaInfoDialog_t {
DefaultDialog_t *dialog; DefaultDialog_t *dialog;
Object_t *obj; Object_t *obj;
Object_t *clone;
gboolean add; gboolean add;
gboolean geometry_lock;
gboolean preview;
GtkWidget *notebook; GtkWidget *notebook;
GtkWidget *web_site; GtkWidget *web_site;
@ -55,10 +58,12 @@ struct AreaInfoDialog_t {
GtkWidget *blur; GtkWidget *blur;
GtkWidget *browse; GtkWidget *browse;
gpointer infotab; gpointer infotab;
gpointer geometry_cb_id;
}; };
AreaInfoDialog_t *create_edit_area_info_dialog(Object_t *obj); AreaInfoDialog_t *create_edit_area_info_dialog(Object_t *obj);
void edit_area_info_dialog_show(AreaInfoDialog_t *dialog, Object_t *obj, void edit_area_info_dialog_show(AreaInfoDialog_t *dialog, Object_t *obj,
gboolean add); gboolean add);
void edit_area_info_dialog_emit_geometry_signal(AreaInfoDialog_t *dialog);
#endif /* _IMAP_EDIT_AREA_INFO_H */ #endif /* _IMAP_EDIT_AREA_INFO_H */

View file

@ -26,6 +26,7 @@
#include "imap_default_dialog.h" #include "imap_default_dialog.h"
#include "imap_file.h" #include "imap_file.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_table.h" #include "imap_table.h"
@ -42,7 +43,7 @@ open_cb(GtkWidget *widget, gpointer data)
gtk_widget_hide((GtkWidget*) data); gtk_widget_hide((GtkWidget*) data);
load(filename); load(filename);
} else { } else {
do_file_error_dialog("Error opening file", filename); do_file_error_dialog(_("Error opening file"), filename);
} }
} }
@ -51,7 +52,7 @@ do_file_open_dialog(void)
{ {
static GtkWidget *dialog; static GtkWidget *dialog;
if (!dialog) { if (!dialog) {
dialog = gtk_file_selection_new("Load Imagemap"); dialog = gtk_file_selection_new(_("Load Imagemap"));
gtk_signal_connect_object( gtk_signal_connect_object(
GTK_OBJECT(GTK_FILE_SELECTION(dialog)->cancel_button), GTK_OBJECT(GTK_FILE_SELECTION(dialog)->cancel_button),
"clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(dialog)); "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(dialog));
@ -74,13 +75,13 @@ do_file_exists_dialog(gpointer data)
static DefaultDialog_t *dialog; static DefaultDialog_t *dialog;
if (!dialog) { if (!dialog) {
dialog = make_default_dialog("File exists!"); dialog = make_default_dialog(_("File exists!"));
default_dialog_hide_apply_button(dialog); default_dialog_hide_apply_button(dialog);
default_dialog_set_ok_cb(dialog, really_overwrite, data); default_dialog_set_ok_cb(dialog, really_overwrite, data);
default_dialog_set_label( default_dialog_set_label(
dialog, dialog,
"File already exists.\n" _("File already exists.\n"
" Do you really want to overwrite? "); " Do you really want to overwrite? "));
} }
default_dialog_show(dialog); default_dialog_show(dialog);
} }
@ -111,7 +112,7 @@ do_file_save_as_dialog(void)
{ {
static GtkWidget *dialog; static GtkWidget *dialog;
if (!dialog) { if (!dialog) {
dialog = gtk_file_selection_new("Save Imagemap"); dialog = gtk_file_selection_new(_("Save Imagemap"));
gtk_signal_connect_object( gtk_signal_connect_object(
GTK_OBJECT(GTK_FILE_SELECTION(dialog)->cancel_button), GTK_OBJECT(GTK_FILE_SELECTION(dialog)->cancel_button),
"clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(dialog)); "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(dialog));
@ -134,7 +135,7 @@ create_file_error_dialog()
DefaultDialog_t *dialog; DefaultDialog_t *dialog;
GtkWidget *table; GtkWidget *table;
file_dialog->dialog = dialog = make_default_dialog("Error"); file_dialog->dialog = dialog = make_default_dialog(_("Error"));
default_dialog_hide_apply_button(dialog); default_dialog_hide_apply_button(dialog);
default_dialog_hide_cancel_button(dialog); default_dialog_hide_cancel_button(dialog);

View file

@ -22,6 +22,7 @@
*/ */
#include "imap_grid.h" #include "imap_grid.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_menu.h" #include "imap_menu.h"
#include "imap_popup.h" #include "imap_popup.h"
@ -43,8 +44,9 @@ static void
grid_settings_ok_cb(gpointer data) grid_settings_ok_cb(gpointer data)
{ {
GridDialog_t *param = (GridDialog_t*) data; GridDialog_t *param = (GridDialog_t*) data;
gint new_snap;
grid_snap = GTK_TOGGLE_BUTTON(param->snap)->active; new_snap = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(param->snap));
grid_width = gtk_spin_button_get_value_as_int( grid_width = gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON(param->width)); GTK_SPIN_BUTTON(param->width));
grid_height = gtk_spin_button_get_value_as_int( grid_height = gtk_spin_button_get_value_as_int(
@ -54,10 +56,12 @@ grid_settings_ok_cb(gpointer data)
grid_top = gtk_spin_button_get_value_as_int( grid_top = gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON(param->top)); GTK_SPIN_BUTTON(param->top));
main_toolbar_set_grid(grid_snap); if (grid_snap != new_snap) {
popup_check_grid(grid_snap); grid_snap = new_snap;
menu_check_grid(grid_snap); main_toolbar_set_grid(grid_snap);
popup_check_grid(grid_snap);
menu_check_grid(grid_snap);
}
redraw_preview(); redraw_preview();
} }
@ -65,18 +69,63 @@ static void
snap_toggled_cb(GtkWidget *widget, gpointer data) snap_toggled_cb(GtkWidget *widget, gpointer data)
{ {
GridDialog_t *param = (GridDialog_t*) data; GridDialog_t *param = (GridDialog_t*) data;
gint sensitive = GTK_TOGGLE_BUTTON(widget)->active; gint sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
gtk_widget_set_sensitive(param->type_frame, sensitive); gtk_widget_set_sensitive(param->type_frame, sensitive);
gtk_widget_set_sensitive(param->granularity_frame, sensitive); gtk_widget_set_sensitive(param->granularity_frame, sensitive);
gtk_widget_set_sensitive(param->offset_frame, sensitive); gtk_widget_set_sensitive(param->offset_frame, sensitive);
gtk_widget_set_sensitive(param->preview, sensitive);
} }
static void static void
type_toggled_cb(GtkWidget *widget, gpointer data) type_toggled_cb(GtkWidget *widget, gpointer data)
{ {
if (GTK_WIDGET_STATE(widget) & GTK_STATE_SELECTED) if (GTK_WIDGET_STATE(widget) & GTK_STATE_SELECTED) {
grid_type = (gint) data; grid_type = (gint) data;
redraw_preview();
}
}
static void
toggle_preview_cb(GtkWidget *widget, GridDialog_t *param)
{
param->enable_preview =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
redraw_preview();
}
static void
grid_assign_value(GtkWidget *widget, gpointer data, gint *value)
{
GridDialog_t *dialog = (GridDialog_t*) data;
if (dialog->enable_preview) {
*value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
redraw_preview(); /* Fix me! */
}
}
static void
width_changed_cb(GtkWidget *widget, gpointer data)
{
grid_assign_value(widget, data, &grid_width);
}
static void
height_changed_cb(GtkWidget *widget, gpointer data)
{
grid_assign_value(widget, data, &grid_height);
}
static void
left_changed_cb(GtkWidget *widget, gpointer data)
{
grid_assign_value(widget, data, &grid_left);
}
static void
top_changed_cb(GtkWidget *widget, gpointer data)
{
grid_assign_value(widget, data, &grid_top);
} }
static GridDialog_t* static GridDialog_t*
@ -90,10 +139,10 @@ create_grid_settings_dialog()
GtkWidget *button; GtkWidget *button;
GSList* group; GSList* group;
data->dialog = dialog = make_default_dialog("Grid Settings"); data->dialog = dialog = make_default_dialog(_("Grid Settings"));
default_dialog_set_ok_cb(dialog, grid_settings_ok_cb, (gpointer) data); default_dialog_set_ok_cb(dialog, grid_settings_ok_cb, (gpointer) data);
main_table = gtk_table_new(3, 2, FALSE); main_table = gtk_table_new(4, 2, FALSE);
gtk_container_set_border_width(GTK_CONTAINER(main_table), 10); gtk_container_set_border_width(GTK_CONTAINER(main_table), 10);
gtk_table_set_row_spacings(GTK_TABLE(main_table), 10); gtk_table_set_row_spacings(GTK_TABLE(main_table), 10);
gtk_table_set_col_spacings(GTK_TABLE(main_table), 10); gtk_table_set_col_spacings(GTK_TABLE(main_table), 10);
@ -101,27 +150,27 @@ create_grid_settings_dialog()
main_table, TRUE, TRUE, 10); main_table, TRUE, TRUE, 10);
gtk_widget_show(main_table); gtk_widget_show(main_table);
data->snap = gtk_check_button_new_with_label("Snap-To Grid Enabled"); data->snap = gtk_check_button_new_with_label(_("Snap-To Grid Enabled"));
gtk_signal_connect(GTK_OBJECT(data->snap), "toggled", gtk_signal_connect(GTK_OBJECT(data->snap), "toggled",
(GtkSignalFunc) snap_toggled_cb, data); (GtkSignalFunc) snap_toggled_cb, data);
gtk_table_attach_defaults(GTK_TABLE(main_table), data->snap, 0, 1, 0, 1); gtk_table_attach_defaults(GTK_TABLE(main_table), data->snap, 0, 1, 0, 1);
gtk_widget_show(data->snap); gtk_widget_show(data->snap);
data->type_frame = frame = gtk_frame_new("Grid Visibility and Type"); data->type_frame = frame = gtk_frame_new(_("Grid Visibility and Type"));
gtk_widget_show(frame); gtk_widget_show(frame);
gtk_table_attach_defaults(GTK_TABLE(main_table), frame, 0, 2, 1, 2); gtk_table_attach_defaults(GTK_TABLE(main_table), frame, 0, 2, 1, 2);
hbox = gtk_hbox_new(FALSE, 1); hbox = gtk_hbox_new(FALSE, 1);
gtk_container_add(GTK_CONTAINER(frame), hbox); gtk_container_add(GTK_CONTAINER(frame), hbox);
gtk_widget_show(hbox); gtk_widget_show(hbox);
data->hidden = button = gtk_radio_button_new_with_label(NULL, "Hidden"); data->hidden = button = gtk_radio_button_new_with_label(NULL, _("Hidden"));
gtk_signal_connect(GTK_OBJECT(button), "toggled", gtk_signal_connect(GTK_OBJECT(button), "toggled",
(GtkSignalFunc) type_toggled_cb, (gpointer) GRID_HIDDEN); (GtkSignalFunc) type_toggled_cb, (gpointer) GRID_HIDDEN);
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 10); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 10);
gtk_widget_show(button); gtk_widget_show(button);
group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); group = gtk_radio_button_group(GTK_RADIO_BUTTON(button));
data->lines = button = gtk_radio_button_new_with_label(group, "Lines"); data->lines = button = gtk_radio_button_new_with_label(group, _("Lines"));
gtk_signal_connect(GTK_OBJECT(button), "toggled", gtk_signal_connect(GTK_OBJECT(button), "toggled",
(GtkSignalFunc) type_toggled_cb, (gpointer) GRID_LINES); (GtkSignalFunc) type_toggled_cb, (gpointer) GRID_LINES);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
@ -129,40 +178,60 @@ create_grid_settings_dialog()
gtk_widget_show(button); gtk_widget_show(button);
group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); group = gtk_radio_button_group(GTK_RADIO_BUTTON(button));
data->crosses = button = gtk_radio_button_new_with_label(group, "Crosses"); data->crosses = button = gtk_radio_button_new_with_label(group,
_("Crosses"));
gtk_signal_connect(GTK_OBJECT(button), "toggled", gtk_signal_connect(GTK_OBJECT(button), "toggled",
(GtkSignalFunc) type_toggled_cb, (GtkSignalFunc) type_toggled_cb,
(gpointer) GRID_CROSSES); (gpointer) GRID_CROSSES);
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 10); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 10);
gtk_widget_show(button); gtk_widget_show(button);
data->granularity_frame = frame = gtk_frame_new("Grid Granularity"); data->granularity_frame = frame = gtk_frame_new(_("Grid Granularity"));
gtk_table_attach_defaults(GTK_TABLE(main_table), frame, 0, 1, 2, 3); gtk_table_attach_defaults(GTK_TABLE(main_table), frame, 0, 1, 2, 3);
table = gtk_table_new(2, 3, FALSE); table = gtk_table_new(2, 3, FALSE);
gtk_container_set_border_width(GTK_CONTAINER(table), 10); gtk_container_set_border_width(GTK_CONTAINER(table), 10);
gtk_table_set_row_spacings(GTK_TABLE(table), 10); gtk_table_set_row_spacings(GTK_TABLE(table), 10);
gtk_table_set_col_spacings(GTK_TABLE(table), 10); gtk_table_set_col_spacings(GTK_TABLE(table), 10);
gtk_container_add(GTK_CONTAINER(frame), table); gtk_container_add(GTK_CONTAINER(frame), table);
create_label_in_table(table, 0, 0, "Width");
create_label_in_table(table, 0, 0, _("Width"));
data->width = create_spin_button_in_table(table, 0, 1, 15, 1, 100); data->width = create_spin_button_in_table(table, 0, 1, 15, 1, 100);
create_label_in_table(table, 0, 2, "pixels"); gtk_signal_connect(GTK_OBJECT(data->width), "changed",
create_label_in_table(table, 1, 0, "Height"); (GtkSignalFunc) width_changed_cb, (gpointer) data);
create_label_in_table(table, 0, 2, _("pixels"));
create_label_in_table(table, 1, 0, _("Height"));
data->height = create_spin_button_in_table(table, 1, 1, 15, 1, 100); data->height = create_spin_button_in_table(table, 1, 1, 15, 1, 100);
create_label_in_table(table, 1, 2, "pixels"); gtk_signal_connect(GTK_OBJECT(data->height), "changed",
(GtkSignalFunc) height_changed_cb, (gpointer) data);
create_label_in_table(table, 1, 2, _("pixels"));
gtk_widget_show(table); gtk_widget_show(table);
gtk_widget_show(frame); gtk_widget_show(frame);
data->offset_frame = frame = gtk_frame_new("Grid Offset"); data->offset_frame = frame = gtk_frame_new(_("Grid Offset"));
gtk_table_attach_defaults(GTK_TABLE(main_table), frame, 1, 2, 2, 3); gtk_table_attach_defaults(GTK_TABLE(main_table), frame, 1, 2, 2, 3);
table = gtk_table_new(2, 2, FALSE); table = gtk_table_new(2, 2, FALSE);
gtk_container_set_border_width(GTK_CONTAINER(table), 10); gtk_container_set_border_width(GTK_CONTAINER(table), 10);
gtk_table_set_row_spacings(GTK_TABLE(table), 10); gtk_table_set_row_spacings(GTK_TABLE(table), 10);
gtk_table_set_col_spacings(GTK_TABLE(table), 10); gtk_table_set_col_spacings(GTK_TABLE(table), 10);
gtk_container_add(GTK_CONTAINER(frame), table); gtk_container_add(GTK_CONTAINER(frame), table);
data->left = create_spin_button_in_table(table, 0, 0, 0, 0, 100); data->left = create_spin_button_in_table(table, 0, 0, 0, 0, 100);
create_label_in_table(table, 0, 1, "pixels from left"); gtk_signal_connect(GTK_OBJECT(data->left), "changed",
(GtkSignalFunc) left_changed_cb, (gpointer) data);
create_label_in_table(table, 0, 1, _("pixels from left"));
data->top = create_spin_button_in_table(table, 1, 0, 0, 0, 100); data->top = create_spin_button_in_table(table, 1, 0, 0, 0, 100);
create_label_in_table(table, 1, 1, "pixels from top"); gtk_signal_connect(GTK_OBJECT(data->top), "changed",
(GtkSignalFunc) top_changed_cb, (gpointer) data);
create_label_in_table(table, 1, 1, _("pixels from top"));
data->preview = create_check_button_in_table(main_table, 3, 0,
_("Preview"));
gtk_signal_connect(GTK_OBJECT(data->preview), "toggled",
(GtkSignalFunc) toggle_preview_cb, (gpointer) data);
gtk_widget_show(data->preview);
snap_toggled_cb(data->snap, data); snap_toggled_cb(data->snap, data);
@ -234,14 +303,11 @@ draw_grid(GtkWidget *preview)
gdk_gc_set_line_attributes(grid_gc, 1, GDK_LINE_ON_OFF_DASH, gdk_gc_set_line_attributes(grid_gc, 1, GDK_LINE_ON_OFF_DASH,
GDK_CAP_BUTT, GDK_JOIN_BEVEL); GDK_CAP_BUTT, GDK_JOIN_BEVEL);
} }
gdk_gc_set_function(preview->style->black_gc, GDK_INVERT);
if (grid_type == GRID_LINES) if (grid_type == GRID_LINES)
draw_lines(preview->window, preview->style->black_gc, width, height); draw_lines(preview->window, grid_gc, width, height);
else else
draw_crosses(preview->window, preview->style->black_gc, width, draw_crosses(preview->window, preview->style->black_gc, width,
height); height);
gdk_gc_set_function(preview->style->black_gc, GDK_COPY);
} }
} }
@ -253,14 +319,39 @@ toggle_grid(void)
return grid_snap; return grid_snap;
} }
static gint
grid_nearest_x(gint x)
{
return grid_left + (x - grid_left + grid_width / 2) / grid_width
* grid_width;
}
static gint
grid_nearest_y(gint y)
{
return grid_top + (y - grid_top + grid_height / 2) / grid_height
* grid_height;
}
void void
round_to_grid(gint *x, gint *y) round_to_grid(gint *x, gint *y)
{ {
if (grid_snap) { if (grid_snap) {
*x = grid_left + (*x - grid_left + grid_width / 2) / grid_width *x = grid_nearest_x(*x);
* grid_width; *y = grid_nearest_y(*y);
*y = grid_top + (*y - grid_top + grid_height / 2) / grid_height
* grid_height;
} }
} }
gboolean
grid_near_x(gint x)
{
return grid_snap && grid_type != GRID_HIDDEN
&& abs(grid_nearest_x(x) - x) <= 1;
}
gboolean
grid_near_y(gint y)
{
return grid_snap && grid_type != GRID_HIDDEN
&& abs(grid_nearest_x(y) - y) <= 1;
}

View file

@ -39,6 +39,9 @@ typedef struct {
GtkWidget *hidden; GtkWidget *hidden;
GtkWidget *lines; GtkWidget *lines;
GtkWidget *crosses; GtkWidget *crosses;
GtkWidget *preview;
gboolean enable_preview;
} GridDialog_t; } GridDialog_t;
void do_grid_settings_dialog(); void do_grid_settings_dialog();
@ -46,4 +49,7 @@ void draw_grid(GtkWidget *preview);
gboolean toggle_grid(); gboolean toggle_grid();
void round_to_grid(gint *x, gint *y); void round_to_grid(gint *x, gint *y);
gboolean grid_near_x(gint x);
gboolean grid_near_y(gint y);
#endif /* _IMAP_GRID_H */ #endif /* _IMAP_GRID_H */

View file

@ -26,6 +26,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "libgimp/gimp.h" #include "libgimp/gimp.h"
#include "gdk/gdkkeysyms.h" /* for keyboard values */
#include "gtk/gtk.h" #include "gtk/gtk.h"
#include "imap_about.h" #include "imap_about.h"
@ -38,11 +39,15 @@
#include "imap_cmd_move.h" #include "imap_cmd_move.h"
#include "imap_cmd_move_down.h" #include "imap_cmd_move_down.h"
#include "imap_cmd_move_sash.h" #include "imap_cmd_move_sash.h"
#include "imap_cmd_move_selected.h"
#include "imap_cmd_move_to_front.h" #include "imap_cmd_move_to_front.h"
#include "imap_cmd_move_up.h" #include "imap_cmd_move_up.h"
#include "imap_cmd_object_move.h"
#include "imap_cmd_paste.h" #include "imap_cmd_paste.h"
#include "imap_cmd_select.h" #include "imap_cmd_select.h"
#include "imap_cmd_select_all.h" #include "imap_cmd_select_all.h"
#include "imap_cmd_select_next.h"
#include "imap_cmd_select_prev.h"
#include "imap_cmd_select_region.h" #include "imap_cmd_select_region.h"
#include "imap_cmd_send_to_back.h" #include "imap_cmd_send_to_back.h"
#include "imap_cmd_unselect.h" #include "imap_cmd_unselect.h"
@ -51,6 +56,7 @@
#include "imap_edit_area_info.h" #include "imap_edit_area_info.h"
#include "imap_file.h" #include "imap_file.h"
#include "imap_grid.h" #include "imap_grid.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_menu.h" #include "imap_menu.h"
#include "imap_object.h" #include "imap_object.h"
@ -73,7 +79,7 @@
/* Global variables */ /* Global variables */
static MapInfo_t _map_info; static MapInfo_t _map_info;
static PreferencesData_t _preferences = {CSIM, TRUE, FALSE, TRUE, TRUE, FALSE, static PreferencesData_t _preferences = {CSIM, TRUE, FALSE, TRUE, TRUE, FALSE,
FALSE, 4}; FALSE, DEFAULT_UNDO_LEVELS, DEFAULT_MRU_SIZE};
static MRU_t *_mru; static MRU_t *_mru;
static GdkCursorType _cursor; static GdkCursorType _cursor;
@ -124,6 +130,8 @@ static void query()
static int nargs = sizeof (args) / sizeof (args[0]); static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0; static int nreturn_vals = 0;
INIT_I18N();
gimp_install_procedure("plug_in_imagemap", gimp_install_procedure("plug_in_imagemap",
"Creates a clickable imagemap.", "Creates a clickable imagemap.",
"", "",
@ -146,6 +154,8 @@ run(char *name, int n_params, GParam *param, int *nreturn_vals,
GRunModeType run_mode; GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS; GStatusType status = STATUS_SUCCESS;
INIT_I18N_UI();
*nreturn_vals = 1; *nreturn_vals = 1;
*return_vals = values; *return_vals = values;
@ -194,12 +204,6 @@ get_preferences(void)
return &_preferences; return &_preferences;
} }
GtkWidget*
get_top_widget(void)
{
return _dlg;
}
static void static void
init_preferences(void) init_preferences(void)
{ {
@ -242,6 +246,9 @@ init_preferences(void)
gdk_gc_set_background(_preferences.normal_gc, &colors->normal_bg); gdk_gc_set_background(_preferences.normal_gc, &colors->normal_bg);
gdk_gc_set_foreground(_preferences.selected_gc, &colors->selected_fg); gdk_gc_set_foreground(_preferences.selected_gc, &colors->selected_fg);
gdk_gc_set_background(_preferences.selected_gc, &colors->selected_bg); gdk_gc_set_background(_preferences.selected_gc, &colors->selected_bg);
mru_set_size(_mru, _preferences.mru_size);
command_list_set_undo_level(_preferences.undo_levels);
} }
/* Get yellow for tooltips */ /* Get yellow for tooltips */
@ -377,13 +384,13 @@ draw_polygon(GdkWindow *window, GdkGC *gc, GList *list)
static gboolean _preview_redraw_blocked; static gboolean _preview_redraw_blocked;
static void void
preview_freeze(void) preview_freeze(void)
{ {
_preview_redraw_blocked = TRUE; _preview_redraw_blocked = TRUE;
} }
static void void
preview_thaw(void) preview_thaw(void)
{ {
_preview_redraw_blocked = FALSE; _preview_redraw_blocked = FALSE;
@ -393,7 +400,8 @@ preview_thaw(void)
void void
redraw_preview(void) redraw_preview(void)
{ {
preview_redraw(_preview); if (!_preview_redraw_blocked)
preview_redraw(_preview);
} }
static void static void
@ -509,8 +517,8 @@ main_set_title(const char *filename)
char *p; char *p;
g_strreplace(&_filename, filename); g_strreplace(&_filename, filename);
p = (filename) ? g_basename(filename) : "<Untitled>"; p = (filename) ? g_basename(filename) : _("<Untitled>");
sprintf(title, "%s - ImageMap 1.2", p); sprintf(title, "%s - ImageMap 1.3", p);
gtk_window_set_title(GTK_WINDOW(_dlg), title); gtk_window_set_title(GTK_WINDOW(_dlg), title);
} }
@ -540,67 +548,6 @@ hide_url(void)
statusbar_clear_status(_statusbar); statusbar_clear_status(_statusbar);
} }
static gint start_x, start_y;
static gint obj_start_x, obj_start_y;
static gint obj_x, obj_y, obj_width, obj_height;
static gboolean _moved_first_time = TRUE;
static void
button_motion(GtkWidget *widget, GdkEventMotion *event, gpointer data)
{
Object_t *obj = (Object_t*) data;
gint dx = GET_REAL_COORD((gint) event->x) - start_x;
gint dy = GET_REAL_COORD((gint) event->y) - start_y;
if (_moved_first_time) {
_moved_first_time = FALSE;
preview_set_cursor(_preview, GDK_FLEUR);
gdk_gc_set_function(_preferences.normal_gc, GDK_EQUIV);
gdk_gc_set_function(_preferences.selected_gc, GDK_EQUIV);
hide_url();
}
if (obj_x + dx < 0)
dx = -obj_x;
if (obj_x + obj_width + dx > _image_width)
dx = _image_width - obj_width - obj_x;
if (obj_y + dy < 0)
dy = -obj_y;
if (obj_y + obj_height + dy > _image_height)
dy = _image_height - obj_height - obj_y;
if (dx || dy) {
start_x = GET_REAL_COORD((gint) event->x);
start_y = GET_REAL_COORD((gint) event->y);
obj_x += dx;
obj_y += dy;
object_draw(obj, widget->window);
object_move(obj, dx, dy);
object_draw(obj, widget->window);
}
}
static void
button_release(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
gtk_signal_disconnect_by_func(GTK_OBJECT(widget),
(GtkSignalFunc) button_motion, data);
gtk_signal_disconnect_by_func(GTK_OBJECT(widget),
(GtkSignalFunc) button_release, data);
_moved_first_time = TRUE;
preview_set_cursor(_preview, _cursor);
gdk_gc_set_function(_preferences.normal_gc, GDK_COPY);
gdk_gc_set_function(_preferences.selected_gc, GDK_COPY);
redraw_preview();
show_url();
obj_x -= obj_start_x;
obj_y -= obj_start_y;
if (obj_x || obj_y)
command_list_add(move_command_new((Object_t*) data, obj_x, obj_y));
}
void void
select_shape(GtkWidget *widget, GdkEventButton *event) select_shape(GtkWidget *widget, GdkEventButton *event)
{ {
@ -640,15 +587,8 @@ select_shape(GtkWidget *widget, GdkEventButton *event)
} }
command_execute(command); command_execute(command);
start_x = x; command = move_command_new(_preview, obj, x, y);
start_y = y; command_execute(command);
object_get_dimensions(obj, &obj_x, &obj_y, &obj_width, &obj_height);
obj_start_x = obj_x;
obj_start_y = obj_y;
gtk_signal_connect(GTK_OBJECT(widget), "button_release_event",
(GtkSignalFunc) button_release, obj);
gtk_signal_connect(GTK_OBJECT(widget), "motion_notify_event",
(GtkSignalFunc) button_motion, obj);
} else { /* Start selection rectangle */ } else { /* Start selection rectangle */
command = select_region_command_new(widget, _shapes, x, y); command = select_region_command_new(widget, _shapes, x, y);
command_execute(command); command_execute(command);
@ -725,12 +665,12 @@ do_data_changed_dialog(void (*continue_cb)(gpointer), gpointer param)
static DefaultDialog_t *dialog; static DefaultDialog_t *dialog;
if (!dialog) { if (!dialog) {
dialog = make_default_dialog("Data changed"); dialog = make_default_dialog(_("Data changed"));
default_dialog_hide_apply_button(dialog); default_dialog_hide_apply_button(dialog);
default_dialog_set_label( default_dialog_set_label(
dialog, dialog,
" Some data has been changed. \n" _(" Some data has been changed. \n"
"Do you really want to continue?"); "Do you really want to continue?"));
} }
default_dialog_set_ok_cb(dialog, continue_cb, param); default_dialog_set_ok_cb(dialog, continue_cb, param);
default_dialog_show(dialog); default_dialog_show(dialog);
@ -833,7 +773,7 @@ save_as_cern(gpointer param, OutputFunc_t output)
write_cern_comment(param, output); write_cern_comment(param, output);
output(param, "-:Please do not edit lines starting with \"#$\"\n"); output(param, "-:Please do not edit lines starting with \"#$\"\n");
write_cern_comment(param, output); write_cern_comment(param, output);
output(param, "VERSION:1.2\n"); output(param, "VERSION:1.3\n");
write_cern_comment(param, output); write_cern_comment(param, output);
output(param, "TITLE:%s\n", _map_info.title); output(param, "TITLE:%s\n", _map_info.title);
write_cern_comment(param, output); write_cern_comment(param, output);
@ -868,7 +808,7 @@ save_as_csim(gpointer param, OutputFunc_t output)
output(param, "<!-- #$-:GIMP Imagemap Plugin by Maurits Rijk -->\n"); output(param, "<!-- #$-:GIMP Imagemap Plugin by Maurits Rijk -->\n");
output(param, output(param,
"<!-- #$-:Please do not edit lines starting with \"#$\" -->\n"); "<!-- #$-:Please do not edit lines starting with \"#$\" -->\n");
output(param, "<!-- #$VERSION:1.2 -->\n"); output(param, "<!-- #$VERSION:1.3 -->\n");
output(param, "<!-- #$AUTHOR:%s -->\n", _map_info.author); output(param, "<!-- #$AUTHOR:%s -->\n", _map_info.author);
description = g_strdup(_map_info.description); description = g_strdup(_map_info.description);
@ -892,7 +832,7 @@ save_as_ncsa(gpointer param, OutputFunc_t output)
output(param, "#$-:Image Map file created by GIMP Imagemap Plugin\n"); output(param, "#$-:Image Map file created by GIMP Imagemap Plugin\n");
output(param, "#$-:GIMP Imagemap Plugin by Maurits Rijk\n"); output(param, "#$-:GIMP Imagemap Plugin by Maurits Rijk\n");
output(param, "#$-:Please do not edit lines starting with \"#$\"\n"); output(param, "#$-:Please do not edit lines starting with \"#$\"\n");
output(param, "#$VERSION:1.2\n"); output(param, "#$VERSION:1.3\n");
output(param, "#$TITLE:%s\n", _map_info.title); output(param, "#$TITLE:%s\n", _map_info.title);
output(param, "#$AUTHOR:%s\n", _map_info.author); output(param, "#$AUTHOR:%s\n", _map_info.author);
output(param, "#$FORMAT:ncsa\n"); output(param, "#$FORMAT:ncsa\n");
@ -1051,6 +991,17 @@ preview_move(GtkWidget *widget, GdkEventMotion *event)
statusbar_clear_status(_statusbar); statusbar_clear_status(_statusbar);
} }
} }
#ifdef _NOT_READY_YET_
if (!obj) {
if (grid_near_x(x)) {
preview_set_cursor(_preview, GDK_SB_H_DOUBLE_ARROW);
} else if (grid_near_y(y)) {
preview_set_cursor(_preview, GDK_SB_V_DOUBLE_ARROW);
} else {
preview_set_cursor(_preview, _cursor);
}
}
#endif
} }
static void static void
@ -1072,13 +1023,103 @@ button_press(GtkWidget* widget, GdkEventButton* event, gpointer data)
_button_press_func(widget, event, _button_press_param); _button_press_func(widget, event, _button_press_param);
} }
#ifdef _NOT_READY_YET_ /* A few global vars for key movement */
static gint _timeout;
static guint _keyval;
static gint _dx, _dy;
static void
move_selected_objects(gint dx, gint dy, gboolean fast)
{
if (fast) {
dx *= 5;
dy *= 5;
}
_dx += dx;
_dy += dy;
gdk_gc_set_function(_preferences.normal_gc, GDK_EQUIV);
gdk_gc_set_function(_preferences.selected_gc, GDK_EQUIV);
object_list_draw_selected(_shapes, _preview->preview->window);
object_list_move_selected(_shapes, dx, dy);
object_list_draw_selected(_shapes, _preview->preview->window);
gdk_gc_set_function(_preferences.normal_gc, GDK_COPY);
gdk_gc_set_function(_preferences.selected_gc, GDK_COPY);
}
static gboolean
key_timeout_cb(gpointer data)
{
switch (_keyval) {
case GDK_Left:
case GDK_Right:
case GDK_Up:
case GDK_Down:
command_list_add(move_selected_command_new(_shapes, _dx, _dy));
_dx = _dy = 0;
break;
}
preview_thaw();
return FALSE;
}
static gboolean
key_press_cb(GtkWidget *widget, GdkEventKey *event)
{
gint handled = FALSE;
gboolean shift = event->state & GDK_SHIFT_MASK;
Command_t *command;
preview_freeze();
if (_timeout)
gtk_timeout_remove(_timeout);
switch (event->keyval) {
case GDK_Left:
move_selected_objects(-1, 0, shift);
handled = TRUE;
break;
case GDK_Right:
move_selected_objects(1, 0, shift);
handled = TRUE;
break;
case GDK_Up:
move_selected_objects(0, -1, shift);
handled = TRUE;
break;
case GDK_Down:
move_selected_objects(0, 1, shift);
handled = TRUE;
break;
case GDK_Tab:
if (shift)
command = select_prev_command_new(_shapes);
else
command = select_next_command_new(_shapes);
command_execute(command);
handled = TRUE;
break;
}
if (handled)
gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "key_press_event");
return handled;
}
static gboolean
key_release_cb(GtkWidget *widget, GdkEventKey *event)
{
_keyval = event->keyval;
_timeout = gtk_timeout_add(250, key_timeout_cb, NULL);
return FALSE;
}
static void static void
geometry_changed(Object_t *obj, gpointer data) geometry_changed(Object_t *obj, gpointer data)
{ {
redraw_preview(); redraw_preview(); /* Fix me! */
} }
#endif
static void static void
data_changed(Object_t *obj, gpointer data) data_changed(Object_t *obj, gpointer data)
@ -1286,7 +1327,6 @@ dialog(GDrawable *drawable)
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *main_vbox; GtkWidget *main_vbox;
Tools_t *tools; Tools_t *tools;
guchar *color_cube;
gchar **argv; gchar **argv;
gint argc = 1; gint argc = 1;
Menu_t *menu; Menu_t *menu;
@ -1300,13 +1340,9 @@ dialog(GDrawable *drawable)
gdk_set_use_xshm(gimp_use_xshm()); gdk_set_use_xshm(gimp_use_xshm());
gtk_preview_set_gamma(gimp_gamma()); gtk_preview_set_gamma(gimp_gamma());
gtk_preview_set_install_cmap(gimp_install_cmap());
color_cube = gimp_color_cube();
gtk_preview_set_color_cube(color_cube[0], color_cube[1],
color_cube[2], color_cube[3]);
gtk_widget_set_default_visual(gtk_preview_get_visual()); gtk_widget_set_default_visual(gtk_preview_get_visual());
gtk_widget_set_default_colormap(gtk_preview_get_cmap()); gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
_shapes = make_object_list(); _shapes = make_object_list();
@ -1319,6 +1355,11 @@ dialog(GDrawable *drawable)
gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_MOUSE); gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_MOUSE);
gtk_signal_connect(GTK_OBJECT(dlg), "destroy", gtk_signal_connect(GTK_OBJECT(dlg), "destroy",
(GtkSignalFunc) close_callback, NULL); (GtkSignalFunc) close_callback, NULL);
gtk_signal_connect(GTK_OBJECT(dlg), "key_press_event",
(GtkSignalFunc) key_press_cb, NULL);
gtk_signal_connect(GTK_OBJECT(dlg), "key_release_event",
(GtkSignalFunc) key_release_cb, NULL);
main_vbox = gtk_vbox_new(FALSE, 1); main_vbox = gtk_vbox_new(FALSE, 1);
gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 1); gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 1);
gtk_container_add(GTK_CONTAINER(dlg), main_vbox); gtk_container_add(GTK_CONTAINER(dlg), main_vbox);
@ -1394,7 +1435,7 @@ dialog(GDrawable *drawable)
add_preview_button_press_event(_preview, (GtkSignalFunc) button_press); add_preview_button_press_event(_preview, (GtkSignalFunc) button_press);
gtk_container_add(GTK_CONTAINER(hbox), _preview->window); gtk_container_add(GTK_CONTAINER(hbox), _preview->window);
/* object_list_add_changed_cb(_shapes, geometry_changed, NULL); */ object_list_add_geometry_cb(_shapes, geometry_changed, NULL);
object_list_add_update_cb(_shapes, data_changed, NULL); object_list_add_update_cb(_shapes, data_changed, NULL);
object_list_add_add_cb(_shapes, data_changed, NULL); object_list_add_add_cb(_shapes, data_changed, NULL);
object_list_add_remove_cb(_shapes, data_changed, NULL); object_list_add_remove_cb(_shapes, data_changed, NULL);

View file

@ -24,12 +24,9 @@
#ifndef _IMAP_MAIN_H #ifndef _IMAP_MAIN_H
#define _IMAP_MAIN_H #define _IMAP_MAIN_H
#include "gtk/gtk.h"
#include "imap_mru.h" #include "imap_mru.h"
#include "imap_object.h" #include "imap_object.h"
#include "imap_preferences.h" #include "imap_preferences.h"
#include "imap_preview.h"
typedef enum {NCSA, CERN, CSIM} MapFormat_t; typedef enum {NCSA, CERN, CSIM} MapFormat_t;
@ -55,7 +52,7 @@ GdkColor *get_yellow(void);
MRU_t *get_mru(void); MRU_t *get_mru(void);
MapInfo_t *get_map_info(void); MapInfo_t *get_map_info(void);
PreferencesData_t *get_preferences(void); PreferencesData_t *get_preferences(void);
GtkWidget *get_top_widget(void);
gint get_image_width(void); gint get_image_width(void);
gint get_image_height(void); gint get_image_height(void);
@ -91,7 +88,10 @@ void edit_shape(gint x, gint y);
void do_popup_menu(GdkEventButton *event); void do_popup_menu(GdkEventButton *event);
void draw_shapes(GtkWidget *preview); void draw_shapes(GtkWidget *preview);
void redraw_preview(void); void redraw_preview(void);
void preview_freeze(void);
void preview_thaw(void);
void show_url(void); void show_url(void);
void hide_url(void); void hide_url(void);

View file

@ -449,14 +449,14 @@ menu_build_mru_items(MRU_t *mru)
} }
i = 0; i = 0;
for (p = mru->list; p; p = p->next, i++) for (p = mru->list; p; p = p->next, i++) {
insert_item_with_label(_menu.file_menu, position++, (gchar*) p->data, insert_item_with_label(_menu.file_menu, position++, (gchar*) p->data,
menu_mru, p->data); menu_mru, p->data);
}
insert_separator(_menu.file_menu, position); insert_separator(_menu.file_menu, position);
_menu.nr_off_mru_items = i + 1; _menu.nr_off_mru_items = i + 1;
} }
void void
menu_select_arrow(void) menu_select_arrow(void)
{ {

View file

@ -25,8 +25,6 @@
#include "imap_mru.h" #include "imap_mru.h"
#define DEFAULT_MRU_SIZE 4
MRU_t* MRU_t*
mru_create(void) mru_create(void)
{ {
@ -85,9 +83,10 @@ mru_set_first(MRU_t *mru, const gchar *filename)
void void
mru_set_size(MRU_t *mru, gint size) mru_set_size(MRU_t *mru, gint size)
{ {
if (size < mru->max_size) { gint diff;
/* fix me */
} for (diff = g_list_length(mru->list) - size; diff > 0; diff--)
mru_remove_link(mru, g_list_last(mru->list));
mru->max_size = size; mru->max_size = size;
} }

View file

@ -28,6 +28,8 @@
#include "gtk/gtk.h" #include "gtk/gtk.h"
#define DEFAULT_MRU_SIZE 4
typedef struct { typedef struct {
GList *list; GList *list;
gint max_size; gint max_size;

View file

@ -152,6 +152,12 @@ object_list_remove_move_cb(ObjectList_t *list, gpointer id)
object_list_callback_remove(&list->move_cb, id); object_list_callback_remove(&list->move_cb, id);
} }
void
object_list_remove_geometry_cb(ObjectList_t *list, gpointer id)
{
object_list_callback_remove(&list->geometry_cb, id);
}
Object_t* Object_t*
object_init(Object_t *obj, ObjectClass_t *class) object_init(Object_t *obj, ObjectClass_t *class)
{ {
@ -216,7 +222,7 @@ object_clone(Object_t *obj)
return clone; return clone;
} }
Object_t* static Object_t*
object_copy(Object_t *src, Object_t *des) object_copy(Object_t *src, Object_t *des)
{ {
des->class = src->class; des->class = src->class;
@ -235,7 +241,8 @@ object_copy(Object_t *src, Object_t *des)
Object_t* Object_t*
object_assign(Object_t *obj, Object_t *des) object_assign(Object_t *obj, Object_t *des)
{ {
return obj->class->assign(obj, des); obj->class->assign(obj, des);
return object_copy(obj, des);
} }
void void
@ -271,6 +278,13 @@ object_unselect(Object_t *obj)
object_list_callback_call(&obj->list->select_cb, obj); object_list_callback_call(&obj->list->select_cb, obj);
} }
void
object_move(Object_t *obj, gint dx, gint dy)
{
obj->class->move(obj, dx, dy);
object_list_callback_call(&obj->list->geometry_cb, obj);
}
void void
object_remove(Object_t *obj) object_remove(Object_t *obj)
{ {
@ -343,6 +357,18 @@ object_emit_changed_signal(Object_t *obj)
object_list_callback_call(&obj->list->changed_cb, obj); object_list_callback_call(&obj->list->changed_cb, obj);
} }
void
object_emit_geometry_signal(Object_t *obj)
{
object_list_callback_call(&obj->list->geometry_cb, obj);
}
void
object_emit_update_signal(Object_t *obj)
{
object_list_callback_call(&obj->list->update_cb, obj);
}
GdkPixmap* GdkPixmap*
object_get_icon(Object_t *obj, GtkWidget *widget, GdkBitmap **mask) object_get_icon(Object_t *obj, GtkWidget *widget, GdkBitmap **mask)
{ {
@ -556,6 +582,17 @@ object_list_draw(ObjectList_t *list, GdkWindow *window)
object_draw((Object_t*) p->data, window); object_draw((Object_t*) p->data, window);
} }
void
object_list_draw_selected(ObjectList_t *list, GdkWindow *window)
{
GList *p;
for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data;
if (obj->selected)
object_draw(obj, window);
}
}
Object_t* Object_t*
object_list_find(ObjectList_t *list, gint x, gint y) object_list_find(ObjectList_t *list, gint x, gint y)
{ {
@ -706,6 +743,44 @@ object_list_select_all(ObjectList_t *list)
return count; return count;
} }
void
object_list_select_next(ObjectList_t *list)
{
GList *p;
for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data;
if (obj->selected) {
object_unselect(obj);
p = (p->next) ? p->next : list->list;
object_select((Object_t*) p->data);
for (p = p->next; p; p = p->next) {
obj = (Object_t*) p->data;
if (obj->selected)
object_unselect(obj);
}
break;
}
}
}
void object_list_select_prev(ObjectList_t *list)
{
GList *p;
for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data;
if (obj->selected) {
GList *q = (p->prev) ? p->prev : g_list_last(list->list);
for (; p; p = p->next) {
obj = (Object_t*) p->data;
if (obj->selected)
object_unselect(obj);
}
object_select((Object_t*) q->data);
break;
}
}
}
gint gint
object_list_select_region(ObjectList_t *list, gint x, gint y, gint width, object_list_select_region(ObjectList_t *list, gint x, gint y, gint width,
gint height) gint height)
@ -784,6 +859,17 @@ object_list_swap_next(ObjectList_t *list, GList *p)
object_list_callback_call(&list->move_cb, (Object_t*) p->next->data); object_list_callback_call(&list->move_cb, (Object_t*) p->next->data);
} }
void
object_list_move_selected(ObjectList_t *list, gint dx, gint dy)
{
GList *p;
for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data;
if (obj->selected)
object_move(obj, dx, dy);
}
}
void void
object_list_move_up(ObjectList_t *list, Object_t *obj) object_list_move_up(ObjectList_t *list, Object_t *obj)
{ {

View file

@ -54,6 +54,7 @@ typedef void (*OutputFunc_t)(gpointer, const char*, ...);
struct AreaInfoDialog_t; struct AreaInfoDialog_t;
struct ObjectClass_t { struct ObjectClass_t {
gchar *name;
AreaInfoDialog_t *info_dialog; AreaInfoDialog_t *info_dialog;
GdkPixmap *icon; GdkPixmap *icon;
GdkBitmap *mask; GdkBitmap *mask;
@ -61,7 +62,7 @@ struct ObjectClass_t {
gboolean (*is_valid)(Object_t *obj); gboolean (*is_valid)(Object_t *obj);
void (*destruct)(Object_t *obj); void (*destruct)(Object_t *obj);
Object_t* (*clone)(Object_t *obj); Object_t* (*clone)(Object_t *obj);
Object_t* (*assign)(Object_t *obj, Object_t *des); void (*assign)(Object_t *obj, Object_t *des);
void (*normalize)(Object_t *obj); void (*normalize)(Object_t *obj);
void (*draw)(Object_t *obj, GdkWindow *window, GdkGC* gc); void (*draw)(Object_t *obj, GdkWindow *window, GdkGC* gc);
void (*draw_sashes)(Object_t *obj, GdkWindow *window, GdkGC* gc); void (*draw_sashes)(Object_t *obj, GdkWindow *window, GdkGC* gc);
@ -71,7 +72,8 @@ struct ObjectClass_t {
gint *height); gint *height);
void (*resize)(Object_t *obj, gint percentage_x, gint percentage_y); void (*resize)(Object_t *obj, gint percentage_x, gint percentage_y);
void (*move)(Object_t *obj, gint dx, gint dy); void (*move)(Object_t *obj, gint dx, gint dy);
gpointer (*create_info_tab)(GtkWidget *notebook); gpointer (*create_info_widget)(GtkWidget *frame);
void (*update_info_widget)(Object_t *obj, gpointer data);
void (*fill_info_tab)(Object_t *obj, gpointer data); void (*fill_info_tab)(Object_t *obj, gpointer data);
void (*set_initial_focus)(Object_t *obj, gpointer data); void (*set_initial_focus)(Object_t *obj, gpointer data);
void (*update)(Object_t *obj, gpointer data); void (*update)(Object_t *obj, gpointer data);
@ -86,13 +88,13 @@ struct ObjectClass_t {
Object_t *object_ref(Object_t *obj); Object_t *object_ref(Object_t *obj);
void object_unref(Object_t *obj); void object_unref(Object_t *obj);
Object_t* object_init(Object_t *obj, ObjectClass_t *class); Object_t* object_init(Object_t *obj, ObjectClass_t *class);
Object_t* object_copy(Object_t *src, Object_t *des);
Object_t* object_clone(Object_t *obj); Object_t* object_clone(Object_t *obj);
Object_t* object_assign(Object_t *src, Object_t *des); Object_t* object_assign(Object_t *src, Object_t *des);
void object_draw(Object_t *obj, GdkWindow *window); void object_draw(Object_t *obj, GdkWindow *window);
void object_edit(Object_t *obj, gboolean add); void object_edit(Object_t *obj, gboolean add);
void object_select(Object_t *obj); void object_select(Object_t *obj);
void object_unselect(Object_t *obj); void object_unselect(Object_t *obj);
void object_move(Object_t *obj, gint dx, gint dy);
void object_remove(Object_t *obj); void object_remove(Object_t *obj);
void object_lock(Object_t *obj); void object_lock(Object_t *obj);
void object_unlock(Object_t *obj); void object_unlock(Object_t *obj);
@ -105,7 +107,10 @@ void object_set_focus(Object_t *obj, const gchar *focus);
void object_set_blur(Object_t *obj, const gchar *blur); void object_set_blur(Object_t *obj, const gchar *blur);
gint object_get_position_in_list(Object_t *obj); gint object_get_position_in_list(Object_t *obj);
GdkPixmap* object_get_icon(Object_t *obj, GtkWidget *widget, GdkBitmap **mask); GdkPixmap* object_get_icon(Object_t *obj, GtkWidget *widget, GdkBitmap **mask);
void object_emit_changed_signal(Object_t *obj); void object_emit_changed_signal(Object_t *obj);
void object_emit_geometry_signal(Object_t *obj);
void object_emit_update_signal(Object_t *obj);
#define object_is_valid(obj) \ #define object_is_valid(obj) \
((obj)->class->is_valid(obj)) ((obj)->class->is_valid(obj))
@ -116,15 +121,18 @@ void object_emit_changed_signal(Object_t *obj);
#define object_normalize(obj) \ #define object_normalize(obj) \
((obj)->class->normalize(obj)) ((obj)->class->normalize(obj))
#define object_move(obj, dx, dy) \
((obj)->class->move((obj), (dx), (dy)))
#define object_resize(obj, per_x, per_y) \ #define object_resize(obj, per_x, per_y) \
((obj)->class->resize((obj), (per_x), (per_y))) ((obj)->class->resize((obj), (per_x), (per_y)))
#define object_update(obj, data) \ #define object_update(obj, data) \
((obj)->class->update((obj), (data))) ((obj)->class->update((obj), (data)))
#define object_update_info_widget(obj, data) \
((obj)->class->update_info_widget((obj), (data)))
#define object_fill_info_tab(obj, data) \
((obj)->class->fill_info_tab((obj), (data)))
typedef struct { typedef struct {
Object_t *obj; Object_t *obj;
gboolean (*finish)(Object_t *obj, gint x, gint y); gboolean (*finish)(Object_t *obj, gint x, gint y);
@ -164,6 +172,7 @@ void object_list_remove(ObjectList_t *list, Object_t *object);
void object_list_remove_link(ObjectList_t *list, GList *link); void object_list_remove_link(ObjectList_t *list, GList *link);
void object_list_update(ObjectList_t *list, Object_t *object); void object_list_update(ObjectList_t *list, Object_t *object);
void object_list_draw(ObjectList_t *list, GdkWindow *window); void object_list_draw(ObjectList_t *list, GdkWindow *window);
void object_list_draw_selected(ObjectList_t *list, GdkWindow *window);
Object_t *object_list_find(ObjectList_t *list, gint x, gint y); Object_t *object_list_find(ObjectList_t *list, gint x, gint y);
Object_t *object_list_near_sash(ObjectList_t *list, gint x, gint y, Object_t *object_list_near_sash(ObjectList_t *list, gint x, gint y,
MoveSashFunc_t *sash_func); MoveSashFunc_t *sash_func);
@ -176,12 +185,15 @@ void object_list_remove_all(ObjectList_t *list);
void object_list_delete_selected(ObjectList_t *list); void object_list_delete_selected(ObjectList_t *list);
void object_list_edit_selected(ObjectList_t *list); void object_list_edit_selected(ObjectList_t *list);
gint object_list_select_all(ObjectList_t *list); gint object_list_select_all(ObjectList_t *list);
void object_list_select_next(ObjectList_t *list);
void object_list_select_prev(ObjectList_t *list);
gint object_list_select_region(ObjectList_t *list, gint x, gint y, gint width, gint object_list_select_region(ObjectList_t *list, gint x, gint y, gint width,
gint height); gint height);
gint object_list_deselect_all(ObjectList_t *list, Object_t *exception); gint object_list_deselect_all(ObjectList_t *list, Object_t *exception);
gint object_list_nr_selected(ObjectList_t *list); gint object_list_nr_selected(ObjectList_t *list);
void object_list_resize(ObjectList_t *list, gint percentage_x, void object_list_resize(ObjectList_t *list, gint percentage_x,
gint percentage_y); gint percentage_y);
void object_list_move_selected(ObjectList_t *list, gint dx, gint dy);
void object_list_move_up(ObjectList_t *list, Object_t *obj); void object_list_move_up(ObjectList_t *list, Object_t *obj);
void object_list_move_down(ObjectList_t *list, Object_t *obj); void object_list_move_down(ObjectList_t *list, Object_t *obj);
void object_list_move_selected_up(ObjectList_t *list); void object_list_move_selected_up(ObjectList_t *list);
@ -222,6 +234,7 @@ void object_list_remove_add_cb(ObjectList_t *list, gpointer id);
void object_list_remove_select_cb(ObjectList_t *list, gpointer id); void object_list_remove_select_cb(ObjectList_t *list, gpointer id);
void object_list_remove_remove_cb(ObjectList_t *list, gpointer id); void object_list_remove_remove_cb(ObjectList_t *list, gpointer id);
void object_list_remove_move_cb(ObjectList_t *list, gpointer id); void object_list_remove_move_cb(ObjectList_t *list, gpointer id);
void object_list_remove_geometry_cb(ObjectList_t *list, gpointer id);
#define object_list_clear_changed(list) ((list)->changed = FALSE) #define object_list_clear_changed(list) ((list)->changed = FALSE)
#define object_list_set_changed(list, ischanged) \ #define object_list_set_changed(list, ischanged) \

View file

@ -25,8 +25,8 @@
#include <stdio.h> #include <stdio.h>
#include "imap_cmd_delete_point.h" #include "imap_cmd_delete_point.h"
#include "imap_grid.h"
#include "imap_cmd_insert_point.h" #include "imap_cmd_insert_point.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_misc.h" #include "imap_misc.h"
#include "imap_object_popup.h" #include "imap_object_popup.h"
@ -40,7 +40,7 @@
static gboolean polygon_is_valid(Object_t *obj); static gboolean polygon_is_valid(Object_t *obj);
static void polygon_destruct(Object_t *obj); static void polygon_destruct(Object_t *obj);
static Object_t *polygon_clone(Object_t *obj); static Object_t *polygon_clone(Object_t *obj);
static Object_t *polygon_assign(Object_t *obj, Object_t *des); static void polygon_assign(Object_t *obj, Object_t *des);
static void polygon_draw(Object_t* obj, GdkWindow *window, GdkGC* gc); static void polygon_draw(Object_t* obj, GdkWindow *window, GdkGC* gc);
static void polygon_draw_sashes(Object_t* obj, GdkWindow *window, GdkGC* gc); static void polygon_draw_sashes(Object_t* obj, GdkWindow *window, GdkGC* gc);
static MoveSashFunc_t polygon_near_sash(Object_t *obj, gint x, gint y); static MoveSashFunc_t polygon_near_sash(Object_t *obj, gint x, gint y);
@ -50,7 +50,8 @@ static void polygon_get_dimensions(Object_t *obj, gint *x, gint *y,
static void polygon_resize(Object_t *obj, gint percentage_x, static void polygon_resize(Object_t *obj, gint percentage_x,
gint percentage_y); gint percentage_y);
static void polygon_move(Object_t *obj, gint dx, gint dy); static void polygon_move(Object_t *obj, gint dx, gint dy);
static gpointer polygon_create_info_tab(GtkWidget *notebook); static gpointer polygon_create_info_widget(GtkWidget *frame);
static void polygon_update_info_widget(Object_t *obj, gpointer data);
static void polygon_fill_info_tab(Object_t *obj, gpointer data); static void polygon_fill_info_tab(Object_t *obj, gpointer data);
static void polygon_set_initial_focus(Object_t *obj, gpointer data); static void polygon_set_initial_focus(Object_t *obj, gpointer data);
static void polygon_update(Object_t* obj, gpointer data); static void polygon_update(Object_t* obj, gpointer data);
@ -64,6 +65,7 @@ static void polygon_do_popup(Object_t *obj, GdkEventButton *event);
static char** polygon_get_icon_data(void); static char** polygon_get_icon_data(void);
static ObjectClass_t polygon_class = { static ObjectClass_t polygon_class = {
N_("Polygon"),
NULL, /* info_dialog */ NULL, /* info_dialog */
NULL, /* icon */ NULL, /* icon */
NULL, /* mask */ NULL, /* mask */
@ -80,7 +82,8 @@ static ObjectClass_t polygon_class = {
polygon_get_dimensions, polygon_get_dimensions,
polygon_resize, polygon_resize,
polygon_move, polygon_move,
polygon_create_info_tab, polygon_create_info_widget,
polygon_update_info_widget,
polygon_fill_info_tab, polygon_fill_info_tab,
polygon_set_initial_focus, polygon_set_initial_focus,
polygon_update, polygon_update,
@ -99,13 +102,19 @@ create_polygon(GList *points)
return object_init(&polygon->obj, &polygon_class); return object_init(&polygon->obj, &polygon_class);
} }
static void
polygon_free_list(Polygon_t *polygon)
{
g_list_foreach(polygon->points, (GFunc) g_free, NULL);
g_list_free(polygon->points);
polygon->points = NULL;
}
static void static void
polygon_destruct(Object_t *obj) polygon_destruct(Object_t *obj)
{ {
Polygon_t *polygon = ObjectToPolygon(obj); Polygon_t *polygon = ObjectToPolygon(obj);
polygon_free_list(polygon);
g_list_foreach(polygon->points, (GFunc) g_free, NULL);
g_list_free(polygon->points);
} }
static gboolean static gboolean
@ -130,19 +139,19 @@ polygon_clone(Object_t *obj)
return &clone->obj; return &clone->obj;
} }
static Object_t* static void
polygon_assign(Object_t *obj, Object_t *des) polygon_assign(Object_t *obj, Object_t *des)
{ {
Polygon_t *src_polygon = ObjectToPolygon(obj); Polygon_t *src_polygon = ObjectToPolygon(obj);
Polygon_t *des_polygon = ObjectToPolygon(des); Polygon_t *des_polygon = ObjectToPolygon(des);
GList *p; GList *p;
polygon_free_list(des_polygon);
for (p = src_polygon->points; p; p = p->next) { for (p = src_polygon->points; p; p = p->next) {
GdkPoint *point = (GdkPoint*) p->data; GdkPoint *point = (GdkPoint*) p->data;
des_polygon->points = g_list_append(des_polygon->points, des_polygon->points = g_list_append(des_polygon->points,
new_point(point->x, point->y)); new_point(point->x, point->y));
} }
return object_copy(obj, des);
} }
static void static void
@ -163,13 +172,14 @@ polygon_draw_sashes(Object_t *obj, GdkWindow *window, GdkGC *gc)
} }
} }
static GdkPoint *sash_point; static GdkPoint *_sash_point;
static gint _sash_index;
static void static void
move_sash(Object_t *obj, gint dx, gint dy) move_sash(Object_t *obj, gint dx, gint dy)
{ {
sash_point->x += dx; _sash_point->x += dx;
sash_point->y += dy; _sash_point->y += dy;
} }
static MoveSashFunc_t static MoveSashFunc_t
@ -177,10 +187,12 @@ polygon_near_sash(Object_t *obj, gint x, gint y)
{ {
Polygon_t *polygon = ObjectToPolygon(obj); Polygon_t *polygon = ObjectToPolygon(obj);
GList *p; GList *p;
for (p = polygon->points; p; p = p->next) {
_sash_index = 0;
for (p = polygon->points; p; p = p->next, _sash_index++) {
GdkPoint *point = (GdkPoint*) p->data; GdkPoint *point = (GdkPoint*) p->data;
if (near_sash(point->x, point->y, x, y)) { if (near_sash(point->x, point->y, x, y)) {
sash_point = point; _sash_point = point;
return move_sash; return move_sash;
} }
} }
@ -276,6 +288,7 @@ polygon_move(Object_t *obj, gint dx, gint dy)
} }
typedef struct { typedef struct {
Object_t *obj;
GtkWidget *list; GtkWidget *list;
GtkWidget *x; GtkWidget *x;
GtkWidget *y; GtkWidget *y;
@ -284,6 +297,7 @@ typedef struct {
GtkWidget *append; GtkWidget *append;
GtkWidget *remove; GtkWidget *remove;
gint selected_row; gint selected_row;
gint timeout;
} PolygonProperties_t; } PolygonProperties_t;
static void static void
@ -293,6 +307,8 @@ select_row_cb(GtkWidget *widget, gint row, gint column, GdkEventButton *event,
gchar *text; gchar *text;
data->selected_row = row; data->selected_row = row;
_sash_point = g_list_nth(ObjectToPolygon(data->obj)->points, row)->data;
gtk_clist_get_text(GTK_CLIST(data->list), row, 0, &text); gtk_clist_get_text(GTK_CLIST(data->list), row, 0, &text);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->x), atoi(text)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->x), atoi(text));
@ -345,20 +361,39 @@ remove_button_clicked(GtkWidget *widget, PolygonProperties_t *data)
set_buttons_sensitivity(data); set_buttons_sensitivity(data);
} }
static gpointer static void
polygon_create_info_tab(GtkWidget *notebook) x_changed_cb(GtkWidget *widget, gpointer data)
{ {
PolygonProperties_t *data = g_new(PolygonProperties_t, 1); Object_t *obj = ((PolygonProperties_t*) data)->obj;
GtkWidget *hbox, *swin, *table, *label; gint x = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
_sash_point->x = x;
edit_area_info_dialog_emit_geometry_signal(obj->class->info_dialog);
}
static void
y_changed_cb(GtkWidget *widget, gpointer data)
{
Object_t *obj = ((PolygonProperties_t*) data)->obj;
gint y = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
_sash_point->y = y;
edit_area_info_dialog_emit_geometry_signal(obj->class->info_dialog);
}
static gpointer
polygon_create_info_widget(GtkWidget *frame)
{
PolygonProperties_t *props = g_new(PolygonProperties_t, 1);
GtkWidget *hbox, *swin, *table;
GtkWidget *list; GtkWidget *list;
gint max_width = get_image_width(); gint max_width = get_image_width();
gint max_height = get_image_height(); gint max_height = get_image_height();
gchar *titles[] = {"x (pixels)", "y (pixels)"}; gchar *titles[] = {N_("x (pixels)"), N_("y (pixels)")};
hbox = gtk_hbox_new(FALSE, 1); hbox = gtk_hbox_new(FALSE, 1);
gtk_container_add(GTK_CONTAINER(frame), hbox);
gtk_widget_show(hbox); gtk_widget_show(hbox);
data->list = list = gtk_clist_new_with_titles(2, titles); props->list = list = gtk_clist_new_with_titles(2, titles);
gtk_clist_column_titles_passive(GTK_CLIST(list)); gtk_clist_column_titles_passive(GTK_CLIST(list));
swin = gtk_scrolled_window_new(NULL, NULL); swin = gtk_scrolled_window_new(NULL, NULL);
@ -379,7 +414,7 @@ polygon_create_info_tab(GtkWidget *notebook)
gtk_clist_set_column_justification(GTK_CLIST(list), 1, GTK_JUSTIFY_RIGHT); gtk_clist_set_column_justification(GTK_CLIST(list), 1, GTK_JUSTIFY_RIGHT);
gtk_signal_connect(GTK_OBJECT(list), "select_row", gtk_signal_connect(GTK_OBJECT(list), "select_row",
GTK_SIGNAL_FUNC(select_row_cb), data); GTK_SIGNAL_FUNC(select_row_cb), props);
gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_SINGLE); gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_SINGLE);
gtk_widget_show(list); gtk_widget_show(list);
@ -391,43 +426,71 @@ polygon_create_info_tab(GtkWidget *notebook)
gtk_widget_show(table); gtk_widget_show(table);
create_label_in_table(table, 0, 0, "x:"); create_label_in_table(table, 0, 0, "x:");
data->x = create_spin_button_in_table(table, 0, 1, 1, 0, max_width - 1); props->x = create_spin_button_in_table(table, 0, 1, 1, 0, max_width - 1);
gtk_widget_set_usize(data->x, 64, -1); gtk_signal_connect(GTK_OBJECT(props->x), "changed",
create_label_in_table(table, 0, 2, "pixels"); (GtkSignalFunc) x_changed_cb, (gpointer) props);
gtk_widget_set_usize(props->x, 64, -1);
create_label_in_table(table, 0, 2, _("pixels"));
create_label_in_table(table, 1, 0, "y:"); create_label_in_table(table, 1, 0, "y:");
data->y = create_spin_button_in_table(table, 1, 1, 1, 0, max_height - 1); props->y = create_spin_button_in_table(table, 1, 1, 1, 0, max_height - 1);
gtk_widget_set_usize(data->y, 64, -1); gtk_signal_connect(GTK_OBJECT(props->y), "changed",
create_label_in_table(table, 1, 2, "pixels"); (GtkSignalFunc) y_changed_cb, (gpointer) props);
gtk_widget_set_usize(props->y, 64, -1);
create_label_in_table(table, 1, 2, _("pixels"));
data->update = gtk_button_new_with_label("Update"); props->update = gtk_button_new_with_label(_("Update"));
gtk_signal_connect(GTK_OBJECT(data->update), "clicked", gtk_signal_connect(GTK_OBJECT(props->update), "clicked",
GTK_SIGNAL_FUNC(update_button_clicked), data); GTK_SIGNAL_FUNC(update_button_clicked), props);
gtk_table_attach_defaults(GTK_TABLE(table), data->update, 1, 2, 2, 3); gtk_table_attach_defaults(GTK_TABLE(table), props->update, 1, 2, 2, 3);
gtk_widget_show(data->update); gtk_widget_show(props->update);
data->insert = gtk_button_new_with_label("Insert"); props->insert = gtk_button_new_with_label(_("Insert"));
gtk_signal_connect(GTK_OBJECT(data->insert), "clicked", gtk_signal_connect(GTK_OBJECT(props->insert), "clicked",
GTK_SIGNAL_FUNC(insert_button_clicked), data); GTK_SIGNAL_FUNC(insert_button_clicked), props);
gtk_table_attach_defaults(GTK_TABLE(table), data->insert, 1, 2, 3, 4); gtk_table_attach_defaults(GTK_TABLE(table), props->insert, 1, 2, 3, 4);
gtk_widget_show(data->insert); gtk_widget_show(props->insert);
data->append = gtk_button_new_with_label("Append"); props->append = gtk_button_new_with_label(_("Append"));
gtk_signal_connect(GTK_OBJECT(data->append), "clicked", gtk_signal_connect(GTK_OBJECT(props->append), "clicked",
GTK_SIGNAL_FUNC(append_button_clicked), data); GTK_SIGNAL_FUNC(append_button_clicked), props);
gtk_table_attach_defaults(GTK_TABLE(table), data->append, 1, 2, 4, 5); gtk_table_attach_defaults(GTK_TABLE(table), props->append, 1, 2, 4, 5);
gtk_widget_show(data->append); gtk_widget_show(props->append);
data->remove = gtk_button_new_with_label("Remove"); props->remove = gtk_button_new_with_label(_("Remove"));
gtk_signal_connect(GTK_OBJECT(data->remove), "clicked", gtk_signal_connect(GTK_OBJECT(props->remove), "clicked",
GTK_SIGNAL_FUNC(remove_button_clicked), data); GTK_SIGNAL_FUNC(remove_button_clicked), props);
gtk_table_attach_defaults(GTK_TABLE(table), data->remove, 1, 2, 5, 6); gtk_table_attach_defaults(GTK_TABLE(table), props->remove, 1, 2, 5, 6);
gtk_widget_show(data->remove); gtk_widget_show(props->remove);
label = gtk_label_new("Polygon"); props->timeout = 0;
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), hbox, label);
return data; return props;
}
static gint
update_timeout(gpointer data)
{
PolygonProperties_t *props = (PolygonProperties_t*) data;
polygon_fill_info_tab(props->obj, data);
return FALSE;
}
static void
polygon_update_info_widget(Object_t *obj, gpointer data)
{
PolygonProperties_t *props = (PolygonProperties_t*) data;
gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->x), _sash_point->x);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->y), _sash_point->y);
if (props->selected_row != _sash_index) {
props->selected_row = _sash_index;
gtk_clist_select_row(GTK_CLIST(props->list), _sash_index, -1);
}
if (props->timeout)
gtk_timeout_remove(props->timeout);
props->timeout = gtk_timeout_add(1000, update_timeout, data);
} }
static void static void
@ -437,6 +500,7 @@ polygon_fill_info_tab(Object_t *obj, gpointer data)
PolygonProperties_t *props = (PolygonProperties_t*) data; PolygonProperties_t *props = (PolygonProperties_t*) data;
GList *p; GList *p;
props->obj = obj;
gtk_clist_freeze(GTK_CLIST(props->list)); gtk_clist_freeze(GTK_CLIST(props->list));
gtk_clist_clear(GTK_CLIST(props->list)); gtk_clist_clear(GTK_CLIST(props->list));
for (p = polygon->points; p; p = p->next) { for (p = polygon->points; p; p = p->next) {
@ -446,12 +510,11 @@ polygon_fill_info_tab(Object_t *obj, gpointer data)
text[0] = x; text[0] = x;
text[1] = y; text[1] = y;
sprintf(x, "%d", point->x); sprintf(x, "%d", point->x);
sprintf(y, "%d", point->y); sprintf(y, "%d", point->y);
gtk_clist_append(GTK_CLIST(props->list), text); gtk_clist_append(GTK_CLIST(props->list), text);
} }
gtk_clist_select_row(GTK_CLIST(props->list), 0, -1); gtk_clist_select_row(GTK_CLIST(props->list), _sash_index, -1);
gtk_clist_thaw(GTK_CLIST(props->list)); gtk_clist_thaw(GTK_CLIST(props->list));
set_buttons_sensitivity(props); set_buttons_sensitivity(props);
@ -548,7 +611,7 @@ static void
polygon_delete_point(GtkWidget *widget, gpointer data) polygon_delete_point(GtkWidget *widget, gpointer data)
{ {
Command_t *command = delete_point_command_new(get_popup_object(), Command_t *command = delete_point_command_new(get_popup_object(),
sash_point); _sash_point);
command_execute(command); command_execute(command);
} }
@ -599,7 +662,7 @@ polygon_do_popup(Object_t *obj, GdkEventButton *event)
static ObjectPopup_t *delete_popup; static ObjectPopup_t *delete_popup;
if (!delete_popup) { if (!delete_popup) {
delete_popup = make_object_popup(); delete_popup = make_object_popup();
object_popup_prepend_menu(delete_popup, "Delete Point", object_popup_prepend_menu(delete_popup, _("Delete Point"),
polygon_delete_point, delete_popup); polygon_delete_point, delete_popup);
} }
object_handle_popup(delete_popup, obj, event); object_handle_popup(delete_popup, obj, event);
@ -613,7 +676,7 @@ polygon_do_popup(Object_t *obj, GdkEventButton *event)
if (!insert_popup) { if (!insert_popup) {
insert_popup = make_object_popup(); insert_popup = make_object_popup();
object_popup_prepend_menu(insert_popup, "Insert Point", object_popup_prepend_menu(insert_popup, _("Insert Point"),
polygon_insert_point, insert_popup); polygon_insert_point, insert_popup);
} }
object_handle_popup(insert_popup, obj, event); object_handle_popup(insert_popup, obj, event);

View file

@ -25,9 +25,14 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "libgimp/gimpenv.h"
#include "imap_command.h"
#include "imap_file.h" #include "imap_file.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_menu.h"
#include "imap_misc.h" #include "imap_misc.h"
#include "imap_mru.h"
#include "imap_preferences.h" #include "imap_preferences.h"
#include "imap_table.h" #include "imap_table.h"
@ -100,6 +105,10 @@ parse_line(PreferencesData_t *data, char *line)
data->show_url_tip = parse_yes_no(); data->show_url_tip = parse_yes_no();
} else if (!strcmp(token, "use-doublesized")) { } else if (!strcmp(token, "use-doublesized")) {
data->use_doublesized = parse_yes_no(); data->use_doublesized = parse_yes_no();
} else if (!strcmp(token, "mru-size")) {
data->mru_size = parse_int();
} else if (!strcmp(token, "undo-levels")) {
data->undo_levels = parse_int();
} else if (!strcmp(token, "normal-fg-color")) { } else if (!strcmp(token, "normal-fg-color")) {
parse_color(&colors->normal_fg); parse_color(&colors->normal_fg);
} else if (!strcmp(token, "normal-bg-color")) { } else if (!strcmp(token, "normal-bg-color")) {
@ -110,8 +119,6 @@ parse_line(PreferencesData_t *data, char *line)
parse_color(&colors->selected_bg); parse_color(&colors->selected_bg);
} else if (!strcmp(token, "mru-entry")) { } else if (!strcmp(token, "mru-entry")) {
parse_mru_entry(); parse_mru_entry();
} else if (!strcmp(token, "mru-size")) {
data->mru_size = parse_int();
} else { } else {
/* Unrecognized, just ignore rest of line */ /* Unrecognized, just ignore rest of line */
} }
@ -124,7 +131,7 @@ preferences_load(PreferencesData_t *data)
char buf[256]; char buf[256];
gchar *filename; gchar *filename;
filename = g_strconcat(getenv("HOME"), "/.gimp/imagemaprc", NULL); filename = g_strconcat(gimp_directory(), "/imagemaprc", NULL);
in = fopen(filename, "r"); in = fopen(filename, "r");
g_free(filename); g_free(filename);
@ -147,7 +154,7 @@ preferences_save(PreferencesData_t *data)
gchar *filename; gchar *filename;
ColorSelData_t *colors = &data->colors; ColorSelData_t *colors = &data->colors;
filename = g_strconcat(getenv("HOME"), "/.gimp/imagemaprc", NULL); filename = g_strconcat(gimp_directory(), "/imagemaprc", NULL);
out = fopen(filename, "w"); out = fopen(filename, "w");
if (out) { if (out) {
@ -171,6 +178,10 @@ preferences_save(PreferencesData_t *data)
(data->show_url_tip) ? "yes" : "no"); (data->show_url_tip) ? "yes" : "no");
fprintf(out, "(use-doublesized %s)\n", fprintf(out, "(use-doublesized %s)\n",
(data->use_doublesized) ? "yes" : "no"); (data->use_doublesized) ? "yes" : "no");
fprintf(out, "(undo-levels %d)\n", data->undo_levels);
fprintf(out, "(mru-size %d)\n", data->mru_size);
fprintf(out, "(normal-fg-color %d %d %d)\n", fprintf(out, "(normal-fg-color %d %d %d)\n",
colors->normal_fg.red, colors->normal_fg.green, colors->normal_fg.red, colors->normal_fg.green,
colors->normal_fg.blue); colors->normal_fg.blue);
@ -199,6 +210,7 @@ preferences_ok_cb(gpointer data)
PreferencesDialog_t *param = (PreferencesDialog_t*) data; PreferencesDialog_t *param = (PreferencesDialog_t*) data;
PreferencesData_t *old_data = param->old_data; PreferencesData_t *old_data = param->old_data;
ColorSelData_t *colors = &old_data->colors; ColorSelData_t *colors = &old_data->colors;
MRU_t *mru = get_mru();
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(param->cern))) if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(param->cern)))
old_data->default_map_type = CERN; old_data->default_map_type = CERN;
@ -220,6 +232,14 @@ preferences_ok_cb(gpointer data)
old_data->use_doublesized = gtk_toggle_button_get_active( old_data->use_doublesized = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(param->use_doublesized)); GTK_TOGGLE_BUTTON(param->use_doublesized));
old_data->mru_size =
gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(param->mru_size));
old_data->undo_levels =
gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(param->undo_levels));
mru_set_size(mru, old_data->mru_size);
menu_build_mru_items(mru);
command_list_set_undo_level(old_data->undo_levels);
*colors = param->new_colors; *colors = param->new_colors;
gdk_gc_set_foreground(old_data->normal_gc, &colors->normal_fg); gdk_gc_set_foreground(old_data->normal_gc, &colors->normal_fg);
@ -446,6 +466,33 @@ create_general_tab(PreferencesDialog_t *data, GtkWidget *notebook)
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label);
} }
static void
create_menu_tab(PreferencesDialog_t *data, GtkWidget *notebook)
{
GtkWidget *table;
GtkWidget *label;
GtkWidget *vbox;
vbox = gtk_vbox_new(FALSE, 1);
gtk_widget_show(vbox);
table = gtk_table_new(2, 2, FALSE);
gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(table), 10);
gtk_table_set_row_spacings(GTK_TABLE(table), 10);
gtk_table_set_col_spacings(GTK_TABLE(table), 10);
gtk_widget_show(table);
create_label_in_table(table, 0, 0, "Number of Undo levels (1 - 99):");
data->undo_levels = create_spin_button_in_table(table, 0, 1, 1, 1, 99);
create_label_in_table(table, 1, 0, "Number of MRU entries (1 - 16):");
data->mru_size = create_spin_button_in_table(table, 1, 1, 1, 1, 16);
label = gtk_label_new("Menu");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label);
}
static GtkWidget* static GtkWidget*
create_color_field(PreferencesDialog_t *data, GtkWidget *table, gint row, create_color_field(PreferencesDialog_t *data, GtkWidget *table, gint row,
gint col, GtkSignalFunc func) gint col, GtkSignalFunc func)
@ -498,7 +545,7 @@ static void
switch_page(GtkWidget *widget, GtkNotebookPage *page, gint page_num, switch_page(GtkWidget *widget, GtkNotebookPage *page, gint page_num,
gpointer data) gpointer data)
{ {
if (page_num == 1) { if (page_num == 2) {
PreferencesDialog_t *param = (PreferencesDialog_t*) data; PreferencesDialog_t *param = (PreferencesDialog_t*) data;
set_button_colors(param, &param->old_colors); set_button_colors(param, &param->old_colors);
} }
@ -523,6 +570,7 @@ create_preferences_dialog()
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->dialog)->vbox), gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->dialog)->vbox),
notebook, TRUE, TRUE, 10); notebook, TRUE, TRUE, 10);
create_general_tab(data, notebook); create_general_tab(data, notebook);
create_menu_tab(data, notebook);
create_colors_tab(data, notebook); create_colors_tab(data, notebook);
gtk_widget_show(notebook); gtk_widget_show(notebook);
@ -566,5 +614,10 @@ do_preferences_dialog(void)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->use_doublesized), gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->use_doublesized),
old_data->use_doublesized); old_data->use_doublesized);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->undo_levels),
old_data->undo_levels);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->mru_size),
old_data->mru_size);
default_dialog_show(dialog->dialog); default_dialog_show(dialog->dialog);
} }

View file

@ -41,6 +41,7 @@ typedef struct {
gboolean keep_circles_round; gboolean keep_circles_round;
gboolean show_url_tip; gboolean show_url_tip;
gboolean use_doublesized; gboolean use_doublesized;
gint undo_levels;
gint mru_size; gint mru_size;
ColorSelData_t colors; ColorSelData_t colors;
GdkGC *normal_gc; GdkGC *normal_gc;
@ -59,6 +60,10 @@ typedef struct {
GtkWidget *keep_circles_round; GtkWidget *keep_circles_round;
GtkWidget *show_url_tip; GtkWidget *show_url_tip;
GtkWidget *use_doublesized; GtkWidget *use_doublesized;
GtkWidget *undo_levels;
GtkWidget *mru_size;
GtkWidget *normal_fg; GtkWidget *normal_fg;
GtkWidget *normal_bg; GtkWidget *normal_bg;
GtkWidget *selected_fg; GtkWidget *selected_fg;

View file

@ -23,10 +23,10 @@
#include "libgimp/gimp.h" #include "libgimp/gimp.h"
#include "imap_cmd_edit_object.h"
#include "imap_grid.h" #include "imap_grid.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_preview.h" #include "imap_preview.h"
#include "imap_rectangle.h"
#define PREVIEW_MASK GDK_EXPOSURE_MASK | \ #define PREVIEW_MASK GDK_EXPOSURE_MASK | \
GDK_MOTION_NOTIFY | \ GDK_MOTION_NOTIFY | \
@ -338,13 +338,43 @@ preview_zoom(Preview_t *preview, gint zoom_factor)
preview_redraw(preview); preview_redraw(preview);
} }
void GdkCursorType
preview_set_cursor(Preview_t *preview, GdkCursorType cursor_type) preview_set_cursor(Preview_t *preview, GdkCursorType cursor_type)
{ {
GdkCursorType prev_cursor = preview->cursor;
GdkCursor *cursor = gdk_cursor_new(cursor_type); GdkCursor *cursor = gdk_cursor_new(cursor_type);
gdk_window_set_cursor(preview->window->window, cursor); gdk_window_set_cursor(preview->window->window, cursor);
gdk_cursor_destroy(cursor); gdk_cursor_destroy(cursor);
gdk_flush(); gdk_flush();
preview->cursor = cursor_type;
return prev_cursor;
}
static GtkTargetEntry target_table[] = {
{"STRING", 0, 1 },
{"text/plain", 0, 2 }
};
static void
handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
GtkSelectionData *data, guint info, guint time)
{
gboolean success = FALSE;
if (data->length >= 0 && data->format == 8) {
ObjectList_t *list = get_shapes();
Object_t *obj;
x = get_real_coord(x);
y = get_real_coord(y);
obj = object_list_find(list, x, y);
if (obj && !obj->locked) {
command_list_add(edit_object_command_new(obj));
object_set_url(obj, data->data);
object_emit_update_signal(obj);
success = TRUE;
}
}
gtk_drag_finish(context, success, FALSE, time);
} }
Preview_t* Preview_t*
@ -367,6 +397,12 @@ make_preview(GDrawable *drawable)
(GtkSignalFunc) preview_expose, (GtkSignalFunc) preview_expose,
data); data);
/* Handle drop of links in preview widget */
gtk_drag_dest_set(preview, GTK_DEST_DEFAULT_ALL, target_table,
2, GDK_ACTION_COPY);
gtk_signal_connect(GTK_OBJECT(preview), "drag_data_received",
GTK_SIGNAL_FUNC(handle_drop), NULL);
data->width = gimp_drawable_width(drawable->id); data->width = gimp_drawable_width(drawable->id);
data->height = gimp_drawable_height(drawable->id); data->height = gimp_drawable_height(drawable->id);
gtk_preview_size(GTK_PREVIEW(preview), data->width, data->height); gtk_preview_size(GTK_PREVIEW(preview), data->width, data->height);

View file

@ -38,6 +38,8 @@ typedef struct {
gint height; gint height;
gint exp_id; gint exp_id;
GPixelRgn src_rgn; GPixelRgn src_rgn;
GdkCursorType cursor;
} Preview_t; } Preview_t;
Preview_t *make_preview(GDrawable *drawable); Preview_t *make_preview(GDrawable *drawable);
@ -52,6 +54,7 @@ gint preview_get_width(GtkWidget *preview);
gint preview_get_height(GtkWidget *preview); gint preview_get_height(GtkWidget *preview);
void preview_zoom(Preview_t *preview, gint zoom_factor); void preview_zoom(Preview_t *preview, gint zoom_factor);
void preview_set_cursor(Preview_t *preview, GdkCursorType cursor_type); GdkCursorType preview_set_cursor(Preview_t *preview,
GdkCursorType cursor_type);
#endif /* _IMAP_PREVIEW_H */ #endif /* _IMAP_PREVIEW_H */

View file

@ -21,6 +21,7 @@
* *
*/ */
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_misc.h" #include "imap_misc.h"
#include "imap_object_popup.h" #include "imap_object_popup.h"
@ -31,7 +32,7 @@
static gboolean rectangle_is_valid(Object_t *obj); static gboolean rectangle_is_valid(Object_t *obj);
static Object_t *rectangle_clone(Object_t *obj); static Object_t *rectangle_clone(Object_t *obj);
static Object_t *rectangle_assign(Object_t *obj, Object_t *des); static void rectangle_assign(Object_t *obj, Object_t *des);
static void rectangle_normalize(Object_t *obj); static void rectangle_normalize(Object_t *obj);
static void rectangle_draw(Object_t *obj, GdkWindow *window, GdkGC* gc); static void rectangle_draw(Object_t *obj, GdkWindow *window, GdkGC* gc);
static void rectangle_draw_sashes(Object_t *obj, GdkWindow *window, GdkGC* gc); static void rectangle_draw_sashes(Object_t *obj, GdkWindow *window, GdkGC* gc);
@ -42,7 +43,7 @@ static void rectangle_get_dimensions(Object_t *obj, gint *x, gint *y,
static void rectangle_resize(Object_t *obj, gint percentage_x, static void rectangle_resize(Object_t *obj, gint percentage_x,
gint percentage_y); gint percentage_y);
static void rectangle_move(Object_t *obj, gint dx, gint dy); static void rectangle_move(Object_t *obj, gint dx, gint dy);
static gpointer rectangle_create_info_tab(GtkWidget *notebook); static gpointer rectangle_create_info_widget(GtkWidget *frame);
static void rectangle_fill_info_tab(Object_t *obj, gpointer data); static void rectangle_fill_info_tab(Object_t *obj, gpointer data);
static void rectangle_set_initial_focus(Object_t *obj, gpointer data); static void rectangle_set_initial_focus(Object_t *obj, gpointer data);
static void rectangle_update(Object_t *obj, gpointer data); static void rectangle_update(Object_t *obj, gpointer data);
@ -55,6 +56,7 @@ static void rectangle_write_ncsa(Object_t *obj, gpointer param,
static char** rectangle_get_icon_data(void); static char** rectangle_get_icon_data(void);
static ObjectClass_t rectangle_class = { static ObjectClass_t rectangle_class = {
N_("Rectangle"),
NULL, /* info_dialog */ NULL, /* info_dialog */
NULL, /* icon */ NULL, /* icon */
NULL, /* mask */ NULL, /* mask */
@ -71,7 +73,8 @@ static ObjectClass_t rectangle_class = {
rectangle_get_dimensions, rectangle_get_dimensions,
rectangle_resize, rectangle_resize,
rectangle_move, rectangle_move,
rectangle_create_info_tab, rectangle_create_info_widget,
rectangle_fill_info_tab, /* rectangle_update_info_widget */
rectangle_fill_info_tab, rectangle_fill_info_tab,
rectangle_set_initial_focus, rectangle_set_initial_focus,
rectangle_update, rectangle_update,
@ -128,7 +131,7 @@ rectangle_clone(Object_t *obj)
return &clone->obj; return &clone->obj;
} }
static Object_t* static void
rectangle_assign(Object_t *obj, Object_t *des) rectangle_assign(Object_t *obj, Object_t *des)
{ {
Rectangle_t *src_rectangle = ObjectToRectangle(obj); Rectangle_t *src_rectangle = ObjectToRectangle(obj);
@ -137,7 +140,6 @@ rectangle_assign(Object_t *obj, Object_t *des)
des_rectangle->y = src_rectangle->y; des_rectangle->y = src_rectangle->y;
des_rectangle->width = src_rectangle->width; des_rectangle->width = src_rectangle->width;
des_rectangle->height = src_rectangle->height; des_rectangle->height = src_rectangle->height;
return object_copy(obj, des);
} }
static void static void
@ -317,58 +319,81 @@ typedef struct {
GtkWidget *height; GtkWidget *height;
} RectangleProperties_t; } RectangleProperties_t;
#ifdef _NOT_READY_YET_
static void static void
x_changed_cb(GtkWidget *widget, gpointer data) x_changed_cb(GtkWidget *widget, gpointer data)
{ {
Object_t *obj = ((RectangleProperties_t*) data)->obj; Object_t *obj = ((RectangleProperties_t*) data)->obj;
gint x = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); gint x = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
ObjectToRectangle(obj)->x = x; ObjectToRectangle(obj)->x = x;
object_emit_changed_signal(obj); edit_area_info_dialog_emit_geometry_signal(obj->class->info_dialog);
}
static void
y_changed_cb(GtkWidget *widget, gpointer data)
{
Object_t *obj = ((RectangleProperties_t*) data)->obj;
gint y = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
ObjectToRectangle(obj)->y = y;
edit_area_info_dialog_emit_geometry_signal(obj->class->info_dialog);
}
static void
width_changed_cb(GtkWidget *widget, gpointer data)
{
Object_t *obj = ((RectangleProperties_t*) data)->obj;
gint width = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
ObjectToRectangle(obj)->width = width;
edit_area_info_dialog_emit_geometry_signal(obj->class->info_dialog);
}
static void
height_changed_cb(GtkWidget *widget, gpointer data)
{
Object_t *obj = ((RectangleProperties_t*) data)->obj;
gint height = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
ObjectToRectangle(obj)->height = height;
edit_area_info_dialog_emit_geometry_signal(obj->class->info_dialog);
} }
#endif
static gpointer static gpointer
rectangle_create_info_tab(GtkWidget *notebook) rectangle_create_info_widget(GtkWidget *frame)
{ {
RectangleProperties_t *props = g_new(RectangleProperties_t, 1); RectangleProperties_t *props = g_new(RectangleProperties_t, 1);
GtkWidget *vbox, *table, *label; GtkWidget *table;
gint max_width = get_image_width(); gint max_width = get_image_width();
gint max_height = get_image_height(); gint max_height = get_image_height();
vbox = gtk_vbox_new(FALSE, 1); table = gtk_table_new(4, 3, FALSE);
gtk_widget_show(vbox); gtk_container_add(GTK_CONTAINER(frame), table);
table = gtk_table_new(5, 3, FALSE);
gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(table), 10); gtk_container_set_border_width(GTK_CONTAINER(table), 10);
gtk_table_set_row_spacings(GTK_TABLE(table), 10); gtk_table_set_row_spacings(GTK_TABLE(table), 10);
gtk_table_set_col_spacings(GTK_TABLE(table), 10); gtk_table_set_col_spacings(GTK_TABLE(table), 10);
gtk_widget_show(table); gtk_widget_show(table);
create_label_in_table(table, 0, 0, "Upper left x:"); create_label_in_table(table, 0, 0, _("Upper left x:"));
props->x = create_spin_button_in_table(table, 0, 1, 1, 0, max_width - 1); props->x = create_spin_button_in_table(table, 0, 1, 1, 0, max_width - 1);
/* gtk_signal_connect(GTK_OBJECT(props->x), "changed", gtk_signal_connect(GTK_OBJECT(props->x), "changed",
(GtkSignalFunc) x_changed_cb, (gpointer) props); */ (GtkSignalFunc) x_changed_cb, (gpointer) props);
create_label_in_table(table, 0, 2, "pixels"); create_label_in_table(table, 0, 2, _("pixels"));
create_label_in_table(table, 1, 0, "Upper left y:"); create_label_in_table(table, 1, 0, _("Upper left y:"));
props->y = create_spin_button_in_table(table, 1, 1, 1, 0, max_height - 1); props->y = create_spin_button_in_table(table, 1, 1, 1, 0, max_height - 1);
create_label_in_table(table, 1, 2, "pixels"); gtk_signal_connect(GTK_OBJECT(props->y), "changed",
(GtkSignalFunc) y_changed_cb, (gpointer) props);
create_label_in_table(table, 1, 2, _("pixels"));
create_label_in_table(table, 2, 0, "Width:"); create_label_in_table(table, 2, 0, _("Width:"));
props->width = create_spin_button_in_table(table, 2, 1, 1, 1, max_width); props->width = create_spin_button_in_table(table, 2, 1, 1, 1, max_width);
create_label_in_table(table, 2, 2, "pixels"); gtk_signal_connect(GTK_OBJECT(props->width), "changed",
(GtkSignalFunc) width_changed_cb, (gpointer) props);
create_label_in_table(table, 2, 2, _("pixels"));
create_label_in_table(table, 3, 0, "Height:"); create_label_in_table(table, 3, 0, _("Height:"));
props->height = create_spin_button_in_table(table, 3, 1, 1, 1, max_height); props->height = create_spin_button_in_table(table, 3, 1, 1, 1, max_height);
create_label_in_table(table, 3, 2, "pixels"); gtk_signal_connect(GTK_OBJECT(props->height), "changed",
(GtkSignalFunc) height_changed_cb, (gpointer) props);
/* create_check_button_in_table(table, 4, 0, "Preview");*/ create_label_in_table(table, 3, 2, _("pixels"));
label = gtk_label_new("Rectangle");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label);
return props; return props;
} }

View file

@ -23,10 +23,12 @@
#include <stdio.h> #include <stdio.h>
#include "imap_cmd_edit_object.h"
#include "imap_cmd_select.h" #include "imap_cmd_select.h"
#include "imap_cmd_unselect.h" #include "imap_cmd_unselect.h"
#include "imap_cmd_unselect_all.h" #include "imap_cmd_unselect_all.h"
#include "imap_edit_area_info.h" #include "imap_edit_area_info.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_misc.h" #include "imap_misc.h"
#include "imap_selection.h" #include "imap_selection.h"
@ -62,14 +64,16 @@ select_row_cb(GtkWidget *widget, gint row, gint column, GdkEventButton *event,
{ {
data->selected_child = widget; data->selected_child = widget;
data->selected_row = row; data->selected_row = row;
set_buttons(data); set_buttons(data);
if (data->select_lock) { if (data->select_lock) {
data->select_lock = FALSE; data->select_lock = FALSE;
} else { } else {
Object_t *obj = gtk_clist_get_row_data(GTK_CLIST(data->list), row); Object_t *obj = gtk_clist_get_row_data(GTK_CLIST(data->list), row);
Command_t *command; Command_t *command;
if (event->state & GDK_SHIFT_MASK) { /* Note: event can be NULL if select_row_cb is called as a result of
a key press! */
if (event && event->state & GDK_SHIFT_MASK) {
command = select_command_new(obj); command = select_command_new(obj);
} else { } else {
Command_t *sub_command; Command_t *sub_command;
@ -104,6 +108,39 @@ unselect_row_cb(GtkWidget *widget, gint row, gint column,
set_buttons(data); set_buttons(data);
} }
static void
row_move_cb(GtkWidget *widget, gint src, gint des)
{
printf("move: %d %d\n", src, des);
}
static gboolean doubleclick;
static void
button_press_cb(GtkWidget *widget, GdkEventButton *event, Selection_t *data)
{
if (event->button == 1) {
if (doubleclick) {
gint row, column;
doubleclick = FALSE;
if (gtk_clist_get_selection_info(GTK_CLIST(widget), (gint) event->x,
(gint) event->y, &row, &column)) {
Object_t *obj = gtk_clist_get_row_data(GTK_CLIST(data->list), row);
object_edit(obj, TRUE);
}
} else {
doubleclick = TRUE;
}
}
}
static void
button_release_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
if (event->button == 1)
doubleclick = FALSE;
}
static void static void
selection_command(GtkWidget *widget, gpointer data) selection_command(GtkWidget *widget, gpointer data)
{ {
@ -264,6 +301,32 @@ toggle_order(GtkWidget *widget, gint column, gpointer data)
/* Fix me! */ /* Fix me! */
} }
static GtkTargetEntry target_table[] = {
{"STRING", 0, 1 },
{"text/plain", 0, 2 }
};
static void
handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
GtkSelectionData *data, guint info, guint time)
{
gboolean success = FALSE;
if (data->length >= 0 && data->format == 8) {
gint row, column;
if (gtk_clist_get_selection_info(GTK_CLIST(widget), x, y, &row,
&column)) {
Object_t *obj = gtk_clist_get_row_data(GTK_CLIST(widget), row + 1);
if (!obj->locked) {
command_list_add(edit_object_command_new(obj));
object_set_url(obj, data->data);
object_emit_update_signal(obj);
success = TRUE;
}
}
}
gtk_drag_finish(context, success, FALSE, time);
}
Selection_t* Selection_t*
make_selection(GtkWidget *window, ObjectList_t *object_list) make_selection(GtkWidget *window, ObjectList_t *object_list)
{ {
@ -271,7 +334,7 @@ make_selection(GtkWidget *window, ObjectList_t *object_list)
GtkWidget *swin, *frame, *hbox; GtkWidget *swin, *frame, *hbox;
GtkWidget *toolbar; GtkWidget *toolbar;
GtkWidget *list; GtkWidget *list;
gchar *titles[] = {"#", "URL", "Target", "Comment"}; gchar *titles[] = {"#", N_("URL"), N_("Target"), N_("Comment")};
data->object_list = object_list; data->object_list = object_list;
data->selected_child = NULL; data->selected_child = NULL;
@ -292,21 +355,20 @@ make_selection(GtkWidget *window, ObjectList_t *object_list)
gtk_container_add(GTK_CONTAINER(hbox), toolbar); gtk_container_add(GTK_CONTAINER(hbox), toolbar);
/* Create selection */ /* Create selection */
frame = gtk_frame_new("Selection"); frame = gtk_frame_new(_("Selection"));
gtk_container_set_border_width(GTK_CONTAINER(frame), 10); gtk_container_set_border_width(GTK_CONTAINER(frame), 10);
gtk_container_add(GTK_CONTAINER(hbox), frame); gtk_container_add(GTK_CONTAINER(hbox), frame);
gtk_widget_show(frame); gtk_widget_show(frame);
data->list = list = gtk_clist_new_with_titles(4, titles); data->list = list = gtk_clist_new_with_titles(4, titles);
GTK_WIDGET_UNSET_FLAGS(data->list, GTK_CAN_FOCUS);
gtk_clist_column_titles_passive(GTK_CLIST(list)); gtk_clist_column_titles_passive(GTK_CLIST(list));
gtk_clist_column_title_active(GTK_CLIST(list), 0); gtk_clist_column_title_active(GTK_CLIST(list), 0);
gtk_clist_set_column_width(GTK_CLIST(list), 0, 16); gtk_clist_set_column_width(GTK_CLIST(list), 0, 16);
gtk_clist_set_column_width(GTK_CLIST(list), 1, 80); gtk_clist_set_column_width(GTK_CLIST(list), 1, 80);
gtk_clist_set_column_width(GTK_CLIST(list), 2, 64); gtk_clist_set_column_width(GTK_CLIST(list), 2, 64);
gtk_clist_set_column_width(GTK_CLIST(list), 3, 64); gtk_clist_set_column_width(GTK_CLIST(list), 3, 64);
gtk_clist_set_reorderable(GTK_CLIST(list), TRUE);
gtk_signal_connect(GTK_OBJECT(list), "click_column",
GTK_SIGNAL_FUNC(toggle_order), (gpointer) data);
/* Create scrollable window */ /* Create scrollable window */
swin = gtk_scrolled_window_new(NULL, NULL); swin = gtk_scrolled_window_new(NULL, NULL);
@ -315,19 +377,35 @@ make_selection(GtkWidget *window, ObjectList_t *object_list)
gtk_widget_show(swin); gtk_widget_show(swin);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swin), list); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swin), list);
gtk_object_set_user_data(GTK_OBJECT(list), data);
gtk_widget_show(list); gtk_widget_show(list);
/* Drop support */
gtk_drag_dest_set(list, GTK_DEST_DEFAULT_ALL, target_table,
2, GDK_ACTION_COPY);
gtk_signal_connect(GTK_OBJECT(list), "drag_data_received",
GTK_SIGNAL_FUNC(handle_drop), NULL);
/* Callbacks we are interested in */
gtk_signal_connect(GTK_OBJECT(list), "click_column",
GTK_SIGNAL_FUNC(toggle_order), data);
gtk_signal_connect(GTK_OBJECT(list), "select_row", gtk_signal_connect(GTK_OBJECT(list), "select_row",
GTK_SIGNAL_FUNC(select_row_cb), data); GTK_SIGNAL_FUNC(select_row_cb), data);
gtk_signal_connect(GTK_OBJECT(list), "unselect_row", gtk_signal_connect(GTK_OBJECT(list), "unselect_row",
GTK_SIGNAL_FUNC(unselect_row_cb), data); GTK_SIGNAL_FUNC(unselect_row_cb), data);
gtk_signal_connect(GTK_OBJECT(list), "row_move",
GTK_SIGNAL_FUNC(row_move_cb), data);
/* For handling doubleclick */
gtk_signal_connect(GTK_OBJECT(list), "button_press_event",
GTK_SIGNAL_FUNC(button_press_cb), data);
gtk_signal_connect(GTK_OBJECT(list), "button_release_event",
GTK_SIGNAL_FUNC(button_release_cb), data);
gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_MULTIPLE); gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_MULTIPLE);
set_buttons(data); set_buttons(data);
/* Set callbacks we're interested in */ /* Set object list callbacks we're interested in */
object_list_add_add_cb(object_list, object_added_cb, data); object_list_add_add_cb(object_list, object_added_cb, data);
object_list_add_update_cb(object_list, object_updated_cb, data); object_list_add_update_cb(object_list, object_updated_cb, data);
object_list_add_remove_cb(object_list, object_removed_cb, data); object_list_add_remove_cb(object_list, object_removed_cb, data);

View file

@ -22,6 +22,7 @@
*/ */
#include "imap_browse.h" #include "imap_browse.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_settings.h" #include "imap_settings.h"
#include "imap_string.h" #include "imap_string.h"
@ -63,7 +64,7 @@ make_settings_dialog()
DefaultDialog_t *dialog; DefaultDialog_t *dialog;
GSList *group; GSList *group;
dialog = data->dialog = make_default_dialog("Settings for this Mapfile"); dialog = data->dialog = make_default_dialog(_("Settings for this Mapfile"));
default_dialog_set_ok_cb(dialog, settings_ok_cb, (gpointer) data); default_dialog_set_ok_cb(dialog, settings_ok_cb, (gpointer) data);
table = gtk_table_new(9, 3, FALSE); table = gtk_table_new(9, 3, FALSE);
@ -74,21 +75,21 @@ make_settings_dialog()
gtk_container_set_border_width(GTK_CONTAINER(table), 10); gtk_container_set_border_width(GTK_CONTAINER(table), 10);
gtk_widget_show(table); gtk_widget_show(table);
create_label_in_table(table, 0, 0, "Filename:"); create_label_in_table(table, 0, 0, _("Filename:"));
data->filename = create_label_in_table(table, 0, 1, ""); data->filename = create_label_in_table(table, 0, 1, "");
create_label_in_table(table, 1, 0, "Image name:"); create_label_in_table(table, 1, 0, _("Image name:"));
data->imagename = browse_widget_new("Select Image File"); data->imagename = browse_widget_new(_("Select Image File"));
gtk_table_attach_defaults(GTK_TABLE(table), data->imagename->hbox, 1, 2, gtk_table_attach_defaults(GTK_TABLE(table), data->imagename->hbox, 1, 2,
1, 2); 1, 2);
create_label_in_table(table, 2, 0, "Title:"); create_label_in_table(table, 2, 0, _("Title:"));
data->title = create_entry_in_table(table, 2, 1); data->title = create_entry_in_table(table, 2, 1);
create_label_in_table(table, 3, 0, "Author:"); create_label_in_table(table, 3, 0, _("Author:"));
data->author = create_entry_in_table(table, 3, 1); data->author = create_entry_in_table(table, 3, 1);
create_label_in_table(table, 4, 0, "Default URL:"); create_label_in_table(table, 4, 0, _("Default URL:"));
data->default_url = create_entry_in_table(table, 4, 1); data->default_url = create_entry_in_table(table, 4, 1);
create_label_in_table(table, 5, 0, "Description:"); create_label_in_table(table, 5, 0, _("Description:"));
data->description = gtk_text_new(NULL, NULL); data->description = gtk_text_new(NULL, NULL);
gtk_text_set_editable(GTK_TEXT(data->description), TRUE); gtk_text_set_editable(GTK_TEXT(data->description), TRUE);
@ -103,7 +104,7 @@ make_settings_dialog()
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show(vscrollbar); gtk_widget_show(vscrollbar);
frame = gtk_frame_new("Map file format"); frame = gtk_frame_new(_("Map file format"));
gtk_widget_show(frame); gtk_widget_show(frame);
gtk_table_attach_defaults(GTK_TABLE(table), frame, 1, 2, 9, 10); gtk_table_attach_defaults(GTK_TABLE(table), frame, 1, 2, 9, 10);
hbox = gtk_hbox_new(FALSE, 1); hbox = gtk_hbox_new(FALSE, 1);
@ -144,7 +145,7 @@ do_settings_dialog(void)
dialog = make_settings_dialog(); dialog = make_settings_dialog();
gtk_label_set_text(GTK_LABEL(dialog->filename), gtk_label_set_text(GTK_LABEL(dialog->filename),
(filename) ? filename : "<Untitled>"); (filename) ? filename : _("<Untitled>"));
browse_widget_set_filename(dialog->imagename, info->image_name); browse_widget_set_filename(dialog->imagename, info->image_name);
gtk_entry_set_text(GTK_ENTRY(dialog->title), info->title); gtk_entry_set_text(GTK_ENTRY(dialog->title), info->title);
gtk_entry_set_text(GTK_ENTRY(dialog->author), info->author); gtk_entry_set_text(GTK_ENTRY(dialog->author), info->author);
@ -164,3 +165,4 @@ do_settings_dialog(void)
gtk_text_insert(GTK_TEXT(dialog->description), NULL, NULL, NULL, gtk_text_insert(GTK_TEXT(dialog->description), NULL, NULL, NULL,
info->description, -1); info->description, -1);
} }

View file

@ -25,6 +25,7 @@
#include <stdio.h> #include <stdio.h>
#include "imap_default_dialog.h" #include "imap_default_dialog.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_source.h" #include "imap_source.h"
@ -50,7 +51,7 @@ do_source_dialog(void)
if (!dialog) { if (!dialog) {
GtkWidget *window; GtkWidget *window;
dialog = make_default_dialog("View Source"); dialog = make_default_dialog(_("View Source"));
default_dialog_hide_cancel_button(dialog); default_dialog_hide_cancel_button(dialog);
default_dialog_hide_apply_button(dialog); default_dialog_hide_apply_button(dialog);

View file

@ -60,6 +60,7 @@ make_statusbar(GtkWidget *main_vbox, GtkWidget *window)
statusbar->xy = gtk_entry_new(); statusbar->xy = gtk_entry_new();
gtk_widget_set_usize(statusbar->xy, 64, -1); gtk_widget_set_usize(statusbar->xy, 64, -1);
gtk_entry_set_editable(GTK_ENTRY(statusbar->xy), FALSE); gtk_entry_set_editable(GTK_ENTRY(statusbar->xy), FALSE);
GTK_WIDGET_UNSET_FLAGS(statusbar->xy, GTK_CAN_FOCUS);
gtk_box_pack_start(GTK_BOX(hbox), statusbar->xy, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), statusbar->xy, FALSE, FALSE, 0);
gtk_widget_show(statusbar->xy); gtk_widget_show(statusbar->xy);
@ -74,6 +75,7 @@ make_statusbar(GtkWidget *main_vbox, GtkWidget *window)
statusbar->dimension = gtk_entry_new(); statusbar->dimension = gtk_entry_new();
gtk_widget_set_usize(statusbar->dimension, 64, -1); gtk_widget_set_usize(statusbar->dimension, 64, -1);
gtk_entry_set_editable(GTK_ENTRY(statusbar->dimension), FALSE); gtk_entry_set_editable(GTK_ENTRY(statusbar->dimension), FALSE);
GTK_WIDGET_UNSET_FLAGS(statusbar->dimension, GTK_CAN_FOCUS);
gtk_box_pack_start(GTK_BOX(hbox), statusbar->dimension, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), statusbar->dimension, FALSE, FALSE, 0);
gtk_widget_show(statusbar->dimension); gtk_widget_show(statusbar->dimension);

View file

@ -26,7 +26,10 @@
gchar* gchar*
g_strreplace(gchar **old_str, const gchar *new_str) g_strreplace(gchar **old_str, const gchar *new_str)
{ {
g_free(*old_str); if (*old_str != new_str) {
return *old_str = g_strdup(new_str); g_free(*old_str);
*old_str = g_strdup(new_str);
}
return *old_str;
} }

View file

@ -0,0 +1,122 @@
/*
* 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.
*
*/
#include <stdio.h>
#include "imap_string.h"
#include "imap_taglist.h"
static Tag_t*
tag_create(const gchar *name, const gchar *value)
{
Tag_t *tag = g_new(Tag_t, 1);
tag->name = g_strdup(name);
tag->value = g_strdup(value);
return tag;
}
static Tag_t*
tag_clone(Tag_t *src)
{
return tag_create(src->name, src->value);
}
static void
tag_destruct(Tag_t *tag)
{
g_free(tag->name);
g_free(tag->value);
g_free(tag);
}
static void
tag_write(Tag_t *tag)
{
printf("\"%s\"=\"%s\"\n", tag->name, tag->value);
}
TagList_t*
taglist_create(void)
{
TagList_t *tlist = g_new(TagList_t, 1);
tlist->list = NULL;
return tlist;
}
TagList_t*
taglist_clone(TagList_t *src)
{
return taglist_copy(src, taglist_create());
}
static void
taglist_remove_all(TagList_t *tlist)
{
GList *p;
for (p = tlist->list; p; p = p->next)
tag_destruct((Tag_t*) p->data);
g_list_free(tlist->list);
tlist->list = NULL;
}
TagList_t*
taglist_copy(TagList_t *src, TagList_t *des)
{
GList *p;
taglist_remove_all(des);
for (p = src->list; p; p = p->next)
des->list = g_list_append(des->list, tag_clone((Tag_t*) p->data));
return des;
}
void
taglist_destruct(TagList_t *tlist)
{
taglist_remove_all(tlist);
g_free(tlist);
}
void
taglist_set(TagList_t *tlist, const gchar *name, const gchar *value)
{
GList *p;
Tag_t *tag;
for (p = tlist->list; p; p = p->next) {
tag = (Tag_t*) p->data;
if (!g_strcasecmp(tag->name, name)) {
g_strreplace(&tag->value, value);
return;
}
}
/* Tag not found, add a new tag */
tlist->list = g_list_append(tlist->list, tag_create(name, value));
}
void
taglist_write(TagList_t *tlist)
{
GList *p;
for (p = tlist->list; p; p = p->next)
tag_write((Tag_t*) p->data);
}

View file

@ -0,0 +1,45 @@
/*
* 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_TAGLIST_H
#define _IMAP_TAGLIST_H
#include <glib.h>
typedef struct {
gchar *name;
gchar *value;
} Tag_t;
typedef struct {
GList *list;
} TagList_t;
TagList_t *taglist_create(void);
TagList_t *taglist_clone(TagList_t *src);
TagList_t *taglist_copy(TagList_t *src, TagList_t *des);
void taglist_destruct(TagList_t *tlist);
void taglist_set(TagList_t *tlist, const gchar *id, const gchar *value);
void taglist_write(TagList_t *tlist);
#endif /* _IMAP_TAGLIST_H */

View file

@ -21,6 +21,7 @@
* *
*/ */
#include "libgimp/stdplugins-intl.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_misc.h" #include "imap_misc.h"
#include "imap_toolbar.h" #include "imap_toolbar.h"
@ -107,59 +108,60 @@ make_toolbar(GtkWidget *main_vbox, GtkWidget *window)
gtk_container_add(GTK_CONTAINER(handlebox), toolbar); gtk_container_add(GTK_CONTAINER(handlebox), toolbar);
make_toolbar_icon(toolbar, window, open_xpm, "Open", make_toolbar_icon(toolbar, window, open_xpm, "Open",
"Open", toolbar_command, &data->cmd_open); _("Open"), toolbar_command, &data->cmd_open);
make_toolbar_icon(toolbar, window, save_xpm, "Save", make_toolbar_icon(toolbar, window, save_xpm, _("Save"),
"Save", toolbar_command, &data->cmd_save); "Save", toolbar_command, &data->cmd_save);
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
make_toolbar_icon(toolbar, window, preferences_xpm, "Preferences", make_toolbar_icon(toolbar, window, preferences_xpm, "Preferences",
"Preferences", toolbar_command, &data->cmd_preferences); _("Preferences"), toolbar_command,
&data->cmd_preferences);
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
data->undo = make_toolbar_icon(toolbar, window, undo_xpm, "Undo", data->undo = make_toolbar_icon(toolbar, window, undo_xpm, "Undo",
"Undo", toolbar_command, &data->cmd_undo); _("Undo"), toolbar_command, &data->cmd_undo);
gtk_widget_set_sensitive(data->undo, FALSE); gtk_widget_set_sensitive(data->undo, FALSE);
data->redo = make_toolbar_icon(toolbar, window, redo_xpm, "Redo", data->redo = make_toolbar_icon(toolbar, window, redo_xpm, "Redo",
"Redo", toolbar_command, &data->cmd_redo); _("Redo"), toolbar_command, &data->cmd_redo);
gtk_widget_set_sensitive(data->redo, FALSE); gtk_widget_set_sensitive(data->redo, FALSE);
command_list_add_update_cb(command_list_changed, data); command_list_add_update_cb(command_list_changed, data);
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
data->cut = make_toolbar_icon(toolbar, window, cut_xpm, "Cut", data->cut = make_toolbar_icon(toolbar, window, cut_xpm, "Cut",
"Cut", toolbar_command, &data->cmd_cut); _("Cut"), toolbar_command, &data->cmd_cut);
gtk_widget_set_sensitive(data->cut, FALSE); gtk_widget_set_sensitive(data->cut, FALSE);
data->copy = make_toolbar_icon(toolbar, window, copy_xpm, "Copy", data->copy = make_toolbar_icon(toolbar, window, copy_xpm, "Copy",
"Copy", toolbar_command, &data->cmd_copy); _("Copy"), toolbar_command, &data->cmd_copy);
gtk_widget_set_sensitive(data->copy, FALSE); gtk_widget_set_sensitive(data->copy, FALSE);
paste = make_toolbar_icon(toolbar, window, paste_xpm, "Paste", paste = make_toolbar_icon(toolbar, window, paste_xpm, "Paste",
"Paste", toolbar_command, &data->cmd_paste); _("Paste"), toolbar_command, &data->cmd_paste);
gtk_widget_set_sensitive(paste, FALSE); gtk_widget_set_sensitive(paste, FALSE);
paste_buffer_add_add_cb(paste_buffer_added, (gpointer) paste); paste_buffer_add_add_cb(paste_buffer_added, (gpointer) paste);
paste_buffer_add_remove_cb(paste_buffer_removed, (gpointer) paste); paste_buffer_add_remove_cb(paste_buffer_removed, (gpointer) paste);
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
data->zoom_in = make_toolbar_icon(toolbar, window, zoom_in_xpm, "ZoomIn", data->zoom_in = make_toolbar_icon(toolbar, window, zoom_in_xpm, "ZoomIn",
"Zoom in", toolbar_command, _("Zoom in"), toolbar_command,
&data->cmd_zoom_in); &data->cmd_zoom_in);
data->zoom_out = make_toolbar_icon(toolbar, window, zoom_out_xpm, "ZoomOut", data->zoom_out = make_toolbar_icon(toolbar, window, zoom_out_xpm, "ZoomOut",
"Zoom out", toolbar_command, _("Zoom out"), toolbar_command,
&data->cmd_zoom_out); &data->cmd_zoom_out);
gtk_widget_set_sensitive(data->zoom_out, FALSE); gtk_widget_set_sensitive(data->zoom_out, FALSE);
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
make_toolbar_icon(toolbar, window, map_info_xpm, "EditMapInfo", make_toolbar_icon(toolbar, window, map_info_xpm, "EditMapInfo",
"Edit Map Info", toolbar_command, _("Edit Map Info"), toolbar_command,
&data->cmd_edit_map_info); &data->cmd_edit_map_info);
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
data->to_front = make_toolbar_icon(toolbar, window, to_front_xpm, "ToFront", data->to_front = make_toolbar_icon(toolbar, window, to_front_xpm, "ToFront",
"Move To Front", toolbar_command, _("Move To Front"), toolbar_command,
&data->cmd_move_to_front); &data->cmd_move_to_front);
gtk_widget_set_sensitive(data->to_front, FALSE); gtk_widget_set_sensitive(data->to_front, FALSE);
data->to_back = make_toolbar_icon(toolbar, window, to_back_xpm, "ToBack", data->to_back = make_toolbar_icon(toolbar, window, to_back_xpm, "ToBack",
"Send To Back", toolbar_command, _("Send To Back"), toolbar_command,
&data->cmd_send_to_back); &data->cmd_send_to_back);
gtk_widget_set_sensitive(data->to_back, FALSE); gtk_widget_set_sensitive(data->to_back, FALSE);
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
data->grid = make_toolbar_toggle_icon(toolbar, window, grid_xpm, "Grid", data->grid = make_toolbar_toggle_icon(toolbar, window, grid_xpm, "Grid",
"Grid", toolbar_command, _("Grid"), toolbar_command,
&data->cmd_grid); &data->cmd_grid);
gtk_widget_show(toolbar); gtk_widget_show(toolbar);

View file

@ -24,6 +24,7 @@
#include "imap_circle.h" #include "imap_circle.h"
#include "imap_edit_area_info.h" #include "imap_edit_area_info.h"
#include "imap_main.h" #include "imap_main.h"
#include "libgimp/stdplugins-intl.h"
#include "imap_menu.h" #include "imap_menu.h"
#include "imap_misc.h" #include "imap_misc.h"
#include "imap_polygon.h" #include "imap_polygon.h"
@ -125,27 +126,27 @@ make_tools(GtkWidget *window)
gtk_container_add(GTK_CONTAINER(handlebox), toolbar); gtk_container_add(GTK_CONTAINER(handlebox), toolbar);
_tools.arrow = make_toolbar_radio_icon(toolbar, window, NULL, arrow_xpm, _tools.arrow = make_toolbar_radio_icon(toolbar, window, NULL, arrow_xpm,
"Select", "Select existing area", "Select", _("Select existing area"),
arrow_clicked, NULL); arrow_clicked, NULL);
_tools.rectangle = make_toolbar_radio_icon(toolbar, window, _tools.arrow, _tools.rectangle = make_toolbar_radio_icon(toolbar, window, _tools.arrow,
rectangle_xpm, "Rectangle", rectangle_xpm, "Rectangle",
"Define Rectangle area", _("Define Rectangle area"),
rectangle_clicked, NULL); rectangle_clicked, NULL);
_tools.circle = make_toolbar_radio_icon(toolbar, window, _tools.rectangle, _tools.circle = make_toolbar_radio_icon(toolbar, window, _tools.rectangle,
circle_xpm, "Circle", circle_xpm, "Circle",
"Define Circle/Oval area", _("Define Circle/Oval area"),
circle_clicked, NULL); circle_clicked, NULL);
_tools.polygon = make_toolbar_radio_icon(toolbar, window, _tools.circle, _tools.polygon = make_toolbar_radio_icon(toolbar, window, _tools.circle,
polygon_xpm, "Polygon", polygon_xpm, "Polygon",
"Define Polygon area", _("Define Polygon area"),
polygon_clicked, NULL); polygon_clicked, NULL);
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
_tools.edit = make_toolbar_icon(toolbar, window, edit_xpm, "Edit", _tools.edit = make_toolbar_icon(toolbar, window, edit_xpm, "Edit",
"Edit selected area info", tools_command, _("Edit selected area info"), tools_command,
&_tools.cmd_edit); &_tools.cmd_edit);
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
_tools.delete = make_toolbar_icon(toolbar, window, delete_xpm, "Delete", _tools.delete = make_toolbar_icon(toolbar, window, delete_xpm, "Delete",
"Delete selected area", tools_command, _("Delete selected area"), tools_command,
&_tools.cmd_delete); &_tools.cmd_delete);
gtk_widget_show(toolbar); gtk_widget_show(toolbar);

View file

@ -1,7 +1,11 @@
Sun Oct 24 22:52:01 MEST 1999 Sven Neumann <sven@gimp.org>
* POTFILES.in: added imagemap plug-in
Sun Oct 24 18:58:16 MEST 1999 Sven Neumann <sven@gimp.org> Sun Oct 24 18:58:16 MEST 1999 Sven Neumann <sven@gimp.org>
* de.po: Checked in first german version * de.po: Checked in first german version
(done by Felix Natter <f.natter@ndh.net> (done by Felix Natter <f.natter@ndh.net>
and Daniel Eggert <Daniel.Egger@rz.fh-muenchen.de>) and Daniel Eggert <Daniel.Egger@rz.fh-muenchen.de>)
1999-10-21 Kjartan Maraas <kmaraas@online.no> 1999-10-21 Kjartan Maraas <kmaraas@online.no>

View file

@ -3,20 +3,20 @@
plug-ins/AlienMap/AlienMap.c plug-ins/AlienMap/AlienMap.c
plug-ins/AlienMap2/AlienMap2.c plug-ins/AlienMap2/AlienMap2.c
plug-ins/common/CEL.c
plug-ins/common/CML_explorer.c
plug-ins/Lighting/lighting_main.c plug-ins/Lighting/lighting_main.c
plug-ins/Lighting/lighting_ui.c plug-ins/Lighting/lighting_ui.c
plug-ins/bmp/bmp.c
plug-ins/bmp/bmpread.c
plug-ins/bmp/bmpwrite.c
plug-ins/borderaverage/borderaverage.c
plug-ins/common/CEL.c
plug-ins/common/CML_explorer.c
plug-ins/common/animationplay.c plug-ins/common/animationplay.c
plug-ins/common/animoptimize.c plug-ins/common/animoptimize.c
plug-ins/common/apply_lens.c plug-ins/common/apply_lens.c
plug-ins/common/autocrop.c plug-ins/common/autocrop.c
plug-ins/common/autostretch_hsv.c plug-ins/common/autostretch_hsv.c
plug-ins/common/blur.c plug-ins/common/blur.c
plug-ins/bmp/bmp.c
plug-ins/bmp/bmpread.c
plug-ins/bmp/bmpwrite.c
plug-ins/borderaverage/borderaverage.c
plug-ins/common/bumpmap.c plug-ins/common/bumpmap.c
plug-ins/common/bz2.c plug-ins/common/bz2.c
plug-ins/common/c_astretch.c plug-ins/common/c_astretch.c
@ -29,6 +29,21 @@ plug-ins/common/cubism.c
plug-ins/common/decompose.c plug-ins/common/decompose.c
plug-ins/common/depthmerge.c plug-ins/common/depthmerge.c
plug-ins/common/destripe.c plug-ins/common/destripe.c
plug-ins/common/gif.c
plug-ins/common/gifload.c
plug-ins/common/film.c
plug-ins/common/normalize.c
plug-ins/common/oilify.c
plug-ins/common/png.c
plug-ins/common/ps.c
plug-ins/common/rotate.c
plug-ins/common/rotators.c
plug-ins/common/threshold_alpha.c
plug-ins/common/warp.c
plug-ins/common/xbm.c
plug-ins/common/xpm.c
plug-ins/common/xwd.c
plug-ins/common/zealouscrop.c
plug-ins/gap/gap_arr_dialog.c plug-ins/gap/gap_arr_dialog.c
plug-ins/gap/gap_dbbrowser_utils.c plug-ins/gap/gap_dbbrowser_utils.c
plug-ins/gap/gap_filter_foreach.c plug-ins/gap/gap_filter_foreach.c
@ -43,8 +58,6 @@ plug-ins/gap/gap_range_ops.c
plug-ins/gap/gap_resi_dialog.c plug-ins/gap/gap_resi_dialog.c
plug-ins/gap/gap_split.c plug-ins/gap/gap_split.c
plug-ins/gap/resize.c plug-ins/gap/resize.c
plug-ins/common/gif.c
plug-ins/common/gifload.c
plug-ins/gimpressionist/brush.c plug-ins/gimpressionist/brush.c
plug-ins/gimpressionist/color.c plug-ins/gimpressionist/color.c
plug-ins/gimpressionist/general.c plug-ins/gimpressionist/general.c
@ -60,31 +73,54 @@ plug-ins/gimpressionist/preview.c
plug-ins/gimpressionist/repaint.c plug-ins/gimpressionist/repaint.c
plug-ins/gimpressionist/size.c plug-ins/gimpressionist/size.c
plug-ins/gimpressionist/sizemap.c plug-ins/gimpressionist/sizemap.c
plug-ins/common/guillotine.c plug-ins/imagemap/imap_about.c
plug-ins/common/jpeg.c plug-ins/imagemap/imap_circle.c
plug-ins/common/lic.c plug-ins/imagemap/imap_cmd_clear.c
plug-ins/common/mail.c plug-ins/imagemap/imap_cmd_copy.c
plug-ins/imagemap/imap_cmd_copy_object.c
plug-ins/imagemap/imap_cmd_create.c
plug-ins/imagemap/imap_cmd_cut.c
plug-ins/imagemap/imap_cmd_cut_object.c
plug-ins/imagemap/imap_cmd_delete.c
plug-ins/imagemap/imap_cmd_delete_point.c
plug-ins/imagemap/imap_cmd_edit_object.c
plug-ins/imagemap/imap_cmd_guides.c
plug-ins/imagemap/imap_cmd_insert_point.c
plug-ins/imagemap/imap_cmd_move.c
plug-ins/imagemap/imap_cmd_move_down.c
plug-ins/imagemap/imap_cmd_move_sash.c
plug-ins/imagemap/imap_cmd_move_up.c
plug-ins/imagemap/imap_cmd_object_down.c
plug-ins/imagemap/imap_cmd_object_up.c
plug-ins/imagemap/imap_cmd_paste.c
plug-ins/imagemap/imap_cmd_select.c
plug-ins/imagemap/imap_cmd_select_all.c
plug-ins/imagemap/imap_cmd_select_region.c
plug-ins/imagemap/imap_cmd_send_to_back.c
plug-ins/imagemap/imap_cmd_unselect.c
plug-ins/imagemap/imap_cmd_unselect_all.c
plug-ins/imagemap/imap_edit_area_info.c
plug-ins/imagemap/imap_file.c
plug-ins/imagemap/imap_grid.c
plug-ins/imagemap/imap_main.c
plug-ins/imagemap/imap_polygon.c
plug-ins/imagemap/imap_rectangle.c
plug-ins/imagemap/imap_selection.c
plug-ins/imagemap/imap_settings.c
plug-ins/imagemap/imap_source.c
plug-ins/imagemap/imap_toolbar.c
plug-ins/imagemap/imap_tools.c
plug-ins/imagemap/imap_cmd_move_selected.c
plug-ins/imagemap/imap_cmd_object_move.c
plug-ins/imagemap/imap_cmd_select_next.c
plug-ins/mosaic/mosaic.c plug-ins/mosaic/mosaic.c
plug-ins/common/normalize.c
plug-ins/common/oilify.c
plug-ins/common/png.c
plug-ins/print/print-escp2.c plug-ins/print/print-escp2.c
plug-ins/print/print-pcl.c plug-ins/print/print-pcl.c
plug-ins/print/print-ps.c plug-ins/print/print-ps.c
plug-ins/print/print.c plug-ins/print/print.c
plug-ins/common/ps.c
plug-ins/common/rotate.c
plug-ins/common/rotators.c
plug-ins/sel2path/sel2path.c
plug-ins/struc/struc.c
plug-ins/common/threshold_alpha.c
plug-ins/common/warp.c
plug-ins/common/xbm.c
plug-ins/common/xpm.c
plug-ins/common/xwd.c
plug-ins/common/zealouscrop.c
plug-ins/script-fu/script-fu-console.c plug-ins/script-fu/script-fu-console.c
plug-ins/script-fu/script-fu-scripts.c plug-ins/script-fu/script-fu-scripts.c
plug-ins/script-fu/script-fu-server.c plug-ins/script-fu/script-fu-server.c
plug-ins/script-fu/script-fu.c plug-ins/script-fu/script-fu.c
plug-ins/common/film.c plug-ins/sel2path/sel2path.c
plug-ins/struc/struc.c