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
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
1998-07-29 05:11:47 +08:00
|
|
|
|
1999-07-25 02:26:33 +08:00
|
|
|
#include "appenv.h"
|
1998-08-03 03:05:02 +08:00
|
|
|
#include "commands.h"
|
1999-09-28 01:58:10 +08:00
|
|
|
#include "gimpui.h"
|
1998-08-03 03:05:02 +08:00
|
|
|
#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"
|
|
|
|
|
1999-07-25 02:26:33 +08:00
|
|
|
#define ERRORS_ALL 0
|
1998-07-29 05:11:47 +08:00
|
|
|
#define ERRORS_SELECTION 1
|
|
|
|
|
1999-07-25 02:26:33 +08:00
|
|
|
static GtkWidget * error_console = NULL;
|
|
|
|
static GtkWidget * text;
|
1998-07-29 05:11:47 +08:00
|
|
|
|
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-07-25 02:26:33 +08:00
|
|
|
|
|
|
|
/* FIXME: interact with preferences */
|
|
|
|
message_handler = MESSAGE_BOX;
|
1998-08-03 03:05:02 +08:00
|
|
|
}
|
|
|
|
|
1999-08-22 03:00:41 +08:00
|
|
|
static void
|
|
|
|
error_console_clear_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gtk_editable_delete_text
|
|
|
|
(GTK_EDITABLE (text), 0, gtk_text_get_length (GTK_TEXT (text)));
|
|
|
|
}
|
|
|
|
|
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
|
1999-07-25 02:26:33 +08:00
|
|
|
error_console_write_file (gchar *path,
|
|
|
|
gint textscope)
|
1998-07-29 05:11:47 +08:00
|
|
|
{
|
1999-09-28 01:58:10 +08:00
|
|
|
gint fd;
|
|
|
|
gint text_length;
|
|
|
|
gint bytes_written;
|
1998-07-29 05:11:47 +08:00
|
|
|
gchar *text_contents;
|
1999-09-28 01:58:10 +08:00
|
|
|
GtkText *gtext;
|
|
|
|
|
|
|
|
gtext = GTK_TEXT (text);
|
1998-07-29 05:11:47 +08:00
|
|
|
|
|
|
|
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
|
1999-07-25 02:26:33 +08:00
|
|
|
error_console_file_ok_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-07-29 05:11:47 +08:00
|
|
|
{
|
1999-09-28 01:58:10 +08:00
|
|
|
GtkWidget *filesel;
|
|
|
|
gchar *filename;
|
|
|
|
gint textscope;
|
1998-07-29 05:11:47 +08:00
|
|
|
|
|
|
|
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 ("");
|
1999-09-28 01:58:10 +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)
|
|
|
|
{
|
1999-09-28 01:58:10 +08:00
|
|
|
GtkWidget *filesel;
|
1998-07-29 05:11:47 +08:00
|
|
|
|
1999-09-28 01:58:10 +08:00
|
|
|
if (!(GTK_TEXT (text)->editable.has_selection) &&
|
|
|
|
(textscope == ERRORS_SELECTION))
|
1998-07-29 05:11:47 +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
|
|
|
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));
|
1999-09-28 01:58:10 +08:00
|
|
|
|
|
|
|
/* Connect the "F1" help key */
|
|
|
|
gimp_help_connect_help_accel (filesel,
|
|
|
|
gimp_standard_help_func,
|
|
|
|
"dialogs/error_console.html");
|
|
|
|
|
1998-07-29 05:11:47 +08:00
|
|
|
gtk_widget_show (filesel);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
1999-09-28 01:58:10 +08:00
|
|
|
text_clicked_callback (GtkWidget *widget,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data)
|
1998-07-29 05:11:47 +08:00
|
|
|
{
|
1999-09-28 01:58:10 +08:00
|
|
|
GtkMenu *menu = (GtkMenu *) data;
|
|
|
|
GtkText *gtext;
|
1998-07-29 05:11:47 +08:00
|
|
|
|
|
|
|
gtext = GTK_TEXT (text);
|
|
|
|
|
1999-07-25 02:26:33 +08:00
|
|
|
switch (event->button)
|
1998-07-29 05:11:47 +08:00
|
|
|
{
|
1999-07-25 02:26:33 +08:00
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
break;
|
1998-07-29 05:11:47 +08:00
|
|
|
|
1999-07-25 02:26:33 +08:00
|
|
|
case 3:
|
|
|
|
gtk_signal_emit_stop_by_name (GTK_OBJECT (text), "button_press_event");
|
|
|
|
gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, event->time);
|
|
|
|
|
|
|
|
/* wheelmouse support */
|
|
|
|
case 4:
|
|
|
|
{
|
|
|
|
GtkAdjustment *adj = gtext->vadj;
|
|
|
|
gfloat new_value = adj->value - adj->page_increment / 2;
|
|
|
|
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
|
|
|
|
gtk_adjustment_set_value (adj, new_value);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
{
|
|
|
|
GtkAdjustment *adj = gtext->vadj;
|
|
|
|
gfloat new_value = adj->value + adj->page_increment / 2;
|
|
|
|
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
|
|
|
|
gtk_adjustment_set_value (adj, new_value);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
1998-07-29 05:11:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
error_console_create_window (void)
|
|
|
|
{
|
1999-09-28 01:58:10 +08:00
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *vscrollbar;
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *menuitem;
|
|
|
|
|
|
|
|
error_console = gimp_dialog_new (_("GIMP Error Console"), "error_console",
|
|
|
|
gimp_standard_help_func,
|
|
|
|
"dialogs/error_console.html",
|
|
|
|
GTK_WIN_POS_NONE,
|
|
|
|
TRUE, TRUE, FALSE,
|
|
|
|
|
|
|
|
_("Clear"), error_console_clear_callback,
|
|
|
|
NULL, NULL, FALSE, FALSE,
|
|
|
|
_("Close"), error_console_close_callback,
|
|
|
|
text, NULL, TRUE, TRUE,
|
|
|
|
|
|
|
|
NULL);
|
1999-01-11 07:20:33 +08:00
|
|
|
/* register this one only */
|
1999-07-25 02:26:33 +08:00
|
|
|
dialog_register (error_console);
|
1999-09-28 01:58:10 +08:00
|
|
|
session_set_window_geometry (error_console, &error_console_session_info,
|
|
|
|
TRUE);
|
1999-01-11 07:20:33 +08:00
|
|
|
|
1998-08-03 03:05:02 +08:00
|
|
|
/* The next line should disappear when setting the size works in SM */
|
|
|
|
gtk_widget_set_usize (error_console, 250, 300);
|
1999-09-28 01:58:10 +08:00
|
|
|
|
|
|
|
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);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (error_console)->vbox), table);
|
|
|
|
gtk_widget_show (table);
|
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);
|
|
|
|
|
|
|
|
/* 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 ();
|
1999-07-25 02:26:33 +08:00
|
|
|
|
|
|
|
/* FIMXE: interact with preferences */
|
|
|
|
message_handler = ERROR_CONSOLE;
|
1998-08-03 03:05:02 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!GTK_WIDGET_VISIBLE (error_console))
|
1999-07-25 02:26:33 +08:00
|
|
|
{
|
|
|
|
gtk_widget_show (error_console);
|
|
|
|
|
|
|
|
/* FIXME: interact with preferences */
|
|
|
|
message_handler = ERROR_CONSOLE;
|
|
|
|
}
|
1998-08-03 03:05:02 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|