2006-12-09 21:33:38 +00:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2002-03-29 03:50:29 +00:00
|
|
|
* Copyright (C) 1995-2002 Spencer Kimball, Peter Mattis, and others
|
2001-07-04 19:31:35 +00:00
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-07-04 19:31:35 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 22:28:01 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-07-04 19:31:35 +00:00
|
|
|
* (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
|
2018-07-11 23:27:07 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2001-07-04 19:31:35 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2001-07-22 22:18:01 +00:00
|
|
|
#include <string.h> /* strlen */
|
|
|
|
|
2013-10-15 01:58:39 +02:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
2008-10-09 20:24:04 +00:00
|
|
|
#include <gegl.h>
|
2001-07-04 19:31:35 +00:00
|
|
|
|
2001-07-05 16:21:36 +00:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2019-08-12 19:26:08 +02:00
|
|
|
#include "libgimpbase/gimpbase-private.h"
|
2005-01-25 19:11:26 +00:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2001-07-05 16:21:36 +00:00
|
|
|
|
2002-05-03 12:45:22 +00:00
|
|
|
#include "core-types.h"
|
2001-07-04 19:31:35 +00:00
|
|
|
|
2002-11-18 20:50:31 +00:00
|
|
|
#include "config/gimprc.h"
|
|
|
|
|
2016-11-11 01:06:14 +01:00
|
|
|
#include "gegl/gimp-babl.h"
|
2016-11-11 00:48:30 +01:00
|
|
|
|
2006-08-05 18:27:56 +00:00
|
|
|
#include "pdb/gimppdb.h"
|
|
|
|
#include "pdb/gimp-pdb-compat.h"
|
2008-04-04 11:36:54 +00:00
|
|
|
#include "pdb/internal-procs.h"
|
2001-07-04 19:31:35 +00:00
|
|
|
|
2006-04-28 22:26:51 +00:00
|
|
|
#include "plug-in/gimppluginmanager.h"
|
2007-04-18 15:06:05 +00:00
|
|
|
#include "plug-in/gimppluginmanager-restore.h"
|
2003-10-02 11:26:26 +00:00
|
|
|
|
2003-09-18 13:51:10 +00:00
|
|
|
#include "paint/gimp-paint.h"
|
2002-02-26 02:00:02 +00:00
|
|
|
|
2001-10-18 17:27:36 +00:00
|
|
|
#include "xcf/xcf.h"
|
2019-02-11 12:45:06 +01:00
|
|
|
#include "file-data/file-data.h"
|
2001-10-18 17:27:36 +00:00
|
|
|
|
2001-07-04 19:31:35 +00:00
|
|
|
#include "gimp.h"
|
2005-09-04 10:44:04 +00:00
|
|
|
#include "gimp-contexts.h"
|
2016-09-12 02:48:39 +02:00
|
|
|
#include "gimp-data-factories.h"
|
2015-12-30 11:53:52 +01:00
|
|
|
#include "gimp-filter-history.h"
|
2014-08-12 13:57:57 +02:00
|
|
|
#include "gimp-memsize.h"
|
2003-09-15 17:26:28 +00:00
|
|
|
#include "gimp-modules.h"
|
2002-05-15 11:05:32 +00:00
|
|
|
#include "gimp-parasites.h"
|
2003-04-03 17:50:56 +00:00
|
|
|
#include "gimp-templates.h"
|
2003-09-15 17:26:28 +00:00
|
|
|
#include "gimp-units.h"
|
2003-11-25 12:53:29 +00:00
|
|
|
#include "gimp-utils.h"
|
2008-12-04 21:58:45 +00:00
|
|
|
#include "gimpbrush.h"
|
2001-07-04 19:31:35 +00:00
|
|
|
#include "gimpbuffer.h"
|
2001-07-07 12:17:23 +00:00
|
|
|
#include "gimpcontext.h"
|
2009-10-11 00:08:24 +02:00
|
|
|
#include "gimpdynamics.h"
|
2002-05-15 11:05:32 +00:00
|
|
|
#include "gimpdocumentlist.h"
|
2018-07-01 09:10:54 +02:00
|
|
|
#include "gimpextensionmanager.h"
|
2008-12-04 21:58:45 +00:00
|
|
|
#include "gimpgradient.h"
|
2011-05-04 22:14:13 +02:00
|
|
|
#include "gimpidtable.h"
|
2001-07-04 19:31:35 +00:00
|
|
|
#include "gimpimage.h"
|
2001-08-10 14:41:39 +00:00
|
|
|
#include "gimpimagefile.h"
|
2001-07-04 19:31:35 +00:00
|
|
|
#include "gimplist.h"
|
2002-12-05 15:49:59 +00:00
|
|
|
#include "gimpmarshal.h"
|
2015-12-20 23:48:40 +01:00
|
|
|
#include "gimpmybrush.h"
|
2008-12-04 21:58:45 +00:00
|
|
|
#include "gimppalette.h"
|
|
|
|
#include "gimpparasitelist.h"
|
|
|
|
#include "gimppattern.h"
|
2003-04-03 17:50:56 +00:00
|
|
|
#include "gimptemplate.h"
|
2001-07-04 19:31:35 +00:00
|
|
|
#include "gimptoolinfo.h"
|
|
|
|
|
2003-03-25 16:38:19 +00:00
|
|
|
#include "gimp-intl.h"
|
2001-07-04 19:31:35 +00:00
|
|
|
|
|
|
|
|
2019-08-12 19:26:08 +02:00
|
|
|
/* we need to register all enum types so they are known to the type
|
|
|
|
* system by name, re-use the files the pdb generated for libgimp
|
|
|
|
*/
|
|
|
|
void gimp_enums_init (void);
|
|
|
|
const gchar ** gimp_enums_get_type_names (gint *n_type_names);
|
|
|
|
#include "libgimp/gimpenums.c.tail"
|
|
|
|
|
|
|
|
|
2002-12-05 15:49:59 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-10-02 11:26:26 +00:00
|
|
|
INITIALIZE,
|
|
|
|
RESTORE,
|
2002-12-05 15:49:59 +00:00
|
|
|
EXIT,
|
2016-09-17 17:39:54 +02:00
|
|
|
CLIPBOARD_CHANGED,
|
2015-12-30 11:53:52 +01:00
|
|
|
FILTER_HISTORY_CHANGED,
|
2008-10-17 12:03:08 +00:00
|
|
|
IMAGE_OPENED,
|
2002-12-05 15:49:59 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2014-07-15 00:09:15 +02:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_VERBOSE
|
|
|
|
};
|
2002-12-05 15:49:59 +00:00
|
|
|
|
2014-07-15 00:09:15 +02:00
|
|
|
|
|
|
|
static void gimp_constructed (GObject *object);
|
|
|
|
static void gimp_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2007-04-18 15:06:05 +00:00
|
|
|
static void gimp_dispose (GObject *object);
|
|
|
|
static void gimp_finalize (GObject *object);
|
2002-01-30 16:14:26 +00:00
|
|
|
|
2007-04-18 15:06:05 +00:00
|
|
|
static gint64 gimp_get_memsize (GimpObject *object,
|
|
|
|
gint64 *gui_size);
|
2002-11-30 13:08:44 +00:00
|
|
|
|
2007-04-18 15:06:05 +00:00
|
|
|
static void gimp_real_initialize (Gimp *gimp,
|
|
|
|
GimpInitStatusFunc status_callback);
|
|
|
|
static void gimp_real_restore (Gimp *gimp,
|
|
|
|
GimpInitStatusFunc status_callback);
|
|
|
|
static gboolean gimp_real_exit (Gimp *gimp,
|
|
|
|
gboolean force);
|
2002-12-05 15:49:59 +00:00
|
|
|
|
2007-04-18 15:06:05 +00:00
|
|
|
static void gimp_global_config_notify (GObject *global_config,
|
|
|
|
GParamSpec *param_spec,
|
|
|
|
GObject *edit_config);
|
|
|
|
static void gimp_edit_config_notify (GObject *edit_config,
|
|
|
|
GParamSpec *param_spec,
|
|
|
|
GObject *global_config);
|
2001-07-04 19:31:35 +00:00
|
|
|
|
|
|
|
|
2006-05-15 09:46:31 +00:00
|
|
|
G_DEFINE_TYPE (Gimp, gimp, GIMP_TYPE_OBJECT)
|
2005-12-10 19:24:36 +00:00
|
|
|
|
|
|
|
#define parent_class gimp_parent_class
|
2001-07-04 19:31:35 +00:00
|
|
|
|
2002-12-05 15:49:59 +00:00
|
|
|
static guint gimp_signals[LAST_SIGNAL] = { 0, };
|
|
|
|
|
2001-07-04 19:31:35 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_class_init (GimpClass *klass)
|
|
|
|
{
|
2004-06-17 16:32:30 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
2001-07-04 19:31:35 +00:00
|
|
|
|
2003-10-02 11:26:26 +00:00
|
|
|
gimp_signals[INITIALIZE] =
|
|
|
|
g_signal_new ("initialize",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GimpClass, initialize),
|
app/core: Use NULL for "simple" signals
Apart from being less code, this actually gives us a nice performance
improvement. Up until a few years ago, if you pass `NULL` as the
marshaller for a signal, GLib would fall back to
`g_cclosure_marshal_generic` which uses libffi to pack/unpack its
arguments. One could avoid this by specifying a more specific
marshaller which would then be used to immediately pack and unpack into
GValues with the correct type.
Lately however, as a way of optimizing signal emission (which can be
quite expensive), GLib added a possibility to set a va_marshaller, which
skips the unnecessary GValue packing and unpacking and just uses a
valist variant.
Since the performance difference is big enough, if the marshaller
argument is NULL, `g_signal_new()` will now check for the simple
marshallers (return type NONE and a single argument) and set both the
generic and the valist marshaller. In other words, less code for us with
bigger optimizations.
In case you also want va_marshallers for more complex signals, you can
use `g_signal_set_va_marshaller()`.
2019-08-06 07:51:23 +02:00
|
|
|
NULL, NULL, NULL,
|
2003-10-02 11:26:26 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
G_TYPE_POINTER);
|
|
|
|
|
|
|
|
gimp_signals[RESTORE] =
|
|
|
|
g_signal_new ("restore",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GimpClass, restore),
|
app/core: Use NULL for "simple" signals
Apart from being less code, this actually gives us a nice performance
improvement. Up until a few years ago, if you pass `NULL` as the
marshaller for a signal, GLib would fall back to
`g_cclosure_marshal_generic` which uses libffi to pack/unpack its
arguments. One could avoid this by specifying a more specific
marshaller which would then be used to immediately pack and unpack into
GValues with the correct type.
Lately however, as a way of optimizing signal emission (which can be
quite expensive), GLib added a possibility to set a va_marshaller, which
skips the unnecessary GValue packing and unpacking and just uses a
valist variant.
Since the performance difference is big enough, if the marshaller
argument is NULL, `g_signal_new()` will now check for the simple
marshallers (return type NONE and a single argument) and set both the
generic and the valist marshaller. In other words, less code for us with
bigger optimizations.
In case you also want va_marshallers for more complex signals, you can
use `g_signal_set_va_marshaller()`.
2019-08-06 07:51:23 +02:00
|
|
|
NULL, NULL, NULL,
|
2003-11-13 14:14:20 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
G_TYPE_POINTER);
|
2003-10-02 11:26:26 +00:00
|
|
|
|
2002-12-05 15:49:59 +00:00
|
|
|
gimp_signals[EXIT] =
|
|
|
|
g_signal_new ("exit",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GimpClass, exit),
|
2007-02-17 11:45:59 +00:00
|
|
|
g_signal_accumulator_true_handled, NULL,
|
2002-12-05 15:49:59 +00:00
|
|
|
gimp_marshal_BOOLEAN__BOOLEAN,
|
|
|
|
G_TYPE_BOOLEAN, 1,
|
|
|
|
G_TYPE_BOOLEAN);
|
|
|
|
|
2016-09-17 17:39:54 +02:00
|
|
|
gimp_signals[CLIPBOARD_CHANGED] =
|
|
|
|
g_signal_new ("clipboard-changed",
|
2004-02-19 12:49:15 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
2016-09-17 17:39:54 +02:00
|
|
|
G_STRUCT_OFFSET (GimpClass, clipboard_changed),
|
app/core: Use NULL for "simple" signals
Apart from being less code, this actually gives us a nice performance
improvement. Up until a few years ago, if you pass `NULL` as the
marshaller for a signal, GLib would fall back to
`g_cclosure_marshal_generic` which uses libffi to pack/unpack its
arguments. One could avoid this by specifying a more specific
marshaller which would then be used to immediately pack and unpack into
GValues with the correct type.
Lately however, as a way of optimizing signal emission (which can be
quite expensive), GLib added a possibility to set a va_marshaller, which
skips the unnecessary GValue packing and unpacking and just uses a
valist variant.
Since the performance difference is big enough, if the marshaller
argument is NULL, `g_signal_new()` will now check for the simple
marshallers (return type NONE and a single argument) and set both the
generic and the valist marshaller. In other words, less code for us with
bigger optimizations.
In case you also want va_marshallers for more complex signals, you can
use `g_signal_set_va_marshaller()`.
2019-08-06 07:51:23 +02:00
|
|
|
NULL, NULL, NULL,
|
2004-02-19 12:49:15 +00:00
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2015-12-30 11:53:52 +01:00
|
|
|
gimp_signals[FILTER_HISTORY_CHANGED] =
|
|
|
|
g_signal_new ("filter-history-changed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GimpClass,
|
|
|
|
filter_history_changed),
|
app/core: Use NULL for "simple" signals
Apart from being less code, this actually gives us a nice performance
improvement. Up until a few years ago, if you pass `NULL` as the
marshaller for a signal, GLib would fall back to
`g_cclosure_marshal_generic` which uses libffi to pack/unpack its
arguments. One could avoid this by specifying a more specific
marshaller which would then be used to immediately pack and unpack into
GValues with the correct type.
Lately however, as a way of optimizing signal emission (which can be
quite expensive), GLib added a possibility to set a va_marshaller, which
skips the unnecessary GValue packing and unpacking and just uses a
valist variant.
Since the performance difference is big enough, if the marshaller
argument is NULL, `g_signal_new()` will now check for the simple
marshallers (return type NONE and a single argument) and set both the
generic and the valist marshaller. In other words, less code for us with
bigger optimizations.
In case you also want va_marshallers for more complex signals, you can
use `g_signal_set_va_marshaller()`.
2019-08-06 07:51:23 +02:00
|
|
|
NULL, NULL, NULL,
|
2015-12-30 11:53:52 +01:00
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2008-10-17 12:03:08 +00:00
|
|
|
gimp_signals[IMAGE_OPENED] =
|
|
|
|
g_signal_new ("image-opened",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GimpClass, image_opened),
|
app/core: Use NULL for "simple" signals
Apart from being less code, this actually gives us a nice performance
improvement. Up until a few years ago, if you pass `NULL` as the
marshaller for a signal, GLib would fall back to
`g_cclosure_marshal_generic` which uses libffi to pack/unpack its
arguments. One could avoid this by specifying a more specific
marshaller which would then be used to immediately pack and unpack into
GValues with the correct type.
Lately however, as a way of optimizing signal emission (which can be
quite expensive), GLib added a possibility to set a va_marshaller, which
skips the unnecessary GValue packing and unpacking and just uses a
valist variant.
Since the performance difference is big enough, if the marshaller
argument is NULL, `g_signal_new()` will now check for the simple
marshallers (return type NONE and a single argument) and set both the
generic and the valist marshaller. In other words, less code for us with
bigger optimizations.
In case you also want va_marshallers for more complex signals, you can
use `g_signal_set_va_marshaller()`.
2019-08-06 07:51:23 +02:00
|
|
|
NULL, NULL, NULL,
|
2014-07-07 00:46:25 +02:00
|
|
|
G_TYPE_NONE, 1, G_TYPE_FILE);
|
2008-10-17 12:03:08 +00:00
|
|
|
|
2014-07-15 00:09:15 +02:00
|
|
|
object_class->constructed = gimp_constructed;
|
|
|
|
object_class->set_property = gimp_set_property;
|
|
|
|
object_class->get_property = gimp_get_property;
|
2002-01-30 16:14:26 +00:00
|
|
|
object_class->dispose = gimp_dispose;
|
|
|
|
object_class->finalize = gimp_finalize;
|
|
|
|
|
|
|
|
gimp_object_class->get_memsize = gimp_get_memsize;
|
2002-12-05 15:49:59 +00:00
|
|
|
|
2003-10-02 11:26:26 +00:00
|
|
|
klass->initialize = gimp_real_initialize;
|
|
|
|
klass->restore = gimp_real_restore;
|
2002-12-05 15:49:59 +00:00
|
|
|
klass->exit = gimp_real_exit;
|
2016-09-17 17:39:54 +02:00
|
|
|
klass->clipboard_changed = NULL;
|
2014-07-15 00:09:15 +02:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_VERBOSE,
|
|
|
|
g_param_spec_boolean ("verbose", NULL, NULL,
|
|
|
|
FALSE,
|
|
|
|
GIMP_PARAM_READWRITE |
|
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
2001-07-04 19:31:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_init (Gimp *gimp)
|
|
|
|
{
|
2003-09-10 22:06:45 +00:00
|
|
|
gimp->be_verbose = FALSE;
|
|
|
|
gimp->no_data = FALSE;
|
|
|
|
gimp->no_interface = FALSE;
|
2009-09-08 19:26:57 +02:00
|
|
|
gimp->show_gui = TRUE;
|
2003-09-10 22:06:45 +00:00
|
|
|
gimp->use_shm = FALSE;
|
2013-06-19 20:42:56 +02:00
|
|
|
gimp->use_cpu_accel = TRUE;
|
2003-09-10 22:06:45 +00:00
|
|
|
gimp->message_handler = GIMP_CONSOLE;
|
2014-09-14 01:08:25 +02:00
|
|
|
gimp->show_playground = FALSE;
|
2003-09-10 22:06:45 +00:00
|
|
|
gimp->stack_trace_mode = GIMP_STACK_TRACE_NEVER;
|
2003-12-05 17:08:35 +00:00
|
|
|
gimp->pdb_compat_mode = GIMP_PDB_COMPAT_OFF;
|
2003-09-10 22:06:45 +00:00
|
|
|
|
2004-07-12 11:41:19 +00:00
|
|
|
gimp_gui_init (gimp);
|
2003-09-10 22:06:45 +00:00
|
|
|
|
2014-07-15 00:22:43 +02:00
|
|
|
gimp->parasites = gimp_parasite_list_new ();
|
2001-07-04 19:31:35 +00:00
|
|
|
|
2019-08-12 19:26:08 +02:00
|
|
|
gimp_enums_init ();
|
|
|
|
|
2016-09-12 23:51:29 +02:00
|
|
|
gimp_units_init (gimp);
|
|
|
|
|
2014-07-15 00:22:43 +02:00
|
|
|
gimp->images = gimp_list_new_weak (GIMP_TYPE_IMAGE, FALSE);
|
2006-04-07 10:51:22 +00:00
|
|
|
gimp_object_set_static_name (GIMP_OBJECT (gimp->images), "images");
|
2002-01-31 18:02:38 +00:00
|
|
|
|
2019-08-23 22:23:23 +02:00
|
|
|
gimp->next_guide_id = 1;
|
|
|
|
gimp->next_sample_point_id = 1;
|
2011-05-04 22:14:13 +02:00
|
|
|
gimp->image_table = gimp_id_table_new ();
|
2014-07-15 00:22:43 +02:00
|
|
|
gimp->item_table = gimp_id_table_new ();
|
2001-07-11 12:39:49 +00:00
|
|
|
|
2014-07-15 00:22:43 +02:00
|
|
|
gimp->displays = g_object_new (GIMP_TYPE_LIST,
|
|
|
|
"children-type", GIMP_TYPE_OBJECT,
|
|
|
|
"policy", GIMP_CONTAINER_POLICY_WEAK,
|
|
|
|
"append", TRUE,
|
|
|
|
NULL);
|
2006-04-07 10:51:22 +00:00
|
|
|
gimp_object_set_static_name (GIMP_OBJECT (gimp->displays), "displays");
|
2019-08-23 22:23:23 +02:00
|
|
|
gimp->next_display_id = 1;
|
2002-05-08 17:48:24 +00:00
|
|
|
|
2014-07-15 00:22:43 +02:00
|
|
|
gimp->named_buffers = gimp_list_new (GIMP_TYPE_BUFFER, TRUE);
|
2006-04-07 10:51:22 +00:00
|
|
|
gimp_object_set_static_name (GIMP_OBJECT (gimp->named_buffers),
|
|
|
|
"named buffers");
|
2002-01-31 18:02:38 +00:00
|
|
|
|
2016-09-13 09:47:27 +02:00
|
|
|
gimp_data_factories_init (gimp);
|
|
|
|
|
2016-05-01 16:05:44 +02:00
|
|
|
gimp->tool_info_list = g_object_new (GIMP_TYPE_LIST,
|
|
|
|
"children-type", GIMP_TYPE_TOOL_INFO,
|
|
|
|
"append", TRUE,
|
|
|
|
NULL);
|
2006-04-07 10:51:22 +00:00
|
|
|
gimp_object_set_static_name (GIMP_OBJECT (gimp->tool_info_list),
|
|
|
|
"tool infos");
|
2002-01-31 18:02:38 +00:00
|
|
|
|
app: add support for tool groups in toolrc
Add a new Gimp::tool_item_list list, in addition to
Gimp::tool_info_list. The latter may contain arbitrary tool items,
including tool groups, and is intended for use in the UI (namely,
the toolbox and the preferences tool editor).
In gimp-tools, use Gimp::tool_item_list for representing the UI
tool order (while still using Gimp::tool_info_list as a flat list
of all GimpToolInfo objects), and add support for saving and
loading tool groups to/from toolrc.
Introduce file-version tracking in toolrc, and drop its contents on
version mismatch, or when new tools are introduced. This is
slightly disruptive, but merging new changes with existing toolrc
files is non-trivial, and it doesn't happen very often.
Add support for a sysconf toolrc file, which is used if there's no
user toolrc file (i.e., on first use). If neither file is found,
the hard-coded flat tool order is used. This commit doesn't
provide a default toolrc file, but the next commits will.
Make the gimp-tools serialization and deserialization functions
public, for use in GimpToolEditor in the next commits.
2020-01-29 21:02:00 +02:00
|
|
|
gimp->tool_item_list = g_object_new (GIMP_TYPE_LIST,
|
|
|
|
"children-type", GIMP_TYPE_TOOL_ITEM,
|
|
|
|
"append", TRUE,
|
|
|
|
NULL);
|
|
|
|
gimp_object_set_static_name (GIMP_OBJECT (gimp->tool_item_list),
|
|
|
|
"tool items");
|
|
|
|
|
2016-09-13 09:47:27 +02:00
|
|
|
gimp->documents = gimp_document_list_new (gimp);
|
|
|
|
|
2014-07-15 00:22:43 +02:00
|
|
|
gimp->templates = gimp_list_new (GIMP_TYPE_TEMPLATE, TRUE);
|
2006-04-07 10:51:22 +00:00
|
|
|
gimp_object_set_static_name (GIMP_OBJECT (gimp->templates), "templates");
|
2001-07-04 19:31:35 +00:00
|
|
|
}
|
|
|
|
|
2014-07-15 00:09:15 +02:00
|
|
|
static void
|
|
|
|
gimp_constructed (GObject *object)
|
|
|
|
{
|
|
|
|
Gimp *gimp = GIMP (object);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->constructed (object);
|
|
|
|
|
|
|
|
gimp_modules_init (gimp);
|
|
|
|
|
2016-09-13 09:47:27 +02:00
|
|
|
gimp_paint_init (gimp);
|
|
|
|
|
2018-07-01 09:10:54 +02:00
|
|
|
gimp->extension_manager = gimp_extension_manager_new (gimp);
|
|
|
|
gimp->plug_in_manager = gimp_plug_in_manager_new (gimp);
|
|
|
|
gimp->pdb = gimp_pdb_new (gimp);
|
2014-07-15 00:09:15 +02:00
|
|
|
|
|
|
|
xcf_init (gimp);
|
2019-02-11 12:45:06 +01:00
|
|
|
file_data_init (gimp);
|
2014-07-15 00:09:15 +02:00
|
|
|
|
2016-09-13 09:47:27 +02:00
|
|
|
/* create user and default context */
|
|
|
|
gimp_contexts_init (gimp);
|
2018-08-07 12:40:28 +02:00
|
|
|
|
|
|
|
/* Initialize the extension manager early as its contents may be used
|
|
|
|
* at the very start (e.g. the splash image).
|
|
|
|
*/
|
|
|
|
gimp_extension_manager_initialize (gimp->extension_manager);
|
2014-07-15 00:09:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
Gimp *gimp = GIMP (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_VERBOSE:
|
|
|
|
gimp->be_verbose = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
Gimp *gimp = GIMP (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_VERBOSE:
|
|
|
|
g_value_set_boolean (value, gimp->be_verbose);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-04 19:31:35 +00:00
|
|
|
static void
|
2001-08-11 21:10:44 +00:00
|
|
|
gimp_dispose (GObject *object)
|
|
|
|
{
|
2003-11-17 00:47:37 +00:00
|
|
|
Gimp *gimp = GIMP (object);
|
2001-08-11 21:10:44 +00:00
|
|
|
|
2008-12-14 19:04:05 +00:00
|
|
|
if (gimp->be_verbose)
|
|
|
|
g_print ("EXIT: %s\n", G_STRFUNC);
|
|
|
|
|
2016-09-12 02:48:39 +02:00
|
|
|
gimp_data_factories_clear (gimp);
|
2010-04-03 18:25:31 +03:00
|
|
|
|
2015-12-30 11:53:52 +01:00
|
|
|
gimp_filter_history_clear (gimp);
|
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_object (&gimp->edit_config);
|
|
|
|
g_clear_object (&gimp->config);
|
2016-09-13 12:44:10 +02:00
|
|
|
|
|
|
|
gimp_contexts_exit (gimp);
|
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_object (&gimp->image_new_last_template);
|
2016-09-13 12:44:10 +02:00
|
|
|
|
2008-12-14 19:04:05 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_finalize (GObject *object)
|
|
|
|
{
|
2014-10-06 20:35:24 +02:00
|
|
|
Gimp *gimp = GIMP (object);
|
|
|
|
GList *standards = NULL;
|
2008-12-14 19:04:05 +00:00
|
|
|
|
2003-11-17 00:47:37 +00:00
|
|
|
if (gimp->be_verbose)
|
2008-02-19 13:38:24 +00:00
|
|
|
g_print ("EXIT: %s\n", G_STRFUNC);
|
2003-11-17 00:47:37 +00:00
|
|
|
|
2014-10-06 20:35:24 +02:00
|
|
|
standards = g_list_prepend (standards,
|
|
|
|
gimp_brush_get_standard (gimp->user_context));
|
|
|
|
standards = g_list_prepend (standards,
|
|
|
|
gimp_dynamics_get_standard (gimp->user_context));
|
2015-12-20 23:48:40 +01:00
|
|
|
standards = g_list_prepend (standards,
|
|
|
|
gimp_mybrush_get_standard (gimp->user_context));
|
2014-10-06 20:35:24 +02:00
|
|
|
standards = g_list_prepend (standards,
|
|
|
|
gimp_pattern_get_standard (gimp->user_context));
|
|
|
|
standards = g_list_prepend (standards,
|
|
|
|
gimp_gradient_get_standard (gimp->user_context));
|
|
|
|
standards = g_list_prepend (standards,
|
|
|
|
gimp_palette_get_standard (gimp->user_context));
|
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_object (&gimp->templates);
|
|
|
|
g_clear_object (&gimp->documents);
|
2001-08-10 14:41:39 +00:00
|
|
|
|
2001-08-17 14:27:31 +00:00
|
|
|
gimp_tool_info_set_standard (gimp, NULL);
|
|
|
|
|
2001-07-04 19:31:35 +00:00
|
|
|
if (gimp->tool_info_list)
|
|
|
|
{
|
2010-06-24 12:57:00 +02:00
|
|
|
gimp_container_foreach (gimp->tool_info_list,
|
|
|
|
(GFunc) g_object_run_dispose, NULL);
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_object (&gimp->tool_info_list);
|
2001-07-04 19:31:35 +00:00
|
|
|
}
|
|
|
|
|
app: add support for tool groups in toolrc
Add a new Gimp::tool_item_list list, in addition to
Gimp::tool_info_list. The latter may contain arbitrary tool items,
including tool groups, and is intended for use in the UI (namely,
the toolbox and the preferences tool editor).
In gimp-tools, use Gimp::tool_item_list for representing the UI
tool order (while still using Gimp::tool_info_list as a flat list
of all GimpToolInfo objects), and add support for saving and
loading tool groups to/from toolrc.
Introduce file-version tracking in toolrc, and drop its contents on
version mismatch, or when new tools are introduced. This is
slightly disruptive, but merging new changes with existing toolrc
files is non-trivial, and it doesn't happen very often.
Add support for a sysconf toolrc file, which is used if there's no
user toolrc file (i.e., on first use). If neither file is found,
the hard-coded flat tool order is used. This commit doesn't
provide a default toolrc file, but the next commits will.
Make the gimp-tools serialization and deserialization functions
public, for use in GimpToolEditor in the next commits.
2020-01-29 21:02:00 +02:00
|
|
|
g_clear_object (&gimp->tool_item_list);
|
|
|
|
|
2019-02-11 12:45:06 +01:00
|
|
|
file_data_exit (gimp);
|
2001-10-18 17:27:36 +00:00
|
|
|
xcf_exit (gimp);
|
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_object (&gimp->pdb);
|
2001-10-29 11:47:11 +00:00
|
|
|
|
2016-09-12 02:48:39 +02:00
|
|
|
gimp_data_factories_exit (gimp);
|
2008-12-20 14:46:54 +00:00
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_object (&gimp->named_buffers);
|
|
|
|
g_clear_object (&gimp->clipboard_buffer);
|
|
|
|
g_clear_object (&gimp->clipboard_image);
|
|
|
|
g_clear_object (&gimp->displays);
|
|
|
|
g_clear_object (&gimp->item_table);
|
|
|
|
g_clear_object (&gimp->image_table);
|
|
|
|
g_clear_object (&gimp->images);
|
|
|
|
g_clear_object (&gimp->plug_in_manager);
|
2018-07-17 15:43:43 +02:00
|
|
|
g_clear_object (&gimp->extension_manager);
|
2005-02-21 02:56:29 +00:00
|
|
|
|
2002-10-23 14:55:07 +00:00
|
|
|
if (gimp->module_db)
|
2001-10-18 17:27:36 +00:00
|
|
|
gimp_modules_exit (gimp);
|
|
|
|
|
2003-09-18 13:51:10 +00:00
|
|
|
gimp_paint_exit (gimp);
|
2002-02-26 02:00:02 +00:00
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_object (&gimp->parasites);
|
|
|
|
g_clear_object (&gimp->default_folder);
|
2012-12-15 00:34:15 +01:00
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_pointer (&gimp->session_name, g_free);
|
2003-11-13 14:14:20 +00:00
|
|
|
|
2007-07-17 11:15:15 +00:00
|
|
|
if (gimp->context_list)
|
|
|
|
{
|
2014-10-06 20:35:24 +02:00
|
|
|
GList *list;
|
|
|
|
|
|
|
|
g_warning ("%s: list of contexts not empty upon exit (%d contexts left)\n",
|
|
|
|
G_STRFUNC, g_list_length (gimp->context_list));
|
|
|
|
|
|
|
|
for (list = gimp->context_list; list; list = g_list_next (list))
|
|
|
|
g_printerr ("stale context: %s\n", gimp_object_get_name (list->data));
|
|
|
|
|
2007-07-17 11:15:15 +00:00
|
|
|
g_list_free (gimp->context_list);
|
|
|
|
gimp->context_list = NULL;
|
|
|
|
}
|
|
|
|
|
2014-10-06 20:35:24 +02:00
|
|
|
g_list_foreach (standards, (GFunc) g_object_unref, NULL);
|
|
|
|
g_list_free (standards);
|
|
|
|
|
2005-01-13 13:08:00 +00:00
|
|
|
gimp_units_exit (gimp);
|
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-10 19:16:16 +00:00
|
|
|
|
2001-08-11 21:10:44 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2001-07-04 19:31:35 +00:00
|
|
|
}
|
|
|
|
|
2003-11-16 17:51:36 +00:00
|
|
|
static gint64
|
2003-08-25 10:49:33 +00:00
|
|
|
gimp_get_memsize (GimpObject *object,
|
2003-11-16 17:51:36 +00:00
|
|
|
gint64 *gui_size)
|
2002-01-30 16:14:26 +00:00
|
|
|
{
|
2004-02-19 12:49:15 +00:00
|
|
|
Gimp *gimp = GIMP (object);
|
2003-11-16 17:51:36 +00:00
|
|
|
gint64 memsize = 0;
|
2002-01-30 16:14:26 +00:00
|
|
|
|
2003-11-25 12:53:29 +00:00
|
|
|
memsize += gimp_g_list_get_memsize (gimp->user_units, 0 /* FIXME */);
|
2002-01-30 16:14:26 +00:00
|
|
|
|
2003-08-25 10:49:33 +00:00
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->parasites),
|
|
|
|
gui_size);
|
2002-10-23 14:55:07 +00:00
|
|
|
|
2006-04-15 15:15:33 +00:00
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->paint_info_list),
|
|
|
|
gui_size);
|
|
|
|
|
2002-10-23 14:55:07 +00:00
|
|
|
memsize += gimp_g_object_get_memsize (G_OBJECT (gimp->module_db));
|
2007-11-16 18:19:30 +00:00
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->plug_in_manager),
|
|
|
|
gui_size);
|
2006-02-21 11:05:43 +00:00
|
|
|
|
2015-12-30 11:53:52 +01:00
|
|
|
memsize += gimp_g_list_get_memsize_foreach (gimp->filter_history,
|
|
|
|
(GimpMemsizeFunc)
|
|
|
|
gimp_object_get_memsize,
|
|
|
|
gui_size);
|
|
|
|
|
2011-05-04 22:14:13 +02:00
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->image_table), 0);
|
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->item_table), 0);
|
2002-01-30 16:14:26 +00:00
|
|
|
|
2003-08-25 10:49:33 +00:00
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->displays), gui_size);
|
2002-05-08 17:48:24 +00:00
|
|
|
|
2016-09-19 20:13:39 +02:00
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->clipboard_image),
|
|
|
|
gui_size);
|
2016-09-17 17:39:54 +02:00
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->clipboard_buffer),
|
2007-11-16 18:19:30 +00:00
|
|
|
gui_size);
|
2016-09-19 20:13:39 +02:00
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->named_buffers),
|
|
|
|
gui_size);
|
2007-11-16 18:19:30 +00:00
|
|
|
|
2016-09-12 02:48:39 +02:00
|
|
|
memsize += gimp_data_factories_get_memsize (gimp, gui_size);
|
2008-12-20 14:46:54 +00:00
|
|
|
|
2006-04-26 09:13:47 +00:00
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->pdb), gui_size);
|
2002-01-30 16:14:26 +00:00
|
|
|
|
2007-11-16 18:19:30 +00:00
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->tool_info_list),
|
|
|
|
gui_size);
|
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->standard_tool_info),
|
|
|
|
gui_size);
|
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->documents),
|
|
|
|
gui_size);
|
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->templates),
|
|
|
|
gui_size);
|
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->image_new_last_template),
|
|
|
|
gui_size);
|
2002-01-30 16:14:26 +00:00
|
|
|
|
2003-11-25 12:53:29 +00:00
|
|
|
memsize += gimp_g_list_get_memsize (gimp->context_list, 0);
|
2002-01-30 16:14:26 +00:00
|
|
|
|
2007-11-16 18:19:30 +00:00
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->default_context),
|
|
|
|
gui_size);
|
|
|
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->user_context),
|
|
|
|
gui_size);
|
2002-01-30 16:14:26 +00:00
|
|
|
|
2003-08-25 10:49:33 +00:00
|
|
|
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
|
|
|
|
gui_size);
|
2002-01-30 16:14:26 +00:00
|
|
|
}
|
|
|
|
|
2003-10-02 11:26:26 +00:00
|
|
|
static void
|
|
|
|
gimp_real_initialize (Gimp *gimp,
|
|
|
|
GimpInitStatusFunc status_callback)
|
|
|
|
{
|
|
|
|
if (gimp->be_verbose)
|
2008-02-19 13:38:24 +00:00
|
|
|
g_print ("INIT: %s\n", G_STRFUNC);
|
2003-10-02 11:26:26 +00:00
|
|
|
|
2005-11-05 13:00:04 +00:00
|
|
|
status_callback (_("Initialization"), NULL, 0.0);
|
|
|
|
|
2016-11-11 00:48:30 +01:00
|
|
|
/* set the last values used to default values */
|
2003-10-14 15:20:59 +00:00
|
|
|
gimp->image_new_last_template =
|
|
|
|
gimp_config_duplicate (GIMP_CONFIG (gimp->config->default_image));
|
2003-10-02 11:26:26 +00:00
|
|
|
|
2016-09-12 02:48:39 +02:00
|
|
|
/* add data objects that need the user context */
|
|
|
|
gimp_data_factories_add_builtin (gimp);
|
2006-05-17 09:49:20 +00:00
|
|
|
|
2003-10-02 11:26:26 +00:00
|
|
|
/* register all internal procedures */
|
2006-05-16 11:43:55 +00:00
|
|
|
status_callback (NULL, _("Internal Procedures"), 0.2);
|
2006-08-05 18:27:56 +00:00
|
|
|
internal_procs_init (gimp->pdb);
|
|
|
|
gimp_pdb_compat_procs_register (gimp->pdb, gimp->pdb_compat_mode);
|
2003-10-02 11:26:26 +00:00
|
|
|
|
2006-04-28 22:26:51 +00:00
|
|
|
gimp_plug_in_manager_initialize (gimp->plug_in_manager, status_callback);
|
2005-11-05 13:00:04 +00:00
|
|
|
|
|
|
|
status_callback (NULL, "", 1.0);
|
2003-10-02 11:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_real_restore (Gimp *gimp,
|
2003-11-13 14:14:20 +00:00
|
|
|
GimpInitStatusFunc status_callback)
|
2003-10-02 11:26:26 +00:00
|
|
|
{
|
|
|
|
if (gimp->be_verbose)
|
2008-02-19 13:38:24 +00:00
|
|
|
g_print ("INIT: %s\n", G_STRFUNC);
|
2003-10-02 11:26:26 +00:00
|
|
|
|
2006-04-28 22:26:51 +00:00
|
|
|
gimp_plug_in_manager_restore (gimp->plug_in_manager,
|
|
|
|
gimp_get_user_context (gimp), status_callback);
|
2008-09-25 08:56:58 +00:00
|
|
|
|
2016-11-11 13:09:12 +01:00
|
|
|
/* initialize babl fishes */
|
|
|
|
status_callback (_("Initialization"), "Babl Fishes", 0.0);
|
|
|
|
gimp_babl_init_fishes (status_callback);
|
|
|
|
|
2008-09-25 08:56:58 +00:00
|
|
|
gimp->restored = TRUE;
|
2003-10-02 11:26:26 +00:00
|
|
|
}
|
|
|
|
|
2002-12-05 15:49:59 +00:00
|
|
|
static gboolean
|
|
|
|
gimp_real_exit (Gimp *gimp,
|
2003-11-30 16:05:56 +00:00
|
|
|
gboolean force)
|
2002-12-05 15:49:59 +00:00
|
|
|
{
|
2003-10-02 11:26:26 +00:00
|
|
|
if (gimp->be_verbose)
|
2008-02-19 13:38:24 +00:00
|
|
|
g_print ("EXIT: %s\n", G_STRFUNC);
|
2003-10-02 11:26:26 +00:00
|
|
|
|
2006-04-28 22:26:51 +00:00
|
|
|
gimp_plug_in_manager_exit (gimp->plug_in_manager);
|
2018-07-17 15:43:43 +02:00
|
|
|
gimp_extension_manager_exit (gimp->extension_manager);
|
2002-12-05 15:49:59 +00:00
|
|
|
gimp_modules_unload (gimp);
|
2003-10-21 18:14:58 +00:00
|
|
|
|
2016-09-12 02:48:39 +02:00
|
|
|
gimp_data_factories_save (gimp);
|
2010-04-03 18:25:31 +03:00
|
|
|
|
2003-04-03 17:50:56 +00:00
|
|
|
gimp_templates_save (gimp);
|
2002-12-05 15:49:59 +00:00
|
|
|
gimp_parasiterc_save (gimp);
|
|
|
|
gimp_unitrc_save (gimp);
|
|
|
|
|
|
|
|
return FALSE; /* continue exiting */
|
|
|
|
}
|
|
|
|
|
2001-07-04 19:31:35 +00:00
|
|
|
Gimp *
|
2003-10-02 11:26:26 +00:00
|
|
|
gimp_new (const gchar *name,
|
2003-11-13 14:14:20 +00:00
|
|
|
const gchar *session_name,
|
2014-07-09 20:12:05 +02:00
|
|
|
GFile *default_folder,
|
2003-10-02 11:26:26 +00:00
|
|
|
gboolean be_verbose,
|
2001-12-01 00:14:14 +00:00
|
|
|
gboolean no_data,
|
2003-11-05 00:33:20 +00:00
|
|
|
gboolean no_fonts,
|
2001-12-01 00:14:14 +00:00
|
|
|
gboolean no_interface,
|
2002-12-01 12:16:03 +00:00
|
|
|
gboolean use_shm,
|
2013-06-19 20:42:56 +02:00
|
|
|
gboolean use_cpu_accel,
|
2003-09-09 10:54:20 +00:00
|
|
|
gboolean console_messages,
|
2014-09-14 01:08:25 +02:00
|
|
|
gboolean show_playground,
|
2018-03-29 05:20:20 -04:00
|
|
|
gboolean show_debug_menu,
|
2003-12-05 17:08:35 +00:00
|
|
|
GimpStackTraceMode stack_trace_mode,
|
|
|
|
GimpPDBCompatMode pdb_compat_mode)
|
2001-07-04 19:31:35 +00:00
|
|
|
{
|
|
|
|
Gimp *gimp;
|
|
|
|
|
2003-10-02 11:26:26 +00:00
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
2003-11-13 14:14:20 +00:00
|
|
|
gimp = g_object_new (GIMP_TYPE_GIMP,
|
2014-07-15 00:09:15 +02:00
|
|
|
"name", name,
|
|
|
|
"verbose", be_verbose ? TRUE : FALSE,
|
2003-11-13 14:14:20 +00:00
|
|
|
NULL);
|
2001-07-04 19:31:35 +00:00
|
|
|
|
2014-07-09 20:12:05 +02:00
|
|
|
if (default_folder)
|
|
|
|
gimp->default_folder = g_object_ref (default_folder);
|
|
|
|
|
2003-11-13 14:14:20 +00:00
|
|
|
gimp->session_name = g_strdup (session_name);
|
2003-09-09 10:54:20 +00:00
|
|
|
gimp->no_data = no_data ? TRUE : FALSE;
|
2003-11-05 00:33:20 +00:00
|
|
|
gimp->no_fonts = no_fonts ? TRUE : FALSE;
|
2003-09-09 10:54:20 +00:00
|
|
|
gimp->no_interface = no_interface ? TRUE : FALSE;
|
|
|
|
gimp->use_shm = use_shm ? TRUE : FALSE;
|
2013-06-19 20:42:56 +02:00
|
|
|
gimp->use_cpu_accel = use_cpu_accel ? TRUE : FALSE;
|
2003-09-09 10:54:20 +00:00
|
|
|
gimp->console_messages = console_messages ? TRUE : FALSE;
|
2014-09-14 01:08:25 +02:00
|
|
|
gimp->show_playground = show_playground ? TRUE : FALSE;
|
2018-03-29 05:20:20 -04:00
|
|
|
gimp->show_debug_menu = show_debug_menu ? TRUE : FALSE;
|
2001-12-01 00:14:14 +00:00
|
|
|
gimp->stack_trace_mode = stack_trace_mode;
|
2003-12-05 17:08:35 +00:00
|
|
|
gimp->pdb_compat_mode = pdb_compat_mode;
|
2001-10-18 17:27:36 +00:00
|
|
|
|
2001-07-04 19:31:35 +00:00
|
|
|
return gimp;
|
|
|
|
}
|
|
|
|
|
2009-09-08 19:26:57 +02:00
|
|
|
/**
|
|
|
|
* gimp_set_show_gui:
|
|
|
|
* @gimp:
|
|
|
|
* @show:
|
|
|
|
*
|
|
|
|
* Test cases that tests the UI typically don't want any windows to be
|
|
|
|
* presented during the test run. Allow them to set this.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gimp_set_show_gui (Gimp *gimp,
|
|
|
|
gboolean show_gui)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
gimp->show_gui = show_gui;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_get_show_gui:
|
|
|
|
* @gimp:
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the GUI should be shown, %FALSE otherwise.
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_get_show_gui (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
|
|
|
|
|
|
|
return gimp->show_gui;
|
|
|
|
}
|
|
|
|
|
2002-11-30 13:08:44 +00:00
|
|
|
static void
|
|
|
|
gimp_global_config_notify (GObject *global_config,
|
|
|
|
GParamSpec *param_spec,
|
|
|
|
GObject *edit_config)
|
|
|
|
{
|
2016-03-26 15:59:26 +01:00
|
|
|
GValue global_value = G_VALUE_INIT;
|
|
|
|
GValue edit_value = G_VALUE_INIT;
|
2002-11-30 13:08:44 +00:00
|
|
|
|
|
|
|
g_value_init (&global_value, param_spec->value_type);
|
|
|
|
g_value_init (&edit_value, param_spec->value_type);
|
|
|
|
|
|
|
|
g_object_get_property (global_config, param_spec->name, &global_value);
|
|
|
|
g_object_get_property (edit_config, param_spec->name, &edit_value);
|
|
|
|
|
|
|
|
if (g_param_values_cmp (param_spec, &global_value, &edit_value))
|
|
|
|
{
|
|
|
|
g_signal_handlers_block_by_func (edit_config,
|
|
|
|
gimp_edit_config_notify,
|
|
|
|
global_config);
|
|
|
|
|
|
|
|
g_object_set_property (edit_config, param_spec->name, &global_value);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func (edit_config,
|
|
|
|
gimp_edit_config_notify,
|
|
|
|
global_config);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_value_unset (&global_value);
|
|
|
|
g_value_unset (&edit_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_edit_config_notify (GObject *edit_config,
|
|
|
|
GParamSpec *param_spec,
|
|
|
|
GObject *global_config)
|
|
|
|
{
|
2016-03-26 15:59:26 +01:00
|
|
|
GValue edit_value = G_VALUE_INIT;
|
|
|
|
GValue global_value = G_VALUE_INIT;
|
2002-11-30 13:08:44 +00:00
|
|
|
|
|
|
|
g_value_init (&edit_value, param_spec->value_type);
|
|
|
|
g_value_init (&global_value, param_spec->value_type);
|
|
|
|
|
|
|
|
g_object_get_property (edit_config, param_spec->name, &edit_value);
|
|
|
|
g_object_get_property (global_config, param_spec->name, &global_value);
|
|
|
|
|
|
|
|
if (g_param_values_cmp (param_spec, &edit_value, &global_value))
|
|
|
|
{
|
2005-02-05 14:52:58 +00:00
|
|
|
if (param_spec->flags & GIMP_CONFIG_PARAM_RESTART)
|
2002-11-30 13:08:44 +00:00
|
|
|
{
|
2003-02-03 14:37:59 +00:00
|
|
|
#ifdef GIMP_CONFIG_DEBUG
|
2002-11-30 13:08:44 +00:00
|
|
|
g_print ("NOT Applying edit_config change of '%s' to global_config "
|
|
|
|
"because it needs restart\n",
|
|
|
|
param_spec->name);
|
2003-02-03 14:37:59 +00:00
|
|
|
#endif
|
2002-11-30 13:08:44 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-02-03 14:37:59 +00:00
|
|
|
#ifdef GIMP_CONFIG_DEBUG
|
2002-11-30 13:08:44 +00:00
|
|
|
g_print ("Applying edit_config change of '%s' to global_config\n",
|
|
|
|
param_spec->name);
|
2003-02-03 14:37:59 +00:00
|
|
|
#endif
|
2002-11-30 13:08:44 +00:00
|
|
|
g_signal_handlers_block_by_func (global_config,
|
|
|
|
gimp_global_config_notify,
|
|
|
|
edit_config);
|
|
|
|
|
|
|
|
g_object_set_property (global_config, param_spec->name, &edit_value);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func (global_config,
|
|
|
|
gimp_global_config_notify,
|
|
|
|
edit_config);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_value_unset (&edit_value);
|
|
|
|
g_value_unset (&global_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-07-28 15:03:06 +02:00
|
|
|
gimp_load_config (Gimp *gimp,
|
|
|
|
GFile *alternate_system_gimprc,
|
|
|
|
GFile *alternate_gimprc)
|
2002-11-30 13:08:44 +00:00
|
|
|
{
|
2003-10-02 11:26:26 +00:00
|
|
|
GimpRc *gimprc;
|
|
|
|
|
2002-11-30 13:08:44 +00:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2014-07-28 15:03:06 +02:00
|
|
|
g_return_if_fail (alternate_system_gimprc == NULL ||
|
|
|
|
G_IS_FILE (alternate_system_gimprc));
|
|
|
|
g_return_if_fail (alternate_gimprc == NULL ||
|
|
|
|
G_IS_FILE (alternate_gimprc));
|
2002-11-30 13:08:44 +00:00
|
|
|
g_return_if_fail (gimp->config == NULL);
|
|
|
|
g_return_if_fail (gimp->edit_config == NULL);
|
|
|
|
|
2003-10-02 11:26:26 +00:00
|
|
|
if (gimp->be_verbose)
|
2008-02-19 13:38:24 +00:00
|
|
|
g_print ("INIT: %s\n", G_STRFUNC);
|
2003-10-02 11:26:26 +00:00
|
|
|
|
|
|
|
/* this needs to be done before gimprc loading because gimprc can
|
|
|
|
* use user defined units
|
|
|
|
*/
|
|
|
|
gimp_unitrc_load (gimp);
|
|
|
|
|
2016-09-14 01:27:42 +02:00
|
|
|
gimprc = gimp_rc_new (G_OBJECT (gimp),
|
|
|
|
alternate_system_gimprc,
|
2003-10-02 11:26:26 +00:00
|
|
|
alternate_gimprc,
|
|
|
|
gimp->be_verbose);
|
|
|
|
|
|
|
|
gimp->config = GIMP_CORE_CONFIG (gimprc);
|
2002-11-30 13:08:44 +00:00
|
|
|
|
2003-10-14 15:20:59 +00:00
|
|
|
gimp->edit_config = gimp_config_duplicate (GIMP_CONFIG (gimp->config));
|
2002-11-30 13:08:44 +00:00
|
|
|
|
|
|
|
g_signal_connect_object (gimp->config, "notify",
|
|
|
|
G_CALLBACK (gimp_global_config_notify),
|
|
|
|
gimp->edit_config, 0);
|
|
|
|
g_signal_connect_object (gimp->edit_config, "notify",
|
|
|
|
G_CALLBACK (gimp_edit_config_notify),
|
|
|
|
gimp->config, 0);
|
|
|
|
}
|
|
|
|
|
2001-07-04 19:31:35 +00:00
|
|
|
void
|
2001-10-19 16:41:09 +00:00
|
|
|
gimp_initialize (Gimp *gimp,
|
|
|
|
GimpInitStatusFunc status_callback)
|
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-10 19:16:16 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2001-10-19 16:41:09 +00:00
|
|
|
g_return_if_fail (status_callback != NULL);
|
2002-11-30 13:08:44 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CORE_CONFIG (gimp->config));
|
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-10 19:16:16 +00:00
|
|
|
|
2003-10-02 11:26:26 +00:00
|
|
|
if (gimp->be_verbose)
|
2008-02-19 13:38:24 +00:00
|
|
|
g_print ("INIT: %s\n", G_STRFUNC);
|
2003-09-15 17:26:28 +00:00
|
|
|
|
2003-10-02 11:26:26 +00:00
|
|
|
g_signal_emit (gimp, gimp_signals[INITIALIZE], 0, status_callback);
|
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-10 19:16:16 +00:00
|
|
|
}
|
|
|
|
|
2018-05-01 02:54:36 +02:00
|
|
|
/**
|
|
|
|
* gimp_restore:
|
|
|
|
* @gimp: a #Gimp object
|
|
|
|
* @error: a #GError for uncessful loading.
|
|
|
|
*
|
|
|
|
* This function always succeeds. If present, @error may be filled for
|
|
|
|
* possible feedback on data which failed to load. It doesn't imply any
|
|
|
|
* fatale error.
|
|
|
|
**/
|
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-10 19:16:16 +00:00
|
|
|
void
|
2018-05-01 02:54:36 +02:00
|
|
|
gimp_restore (Gimp *gimp,
|
|
|
|
GimpInitStatusFunc status_callback,
|
|
|
|
GError **error)
|
2001-07-04 19:31:35 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2001-10-19 16:41:09 +00:00
|
|
|
g_return_if_fail (status_callback != NULL);
|
2001-07-04 19:31:35 +00:00
|
|
|
|
2003-10-02 11:26:26 +00:00
|
|
|
if (gimp->be_verbose)
|
2008-02-19 13:38:24 +00:00
|
|
|
g_print ("INIT: %s\n", G_STRFUNC);
|
2003-10-02 11:26:26 +00:00
|
|
|
|
2001-07-04 19:31:35 +00:00
|
|
|
/* initialize the global parasite table */
|
2005-11-05 12:18:56 +00:00
|
|
|
status_callback (_("Looking for data files"), _("Parasites"), 0.0);
|
2001-07-04 22:59:25 +00:00
|
|
|
gimp_parasiterc_load (gimp);
|
2001-07-04 19:31:35 +00:00
|
|
|
|
2016-09-12 02:48:39 +02:00
|
|
|
/* initialize the lists of gimp brushes, dynamics, patterns etc. */
|
|
|
|
gimp_data_factories_load (gimp, status_callback);
|
2010-04-03 18:25:31 +03:00
|
|
|
|
2003-04-03 17:50:56 +00:00
|
|
|
/* initialize the template list */
|
2016-09-12 02:48:39 +02:00
|
|
|
status_callback (NULL, _("Templates"), 0.8);
|
2003-04-03 17:50:56 +00:00
|
|
|
gimp_templates_load (gimp);
|
|
|
|
|
2003-10-02 11:26:26 +00:00
|
|
|
/* initialize the module list */
|
2016-09-12 02:48:39 +02:00
|
|
|
status_callback (NULL, _("Modules"), 0.9);
|
2001-10-18 17:27:36 +00:00
|
|
|
gimp_modules_load (gimp);
|
2003-10-02 11:26:26 +00:00
|
|
|
|
2003-11-13 14:14:20 +00:00
|
|
|
g_signal_emit (gimp, gimp_signals[RESTORE], 0, status_callback);
|
2015-02-26 22:17:45 +01:00
|
|
|
|
|
|
|
/* when done, make sure everything is clean, to clean out dirty
|
2016-09-15 18:47:55 +02:00
|
|
|
* states from data objects which reference each other and got
|
2015-02-26 22:17:45 +01:00
|
|
|
* dirtied by loading the referenced object
|
|
|
|
*/
|
2016-09-12 02:48:39 +02:00
|
|
|
gimp_data_factories_data_clean (gimp);
|
2001-07-04 19:31:35 +00:00
|
|
|
}
|
2001-07-04 22:59:25 +00:00
|
|
|
|
2008-09-25 08:56:58 +00:00
|
|
|
/**
|
|
|
|
* gimp_is_restored:
|
|
|
|
* @gimp: a #Gimp object
|
|
|
|
*
|
2019-08-03 00:10:14 +02:00
|
|
|
* Returns: %TRUE if GIMP is completely started, %FALSE otherwise.
|
2008-09-25 08:56:58 +00:00
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_is_restored (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
|
|
|
|
|
|
|
return gimp->restored;
|
|
|
|
}
|
|
|
|
|
2003-11-30 16:05:56 +00:00
|
|
|
/**
|
|
|
|
* gimp_exit:
|
|
|
|
* @gimp: a #Gimp object
|
|
|
|
* @force: whether to force the application to quit
|
|
|
|
*
|
|
|
|
* Exit this GIMP session. Unless @force is %TRUE, the user is queried
|
|
|
|
* whether unsaved images should be saved and can cancel the operation.
|
|
|
|
**/
|
2001-07-04 22:59:25 +00:00
|
|
|
void
|
2002-12-05 15:49:59 +00:00
|
|
|
gimp_exit (Gimp *gimp,
|
2003-11-30 16:05:56 +00:00
|
|
|
gboolean force)
|
2001-07-04 22:59:25 +00:00
|
|
|
{
|
2016-04-16 13:52:41 +01:00
|
|
|
gboolean handled;
|
|
|
|
GList *image_iter;
|
2002-12-05 15:49:59 +00: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-10 19:16:16 +00:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2003-10-02 11:26:26 +00:00
|
|
|
if (gimp->be_verbose)
|
2008-02-19 13:38:24 +00:00
|
|
|
g_print ("EXIT: %s\n", G_STRFUNC);
|
2003-10-02 11:26:26 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (gimp, gimp_signals[EXIT], 0,
|
2003-11-30 16:05:56 +00:00
|
|
|
force ? TRUE : FALSE,
|
2002-12-05 15:49:59 +00:00
|
|
|
&handled);
|
2016-04-16 13:52:41 +01:00
|
|
|
|
2016-04-16 14:20:43 +01:00
|
|
|
if (handled)
|
|
|
|
return;
|
|
|
|
|
2016-04-16 13:52:41 +01:00
|
|
|
/* Get rid of images without display. We do this *after* handling the
|
|
|
|
* usual exit callbacks, because the things that are torn down there
|
|
|
|
* might have references to these images (for instance GimpActions
|
|
|
|
* in the UI manager).
|
|
|
|
*/
|
|
|
|
while ((image_iter = gimp_get_image_iter (gimp)))
|
|
|
|
{
|
|
|
|
GimpImage *image = image_iter->data;
|
|
|
|
|
|
|
|
g_object_unref (image);
|
|
|
|
}
|
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-10 19:16:16 +00:00
|
|
|
}
|
|
|
|
|
2008-11-02 21:34:14 +00:00
|
|
|
GList *
|
|
|
|
gimp_get_image_iter (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
2016-05-01 15:22:44 +02:00
|
|
|
return GIMP_LIST (gimp->images)->queue->head;
|
2008-11-02 21:34:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GList *
|
|
|
|
gimp_get_display_iter (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
2016-05-01 15:22:44 +02:00
|
|
|
return GIMP_LIST (gimp->displays)->queue->head;
|
2008-11-02 21:34:14 +00:00
|
|
|
}
|
|
|
|
|
2009-10-04 02:01:53 +02:00
|
|
|
GList *
|
2009-10-25 20:31:55 +01:00
|
|
|
gimp_get_image_windows (Gimp *gimp)
|
2009-10-04 02:01:53 +02:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
2009-10-25 20:31:55 +01:00
|
|
|
return g_list_copy (gimp->image_windows);
|
2009-10-04 02:01:53 +02:00
|
|
|
}
|
|
|
|
|
2011-10-29 19:37:58 +02:00
|
|
|
GList *
|
|
|
|
gimp_get_paint_info_iter (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
2016-05-01 15:22:44 +02:00
|
|
|
return GIMP_LIST (gimp->paint_info_list)->queue->head;
|
2011-10-29 19:37:58 +02:00
|
|
|
}
|
|
|
|
|
2008-11-02 21:34:14 +00:00
|
|
|
GList *
|
|
|
|
gimp_get_tool_info_iter (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
2016-05-01 15:22:44 +02:00
|
|
|
return GIMP_LIST (gimp->tool_info_list)->queue->head;
|
2008-11-02 21:34:14 +00:00
|
|
|
}
|
|
|
|
|
app: add support for tool groups in toolrc
Add a new Gimp::tool_item_list list, in addition to
Gimp::tool_info_list. The latter may contain arbitrary tool items,
including tool groups, and is intended for use in the UI (namely,
the toolbox and the preferences tool editor).
In gimp-tools, use Gimp::tool_item_list for representing the UI
tool order (while still using Gimp::tool_info_list as a flat list
of all GimpToolInfo objects), and add support for saving and
loading tool groups to/from toolrc.
Introduce file-version tracking in toolrc, and drop its contents on
version mismatch, or when new tools are introduced. This is
slightly disruptive, but merging new changes with existing toolrc
files is non-trivial, and it doesn't happen very often.
Add support for a sysconf toolrc file, which is used if there's no
user toolrc file (i.e., on first use). If neither file is found,
the hard-coded flat tool order is used. This commit doesn't
provide a default toolrc file, but the next commits will.
Make the gimp-tools serialization and deserialization functions
public, for use in GimpToolEditor in the next commits.
2020-01-29 21:02:00 +02:00
|
|
|
GList *
|
|
|
|
gimp_get_tool_item_iter (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
return GIMP_LIST (gimp->tool_item_list)->queue->head;
|
|
|
|
}
|
|
|
|
|
2016-09-21 00:11:15 +02:00
|
|
|
GimpObject *
|
|
|
|
gimp_get_clipboard_object (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
if (gimp->clipboard_image)
|
|
|
|
return GIMP_OBJECT (gimp->clipboard_image);
|
|
|
|
|
|
|
|
return GIMP_OBJECT (gimp->clipboard_buffer);
|
|
|
|
}
|
|
|
|
|
2016-09-19 20:13:39 +02:00
|
|
|
void
|
|
|
|
gimp_set_clipboard_image (Gimp *gimp,
|
|
|
|
GimpImage *image)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (image == NULL || GIMP_IS_IMAGE (image));
|
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_object (&gimp->clipboard_buffer);
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&gimp->clipboard_image, image);
|
2016-09-19 20:13:39 +02:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
/* we want the signal emission */
|
2016-09-19 20:13:39 +02:00
|
|
|
g_signal_emit (gimp, gimp_signals[CLIPBOARD_CHANGED], 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpImage *
|
|
|
|
gimp_get_clipboard_image (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
return gimp->clipboard_image;
|
|
|
|
}
|
|
|
|
|
2004-02-19 12:49:15 +00:00
|
|
|
void
|
2016-09-17 17:39:54 +02:00
|
|
|
gimp_set_clipboard_buffer (Gimp *gimp,
|
|
|
|
GimpBuffer *buffer)
|
2004-02-19 12:49:15 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (buffer == NULL || GIMP_IS_BUFFER (buffer));
|
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_object (&gimp->clipboard_image);
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&gimp->clipboard_buffer, buffer);
|
2004-02-19 12:49:15 +00:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
/* we want the signal emission */
|
2016-09-17 17:39:54 +02:00
|
|
|
g_signal_emit (gimp, gimp_signals[CLIPBOARD_CHANGED], 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpBuffer *
|
|
|
|
gimp_get_clipboard_buffer (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
return gimp->clipboard_buffer;
|
2004-02-19 12:49:15 +00:00
|
|
|
}
|
|
|
|
|
2001-07-05 15:34:26 +00:00
|
|
|
GimpImage *
|
|
|
|
gimp_create_image (Gimp *gimp,
|
2004-08-11 14:00:08 +00:00
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GimpImageBaseType type,
|
2012-04-22 17:31:32 +02:00
|
|
|
GimpPrecision precision,
|
2004-08-11 14:00:08 +00:00
|
|
|
gboolean attach_comment)
|
2001-07-05 15:34:26 +00:00
|
|
|
{
|
2006-03-28 17:08:36 +00:00
|
|
|
GimpImage *image;
|
2001-07-05 15:34:26 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
2012-04-22 17:31:32 +02:00
|
|
|
image = gimp_image_new (gimp, width, height, type, precision);
|
2001-07-05 15:34:26 +00:00
|
|
|
|
2003-10-15 15:30:11 +00:00
|
|
|
if (attach_comment)
|
2001-07-05 16:21:36 +00:00
|
|
|
{
|
2011-03-02 10:16:43 +01:00
|
|
|
const gchar *comment;
|
|
|
|
|
|
|
|
comment = gimp_template_get_comment (gimp->config->default_image);
|
2003-10-15 15:30:11 +00:00
|
|
|
|
|
|
|
if (comment)
|
|
|
|
{
|
|
|
|
GimpParasite *parasite = gimp_parasite_new ("gimp-comment",
|
|
|
|
GIMP_PARASITE_PERSISTENT,
|
|
|
|
strlen (comment) + 1,
|
|
|
|
comment);
|
2019-05-30 16:44:23 +02:00
|
|
|
gimp_image_parasite_attach (image, parasite, FALSE);
|
2003-10-15 15:30:11 +00:00
|
|
|
gimp_parasite_free (parasite);
|
|
|
|
}
|
2001-07-05 16:21:36 +00:00
|
|
|
}
|
|
|
|
|
2006-03-28 17:08:36 +00:00
|
|
|
return image;
|
2001-07-05 15:34:26 +00:00
|
|
|
}
|
|
|
|
|
2001-07-07 12:17:23 +00:00
|
|
|
void
|
|
|
|
gimp_set_default_context (Gimp *gimp,
|
2004-08-11 14:00:08 +00:00
|
|
|
GimpContext *context)
|
2001-07-07 12:17:23 +00: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-10 19:16:16 +00:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2005-09-04 10:44:04 +00:00
|
|
|
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
|
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-10 19:16:16 +00:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&gimp->default_context, context);
|
2001-07-07 12:17:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GimpContext *
|
|
|
|
gimp_get_default_context (Gimp *gimp)
|
|
|
|
{
|
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-10 19:16:16 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
2001-07-07 12:17:23 +00:00
|
|
|
return gimp->default_context;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_set_user_context (Gimp *gimp,
|
2004-08-11 14:00:08 +00:00
|
|
|
GimpContext *context)
|
2001-07-07 12:17:23 +00: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-10 19:16:16 +00:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2005-09-04 10:44:04 +00:00
|
|
|
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
|
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-10 19:16:16 +00:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&gimp->user_context, context);
|
2001-07-07 12:17:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GimpContext *
|
|
|
|
gimp_get_user_context (Gimp *gimp)
|
|
|
|
{
|
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-10 19:16:16 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
2001-07-07 12:17:23 +00:00
|
|
|
return gimp->user_context;
|
|
|
|
}
|
2006-08-08 21:06:36 +00:00
|
|
|
|
2006-09-08 13:42:00 +00:00
|
|
|
GimpToolInfo *
|
|
|
|
gimp_get_tool_info (Gimp *gimp,
|
|
|
|
const gchar *tool_id)
|
|
|
|
{
|
|
|
|
gpointer info;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
g_return_val_if_fail (tool_id != NULL, NULL);
|
|
|
|
|
|
|
|
info = gimp_container_get_child_by_name (gimp->tool_info_list, tool_id);
|
|
|
|
|
|
|
|
return (GimpToolInfo *) info;
|
|
|
|
}
|
|
|
|
|
2007-05-21 16:32:52 +00:00
|
|
|
/**
|
|
|
|
* gimp_message:
|
|
|
|
* @gimp: a pointer to the %Gimp object
|
|
|
|
* @handler: either a %GimpProgress or a %GtkWidget pointer
|
|
|
|
* @severity: severity of the message
|
|
|
|
* @format: printf-like format string
|
|
|
|
* @...: arguments to use with @format
|
|
|
|
*
|
|
|
|
* Present a message to the user. How exactly the message is displayed
|
|
|
|
* depends on the @severity, the @handler object and user preferences.
|
|
|
|
**/
|
2006-08-08 21:06:36 +00:00
|
|
|
void
|
2006-10-09 08:17:22 +00:00
|
|
|
gimp_message (Gimp *gimp,
|
|
|
|
GObject *handler,
|
|
|
|
GimpMessageSeverity severity,
|
|
|
|
const gchar *format,
|
2006-08-08 21:06:36 +00:00
|
|
|
...)
|
|
|
|
{
|
2006-09-28 10:47:44 +00:00
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start (args, format);
|
|
|
|
|
2006-10-09 08:17:22 +00:00
|
|
|
gimp_message_valist (gimp, handler, severity, format, args);
|
2006-09-28 10:47:44 +00:00
|
|
|
|
|
|
|
va_end (args);
|
|
|
|
}
|
|
|
|
|
2007-05-21 16:32:52 +00:00
|
|
|
/**
|
|
|
|
* gimp_message_valist:
|
|
|
|
* @gimp: a pointer to the %Gimp object
|
|
|
|
* @handler: either a %GimpProgress or a %GtkWidget pointer
|
|
|
|
* @severity: severity of the message
|
|
|
|
* @format: printf-like format string
|
|
|
|
* @args: arguments to use with @format
|
|
|
|
*
|
|
|
|
* See documentation for gimp_message().
|
|
|
|
**/
|
2006-09-28 10:47:44 +00:00
|
|
|
void
|
2006-10-09 08:17:22 +00:00
|
|
|
gimp_message_valist (Gimp *gimp,
|
|
|
|
GObject *handler,
|
|
|
|
GimpMessageSeverity severity,
|
|
|
|
const gchar *format,
|
|
|
|
va_list args)
|
2006-09-28 10:47:44 +00:00
|
|
|
{
|
|
|
|
gchar *message;
|
2006-08-08 21:06:36 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2006-10-09 08:17:22 +00:00
|
|
|
g_return_if_fail (handler == NULL || G_IS_OBJECT (handler));
|
|
|
|
g_return_if_fail (format != NULL);
|
2006-08-08 21:06:36 +00:00
|
|
|
|
|
|
|
message = g_strdup_vprintf (format, args);
|
|
|
|
|
2018-02-12 01:59:08 +01:00
|
|
|
gimp_show_message (gimp, handler, severity, NULL, message);
|
2006-09-19 14:26:48 +00:00
|
|
|
|
|
|
|
g_free (message);
|
2006-08-08 21:06:36 +00:00
|
|
|
}
|
2008-01-22 11:28:48 +00:00
|
|
|
|
2008-11-04 12:33:09 +00:00
|
|
|
void
|
|
|
|
gimp_message_literal (Gimp *gimp,
|
2013-09-15 04:59:20 +12:00
|
|
|
GObject *handler,
|
|
|
|
GimpMessageSeverity severity,
|
|
|
|
const gchar *message)
|
2008-11-04 12:33:09 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (handler == NULL || G_IS_OBJECT (handler));
|
|
|
|
g_return_if_fail (message != NULL);
|
|
|
|
|
2018-02-12 01:59:08 +01:00
|
|
|
gimp_show_message (gimp, handler, severity, NULL, message);
|
2008-11-04 12:33:09 +00:00
|
|
|
}
|
|
|
|
|
2015-12-30 11:53:52 +01:00
|
|
|
void
|
|
|
|
gimp_filter_history_changed (Gimp *gimp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
g_signal_emit (gimp, gimp_signals[FILTER_HISTORY_CHANGED], 0);
|
|
|
|
}
|
|
|
|
|
2008-10-17 12:03:08 +00:00
|
|
|
void
|
2014-07-07 00:46:25 +02:00
|
|
|
gimp_image_opened (Gimp *gimp,
|
2016-11-25 05:51:03 +01:00
|
|
|
GFile *file)
|
2008-10-17 12:03:08 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2014-07-07 00:46:25 +02:00
|
|
|
g_return_if_fail (G_IS_FILE (file));
|
2008-10-17 12:03:08 +00:00
|
|
|
|
2014-07-07 00:46:25 +02:00
|
|
|
g_signal_emit (gimp, gimp_signals[IMAGE_OPENED], 0, file);
|
2008-10-17 12:03:08 +00:00
|
|
|
}
|
|
|
|
|
2014-07-10 22:32:09 +02:00
|
|
|
GFile *
|
|
|
|
gimp_get_temp_file (Gimp *gimp,
|
|
|
|
const gchar *extension)
|
2012-04-23 21:13:57 +02:00
|
|
|
{
|
|
|
|
static gint id = 0;
|
|
|
|
static gint pid;
|
|
|
|
gchar *basename;
|
2014-07-29 16:32:08 +02:00
|
|
|
GFile *dir;
|
2014-07-10 22:32:09 +02:00
|
|
|
GFile *file;
|
2012-04-23 21:13:57 +02:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
|
|
|
|
if (id == 0)
|
|
|
|
pid = gimp_get_pid ();
|
|
|
|
|
|
|
|
if (extension)
|
|
|
|
basename = g_strdup_printf ("gimp-temp-%d%d.%s", pid, id++, extension);
|
|
|
|
else
|
|
|
|
basename = g_strdup_printf ("gimp-temp-%d%d", pid, id++);
|
|
|
|
|
2016-09-30 22:07:00 +02:00
|
|
|
dir = gimp_file_new_for_config_path (GIMP_GEGL_CONFIG (gimp->config)->temp_path,
|
|
|
|
NULL);
|
2018-04-23 00:35:01 +02:00
|
|
|
if (! g_file_query_exists (dir, NULL))
|
|
|
|
{
|
|
|
|
/* Try to make the temp directory if it doesn't exist.
|
|
|
|
* Ignore any error.
|
|
|
|
*/
|
|
|
|
g_file_make_directory_with_parents (dir, NULL, NULL);
|
|
|
|
}
|
2014-07-29 16:32:08 +02:00
|
|
|
file = g_file_get_child (dir, basename);
|
|
|
|
g_free (basename);
|
|
|
|
g_object_unref (dir);
|
2014-07-10 22:32:09 +02:00
|
|
|
|
|
|
|
return file;
|
2012-04-23 21:13:57 +02:00
|
|
|
}
|