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>
* plug-ins/Lighting/lighting_ui.c
......
......@@ -3,7 +3,7 @@
*
* 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
* it under the terms of the GNU General Public License as published by
......@@ -39,10 +39,10 @@ do_about_dialog(void)
default_dialog_hide_cancel_button(dialog);
default_dialog_hide_apply_button(dialog);
default_dialog_hide_help_button(dialog);
default_dialog_set_label(dialog, _("Imagemap plug-in 2.0"));
default_dialog_set_label(dialog, _("Imagemap plug-in 2.2"));
default_dialog_set_label(
dialog, _("Copyright(c) 1999-2003 by Maurits Rijk"));
default_dialog_set_label(dialog, _("lpeek.mrijk@consunet.nl"));
dialog, _("Copyright(c) 1999-2004 by Maurits Rijk"));
default_dialog_set_label(dialog, _("m.rijk@chello.nl"));
default_dialog_set_label(
dialog, _(" Released under the GNU General Public License "));
}
......
......@@ -3,7 +3,7 @@
*
* 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
* it under the terms of the GNU General Public License as published by
......
......@@ -3,7 +3,7 @@
*
* 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
* it under the terms of the GNU General Public License as published by
......@@ -59,23 +59,28 @@ static void
browse_cb (GtkWidget *widget,
BrowseWidget_t *browse)
{
if (! browse->file_selection)
if (!browse->file_selection)
{
GtkWidget *dialog;
dialog = browse->file_selection = gtk_file_selection_new (browse->name);
gtk_window_set_transient_for (GTK_WINDOW (dialog),
GTK_WINDOW (gtk_widget_get_toplevel (widget)));
g_signal_connect (dialog, "delete_event",
G_CALLBACK (gtk_true),
NULL);
dialog = browse->file_selection =
gtk_file_chooser_dialog_new (browse->name,
GTK_WINDOW (gtk_widget_get_toplevel (widget)),
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 (select_cb),
browse);
}
gtk_window_present (GTK_WINDOW (browse->file_selection));
}
......@@ -104,27 +109,27 @@ browse_widget_new(const gchar *name)
browse->name = name;
browse->filter = NULL;
browse->hbox = gtk_hbox_new(FALSE, 1);
gtk_widget_show(browse->hbox);
browse->hbox = gtk_hbox_new (FALSE, 1);
gtk_widget_show (browse->hbox);
browse->file = gtk_entry_new();
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,
2, GDK_ACTION_COPY);
g_signal_connect(browse->file, "drag_data_received",
G_CALLBACK(handle_drop), NULL);
browse->file = gtk_entry_new ();
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,
2, GDK_ACTION_COPY);
g_signal_connect (browse->file, "drag_data_received",
G_CALLBACK(handle_drop), NULL);
gtk_widget_show(browse->file);
gtk_widget_show (browse->file);
browse->button = button = gtk_button_new();
icon = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
gtk_container_add(GTK_CONTAINER(button), icon);
gtk_widget_show(icon);
browse->button = button = gtk_button_new ();
icon = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (button), icon);
gtk_widget_show (icon);
gtk_box_pack_end(GTK_BOX(browse->hbox), button, FALSE, FALSE, 0);
g_signal_connect(button, "clicked",
G_CALLBACK(browse_cb), (gpointer) browse);
gtk_widget_show(button);
gtk_box_pack_end(GTK_BOX (browse->hbox), button, FALSE, FALSE, 0);
g_signal_connect (button, "clicked",
G_CALLBACK(browse_cb), (gpointer) browse);
gtk_widget_show (button);
return browse;
}
......@@ -132,7 +137,7 @@ browse_widget_new(const gchar *name)
void
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
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
*
* 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
* it under the terms of the GNU General Public License as published by
......@@ -147,7 +147,7 @@ make_gimp_guides_dialog(void)
default_dialog_set_ok_cb(dialog, gimp_guides_ok_cb, data);
table = default_dialog_add_table(dialog, 3, 2);
frame = gtk_frame_new(_("Create"));
frame = gimp_frame_new(_("Create"));
gtk_widget_show(frame);
gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1);
......@@ -165,7 +165,7 @@ make_gimp_guides_dialog(void)
gtk_box_pack_start(GTK_BOX(hbox), data->all, TRUE, TRUE, 10);
gtk_widget_show(data->all);
frame = gtk_frame_new(_("Add Additional Guides"));
frame = gimp_frame_new(_("Add Additional Guides"));
gtk_widget_show(frame);
gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 1, 2);
......
......@@ -316,17 +316,17 @@ csim_error(char* s)
}
gboolean
load_csim(const char* filename)
load_csim (const char* filename)
{
gboolean status;
extern FILE *csim_in;
csim_in = fopen(filename, "r");
if (csim_in) {
_map_info = get_map_info();
status = !csim_parse();
fclose(csim_in);
} else {
status = FALSE;
}
return status;
gboolean status;
extern FILE *csim_in;
csim_in = fopen(filename, "r");
if (csim_in) {
_map_info = get_map_info();
status = !csim_parse();
fclose(csim_in);
} else {
status = FALSE;
}
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,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
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 {
#ifndef YYSTYPE
typedef union {
int val;
double value;
char id[256];
} YYSTYPE;
/* Line 1240 of yacc.c. */
#line 99 "y.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
} yystype;
# define YYSTYPE yystype
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE csim_lval;
# define IMG 257
# 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 @@
*
* 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
* 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)
gtk_table_set_row_spacings(GTK_TABLE(table), 10);
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_widget_show(frame);
......@@ -306,7 +306,7 @@ create_info_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook)
gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
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_widget_show(frame);
......
......@@ -3,7 +3,7 @@
*
* 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
* it under the terms of the GNU General Public License as published by
......@@ -26,7 +26,6 @@
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "imap_default_dialog.h"
#include "imap_file.h"
#include "imap_main.h"
#include "imap_misc.h"
......@@ -60,45 +59,66 @@ open_cb (GtkFileSelection *fs,
void
do_file_open_dialog (void)
{
static GtkWidget *dialog;
static GtkWidget *dialog;
if (! dialog)
{
dialog = gtk_file_selection_new (_("Load Imagemap"));
g_signal_connect (dialog, "delete_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (open_cb),
NULL);
}
gtk_window_present (GTK_WINDOW (dialog));
if (! dialog)
{
dialog =
gtk_file_chooser_dialog_new (_("Load 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 (open_cb),
dialog);
}
gtk_window_present (GTK_WINDOW (dialog));
}
static void
really_overwrite(gpointer data)
really_overwrite_cb (GtkMessageDialog *dialog,
gint response_id,
gpointer data)
{
gtk_widget_hide((GtkWidget*) data);
save_as(gtk_file_selection_get_filename(GTK_FILE_SELECTION(data)));
if (response_id == GTK_RESPONSE_YES)
{
save_as (gtk_file_selection_get_filename (GTK_FILE_SELECTION (data)));
}
gtk_widget_hide (GTK_WIDGET (dialog));
}
static void
do_file_exists_dialog(gpointer data)
do_file_exists_dialog (gpointer data)
{
static DefaultDialog_t *dialog;
if (!dialog) {
dialog = make_default_dialog(_("File exists!"));
default_dialog_hide_apply_button(dialog);
default_dialog_set_ok_cb(dialog, really_overwrite, data);
default_dialog_set_label(
dialog,
_("File already exists.\n"
" Do you really want to overwrite? "));
}
default_dialog_show(dialog);
static GtkWidget *dialog;
if (!dialog)
{
dialog = gtk_message_dialog_new_with_markup
(GTK_WINDOW(get_dialog()),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
_("<span weight=\"bold\" size=\"larger\">File already exists.</span>\n\n"
"Do you really want to overwrite?"));
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
......@@ -109,9 +129,9 @@ save_cb (GtkFileSelection *fs,
if (response_id == GTK_RESPONSE_OK)
{
const gchar *filename;
filename = gtk_file_selection_get_filename (fs);
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
{
do_file_exists_dialog (fs);
......@@ -127,32 +147,43 @@ save_cb (GtkFileSelection *fs,
void
do_file_save_as_dialog (void)
{
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);
}
static GtkWidget *dialog;
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
do_file_error_dialog(const char *error, const char *filename)
{
static Alert_t *alert;
if (!alert)
alert = create_alert(GTK_STOCK_DIALOG_ERROR);
alert_set_text(alert, error, gimp_filename_to_utf8 (filename));
default_dialog_show(alert->dialog);
static Alert_t *alert;
if (!alert)
alert = create_alert (GTK_STOCK_DIALOG_ERROR);
alert_set_text(alert, error, gimp_filename_to_utf8 (filename));
alert_set_text (alert, error, filename);
default_dialog_show (alert->dialog);
}
......@@ -3,7 +3,7 @@
*
* 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
* it under the terms of the GNU General Public License as published by
......@@ -28,8 +28,8 @@ void do_file_open_dialog(void);
void do_file_save_as_dialog(void);
void do_file_error_dialog(const char *error, const char *filename);
gboolean load_csim(const char* filename);
gboolean load_cern(const char* filename);
gboolean load_ncsa(const char* filename);
gboolean load_csim (const char* filename);
gboolean load_cern (const char* filename);
gboolean load_ncsa (const char* filename);
#endif /* _IMAP_FILE_H */
......@@ -208,7 +208,7 @@ create_grid_settings_dialog()
gtk_table_attach_defaults(GTK_TABLE(main_table), data->snap, 0, 1, 0, 1);
gtk_widget_show(data->snap);
data->type_frame = frame = gtk_frame_new(_("Grid Visibility and Type"));
data->type_frame = frame = gimp_frame_new(_("Grid Visibility and Type"));
gtk_widget_show(frame);
gtk_table_attach_defaults(GTK_TABLE(main_table), frame, 0, 2, 1, 2);
hbox = gtk_hbox_new(FALSE, 1);
......@@ -240,7 +240,7 @@ create_grid_settings_dialog()
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 10);
gtk_widget_show(button);
data->granularity_frame = frame = gtk_frame_new(_("Grid Granularity"));
data->granularity_frame = frame = gimp_frame_new(_("Grid Granularity"));
gtk_table_attach_defaults(GTK_TABLE(main_table), frame, 0, 1, 2, 3);
table = gtk_table_new(2, 4, FALSE);
gtk_container_set_border_width(GTK_CONTAINER(table), 10);
......@@ -268,7 +268,7 @@ create_grid_settings_dialog()
gtk_widget_show(table);
gtk_widget_show(frame);
data->offset_frame = frame = gtk_frame_new(_("Grid Offset"));
data->offset_frame = frame = gimp_frame_new(_("Grid Offset"));
gtk_table_attach_defaults(GTK_TABLE(main_table), frame, 1, 2, 2, 3);
table = gtk_table_new(2, 3, FALSE);
gtk_container_set_border_width(GTK_CONTAINER(table), 10);
......
......@@ -178,6 +178,12 @@ run (const gchar *name,
values[0].data.d_status = status;
}
GtkWidget*
get_dialog(void)
{
return _dlg;
}
MRU_t*
get_mru(void)
{
......
......@@ -48,6 +48,7 @@ void main_clear_dimension(void);
void load(const gchar *filename);
void save_as(const gchar *filename);
void dump_output(gpointer param, OutputFunc_t output);
GtkWidget *get_dialog(void);
MRU_t *get_mru(void);
MapInfo_t *get_map_info(void);
PreferencesData_t *get_preferences(void);
......
......@@ -3,7 +3,7 @@
*
* 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
* it under the terms of the GNU General Public License as published by
......
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,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
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 {
RECTANGLE = 258,
POLYGON = 259,
CIRCLE = 260,
DEFAULT = 261,
AUTHOR = 262,
TITLE = 263,
DESCRIPTION = 264,
BEGIN_COMMENT = 265,
FLOAT = 266,
LINK = 267,