1998-07-29 05:11:47 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* errorconsole.c - text window for collecting error messages
|
|
|
|
* Copyright (C) 1998 Nick Fetchak <nuke@bayside.net>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
1999-06-15 06:18:02 +08:00
|
|
|
#include <glib.h>
|
|
|
|
|
1998-07-29 05:11:47 +08:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
1999-04-23 23:20:10 +08:00
|
|
|
#include <sys/types.h>
|
1999-02-21 07:20:54 +08:00
|
|
|
#ifdef HAVE_DIRENT_H
|
1998-07-29 05:11:47 +08:00
|
|
|
#include <dirent.h>
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_UNISTD_H
|
1998-07-29 05:11:47 +08:00
|
|
|
#include <unistd.h>
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
1998-07-29 05:11:47 +08:00
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/stat.h>
|
1999-02-21 07:20:54 +08:00
|
|
|
|
Win32 portability changes:
* config.h.win32, README.win32: Small changes.
* tools/pdbgen/pdb/*.pdb: Include <string.h>.
* app/*_cmds.c: Autogenerated files reflect above changes.
* libgimp/makefile.msc app/makefile.msc: Various updates,
including new object files. Gtk+ directory now should be called
gtk+ (not gtk-plus). Use win32-specific gdk subdir. Glib directory
now should be called just glib.
* libgimp/gimp.def: Updates.
* libgimp/gimpfeatures.h.win32: Made current with
gimpfeatures.h.in.
* libgimp/gimpfileselection.c: Define S_ISDIR and S_ISREG if
necessary.
* tools/pdbgen/pdb/fileops.pdb: Must have a
statement (even an empty one) after a label.
* app/fileops_cmds.c: Autogenerated file reflects above changes.
* app/crop.c: Include <string.h>.
* app/{app_procs,batch,fileops,datafiles,errorconsole,general,
plug_in,temp_buf,tile_swap}.c: Test NATIVE_WIN32, not
_MSC_VER. (NATIVE_WIN32 means we are using the Microsoft C
runtime, even if we might be compiling with gcc.)
* app/fileops.c: Don't include <process.h> here.
* app/fileops.h: Do include <process.h> here.
* app/gimpparasite.c: Include config.h, guard inclusion of
<unistd.h>. (Is the inclusion of unistd.h in source files all over
the place really necessary?)
* app/ink.c: MSC doesn't handle conversion from unsigned __int64
to double, so cast to signed.
* app/lut_funcs.c: Include config.h, and define rint() if necessary.
* app/pixel_processor.c: Include config.h without "..", like in
all the other places. Include <string.h>
* app/text_tool.c: Guard the "POINTS" identifier that clashes with
<windows.h>, sigh.
1999-05-05 05:32:17 +08:00
|
|
|
#ifdef NATIVE_WIN32
|
1999-02-21 07:20:54 +08:00
|
|
|
#include <io.h>
|
|
|
|
#ifndef S_IRUSR
|
|
|
|
#define S_IRUSR _S_IREAD
|
|
|
|
#endif
|
|
|
|
#ifndef S_IWUSR
|
|
|
|
#define S_IWUSR _S_IWRITE
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
1999-04-05 20:48:48 +08:00
|
|
|
#include "actionarea.h"
|
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
#include <gtk/gtk.h>
|
1998-07-29 05:11:47 +08:00
|
|
|
|
1998-08-03 03:05:02 +08:00
|
|
|
#include "commands.h"
|
|
|
|
#include "session.h"
|
1999-01-11 07:20:33 +08:00
|
|
|
#include "dialog_handler.h"
|
1998-08-03 03:05:02 +08:00
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
1998-07-29 05:11:47 +08:00
|
|
|
#define ERRORS_ALL 0
|
|
|
|
#define ERRORS_SELECTION 1
|
|
|
|
|
|
|
|
void error_console_add (gchar *errormsg);
|
|
|
|
|
1998-08-03 03:05:02 +08:00
|
|
|
static GtkWidget *error_console = NULL;
|
1998-07-29 05:11:47 +08:00
|
|
|
static GtkWidget *text;
|
|
|
|
|
1998-08-03 03:05:02 +08:00
|
|
|
|
|
|
|
static void
|
1998-07-29 05:11:47 +08:00
|
|
|
error_console_close_callback (GtkWidget *widget,
|
1999-04-05 20:48:48 +08:00
|
|
|
gpointer data)
|
1998-07-29 05:11:47 +08:00
|
|
|
{
|
1998-08-03 03:05:02 +08:00
|
|
|
gtk_widget_hide (error_console);
|
|
|
|
}
|
|
|
|
|
1999-04-05 20:48:48 +08:00
|
|
|
static gint
|
|
|
|
error_console_delete_callback (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
error_console_close_callback (NULL, NULL);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1998-08-03 03:05:02 +08:00
|
|
|
void
|
|
|
|
error_console_free (void)
|
|
|
|
{
|
|
|
|
if (error_console)
|
|
|
|
session_get_window_info (error_console, &error_console_session_info);
|
1998-07-29 05:11:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
error_console_write_file (gchar *path, gint textscope)
|
|
|
|
{
|
|
|
|
gint fd;
|
|
|
|
gint text_length;
|
|
|
|
gint bytes_written;
|
|
|
|
gchar *text_contents;
|
|
|
|
GtkText *gtext;
|
|
|
|
|
|
|
|
gtext = GTK_TEXT(text);
|
|
|
|
|
|
|
|
fd = open (path, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
|
|
|
|
|
|
|
|
if (fd == -1)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (textscope == ERRORS_ALL)
|
|
|
|
{
|
|
|
|
text_contents =
|
|
|
|
gtk_editable_get_chars (GTK_EDITABLE (text), 0,
|
|
|
|
gtk_text_get_length (GTK_TEXT (text)));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gint selection_start, selection_end, temp;
|
|
|
|
|
|
|
|
selection_start = GTK_TEXT (text)->editable.selection_start_pos;
|
|
|
|
selection_end = GTK_TEXT (text)->editable.selection_end_pos;
|
|
|
|
|
|
|
|
if (selection_start > selection_end)
|
|
|
|
{
|
|
|
|
temp = selection_start;
|
|
|
|
selection_start = selection_end;
|
|
|
|
selection_end = temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
text_contents = gtk_editable_get_chars (GTK_EDITABLE (text),
|
|
|
|
selection_start,
|
|
|
|
selection_end);
|
|
|
|
}
|
|
|
|
|
|
|
|
text_length = strlen (text_contents);
|
|
|
|
|
|
|
|
if (text_contents && (text_length > 0))
|
|
|
|
{
|
|
|
|
bytes_written = write (fd, text_contents, text_length);
|
|
|
|
|
|
|
|
g_free (text_contents);
|
|
|
|
close (fd);
|
|
|
|
|
|
|
|
if (bytes_written != text_length)
|
|
|
|
return FALSE;
|
|
|
|
else
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
close (fd);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
error_console_file_ok_callback (GtkWidget *widget, gpointer data)
|
|
|
|
{
|
|
|
|
GtkWidget *filesel;
|
|
|
|
gchar *filename;
|
|
|
|
gint textscope;
|
|
|
|
|
|
|
|
filesel = (GtkWidget *) data;
|
|
|
|
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
|
|
|
|
|
|
|
|
textscope = (gint) gtk_object_get_user_data (GTK_OBJECT (filesel));
|
|
|
|
|
|
|
|
if (!error_console_write_file (filename, textscope))
|
|
|
|
{
|
|
|
|
GString *string;
|
|
|
|
|
1998-08-03 03:05:02 +08:00
|
|
|
string = g_string_new ("");
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
g_string_sprintf (string, _("Error opening file %s: %s"), filename, g_strerror (errno));
|
1998-07-29 05:11:47 +08:00
|
|
|
g_message (string->str);
|
|
|
|
g_string_free (string, TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
gtk_widget_destroy (filesel);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
error_console_menu_callback (gint textscope)
|
|
|
|
{
|
|
|
|
GtkWidget *filesel;
|
|
|
|
|
|
|
|
if (!(GTK_TEXT (text)->editable.has_selection) && (textscope == ERRORS_SELECTION))
|
|
|
|
{
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
g_message (_("Can't save, nothing selected!"));
|
1998-07-29 05:11:47 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
filesel = gtk_file_selection_new (_("Save error log to file..."));
|
1998-12-04 07:01:44 +08:00
|
|
|
gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE);
|
1998-07-29 05:11:47 +08:00
|
|
|
gtk_window_set_wmclass (GTK_WINDOW (filesel), "save_errors", "Gimp");
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (filesel)->cancel_button),
|
|
|
|
"clicked", (GtkSignalFunc) gtk_widget_destroy,
|
|
|
|
GTK_OBJECT (filesel));
|
|
|
|
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (filesel), (gpointer) textscope);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filesel)->ok_button),
|
|
|
|
"clicked", (GtkSignalFunc) error_console_file_ok_callback,
|
|
|
|
filesel);
|
|
|
|
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (filesel)->cancel_button),
|
|
|
|
"delete_event", (GtkSignalFunc) gtk_widget_destroy,
|
|
|
|
GTK_OBJECT (filesel));
|
|
|
|
gtk_widget_show (filesel);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
text_clicked_callback (GtkWidget *widget,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GtkMenu *menu = (GtkMenu *) data;
|
|
|
|
GtkText *gtext;
|
|
|
|
|
|
|
|
gtext = GTK_TEXT (text);
|
|
|
|
|
|
|
|
if (event->button == 3)
|
|
|
|
{
|
|
|
|
gtk_signal_emit_stop_by_name (GTK_OBJECT (text), "button_press_event");
|
|
|
|
|
1998-08-03 03:05:02 +08:00
|
|
|
gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button, event->time);
|
1998-07-29 05:11:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-04-05 20:48:48 +08:00
|
|
|
/* the action area structure */
|
|
|
|
static ActionAreaItem action_items[] =
|
|
|
|
{
|
|
|
|
{ N_("Close"), error_console_close_callback, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
1998-07-29 05:11:47 +08:00
|
|
|
static void
|
|
|
|
error_console_create_window (void)
|
|
|
|
{
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *vscrollbar;
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *menuitem;
|
|
|
|
|
1998-08-03 03:05:02 +08:00
|
|
|
error_console = gtk_dialog_new ();
|
1999-01-11 07:20:33 +08:00
|
|
|
|
|
|
|
/* register this one only */
|
|
|
|
dialog_register(error_console);
|
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
gtk_window_set_title (GTK_WINDOW (error_console), _("GIMP Error console"));
|
1998-08-03 03:05:02 +08:00
|
|
|
session_set_window_geometry (error_console, &error_console_session_info, TRUE);
|
|
|
|
/* The next line should disappear when setting the size works in SM */
|
|
|
|
gtk_widget_set_usize (error_console, 250, 300);
|
|
|
|
gtk_window_set_policy (GTK_WINDOW(error_console), TRUE, TRUE, FALSE);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (error_console), "delete_event",
|
1999-04-05 20:48:48 +08:00
|
|
|
(GdkEventFunc) error_console_delete_callback, NULL);
|
1998-12-04 07:01:44 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (error_console)->vbox), 2);
|
1998-07-29 05:11:47 +08:00
|
|
|
|
|
|
|
/* Action area */
|
1999-04-05 20:48:48 +08:00
|
|
|
action_items[0].user_data = error_console;
|
|
|
|
build_action_area (GTK_DIALOG (error_console), action_items, 1, 0);
|
1998-07-29 05:11:47 +08:00
|
|
|
|
|
|
|
menu = gtk_menu_new ();
|
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
menuitem = gtk_menu_item_new_with_label (_("Write all errors to file..."));
|
1998-07-29 05:11:47 +08:00
|
|
|
gtk_menu_append (GTK_MENU (menu), menuitem);
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT(menuitem), "activate",
|
|
|
|
(GtkSignalFunc) error_console_menu_callback,
|
|
|
|
(gpointer) ERRORS_ALL);
|
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
menuitem = gtk_menu_item_new_with_label (_("Write selection to file..."));
|
1998-07-29 05:11:47 +08:00
|
|
|
gtk_menu_append (GTK_MENU (menu), menuitem);
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT(menuitem), "activate",
|
|
|
|
(GtkSignalFunc) error_console_menu_callback,
|
|
|
|
(gpointer) ERRORS_SELECTION);
|
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
|
|
|
|
table = gtk_table_new (2, 2, FALSE);
|
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
|
1998-12-04 07:01:44 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 0);
|
1998-08-03 03:05:02 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (error_console)->vbox), table, TRUE, TRUE, 0);
|
1998-07-29 05:11:47 +08:00
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
/* The output text widget */
|
|
|
|
text = gtk_text_new (NULL, NULL);
|
|
|
|
gtk_text_set_editable (GTK_TEXT (text), FALSE);
|
|
|
|
gtk_text_set_word_wrap (GTK_TEXT (text), TRUE);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), text, 0, 1, 0, 1,
|
|
|
|
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
|
|
|
GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
|
|
|
|
gtk_widget_set_events (text, GDK_BUTTON_PRESS_MASK);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (text), "button_press_event",
|
|
|
|
GTK_SIGNAL_FUNC (text_clicked_callback), GTK_MENU (menu));
|
|
|
|
|
|
|
|
gtk_widget_show (text);
|
|
|
|
|
|
|
|
vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), vscrollbar, 1, 2, 0, 1,
|
|
|
|
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (vscrollbar);
|
|
|
|
|
1998-08-03 03:05:02 +08:00
|
|
|
gtk_widget_show (error_console);
|
1998-07-29 05:11:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
error_console_add (gchar *errormsg)
|
|
|
|
{
|
|
|
|
|
1998-08-03 03:05:02 +08:00
|
|
|
if (!error_console)
|
|
|
|
{
|
|
|
|
error_console_create_window ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!GTK_WIDGET_VISIBLE (error_console))
|
|
|
|
gtk_widget_show (error_console);
|
|
|
|
else
|
|
|
|
gdk_window_raise (error_console->window);
|
|
|
|
}
|
1998-07-29 05:11:47 +08:00
|
|
|
|
|
|
|
if (errormsg)
|
|
|
|
{
|
|
|
|
gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, errormsg, -1);
|
|
|
|
gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, "\n", -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|