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
|
|
|
*/
|
2000-12-17 05:37:03 +08:00
|
|
|
|
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
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/types.h>
|
2000-02-11 09:04:23 +08:00
|
|
|
|
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
|
2000-02-11 09:04:23 +08:00
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
#ifdef HAVE_UNISTD_H
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <unistd.h>
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#ifndef WAIT_ANY
|
|
|
|
#define WAIT_ANY -1
|
2001-07-14 03:25:34 +08:00
|
|
|
#endif
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include <locale.h>
|
|
|
|
|
2001-11-18 00:32:34 +08:00
|
|
|
#include <glib-object.h>
|
2000-02-11 09:04:23 +08:00
|
|
|
|
2001-05-22 04:30:16 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
1998-07-15 10:28:31 +08:00
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
#include "core/core-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "appenv.h"
|
|
|
|
#include "app_procs.h"
|
|
|
|
#include "errors.h"
|
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
1998-08-06 07:46:04 +08:00
|
|
|
|
2001-07-14 03:25:34 +08:00
|
|
|
|
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
|
2003-01-09 07:43:31 +08:00
|
|
|
static void gimp_sigfatal_handler (gint sig_num);
|
|
|
|
static void gimp_sigchld_handler (gint sig_num);
|
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
|
2000-04-22 00:42:11 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-09 07:43:31 +08:00
|
|
|
static void gimp_show_version (void);
|
|
|
|
static void gimp_show_help (const gchar *progname);
|
|
|
|
static void gimp_text_console_exit (gboolean fail);
|
|
|
|
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/*
|
2003-09-02 01:26:09 +08:00
|
|
|
* argv processing:
|
1997-11-25 06:05:25 +08:00
|
|
|
* 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.
|
|
|
|
*
|
2001-07-18 08:24:07 +08:00
|
|
|
* The exception is the batch switch. When this is
|
|
|
|
* encountered, all remaining args are treated as batch
|
|
|
|
* commands.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
|
|
|
|
1998-02-05 13:41:05 +08:00
|
|
|
int
|
2000-01-28 03:26:00 +08:00
|
|
|
main (int argc,
|
|
|
|
char **argv)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-09-02 01:26:09 +08:00
|
|
|
gchar *alternate_system_gimprc = NULL;
|
|
|
|
gchar *alternate_gimprc = NULL;
|
|
|
|
gchar **batch_cmds = NULL;
|
|
|
|
gboolean show_help = FALSE;
|
|
|
|
gboolean no_interface = FALSE;
|
|
|
|
gboolean no_data = FALSE;
|
|
|
|
gboolean no_splash = FALSE;
|
|
|
|
gboolean no_splash_image = FALSE;
|
|
|
|
gboolean be_verbose = FALSE;
|
|
|
|
gboolean use_shm = FALSE;
|
|
|
|
gboolean use_mmx = TRUE;
|
2003-09-09 18:54:20 +08:00
|
|
|
gboolean console_messages = FALSE;
|
2003-09-02 01:26:09 +08:00
|
|
|
gboolean restore_session = FALSE;
|
|
|
|
gint i, j;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-08-04 03:43:19 +08:00
|
|
|
#if 0
|
|
|
|
g_mem_set_vtable (glib_mem_profiler_table);
|
1998-09-08 13:31:51 +08:00
|
|
|
g_atexit (g_mem_profile);
|
2001-08-04 03:43:19 +08:00
|
|
|
#endif
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Initialize variables */
|
2000-01-28 03:26:00 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
prog_name = argv[0];
|
|
|
|
|
1999-09-25 09:59:43 +08:00
|
|
|
/* Initialize i18n support */
|
1999-12-04 21:46:25 +08:00
|
|
|
|
2002-02-19 01:42:17 +08:00
|
|
|
setlocale (LC_ALL, "");
|
|
|
|
|
2002-05-11 07:30:09 +08:00
|
|
|
bindtextdomain (GETTEXT_PACKAGE"-libgimp", gimp_locale_directory ());
|
2003-03-26 00:38:19 +08:00
|
|
|
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
|
2002-02-19 01:42:17 +08:00
|
|
|
bind_textdomain_codeset (GETTEXT_PACKAGE"-libgimp", "UTF-8");
|
2003-03-26 00:38:19 +08:00
|
|
|
#endif
|
2002-02-19 01:42:17 +08:00
|
|
|
|
2002-05-11 07:30:09 +08:00
|
|
|
bindtextdomain (GETTEXT_PACKAGE, gimp_locale_directory ());
|
2003-03-26 00:38:19 +08:00
|
|
|
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
|
2002-02-19 01:42:17 +08:00
|
|
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
2003-03-26 00:38:19 +08:00
|
|
|
#endif
|
2002-02-19 01:42:17 +08:00
|
|
|
|
|
|
|
textdomain (GETTEXT_PACKAGE);
|
1999-09-04 09:43:50 +08:00
|
|
|
|
2003-01-09 07:43:31 +08:00
|
|
|
/* Check argv[] for "--no-interface" before trying to initialize gtk+.
|
|
|
|
* We also check for "--help" or "--version" here since those shouldn't
|
|
|
|
* require gui libs either.
|
|
|
|
*/
|
2001-11-18 00:32:34 +08:00
|
|
|
for (i = 1; i < argc; i++)
|
|
|
|
{
|
|
|
|
if ((strcmp (argv[i], "--no-interface") == 0) ||
|
|
|
|
(strcmp (argv[i], "-i") == 0))
|
|
|
|
{
|
|
|
|
no_interface = TRUE;
|
|
|
|
}
|
2003-01-09 07:43:31 +08:00
|
|
|
else if ((strcmp (argv[i], "--version") == 0) ||
|
|
|
|
(strcmp (argv[i], "-v") == 0))
|
|
|
|
{
|
|
|
|
gimp_show_version ();
|
|
|
|
gimp_text_console_exit (FALSE);
|
|
|
|
}
|
|
|
|
else if ((strcmp (argv[i], "--help") == 0) ||
|
|
|
|
(strcmp (argv[i], "-h") == 0))
|
|
|
|
{
|
|
|
|
gimp_show_help (argv[0]);
|
|
|
|
gimp_text_console_exit (FALSE);
|
|
|
|
}
|
2001-11-18 00:32:34 +08:00
|
|
|
}
|
1999-09-28 06:12:44 +08:00
|
|
|
|
2001-11-18 00:32:34 +08:00
|
|
|
if (no_interface)
|
|
|
|
{
|
|
|
|
g_type_init ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-05-29 19:34:30 +08:00
|
|
|
if (! app_gui_libs_init (&argc, &argv))
|
2003-01-09 07:43:31 +08:00
|
|
|
{
|
2003-01-09 19:01:01 +08:00
|
|
|
const gchar *msg;
|
|
|
|
|
2003-01-19 20:44:31 +08:00
|
|
|
msg = _("GIMP could not initialize the graphical user interface.\n"
|
2003-01-09 19:01:01 +08:00
|
|
|
"Make sure a proper setup for your display environment exists.");
|
|
|
|
g_print ("%s\n\n", msg);
|
|
|
|
|
2003-01-09 07:43:31 +08:00
|
|
|
gimp_text_console_exit (TRUE);
|
|
|
|
}
|
2001-11-18 00:32:34 +08:00
|
|
|
}
|
1997-12-18 07:28:44 +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
|
|
|
#endif
|
1999-06-05 10:11:16 +08:00
|
|
|
|
2001-07-18 08:24:07 +08:00
|
|
|
batch_cmds = g_new (char *, argc);
|
|
|
|
batch_cmds[0] = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
for (i = 1; i < argc; i++)
|
|
|
|
{
|
2001-11-18 00:32:34 +08:00
|
|
|
if (strcmp (argv[i], "--g-fatal-warnings") == 0)
|
|
|
|
{
|
|
|
|
GLogLevelFlags fatal_mask;
|
|
|
|
|
|
|
|
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
|
|
|
|
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
|
|
|
|
g_log_set_always_fatal (fatal_mask);
|
|
|
|
argv[i] = NULL;
|
|
|
|
}
|
|
|
|
else if ((strcmp (argv[i], "--no-interface") == 0) ||
|
|
|
|
(strcmp (argv[i], "-i") == 0))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
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) ||
|
2000-10-29 22:01:17 +08:00
|
|
|
(strcmp (argv[i], "-b") == 0))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
2001-07-18 08:24:07 +08:00
|
|
|
for (j = 0, i++ ; i < argc; j++, i++)
|
|
|
|
{
|
|
|
|
batch_cmds[j] = argv[i];
|
|
|
|
argv[i] = NULL;
|
|
|
|
}
|
|
|
|
batch_cmds[j] = NULL;
|
|
|
|
|
|
|
|
if (batch_cmds[0] == NULL) /* We need at least one batch command */
|
|
|
|
show_help = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2003-09-02 01:26:09 +08:00
|
|
|
else if (strcmp (argv[i], "--system-gimprc") == 0)
|
1998-07-11 15:06:39 +08:00
|
|
|
{
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
2003-09-02 01:26:09 +08:00
|
|
|
if (argc <= ++i)
|
1998-07-11 15:06:39 +08:00
|
|
|
{
|
2000-07-16 20:49:04 +08:00
|
|
|
show_help = TRUE;
|
|
|
|
}
|
2003-09-02 01:26:09 +08:00
|
|
|
else
|
1998-07-11 15:06:39 +08:00
|
|
|
{
|
2000-07-16 20:49:04 +08:00
|
|
|
alternate_system_gimprc = argv[i];
|
|
|
|
argv[i] = NULL;
|
1998-07-11 15:06:39 +08:00
|
|
|
}
|
2003-09-02 01:26:09 +08:00
|
|
|
}
|
|
|
|
else if ((strcmp (argv[i], "--gimprc") == 0) ||
|
2000-08-22 05:46:45 +08:00
|
|
|
(strcmp (argv[i], "-g") == 0))
|
1998-07-11 10:00:19 +08:00
|
|
|
{
|
2000-10-29 22:01:17 +08:00
|
|
|
argv[i] = NULL;
|
2003-09-02 01:26:09 +08:00
|
|
|
if (argc <= ++i)
|
1998-07-11 10:00:19 +08:00
|
|
|
{
|
2000-07-16 20:49:04 +08:00
|
|
|
show_help = TRUE;
|
|
|
|
}
|
|
|
|
else
|
1998-07-11 10:00:19 +08:00
|
|
|
{
|
2000-07-16 20:49:04 +08:00
|
|
|
alternate_gimprc = argv[i];
|
|
|
|
argv[i] = NULL;
|
1998-07-11 10:00:19 +08:00
|
|
|
}
|
2000-07-16 20:49:04 +08:00
|
|
|
}
|
2000-08-22 05:46:45 +08:00
|
|
|
else if ((strcmp (argv[i], "--no-data") == 0) ||
|
2000-10-29 22:01:17 +08:00
|
|
|
(strcmp (argv[i], "-d") == 0))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
no_data = TRUE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2000-08-22 05:46:45 +08:00
|
|
|
else if ((strcmp (argv[i], "--no-splash") == 0) ||
|
2000-10-29 22:01:17 +08:00
|
|
|
(strcmp (argv[i], "-s") == 0))
|
1998-02-18 04:14:29 +08:00
|
|
|
{
|
|
|
|
no_splash = TRUE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1998-02-18 04:14:29 +08:00
|
|
|
}
|
2000-08-22 05:46:45 +08:00
|
|
|
else if ((strcmp (argv[i], "--no-splash-image") == 0) ||
|
2000-10-29 22:01:17 +08:00
|
|
|
(strcmp (argv[i], "-S") == 0))
|
1998-02-18 04:14:29 +08:00
|
|
|
{
|
|
|
|
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
|
|
|
}
|
2002-03-22 21:37:26 +08:00
|
|
|
else if (strcmp (argv[i], "--no-mmx") == 0)
|
|
|
|
{
|
|
|
|
use_mmx = FALSE;
|
|
|
|
argv[i] = NULL;
|
|
|
|
}
|
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
|
|
|
}
|
2000-08-22 05:46:45 +08:00
|
|
|
else if ((strcmp (argv[i], "--console-messages") == 0) ||
|
2000-10-29 22:01:17 +08:00
|
|
|
(strcmp (argv[i], "-c") == 0))
|
1998-05-30 15:32:37 +08:00
|
|
|
{
|
|
|
|
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) ||
|
2000-10-29 22:01:17 +08:00
|
|
|
(strcmp (argv[i], "-r") == 0))
|
1998-07-12 06:23:23 +08:00
|
|
|
{
|
|
|
|
restore_session = TRUE;
|
1998-09-11 03:03:20 +08:00
|
|
|
argv[i] = NULL;
|
1998-07-12 06:23:23 +08:00
|
|
|
}
|
2003-09-02 01:26:09 +08:00
|
|
|
else if (strcmp (argv[i], "--enable-stack-trace") == 0)
|
2000-04-25 02:32:42 +08:00
|
|
|
{
|
|
|
|
argv[i] = NULL;
|
2003-09-02 01:26:09 +08:00
|
|
|
if (argc <= ++i)
|
2000-07-16 20:49:04 +08:00
|
|
|
{
|
|
|
|
show_help = TRUE;
|
|
|
|
}
|
2003-09-02 01:26:09 +08:00
|
|
|
else
|
2000-07-16 20:49:04 +08:00
|
|
|
{
|
|
|
|
if (! strcmp (argv[i], "never"))
|
2001-12-01 08:14:14 +08:00
|
|
|
stack_trace_mode = GIMP_STACK_TRACE_NEVER;
|
2000-07-16 20:49:04 +08:00
|
|
|
else if (! strcmp (argv[i], "query"))
|
2001-12-01 08:14:14 +08:00
|
|
|
stack_trace_mode = GIMP_STACK_TRACE_QUERY;
|
2000-07-16 20:49:04 +08:00
|
|
|
else if (! strcmp (argv[i], "always"))
|
2001-12-01 08:14:14 +08:00
|
|
|
stack_trace_mode = GIMP_STACK_TRACE_ALWAYS;
|
2000-07-16 20:49:04 +08:00
|
|
|
else
|
|
|
|
show_help = TRUE;
|
2000-10-29 22:01:17 +08:00
|
|
|
|
2000-07-16 20:49:04 +08:00
|
|
|
argv[i] = NULL;
|
|
|
|
}
|
2000-10-29 22:01:17 +08:00
|
|
|
}
|
2001-11-18 00:32:34 +08:00
|
|
|
else if (strcmp (argv[i], "--") == 0)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* everything after "--" is a parameter (i.e. image to load)
|
|
|
|
*/
|
|
|
|
argv[i] = NULL;
|
|
|
|
break;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
else if (argv[i][0] == '-')
|
|
|
|
{
|
2001-11-18 00:32:34 +08:00
|
|
|
/*
|
|
|
|
* anything else starting with a '-' is an error.
|
|
|
|
*/
|
2001-04-25 07:06:51 +08:00
|
|
|
g_print (_("\nInvalid option \"%s\"\n"), argv[i]);
|
|
|
|
show_help = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
2003-09-02 01:26:09 +08:00
|
|
|
/* Common windoze apps don't have a console at all. So does Gimp
|
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
|
|
|
* - if appropiate. This allows to compile as console application
|
2003-01-09 07:43:31 +08:00
|
|
|
* with all it's benefits (like inheriting the console) but hide
|
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
|
|
|
* it, if the user doesn't want it.
|
|
|
|
*/
|
2003-01-09 07:43:31 +08:00
|
|
|
if (!show_help && !be_verbose && !console_messages)
|
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
|
|
|
FreeConsole ();
|
|
|
|
#endif
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (show_help)
|
|
|
|
{
|
2003-01-09 07:43:31 +08:00
|
|
|
gimp_show_help (argv[0]);
|
|
|
|
gimp_text_console_exit (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
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifndef G_OS_WIN32
|
2000-04-22 00:42:11 +08:00
|
|
|
|
2003-09-02 01:26:09 +08:00
|
|
|
/* No use catching these on Win32, the user won't get any
|
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
|
|
|
* stack trace from glib anyhow. It's better to let Windows inform
|
2000-05-11 05:21:23 +08:00
|
|
|
* about the program error, and offer debugging (if the user
|
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
|
|
|
* has installed MSVC or some other compiler that knows how to
|
|
|
|
* install itself as a handler for program errors).
|
|
|
|
*/
|
|
|
|
|
2000-05-11 05:21:23 +08:00
|
|
|
/* Handle fatal signals */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-12-18 00:26:34 +08:00
|
|
|
/* these are handled by gimp_terminate() */
|
2000-05-11 05:21:23 +08:00
|
|
|
gimp_signal_private (SIGHUP, gimp_sigfatal_handler, 0);
|
|
|
|
gimp_signal_private (SIGINT, gimp_sigfatal_handler, 0);
|
|
|
|
gimp_signal_private (SIGQUIT, gimp_sigfatal_handler, 0);
|
|
|
|
gimp_signal_private (SIGABRT, gimp_sigfatal_handler, 0);
|
|
|
|
gimp_signal_private (SIGTERM, gimp_sigfatal_handler, 0);
|
2002-12-18 00:26:34 +08:00
|
|
|
|
2002-12-18 00:41:30 +08:00
|
|
|
if (stack_trace_mode != GIMP_STACK_TRACE_NEVER)
|
2002-12-18 00:26:34 +08:00
|
|
|
{
|
|
|
|
/* these are handled by gimp_fatal_error() */
|
|
|
|
gimp_signal_private (SIGBUS, gimp_sigfatal_handler, 0);
|
|
|
|
gimp_signal_private (SIGSEGV, gimp_sigfatal_handler, 0);
|
|
|
|
gimp_signal_private (SIGFPE, gimp_sigfatal_handler, 0);
|
|
|
|
}
|
2000-04-22 00:42:11 +08:00
|
|
|
|
2000-05-11 05:21:23 +08:00
|
|
|
/* Ignore SIGPIPE because plug_in.c handles broken pipes */
|
2000-04-22 00:42:11 +08:00
|
|
|
|
2000-05-11 05:21:23 +08:00
|
|
|
gimp_signal_private (SIGPIPE, SIG_IGN, 0);
|
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
|
|
|
|
2000-05-11 05:21:23 +08:00
|
|
|
/* Collect dead children */
|
2000-05-01 01:47:32 +08:00
|
|
|
|
2000-05-11 05:21:23 +08:00
|
|
|
gimp_signal_private (SIGCHLD, gimp_sigchld_handler, SA_RESTART);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-11 05:21:23 +08:00
|
|
|
#endif /* G_OS_WIN32 */
|
|
|
|
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
/* Initialize the application */
|
|
|
|
app_init (argc - 1,
|
2003-09-02 01:26:09 +08:00
|
|
|
argv + 1,
|
|
|
|
alternate_system_gimprc,
|
|
|
|
alternate_gimprc,
|
|
|
|
(const gchar **) batch_cmds,
|
|
|
|
no_interface,
|
|
|
|
no_data,
|
|
|
|
no_splash,
|
|
|
|
no_splash_image,
|
|
|
|
be_verbose,
|
|
|
|
use_shm,
|
|
|
|
use_mmx,
|
2003-09-09 18:54:20 +08:00
|
|
|
console_messages,
|
2003-09-02 01:26:09 +08:00
|
|
|
restore_session);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-02-05 13:41:05 +08:00
|
|
|
return 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
|
2003-01-09 07:43:31 +08:00
|
|
|
static void
|
|
|
|
gimp_show_version (void)
|
|
|
|
{
|
|
|
|
g_print ("%s %s\n", _("GIMP version"), GIMP_VERSION);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_show_help (const gchar *progname)
|
|
|
|
{
|
|
|
|
gimp_show_version ();
|
|
|
|
|
|
|
|
g_print (_("\nUsage: %s [option ... ] [file ... ]\n\n"), progname);
|
|
|
|
g_print (_("Options:\n"));
|
|
|
|
g_print (_(" -b, --batch <commands> Run in batch mode.\n"));
|
|
|
|
g_print (_(" -c, --console-messages Display warnings to console instead of a dialog box.\n"));
|
|
|
|
g_print (_(" -d, --no-data Do not load brushes, gradients, palettes, patterns.\n"));
|
|
|
|
g_print (_(" -i, --no-interface Run without a user interface.\n"));
|
|
|
|
g_print (_(" -g, --gimprc <gimprc> Use an alternate gimprc file.\n"));
|
|
|
|
g_print (_(" -h, --help Output this help.\n"));
|
|
|
|
g_print (_(" -r, --restore-session Try to restore saved session.\n"));
|
|
|
|
g_print (_(" -s, --no-splash Do not show the startup window.\n"));
|
|
|
|
g_print (_(" -S, --no-splash-image Do not add an image to the startup window.\n"));
|
|
|
|
g_print (_(" -v, --version Output version information.\n"));
|
2003-09-02 01:26:09 +08:00
|
|
|
g_print (_(" --verbose Show startup messages.\n"));
|
2003-01-09 07:43:31 +08:00
|
|
|
g_print (_(" --no-shm Do not use shared memory between GIMP and plugins.\n"));
|
|
|
|
g_print (_(" --no-mmx Do not use MMX routines.\n"));
|
|
|
|
g_print (_(" --debug-handlers Enable non-fatal debugging signal handlers.\n"));
|
|
|
|
g_print (_(" --display <display> Use the designated X display.\n"));
|
|
|
|
g_print (_(" --system-gimprc <gimprc> Use an alternate system gimprc file.\n"));
|
2003-01-09 19:01:01 +08:00
|
|
|
g_print (_(" --enable-stack-trace <never | query | always>\n"
|
|
|
|
" Debugging mode for fatal signals.\n\n"));
|
2003-01-09 07:43:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_text_console_exit (gboolean fail)
|
|
|
|
{
|
|
|
|
#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 (fail ? 1 : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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__
|
2000-04-11 04:47:04 +08:00
|
|
|
# ifndef _stdcall
|
|
|
|
# define _stdcall __attribute__((stdcall))
|
|
|
|
# endif
|
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
|
|
|
#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);
|
|
|
|
}
|
|
|
|
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
#endif /* G_OS_WIN32 */
|
1999-01-08 03:53:05 +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
|
|
|
|
2000-04-22 00:42:11 +08:00
|
|
|
/* gimp core signal handler for fatal signals */
|
|
|
|
|
|
|
|
static void
|
2000-05-11 05:21:23 +08:00
|
|
|
gimp_sigfatal_handler (gint sig_num)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
switch (sig_num)
|
|
|
|
{
|
|
|
|
case SIGHUP:
|
|
|
|
case SIGINT:
|
|
|
|
case SIGQUIT:
|
|
|
|
case SIGABRT:
|
2000-05-11 05:21:23 +08:00
|
|
|
case SIGTERM:
|
|
|
|
gimp_terminate (g_strsignal (sig_num));
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
2000-04-22 00:42:11 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
case SIGBUS:
|
|
|
|
case SIGSEGV:
|
2000-05-11 05:21:23 +08:00
|
|
|
case SIGFPE:
|
|
|
|
default:
|
|
|
|
gimp_fatal_error (g_strsignal (sig_num));
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
2000-05-11 05:21:23 +08:00
|
|
|
}
|
|
|
|
}
|
2000-04-22 00:42:11 +08:00
|
|
|
|
2000-05-11 05:21:23 +08:00
|
|
|
/* gimp core signal handler for death-of-child signals */
|
2000-04-22 00:42:11 +08:00
|
|
|
|
2000-05-11 05:21:23 +08:00
|
|
|
static void
|
|
|
|
gimp_sigchld_handler (gint sig_num)
|
|
|
|
{
|
|
|
|
gint pid;
|
|
|
|
gint status;
|
2000-04-22 00:42:11 +08:00
|
|
|
|
2000-05-11 05:21:23 +08:00
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
pid = waitpid (WAIT_ANY, &status, WNOHANG);
|
2000-04-22 00:42:11 +08:00
|
|
|
|
2000-05-11 05:21:23 +08:00
|
|
|
if (pid <= 0)
|
|
|
|
break;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
removed the gimp_busy boolean, check whether user_installation is needed
2001-07-10 Michael Natterer <mitch@gimp.org>
* app/app_procs.[ch]: removed the gimp_busy boolean, check whether
user_installation is needed here, not in user_install.c, parse
gtkrc an friends only if(!no_interface), create the Gimp object
before parsing gimp's rc files an pas it to the parse functions,
many other cleanups.
* app/appenums.h: added MessageHandlerType and StackTraceMode.
* app/appenv.h: removed MessageHandlerType, declare all global
variables from main.c (no more hidden global stuff please).
* app/errors.[ch]: added the fatal message func here (from main.c),
removed the StackTraceMode enum.
* app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp
pointer to some functions.
* app/gimpunit.c
* app/unitrc.h: ok, this is ugly: renamed all functions to
_gimp_unit_*() and made them public. The unit list is part
of the Gimp object now, so pass a Gimp* to all functions.
* app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*()
functions which are used by widgets.
* app/main.c: cleaned up the global variables, removed the fatal
message handler, call app_init() directly, not via the
user_install stuff, misc. cleanups.
* app/user_install.[ch]: removed the check if user_installation is
needed (done by app_procs.c now).
* app/core/gimp.[ch]: added the user_unit list and the "busy"
boolean. Moved gimp_[set|unset]_busy() here. Added
gimp_initialize() which is called after unitrc and gimprc are
parsed.
* app/batch.c
* app/colormaps.c
* app/devices.c
* app/disp_callbacks.c
* app/gdisplay_ops.c
* app/gimphelp.c
* app/module_db.c
* app/nav_window.c
* app/plug_in.c
* app/core/gimpcontext.c
* app/core/gimpdatafiles.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage.c
* app/core/gimpparasite.c
* app/core/gimpparasitelist.h
* app/gui/file-open-dialog.c
* app/gui/gui.[ch]
* app/gui/info-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/session.c
* app/gui/tips-dialog.c
* app/gui/toolbox.c
* app/tools/gimpblendtool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimptransformtool.c
* app/tools/tool_manager.c
* app/widgets/gimpcolorpanel.c
* app/widgets/gimpcursor.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* tools/pdbgen/Makefile.am
* tools/pdbgen/app.pl
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/message.pdb
* tools/pdbgen/pdb/unit.pdb
* app/pdb/image_cmds.c
* app/pdb/message_cmds.c
* app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
2001-07-11 03:16:16 +08:00
|
|
|
#endif /* ! G_OS_WIN32 */
|