an update of the imagemap plug-in

--Sven
This commit is contained in:
Sven Neumann 1999-12-18 19:45:00 +00:00
parent b6d773dcc5
commit d37d2da31d
13 changed files with 222 additions and 128 deletions

View File

@ -1,3 +1,24 @@
Sat Dec 18 20:40:44 CET 1999 Sven Neumann <sven@gimp.org>
* plug-ins/imagemap/imap_about.c
* plug-ins/imagemap/imap_circle.c
* plug-ins/imagemap/imap_default_dialog.c
* plug-ins/imagemap/imap_default_dialog.h
* plug-ins/imagemap/imap_main.c
* plug-ins/imagemap/imap_menu.c
* plug-ins/imagemap/imap_menu_funcs.c
* plug-ins/imagemap/imap_popup.c
* plug-ins/imagemap/imap_preview.c
* plug-ins/imagemap/imap_rectangle.c
* plug-ins/imagemap/imap_selection.c
* plug-ins/imagemap/imap_table.c
* po-plug-ins/POTFILES.in: applied a patch to the ImageMap plug-ins
provided by its author Maurits Rijk <lpeek.mrijk@consunet.nl>.
Contains some internationalization fixes, compliance to the standard
Gimp dialog layout and some minor stuff (like the use of tear-off
menus).
1999-12-18 Michael Natterer <mitch@gimp.org> 1999-12-18 Michael Natterer <mitch@gimp.org>
* app/preferences_dialog.c: Added a special help function which * app/preferences_dialog.c: Added a special help function which

View File

@ -33,6 +33,7 @@ do_about_dialog(void)
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_hide_help_button(dialog);
default_dialog_set_label( default_dialog_set_label(
dialog, dialog,
_("Imagemap plug-in 1.3\n\n" _("Imagemap plug-in 1.3\n\n"

View File

@ -56,7 +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", N_("Circle"),
NULL, /* info_dialog */ NULL, /* info_dialog */
NULL, /* icon */ NULL, /* icon */
NULL, /* mask */ NULL, /* mask */

View File

@ -21,6 +21,8 @@
* *
*/ */
#include "libgimp/stdplugins-intl.h"
#include "imap_default_dialog.h" #include "imap_default_dialog.h"
static void static void
@ -76,7 +78,7 @@ DefaultDialog_t*
make_default_dialog(const gchar *title) make_default_dialog(const gchar *title)
{ {
DefaultDialog_t *data = (DefaultDialog_t*) g_new(DefaultDialog_t, 1); DefaultDialog_t *data = (DefaultDialog_t*) g_new(DefaultDialog_t, 1);
GtkWidget *dialog; GtkWidget *dialog, *hbbox;
data->ok_cb = NULL; data->ok_cb = NULL;
data->cancel_cb = NULL; data->cancel_cb = NULL;
@ -86,29 +88,44 @@ make_default_dialog(const gchar *title)
gtk_signal_connect(GTK_OBJECT(dialog), "delete_event", gtk_signal_connect(GTK_OBJECT(dialog), "delete_event",
GTK_SIGNAL_FUNC(dialog_destroy), (gpointer) data); GTK_SIGNAL_FUNC(dialog_destroy), (gpointer) data);
data->ok = gtk_button_new_with_label("OK"); /* Action area */
gtk_container_set_border_width(GTK_CONTAINER(
GTK_DIALOG(dialog)->action_area), 2);
gtk_box_set_homogeneous(GTK_BOX(GTK_DIALOG(dialog)->action_area), FALSE);
hbbox = gtk_hbutton_box_new();
gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbbox), 4);
gtk_box_pack_end(GTK_BOX(GTK_DIALOG(dialog)->action_area), hbbox, FALSE,
FALSE, 0);
gtk_widget_show (hbbox);
data->ok = gtk_button_new_with_label(_("OK"));
GTK_WIDGET_SET_FLAGS(data->ok, GTK_CAN_DEFAULT); GTK_WIDGET_SET_FLAGS(data->ok, GTK_CAN_DEFAULT);
gtk_signal_connect(GTK_OBJECT(data->ok), "clicked", gtk_signal_connect(GTK_OBJECT(data->ok), "clicked",
GTK_SIGNAL_FUNC(dialog_ok), (gpointer) data); GTK_SIGNAL_FUNC(dialog_ok), (gpointer) data);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), data->ok, TRUE, gtk_box_pack_start(GTK_BOX(hbbox), data->ok, FALSE, FALSE, 0);
TRUE, 0);
gtk_widget_grab_default(data->ok); gtk_widget_grab_default(data->ok);
gtk_widget_show(data->ok); gtk_widget_show(data->ok);
data->apply = gtk_button_new_with_label("Apply"); data->apply = gtk_button_new_with_label(_("Apply"));
GTK_WIDGET_SET_FLAGS(data->apply, GTK_CAN_DEFAULT);
gtk_signal_connect(GTK_OBJECT(data->apply), "clicked", gtk_signal_connect(GTK_OBJECT(data->apply), "clicked",
GTK_SIGNAL_FUNC(dialog_apply), (gpointer) data); GTK_SIGNAL_FUNC(dialog_apply), (gpointer) data);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), data->apply, gtk_box_pack_start(GTK_BOX(hbbox), data->apply, FALSE, FALSE, 0);
TRUE, TRUE, 0);
gtk_widget_show(data->apply); gtk_widget_show(data->apply);
data->cancel = gtk_button_new_with_label("Cancel"); data->cancel = gtk_button_new_with_label(_("Cancel"));
GTK_WIDGET_SET_FLAGS(data->cancel, GTK_CAN_DEFAULT);
gtk_signal_connect(GTK_OBJECT(data->cancel), "clicked", gtk_signal_connect(GTK_OBJECT(data->cancel), "clicked",
GTK_SIGNAL_FUNC(dialog_cancel), (gpointer) data); GTK_SIGNAL_FUNC(dialog_cancel), (gpointer) data);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), data->cancel, gtk_box_pack_start(GTK_BOX(hbbox), data->cancel, FALSE, FALSE, 0);
TRUE, TRUE, 0);
gtk_widget_show(data->cancel); gtk_widget_show(data->cancel);
data->help = gtk_button_new_with_label(_("Help..."));
GTK_WIDGET_SET_FLAGS(data->help, GTK_CAN_DEFAULT);
/* Fix me: no action yet */
gtk_box_pack_start(GTK_BOX(hbbox), data->help, FALSE, FALSE, 0);
gtk_widget_show(data->help);
return data; return data;
} }
@ -130,6 +147,12 @@ default_dialog_hide_apply_button(DefaultDialog_t *dialog)
gtk_widget_hide(dialog->apply); gtk_widget_hide(dialog->apply);
} }
void
default_dialog_hide_help_button(DefaultDialog_t *dialog)
{
gtk_widget_hide(dialog->help);
}
void void
default_dialog_set_title(DefaultDialog_t *dialog, const gchar *title) default_dialog_set_title(DefaultDialog_t *dialog, const gchar *title)
{ {

View File

@ -31,6 +31,7 @@ typedef struct {
GtkWidget *ok; GtkWidget *ok;
GtkWidget *apply; GtkWidget *apply;
GtkWidget *cancel; GtkWidget *cancel;
GtkWidget *help;
void (*ok_cb)(gpointer); void (*ok_cb)(gpointer);
gpointer ok_cb_data; gpointer ok_cb_data;
void (*cancel_cb)(gpointer); void (*cancel_cb)(gpointer);
@ -46,6 +47,7 @@ void default_dialog_set_cancel_cb(DefaultDialog_t *dialog,
void default_dialog_show(DefaultDialog_t *dialog); void default_dialog_show(DefaultDialog_t *dialog);
void default_dialog_hide_cancel_button(DefaultDialog_t *dialog); void default_dialog_hide_cancel_button(DefaultDialog_t *dialog);
void default_dialog_hide_apply_button(DefaultDialog_t *dialog); void default_dialog_hide_apply_button(DefaultDialog_t *dialog);
void default_dialog_hide_help_button(DefaultDialog_t *dialog);
void default_dialog_set_title(DefaultDialog_t *dialog, const gchar *title); void default_dialog_set_title(DefaultDialog_t *dialog, const gchar *title);
void default_dialog_set_ok_sensitivity(DefaultDialog_t *dialog, void default_dialog_set_ok_sensitivity(DefaultDialog_t *dialog,
gint sensitive); gint sensitive);

View File

@ -383,7 +383,8 @@ draw_polygon(GdkWindow *window, GdkGC *gc, GList *list)
g_free(points); g_free(points);
} }
static gboolean _preview_redraw_blocked; static gboolean _preview_redraw_blocked = FALSE;
static gboolean _pending_redraw = FALSE;
void void
preview_freeze(void) preview_freeze(void)
@ -395,13 +396,18 @@ void
preview_thaw(void) preview_thaw(void)
{ {
_preview_redraw_blocked = FALSE; _preview_redraw_blocked = FALSE;
redraw_preview(); if (_pending_redraw) {
_pending_redraw = FALSE;
redraw_preview();
}
} }
void void
redraw_preview(void) redraw_preview(void)
{ {
if (!_preview_redraw_blocked) if (_preview_redraw_blocked)
_pending_redraw = TRUE;
else
preview_redraw(_preview); preview_redraw(_preview);
} }

View File

@ -24,6 +24,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "libgimp/stdplugins-intl.h"
#include "imap_circle.h" #include "imap_circle.h"
#include "imap_file.h" #include "imap_file.h"
#include "imap_grid.h" #include "imap_grid.h"
@ -60,7 +62,7 @@ menu_mru(GtkWidget *widget, gpointer data)
if (!err && (buf.st_mode & S_IFREG)) { if (!err && (buf.st_mode & S_IFREG)) {
load(filename); load(filename);
} else { } else {
do_file_error_dialog("Error opening file", filename); do_file_error_dialog(_("Error opening file"), filename);
mru_remove(mru, filename); mru_remove(mru, filename);
menu_build_mru_items(mru); menu_build_mru_items(mru);
} }
@ -205,23 +207,23 @@ menu_grid(GtkWidget *widget, gpointer data)
static void static void
make_file_menu(GtkWidget *menu_bar) make_file_menu(GtkWidget *menu_bar)
{ {
GtkWidget *file_menu = make_menu_bar_item(menu_bar, "File"); GtkWidget *file_menu = make_menu_bar_item(menu_bar, _("File"));
GtkWidget *item; GtkWidget *item;
_menu.file_menu = file_menu; _menu.file_menu = file_menu;
item = make_item_with_label(file_menu, "Open...", menu_command, item = make_item_with_label(file_menu, _("Open..."), menu_command,
&_menu.cmd_open); &_menu.cmd_open);
add_accelerator(item, 'O', GDK_CONTROL_MASK); add_accelerator(item, 'O', GDK_CONTROL_MASK);
item = make_item_with_label(file_menu, "Save", menu_command, item = make_item_with_label(file_menu, _("Save"), menu_command,
&_menu.cmd_save); &_menu.cmd_save);
add_accelerator(item, 'S', GDK_CONTROL_MASK); add_accelerator(item, 'S', GDK_CONTROL_MASK);
make_item_with_label(file_menu, "Save As...", menu_command, make_item_with_label(file_menu, _("Save As..."), menu_command,
&_menu.cmd_save_as); &_menu.cmd_save_as);
make_separator(file_menu); make_separator(file_menu);
make_item_with_label(file_menu, "Preferences...", menu_command, make_item_with_label(file_menu, _("Preferences..."), menu_command,
&_menu.cmd_preferences); &_menu.cmd_preferences);
make_separator(file_menu); make_separator(file_menu);
item = make_item_with_label(file_menu, "Close", menu_command, item = make_item_with_label(file_menu, _("Close"), menu_command,
&_menu.cmd_close); &_menu.cmd_close);
add_accelerator(item, 'W', GDK_CONTROL_MASK); add_accelerator(item, 'W', GDK_CONTROL_MASK);
item = make_item_with_label(file_menu, "Quit", menu_command, item = make_item_with_label(file_menu, "Quit", menu_command,
@ -237,8 +239,8 @@ command_list_changed(Command_t *command, gpointer data)
/* Set undo entry */ /* Set undo entry */
if (_menu.undo) if (_menu.undo)
gtk_widget_destroy(_menu.undo); gtk_widget_destroy(_menu.undo);
sprintf(scratch, "Undo %s", (command) ? command->name : ""); sprintf(scratch, _("Undo %s"), (command) ? command->name : "");
_menu.undo = insert_item_with_label(_menu.edit_menu, 0, scratch, _menu.undo = insert_item_with_label(_menu.edit_menu, 1, scratch,
menu_command, &_menu.cmd_undo); menu_command, &_menu.cmd_undo);
add_accelerator(_menu.undo, 'Z', GDK_CONTROL_MASK); add_accelerator(_menu.undo, 'Z', GDK_CONTROL_MASK);
gtk_widget_set_sensitive(_menu.undo, (command != NULL)); gtk_widget_set_sensitive(_menu.undo, (command != NULL));
@ -247,8 +249,8 @@ command_list_changed(Command_t *command, gpointer data)
command = command_list_get_redo_command(); command = command_list_get_redo_command();
if (_menu.redo) if (_menu.redo)
gtk_widget_destroy(_menu.redo); gtk_widget_destroy(_menu.redo);
sprintf(scratch, "Redo %s", (command) ? command->name : ""); sprintf(scratch, _("Redo %s"), (command) ? command->name : "");
_menu.redo = insert_item_with_label(_menu.edit_menu, 1, scratch, _menu.redo = insert_item_with_label(_menu.edit_menu, 2, scratch,
menu_command, &_menu.cmd_redo); menu_command, &_menu.cmd_redo);
add_accelerator(_menu.redo, 'R', GDK_CONTROL_MASK); add_accelerator(_menu.redo, 'R', GDK_CONTROL_MASK);
gtk_widget_set_sensitive(_menu.redo, (command != NULL)); gtk_widget_set_sensitive(_menu.redo, (command != NULL));
@ -269,32 +271,32 @@ paste_buffer_removed(Object_t *obj, gpointer data)
static void static void
make_edit_menu(GtkWidget *menu_bar) make_edit_menu(GtkWidget *menu_bar)
{ {
GtkWidget *edit_menu = make_menu_bar_item(menu_bar, "Edit"); GtkWidget *edit_menu = make_menu_bar_item(menu_bar, _("Edit"));
GtkWidget *item, *paste; GtkWidget *item, *paste;
_menu.edit_menu = edit_menu; _menu.edit_menu = edit_menu;
command_list_changed(NULL, NULL); command_list_changed(NULL, NULL);
make_separator(edit_menu); make_separator(edit_menu);
_menu.cut = make_item_with_label(edit_menu, "Cut", menu_command, _menu.cut = make_item_with_label(edit_menu, _("Cut"), menu_command,
&_menu.cmd_cut); &_menu.cmd_cut);
add_accelerator(_menu.cut, 'X', GDK_CONTROL_MASK); add_accelerator(_menu.cut, 'X', GDK_CONTROL_MASK);
_menu.copy = make_item_with_label(edit_menu, "Copy", menu_command, _menu.copy = make_item_with_label(edit_menu, _("Copy"), menu_command,
&_menu.cmd_copy); &_menu.cmd_copy);
add_accelerator(_menu.copy, 'C', GDK_CONTROL_MASK); add_accelerator(_menu.copy, 'C', GDK_CONTROL_MASK);
paste = make_item_with_label(edit_menu, "Paste", menu_command, paste = make_item_with_label(edit_menu, _("Paste"), menu_command,
&_menu.cmd_paste); &_menu.cmd_paste);
add_accelerator(paste, 'V', GDK_CONTROL_MASK); add_accelerator(paste, 'V', GDK_CONTROL_MASK);
gtk_widget_set_sensitive(paste, FALSE); gtk_widget_set_sensitive(paste, FALSE);
item = make_item_with_label(edit_menu, "Select All", menu_command, item = make_item_with_label(edit_menu, _("Select All"), menu_command,
&_menu.cmd_select_all); &_menu.cmd_select_all);
add_accelerator(item, 'A', GDK_CONTROL_MASK); add_accelerator(item, 'A', GDK_CONTROL_MASK);
make_separator(edit_menu); make_separator(edit_menu);
_menu.clear = make_item_with_label(edit_menu, "Clear", menu_command, _menu.clear = make_item_with_label(edit_menu, _("Clear"), menu_command,
&_menu.cmd_clear); &_menu.cmd_clear);
add_accelerator(_menu.clear, 'K', GDK_CONTROL_MASK); add_accelerator(_menu.clear, 'K', GDK_CONTROL_MASK);
_menu.edit = make_item_with_label(edit_menu, "Edit Area Info...", _menu.edit = make_item_with_label(edit_menu, _("Edit Area Info..."),
menu_command, &_menu.cmd_edit_area_info); menu_command, &_menu.cmd_edit_area_info);
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);
@ -305,23 +307,23 @@ make_edit_menu(GtkWidget *menu_bar)
static void static void
make_view_menu(GtkWidget *menu_bar) make_view_menu(GtkWidget *menu_bar)
{ {
GtkWidget *view_menu = make_menu_bar_item(menu_bar, "View"); GtkWidget *view_menu = make_menu_bar_item(menu_bar, _("View"));
GtkWidget *zoom_menu, *item; GtkWidget *zoom_menu, *item;
GSList *group = NULL; GSList *group = NULL;
item = make_check_item(view_menu, "Area List", menu_command, item = make_check_item(view_menu, _("Area List"), menu_command,
&_menu.cmd_area_list); &_menu.cmd_area_list);
GTK_CHECK_MENU_ITEM(item)->active = TRUE; GTK_CHECK_MENU_ITEM(item)->active = TRUE;
make_item_with_label(view_menu, "Source...", menu_command, make_item_with_label(view_menu, _("Source..."), menu_command,
&_menu.cmd_source); &_menu.cmd_source);
make_separator(view_menu); make_separator(view_menu);
_menu.color = make_radio_item(view_menu, NULL, "Color", menu_command, _menu.color = make_radio_item(view_menu, NULL, _("Color"), menu_command,
&_menu.cmd_color); &_menu.cmd_color);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.color)); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.color));
_menu.gray = make_radio_item(view_menu, group, "Grayscale", menu_command, _menu.gray = make_radio_item(view_menu, group, _("Grayscale"), menu_command,
&_menu.cmd_gray); &_menu.cmd_gray);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.gray)); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.gray));
@ -333,79 +335,79 @@ make_view_menu(GtkWidget *menu_bar)
make_separator(view_menu); make_separator(view_menu);
_menu.zoom_in = make_item_with_label(view_menu, "Zoom In", menu_command, _menu.zoom_in = make_item_with_label(view_menu, _("Zoom In"), menu_command,
&_menu.cmd_zoom_in); &_menu.cmd_zoom_in);
add_accelerator(_menu.zoom_in, '=', 0); add_accelerator(_menu.zoom_in, '=', 0);
_menu.zoom_out = make_item_with_label(view_menu, "Zoom Out", menu_command, _menu.zoom_out = make_item_with_label(view_menu, _("Zoom Out"),
&_menu.cmd_zoom_out); menu_command, &_menu.cmd_zoom_out);
add_accelerator(_menu.zoom_out, '-', 0); add_accelerator(_menu.zoom_out, '-', 0);
gtk_widget_set_sensitive(_menu.zoom_out, FALSE); gtk_widget_set_sensitive(_menu.zoom_out, FALSE);
zoom_menu = make_sub_menu(view_menu, "Zoom To"); zoom_menu = make_sub_menu(view_menu, _("Zoom To"));
_menu.zoom[0] = make_radio_item(zoom_menu, NULL, "1:1", menu_zoom_to_1, _menu.zoom[0] = make_radio_item(zoom_menu, NULL, "1:1", menu_zoom_to_1,
NULL); NULL);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[0])); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[0]));
_menu.zoom[1] = make_radio_item(zoom_menu, group, "1:2", menu_zoom_to_2, _menu.zoom[1] = make_radio_item(zoom_menu, group, "1:2", menu_zoom_to_2,
NULL); NULL);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[1])); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[1]));
_menu.zoom[2] = make_radio_item(zoom_menu, group, "1:3", menu_zoom_to_3, _menu.zoom[2] = make_radio_item(zoom_menu, group, "1:3", menu_zoom_to_3,
NULL); NULL);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[2])); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[2]));
_menu.zoom[3] = make_radio_item(zoom_menu, group, "1:4", menu_zoom_to_4, _menu.zoom[3] = make_radio_item(zoom_menu, group, "1:4", menu_zoom_to_4,
NULL); NULL);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[3])); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[3]));
_menu.zoom[4] = make_radio_item(zoom_menu, group, "1:5", menu_zoom_to_5, _menu.zoom[4] = make_radio_item(zoom_menu, group, "1:5", menu_zoom_to_5,
NULL); NULL);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[4])); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[4]));
_menu.zoom[5] = make_radio_item(zoom_menu, group, "1:6", menu_zoom_to_6, _menu.zoom[5] = make_radio_item(zoom_menu, group, "1:6", menu_zoom_to_6,
NULL); NULL);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[5])); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[5]));
_menu.zoom[6] = make_radio_item(zoom_menu, group, "1:7", menu_zoom_to_7, _menu.zoom[6] = make_radio_item(zoom_menu, group, "1:7", menu_zoom_to_7,
NULL); NULL);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[6])); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.zoom[6]));
_menu.zoom[7] = make_radio_item(zoom_menu, group, "1:8", menu_zoom_to_8, _menu.zoom[7] = make_radio_item(zoom_menu, group, "1:8", menu_zoom_to_8,
NULL); NULL);
} }
static void static void
make_mapping_menu(GtkWidget *menu_bar) make_mapping_menu(GtkWidget *menu_bar)
{ {
GtkWidget *menu = make_menu_bar_item(menu_bar, "Mapping"); GtkWidget *menu = make_menu_bar_item(menu_bar, _("Mapping"));
GSList *group; GSList *group;
_menu.arrow = make_radio_item(menu, NULL, "Arrow", menu_arrow, NULL); _menu.arrow = make_radio_item(menu, NULL, _("Arrow"), menu_arrow, NULL);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.arrow)); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.arrow));
_menu.rectangle = make_radio_item(menu, group, "Rectangle", _menu.rectangle = make_radio_item(menu, group, _("Rectangle"),
menu_rectangle, NULL); menu_rectangle, NULL);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.rectangle)); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.rectangle));
_menu.circle = make_radio_item(menu, group, "Circle", menu_circle, NULL); _menu.circle = make_radio_item(menu, group, _("Circle"), menu_circle, NULL);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.circle)); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_menu.circle));
_menu.polygon = make_radio_item(menu, group, "Polygon", menu_polygon, _menu.polygon = make_radio_item(menu, group, _("Polygon"), menu_polygon,
NULL); NULL);
make_separator(menu); make_separator(menu);
make_item_with_label(menu, "Edit Map Info...", menu_command, make_item_with_label(menu, _("Edit Map Info..."), menu_command,
&_menu.cmd_edit_map_info); &_menu.cmd_edit_map_info);
} }
static void static void
make_goodies_menu(GtkWidget *menu_bar) make_goodies_menu(GtkWidget *menu_bar)
{ {
GtkWidget *goodies_menu = make_menu_bar_item(menu_bar, "Goodies"); GtkWidget *goodies_menu = make_menu_bar_item(menu_bar, _("Goodies"));
_menu.grid = make_check_item(goodies_menu, "Grid", menu_grid, NULL); _menu.grid = make_check_item(goodies_menu, _("Grid"), menu_grid, NULL);
make_item_with_label(goodies_menu, "Grid Settings...", menu_command, make_item_with_label(goodies_menu, _("Grid Settings..."), menu_command,
&_menu.cmd_grid_settings); &_menu.cmd_grid_settings);
make_item_with_label(goodies_menu, "Create Guides...", menu_command, make_item_with_label(goodies_menu, _("Create Guides..."), menu_command,
&_menu.cmd_create_guides); &_menu.cmd_create_guides);
} }
static void static void
make_help_menu(GtkWidget *menu_bar) make_help_menu(GtkWidget *menu_bar)
{ {
GtkWidget *help_menu = make_menu_bar_item(menu_bar, "Help"); GtkWidget *help_menu = make_menu_bar_item(menu_bar, _("Help"));
gtk_menu_item_right_justify(GTK_MENU_ITEM(gtk_menu_get_attach_widget( gtk_menu_item_right_justify(GTK_MENU_ITEM(gtk_menu_get_attach_widget(
GTK_MENU(help_menu)))); GTK_MENU(help_menu))));
make_item_with_label(help_menu, "About ImageMap...", menu_command, make_item_with_label(help_menu, _("About ImageMap..."), menu_command,
&_menu.cmd_about); &_menu.cmd_about);
} }
@ -435,12 +437,12 @@ void
menu_build_mru_items(MRU_t *mru) menu_build_mru_items(MRU_t *mru)
{ {
GList *p; GList *p;
gint position = 6; /* Position of 'Close' entry */ gint position = 7; /* Position of 'Close' entry */
int i; int i;
if (_menu.nr_off_mru_items) { if (_menu.nr_off_mru_items) {
GList *children = gtk_container_children(GTK_CONTAINER(_menu.file_menu)); GList *children = gtk_container_children(GTK_CONTAINER(_menu.file_menu));
p = g_list_nth(children, position); p = g_list_nth(children, position);
for (i = 0; i < _menu.nr_off_mru_items; i++, p = p->next) { for (i = 0; i < _menu.nr_off_mru_items; i++, p = p->next) {
gtk_widget_destroy((GtkWidget*) p->data); gtk_widget_destroy((GtkWidget*) p->data);
@ -450,8 +452,13 @@ 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, GtkWidget *item = insert_item_with_label(_menu.file_menu, position++,
menu_mru, p->data); (gchar*) p->data,
menu_mru, p->data);
if (i < 9) {
guchar accelerator_key = '1' + i;
add_accelerator(item, accelerator_key, GDK_CONTROL_MASK);
}
} }
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;
@ -492,7 +499,7 @@ void
menu_set_zoom(gint factor) menu_set_zoom(gint factor)
{ {
_menu_callback_lock = 2; _menu_callback_lock = 2;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(_menu.zoom[factor - 1]), gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(_menu.zoom[factor - 1]),
TRUE); TRUE);
menu_set_zoom_sensitivity(factor); menu_set_zoom_sensitivity(factor);
} }

View File

@ -26,7 +26,7 @@
static GtkAccelGroup *accelerator_group; static GtkAccelGroup *accelerator_group;
void void
init_accel_group(GtkWidget *window) init_accel_group(GtkWidget *window)
{ {
accelerator_group = gtk_accel_group_new(); accelerator_group = gtk_accel_group_new();
@ -37,8 +37,8 @@ void
add_accelerator(GtkWidget *widget, guchar accelerator_key, add_accelerator(GtkWidget *widget, guchar accelerator_key,
guint8 accelerator_mods) guint8 accelerator_mods)
{ {
gtk_widget_add_accelerator(widget, "activate", accelerator_group, gtk_widget_add_accelerator(widget, "activate", accelerator_group,
accelerator_key, accelerator_mods, accelerator_key, accelerator_mods,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
} }
@ -75,7 +75,7 @@ prepend_item_with_label(GtkWidget *parent, gchar *label,
{ {
GtkWidget *item = gtk_menu_item_new_with_label(label); GtkWidget *item = gtk_menu_item_new_with_label(label);
gtk_menu_prepend(GTK_MENU(parent), item); gtk_menu_prepend(GTK_MENU(parent), item);
gtk_signal_connect(GTK_OBJECT(item), "activate", gtk_signal_connect(GTK_OBJECT(item), "activate",
GTK_SIGNAL_FUNC(activate), data); GTK_SIGNAL_FUNC(activate), data);
gtk_widget_show(item); gtk_widget_show(item);
@ -88,7 +88,7 @@ insert_item_with_label(GtkWidget *parent, gint position, gchar *label,
{ {
GtkWidget *item = gtk_menu_item_new_with_label(label); GtkWidget *item = gtk_menu_item_new_with_label(label);
gtk_menu_insert(GTK_MENU(parent), item, position); gtk_menu_insert(GTK_MENU(parent), item, position);
gtk_signal_connect(GTK_OBJECT(item), "activate", gtk_signal_connect(GTK_OBJECT(item), "activate",
GTK_SIGNAL_FUNC(activate), data); GTK_SIGNAL_FUNC(activate), data);
gtk_widget_show(item); gtk_widget_show(item);
@ -104,10 +104,10 @@ make_check_item(GtkWidget *parent, gchar *label, MenuCallback activate,
} }
GtkWidget* GtkWidget*
make_radio_item(GtkWidget *parent, GSList *group, gchar *label, make_radio_item(GtkWidget *parent, GSList *group, gchar *label,
MenuCallback activate, gpointer data) MenuCallback activate, gpointer data)
{ {
return append_active_item(parent, return append_active_item(parent,
gtk_radio_menu_item_new_with_label(group, label), gtk_radio_menu_item_new_with_label(group, label),
activate, data); activate, data);
} }
@ -144,6 +144,10 @@ make_menu_bar_item(GtkWidget *menu_bar, gchar *label)
{ {
GtkWidget *menu = gtk_menu_new(); GtkWidget *menu = gtk_menu_new();
GtkWidget *item = gtk_menu_item_new_with_label(label); GtkWidget *item = gtk_menu_item_new_with_label(label);
GtkWidget *tearoff = gtk_tearoff_menu_item_new();
gtk_menu_insert(GTK_MENU(menu), tearoff, 0);
gtk_widget_show(tearoff);
gtk_widget_show(item); gtk_widget_show(item);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu);

View File

@ -21,6 +21,8 @@
* *
*/ */
#include "libgimp/stdplugins-intl.h"
#include "imap_edit_area_info.h" #include "imap_edit_area_info.h"
#include "imap_grid.h" #include "imap_grid.h"
#include "imap_main.h" #include "imap_main.h"
@ -119,34 +121,35 @@ create_main_popup_menu(void)
GSList *group; GSList *group;
_popup.main = popup_menu = gtk_menu_new(); _popup.main = popup_menu = gtk_menu_new();
make_item_with_label(popup_menu, "Map Info...", menu_command, make_item_with_label(popup_menu, _("Map Info..."), menu_command,
&_popup.cmd_edit_map_info); &_popup.cmd_edit_map_info);
sub_menu = make_sub_menu(popup_menu, "Tools"); sub_menu = make_sub_menu(popup_menu, _("Tools"));
_popup.arrow = make_radio_item(sub_menu, NULL, "Arrow", popup_arrow, NULL); _popup.arrow = make_radio_item(sub_menu, NULL, _("Arrow"), popup_arrow,
NULL);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_popup.arrow)); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_popup.arrow));
_popup.rectangle = make_radio_item(sub_menu, group, "Rectangle", _popup.rectangle = make_radio_item(sub_menu, group, _("Rectangle"),
popup_rectangle, NULL); popup_rectangle, NULL);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_popup.rectangle)); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_popup.rectangle));
_popup.circle = make_radio_item(sub_menu, group, "Circle", _popup.circle = make_radio_item(sub_menu, group, _("Circle"),
popup_circle, NULL); popup_circle, NULL);
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_popup.circle)); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(_popup.circle));
_popup.polygon = make_radio_item(sub_menu, group, "Polygon", _popup.polygon = make_radio_item(sub_menu, group, _("Polygon"),
popup_polygon, NULL); popup_polygon, NULL);
sub_menu = make_sub_menu(popup_menu, "Zoom"); sub_menu = make_sub_menu(popup_menu, _("Zoom"));
_popup.zoom_in = make_item_with_label(sub_menu, "In", menu_command, _popup.zoom_in = make_item_with_label(sub_menu, _("In"), menu_command,
&_popup.cmd_zoom_in); &_popup.cmd_zoom_in);
_popup.zoom_out = make_item_with_label(sub_menu, "Out", menu_command, _popup.zoom_out = make_item_with_label(sub_menu, _("Out"), menu_command,
&_popup.cmd_zoom_out); &_popup.cmd_zoom_out);
gtk_widget_set_sensitive(_popup.zoom_out, FALSE); gtk_widget_set_sensitive(_popup.zoom_out, FALSE);
_popup.grid = make_check_item(popup_menu, "Grid", popup_grid, NULL); _popup.grid = make_check_item(popup_menu, _("Grid"), popup_grid, NULL);
make_item_with_label(popup_menu, "Grid Settings...", menu_command, make_item_with_label(popup_menu, _("Grid Settings..."), menu_command,
&_popup.cmd_grid_settings); &_popup.cmd_grid_settings);
make_item_with_label(popup_menu, "Guides...", menu_command, make_item_with_label(popup_menu, _("Guides..."), menu_command,
&_popup.cmd_create_guides); &_popup.cmd_create_guides);
paste = make_item_with_label(popup_menu, "Paste", menu_command, paste = make_item_with_label(popup_menu, _("Paste"), menu_command,
&_popup.cmd_paste); &_popup.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);

View File

@ -26,6 +26,7 @@
#include "imap_cmd_edit_object.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_popup.h"
#include "imap_preview.h" #include "imap_preview.h"
#define PREVIEW_MASK GDK_EXPOSURE_MASK | \ #define PREVIEW_MASK GDK_EXPOSURE_MASK | \
@ -58,13 +59,13 @@ preview_user_data(GtkWidget *preview)
return (Preview_t*) gtk_object_get_user_data(GTK_OBJECT(preview)); return (Preview_t*) gtk_object_get_user_data(GTK_OBJECT(preview));
} }
gint gint
preview_get_width(GtkWidget *preview) preview_get_width(GtkWidget *preview)
{ {
return preview_user_data(preview)->width; return preview_user_data(preview)->width;
} }
gint gint
preview_get_height(GtkWidget *preview) preview_get_height(GtkWidget *preview)
{ {
return preview_user_data(preview)->height; return preview_user_data(preview)->height;
@ -92,12 +93,12 @@ render_gray_image(GtkWidget *preview, GPixelRgn *srcrgn)
src_row = g_new(guchar, dwidth * bpp); src_row = g_new(guchar, dwidth * bpp);
dest_row = g_new(guchar, pwidth * 3); dest_row = g_new(guchar, pwidth * 3);
src_col = g_new(gint, pwidth); src_col = g_new(gint, pwidth);
for (col = 0; col < pwidth; col++) for (col = 0; col < pwidth; col++)
src_col[col] = (col * dwidth / pwidth) * bpp; src_col[col] = (col * dwidth / pwidth) * bpp;
for (row = 0; row < pheight; row++) { for (row = 0; row < pheight; row++) {
gimp_pixel_rgn_get_row(srcrgn, src_row, 0, row * dheight / pheight, gimp_pixel_rgn_get_row(srcrgn, src_row, 0, row * dheight / pheight,
dwidth); dwidth);
dest = dest_row; dest = dest_row;
@ -141,21 +142,21 @@ render_indexed_image(GtkWidget *preview, GPixelRgn *srcrgn)
bpp = srcrgn->bpp; bpp = srcrgn->bpp;
alpha = bpp; alpha = bpp;
has_alpha = gimp_drawable_has_alpha(srcrgn->drawable->id); has_alpha = gimp_drawable_has_alpha(srcrgn->drawable->id);
if (has_alpha) if (has_alpha)
alpha--; alpha--;
cmap = gimp_image_get_cmap(gimp_drawable_image_id(srcrgn->drawable->id), cmap = gimp_image_get_cmap(gimp_drawable_image_id(srcrgn->drawable->id),
&ncols); &ncols);
src_row = g_new(guchar, dwidth * bpp); src_row = g_new(guchar, dwidth * bpp);
dest_row = g_new(guchar, pwidth * 3); dest_row = g_new(guchar, pwidth * 3);
src_col = g_new(gint, pwidth); src_col = g_new(gint, pwidth);
for (col = 0; col < pwidth; col++) for (col = 0; col < pwidth; col++)
src_col[col] = (col * dwidth / pwidth) * bpp; src_col[col] = (col * dwidth / pwidth) * bpp;
for (row = 0; row < pheight; row++) { for (row = 0; row < pheight; row++) {
gimp_pixel_rgn_get_row(srcrgn, src_row, 0, row * dheight / pheight, gimp_pixel_rgn_get_row(srcrgn, src_row, 0, row * dheight / pheight,
dwidth); dwidth);
dest = dest_row; dest = dest_row;
for (col = 0; col < pwidth; col++) { for (col = 0; col < pwidth; col++) {
@ -163,7 +164,7 @@ render_indexed_image(GtkWidget *preview, GPixelRgn *srcrgn)
colour = cmap + 3 * (int)(*src); colour = cmap + 3 * (int)(*src);
if (gray) { if (gray) {
guchar avg = (299 * *colour++ + 587 * *colour++ + guchar avg = (299 * *colour++ + 587 * *colour++ +
114 * *colour++) / 1000; 114 * *colour++) / 1000;
*dest++ = avg; *dest++ = avg;
*dest++ = avg; *dest++ = avg;
@ -204,18 +205,18 @@ render_rgb_image(GtkWidget *preview, GPixelRgn *srcrgn)
bpp = srcrgn->bpp; bpp = srcrgn->bpp;
alpha = bpp; alpha = bpp;
has_alpha = gimp_drawable_has_alpha(srcrgn->drawable->id); has_alpha = gimp_drawable_has_alpha(srcrgn->drawable->id);
if (has_alpha) if (has_alpha)
alpha--; alpha--;
src_row = g_new(guchar, dwidth * bpp); src_row = g_new(guchar, dwidth * bpp);
dest_row = g_new(guchar, pwidth * bpp); dest_row = g_new(guchar, pwidth * bpp);
src_col = g_new(gint, pwidth); src_col = g_new(gint, pwidth);
for (col = 0; col < pwidth; col++) for (col = 0; col < pwidth; col++)
src_col[col] = (col * dwidth / pwidth) * bpp; src_col[col] = (col * dwidth / pwidth) * bpp;
for (row = 0; row < pheight; row++) { for (row = 0; row < pheight; row++) {
gimp_pixel_rgn_get_row(srcrgn, src_row, 0, row * dheight / pheight, gimp_pixel_rgn_get_row(srcrgn, src_row, 0, row * dheight / pheight,
dwidth); dwidth);
dest = dest_row; dest = dest_row;
for (col = 0; col < pwidth; col++) { for (col = 0; col < pwidth; col++) {
@ -231,7 +232,7 @@ render_rgb_image(GtkWidget *preview, GPixelRgn *srcrgn)
check = LIGHTCHECK; check = LIGHTCHECK;
else else
check = DARKCHECK; check = DARKCHECK;
if (src[alpha] == 0) { if (src[alpha] == 0) {
/* full transparent -- check */ /* full transparent -- check */
for (b = 0; b < alpha; b++) for (b = 0; b < alpha; b++)
@ -239,7 +240,7 @@ render_rgb_image(GtkWidget *preview, GPixelRgn *srcrgn)
} else { } else {
/* middlemost transparent -- mix check and src */ /* middlemost transparent -- mix check and src */
for (b = 0; b < alpha; b++) for (b = 0; b < alpha; b++)
dest[b] = (src[b] * src[alpha] + dest[b] = (src[b] * src[alpha] +
check * (OPAQUE - src[alpha])) / OPAQUE; check * (OPAQUE - src[alpha])) / OPAQUE;
} }
} }
@ -277,6 +278,15 @@ render_preview(GtkWidget *preview, GPixelRgn *srcrgn)
} }
} }
static gint
arrow_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
if (event->button == 1)
do_main_popup_menu(event);
gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "button_press_event");
return FALSE;
}
static gint static gint
preview_expose(GtkWidget *widget, GdkEventExpose *event) preview_expose(GtkWidget *widget, GdkEventExpose *event)
{ {
@ -295,28 +305,28 @@ preview_expose(GtkWidget *widget, GdkEventExpose *event)
void void
add_preview_motion_event(Preview_t *preview, GtkSignalFunc func) add_preview_motion_event(Preview_t *preview, GtkSignalFunc func)
{ {
gtk_signal_connect(GTK_OBJECT(preview->preview), gtk_signal_connect(GTK_OBJECT(preview->preview),
"motion_notify_event", func, NULL); "motion_notify_event", func, NULL);
} }
void void
add_enter_notify_event(Preview_t *preview, GtkSignalFunc func) add_enter_notify_event(Preview_t *preview, GtkSignalFunc func)
{ {
gtk_signal_connect(GTK_OBJECT(preview->preview), gtk_signal_connect(GTK_OBJECT(preview->preview),
"enter_notify_event", func, NULL); "enter_notify_event", func, NULL);
} }
void void
add_leave_notify_event(Preview_t *preview, GtkSignalFunc func) add_leave_notify_event(Preview_t *preview, GtkSignalFunc func)
{ {
gtk_signal_connect(GTK_OBJECT(preview->preview), gtk_signal_connect(GTK_OBJECT(preview->preview),
"leave_notify_event", func, NULL); "leave_notify_event", func, NULL);
} }
void void
add_preview_button_press_event(Preview_t *preview, GtkSignalFunc func) add_preview_button_press_event(Preview_t *preview, GtkSignalFunc func)
{ {
gtk_signal_connect(GTK_OBJECT(preview->preview), gtk_signal_connect(GTK_OBJECT(preview->preview),
"button_press_event", func, NULL); "button_press_event", func, NULL);
} }
@ -355,8 +365,8 @@ static GtkTargetEntry target_table[] = {
{"text/plain", 0, 2 } {"text/plain", 0, 2 }
}; };
static void static void
handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y, handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
GtkSelectionData *data, guint info, guint time) GtkSelectionData *data, guint info, guint time)
{ {
gboolean success = FALSE; gboolean success = FALSE;
@ -383,6 +393,7 @@ make_preview(GDrawable *drawable)
Preview_t *data = g_new(Preview_t, 1); Preview_t *data = g_new(Preview_t, 1);
GtkWidget *preview; GtkWidget *preview;
GtkWidget *window; GtkWidget *window;
GtkWidget *button, *arrow;
GtkWidget *ruler; GtkWidget *ruler;
GtkWidget *frame; GtkWidget *frame;
GtkWidget *table; GtkWidget *table;
@ -394,7 +405,7 @@ make_preview(GDrawable *drawable)
gtk_object_set_user_data(GTK_OBJECT(preview), data); gtk_object_set_user_data(GTK_OBJECT(preview), data);
gtk_widget_set_events(GTK_WIDGET(preview), PREVIEW_MASK); gtk_widget_set_events(GTK_WIDGET(preview), PREVIEW_MASK);
data->exp_id = gtk_signal_connect_after(GTK_OBJECT(preview), "expose_event", data->exp_id = gtk_signal_connect_after(GTK_OBJECT(preview), "expose_event",
(GtkSignalFunc) preview_expose, (GtkSignalFunc) preview_expose,
data); data);
/* Handle drop of links in preview widget */ /* Handle drop of links in preview widget */
@ -411,7 +422,7 @@ make_preview(GDrawable *drawable)
width = (data->width > 600) ? 600 : data->width; width = (data->width > 600) ? 600 : data->width;
height = (data->height > 400) ? 400 : data->height; height = (data->height > 400) ? 400 : data->height;
gtk_widget_set_usize(window, width, height); gtk_widget_set_usize(window, width, height);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(window), gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_show(window); gtk_widget_show(window);
@ -423,7 +434,22 @@ make_preview(GDrawable *drawable)
table = gtk_table_new(3, 3, FALSE); table = gtk_table_new(3, 3, FALSE);
gtk_table_attach(GTK_TABLE(table), preview, 1, 2, 1, 2, GTK_FILL, GTK_FILL, gtk_table_attach(GTK_TABLE(table), preview, 1, 2, 1, 2, GTK_FILL, GTK_FILL,
0, 0); 0, 0);
gtk_container_add(GTK_CONTAINER(frame), table); gtk_container_add(GTK_CONTAINER(frame), table);
/* Create button with arrow */
button = gtk_button_new();
GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS);
gtk_table_attach(GTK_TABLE(table), button, 0, 1, 0, 1, GTK_FILL, GTK_FILL,
0, 0);
gtk_widget_set_events(button,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
gtk_signal_connect(GTK_OBJECT(button), "button_press_event",
(GtkSignalFunc) arrow_cb, NULL);
gtk_widget_show(button);
arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
gtk_container_add(GTK_CONTAINER(button), arrow);
gtk_widget_show(arrow);
/* Create horizontal ruler */ /* Create horizontal ruler */
data->hruler = ruler = gtk_hruler_new(); data->hruler = ruler = gtk_hruler_new();
@ -431,7 +457,7 @@ make_preview(GDrawable *drawable)
gtk_signal_connect_object(GTK_OBJECT(preview), "motion_notify_event", gtk_signal_connect_object(GTK_OBJECT(preview), "motion_notify_event",
(GtkSignalFunc) GTK_WIDGET_CLASS(GTK_OBJECT(ruler)->klass)->motion_notify_event, (GtkSignalFunc) GTK_WIDGET_CLASS(GTK_OBJECT(ruler)->klass)->motion_notify_event,
GTK_OBJECT(ruler)); GTK_OBJECT(ruler));
gtk_table_attach(GTK_TABLE(table), ruler, 1, 2, 0, 1, GTK_FILL, GTK_FILL, gtk_table_attach(GTK_TABLE(table), ruler, 1, 2, 0, 1, GTK_FILL, GTK_FILL,
0, 0); 0, 0);
gtk_widget_show(ruler); gtk_widget_show(ruler);
@ -441,11 +467,11 @@ make_preview(GDrawable *drawable)
gtk_signal_connect_object(GTK_OBJECT(preview), "motion_notify_event", gtk_signal_connect_object(GTK_OBJECT(preview), "motion_notify_event",
(GtkSignalFunc) GTK_WIDGET_CLASS (GTK_OBJECT (ruler)->klass)->motion_notify_event, (GtkSignalFunc) GTK_WIDGET_CLASS (GTK_OBJECT (ruler)->klass)->motion_notify_event,
GTK_OBJECT(ruler)); GTK_OBJECT(ruler));
gtk_table_attach(GTK_TABLE(table), ruler, 0, 1, 1, 2, GTK_FILL, GTK_FILL, gtk_table_attach(GTK_TABLE(table), ruler, 0, 1, 1, 2, GTK_FILL, GTK_FILL,
0, 0); 0, 0);
gtk_widget_show(ruler); gtk_widget_show(ruler);
gimp_pixel_rgn_init(&data->src_rgn, drawable, 0, 0, data->width, gimp_pixel_rgn_init(&data->src_rgn, drawable, 0, 0, data->width,
data->height, FALSE, FALSE); data->height, FALSE, FALSE);
render_preview(preview, &data->src_rgn); render_preview(preview, &data->src_rgn);

View File

@ -252,25 +252,25 @@ rectangle_near_sash(Object_t *obj, gint x, gint y)
{ {
Rectangle_t *rectangle = ObjectToRectangle(obj); Rectangle_t *rectangle = ObjectToRectangle(obj);
if (near_sash(rectangle->x, rectangle->y, x, y)) if (near_sash(rectangle->x, rectangle->y, x, y))
return &MoveUpperLeftSash; return MoveUpperLeftSash;
else if (near_sash(rectangle->x + rectangle->width / 2, rectangle->y, x, y)) else if (near_sash(rectangle->x + rectangle->width / 2, rectangle->y, x, y))
return &MoveUpperSash; return MoveUpperSash;
else if (near_sash(rectangle->x + rectangle->width, rectangle->y, x, y)) else if (near_sash(rectangle->x + rectangle->width, rectangle->y, x, y))
return &MoveUpperRightSash; return MoveUpperRightSash;
else if (near_sash(rectangle->x, rectangle->y + rectangle->height / 2, else if (near_sash(rectangle->x, rectangle->y + rectangle->height / 2,
x, y)) x, y))
return &MoveLeftSash; return MoveLeftSash;
else if (near_sash(rectangle->x + rectangle->width, else if (near_sash(rectangle->x + rectangle->width,
rectangle->y + rectangle->height / 2, x, y)) rectangle->y + rectangle->height / 2, x, y))
return &MoveRightSash; return MoveRightSash;
else if (near_sash(rectangle->x, rectangle->y + rectangle->height, x, y)) else if (near_sash(rectangle->x, rectangle->y + rectangle->height, x, y))
return &MoveLowerLeftSash; return MoveLowerLeftSash;
else if (near_sash(rectangle->x + rectangle->width / 2, else if (near_sash(rectangle->x + rectangle->width / 2,
rectangle->y + rectangle->height, x, y)) rectangle->y + rectangle->height, x, y))
return &MoveLowerSash; return MoveLowerSash;
else if (near_sash(rectangle->x + rectangle->width, else if (near_sash(rectangle->x + rectangle->width,
rectangle->y + rectangle->height, x, y)) rectangle->y + rectangle->height, x, y))
return &MoveLowerRightSash; return MoveLowerRightSash;
return NULL; return NULL;
} }

View File

@ -368,7 +368,7 @@ make_selection(GtkWidget *window, ObjectList_t *object_list)
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_clist_set_reorderable(GTK_CLIST(list), TRUE); */
/* Create scrollable window */ /* Create scrollable window */
swin = gtk_scrolled_window_new(NULL, NULL); swin = gtk_scrolled_window_new(NULL, NULL);

View File

@ -64,6 +64,7 @@ create_label_in_table(GtkWidget *table, int row, int col, const char *text)
GtkWidget *label = gtk_label_new(text); GtkWidget *label = gtk_label_new(text);
gtk_table_attach_defaults(GTK_TABLE(table), label, col, col + 1, gtk_table_attach_defaults(GTK_TABLE(table), label, col, col + 1,
row, row + 1); row, row + 1);
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
gtk_widget_show(label); gtk_widget_show(label);
return label; return label;
} }