Commit f02a8b61 authored by Maurits Rijk's avatar Maurits Rijk

HIG-ified, replaced deprecated widget GtkCList by GtkTreeModel/View (also

* plug-ins/imagemap/imap_*.[ch]: (partly) HIG-ified, replaced
  deprecated widget GtkCList by GtkTreeModel/View (also fixes #136893),
  use file choosers instead of file selectors, minor clean-up.
parent 1f786473
2004-05-20 Maurits Rijk <m.rijk@chello.nl>
* plug-ins/imagemap/imap_*.[ch]: (partly) HIG-ified, replaced
deprecated widget GtkCList by GtkTreeModel/View (also fixes #136893),
use file choosers instead of file selectors, minor clean-up.
2004-05-20 Sven Neumann <sven@gimp.org> 2004-05-20 Sven Neumann <sven@gimp.org>
* plug-ins/Lighting/lighting_ui.c * plug-ins/Lighting/lighting_ui.c
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Generates clickable image maps. * Generates clickable image maps.
* *
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl * Copyright (C) 1998-2004 Maurits Rijk m.rijk@chello.nl
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -39,10 +39,10 @@ do_about_dialog(void) ...@@ -39,10 +39,10 @@ do_about_dialog(void)
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_hide_help_button(dialog);
default_dialog_set_label(dialog, _("Imagemap plug-in 2.0")); default_dialog_set_label(dialog, _("Imagemap plug-in 2.2"));
default_dialog_set_label( default_dialog_set_label(
dialog, _("Copyright(c) 1999-2003 by Maurits Rijk")); dialog, _("Copyright(c) 1999-2004 by Maurits Rijk"));
default_dialog_set_label(dialog, _("lpeek.mrijk@consunet.nl")); default_dialog_set_label(dialog, _("m.rijk@chello.nl"));
default_dialog_set_label( default_dialog_set_label(
dialog, _(" Released under the GNU General Public License ")); dialog, _(" Released under the GNU General Public License "));
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Generates clickable image maps. * Generates clickable image maps.
* *
* Copyright (C) 1998-1999 Maurits Rijk lpeek.mrijk@consunet.nl * Copyright (C) 1998-2004 Maurits Rijk m.rijk@chello.nl
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Generates clickable image maps. * Generates clickable image maps.
* *
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl * Copyright (C) 1998-2004 Maurits Rijk m.rijk@chello.nl
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -59,23 +59,28 @@ static void ...@@ -59,23 +59,28 @@ static void
browse_cb (GtkWidget *widget, browse_cb (GtkWidget *widget,
BrowseWidget_t *browse) BrowseWidget_t *browse)
{ {
if (! browse->file_selection) if (!browse->file_selection)
{ {
GtkWidget *dialog; GtkWidget *dialog;
dialog = browse->file_selection = gtk_file_selection_new (browse->name); dialog = browse->file_selection =
gtk_file_chooser_dialog_new (browse->name,
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (gtk_widget_get_toplevel (widget)),
GTK_WINDOW (gtk_widget_get_toplevel (widget))); GTK_FILE_CHOOSER_ACTION_OPEN,
g_signal_connect (dialog, "delete_event", GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
G_CALLBACK (gtk_true), GTK_STOCK_OPEN, GTK_RESPONSE_OK,
NULL);
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&dialog);
g_signal_connect (dialog, "response", g_signal_connect (dialog, "response",
G_CALLBACK (select_cb), G_CALLBACK (select_cb),
browse); browse);
} }
gtk_window_present (GTK_WINDOW (browse->file_selection)); gtk_window_present (GTK_WINDOW (browse->file_selection));
} }
...@@ -104,27 +109,27 @@ browse_widget_new(const gchar *name) ...@@ -104,27 +109,27 @@ browse_widget_new(const gchar *name)
browse->name = name; browse->name = name;
browse->filter = NULL; browse->filter = NULL;
browse->hbox = gtk_hbox_new(FALSE, 1); browse->hbox = gtk_hbox_new (FALSE, 1);
gtk_widget_show(browse->hbox); gtk_widget_show (browse->hbox);
browse->file = gtk_entry_new(); browse->file = gtk_entry_new ();
gtk_box_pack_start(GTK_BOX(browse->hbox), browse->file, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX(browse->hbox), browse->file, TRUE, TRUE, 0);
gtk_drag_dest_set(browse->file, GTK_DEST_DEFAULT_ALL, target_table, gtk_drag_dest_set (browse->file, GTK_DEST_DEFAULT_ALL, target_table,
2, GDK_ACTION_COPY); 2, GDK_ACTION_COPY);
g_signal_connect(browse->file, "drag_data_received", g_signal_connect (browse->file, "drag_data_received",
G_CALLBACK(handle_drop), NULL); G_CALLBACK(handle_drop), NULL);
gtk_widget_show(browse->file); gtk_widget_show (browse->file);
browse->button = button = gtk_button_new(); browse->button = button = gtk_button_new ();
icon = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON); icon = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
gtk_container_add(GTK_CONTAINER(button), icon); gtk_container_add (GTK_CONTAINER (button), icon);
gtk_widget_show(icon); gtk_widget_show (icon);
gtk_box_pack_end(GTK_BOX(browse->hbox), button, FALSE, FALSE, 0); gtk_box_pack_end(GTK_BOX (browse->hbox), button, FALSE, FALSE, 0);
g_signal_connect(button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK(browse_cb), (gpointer) browse); G_CALLBACK(browse_cb), (gpointer) browse);
gtk_widget_show(button); gtk_widget_show (button);
return browse; return browse;
} }
...@@ -132,7 +137,7 @@ browse_widget_new(const gchar *name) ...@@ -132,7 +137,7 @@ browse_widget_new(const gchar *name)
void void
browse_widget_set_filename(BrowseWidget_t *browse, const gchar *filename) browse_widget_set_filename(BrowseWidget_t *browse, const gchar *filename)
{ {
gtk_entry_set_text(GTK_ENTRY(browse->file), filename); gtk_entry_set_text (GTK_ENTRY (browse->file), filename);
} }
void void
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Generates clickable image maps. * Generates clickable image maps.
* *
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl * Copyright (C) 1998-2004 Maurits Rijk m.rijk@chello.nl
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -147,7 +147,7 @@ make_gimp_guides_dialog(void) ...@@ -147,7 +147,7 @@ make_gimp_guides_dialog(void)
default_dialog_set_ok_cb(dialog, gimp_guides_ok_cb, data); default_dialog_set_ok_cb(dialog, gimp_guides_ok_cb, data);
table = default_dialog_add_table(dialog, 3, 2); table = default_dialog_add_table(dialog, 3, 2);
frame = gtk_frame_new(_("Create")); frame = gimp_frame_new(_("Create"));
gtk_widget_show(frame); gtk_widget_show(frame);
gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1); gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1);
...@@ -165,7 +165,7 @@ make_gimp_guides_dialog(void) ...@@ -165,7 +165,7 @@ make_gimp_guides_dialog(void)
gtk_box_pack_start(GTK_BOX(hbox), data->all, TRUE, TRUE, 10); gtk_box_pack_start(GTK_BOX(hbox), data->all, TRUE, TRUE, 10);
gtk_widget_show(data->all); gtk_widget_show(data->all);
frame = gtk_frame_new(_("Add Additional Guides")); frame = gimp_frame_new(_("Add Additional Guides"));
gtk_widget_show(frame); gtk_widget_show(frame);
gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 1, 2); gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 1, 2);
......
...@@ -316,17 +316,17 @@ csim_error(char* s) ...@@ -316,17 +316,17 @@ csim_error(char* s)
} }
gboolean gboolean
load_csim(const char* filename) load_csim (const char* filename)
{ {
gboolean status; gboolean status;
extern FILE *csim_in; extern FILE *csim_in;
csim_in = fopen(filename, "r"); csim_in = fopen(filename, "r");
if (csim_in) { if (csim_in) {
_map_info = get_map_info(); _map_info = get_map_info();
status = !csim_parse(); status = !csim_parse();
fclose(csim_in); fclose(csim_in);
} else { } else {
status = FALSE; status = FALSE;
} }
return status; return status;
} }
This diff is collapsed.
/* A Bison parser, made by GNU Bison 1.875a. */ #ifndef BISON_Y_TAB_H
# define BISON_Y_TAB_H
/* Skeleton parser for Yacc-like parsing with Bison, #ifndef YYSTYPE
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. typedef union {
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, 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. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
IMG = 258,
SRC = 259,
WIDTH = 260,
HEIGHT = 261,
BORDER = 262,
USEMAP = 263,
START_MAP = 264,
END_MAP = 265,
NAME = 266,
AREA = 267,
SHAPE = 268,
COORDS = 269,
ALT = 270,
HREF = 271,
NOHREF = 272,
TARGET = 273,
ONMOUSEOVER = 274,
ONMOUSEOUT = 275,
ONFOCUS = 276,
ONBLUR = 277,
AUTHOR = 278,
DESCRIPTION = 279,
BEGIN_COMMENT = 280,
END_COMMENT = 281,
FLOAT = 282,
STRING = 283
};
#endif
#define IMG 258
#define SRC 259
#define WIDTH 260
#define HEIGHT 261
#define BORDER 262
#define USEMAP 263
#define START_MAP 264
#define END_MAP 265
#define NAME 266
#define AREA 267
#define SHAPE 268
#define COORDS 269
#define ALT 270
#define HREF 271
#define NOHREF 272
#define TARGET 273
#define ONMOUSEOVER 274
#define ONMOUSEOUT 275
#define ONFOCUS 276
#define ONBLUR 277
#define AUTHOR 278
#define DESCRIPTION 279
#define BEGIN_COMMENT 280
#define END_COMMENT 281
#define FLOAT 282
#define STRING 283
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 47 "imap_csim.y"
typedef union YYSTYPE {
int val; int val;
double value; double value;
char id[256]; char id[256];
} YYSTYPE; } yystype;
/* Line 1240 of yacc.c. */ # define YYSTYPE yystype
#line 99 "y.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
#endif #endif
# define IMG 257
extern YYSTYPE csim_lval; # define SRC 258
# define WIDTH 259
# define HEIGHT 260
# define BORDER 261
# define USEMAP 262
# define START_MAP 263
# define END_MAP 264
# define NAME 265
# define AREA 266
# define SHAPE 267
# define COORDS 268
# define ALT 269
# define HREF 270
# define NOHREF 271
# define TARGET 272
# define ONMOUSEOVER 273
# define ONMOUSEOUT 274
# define ONFOCUS 275
# define ONBLUR 276
# define AUTHOR 277
# define DESCRIPTION 278
# define BEGIN_COMMENT 279
# define END_COMMENT 280
# define FLOAT 281
# define STRING 282
extern YYSTYPE csim_lval;
#endif /* not BISON_Y_TAB_H */
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Generates clickable image maps. * Generates clickable image maps.
* *
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl * Copyright (C) 1998-2004 Maurits Rijk m.rijk@chello.nl
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -192,7 +192,7 @@ create_link_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook) ...@@ -192,7 +192,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 = gimp_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);
...@@ -306,7 +306,7 @@ create_info_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook) ...@@ -306,7 +306,7 @@ create_info_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook)
gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
gtk_widget_show(vbox); gtk_widget_show(vbox);
frame = gtk_frame_new(_("Dimensions")); frame = gimp_frame_new(_("Dimensions"));
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
gtk_widget_show(frame); gtk_widget_show(frame);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Generates clickable image maps. * Generates clickable image maps.
* *
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl * Copyright (C) 1998-2004 Maurits Rijk m.rijk@chello.nl
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <libgimp/gimp.h> #include <libgimp/gimp.h>
#include <libgimp/gimpui.h> #include <libgimp/gimpui.h>
#include "imap_default_dialog.h"
#include "imap_file.h" #include "imap_file.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_misc.h" #include "imap_misc.h"
...@@ -60,45 +59,66 @@ open_cb (GtkFileSelection *fs, ...@@ -60,45 +59,66 @@ open_cb (GtkFileSelection *fs,
void void
do_file_open_dialog (void) 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_chooser_dialog_new (_("Load Imagemap"),
g_signal_connect (dialog, "delete_event", NULL,
G_CALLBACK (gtk_true), GTK_FILE_CHOOSER_ACTION_OPEN,
NULL);
g_signal_connect (dialog, "response", GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
G_CALLBACK (open_cb), GTK_STOCK_OPEN, GTK_RESPONSE_OK,
NULL);
} NULL);
gtk_window_present (GTK_WINDOW (dialog)); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&dialog);
g_signal_connect (dialog, "response",
G_CALLBACK (open_cb),
dialog);
}
gtk_window_present (GTK_WINDOW (dialog));
} }
static void static void
really_overwrite(gpointer data) really_overwrite_cb (GtkMessageDialog *dialog,
gint response_id,
gpointer data)
{ {
gtk_widget_hide((GtkWidget*) data); if (response_id == GTK_RESPONSE_YES)
save_as(gtk_file_selection_get_filename(GTK_FILE_SELECTION(data))); {
save_as (gtk_file_selection_get_filename (GTK_FILE_SELECTION (data)));
}
gtk_widget_hide (GTK_WIDGET (dialog));
} }
static void static void
do_file_exists_dialog(gpointer data) do_file_exists_dialog (gpointer data)
{ {
static DefaultDialog_t *dialog; static GtkWidget *dialog;
if (!dialog) { if (!dialog)
dialog = make_default_dialog(_("File exists!")); {
default_dialog_hide_apply_button(dialog); dialog = gtk_message_dialog_new_with_markup
default_dialog_set_ok_cb(dialog, really_overwrite, data); (GTK_WINDOW(get_dialog()),
default_dialog_set_label( GTK_DIALOG_DESTROY_WITH_PARENT,
dialog, GTK_MESSAGE_QUESTION,
_("File already exists.\n" GTK_BUTTONS_YES_NO,
" Do you really want to overwrite? ")); _("<span weight=\"bold\" size=\"larger\">File already exists.</span>\n\n"
} "Do you really want to overwrite?"));
default_dialog_show(dialog); g_signal_connect (dialog, "delete_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (really_overwrite_cb),
data);
}
gtk_widget_show (dialog);
} }
static void static void
...@@ -109,9 +129,9 @@ save_cb (GtkFileSelection *fs, ...@@ -109,9 +129,9 @@ save_cb (GtkFileSelection *fs,
if (response_id == GTK_RESPONSE_OK) if (response_id == GTK_RESPONSE_OK)
{ {
const gchar *filename; const gchar *filename;
filename = gtk_file_selection_get_filename (fs); filename = gtk_file_selection_get_filename (fs);
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
{ {
do_file_exists_dialog (fs); do_file_exists_dialog (fs);
...@@ -127,32 +147,43 @@ save_cb (GtkFileSelection *fs, ...@@ -127,32 +147,43 @@ save_cb (GtkFileSelection *fs,
void void
do_file_save_as_dialog (void) do_file_save_as_dialog (void)
{ {
static GtkWidget *dialog; static GtkWidget *dialog;
if (! dialog)
{
dialog = gtk_file_selection_new (_("Save Imagemap"));
g_signal_connect (dialog, "delete_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (save_cb),
NULL);
}
gtk_window_present (GTK_WINDOW (dialog)); if (! dialog)
{
dialog =
gtk_file_chooser_dialog_new (_("Save Imagemap"),
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&dialog);
g_signal_connect (dialog, "response",
G_CALLBACK (save_cb),
dialog);
}
gtk_window_present (GTK_WINDOW (dialog));
} }
void void
do_file_error_dialog(const char *error, const char *filename) do_file_error_dialog(const char *error, const char *filename)
{ {
static Alert_t *alert; static Alert_t *alert;