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
|
|
|
*/
|
1999-02-21 07:20:54 +08:00
|
|
|
#include "config.h"
|
1999-09-28 01:58:10 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <signal.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
1999-02-21 07:20:54 +08:00
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <sys/param.h>
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
1999-02-07 18:45:56 +08:00
|
|
|
#include <sys/types.h>
|
1999-02-21 07:20:54 +08:00
|
|
|
#ifdef HAVE_DIRENT_H
|
1999-02-07 18:45:56 +08:00
|
|
|
#include <dirent.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
|
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
|
|
|
#include <process.h> /* For _getpid() */
|
|
|
|
#endif
|
|
|
|
|
1998-05-28 17:03:57 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
1998-07-15 10:28:31 +08:00
|
|
|
#include "libgimp/gimpfeatures.h"
|
1999-03-07 20:56:03 +08:00
|
|
|
#include "libgimp/gimpenv.h"
|
1998-07-15 10:28:31 +08:00
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include "apptypes.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "appenv.h"
|
|
|
|
#include "app_procs.h"
|
|
|
|
#include "batch.h"
|
1999-10-27 02:27:27 +08:00
|
|
|
#include "brush_select.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "color_transfer.h"
|
|
|
|
#include "curves.h"
|
|
|
|
#include "colormaps.h"
|
1999-06-19 02:29:27 +08:00
|
|
|
#include "context_manager.h"
|
1999-10-27 02:27:27 +08:00
|
|
|
#include "devices.h"
|
1998-08-03 03:05:02 +08:00
|
|
|
#include "errorconsole.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "fileops.h"
|
1999-10-27 02:27:27 +08:00
|
|
|
#include "gdisplay.h"
|
|
|
|
#include "gdisplay_ops.h"
|
|
|
|
#include "gimpbrushlist.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "gimprc.h"
|
1998-10-30 18:21:33 +08:00
|
|
|
#include "gimpparasite.h"
|
1998-07-02 07:06:49 +08:00
|
|
|
#include "gimpset.h"
|
1999-09-28 01:58:10 +08:00
|
|
|
#include "gimpui.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "global_edit.h"
|
1999-10-28 23:05:49 +08:00
|
|
|
#include "gradient_select.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "gradient.h"
|
|
|
|
#include "gximage.h"
|
|
|
|
#include "hue_saturation.h"
|
|
|
|
#include "image_render.h"
|
|
|
|
#include "interface.h"
|
|
|
|
#include "internal_procs.h"
|
1999-06-07 01:26:51 +08:00
|
|
|
#include "lc_dialog.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "levels.h"
|
|
|
|
#include "menus.h"
|
|
|
|
#include "paint_funcs.h"
|
|
|
|
#include "palette.h"
|
1999-10-27 02:27:27 +08:00
|
|
|
#include "pattern_select.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "patterns.h"
|
|
|
|
#include "plug_in.h"
|
1999-01-19 08:03:00 +08:00
|
|
|
#include "module_db.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "procedural_db.h"
|
1998-06-23 01:30:40 +08:00
|
|
|
#include "session.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "temp_buf.h"
|
|
|
|
#include "tile_swap.h"
|
|
|
|
#include "tips_dialog.h"
|
|
|
|
#include "tools.h"
|
|
|
|
#include "undo.h"
|
1999-03-17 04:14:07 +08:00
|
|
|
#include "unitrc.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "xcf.h"
|
1998-05-28 17:03:57 +08:00
|
|
|
#include "errors.h"
|
1998-07-08 18:29:09 +08:00
|
|
|
#include "docindex.h"
|
1999-01-08 03:53:05 +08:00
|
|
|
#include "colormap_dialog.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-25 04:27:04 +08:00
|
|
|
#ifdef DISPLAY_FILTERS
|
|
|
|
#include "gdisplay_color.h"
|
|
|
|
#endif /* DISPLAY_FILTERS */
|
|
|
|
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
#include "color_notebook.h"
|
|
|
|
#include "color_select.h"
|
1999-04-09 14:00:11 +08:00
|
|
|
#include "gimpparasite.h"
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
|
1999-05-23 01:56:35 +08:00
|
|
|
#include "libgimp/gimplimits.h"
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
1999-12-18 00:37:50 +08:00
|
|
|
#define LOGO_WIDTH_MIN 300
|
1998-07-20 23:07:13 +08:00
|
|
|
#define LOGO_HEIGHT_MIN 110
|
2000-02-10 09:59:52 +08:00
|
|
|
#define AUTHORS "Spencer Kimball & Peter Mattis"
|
1998-07-20 23:07:13 +08:00
|
|
|
|
1998-02-18 04:14:29 +08:00
|
|
|
#define SHOW_NEVER 0
|
|
|
|
#define SHOW_LATER 1
|
1999-12-18 00:37:50 +08:00
|
|
|
#define SHOW_NOW 2
|
1998-07-20 23:07:13 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Function prototype for affirmation dialog when exiting application */
|
1999-12-18 00:37:50 +08:00
|
|
|
static void really_quit_dialog (void);
|
|
|
|
static void make_initialization_status_window (void);
|
|
|
|
static void destroy_initialization_status_window (void);
|
|
|
|
static gboolean splash_logo_load (GtkWidget *window);
|
|
|
|
static gboolean splash_logo_load_size (GtkWidget *window);
|
|
|
|
static void splash_logo_draw (GtkWidget *widget);
|
|
|
|
static void splash_text_draw (GtkWidget *widget);
|
|
|
|
static void splash_logo_expose (GtkWidget *widget);
|
|
|
|
static void toast_old_temp_files (void);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
2000-04-06 06:59:42 +08:00
|
|
|
static gboolean is_app_exit_finish_done = FALSE;
|
|
|
|
gboolean we_are_exiting = FALSE;
|
1999-12-18 00:37:50 +08:00
|
|
|
|
|
|
|
static GtkWidget *logo_area = NULL;
|
|
|
|
static GdkPixmap *logo_pixmap = NULL;
|
|
|
|
static gint logo_width = 0;
|
|
|
|
static gint logo_height = 0;
|
|
|
|
static gint logo_area_width = 0;
|
|
|
|
static gint logo_area_height = 0;
|
|
|
|
static gint show_logo = SHOW_NEVER;
|
|
|
|
static gint max_label_length = MAXPATHLEN;
|
1998-02-05 13:41:05 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
void
|
2000-05-08 01:47:24 +08:00
|
|
|
gimp_init (gint gimp_argc,
|
|
|
|
gchar **gimp_argv)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
/* Initialize the application */
|
|
|
|
app_init ();
|
|
|
|
|
|
|
|
/* Parse the rest of the command line arguments as images to load */
|
|
|
|
if (gimp_argc > 0)
|
|
|
|
while (gimp_argc--)
|
|
|
|
{
|
|
|
|
if (*gimp_argv)
|
1998-05-12 17:53:24 +08:00
|
|
|
file_open (*gimp_argv, *gimp_argv);
|
1997-11-25 06:05:25 +08:00
|
|
|
gimp_argv++;
|
|
|
|
}
|
|
|
|
|
|
|
|
batch_init ();
|
1998-05-12 17:53:24 +08:00
|
|
|
|
|
|
|
/* Handle showing dialogs with gdk_quit_adds here */
|
|
|
|
if (!no_interface && show_tips)
|
|
|
|
tips_dialog_create ();
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-12-18 00:37:50 +08:00
|
|
|
static gboolean
|
1998-02-18 04:14:29 +08:00
|
|
|
splash_logo_load_size (GtkWidget *window)
|
|
|
|
{
|
1999-12-18 00:37:50 +08:00
|
|
|
gchar buf[1024];
|
1998-02-18 04:14:29 +08:00
|
|
|
FILE *fp;
|
|
|
|
|
|
|
|
if (logo_pixmap)
|
|
|
|
return TRUE;
|
|
|
|
|
2000-03-25 05:57:32 +08:00
|
|
|
g_snprintf (buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "gimp_splash.ppm",
|
1999-03-07 20:56:03 +08:00
|
|
|
gimp_data_directory ());
|
1998-02-18 04:14:29 +08:00
|
|
|
|
1998-08-01 02:34:05 +08:00
|
|
|
fp = fopen (buf, "rb");
|
1998-02-18 04:14:29 +08:00
|
|
|
if (!fp)
|
1999-12-18 00:37:50 +08:00
|
|
|
return FALSE;
|
1998-02-18 04:14:29 +08:00
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
fgets (buf, sizeof (buf), fp);
|
1998-02-18 04:14:29 +08:00
|
|
|
if (strcmp (buf, "P6\n") != 0)
|
|
|
|
{
|
|
|
|
fclose (fp);
|
1999-12-18 00:37:50 +08:00
|
|
|
return FALSE;
|
1998-02-18 04:14:29 +08:00
|
|
|
}
|
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
fgets (buf, sizeof (buf), fp);
|
|
|
|
fgets (buf, sizeof (buf), fp);
|
1998-02-18 04:14:29 +08:00
|
|
|
sscanf (buf, "%d %d", &logo_width, &logo_height);
|
|
|
|
|
|
|
|
fclose (fp);
|
1999-12-18 00:37:50 +08:00
|
|
|
|
1998-02-18 04:14:29 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-12-18 00:37:50 +08:00
|
|
|
static gboolean
|
1998-02-18 04:14:29 +08:00
|
|
|
splash_logo_load (GtkWidget *window)
|
|
|
|
{
|
|
|
|
GtkWidget *preview;
|
1998-02-27 07:27:12 +08:00
|
|
|
GdkGC *gc;
|
1999-12-18 00:37:50 +08:00
|
|
|
gchar buf[1024];
|
|
|
|
guchar *pixelrow;
|
1998-02-18 04:14:29 +08:00
|
|
|
FILE *fp;
|
1999-12-18 00:37:50 +08:00
|
|
|
gint count;
|
|
|
|
gint i;
|
1998-02-18 04:14:29 +08:00
|
|
|
|
|
|
|
if (logo_pixmap)
|
|
|
|
return TRUE;
|
|
|
|
|
2000-03-25 05:57:32 +08:00
|
|
|
g_snprintf (buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "gimp_splash.ppm",
|
1999-03-07 20:56:03 +08:00
|
|
|
gimp_data_directory ());
|
1998-02-18 04:14:29 +08:00
|
|
|
|
1998-08-01 02:34:05 +08:00
|
|
|
fp = fopen (buf, "rb");
|
1998-02-18 04:14:29 +08:00
|
|
|
if (!fp)
|
1999-12-18 00:37:50 +08:00
|
|
|
return FALSE;
|
1998-02-18 04:14:29 +08:00
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
fgets (buf, sizeof (buf), fp);
|
1998-02-18 04:14:29 +08:00
|
|
|
if (strcmp (buf, "P6\n") != 0)
|
|
|
|
{
|
|
|
|
fclose (fp);
|
1999-12-18 00:37:50 +08:00
|
|
|
return FALSE;
|
1998-02-18 04:14:29 +08:00
|
|
|
}
|
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
fgets (buf, sizeof (buf), fp);
|
|
|
|
fgets (buf, sizeof (buf), fp);
|
1998-02-18 04:14:29 +08:00
|
|
|
sscanf (buf, "%d %d", &logo_width, &logo_height);
|
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
fgets (buf, sizeof (buf), fp);
|
1998-02-18 04:14:29 +08:00
|
|
|
if (strcmp (buf, "255\n") != 0)
|
|
|
|
{
|
|
|
|
fclose (fp);
|
1999-12-18 00:37:50 +08:00
|
|
|
return FALSE;
|
1998-02-18 04:14:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
|
|
|
gtk_preview_size (GTK_PREVIEW (preview), logo_width, logo_height);
|
|
|
|
pixelrow = g_new (guchar, logo_width * 3);
|
|
|
|
|
|
|
|
for (i = 0; i < logo_height; i++)
|
|
|
|
{
|
|
|
|
count = fread (pixelrow, sizeof (unsigned char), logo_width * 3, fp);
|
|
|
|
if (count != (logo_width * 3))
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (preview);
|
|
|
|
g_free (pixelrow);
|
|
|
|
fclose (fp);
|
1999-12-18 00:37:50 +08:00
|
|
|
return FALSE;
|
1998-02-18 04:14:29 +08:00
|
|
|
}
|
|
|
|
gtk_preview_draw_row (GTK_PREVIEW (preview), pixelrow, 0, i, logo_width);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_realize (window);
|
1998-02-27 07:27:12 +08:00
|
|
|
logo_pixmap = gdk_pixmap_new (window->window, logo_width, logo_height,
|
|
|
|
gtk_preview_get_visual ()->depth);
|
|
|
|
gc = gdk_gc_new (logo_pixmap);
|
1998-02-18 04:14:29 +08:00
|
|
|
gtk_preview_put (GTK_PREVIEW (preview),
|
1998-02-27 07:27:12 +08:00
|
|
|
logo_pixmap, gc,
|
1998-02-18 04:14:29 +08:00
|
|
|
0, 0, 0, 0, logo_width, logo_height);
|
1998-02-27 07:27:12 +08:00
|
|
|
gdk_gc_destroy (gc);
|
1998-02-18 04:14:29 +08:00
|
|
|
|
1998-02-19 01:04:12 +08:00
|
|
|
gtk_widget_unref (preview);
|
1998-02-18 04:14:29 +08:00
|
|
|
g_free (pixelrow);
|
|
|
|
|
|
|
|
fclose (fp);
|
1999-12-18 00:37:50 +08:00
|
|
|
|
1998-02-18 04:14:29 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
splash_text_draw (GtkWidget *widget)
|
|
|
|
{
|
2000-04-06 06:59:42 +08:00
|
|
|
GdkFont *font;
|
1998-02-18 04:14:29 +08:00
|
|
|
|
2000-02-14 03:35:24 +08:00
|
|
|
/* this is a font, provide only one single font definition */
|
2000-02-10 09:59:52 +08:00
|
|
|
font = gdk_font_load (_("-*-helvetica-bold-r-normal--*-140-*-*-*-*-*-*"));
|
2000-04-06 06:59:42 +08:00
|
|
|
if (!font)
|
2000-02-14 03:35:24 +08:00
|
|
|
{
|
2000-04-06 06:59:42 +08:00
|
|
|
GtkStyle *style = gtk_widget_get_style (widget);
|
|
|
|
font = style->font;
|
|
|
|
gdk_font_ref (font);
|
|
|
|
}
|
|
|
|
|
|
|
|
gdk_draw_string (widget->window,
|
|
|
|
font,
|
|
|
|
widget->style->fg_gc[GTK_STATE_NORMAL],
|
|
|
|
((logo_area_width - gdk_string_width (font, _("The GIMP"))) / 2),
|
|
|
|
(0.25 * logo_area_height),
|
|
|
|
_("The GIMP"));
|
|
|
|
|
|
|
|
gdk_font_unref (font);
|
2000-02-14 03:35:24 +08:00
|
|
|
|
2000-04-06 06:59:42 +08:00
|
|
|
/* this is a fontset, e.g. multiple comma-separated font definitions */
|
|
|
|
font = gdk_fontset_load (_("-*-helvetica-bold-r-normal--*-120-*-*-*-*-*-*,*"));
|
|
|
|
if (!font)
|
|
|
|
{
|
|
|
|
GtkStyle *style = gtk_widget_get_style (widget);
|
|
|
|
font = style->font;
|
|
|
|
gdk_font_ref (font);
|
2000-02-14 03:35:24 +08:00
|
|
|
}
|
2000-04-06 06:59:42 +08:00
|
|
|
|
|
|
|
gdk_draw_string (widget->window,
|
|
|
|
font,
|
|
|
|
widget->style->fg_gc[GTK_STATE_NORMAL],
|
|
|
|
((logo_area_width - gdk_string_width (font, GIMP_VERSION)) / 2),
|
|
|
|
(0.45 * logo_area_height),
|
|
|
|
GIMP_VERSION);
|
|
|
|
gdk_draw_string (widget->window,
|
|
|
|
font,
|
|
|
|
widget->style->fg_gc[GTK_STATE_NORMAL],
|
|
|
|
((logo_area_width - gdk_string_width (font, _("brought to you by"))) / 2),
|
|
|
|
(0.65 * logo_area_height),
|
|
|
|
_("brought to you by"));
|
|
|
|
gdk_draw_string (widget->window,
|
|
|
|
font,
|
|
|
|
widget->style->fg_gc[GTK_STATE_NORMAL],
|
|
|
|
((logo_area_width - gdk_string_width (font, AUTHORS)) / 2),
|
|
|
|
(0.80 * logo_area_height),
|
|
|
|
AUTHORS);
|
|
|
|
|
|
|
|
gdk_font_unref (font);
|
1998-02-18 04:14:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
splash_logo_draw (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
gdk_draw_pixmap (widget->window,
|
|
|
|
widget->style->black_gc,
|
1998-07-20 23:07:13 +08:00
|
|
|
logo_pixmap,
|
1998-02-18 04:14:29 +08:00
|
|
|
0, 0,
|
1999-05-01 05:11:27 +08:00
|
|
|
((logo_area_width - logo_width) / 2),
|
|
|
|
((logo_area_height - logo_height) / 2),
|
1998-02-18 04:14:29 +08:00
|
|
|
logo_width, logo_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
splash_logo_expose (GtkWidget *widget)
|
|
|
|
{
|
1999-05-01 05:11:27 +08:00
|
|
|
switch (show_logo)
|
|
|
|
{
|
|
|
|
case SHOW_NEVER:
|
|
|
|
case SHOW_LATER:
|
|
|
|
splash_text_draw (widget);
|
|
|
|
break;
|
|
|
|
case SHOW_NOW:
|
|
|
|
splash_logo_draw (widget);
|
|
|
|
break;
|
|
|
|
}
|
1998-02-18 04:14:29 +08:00
|
|
|
}
|
|
|
|
|
1998-01-20 08:12:21 +08:00
|
|
|
static GtkWidget *win_initstatus = NULL;
|
|
|
|
static GtkWidget *label1 = NULL;
|
|
|
|
static GtkWidget *label2 = NULL;
|
1999-12-18 00:37:50 +08:00
|
|
|
static GtkWidget *pbar = NULL;
|
1998-01-20 08:12:21 +08:00
|
|
|
|
|
|
|
static void
|
1999-09-28 01:58:10 +08:00
|
|
|
destroy_initialization_status_window (void)
|
1998-01-20 08:12:21 +08:00
|
|
|
{
|
1999-03-07 20:56:03 +08:00
|
|
|
if (win_initstatus)
|
1998-01-20 08:12:21 +08:00
|
|
|
{
|
1999-12-18 00:37:50 +08:00
|
|
|
gtk_widget_destroy (win_initstatus);
|
1998-05-18 11:07:43 +08:00
|
|
|
if (logo_pixmap != NULL)
|
1999-12-18 00:37:50 +08:00
|
|
|
gdk_pixmap_unref (logo_pixmap);
|
|
|
|
|
1998-05-18 05:05:24 +08:00
|
|
|
win_initstatus = label1 = label2 = pbar = logo_area = NULL;
|
|
|
|
logo_pixmap = NULL;
|
1998-01-20 08:12:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-09-28 01:58:10 +08:00
|
|
|
make_initialization_status_window (void)
|
1998-01-20 08:12:21 +08:00
|
|
|
{
|
2000-08-10 01:04:16 +08:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *logo_hbox;
|
|
|
|
GtkStyle *style;
|
1999-12-18 00:37:50 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
if (no_interface || no_splash)
|
|
|
|
return;
|
1999-12-18 00:37:50 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
win_initstatus = gtk_window_new (GTK_WINDOW_DIALOG);
|
1998-02-18 04:14:29 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
gtk_window_set_title (GTK_WINDOW (win_initstatus), _("GIMP Startup"));
|
|
|
|
gtk_window_set_wmclass (GTK_WINDOW (win_initstatus), "gimp_startup", "Gimp");
|
|
|
|
gtk_window_set_position (GTK_WINDOW (win_initstatus), GTK_WIN_POS_CENTER);
|
|
|
|
gtk_window_set_policy (GTK_WINDOW (win_initstatus), FALSE, FALSE, FALSE);
|
2000-02-10 08:00:54 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
gimp_dialog_set_icon (GTK_WINDOW (win_initstatus));
|
1999-12-18 00:37:50 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
if (no_splash_image == FALSE &&
|
|
|
|
splash_logo_load_size (win_initstatus))
|
|
|
|
{
|
|
|
|
show_logo = SHOW_LATER;
|
|
|
|
}
|
1999-12-18 00:37:50 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_add (GTK_CONTAINER (win_initstatus), vbox);
|
1999-12-18 00:37:50 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
logo_hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), logo_hbox, FALSE, TRUE, 0);
|
1999-12-18 00:37:50 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
logo_area = gtk_drawing_area_new ();
|
1999-12-18 00:37:50 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (logo_area), "expose_event",
|
|
|
|
GTK_SIGNAL_FUNC (splash_logo_expose),
|
|
|
|
NULL);
|
1999-12-18 00:37:50 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
logo_area_width = MAX (logo_width, LOGO_WIDTH_MIN);
|
|
|
|
logo_area_height = MAX (logo_height, LOGO_HEIGHT_MIN);
|
1999-12-18 00:37:50 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
gtk_drawing_area_size (GTK_DRAWING_AREA (logo_area),
|
|
|
|
logo_area_width, logo_area_height);
|
|
|
|
gtk_box_pack_start (GTK_BOX(logo_hbox), logo_area, TRUE, FALSE, 0);
|
1999-12-18 00:37:50 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
label1 = gtk_label_new ("");
|
|
|
|
gtk_box_pack_start_defaults (GTK_BOX (vbox), label1);
|
|
|
|
label2 = gtk_label_new ("");
|
|
|
|
gtk_box_pack_start_defaults (GTK_BOX (vbox), label2);
|
1999-12-18 00:37:50 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
pbar = gtk_progress_bar_new ();
|
|
|
|
gtk_box_pack_start_defaults (GTK_BOX (vbox), pbar);
|
1999-12-18 00:37:50 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
gtk_widget_show (vbox);
|
|
|
|
gtk_widget_show (logo_hbox);
|
|
|
|
gtk_widget_show (logo_area);
|
|
|
|
gtk_widget_show (label1);
|
|
|
|
gtk_widget_show (label2);
|
|
|
|
gtk_widget_show (pbar);
|
1999-12-18 00:37:50 +08:00
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
gtk_widget_show (win_initstatus);
|
|
|
|
|
|
|
|
/* This is a hack: we try to compute a good guess for the maximum
|
|
|
|
* number of charcters that will fit into the splash-screen using
|
|
|
|
* the default_font
|
|
|
|
*/
|
|
|
|
style = gtk_widget_get_style (win_initstatus);
|
|
|
|
max_label_length = (0.8 * (gfloat) strlen (AUTHORS) *
|
|
|
|
((gfloat) logo_area_width /
|
|
|
|
(gfloat) gdk_string_width (style->font, AUTHORS)));
|
1998-01-20 08:12:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-12-18 00:37:50 +08:00
|
|
|
app_init_update_status (gchar *label1val,
|
|
|
|
gchar *label2val,
|
1999-09-28 01:58:10 +08:00
|
|
|
float pct_progress)
|
1998-01-20 08:12:21 +08:00
|
|
|
{
|
1999-12-18 00:37:50 +08:00
|
|
|
gchar *temp;
|
1998-04-19 20:19:24 +08:00
|
|
|
|
1999-12-18 00:37:50 +08:00
|
|
|
if (!no_interface && !no_splash && win_initstatus)
|
1998-01-20 08:12:21 +08:00
|
|
|
{
|
1999-05-01 05:11:27 +08:00
|
|
|
if (label1val && strcmp (label1val, GTK_LABEL (label1)->label))
|
2000-08-28 08:42:32 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (label1), label1val);
|
1999-05-01 05:11:27 +08:00
|
|
|
|
|
|
|
if (label2val && strcmp (label2val, GTK_LABEL (label2)->label))
|
1998-01-20 08:12:21 +08:00
|
|
|
{
|
1999-05-01 05:11:27 +08:00
|
|
|
while (strlen (label2val) > max_label_length)
|
1998-04-19 20:19:24 +08:00
|
|
|
{
|
1999-02-21 07:20:54 +08:00
|
|
|
temp = strchr (label2val, G_DIR_SEPARATOR);
|
1998-04-19 20:19:24 +08:00
|
|
|
if (temp == NULL) /* for sanity */
|
|
|
|
break;
|
|
|
|
temp++;
|
|
|
|
label2val = temp;
|
|
|
|
}
|
1999-05-01 05:11:27 +08:00
|
|
|
|
1999-12-18 00:37:50 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (label2), label2val);
|
1998-01-20 08:12:21 +08:00
|
|
|
}
|
1999-05-01 05:11:27 +08:00
|
|
|
|
1998-08-12 04:45:57 +08:00
|
|
|
if (pct_progress >= 0.0 && pct_progress <= 1.0 &&
|
|
|
|
gtk_progress_get_current_percentage (&(GTK_PROGRESS_BAR (pbar)->progress)) != pct_progress)
|
1998-07-20 23:07:13 +08:00
|
|
|
/*
|
|
|
|
GTK_PROGRESS_BAR(pbar)->percentage != pct_progress)
|
|
|
|
*/
|
1998-01-20 08:12:21 +08:00
|
|
|
{
|
1998-08-12 04:45:57 +08:00
|
|
|
gtk_progress_bar_update (GTK_PROGRESS_BAR (pbar), pct_progress);
|
1998-01-20 08:12:21 +08:00
|
|
|
}
|
1999-05-01 05:11:27 +08:00
|
|
|
|
|
|
|
while (gtk_events_pending ())
|
|
|
|
gtk_main_iteration ();
|
|
|
|
|
1998-08-31 04:44:25 +08:00
|
|
|
/* We sync here to make sure things get drawn before continuing,
|
|
|
|
* is the improved look worth the time? I'm not sure...
|
|
|
|
*/
|
1999-05-01 05:11:27 +08:00
|
|
|
gdk_flush ();
|
1998-01-20 08:12:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* #define RESET_BAR() app_init_update_status("", "", 0) */
|
|
|
|
#define RESET_BAR()
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
void
|
1998-05-12 17:53:24 +08:00
|
|
|
app_init (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-03-07 20:56:03 +08:00
|
|
|
gchar *filename;
|
|
|
|
gchar *path;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-11-04 06:59:50 +08:00
|
|
|
/* parse the systemwide gtkrc */
|
1999-03-07 20:56:03 +08:00
|
|
|
filename = gimp_gtkrc ();
|
1998-04-30 13:30:28 +08:00
|
|
|
|
2000-08-15 23:42:14 +08:00
|
|
|
if (be_verbose)
|
1999-03-07 20:56:03 +08:00
|
|
|
g_print (_("parsing \"%s\"\n"), filename);
|
1998-04-30 13:30:28 +08:00
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
gtk_rc_parse (filename);
|
1998-04-30 13:30:28 +08:00
|
|
|
|
2000-11-04 06:59:50 +08:00
|
|
|
/* parse the user gtkrc */
|
|
|
|
filename = gimp_personal_rc_file ("gtkrc");
|
|
|
|
|
|
|
|
if (be_verbose)
|
|
|
|
g_print (_("parsing \"%s\"\n"), filename);
|
|
|
|
|
|
|
|
gtk_rc_parse (filename);
|
|
|
|
|
2000-11-08 07:12:03 +08:00
|
|
|
g_free (filename);
|
|
|
|
|
2000-05-01 02:17:55 +08:00
|
|
|
if (parse_buffers_init ())
|
|
|
|
{
|
|
|
|
parse_unitrc (); /* this needs to be done before gimprc loading */
|
|
|
|
parse_gimprc (); /* parse the local GIMP configuration file */
|
|
|
|
}
|
|
|
|
|
1999-12-18 00:37:50 +08:00
|
|
|
if (!no_interface)
|
1999-06-19 02:29:27 +08:00
|
|
|
get_standard_colormaps ();
|
1999-05-01 05:11:27 +08:00
|
|
|
|
1999-06-19 02:29:27 +08:00
|
|
|
make_initialization_status_window ();
|
1999-05-01 05:11:27 +08:00
|
|
|
|
1999-12-18 00:37:50 +08:00
|
|
|
if (!no_interface && !no_splash && win_initstatus)
|
1998-02-18 04:14:29 +08:00
|
|
|
splash_text_draw (logo_area);
|
1998-07-02 07:06:49 +08:00
|
|
|
|
|
|
|
/* Create the context of all existing images */
|
1999-05-01 05:11:27 +08:00
|
|
|
image_context = gimp_set_new (GIMP_TYPE_IMAGE, TRUE);
|
1998-07-20 23:07:13 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
/* Initialize the context system before loading any data */
|
|
|
|
context_manager_init ();
|
|
|
|
|
1999-06-19 02:29:27 +08:00
|
|
|
/* Initialize the procedural database
|
1997-11-25 06:05:25 +08:00
|
|
|
* We need to do this first because any of the init
|
|
|
|
* procedures might install or query it as needed.
|
|
|
|
*/
|
|
|
|
procedural_db_init ();
|
1998-01-20 08:12:21 +08:00
|
|
|
RESET_BAR();
|
1997-11-25 06:05:25 +08:00
|
|
|
internal_procs_init ();
|
|
|
|
|
2000-12-25 04:27:04 +08:00
|
|
|
#ifdef DISPLAY_FILTERS
|
1999-10-05 03:26:07 +08:00
|
|
|
color_display_init ();
|
2000-12-25 04:27:04 +08:00
|
|
|
#endif /* DISPLAY_FILTERS */
|
1999-07-29 07:00:08 +08:00
|
|
|
|
1998-02-18 04:14:29 +08:00
|
|
|
RESET_BAR();
|
1998-07-12 06:23:23 +08:00
|
|
|
if (always_restore_session)
|
|
|
|
restore_session = TRUE;
|
1998-02-18 04:14:29 +08:00
|
|
|
|
1998-12-06 05:48:37 +08:00
|
|
|
/* make sure the monitor resolution is valid */
|
1999-05-23 01:56:35 +08:00
|
|
|
if (monitor_xres < GIMP_MIN_RESOLUTION ||
|
|
|
|
monitor_yres < GIMP_MIN_RESOLUTION)
|
1999-05-01 05:11:27 +08:00
|
|
|
{
|
1999-05-23 01:56:35 +08:00
|
|
|
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
|
1999-05-01 05:11:27 +08:00
|
|
|
using_xserver_resolution = TRUE;
|
|
|
|
}
|
1998-12-06 05:48:37 +08:00
|
|
|
|
1998-02-18 04:14:29 +08:00
|
|
|
/* Now we are ready to draw the splash-screen-image to the start-up window */
|
|
|
|
if (no_interface == FALSE)
|
|
|
|
{
|
1999-05-01 05:11:27 +08:00
|
|
|
if (no_splash_image == FALSE && show_logo &&
|
|
|
|
splash_logo_load (win_initstatus))
|
|
|
|
{
|
|
|
|
show_logo = SHOW_NOW;
|
|
|
|
splash_logo_draw (logo_area);
|
|
|
|
}
|
1998-02-18 04:14:29 +08:00
|
|
|
}
|
|
|
|
|
1998-01-20 08:12:21 +08:00
|
|
|
RESET_BAR();
|
1997-11-25 06:05:25 +08:00
|
|
|
file_ops_pre_init (); /* pre-initialize the file types */
|
1998-01-20 08:12:21 +08:00
|
|
|
RESET_BAR();
|
1997-11-25 06:05:25 +08:00
|
|
|
xcf_init (); /* initialize the xcf file format routines */
|
1998-03-27 02:24:42 +08:00
|
|
|
|
1999-04-09 14:00:11 +08:00
|
|
|
app_init_update_status (_("Looking for data files"), _("Parasites"), 0.00);
|
1999-10-27 02:27:27 +08:00
|
|
|
gimp_init_parasites (); /* initialize the global parasite table */
|
1999-04-09 14:00:11 +08:00
|
|
|
app_init_update_status (NULL, _("Brushes"), 0.20);
|
1999-10-27 02:27:27 +08:00
|
|
|
brushes_init (no_data); /* initialize the list of gimp brushes */
|
1999-04-09 14:00:11 +08:00
|
|
|
app_init_update_status (NULL, _("Patterns"), 0.40);
|
1999-10-27 02:27:27 +08:00
|
|
|
patterns_init (no_data); /* initialize the list of gimp patterns */
|
1999-04-09 14:00:11 +08:00
|
|
|
app_init_update_status (NULL, _("Palettes"), 0.60);
|
1999-10-27 02:27:27 +08:00
|
|
|
palettes_init (no_data); /* initialize the list of gimp palettes */
|
1999-04-09 14:00:11 +08:00
|
|
|
app_init_update_status (NULL, _("Gradients"), 0.80);
|
1999-10-27 02:27:27 +08:00
|
|
|
gradients_init (no_data); /* initialize the list of gimp gradients */
|
1998-04-15 03:24:23 +08:00
|
|
|
app_init_update_status (NULL, NULL, 1.00);
|
1998-03-27 02:24:42 +08:00
|
|
|
|
1999-11-20 20:12:41 +08:00
|
|
|
plug_in_init (); /* initialize the plug in structures */
|
|
|
|
module_db_init (); /* load any modules we need */
|
1998-01-20 08:12:21 +08:00
|
|
|
RESET_BAR();
|
1999-11-20 20:12:41 +08:00
|
|
|
file_ops_post_init (); /* post-initialize the file types */
|
|
|
|
|
|
|
|
menus_reorder_plugins (); /* beautify some menus */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Add the swap file */
|
|
|
|
if (swap_path == NULL)
|
1999-03-07 20:56:03 +08:00
|
|
|
swap_path = g_get_tmp_dir ();
|
|
|
|
|
1999-02-07 18:45:56 +08:00
|
|
|
toast_old_temp_files ();
|
1999-03-07 20:56:03 +08:00
|
|
|
path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "gimpswap.%lu",
|
|
|
|
swap_path, (unsigned long) getpid ());
|
1997-11-25 06:05:25 +08:00
|
|
|
tile_swap_add (path, NULL, NULL);
|
|
|
|
g_free (path);
|
|
|
|
|
1999-05-01 05:11:27 +08:00
|
|
|
destroy_initialization_status_window ();
|
1998-01-20 08:12:21 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Things to do only if there is an interface */
|
|
|
|
if (no_interface == FALSE)
|
|
|
|
{
|
1998-06-06 11:49:01 +08:00
|
|
|
devices_init ();
|
1998-06-23 01:30:40 +08:00
|
|
|
session_init ();
|
1997-11-25 06:05:25 +08:00
|
|
|
create_toolbox ();
|
1999-05-07 22:21:38 +08:00
|
|
|
|
|
|
|
/* Fill the "last opened" menu items with the first last_opened_size
|
|
|
|
* elements of the docindex
|
|
|
|
*/
|
|
|
|
{
|
2000-05-05 22:53:38 +08:00
|
|
|
FILE *fp;
|
1999-12-18 00:37:50 +08:00
|
|
|
gchar **filenames = g_new (gchar *, last_opened_size);
|
2000-05-05 22:53:38 +08:00
|
|
|
gint i;
|
1999-05-07 22:21:38 +08:00
|
|
|
|
2000-05-08 01:47:24 +08:00
|
|
|
if ((fp = document_index_parse_init ()))
|
1999-05-07 22:21:38 +08:00
|
|
|
{
|
|
|
|
/* read the filenames... */
|
|
|
|
for (i = 0; i < last_opened_size; i++)
|
2000-05-08 01:47:24 +08:00
|
|
|
if ((filenames[i] = document_index_parse_line (fp)) == NULL)
|
1999-05-07 22:21:38 +08:00
|
|
|
break;
|
1999-12-18 00:37:50 +08:00
|
|
|
|
1999-05-07 22:21:38 +08:00
|
|
|
/* ...and add them in reverse order */
|
|
|
|
for (--i; i >= 0; i--)
|
|
|
|
{
|
|
|
|
menus_last_opened_add (filenames[i]);
|
|
|
|
g_free (filenames[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose (fp);
|
|
|
|
}
|
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
|
|
|
g_free (filenames);
|
1999-05-07 22:21:38 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gximage_init ();
|
|
|
|
render_setup (transparency_type, transparency_size);
|
1999-10-30 18:39:48 +08:00
|
|
|
tool_options_dialog_new ();
|
1999-10-27 02:27:27 +08:00
|
|
|
|
|
|
|
/* EEK: force signal emission */
|
|
|
|
if (gimp_context_get_tool (gimp_context_get_user ()) == RECT_SELECT)
|
|
|
|
{
|
2000-02-23 01:06:44 +08:00
|
|
|
gimp_context_tool_changed (gimp_context_get_user ());
|
1999-10-27 02:27:27 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_context_set_tool (gimp_context_get_user (), RECT_SELECT);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: This needs to go in preferences */
|
1998-06-20 07:45:54 +08:00
|
|
|
message_handler = MESSAGE_BOX;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
color_transfer_init ();
|
|
|
|
paint_funcs_setup ();
|
1998-01-20 08:12:21 +08:00
|
|
|
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
/* register internal color selectors */
|
|
|
|
color_select_init ();
|
|
|
|
|
1998-07-12 06:23:23 +08:00
|
|
|
if (no_interface == FALSE)
|
1998-08-13 23:25:41 +08:00
|
|
|
{
|
1999-10-27 02:27:27 +08:00
|
|
|
devices_restore ();
|
1999-05-01 05:11:27 +08:00
|
|
|
session_restore ();
|
1998-08-13 23:25:41 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1998-02-28 00:55:59 +08:00
|
|
|
int
|
1998-02-05 13:41:05 +08:00
|
|
|
app_exit_finish_done (void)
|
|
|
|
{
|
|
|
|
return is_app_exit_finish_done;
|
|
|
|
}
|
|
|
|
|
1998-02-04 06:54:35 +08:00
|
|
|
void
|
1998-05-12 17:53:24 +08:00
|
|
|
app_exit_finish (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1998-02-05 13:41:05 +08:00
|
|
|
if (app_exit_finish_done ())
|
|
|
|
return;
|
|
|
|
is_app_exit_finish_done = TRUE;
|
1998-02-04 06:54:35 +08:00
|
|
|
|
1998-06-20 07:45:54 +08:00
|
|
|
message_handler = CONSOLE;
|
1998-07-12 06:23:23 +08:00
|
|
|
we_are_exiting = TRUE;
|
1998-05-30 15:32:37 +08:00
|
|
|
|
1999-09-03 01:27:28 +08:00
|
|
|
/* do this here before brushes and patterns are freed */
|
|
|
|
if (!no_interface)
|
|
|
|
device_status_free ();
|
|
|
|
|
1999-04-15 03:51:49 +08:00
|
|
|
module_db_free ();
|
1997-11-25 06:05:25 +08:00
|
|
|
lc_dialog_free ();
|
|
|
|
gdisplays_delete ();
|
|
|
|
global_edit_free ();
|
|
|
|
named_buffers_free ();
|
|
|
|
swapping_free ();
|
1999-10-27 02:27:27 +08:00
|
|
|
brush_dialog_free ();
|
1997-11-25 06:05:25 +08:00
|
|
|
brushes_free ();
|
1999-10-27 02:27:27 +08:00
|
|
|
pattern_dialog_free ();
|
1997-11-25 06:05:25 +08:00
|
|
|
patterns_free ();
|
1999-10-27 02:27:27 +08:00
|
|
|
palette_dialog_free ();
|
1997-11-25 06:05:25 +08:00
|
|
|
palettes_free ();
|
1999-10-28 23:05:49 +08:00
|
|
|
gradient_dialog_free ();
|
1999-10-27 02:27:27 +08:00
|
|
|
gradients_free ();
|
|
|
|
context_manager_free ();
|
1997-11-25 06:05:25 +08:00
|
|
|
hue_saturation_free ();
|
|
|
|
curves_free ();
|
|
|
|
levels_free ();
|
|
|
|
paint_funcs_free ();
|
|
|
|
plug_in_kill ();
|
1998-07-08 06:42:35 +08:00
|
|
|
procedural_db_free ();
|
1998-08-03 03:05:02 +08:00
|
|
|
error_console_free ();
|
1997-11-25 06:05:25 +08:00
|
|
|
menus_quit ();
|
|
|
|
tile_swap_exit ();
|
1999-03-17 04:14:07 +08:00
|
|
|
save_unitrc ();
|
1999-04-09 14:00:11 +08:00
|
|
|
gimp_parasiterc_save ();
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Things to do only if there is an interface */
|
1999-09-03 01:27:28 +08:00
|
|
|
if (!no_interface)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-05-18 08:18:45 +08:00
|
|
|
toolbox_free ();
|
2000-05-07 00:35:21 +08:00
|
|
|
document_index_free ();
|
1997-11-25 06:05:25 +08:00
|
|
|
gximage_free ();
|
|
|
|
render_free ();
|
1999-10-30 18:39:48 +08:00
|
|
|
tool_options_dialog_free ();
|
1999-03-14 20:30:45 +08:00
|
|
|
save_sessionrc ();
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
1998-06-23 01:30:40 +08:00
|
|
|
|
2000-03-26 02:49:05 +08:00
|
|
|
/* There used to be gtk_main_quit() here, but there's a chance
|
|
|
|
* that gtk_main() was never called before we reach this point. --Sven
|
|
|
|
*/
|
|
|
|
gtk_exit (0);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
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
|
|
|
app_exit (gboolean kill_it)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
/* If it's the user's perogative, and there are dirty images */
|
1999-12-18 00:37:50 +08:00
|
|
|
if (!kill_it && gdisplays_dirty () && !no_interface)
|
1997-11-25 06:05:25 +08:00
|
|
|
really_quit_dialog ();
|
1998-02-05 13:41:05 +08:00
|
|
|
else
|
|
|
|
app_exit_finish ();
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-12-18 00:37:50 +08:00
|
|
|
/*************************************************
|
|
|
|
* Routines to query exiting the application *
|
|
|
|
*************************************************/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static void
|
2000-02-12 23:01:33 +08:00
|
|
|
really_quit_callback (GtkWidget *button,
|
2000-02-11 07:47:56 +08:00
|
|
|
gboolean quit,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-02-11 07:47:56 +08:00
|
|
|
if (quit)
|
|
|
|
{
|
|
|
|
app_exit_finish ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
menus_set_sensitive ("<Toolbox>/File/Quit", TRUE);
|
|
|
|
menus_set_sensitive ("<Image>/File/Quit", TRUE);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-05-01 05:11:27 +08:00
|
|
|
really_quit_dialog (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
1999-11-24 03:11:29 +08:00
|
|
|
menus_set_sensitive ("<Toolbox>/File/Quit", FALSE);
|
|
|
|
menus_set_sensitive ("<Image>/File/Quit", FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-11 07:47:56 +08:00
|
|
|
dialog = gimp_query_boolean_box (_("Really Quit?"),
|
|
|
|
gimp_standard_help_func,
|
|
|
|
"dialogs/really_quit.html",
|
|
|
|
TRUE,
|
|
|
|
_("Some files unsaved.\n\nQuit the GIMP?"),
|
|
|
|
_("Quit"), _("Cancel"),
|
|
|
|
NULL, NULL,
|
|
|
|
really_quit_callback,
|
|
|
|
NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
gtk_widget_show (dialog);
|
|
|
|
}
|
|
|
|
|
1999-02-07 18:45:56 +08:00
|
|
|
static void
|
|
|
|
toast_old_temp_files (void)
|
|
|
|
{
|
|
|
|
DIR *dir;
|
|
|
|
struct dirent *entry;
|
|
|
|
GString *filename = g_string_new ("");
|
1998-07-21 08:15:24 +08:00
|
|
|
|
1999-02-07 18:45:56 +08:00
|
|
|
dir = opendir (swap_path);
|
1999-12-18 00:37:50 +08:00
|
|
|
|
1999-02-07 18:45:56 +08:00
|
|
|
if (!dir)
|
|
|
|
return;
|
1999-12-18 00:37:50 +08:00
|
|
|
|
1999-02-07 18:45:56 +08:00
|
|
|
while ((entry = readdir (dir)) != NULL)
|
|
|
|
if (!strncmp (entry->d_name, "gimpswap.", 9))
|
|
|
|
{
|
|
|
|
/* don't try to kill swap files of running processes
|
|
|
|
* yes, I know they might not all be gimp processes, and when you
|
|
|
|
* unlink, it's refcounted, but lets not confuse the user by
|
|
|
|
* "where did my disk space go?" cause the filename is gone
|
|
|
|
* if the kill succeeds, and there running process isn't gimp
|
|
|
|
* we'll probably get it the next time around
|
|
|
|
*/
|
|
|
|
|
1999-12-18 00:37:50 +08:00
|
|
|
gint pid = atoi (entry->d_name + 9);
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifndef G_OS_WIN32
|
1999-02-07 18:45:56 +08:00
|
|
|
if (kill (pid, 0))
|
1999-02-21 07:20:54 +08:00
|
|
|
#endif
|
1999-02-07 18:45:56 +08:00
|
|
|
{
|
1999-12-18 00:37:50 +08:00
|
|
|
/* On Windows, you can't remove open files anyhow,
|
|
|
|
* so no harm trying.
|
|
|
|
*/
|
1999-02-21 07:20:54 +08:00
|
|
|
g_string_sprintf (filename, "%s" G_DIR_SEPARATOR_S "%s",
|
|
|
|
swap_path, entry->d_name);
|
1999-02-07 18:45:56 +08:00
|
|
|
unlink (filename->str);
|
|
|
|
}
|
|
|
|
}
|
1998-07-21 08:15:24 +08:00
|
|
|
|
1999-02-07 18:45:56 +08:00
|
|
|
closedir (dir);
|
|
|
|
|
|
|
|
g_string_free (filename, TRUE);
|
|
|
|
}
|