1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* 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
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
|
|
|
#include "config.h"
|
Check for mmap.
* configure.in: Check for mmap.
* app/makefile.msc: Depend on gimpi.lib.
* app/app_procs.c (app_init): Fix gccism: Allocate filenames (an
array with non-constant size) dynamically.
* app/{datafiles,fileops,general,install,module_db,temp_buf}.c:
Include glib.h before standard headers, because of certain obscure
details related to compiling with gcc on Win32.
(If you really want to know: glib.h defines he names of POSIXish
(but non-ANSI) functions as prefixed with underscore, because
that's how they are named in the msvcrt runtime C library we want
to use. However, defining stat as _stat causes some problems if
done after including the mingw32 <sys/stat.h>. So, it's easiest to
include <glib.h> early.)
* app/main.c: Use _stdcall and __argc, __argv with MSC, but
__attribute__((stdcall)) and _argc, _argv with gcc. Don't print
the "Passed serialization test" message on Win32. (It would open
up an otherwise unnecessary console window.)
* app/paint_funcs.c (gaussian_blur_region): Don't use variable sum
until initialized.
* app/{bezier_select,paths_dialog}.c: Include config.h and define
rint() if necessary.
* app/plug_in.c: Use _spawnv, not spawnv, on Win32 and OS/2.
1999-05-29 01:47:17 +08:00
|
|
|
|
1998-03-15 01:54:08 +08:00
|
|
|
#include <locale.h>
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/types.h>
|
1999-02-21 07:20:54 +08:00
|
|
|
#ifdef HAVE_SYS_WAIT_H
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <sys/wait.h>
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_UNISTD_H
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <unistd.h>
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
|
1998-11-08 07:02:14 +08:00
|
|
|
#include "libgimp/gserialize.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
#ifndef WAIT_ANY
|
|
|
|
#define WAIT_ANY -1
|
|
|
|
#endif /* WAIT_ANY */
|
|
|
|
|
1998-07-15 10:28:31 +08:00
|
|
|
#include "libgimp/gimpfeatures.h"
|
1999-06-15 06:18:02 +08:00
|
|
|
#include "libgimp/gimpenv.h"
|
1998-07-15 10:28:31 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "appenv.h"
|
|
|
|
#include "app_procs.h"
|
|
|
|
#include "errors.h"
|
|
|
|
#include "install.h"
|
|
|
|
|
1998-08-06 07:46:04 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
Add gimpcolorspace object.
2000-01-04 Tor Lillqvist <tml@iki.fi>
* libgimp/makefile.{cygwin.msc}: Add gimpcolorspace object.
* libgimp/gimp.def: Add functions from it.
Fixes from Hans Breuer:
* app/datafiles.c: redefine the executable flag for Win32
to _S_IREAD, to get _all_ files from the plug-in dirs as
executables (including scripts)
* app/main.c: Win32-specific changes to allow building Gimp as a
console application, with all its benefits (like inheriting the
console), but hide it if the user doesn't want it. Also, if stdout
goes to a console, give the user a chance to read the help or
version messages. (tml: I am not convinced that it is better to
build gimp as a console application, but let's try it this way for
a while.)
* app/makefile.{cygwin,msc}: Build as console application, and
link with shell32 library.
* app/paint_core.c (paint_core_motion): Pass the value of a call
to the function gimage_active_drawable() to the paint_func,
instead of just passing the address of gimage_active_drawable...
(tml: This code is only called when the TOOL_TRACES_ON_WINDOW flag
is on, and only the clone tool sets that, and the clone tool's
paint_func doesn't use the drawable argument, so this hasn't
caused any trouble.)
* app/plug_in.c: On Win32, to support scripts, use new function
xspawn() instead of _spawnv. Add some more code to properly kill
plug-ins.
* libgimp/color_display.h: Add G_MODULE_EXPORT declarations.
2000-01-05 01:46:41 +08:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
#include <windows.h>
|
|
|
|
#else
|
1997-11-25 06:05:25 +08:00
|
|
|
static RETSIGTYPE on_signal (int);
|
1999-02-21 07:20:54 +08:00
|
|
|
#ifdef SIGCHLD
|
1997-11-25 06:05:25 +08:00
|
|
|
static RETSIGTYPE on_sig_child (int);
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
#endif
|
1997-11-25 06:05:25 +08:00
|
|
|
static void init (void);
|
1998-11-08 07:02:14 +08:00
|
|
|
static void test_gserialize();
|
1999-01-08 03:53:05 +08:00
|
|
|
static void on_error (const gchar* domain,
|
|
|
|
GLogLevelFlags flags,
|
|
|
|
const gchar* msg,
|
|
|
|
gpointer user_data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* GLOBAL data */
|
|
|
|
int no_interface;
|
|
|
|
int no_data;
|
1998-02-18 04:14:29 +08:00
|
|
|
int no_splash;
|
|
|
|
int no_splash_image;
|
1998-01-26 06:13:00 +08:00
|
|
|
int be_verbose;
|
1997-11-25 06:05:25 +08:00
|
|
|
int use_shm;
|
1998-04-21 09:19:30 +08:00
|
|
|
int use_debug_handler;
|
1998-05-30 15:32:37 +08:00
|
|
|
int console_messages;
|
1998-07-12 06:23:23 +08:00
|
|
|
int restore_session;
|
1998-07-02 07:06:49 +08:00
|
|
|
GimpSet* image_context;
|
1998-06-20 07:45:54 +08:00
|
|
|
|
|
|
|
MessageHandlerType message_handler;
|
|
|
|
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
gchar *prog_name; /* The path name we are invoked with */
|
|
|
|
gchar *alternate_gimprc;
|
|
|
|
gchar *alternate_system_gimprc;
|
|
|
|
gchar **batch_cmds;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-12-08 02:56:12 +08:00
|
|
|
#ifdef ENABLE_NLS
|
1999-12-04 21:46:25 +08:00
|
|
|
gchar *plugin_domains[] = { "gimp-std-plugins",
|
|
|
|
"gimp-perl" };
|
|
|
|
gint n_plugin_domains = (sizeof (plugin_domains) /
|
|
|
|
sizeof (plugin_domains[0]));
|
1999-12-08 02:56:12 +08:00
|
|
|
#endif
|
1999-12-04 21:46:25 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* LOCAL data */
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
static gint gimp_argc;
|
|
|
|
static gchar **gimp_argv;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* argv processing:
|
|
|
|
* Arguments are either switches, their associated
|
|
|
|
* values, or image files. As switches and their
|
|
|
|
* associated values are processed, those slots in
|
1998-09-11 03:03:20 +08:00
|
|
|
* the argv[] array are NULLed. We do this because
|
|
|
|
* unparsed args are treated as images to load on
|
|
|
|
* startup.
|
|
|
|
*
|
1997-11-25 06:05:25 +08:00
|
|
|
*
|
|
|
|
* The GTK switches are processed first (X switches are
|
|
|
|
* processed here, not by any X routines). Then the
|
|
|
|
* general GIMP switches are processed. Any args
|
|
|
|
* left are assumed to be image files the GIMP should
|
|
|
|
* display.
|
|
|
|
*
|
|
|
|
* The exception is the batch switch. When this is
|
|
|
|
* encountered, all remaining args are treated as batch
|
|
|
|
* commands.
|
|
|
|
*/
|
|
|
|
|
1998-02-05 13:41:05 +08:00
|
|
|
int
|
1997-11-25 06:05:25 +08:00
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
int show_version;
|
|
|
|
int show_help;
|
|
|
|
int i, j;
|
1998-08-29 07:01:46 +08:00
|
|
|
#ifdef HAVE_PUTENV
|
1997-12-18 07:28:44 +08:00
|
|
|
gchar *display_name, *display_env;
|
1998-08-29 07:01:46 +08:00
|
|
|
#endif
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-09-08 13:31:51 +08:00
|
|
|
g_atexit (g_mem_profile);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Initialize variables */
|
|
|
|
prog_name = argv[0];
|
|
|
|
|
1999-09-25 09:59:43 +08:00
|
|
|
/* Initialize i18n support */
|
1999-09-28 06:12:44 +08:00
|
|
|
|
1999-11-27 21:44:54 +08:00
|
|
|
INIT_LOCALE ("gimp");
|
1999-12-04 21:46:25 +08:00
|
|
|
|
1999-12-08 02:56:12 +08:00
|
|
|
#ifdef ENABLE_NLS
|
1999-12-04 21:46:25 +08:00
|
|
|
for (i = 0; i < n_plugin_domains; i++)
|
|
|
|
bindtextdomain (plugin_domains[i], LOCALEDIR);
|
1999-12-08 02:56:12 +08:00
|
|
|
#endif
|
1999-09-04 09:43:50 +08:00
|
|
|
|
1999-09-28 06:12:44 +08:00
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
|
1999-11-27 21:44:54 +08:00
|
|
|
setlocale (LC_NUMERIC, "C"); /* gtk seems to zap this during init.. */
|
1999-09-28 06:12:44 +08:00
|
|
|
|
1998-08-29 07:01:46 +08:00
|
|
|
#ifdef HAVE_PUTENV
|
1997-12-18 07:28:44 +08:00
|
|
|
display_name = gdk_get_display ();
|
|
|
|
display_env = g_new (gchar, strlen (display_name) + 9);
|
|
|
|
*display_env = 0;
|
|
|
|
strcat (display_env, "DISPLAY=");
|
|
|
|
strcat (display_env, display_name);
|
|
|
|
putenv (display_env);
|
1998-08-29 07:01:46 +08:00
|
|
|
#endif
|
1997-12-18 07:28:44 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
no_interface = FALSE;
|
|
|
|
no_data = FALSE;
|
1998-02-18 04:14:29 +08:00
|
|
|
no_splash = FALSE;
|
|
|
|
no_splash_image = FALSE;
|
1999-06-05 10:11:16 +08:00
|
|
|
|
1999-10-05 03:26:07 +08:00
|
|
|
#if defined (HAVE_SHM_H) || defined (G_OS_WIN32)
|
1997-11-25 06:05:25 +08:00
|
|
|
use_shm = TRUE;
|
1998-08-29 07:01:46 +08:00
|
|
|
#else
|
|
|
|
use_shm = FALSE;
|
|
|
|
#endif
|
1999-06-05 10:11:16 +08:00
|
|
|
|
1998-04-21 09:19:30 +08:00
|
|
|
use_debug_handler = FALSE;
|
1998-07-12 06:23:23 +08:00
|
|
|
restore_session = FALSE;
|
1998-05-30 15:32:37 +08:00
|
|
|
console_messages = FALSE;
|
1998-06-20 07:45:54 +08:00
|
|
|
|
|
|
|
message_handler = CONSOLE;
|
|
|
|
|
1999-06-05 10:11:16 +08:00
|
|
|
batch_cmds = g_new (char *, argc);
|
1997-11-25 06:05:25 +08:00
|
|
|
batch_cmds[0] = NULL;
|
1998-07-11 10:00:19 +08:00
|
|
|
|
|
|
|
alternate_gimprc = NULL;
|
1998-07-11 15:06:39 +08:00
|
|
|
alternate_system_gimprc = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
show_version = FALSE;
|
|
|
|
show_help = FALSE;
|
|
|
|
|
1999-06-05 10:11:16 +08:00
|
|
|
test_gserialize ();
|
1998-11-08 07:02:14 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
for (i = 1; i < argc; i++)
|
|
|
|
{
|
|
|
|
if ((strcmp (argv[i], "--no-interface") == 0) ||
|
|
|
|
(strcmp (argv[i], "-n") == 0))
|
|
|
|
{
|
|
|
|
no_interface = TRUE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else if ((strcmp (argv[i], "--batch") == 0) ||
|
|
|
|
(strcmp (argv[i], "-b") == 0))
|
|
|
|
{
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
|
|
|
for (j = 0, i++ ; i < argc; j++, i++)
|
|
|
|
{
|
1997-11-25 06:05:25 +08:00
|
|
|
batch_cmds[j] = argv[i];
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
batch_cmds[j] = NULL;
|
1998-09-11 03:03:20 +08:00
|
|
|
|
|
|
|
if (batch_cmds[0] == NULL) /* We need at least one batch command */
|
|
|
|
show_help = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
1998-07-11 15:06:39 +08:00
|
|
|
else if (strcmp (argv[i], "--system-gimprc") == 0)
|
|
|
|
{
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1998-07-11 15:06:39 +08:00
|
|
|
if (argc <= ++i)
|
|
|
|
{
|
|
|
|
show_help = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
alternate_system_gimprc = argv[i];
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1998-07-11 15:06:39 +08:00
|
|
|
}
|
|
|
|
}
|
1998-07-11 10:00:19 +08:00
|
|
|
else if ((strcmp (argv[i], "--gimprc") == 0) ||
|
|
|
|
(strcmp (argv[i], "-g") == 0))
|
|
|
|
{
|
|
|
|
if (argc <= ++i)
|
|
|
|
{
|
|
|
|
show_help = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
alternate_gimprc = argv[i];
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1998-07-11 10:00:19 +08:00
|
|
|
}
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
else if ((strcmp (argv[i], "--help") == 0) ||
|
|
|
|
(strcmp (argv[i], "-h") == 0))
|
|
|
|
{
|
|
|
|
show_help = TRUE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else if (strcmp (argv[i], "--version") == 0 ||
|
|
|
|
strcmp (argv[i], "-v") == 0)
|
|
|
|
{
|
|
|
|
show_version = TRUE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else if (strcmp (argv[i], "--no-data") == 0)
|
|
|
|
{
|
|
|
|
no_data = TRUE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
1998-02-18 04:14:29 +08:00
|
|
|
else if (strcmp (argv[i], "--no-splash") == 0)
|
|
|
|
{
|
|
|
|
no_splash = TRUE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1998-02-18 04:14:29 +08:00
|
|
|
}
|
|
|
|
else if (strcmp (argv[i], "--no-splash-image") == 0)
|
|
|
|
{
|
|
|
|
no_splash_image = TRUE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1998-02-18 04:14:29 +08:00
|
|
|
}
|
1998-01-26 06:13:00 +08:00
|
|
|
else if (strcmp (argv[i], "--verbose") == 0)
|
|
|
|
{
|
|
|
|
be_verbose = TRUE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1998-01-26 06:13:00 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
else if (strcmp (argv[i], "--no-shm") == 0)
|
|
|
|
{
|
|
|
|
use_shm = FALSE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
1998-04-21 09:19:30 +08:00
|
|
|
else if (strcmp (argv[i], "--debug-handlers") == 0)
|
|
|
|
{
|
|
|
|
use_debug_handler = TRUE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1998-04-21 09:19:30 +08:00
|
|
|
}
|
1998-05-30 15:32:37 +08:00
|
|
|
else if (strcmp (argv[i], "--console-messages") == 0)
|
|
|
|
{
|
|
|
|
console_messages = TRUE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1998-05-30 15:32:37 +08:00
|
|
|
}
|
1998-07-12 06:23:23 +08:00
|
|
|
else if ((strcmp (argv[i], "--restore-session") == 0) ||
|
|
|
|
(strcmp (argv[i], "-r") == 0))
|
|
|
|
{
|
|
|
|
restore_session = TRUE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1998-07-12 06:23:23 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
/*
|
|
|
|
* ANYTHING ELSE starting with a '-' is an error.
|
|
|
|
*/
|
|
|
|
else if (argv[i][0] == '-')
|
|
|
|
{
|
|
|
|
show_help = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add gimpcolorspace object.
2000-01-04 Tor Lillqvist <tml@iki.fi>
* libgimp/makefile.{cygwin.msc}: Add gimpcolorspace object.
* libgimp/gimp.def: Add functions from it.
Fixes from Hans Breuer:
* app/datafiles.c: redefine the executable flag for Win32
to _S_IREAD, to get _all_ files from the plug-in dirs as
executables (including scripts)
* app/main.c: Win32-specific changes to allow building Gimp as a
console application, with all its benefits (like inheriting the
console), but hide it if the user doesn't want it. Also, if stdout
goes to a console, give the user a chance to read the help or
version messages. (tml: I am not convinced that it is better to
build gimp as a console application, but let's try it this way for
a while.)
* app/makefile.{cygwin,msc}: Build as console application, and
link with shell32 library.
* app/paint_core.c (paint_core_motion): Pass the value of a call
to the function gimage_active_drawable() to the paint_func,
instead of just passing the address of gimage_active_drawable...
(tml: This code is only called when the TOOL_TRACES_ON_WINDOW flag
is on, and only the clone tool sets that, and the clone tool's
paint_func doesn't use the drawable argument, so this hasn't
caused any trouble.)
* app/plug_in.c: On Win32, to support scripts, use new function
xspawn() instead of _spawnv. Add some more code to properly kill
plug-ins.
* libgimp/color_display.h: Add G_MODULE_EXPORT declarations.
2000-01-05 01:46:41 +08:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
/* Common windoze apps don't have a console at all. So does Gimp
|
|
|
|
* - if appropiate. This allows to compile as console application
|
|
|
|
* with all it's benfits (like inheriting the console) but hide
|
|
|
|
* it, if the user doesn't want it.
|
|
|
|
*/
|
|
|
|
if (!show_help && !show_version && !be_verbose && !console_messages)
|
|
|
|
FreeConsole ();
|
|
|
|
#endif
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (show_version)
|
1998-08-06 07:46:04 +08:00
|
|
|
g_print ( "%s %s\n", _("GIMP version"), GIMP_VERSION);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (show_help)
|
|
|
|
{
|
1999-02-21 07:20:54 +08:00
|
|
|
g_print (_("Usage: %s [option ...] [files ...]\n"), argv[0]);
|
1998-08-06 07:46:04 +08:00
|
|
|
g_print (_("Valid options are:\n"));
|
|
|
|
g_print (_(" -h --help Output this help.\n"));
|
|
|
|
g_print (_(" -v --version Output version info.\n"));
|
|
|
|
g_print (_(" -b --batch <commands> Run in batch mode.\n"));
|
|
|
|
g_print (_(" -g --gimprc <gimprc> Use an alternate gimprc file.\n"));
|
|
|
|
g_print (_(" -n --no-interface Run without a user interface.\n"));
|
|
|
|
g_print (_(" -r --restore-session Try to restore saved session.\n"));
|
|
|
|
g_print (_(" --no-data Do not load patterns, gradients, palettes, brushes.\n"));
|
|
|
|
g_print (_(" --verbose Show startup messages.\n"));
|
|
|
|
g_print (_(" --no-splash Do not show the startup window.\n"));
|
|
|
|
g_print (_(" --no-splash-image Do not add an image to the startup window.\n"));
|
|
|
|
g_print (_(" --no-shm Do not use shared memory between GIMP and its plugins.\n"));
|
|
|
|
g_print (_(" --no-xshm Do not use the X Shared Memory extension.\n"));
|
|
|
|
g_print (_(" --console-messages Display warnings to console instead of a dialog box.\n"));
|
|
|
|
g_print (_(" --debug-handlers Enable debugging signal handlers.\n"));
|
|
|
|
g_print (_(" --display <display> Use the designated X display.\n\n"));
|
|
|
|
g_print (_(" --system-gimprc <gimprc> Use an alternate system gimprc file.\n"));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (show_version || show_help)
|
Add gimpcolorspace object.
2000-01-04 Tor Lillqvist <tml@iki.fi>
* libgimp/makefile.{cygwin.msc}: Add gimpcolorspace object.
* libgimp/gimp.def: Add functions from it.
Fixes from Hans Breuer:
* app/datafiles.c: redefine the executable flag for Win32
to _S_IREAD, to get _all_ files from the plug-in dirs as
executables (including scripts)
* app/main.c: Win32-specific changes to allow building Gimp as a
console application, with all its benefits (like inheriting the
console), but hide it if the user doesn't want it. Also, if stdout
goes to a console, give the user a chance to read the help or
version messages. (tml: I am not convinced that it is better to
build gimp as a console application, but let's try it this way for
a while.)
* app/makefile.{cygwin,msc}: Build as console application, and
link with shell32 library.
* app/paint_core.c (paint_core_motion): Pass the value of a call
to the function gimage_active_drawable() to the paint_func,
instead of just passing the address of gimage_active_drawable...
(tml: This code is only called when the TOOL_TRACES_ON_WINDOW flag
is on, and only the clone tool sets that, and the clone tool's
paint_func doesn't use the drawable argument, so this hasn't
caused any trouble.)
* app/plug_in.c: On Win32, to support scripts, use new function
xspawn() instead of _spawnv. Add some more code to properly kill
plug-ins.
* libgimp/color_display.h: Add G_MODULE_EXPORT declarations.
2000-01-05 01:46:41 +08:00
|
|
|
{
|
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
/* Give them time to read the message if it was printed in a
|
|
|
|
* separate console window. I would really love to have
|
|
|
|
* some way of asking for confirmation to close the console
|
|
|
|
* window.
|
|
|
|
*/
|
|
|
|
HANDLE console;
|
|
|
|
DWORD mode;
|
|
|
|
|
|
|
|
console = GetStdHandle (STD_OUTPUT_HANDLE);
|
|
|
|
if (GetConsoleMode (console, &mode) != 0)
|
|
|
|
{
|
|
|
|
g_print (_("(This console window will close in ten seconds)\n"));
|
|
|
|
Sleep(10000);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
exit (0);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
g_set_message_handler ((GPrintFunc) gimp_message_func);
|
1998-05-28 17:03:57 +08:00
|
|
|
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifndef G_OS_WIN32
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
/* No use catching these on Win32, the user won't get any
|
|
|
|
* stack trace from glib anyhow. It's better to let Windows inform
|
|
|
|
* about the program error, and offer debugging (if the use
|
|
|
|
* has installed MSVC or some other compiler that knows how to
|
|
|
|
* install itself as a handler for program errors).
|
|
|
|
*/
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Handle some signals */
|
1999-02-21 07:20:54 +08:00
|
|
|
#ifdef SIGHUP
|
1997-11-25 06:05:25 +08:00
|
|
|
signal (SIGHUP, on_signal);
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGINT
|
1997-11-25 06:05:25 +08:00
|
|
|
signal (SIGINT, on_signal);
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGQUIT
|
1997-11-25 06:05:25 +08:00
|
|
|
signal (SIGQUIT, on_signal);
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGABRT
|
1997-11-25 06:05:25 +08:00
|
|
|
signal (SIGABRT, on_signal);
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGBUS
|
1997-11-25 06:05:25 +08:00
|
|
|
signal (SIGBUS, on_signal);
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGSEGV
|
1997-11-25 06:05:25 +08:00
|
|
|
signal (SIGSEGV, on_signal);
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGPIPE
|
1997-11-25 06:05:25 +08:00
|
|
|
signal (SIGPIPE, on_signal);
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGTERM
|
1997-11-25 06:05:25 +08:00
|
|
|
signal (SIGTERM, on_signal);
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGFPE
|
1997-11-25 06:05:25 +08:00
|
|
|
signal (SIGFPE, on_signal);
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
#ifdef SIGCHLD
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Handle child exits */
|
|
|
|
signal (SIGCHLD, on_sig_child);
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
#endif
|
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-06-05 10:11:16 +08:00
|
|
|
g_log_set_handler (NULL, G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL,
|
|
|
|
on_error, NULL);
|
1999-01-08 03:53:05 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Keep the command line arguments--for use in gimp_init */
|
|
|
|
gimp_argc = argc - 1;
|
|
|
|
gimp_argv = argv + 1;
|
|
|
|
|
|
|
|
/* Check the installation */
|
|
|
|
install_verify (init);
|
|
|
|
|
|
|
|
/* Main application loop */
|
1998-02-05 13:41:05 +08:00
|
|
|
if (!app_exit_finish_done ())
|
|
|
|
gtk_main ();
|
|
|
|
|
|
|
|
return 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifdef G_OS_WIN32
|
1999-02-21 07:20:54 +08:00
|
|
|
|
|
|
|
/* In case we build this as a windowed application */
|
|
|
|
|
Check for mmap.
* configure.in: Check for mmap.
* app/makefile.msc: Depend on gimpi.lib.
* app/app_procs.c (app_init): Fix gccism: Allocate filenames (an
array with non-constant size) dynamically.
* app/{datafiles,fileops,general,install,module_db,temp_buf}.c:
Include glib.h before standard headers, because of certain obscure
details related to compiling with gcc on Win32.
(If you really want to know: glib.h defines he names of POSIXish
(but non-ANSI) functions as prefixed with underscore, because
that's how they are named in the msvcrt runtime C library we want
to use. However, defining stat as _stat causes some problems if
done after including the mingw32 <sys/stat.h>. So, it's easiest to
include <glib.h> early.)
* app/main.c: Use _stdcall and __argc, __argv with MSC, but
__attribute__((stdcall)) and _argc, _argv with gcc. Don't print
the "Passed serialization test" message on Win32. (It would open
up an otherwise unnecessary console window.)
* app/paint_funcs.c (gaussian_blur_region): Don't use variable sum
until initialized.
* app/{bezier_select,paths_dialog}.c: Include config.h and define
rint() if necessary.
* app/plug_in.c: Use _spawnv, not spawnv, on Win32 and OS/2.
1999-05-29 01:47:17 +08:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#define _stdcall __attribute__((stdcall))
|
|
|
|
#endif
|
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
int _stdcall
|
Add gimpcolorspace object.
2000-01-04 Tor Lillqvist <tml@iki.fi>
* libgimp/makefile.{cygwin.msc}: Add gimpcolorspace object.
* libgimp/gimp.def: Add functions from it.
Fixes from Hans Breuer:
* app/datafiles.c: redefine the executable flag for Win32
to _S_IREAD, to get _all_ files from the plug-in dirs as
executables (including scripts)
* app/main.c: Win32-specific changes to allow building Gimp as a
console application, with all its benefits (like inheriting the
console), but hide it if the user doesn't want it. Also, if stdout
goes to a console, give the user a chance to read the help or
version messages. (tml: I am not convinced that it is better to
build gimp as a console application, but let's try it this way for
a while.)
* app/makefile.{cygwin,msc}: Build as console application, and
link with shell32 library.
* app/paint_core.c (paint_core_motion): Pass the value of a call
to the function gimage_active_drawable() to the paint_func,
instead of just passing the address of gimage_active_drawable...
(tml: This code is only called when the TOOL_TRACES_ON_WINDOW flag
is on, and only the clone tool sets that, and the clone tool's
paint_func doesn't use the drawable argument, so this hasn't
caused any trouble.)
* app/plug_in.c: On Win32, to support scripts, use new function
xspawn() instead of _spawnv. Add some more code to properly kill
plug-ins.
* libgimp/color_display.h: Add G_MODULE_EXPORT declarations.
2000-01-05 01:46:41 +08:00
|
|
|
WinMain (struct HINSTANCE__ *hInstance,
|
|
|
|
struct HINSTANCE__ *hPrevInstance,
|
|
|
|
char *lpszCmdLine,
|
|
|
|
int nCmdShow)
|
1999-02-21 07:20:54 +08:00
|
|
|
{
|
|
|
|
return main (__argc, __argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
1999-06-05 10:11:16 +08:00
|
|
|
init (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
/* Continue initializing */
|
|
|
|
gimp_init (gimp_argc, gimp_argv);
|
|
|
|
}
|
|
|
|
|
1999-01-08 03:53:05 +08:00
|
|
|
|
|
|
|
static void
|
1999-06-05 10:11:16 +08:00
|
|
|
on_error (const gchar *domain,
|
|
|
|
GLogLevelFlags flags,
|
|
|
|
const gchar *msg,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
gimp_fatal_error ("%s", msg);
|
1999-01-08 03:53:05 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static int caught_fatal_sig = 0;
|
|
|
|
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifndef G_OS_WIN32
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static RETSIGTYPE
|
|
|
|
on_signal (int sig_num)
|
|
|
|
{
|
|
|
|
if (caught_fatal_sig)
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifdef G_OS_WIN32
|
1999-02-21 07:20:54 +08:00
|
|
|
raise (sig_num);
|
|
|
|
#else
|
1997-11-25 06:05:25 +08:00
|
|
|
kill (getpid (), sig_num);
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
1997-11-25 06:05:25 +08:00
|
|
|
caught_fatal_sig = 1;
|
|
|
|
|
|
|
|
switch (sig_num)
|
|
|
|
{
|
1999-02-21 07:20:54 +08:00
|
|
|
#ifdef SIGHUP
|
1997-11-25 06:05:25 +08:00
|
|
|
case SIGHUP:
|
2000-01-05 19:24:07 +08:00
|
|
|
gimp_terminate ("sighup caught");
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGINT
|
1997-11-25 06:05:25 +08:00
|
|
|
case SIGINT:
|
2000-01-05 19:24:07 +08:00
|
|
|
gimp_terminate ("sigint caught");
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGQUIT
|
1997-11-25 06:05:25 +08:00
|
|
|
case SIGQUIT:
|
2000-01-05 19:24:07 +08:00
|
|
|
gimp_terminate ("sigquit caught");
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGABRT
|
1997-11-25 06:05:25 +08:00
|
|
|
case SIGABRT:
|
2000-01-05 19:24:07 +08:00
|
|
|
gimp_terminate ("sigabrt caught");
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGBUS
|
1997-11-25 06:05:25 +08:00
|
|
|
case SIGBUS:
|
2000-01-05 19:24:07 +08:00
|
|
|
gimp_fatal_error ("sigbus caught");
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGSEGV
|
1997-11-25 06:05:25 +08:00
|
|
|
case SIGSEGV:
|
2000-01-05 19:24:07 +08:00
|
|
|
gimp_fatal_error ("sigsegv caught");
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGPIPE
|
1997-11-25 06:05:25 +08:00
|
|
|
case SIGPIPE:
|
2000-01-05 19:24:07 +08:00
|
|
|
gimp_terminate ("sigpipe caught");
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGTERM
|
1997-11-25 06:05:25 +08:00
|
|
|
case SIGTERM:
|
2000-01-05 19:24:07 +08:00
|
|
|
gimp_terminate ("sigterm caught");
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGFPE
|
1997-11-25 06:05:25 +08:00
|
|
|
case SIGFPE:
|
2000-01-05 19:24:07 +08:00
|
|
|
gimp_fatal_error ("sigfpe caught");
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
1997-11-25 06:05:25 +08:00
|
|
|
default:
|
2000-01-05 19:24:07 +08:00
|
|
|
gimp_fatal_error ("unknown signal");
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
#ifdef SIGCHLD
|
1997-11-25 06:05:25 +08:00
|
|
|
static RETSIGTYPE
|
|
|
|
on_sig_child (int sig_num)
|
|
|
|
{
|
|
|
|
int pid;
|
|
|
|
int status;
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
pid = waitpid (WAIT_ANY, &status, WNOHANG);
|
|
|
|
if (pid <= 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
1998-11-08 07:02:14 +08:00
|
|
|
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
#endif
|
|
|
|
|
1998-11-08 07:02:14 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gint32 test_gint32;
|
|
|
|
float test_float;
|
|
|
|
char *test_string;
|
|
|
|
guint32 test_length;
|
|
|
|
guint16 *test_array;
|
|
|
|
} test_struct;
|
|
|
|
|
1999-06-05 10:11:16 +08:00
|
|
|
static void
|
|
|
|
test_gserialize (void)
|
1998-11-08 07:02:14 +08:00
|
|
|
{
|
|
|
|
GSerialDescription *test_struct_descript;
|
|
|
|
test_struct *ts, *to;
|
1998-12-16 19:23:30 +08:00
|
|
|
char ser_1[] = {3, 1, 2, 3, 4, 4, 64, 83, 51, 51, 101, 0, 0, 0, 4, 102, 111, 111, 0, 103, 0, 0, 0, 2, 5, 6, 7, 8 };
|
1999-06-05 10:11:16 +08:00
|
|
|
ts = g_new (test_struct, 1);
|
|
|
|
to = g_new (test_struct, 1);
|
1998-11-08 07:02:14 +08:00
|
|
|
test_struct_descript
|
|
|
|
= g_new_serial_description("test_struct",
|
|
|
|
g_serial_item(GSERIAL_INT32,
|
|
|
|
test_struct,
|
|
|
|
test_gint32),
|
|
|
|
g_serial_item(GSERIAL_FLOAT,
|
|
|
|
test_struct,
|
|
|
|
test_float),
|
|
|
|
g_serial_item(GSERIAL_STRING,
|
|
|
|
test_struct,
|
|
|
|
test_string),
|
|
|
|
g_serial_vlen_array(GSERIAL_INT16ARRAY,
|
|
|
|
test_struct,
|
|
|
|
test_array,
|
|
|
|
test_length),
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
|
|
ts->test_gint32 = 0x01020304;
|
|
|
|
ts->test_float = 3.3f;
|
|
|
|
ts->test_string = "foo";
|
|
|
|
ts->test_length = 2;
|
1999-06-05 10:11:16 +08:00
|
|
|
ts->test_array = g_new (guint16, 2);
|
1998-11-08 07:02:14 +08:00
|
|
|
ts->test_array[0] = 0x0506;
|
|
|
|
ts->test_array[1] = 0x0708;
|
|
|
|
|
1999-06-05 10:11:16 +08:00
|
|
|
g_deserialize (test_struct_descript, (char *)(void*)to, ser_1);
|
1998-11-08 07:02:14 +08:00
|
|
|
|
1999-01-20 03:43:36 +08:00
|
|
|
#define EPSILON .0001
|
|
|
|
|
1998-11-08 08:38:16 +08:00
|
|
|
if (to->test_gint32 != ts->test_gint32)
|
1998-11-13 12:00:54 +08:00
|
|
|
g_message("gint32 test failed (please email your system configuration to jaycox@earthlink.net): %d\n", to->test_gint32);
|
1999-01-20 03:43:36 +08:00
|
|
|
if (to->test_float + EPSILON < ts->test_float || to->test_float - EPSILON > ts->test_float)
|
1998-11-13 12:00:54 +08:00
|
|
|
g_message("float test failed (please email your system configuration to jaycox@earthlink.net): %f\n", to->test_float);
|
1998-11-08 08:38:16 +08:00
|
|
|
if (strcmp(to->test_string, ts->test_string) != 0)
|
1998-11-13 12:00:54 +08:00
|
|
|
g_message("string test failed (please email your system configuration to jaycox@earthlink.net): %s\n", to->test_string);
|
1998-11-08 08:38:16 +08:00
|
|
|
if (to->test_length != ts->test_length)
|
1998-11-13 12:00:54 +08:00
|
|
|
g_message("array length test failed(please email your system configuration to jaycox@earthlink.net): %d\n", to->test_length);
|
1998-11-08 08:38:16 +08:00
|
|
|
if (to->test_array[0] != ts->test_array[0])
|
1998-11-13 12:00:54 +08:00
|
|
|
g_message("int16array value 0 test failed(please email your system configuration to jaycox@earthlink.net): %d\n", to->test_array[0]);
|
1998-11-08 07:02:14 +08:00
|
|
|
g_return_if_fail (to->test_array[1] == ts->test_array[1]);
|
1998-11-08 08:38:16 +08:00
|
|
|
if (to->test_array[1] != ts->test_array[1])
|
1998-11-13 12:00:54 +08:00
|
|
|
g_message("int16array value 1 test failed(please email your system configuration to jaycox@earthlink.net): %d\n", to->test_array[1]);
|
1999-07-15 16:15:17 +08:00
|
|
|
|
|
|
|
/* free the memory */
|
|
|
|
g_free (ts->test_array);
|
|
|
|
g_free (ts);
|
|
|
|
g_free (to->test_array);
|
|
|
|
g_free (to->test_string);
|
|
|
|
g_free (to);
|
|
|
|
g_free_serial_description (test_struct_descript);
|
|
|
|
}
|