gimp/plug-ins/imagemap/imap_source.c

87 lines
2.4 KiB
C
Raw Normal View History

1999-09-07 00:03:20 +00:00
/*
* This is a plug-in for the GIMP.
*
* Generates clickable image maps.
*
* Copyright (C) 1998-1999 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include "config.h"
1999-09-07 00:03:20 +00:00
#include <stdarg.h>
#include <stdio.h>
#include "imap_default_dialog.h"
#include "imap_main.h"
#include "imap_source.h"
#include "libgimp/stdplugins-intl.h"
updated for GTK2 build 2001-07-28 Hans Breuer <hans@breuer.org> * */*/makefile.msc : updated for GTK2 build * app/widgets/makefile.msc : (new file) forgot this one last time * plug-ins/common/animationplay.c : reflect that GTK2 has its gdk<x|win32|fb>.h files in the back-end sub directories * plug-ins/common/gif.c : * plug-ins/common/jpeg.c : * plug-ins/dbbrowser/dbbrowser_utils.c : * plug-ins/gap/gap_dbbrowser_utils.c : * plug-ims/gimpressionist/presets.c : * plug-ims/gimpressionist/imap_setting.c : * plug-ims/gimpressionist/imap_source.c : * plug-ims/script-fu/script-fu-console.c : * plug-ims/script-fu/script-fu-scripts.c : #define GTK_ENABLE_BROKEN and include <gtk/gtktext.h> to make them compile/work again * plug-ins/common/spheredesigner.c : gtk_color_selction_set_opacity renamed to gtk_color_selction_set_current_alpha * plug-ins/gflare/gtkmultioptionmenu.c : ported ny removing the virtual draw function and style->xthickness and ythickness via direct access, klass field isn't available anymore * plug-ins/common/nlfilt.c : * plug-ims/gap/gap_movdialog.c : * plug-ims/gimpressionist/gimpressionist.c : gtk_widget_set_default_visible is neither available nor needed anymore * plug-ins/common/plugindetails.c : ported to GtkTextBuffer and reflect gtk_paned api changes * plug-ims/gimpressionist/imap_preview.c : replace GTK_WIDGET(a)->klass access by GTK_WIDGET_GET_CLASS(a) * plug-ims/gimpressionist/imap_selection.c : * plug-ims/gimpressionist/imap_toolbar.c : * plug-ims/gimpressionist/imap_tools.c : gtk_toolbar api changes
2001-07-28 19:40:07 +00:00
/* FIXME: remove usage of the 'broken' GtkText */
#define GTK_ENABLE_BROKEN
#include <gtk/gtktext.h>
1999-09-07 00:03:20 +00:00
static void
save_to_view(gpointer param, const char* format, ...)
{
va_list ap;
char scratch[1024];
va_start(ap, format);
vsprintf(scratch, format, ap);
va_end(ap);
gtk_text_insert(GTK_TEXT(param), NULL, NULL, NULL, scratch, -1);
}
void
do_source_dialog(void)
{
static DefaultDialog_t *dialog;
static GtkWidget *text;
if (!dialog) {
GtkWidget *window;
1999-10-24 20:57:17 +00:00
dialog = make_default_dialog(_("View Source"));
1999-09-07 00:03:20 +00:00
default_dialog_hide_cancel_button(dialog);
default_dialog_hide_apply_button(dialog);
text = gtk_text_new(NULL, NULL);
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,
TRUE, TRUE, 0);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_widget_show(window);
gtk_container_add(GTK_CONTAINER(window), 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));
default_dialog_show(dialog);
}