Commit e390f9a4 authored by Maurits Rijk's avatar Maurits Rijk

Fixes for #92750 and #97771. Removed use off deprecated GtkText. Replaced...

Fixes for #92750 and #97771. Removed use off deprecated GtkText. Replaced arrow_up and arrow_down by stock icons.
parent 9a9bce1f
2002-12-14 Maurits Rijk <lpeek.mrijk@consunet.nl>
* plug-ins/imagemap/imap_preferences.c: make sure that undo level
is at least 1. Fixes #97771
* plug-ins/imagemap/imap_file.c: fixes #92750
2002-12-13 Maurits Rijk <lpeek.mrijk@consunet.nl>
* plug-ins/imagemap/imap_settings.c
* plug-ins/imagemap/imap_source.[ch]: remove usage of deprecated
GtkText widget
* plug-ins/imagemap/arrow_up.xpm
* plug-ins/imagemap/arrow_down.xpm: removed.
* plug-ins/imagemap/imap_main.c
* plug-ins/imagemap/imap_misc.[ch]: clean-up some code since we now
only use stock icons.
* plug-ins/imagemap/imap_selection.c: use GTK stock icons for arrow up
and arrow down.
* plug-ins/imagemap/imap_default_dialog.c: code clean-up
2002-12-13 Sven Neumann <sven@gimp.org>
* plug-ins/common/tiff.c: merged fix for #97352 from stable branch.
......
/* XPM */
static char * arrow_down_xpm[] = {
"16 16 7 1",
" c None",
". c #000000",
"+ c #248124",
"@ c #489F48",
"# c #6DBD6D",
"$ c #6DBC6D",
"% c #91DA91",
" ",
" ",
" ............. ",
" .++++++++@. ",
" .+@@@@@@#@. ",
" .@$####@. ",
" .@$%%%#@. ",
" .@$%#@. ",
" .@$%#@. ",
" .@$@. ",
" .@$@. ",
" .@. ",
" .@. ",
" . ",
" . ",
" "};
/* XPM */
static char * arrow_up_xpm[] = {
"16 16 8 1",
" c None",
". c #000000",
"+ c #1D7B1D",
"@ c #3A933A",
"# c #57AB57",
"$ c #74C274",
"% c #91DA91",
"& c #74C374",
" ",
" . ",
" . ",
" .+. ",
" .@. ",
" .@#@. ",
" .@#@. ",
" .@#$#@. ",
" .@#$#@. ",
" .@#$%&#@. ",
" .@#&&&#@. ",
" .+#######@. ",
" .@@@@@@@@@. ",
" ............. ",
" ",
" "};
......@@ -107,7 +107,6 @@ _command_list_add(CommandList_t *list, Command_t *command)
command_destruct(curr);
list->list = g_list_remove_link(list->list, p);
}
if (g_list_length(list->list) == list->undo_levels) {
GList *first = g_list_first(list->list);
Command_t *curr = (Command_t*) first->data;
......
......@@ -95,58 +95,33 @@ default_dialog_set_cancel_cb(DefaultDialog_t *dialog,
DefaultDialog_t*
make_default_dialog(const gchar *title)
{
DefaultDialog_t *data = (DefaultDialog_t*) g_new(DefaultDialog_t, 1);
GtkWidget *dialog, *hbbox;
DefaultDialog_t *data = g_new(DefaultDialog_t, 1);
GtkWidget *dialog;
data->ok_cb = NULL;
data->apply_cb = NULL;
data->cancel_cb = NULL;
data->dialog = dialog = gtk_dialog_new();
dialog = gimp_dialog_new (title, "imagemap",
gimp_standard_help_func, "filters/imagemap.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
if (title)
gtk_window_set_title(GTK_WINDOW(dialog), title);
GTK_STOCK_APPLY, dialog_apply,
data, NULL, &data->apply, FALSE, FALSE,
GTK_STOCK_CANCEL, dialog_cancel,
data, NULL, &data->cancel, FALSE, FALSE,
GTK_STOCK_OK, dialog_ok,
data, NULL, &data->ok, TRUE, FALSE,
NULL);
data->dialog = dialog;
g_signal_connect (G_OBJECT(dialog), "destroy",
G_CALLBACK(gtk_widget_destroyed), &data->dialog);
g_signal_connect(G_OBJECT(dialog), "delete_event",
G_CALLBACK(dialog_destroy), (gpointer) data);
/* Action area */
gtk_container_set_border_width(GTK_CONTAINER(
GTK_DIALOG(dialog)->action_area), 12);
gtk_box_set_homogeneous(GTK_BOX(GTK_DIALOG(dialog)->action_area), FALSE);
hbbox = gtk_hbutton_box_new();
gtk_box_set_spacing(GTK_BOX(hbbox), 6);
gtk_box_pack_end(GTK_BOX(GTK_DIALOG(dialog)->action_area), hbbox, FALSE,
FALSE, 0);
gtk_widget_show (hbbox);
data->ok = gtk_button_new_from_stock(GTK_STOCK_OK);
GTK_WIDGET_SET_FLAGS(data->ok, GTK_CAN_DEFAULT);
g_signal_connect(G_OBJECT(data->ok), "clicked",
G_CALLBACK(dialog_ok), (gpointer) data);
gtk_box_pack_start(GTK_BOX(hbbox), data->ok, FALSE, FALSE, 0);
gtk_widget_grab_default(data->ok);
gtk_widget_show(data->ok);
data->apply = gtk_button_new_from_stock(GTK_STOCK_APPLY);
GTK_WIDGET_SET_FLAGS(data->apply, GTK_CAN_DEFAULT);
g_signal_connect(G_OBJECT(data->apply), "clicked",
G_CALLBACK(dialog_apply), (gpointer) data);
gtk_box_pack_start(GTK_BOX(hbbox), data->apply, FALSE, FALSE, 0);
gtk_widget_show(data->apply);
data->cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
GTK_WIDGET_SET_FLAGS(data->cancel, GTK_CAN_DEFAULT);
g_signal_connect(G_OBJECT(data->cancel), "clicked",
G_CALLBACK(dialog_cancel), (gpointer) data);
gtk_box_pack_start(GTK_BOX(hbbox), data->cancel, FALSE, FALSE, 0);
gtk_widget_show(data->cancel);
data->help = gtk_button_new_with_label(_("Help..."));
/* Fix me: no action yet
GTK_WIDGET_SET_FLAGS(data->help, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(hbbox), data->help, FALSE, FALSE, 0);
gtk_widget_show(data->help);
*/
return data;
}
......@@ -172,7 +147,7 @@ default_dialog_hide_apply_button(DefaultDialog_t *dialog)
void
default_dialog_hide_help_button(DefaultDialog_t *dialog)
{
gtk_widget_hide(dialog->help);
/* gtk_widget_hide(dialog->help); */
}
void
......
......@@ -65,6 +65,8 @@ do_file_open_dialog(void)
"clicked", G_CALLBACK(gtk_widget_hide), dialog);
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button),
"clicked", G_CALLBACK(open_cb), dialog);
g_signal_connect(G_OBJECT(dialog), "delete_event",
G_CALLBACK(gtk_widget_hide), NULL);
}
gtk_widget_show(dialog);
}
......@@ -125,6 +127,8 @@ do_file_save_as_dialog(void)
"clicked", G_CALLBACK(gtk_widget_hide), dialog);
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button),
"clicked", G_CALLBACK(save_cb), dialog);
g_signal_connect(G_OBJECT(dialog), "delete_event",
G_CALLBACK(gtk_widget_hide), NULL);
}
gtk_widget_show(dialog);
}
......
......@@ -28,11 +28,6 @@
#include <stdio.h>
#include <string.h>
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h> /* for keyboard values */
......@@ -93,7 +88,7 @@
/* Global variables */
static MapInfo_t _map_info;
static PreferencesData_t _preferences = {CSIM, TRUE, FALSE, TRUE, TRUE, FALSE,
FALSE, DEFAULT_UNDO_LEVELS, DEFAULT_MRU_SIZE};
FALSE, TRUE, DEFAULT_UNDO_LEVELS, DEFAULT_MRU_SIZE};
static MRU_t *_mru;
static GimpDrawable *_drawable;
......@@ -264,7 +259,6 @@ init_preferences(void)
command_list_set_undo_level(_preferences.undo_levels);
}
gint
get_image_width(void)
{
......@@ -1162,7 +1156,7 @@ key_timeout_cb(gpointer data)
static gboolean
key_press_cb(GtkWidget *widget, GdkEventKey *event)
{
gint handled = FALSE;
gboolean handled = FALSE;
gboolean shift = event->state & GDK_SHIFT_MASK;
Command_t *command;
......@@ -1197,7 +1191,7 @@ key_press_cb(GtkWidget *widget, GdkEventKey *event)
break;
}
if (handled)
gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "key_press_event");
g_signal_stop_emission_by_name(G_OBJECT(widget), "key_press_event");
return handled;
}
......@@ -1358,7 +1352,7 @@ factory_menu_zoom_out(void)
static Command_t*
factory_zoom_in(void)
{
return command_new((void (*)(void)) zoom_in);
return command_new((void (*)(void)) zoom_in);
}
static Command_t*
......@@ -1448,12 +1442,12 @@ dialog(GimpDrawable *drawable)
gimp_help_connect (dlg, gimp_standard_help_func, "filters/imagemap.html");
gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_MOUSE);
gtk_signal_connect(GTK_OBJECT(dlg), "destroy",
(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);
g_signal_connect(G_OBJECT(dlg), "destroy",
G_CALLBACK(close_callback), NULL);
g_signal_connect(G_OBJECT(dlg), "key_press_event",
G_CALLBACK(key_press_cb), NULL);
g_signal_connect(G_OBJECT(dlg), "key_release_event",
G_CALLBACK(key_release_cb), NULL);
main_vbox = gtk_vbox_new(FALSE, 1);
gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 1);
......@@ -1542,7 +1536,7 @@ dialog(GimpDrawable *drawable)
object_list_add_select_cb(_shapes, data_selected, NULL);
/* Selection */
_selection = make_selection(dlg, _shapes);
_selection = make_selection(_shapes);
selection_set_move_up_command(_selection, factory_move_up);
selection_set_move_down_command(_selection, factory_move_down);
selection_set_delete_command(_selection, factory_clear);
......
......@@ -23,36 +23,11 @@
#include "config.h"
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "imap_main.h"
#include "imap_misc.h"
GtkWidget*
make_toolbar_icon(GtkWidget *toolbar, GtkWidget *window, char **data,
const char *identifier, const char *tooltip,
void (*callback)(GtkWidget*, gpointer), gpointer udata)
{
GtkWidget *iconw;
GdkPixmap *icon;
GdkBitmap *mask;
GtkStyle *style;
style = gtk_widget_get_style(window);
icon = gdk_pixmap_create_from_xpm_d(window->window, &mask,
&style->bg[GTK_STATE_NORMAL],
data);
iconw = gtk_pixmap_new(icon, mask);
return gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
identifier, tooltip, NULL, iconw,
GTK_SIGNAL_FUNC(callback), udata);
}
GtkWidget*
make_toolbar_stock_icon(GtkWidget *toolbar, const gchar *stock_id,
const char *identifier, const char *tooltip,
......
......@@ -24,11 +24,6 @@
#ifndef _IMAP_MISC_H
#define _IMAP_MISC_H
GtkWidget *make_toolbar_icon(GtkWidget *toolbar, GtkWidget *window,
char **data, const char *identifier,
const char *tooltip,
void (*callback)(GtkWidget*, gpointer),
gpointer udata);
GtkWidget *make_toolbar_stock_icon(GtkWidget *toolbar, const gchar *stock_id,
const char *identifier,
const char *tooltip,
......
......@@ -113,8 +113,12 @@ parse_line(PreferencesData_t *data, char *line)
data->use_doublesized = parse_yes_no();
} else if (!strcmp(token, "mru-size")) {
data->mru_size = parse_int();
if (data->mru_size < 1)
data->mru_size = 1;
} else if (!strcmp(token, "undo-levels")) {
data->undo_levels = parse_int();
if (data->undo_levels < 1)
data->undo_levels = 1;
} else if (!strcmp(token, "normal-fg-color")) {
parse_color(&colors->normal_fg);
} else if (!strcmp(token, "normal-bg-color")) {
......
......@@ -43,9 +43,6 @@
#include "libgimp/stdplugins-intl.h"
#include "arrow_up.xpm"
#include "arrow_down.xpm"
static void
set_buttons(Selection_t *data)
{
......@@ -158,7 +155,7 @@ selection_command(GtkWidget *widget, gpointer data)
}
static GtkWidget*
make_selection_toolbar(Selection_t *data, GtkWidget *window)
make_selection_toolbar(Selection_t *data)
{
GtkWidget *toolbar;
......@@ -167,13 +164,14 @@ make_selection_toolbar(Selection_t *data, GtkWidget *window)
gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar), GTK_ORIENTATION_VERTICAL);
gtk_container_set_border_width(GTK_CONTAINER(toolbar), 5);
data->arrow_up = make_toolbar_icon(toolbar, window, arrow_up_xpm, "MoveUp",
_("Move Up"), selection_command,
&data->cmd_move_up);
data->arrow_down = make_toolbar_icon(toolbar, window, arrow_down_xpm,
"MoveDown", _("Move Down"),
selection_command,
&data->cmd_move_down);
data->arrow_up = make_toolbar_stock_icon(toolbar, GTK_STOCK_GO_UP,
"MoveUp", _("Move Up"),
selection_command,
&data->cmd_move_up);
data->arrow_down = make_toolbar_stock_icon(toolbar, GTK_STOCK_GO_DOWN,
"MoveDown", _("Move Down"),
selection_command,
&data->cmd_move_down);
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
data->edit = make_toolbar_stock_icon(toolbar, GTK_STOCK_PROPERTIES,
"Edit", _("Edit"), selection_command,
......@@ -338,7 +336,7 @@ handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
}
Selection_t*
make_selection(GtkWidget *window, ObjectList_t *object_list)
make_selection(ObjectList_t *object_list)
{
Selection_t *data = g_new(Selection_t, 1);
GtkWidget *swin, *frame, *hbox;
......@@ -362,7 +360,7 @@ make_selection(GtkWidget *window, ObjectList_t *object_list)
gtk_container_add(GTK_CONTAINER(frame), hbox);
gtk_widget_show(hbox);
toolbar = make_selection_toolbar(data, window);
toolbar = make_selection_toolbar(data);
gtk_container_add(GTK_CONTAINER(hbox), toolbar);
/* Create selection */
......@@ -439,3 +437,15 @@ selection_toggle_visibility(Selection_t *selection)
selection->is_visible = TRUE;
}
}
void
selection_freeze(Selection_t *selection)
{
gtk_clist_freeze(GTK_CLIST((selection)->list));
}
void
selection_thaw(Selection_t *selection)
{
gtk_clist_thaw(GTK_CLIST((selection)->list));
}
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-1999 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -37,10 +37,10 @@ typedef struct {
GtkWidget *edit;
ObjectList_t *object_list;
gint selected_row;
gint is_visible;
gint nr_rows;
gint select_lock;
gint unselect_lock;
gboolean is_visible;
gboolean select_lock;
gboolean unselect_lock;
CommandFactory_t cmd_move_up;
CommandFactory_t cmd_move_down;
......@@ -48,13 +48,10 @@ typedef struct {
CommandFactory_t cmd_edit;
} Selection_t;
Selection_t *make_selection(GtkWidget *window, ObjectList_t *list);
Selection_t *make_selection(ObjectList_t *list);
void selection_toggle_visibility(Selection_t *selection);
#define selection_freeze(selection) \
gtk_clist_freeze(GTK_CLIST((selection)->list))
#define selection_thaw(selection) \
gtk_clist_thaw(GTK_CLIST((selection)->list))
void selection_freeze(Selection_t *selection);
void selection_thaw(Selection_t *selection);
#define selection_set_move_up_command(selection, command) \
((selection)->cmd_move_up = (command))
......
......@@ -23,11 +23,6 @@
#include "config.h"
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "imap_browse.h"
......@@ -36,25 +31,19 @@
#include "imap_string.h"
#include "imap_table.h"
#ifdef __GNUC__
#warning GTK_ENABLE_BROKEN
#endif
#define GTK_ENABLE_BROKEN
#include <gtk/gtktext.h>
#include "libgimp/stdplugins-intl.h"
typedef struct {
DefaultDialog_t *dialog;
BrowseWidget_t *imagename;
GtkWidget *filename;
GtkWidget *title;
GtkWidget *author;
GtkWidget *default_url;
GtkWidget *description;
GtkWidget *ncsa;
GtkWidget *cern;
GtkWidget *csim;
DefaultDialog_t *dialog;
BrowseWidget_t *imagename;
GtkWidget *filename;
GtkWidget *title;
GtkWidget *author;
GtkWidget *default_url;
GtkWidget *ncsa;
GtkWidget *cern;
GtkWidget *csim;
GtkTextBuffer *description;
} SettingsDialog_t;
static MapFormat_t _map_format = CSIM;
......@@ -64,6 +53,8 @@ settings_ok_cb(gpointer data)
{
SettingsDialog_t *param = (SettingsDialog_t*) data;
MapInfo_t *info = get_map_info();
gchar *description;
GtkTextIter start, end;
g_strreplace(&info->image_name, gtk_entry_get_text(
GTK_ENTRY(param->imagename->file)));
......@@ -71,9 +62,12 @@ settings_ok_cb(gpointer data)
g_strreplace(&info->author, gtk_entry_get_text(GTK_ENTRY(param->author)));
g_strreplace(&info->default_url,
gtk_entry_get_text(GTK_ENTRY(param->default_url)));
g_strreplace(&info->description,
gtk_editable_get_chars(GTK_EDITABLE(param->description),
0, -1));
gtk_text_buffer_get_bounds(param->description, &start, &end);
description = gtk_text_buffer_get_text(param->description, &start, &end,
FALSE);
g_strreplace(&info->description, description);
g_free(description);
info->map_format = _map_format;
}
......@@ -88,12 +82,12 @@ static SettingsDialog_t*
create_settings_dialog()
{
SettingsDialog_t *data = g_new(SettingsDialog_t, 1);
GtkWidget *table, *vscrollbar, *frame, *hbox, *label;
GtkWidget *table, *view, *frame, *hbox, *label, *swin;
DefaultDialog_t *dialog;
dialog = data->dialog = make_default_dialog(_("Settings for this Mapfile"));
default_dialog_set_ok_cb(dialog, settings_ok_cb, (gpointer) data);
table = default_dialog_add_table(dialog, 9, 3);
table = default_dialog_add_table(dialog, 9, 2);
create_label_in_table(table, 0, 0, _("Filename:"));
data->filename = create_label_in_table(table, 0, 1, "");
......@@ -111,18 +105,23 @@ create_settings_dialog()
data->default_url = create_entry_in_table(table, label, 4, 1);
label = create_label_in_table(table, 5, 0, _("_Description:"));
data->description = gtk_text_new(NULL, NULL);
gtk_text_set_editable(GTK_TEXT(data->description), TRUE);
gtk_table_attach(GTK_TABLE(table), data->description, 1, 2, 5, 8,
data->description = gtk_text_buffer_new(NULL);
view = gtk_text_view_new_with_buffer(data->description);
gtk_widget_set_size_request(view, -1, 128);
gtk_widget_show(view);
swin = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(swin),
GTK_SHADOW_IN);
gtk_table_attach(GTK_TABLE(table), swin, 1, 2, 5, 8,
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show(data->description);
/* Add a vertical scrollbar to the GtkText widget */
vscrollbar = gtk_vscrollbar_new(GTK_TEXT(data->description)->vadj);
gtk_table_attach(GTK_TABLE(table), vscrollbar, 2, 3, 5, 8,
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show(vscrollbar);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_widget_show(swin);
gtk_container_add(GTK_CONTAINER(swin), view);
frame = gtk_frame_new(_("Map file format"));
gtk_widget_show(frame);
......@@ -164,6 +163,9 @@ do_settings_dialog(void)
if (!dialog)
dialog = create_settings_dialog();
if (!filename)
filename = _("<Untitled>");
gtk_label_set_text(GTK_LABEL(dialog->filename), filename);
browse_widget_set_filename(dialog->imagename, info->image_name);
gtk_entry_set_text(GTK_ENTRY(dialog->title), info->title);
......@@ -180,7 +182,5 @@ do_settings_dialog(void)
gtk_widget_grab_focus(dialog->imagename->file);
default_dialog_show(dialog->dialog);
gtk_editable_delete_text(GTK_EDITABLE(dialog->description), 0, -1);
gtk_text_insert(GTK_TEXT(dialog->description), NULL, NULL, NULL,
info->description, -1);
gtk_text_buffer_set_text (dialog->description, info->description, -1);
}
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-1999 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -26,11 +26,6 @@
#include <stdarg.h>
#include <stdio.h>
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "imap_default_dialog.h"
......@@ -39,57 +34,55 @@
#include "libgimp/stdplugins-intl.h"
#ifdef __GNUC__
#warning GTK_ENABLE_BROKEN
#endif
#define GTK_ENABLE_BROKEN
#include <gtk/gtktext.h>
static void
save_to_view(gpointer param, const char* format, ...)
save_to_view(GtkTextBuffer *buffer, const char* format, ...)
{
va_list ap;
char scratch[1024];
GtkTextIter iter;
va_start(ap, format);
vsprintf(scratch, format, ap);
va_end(ap);
gtk_text_insert(GTK_TEXT(param), NULL, NULL, NULL, scratch, -1);
gtk_text_buffer_get_end_iter(buffer, &iter);
gtk_text_buffer_insert(buffer, &iter, scratch, -1);
}
void
do_source_dialog(void)
{
static DefaultDialog_t *dialog;
static GtkWidget *text;
static GtkTextBuffer *buffer;
if (!dialog) {
GtkWidget *window;
GtkWidget *swin;
dialog = make_default_dialog(_("View Source"));
default_dialog_hide_cancel_button(dialog);
default_dialog_hide_apply_button(dialog);
text = gtk_text_new(NULL, NULL);
buffer = gtk_text_buffer_new(NULL);
text = gtk_text_view_new_with_buffer(buffer);
gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
gtk_widget_show(text);
window = gtk_scrolled_window_new(GTK_TEXT(text)->hadj,
GTK_TEXT(text)->vadj);
gtk_widget_set_usize(window, 640, 400);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->dialog)->vbox), window,
swin = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(swin),
GTK_SHADOW_IN);
gtk_widget_set_size_request(swin, 640, 400);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->dialog)->vbox), swin,
TRUE, TRUE, 0);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(window),
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_widget_show(window);
gtk_container_add(GTK_CONTAINER(window), text);
gtk_widget_show(swin);
gtk_container_add(GTK_CONTAINER(swin), text);
}
gtk_text_freeze(GTK_TEXT(text));
gtk_editable_delete_text(GTK_EDITABLE(text), 0, -1);
dump_output(text, save_to_view);
gtk_text_thaw(GTK_TEXT(text));
gtk_text_buffer_set_text(buffer, "", -1);
dump_output(buffer, (OutputFunc_t) save_to_view);
default_dialog_show(dialog);
}
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-1999 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment