2006-12-09 21:33:38 +00:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1999-06-17 19:13:08 +00:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2001-04-23 16:58:18 +00:00
|
|
|
* gimpcontext.c
|
2010-02-13 15:04:32 +01:00
|
|
|
* Copyright (C) 1999-2010 Michael Natterer
|
1999-10-19 15:52:32 +00:00
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1999-06-17 19:13:08 +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
|
1999-06-17 19:13:08 +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/>.
|
1999-06-17 19:13:08 +00:00
|
|
|
*/
|
2000-12-16 21:37:03 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2011-04-28 15:50:39 +02:00
|
|
|
#include <cairo.h>
|
2008-10-09 20:24:04 +00:00
|
|
|
#include <gegl.h>
|
2012-05-03 03:36:22 +02:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
1999-06-18 18:29:27 +00:00
|
|
|
|
2005-01-22 00:42:40 +00:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2001-01-23 18:49:44 +00:00
|
|
|
#include "libgimpcolor/gimpcolor.h"
|
2005-01-25 19:11:26 +00:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2001-01-23 18:49:44 +00:00
|
|
|
|
2001-05-09 22:34:59 +00:00
|
|
|
#include "core-types.h"
|
|
|
|
|
2002-11-18 20:50:31 +00:00
|
|
|
#include "config/gimpcoreconfig.h"
|
|
|
|
|
2023-11-16 15:15:45 +01:00
|
|
|
#include "gegl/gimp-babl.h"
|
|
|
|
|
2001-07-04 19:31:35 +00:00
|
|
|
#include "gimp.h"
|
2014-08-12 13:57:57 +02:00
|
|
|
#include "gimp-memsize.h"
|
1999-10-26 18:27:27 +00:00
|
|
|
#include "gimpbrush.h"
|
2001-06-26 12:09:43 +00:00
|
|
|
#include "gimpbuffer.h"
|
2001-02-05 17:48:50 +00:00
|
|
|
#include "gimpcontainer.h"
|
1999-06-17 19:13:08 +00:00
|
|
|
#include "gimpcontext.h"
|
2001-02-13 19:53:07 +00:00
|
|
|
#include "gimpdatafactory.h"
|
2019-09-04 14:27:18 +02:00
|
|
|
#include "gimpdisplay.h"
|
2009-10-03 13:53:40 +02:00
|
|
|
#include "gimpdynamics.h"
|
2001-10-22 17:27:46 +00:00
|
|
|
#include "gimpimagefile.h"
|
2001-02-10 19:35:29 +00:00
|
|
|
#include "gimpgradient.h"
|
2001-02-07 15:01:52 +00:00
|
|
|
#include "gimpimage.h"
|
2022-02-08 00:30:15 +01:00
|
|
|
#include "gimplineart.h"
|
2015-12-20 23:48:40 +01:00
|
|
|
#include "gimpmybrush.h"
|
2005-12-27 18:57:01 +00:00
|
|
|
#include "gimppaintinfo.h"
|
2001-02-11 16:14:25 +00:00
|
|
|
#include "gimppalette.h"
|
2001-02-04 17:34:30 +00:00
|
|
|
#include "gimppattern.h"
|
2003-04-05 19:56:38 +00:00
|
|
|
#include "gimptemplate.h"
|
2001-05-09 22:34:59 +00:00
|
|
|
#include "gimptoolinfo.h"
|
2010-04-04 13:58:55 +02:00
|
|
|
#include "gimptoolpreset.h"
|
2001-05-09 22:34:59 +00:00
|
|
|
|
2003-03-25 22:06:03 +00:00
|
|
|
#include "text/gimpfont.h"
|
|
|
|
|
2003-08-25 10:49:33 +00:00
|
|
|
#include "gimp-intl.h"
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2002-05-03 12:45:22 +00:00
|
|
|
|
2001-08-11 19:53:35 +00:00
|
|
|
typedef void (* GimpContextCopyPropFunc) (GimpContext *src,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *dest);
|
2001-02-07 15:01:52 +00:00
|
|
|
|
2018-06-17 14:09:55 +02:00
|
|
|
#define context_find_defined(context, prop) \
|
2003-02-09 17:32:52 +00:00
|
|
|
while (!(((context)->defined_props) & (1 << (prop))) && (context)->parent) \
|
|
|
|
(context) = (context)->parent
|
1999-06-18 18:29:27 +00:00
|
|
|
|
2018-06-17 14:09:55 +02:00
|
|
|
#define COPY_NAME(src, dest, member) \
|
|
|
|
g_free (dest->member); \
|
|
|
|
dest->member = g_strdup (src->member)
|
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
|
|
|
|
/* local function prototypes */
|
1999-11-14 10:50:19 +00:00
|
|
|
|
2005-12-10 19:24:36 +00:00
|
|
|
static void gimp_context_config_iface_init (GimpConfigInterface *iface);
|
2001-08-11 19:53:35 +00:00
|
|
|
|
2011-01-12 22:53:58 +01:00
|
|
|
static void gimp_context_constructed (GObject *object);
|
2002-05-28 16:41:56 +00:00
|
|
|
static void gimp_context_dispose (GObject *object);
|
|
|
|
static void gimp_context_finalize (GObject *object);
|
|
|
|
static void gimp_context_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_context_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2004-03-11 18:47:37 +00:00
|
|
|
static gint64 gimp_context_get_memsize (GimpObject *object,
|
|
|
|
gint64 *gui_size);
|
2002-01-30 16:14:26 +00:00
|
|
|
|
2003-10-11 14:30:18 +00:00
|
|
|
static gboolean gimp_context_serialize (GimpConfig *config,
|
2003-03-05 20:21:50 +00:00
|
|
|
GimpConfigWriter *writer,
|
|
|
|
gpointer data);
|
2015-04-27 17:48:00 -04:00
|
|
|
static gboolean gimp_context_deserialize (GimpConfig *config,
|
|
|
|
GScanner *scanner,
|
|
|
|
gint nest_level,
|
|
|
|
gpointer data);
|
2003-10-11 14:30:18 +00:00
|
|
|
static gboolean gimp_context_serialize_property (GimpConfig *config,
|
2003-03-05 20:21:50 +00:00
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GimpConfigWriter *writer);
|
2003-10-11 14:30:18 +00:00
|
|
|
static gboolean gimp_context_deserialize_property (GimpConfig *config,
|
2003-03-05 20:21:50 +00:00
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GScanner *scanner,
|
|
|
|
GTokenType *expected);
|
2018-06-17 14:09:55 +02:00
|
|
|
static GimpConfig * gimp_context_duplicate (GimpConfig *config);
|
|
|
|
static gboolean gimp_context_copy (GimpConfig *src,
|
|
|
|
GimpConfig *dest,
|
|
|
|
GParamFlags flags);
|
2002-05-22 13:19:19 +00:00
|
|
|
|
1999-11-14 10:50:19 +00:00
|
|
|
/* image */
|
2024-01-30 14:41:50 +01:00
|
|
|
static void gimp_context_image_disconnect (GimpImage *image,
|
|
|
|
GimpContext *context);
|
2001-02-12 03:27:28 +00:00
|
|
|
static void gimp_context_image_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpImage *image,
|
|
|
|
GimpContext *context);
|
1999-10-19 15:52:32 +00:00
|
|
|
static void gimp_context_real_set_image (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpImage *image);
|
1999-11-14 10:50:19 +00:00
|
|
|
|
|
|
|
/* display */
|
2002-05-10 13:09:19 +00:00
|
|
|
static void gimp_context_display_removed (GimpContainer *container,
|
2019-09-04 14:27:18 +02:00
|
|
|
GimpDisplay *display,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
1999-11-14 10:50:19 +00:00
|
|
|
static void gimp_context_real_set_display (GimpContext *context,
|
2019-09-04 14:27:18 +02:00
|
|
|
GimpDisplay *display);
|
1999-11-14 10:50:19 +00:00
|
|
|
|
|
|
|
/* tool */
|
2001-02-21 12:18:09 +00:00
|
|
|
static void gimp_context_tool_dirty (GimpToolInfo *tool_info,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2001-02-21 12:18:09 +00:00
|
|
|
static void gimp_context_tool_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpToolInfo *tool_info,
|
|
|
|
GimpContext *context);
|
2001-02-21 12:18:09 +00:00
|
|
|
static void gimp_context_tool_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
1999-11-14 10:50:19 +00:00
|
|
|
static void gimp_context_real_set_tool (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpToolInfo *tool_info);
|
1999-11-14 10:50:19 +00:00
|
|
|
|
2005-12-27 18:57:01 +00:00
|
|
|
/* paint info */
|
|
|
|
static void gimp_context_paint_info_dirty (GimpPaintInfo *paint_info,
|
|
|
|
GimpContext *context);
|
|
|
|
static void gimp_context_paint_info_removed (GimpContainer *container,
|
|
|
|
GimpPaintInfo *paint_info,
|
|
|
|
GimpContext *context);
|
|
|
|
static void gimp_context_paint_info_list_thaw(GimpContainer *container,
|
|
|
|
GimpContext *context);
|
|
|
|
static void gimp_context_real_set_paint_info (GimpContext *context,
|
|
|
|
GimpPaintInfo *paint_info);
|
|
|
|
|
1999-11-14 10:50:19 +00:00
|
|
|
/* foreground */
|
|
|
|
static void gimp_context_real_set_foreground (GimpContext *context,
|
2023-11-13 23:29:20 +01:00
|
|
|
GeglColor *color);
|
1999-11-14 10:50:19 +00:00
|
|
|
|
|
|
|
/* background */
|
|
|
|
static void gimp_context_real_set_background (GimpContext *context,
|
2023-11-13 23:29:20 +01:00
|
|
|
GeglColor *color);
|
1999-11-14 10:50:19 +00:00
|
|
|
|
|
|
|
/* opacity */
|
|
|
|
static void gimp_context_real_set_opacity (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gdouble opacity);
|
1999-11-14 10:50:19 +00:00
|
|
|
|
|
|
|
/* paint mode */
|
|
|
|
static void gimp_context_real_set_paint_mode (GimpContext *context,
|
2017-01-08 23:00:19 +01:00
|
|
|
GimpLayerMode paint_mode);
|
1999-11-14 10:50:19 +00:00
|
|
|
|
|
|
|
/* brush */
|
2001-02-04 17:34:30 +00:00
|
|
|
static void gimp_context_brush_dirty (GimpBrush *brush,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2001-02-04 17:34:30 +00:00
|
|
|
static void gimp_context_brush_removed (GimpContainer *brush_list,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpBrush *brush,
|
|
|
|
GimpContext *context);
|
2001-02-12 03:27:28 +00:00
|
|
|
static void gimp_context_brush_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
1999-11-14 10:50:19 +00:00
|
|
|
static void gimp_context_real_set_brush (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpBrush *brush);
|
1999-11-14 10:50:19 +00:00
|
|
|
|
2009-08-17 23:47:26 -03:00
|
|
|
/* dynamics */
|
|
|
|
|
2009-10-03 13:53:40 +02:00
|
|
|
static void gimp_context_dynamics_dirty (GimpDynamics *dynamics,
|
|
|
|
GimpContext *context);
|
2009-08-18 22:38:45 -03:00
|
|
|
static void gimp_context_dynamics_removed (GimpContainer *container,
|
2009-10-03 12:59:45 +03:00
|
|
|
GimpDynamics *dynamics,
|
2009-08-17 23:47:26 -03:00
|
|
|
GimpContext *context);
|
|
|
|
static void gimp_context_dynamics_list_thaw (GimpContainer *container,
|
|
|
|
GimpContext *context);
|
|
|
|
static void gimp_context_real_set_dynamics (GimpContext *context,
|
2009-08-20 04:25:26 +03:00
|
|
|
GimpDynamics *dynamics);
|
2009-08-20 03:20:17 +03:00
|
|
|
|
2015-12-20 23:48:40 +01:00
|
|
|
/* mybrush */
|
|
|
|
static void gimp_context_mybrush_dirty (GimpMybrush *brush,
|
|
|
|
GimpContext *context);
|
|
|
|
static void gimp_context_mybrush_removed (GimpContainer *brush_list,
|
|
|
|
GimpMybrush *brush,
|
|
|
|
GimpContext *context);
|
|
|
|
static void gimp_context_mybrush_list_thaw (GimpContainer *container,
|
|
|
|
GimpContext *context);
|
|
|
|
static void gimp_context_real_set_mybrush (GimpContext *context,
|
|
|
|
GimpMybrush *brush);
|
|
|
|
|
1999-11-14 10:50:19 +00:00
|
|
|
/* pattern */
|
2001-02-04 17:34:30 +00:00
|
|
|
static void gimp_context_pattern_dirty (GimpPattern *pattern,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2001-02-21 12:18:09 +00:00
|
|
|
static void gimp_context_pattern_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpPattern *pattern,
|
|
|
|
GimpContext *context);
|
2001-02-12 03:27:28 +00:00
|
|
|
static void gimp_context_pattern_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
1999-11-14 10:50:19 +00:00
|
|
|
static void gimp_context_real_set_pattern (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpPattern *pattern);
|
1999-11-14 10:50:19 +00:00
|
|
|
|
|
|
|
/* gradient */
|
2001-02-12 03:27:28 +00:00
|
|
|
static void gimp_context_gradient_dirty (GimpGradient *gradient,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2001-02-12 03:27:28 +00:00
|
|
|
static void gimp_context_gradient_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpGradient *gradient,
|
|
|
|
GimpContext *context);
|
2001-02-12 03:27:28 +00:00
|
|
|
static void gimp_context_gradient_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
1999-11-14 10:50:19 +00:00
|
|
|
static void gimp_context_real_set_gradient (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpGradient *gradient);
|
1999-10-19 15:52:32 +00:00
|
|
|
|
2001-02-11 16:14:25 +00:00
|
|
|
/* palette */
|
|
|
|
static void gimp_context_palette_dirty (GimpPalette *palette,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2001-02-21 12:18:09 +00:00
|
|
|
static void gimp_context_palette_removed (GimpContainer *container,
|
2018-05-12 12:13:12 -04:00
|
|
|
GimpPalette *palette,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2001-02-12 03:27:28 +00:00
|
|
|
static void gimp_context_palette_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2001-02-11 16:14:25 +00:00
|
|
|
static void gimp_context_real_set_palette (GimpContext *context,
|
2018-05-12 12:13:12 -04:00
|
|
|
GimpPalette *palette);
|
2001-02-11 16:14:25 +00:00
|
|
|
|
2003-03-25 22:06:03 +00:00
|
|
|
/* font */
|
|
|
|
static void gimp_context_font_dirty (GimpFont *font,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2003-03-25 22:06:03 +00:00
|
|
|
static void gimp_context_font_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpFont *font,
|
|
|
|
GimpContext *context);
|
2003-03-25 22:06:03 +00:00
|
|
|
static void gimp_context_font_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2003-03-25 22:06:03 +00:00
|
|
|
static void gimp_context_real_set_font (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpFont *font);
|
2003-03-25 22:06:03 +00:00
|
|
|
|
2018-06-02 23:19:51 +02:00
|
|
|
/* tool preset */
|
|
|
|
static void gimp_context_tool_preset_dirty (GimpToolPreset *tool_preset,
|
|
|
|
GimpContext *context);
|
|
|
|
static void gimp_context_tool_preset_removed (GimpContainer *container,
|
|
|
|
GimpToolPreset *tool_preset,
|
|
|
|
GimpContext *context);
|
|
|
|
static void gimp_context_tool_preset_list_thaw (GimpContainer *container,
|
|
|
|
GimpContext *context);
|
|
|
|
static void gimp_context_real_set_tool_preset (GimpContext *context,
|
|
|
|
GimpToolPreset *tool_preset);
|
|
|
|
|
2001-06-26 12:09:43 +00:00
|
|
|
/* buffer */
|
|
|
|
static void gimp_context_buffer_dirty (GimpBuffer *buffer,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2001-06-26 12:09:43 +00:00
|
|
|
static void gimp_context_buffer_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpBuffer *buffer,
|
|
|
|
GimpContext *context);
|
2001-06-26 12:09:43 +00:00
|
|
|
static void gimp_context_buffer_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2001-06-26 12:09:43 +00:00
|
|
|
static void gimp_context_real_set_buffer (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpBuffer *buffer);
|
2001-06-26 12:09:43 +00:00
|
|
|
|
2001-10-22 17:27:46 +00:00
|
|
|
/* imagefile */
|
|
|
|
static void gimp_context_imagefile_dirty (GimpImagefile *imagefile,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2001-10-22 17:27:46 +00:00
|
|
|
static void gimp_context_imagefile_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpImagefile *imagefile,
|
|
|
|
GimpContext *context);
|
2001-10-22 17:27:46 +00:00
|
|
|
static void gimp_context_imagefile_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2001-10-22 17:27:46 +00:00
|
|
|
static void gimp_context_real_set_imagefile (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpImagefile *imagefile);
|
2001-10-22 17:27:46 +00:00
|
|
|
|
2003-04-05 19:56:38 +00:00
|
|
|
/* template */
|
|
|
|
static void gimp_context_template_dirty (GimpTemplate *template,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2003-04-05 19:56:38 +00:00
|
|
|
static void gimp_context_template_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpTemplate *template,
|
|
|
|
GimpContext *context);
|
2003-04-05 19:56:38 +00:00
|
|
|
static void gimp_context_template_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context);
|
2003-04-05 19:56:38 +00:00
|
|
|
static void gimp_context_real_set_template (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpTemplate *template);
|
2003-04-05 19:56:38 +00:00
|
|
|
|
2001-02-07 15:01:52 +00:00
|
|
|
|
2022-02-08 00:30:15 +01:00
|
|
|
/* line art */
|
|
|
|
static gboolean gimp_context_free_line_art (GimpContext *context);
|
|
|
|
|
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
/* utilities */
|
|
|
|
static gpointer gimp_context_find_object (GimpContext *context,
|
|
|
|
GimpContainer *container,
|
|
|
|
const gchar *object_name,
|
|
|
|
gpointer standard_object);
|
|
|
|
|
|
|
|
|
2001-08-11 19:53:35 +00:00
|
|
|
/* properties & signals */
|
1999-11-14 10:50:19 +00:00
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-02-09 17:32:52 +00:00
|
|
|
GIMP_CONTEXT_PROP_0,
|
|
|
|
GIMP_CONTEXT_PROP_GIMP
|
|
|
|
|
2009-08-19 16:59:15 +02:00
|
|
|
/* remaining values are in core-enums.h (GimpContextPropType) */
|
1999-06-20 13:53:15 +00:00
|
|
|
};
|
|
|
|
|
2001-02-07 15:01:52 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-02-09 17:32:52 +00:00
|
|
|
DUMMY_0,
|
|
|
|
DUMMY_1,
|
2001-02-07 15:01:52 +00:00
|
|
|
IMAGE_CHANGED,
|
|
|
|
DISPLAY_CHANGED,
|
|
|
|
TOOL_CHANGED,
|
2005-12-27 18:57:01 +00:00
|
|
|
PAINT_INFO_CHANGED,
|
2001-02-07 15:01:52 +00:00
|
|
|
FOREGROUND_CHANGED,
|
|
|
|
BACKGROUND_CHANGED,
|
|
|
|
OPACITY_CHANGED,
|
|
|
|
PAINT_MODE_CHANGED,
|
|
|
|
BRUSH_CHANGED,
|
2009-10-03 16:08:15 +03:00
|
|
|
DYNAMICS_CHANGED,
|
2015-12-20 23:48:40 +01:00
|
|
|
MYBRUSH_CHANGED,
|
2001-02-07 15:01:52 +00:00
|
|
|
PATTERN_CHANGED,
|
|
|
|
GRADIENT_CHANGED,
|
2001-02-11 16:14:25 +00:00
|
|
|
PALETTE_CHANGED,
|
2003-03-25 22:06:03 +00:00
|
|
|
FONT_CHANGED,
|
2018-06-02 23:19:51 +02:00
|
|
|
TOOL_PRESET_CHANGED,
|
2001-06-26 12:09:43 +00:00
|
|
|
BUFFER_CHANGED,
|
2001-10-22 17:27:46 +00:00
|
|
|
IMAGEFILE_CHANGED,
|
2003-04-05 19:56:38 +00:00
|
|
|
TEMPLATE_CHANGED,
|
2015-02-26 22:17:45 +01:00
|
|
|
PROP_NAME_CHANGED,
|
2001-02-07 15:01:52 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2006-04-18 10:08:10 +00:00
|
|
|
static const gchar * const gimp_context_prop_names[] =
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
2003-02-09 17:32:52 +00:00
|
|
|
NULL, /* PROP_0 */
|
|
|
|
"gimp",
|
2001-08-11 19:53:35 +00:00
|
|
|
"image",
|
|
|
|
"display",
|
|
|
|
"tool",
|
2005-12-27 18:57:01 +00:00
|
|
|
"paint-info",
|
2001-08-11 19:53:35 +00:00
|
|
|
"foreground",
|
|
|
|
"background",
|
|
|
|
"opacity",
|
2003-02-09 17:32:52 +00:00
|
|
|
"paint-mode",
|
2001-08-11 19:53:35 +00:00
|
|
|
"brush",
|
2009-10-03 16:08:15 +03:00
|
|
|
"dynamics",
|
2015-12-20 23:48:40 +01:00
|
|
|
"mybrush",
|
2001-08-11 19:53:35 +00:00
|
|
|
"pattern",
|
|
|
|
"gradient",
|
|
|
|
"palette",
|
2003-03-25 22:06:03 +00:00
|
|
|
"font",
|
2018-06-02 23:19:51 +02:00
|
|
|
"tool-preset",
|
2001-10-22 17:27:46 +00:00
|
|
|
"buffer",
|
2003-04-05 19:56:38 +00:00
|
|
|
"imagefile",
|
2018-03-17 20:05:54 +01:00
|
|
|
"template"
|
1999-10-19 15:52:32 +00:00
|
|
|
};
|
|
|
|
|
2001-08-11 19:53:35 +00:00
|
|
|
static GType gimp_context_prop_types[] =
|
1999-10-26 18:27:27 +00:00
|
|
|
{
|
2003-02-09 17:32:52 +00:00
|
|
|
G_TYPE_NONE, /* PROP_0 */
|
|
|
|
G_TYPE_NONE, /* PROP_GIMP */
|
2001-02-07 15:01:52 +00:00
|
|
|
0,
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
G_TYPE_NONE,
|
2001-02-21 12:18:09 +00:00
|
|
|
0,
|
2005-12-27 18:57:01 +00:00
|
|
|
0,
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
G_TYPE_NONE,
|
|
|
|
G_TYPE_NONE,
|
|
|
|
G_TYPE_NONE,
|
|
|
|
G_TYPE_NONE,
|
2001-02-07 15:01:52 +00:00
|
|
|
0,
|
|
|
|
0,
|
2001-02-11 16:14:25 +00:00
|
|
|
0,
|
2001-06-26 12:09:43 +00:00
|
|
|
0,
|
2001-10-22 17:27:46 +00:00
|
|
|
0,
|
2003-03-25 22:06:03 +00:00
|
|
|
0,
|
2003-04-05 19:56:38 +00:00
|
|
|
0,
|
2009-08-19 13:29:06 -03:00
|
|
|
0,
|
2010-04-03 18:25:31 +03:00
|
|
|
0,
|
2015-12-20 23:48:40 +01:00
|
|
|
0,
|
2001-02-10 19:35:29 +00:00
|
|
|
0
|
1999-10-26 18:27:27 +00:00
|
|
|
};
|
|
|
|
|
2001-02-07 15:01:52 +00:00
|
|
|
|
2010-02-13 15:04:32 +01:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GimpContext, gimp_context, GIMP_TYPE_VIEWABLE,
|
2005-12-10 19:24:36 +00:00
|
|
|
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
|
2006-05-15 09:46:31 +00:00
|
|
|
gimp_context_config_iface_init))
|
2005-12-10 19:24:36 +00:00
|
|
|
|
|
|
|
#define parent_class gimp_context_parent_class
|
2001-02-07 15:01:52 +00:00
|
|
|
|
2018-06-17 14:09:55 +02:00
|
|
|
static GimpConfigInterface *parent_config_iface = NULL;
|
|
|
|
|
2005-12-10 19:24:36 +00:00
|
|
|
static guint gimp_context_signals[LAST_SIGNAL] = { 0 };
|
1999-06-17 19:13:08 +00:00
|
|
|
|
2001-02-07 15:01:52 +00:00
|
|
|
|
1999-06-17 19:13:08 +00:00
|
|
|
static void
|
|
|
|
gimp_context_class_init (GimpContextClass *klass)
|
|
|
|
{
|
2004-07-03 20:27:28 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
2023-11-14 20:04:14 +01:00
|
|
|
GeglColor *black = gegl_color_new ("black");
|
|
|
|
GeglColor *white = gegl_color_new ("white");
|
1999-11-14 10:50:19 +00:00
|
|
|
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
gimp_context_signals[IMAGE_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("image-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, image_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_IMAGE);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
|
|
|
gimp_context_signals[DISPLAY_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("display-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, display_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
2019-09-04 14:27:18 +02:00
|
|
|
GIMP_TYPE_DISPLAY);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
|
|
|
gimp_context_signals[TOOL_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("tool-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, tool_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_TOOL_INFO);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2005-12-27 18:57:01 +00:00
|
|
|
gimp_context_signals[PAINT_INFO_CHANGED] =
|
|
|
|
g_signal_new ("paint-info-changed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, paint_info_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,
|
2005-12-27 18:57:01 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_PAINT_INFO);
|
|
|
|
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
gimp_context_signals[FOREGROUND_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("foreground-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, foreground_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
2023-11-14 20:04:14 +01:00
|
|
|
GEGL_TYPE_COLOR);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
|
|
|
gimp_context_signals[BACKGROUND_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("background-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, background_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
2023-11-14 20:04:14 +01:00
|
|
|
GEGL_TYPE_COLOR);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
1999-06-17 19:13:08 +00:00
|
|
|
gimp_context_signals[OPACITY_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("opacity-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, opacity_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
G_TYPE_DOUBLE);
|
1999-06-17 19:13:08 +00:00
|
|
|
|
|
|
|
gimp_context_signals[PAINT_MODE_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("paint-mode-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, paint_mode_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
2017-01-08 23:00:19 +01:00
|
|
|
GIMP_TYPE_LAYER_MODE);
|
1999-06-17 19:13:08 +00:00
|
|
|
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
gimp_context_signals[BRUSH_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("brush-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, brush_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_BRUSH);
|
1999-06-18 18:29:27 +00:00
|
|
|
|
2009-08-17 23:47:26 -03:00
|
|
|
gimp_context_signals[DYNAMICS_CHANGED] =
|
|
|
|
g_signal_new ("dynamics-changed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, dynamics_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,
|
2009-08-17 23:47:26 -03:00
|
|
|
G_TYPE_NONE, 1,
|
2009-08-20 04:25:26 +03:00
|
|
|
GIMP_TYPE_DYNAMICS);
|
2009-08-17 23:47:26 -03:00
|
|
|
|
2015-12-20 23:48:40 +01:00
|
|
|
gimp_context_signals[MYBRUSH_CHANGED] =
|
|
|
|
g_signal_new ("mybrush-changed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, mybrush_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-20 23:48:40 +01:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_MYBRUSH);
|
|
|
|
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
gimp_context_signals[PATTERN_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("pattern-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, pattern_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_PATTERN);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
|
|
|
gimp_context_signals[GRADIENT_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("gradient-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, gradient_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_GRADIENT);
|
1999-06-18 18:29:27 +00:00
|
|
|
|
2001-02-11 16:14:25 +00:00
|
|
|
gimp_context_signals[PALETTE_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("palette-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, palette_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_PALETTE);
|
2001-02-11 16:14:25 +00:00
|
|
|
|
2018-06-02 23:19:51 +02:00
|
|
|
gimp_context_signals[FONT_CHANGED] =
|
|
|
|
g_signal_new ("font-changed",
|
2010-04-03 18:25:31 +03:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
2018-06-02 23:19:51 +02:00
|
|
|
G_STRUCT_OFFSET (GimpContextClass, font_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,
|
2010-04-03 18:25:31 +03:00
|
|
|
G_TYPE_NONE, 1,
|
2018-06-02 23:19:51 +02:00
|
|
|
GIMP_TYPE_FONT);
|
2010-04-03 18:25:31 +03:00
|
|
|
|
2018-06-02 23:19:51 +02:00
|
|
|
gimp_context_signals[TOOL_PRESET_CHANGED] =
|
|
|
|
g_signal_new ("tool-preset-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
2018-06-02 23:19:51 +02:00
|
|
|
G_STRUCT_OFFSET (GimpContextClass, tool_preset_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
2018-06-02 23:19:51 +02:00
|
|
|
GIMP_TYPE_TOOL_PRESET);
|
2003-03-25 22:06:03 +00:00
|
|
|
|
2001-06-26 12:09:43 +00:00
|
|
|
gimp_context_signals[BUFFER_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("buffer-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, buffer_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_BUFFER);
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
|
2001-10-22 17:27:46 +00:00
|
|
|
gimp_context_signals[IMAGEFILE_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("imagefile-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, imagefile_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_IMAGEFILE);
|
2001-10-22 17:27:46 +00:00
|
|
|
|
2003-04-05 19:56:38 +00:00
|
|
|
gimp_context_signals[TEMPLATE_CHANGED] =
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_new ("template-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, template_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-07-03 20:27:28 +00:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_TEMPLATE);
|
2003-04-05 19:56:38 +00:00
|
|
|
|
2015-02-26 22:17:45 +01:00
|
|
|
gimp_context_signals[PROP_NAME_CHANGED] =
|
|
|
|
g_signal_new ("prop-name-changed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContextClass, prop_name_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-02-26 22:17:45 +01:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
G_TYPE_INT);
|
|
|
|
|
2011-01-12 22:53:58 +01:00
|
|
|
object_class->constructed = gimp_context_constructed;
|
2002-01-30 16:14:26 +00:00
|
|
|
object_class->set_property = gimp_context_set_property;
|
|
|
|
object_class->get_property = gimp_context_get_property;
|
|
|
|
object_class->dispose = gimp_context_dispose;
|
|
|
|
object_class->finalize = gimp_context_finalize;
|
|
|
|
|
|
|
|
gimp_object_class->get_memsize = gimp_context_get_memsize;
|
|
|
|
|
|
|
|
klass->image_changed = NULL;
|
|
|
|
klass->display_changed = NULL;
|
|
|
|
klass->tool_changed = NULL;
|
2005-12-27 18:57:01 +00:00
|
|
|
klass->paint_info_changed = NULL;
|
2002-01-30 16:14:26 +00:00
|
|
|
klass->foreground_changed = NULL;
|
|
|
|
klass->background_changed = NULL;
|
|
|
|
klass->opacity_changed = NULL;
|
|
|
|
klass->paint_mode_changed = NULL;
|
|
|
|
klass->brush_changed = NULL;
|
2009-08-17 23:47:26 -03:00
|
|
|
klass->dynamics_changed = NULL;
|
2015-12-20 23:48:40 +01:00
|
|
|
klass->mybrush_changed = NULL;
|
2002-01-30 16:14:26 +00:00
|
|
|
klass->pattern_changed = NULL;
|
|
|
|
klass->gradient_changed = NULL;
|
|
|
|
klass->palette_changed = NULL;
|
2003-03-25 22:06:03 +00:00
|
|
|
klass->font_changed = NULL;
|
2018-06-02 23:19:51 +02:00
|
|
|
klass->tool_preset_changed = NULL;
|
2002-01-30 16:14:26 +00:00
|
|
|
klass->buffer_changed = NULL;
|
|
|
|
klass->imagefile_changed = NULL;
|
2003-04-05 19:56:38 +00:00
|
|
|
klass->template_changed = NULL;
|
2015-02-26 22:17:45 +01:00
|
|
|
klass->prop_name_changed = NULL;
|
2001-08-11 19:53:35 +00:00
|
|
|
|
2018-03-17 20:05:54 +01:00
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_IMAGE] = GIMP_TYPE_IMAGE;
|
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_TOOL] = GIMP_TYPE_TOOL_INFO;
|
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_PAINT_INFO] = GIMP_TYPE_PAINT_INFO;
|
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_BRUSH] = GIMP_TYPE_BRUSH;
|
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_DYNAMICS] = GIMP_TYPE_DYNAMICS;
|
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_MYBRUSH] = GIMP_TYPE_MYBRUSH;
|
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_PATTERN] = GIMP_TYPE_PATTERN;
|
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_GRADIENT] = GIMP_TYPE_GRADIENT;
|
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_PALETTE] = GIMP_TYPE_PALETTE;
|
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_FONT] = GIMP_TYPE_FONT;
|
2018-06-02 23:19:51 +02:00
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_TOOL_PRESET] = GIMP_TYPE_TOOL_PRESET;
|
2018-03-17 20:05:54 +01:00
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_BUFFER] = GIMP_TYPE_BUFFER;
|
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_IMAGEFILE] = GIMP_TYPE_IMAGEFILE;
|
|
|
|
gimp_context_prop_types[GIMP_CONTEXT_PROP_TEMPLATE] = GIMP_TYPE_TEMPLATE;
|
2001-08-11 19:53:35 +00:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_class_install_property (object_class, GIMP_CONTEXT_PROP_GIMP,
|
2001-12-07 17:39:51 +00:00
|
|
|
g_param_spec_object ("gimp",
|
|
|
|
NULL, NULL,
|
|
|
|
GIMP_TYPE_GIMP,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READWRITE |
|
2001-12-07 17:39:51 +00:00
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_class_install_property (object_class, GIMP_CONTEXT_PROP_IMAGE,
|
|
|
|
g_param_spec_object (gimp_context_prop_names[GIMP_CONTEXT_PROP_IMAGE],
|
|
|
|
NULL, NULL,
|
|
|
|
GIMP_TYPE_IMAGE,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READWRITE));
|
2001-08-11 19:53:35 +00:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_class_install_property (object_class, GIMP_CONTEXT_PROP_DISPLAY,
|
|
|
|
g_param_spec_object (gimp_context_prop_names[GIMP_CONTEXT_PROP_DISPLAY],
|
2002-05-10 13:09:19 +00:00
|
|
|
NULL, NULL,
|
2019-09-04 14:27:18 +02:00
|
|
|
GIMP_TYPE_DISPLAY,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READWRITE));
|
2001-08-11 19:53:35 +00:00
|
|
|
|
2016-02-11 23:44:07 +01:00
|
|
|
GIMP_CONFIG_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_TOOL,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_TOOL],
|
|
|
|
NULL, NULL,
|
|
|
|
GIMP_TYPE_TOOL_INFO,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
GIMP_CONFIG_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_PAINT_INFO,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_PAINT_INFO],
|
|
|
|
NULL, NULL,
|
|
|
|
GIMP_TYPE_PAINT_INFO,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
|
|
|
|
2023-11-14 20:04:14 +01:00
|
|
|
GIMP_CONFIG_PROP_COLOR (object_class, GIMP_CONTEXT_PROP_FOREGROUND,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_FOREGROUND],
|
|
|
|
_("Foreground"),
|
|
|
|
_("Foreground color"),
|
|
|
|
black,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2016-02-11 23:44:07 +01:00
|
|
|
|
2023-11-14 20:04:14 +01:00
|
|
|
GIMP_CONFIG_PROP_COLOR (object_class, GIMP_CONTEXT_PROP_BACKGROUND,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_BACKGROUND],
|
|
|
|
_("Background"),
|
|
|
|
_("Background color"),
|
|
|
|
white,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2016-02-11 23:44:07 +01:00
|
|
|
|
|
|
|
GIMP_CONFIG_PROP_DOUBLE (object_class, GIMP_CONTEXT_PROP_OPACITY,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_OPACITY],
|
|
|
|
_("Opacity"),
|
|
|
|
_("Opacity"),
|
|
|
|
GIMP_OPACITY_TRANSPARENT,
|
|
|
|
GIMP_OPACITY_OPAQUE,
|
|
|
|
GIMP_OPACITY_OPAQUE,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
GIMP_CONFIG_PROP_ENUM (object_class, GIMP_CONTEXT_PROP_PAINT_MODE,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_PAINT_MODE],
|
|
|
|
_("Paint Mode"),
|
|
|
|
_("Paint Mode"),
|
2017-01-08 23:00:19 +01:00
|
|
|
GIMP_TYPE_LAYER_MODE,
|
2018-04-24 13:56:51 +02:00
|
|
|
GIMP_LAYER_MODE_NORMAL,
|
2016-02-11 23:44:07 +01:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
GIMP_CONFIG_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_BRUSH,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_BRUSH],
|
|
|
|
_("Brush"),
|
|
|
|
_("Brush"),
|
|
|
|
GIMP_TYPE_BRUSH,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
GIMP_CONFIG_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_DYNAMICS,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_DYNAMICS],
|
|
|
|
_("Dynamics"),
|
|
|
|
_("Paint dynamics"),
|
|
|
|
GIMP_TYPE_DYNAMICS,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
GIMP_CONFIG_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_MYBRUSH,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_MYBRUSH],
|
|
|
|
_("MyPaint Brush"),
|
|
|
|
_("MyPaint Brush"),
|
|
|
|
GIMP_TYPE_MYBRUSH,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
GIMP_CONFIG_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_PATTERN,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_PATTERN],
|
|
|
|
_("Pattern"),
|
|
|
|
_("Pattern"),
|
|
|
|
GIMP_TYPE_PATTERN,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
GIMP_CONFIG_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_GRADIENT,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_GRADIENT],
|
|
|
|
_("Gradient"),
|
|
|
|
_("Gradient"),
|
|
|
|
GIMP_TYPE_GRADIENT,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
GIMP_CONFIG_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_PALETTE,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_PALETTE],
|
|
|
|
_("Palette"),
|
|
|
|
_("Palette"),
|
|
|
|
GIMP_TYPE_PALETTE,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
|
|
|
|
|
|
|
GIMP_CONFIG_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_FONT,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_FONT],
|
|
|
|
_("Font"),
|
|
|
|
_("Font"),
|
|
|
|
GIMP_TYPE_FONT,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-03-25 22:06:03 +00:00
|
|
|
|
2018-06-02 23:19:51 +02:00
|
|
|
GIMP_CONFIG_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_TOOL_PRESET,
|
|
|
|
gimp_context_prop_names[GIMP_CONTEXT_PROP_TOOL_PRESET],
|
|
|
|
_("Tool Preset"),
|
|
|
|
_("Tool Preset"),
|
|
|
|
GIMP_TYPE_TOOL_PRESET,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_class_install_property (object_class, GIMP_CONTEXT_PROP_BUFFER,
|
2004-07-03 20:27:28 +00:00
|
|
|
g_param_spec_object (gimp_context_prop_names[GIMP_CONTEXT_PROP_BUFFER],
|
|
|
|
NULL, NULL,
|
|
|
|
GIMP_TYPE_BUFFER,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READWRITE));
|
2001-10-22 17:27:46 +00:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_class_install_property (object_class, GIMP_CONTEXT_PROP_IMAGEFILE,
|
2004-07-03 20:27:28 +00:00
|
|
|
g_param_spec_object (gimp_context_prop_names[GIMP_CONTEXT_PROP_IMAGEFILE],
|
|
|
|
NULL, NULL,
|
|
|
|
GIMP_TYPE_IMAGEFILE,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READWRITE));
|
2003-04-05 19:56:38 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class, GIMP_CONTEXT_PROP_TEMPLATE,
|
2004-07-03 20:27:28 +00:00
|
|
|
g_param_spec_object (gimp_context_prop_names[GIMP_CONTEXT_PROP_TEMPLATE],
|
|
|
|
NULL, NULL,
|
|
|
|
GIMP_TYPE_TEMPLATE,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READWRITE));
|
2023-11-14 20:04:14 +01:00
|
|
|
|
|
|
|
g_object_unref (black);
|
|
|
|
g_object_unref (white);
|
1999-06-17 19:13:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_init (GimpContext *context)
|
|
|
|
{
|
2004-07-03 20:27:28 +00:00
|
|
|
context->gimp = NULL;
|
2004-01-29 16:34:41 +00:00
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
context->parent = NULL;
|
2001-07-04 19:31:35 +00:00
|
|
|
|
2015-09-08 21:18:49 +02:00
|
|
|
context->defined_props = GIMP_CONTEXT_PROP_MASK_ALL;
|
|
|
|
context->serialize_props = GIMP_CONTEXT_PROP_MASK_ALL;
|
1999-06-18 18:29:27 +00:00
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
context->image = NULL;
|
|
|
|
context->display = NULL;
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
context->tool_info = NULL;
|
|
|
|
context->tool_name = NULL;
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2005-12-27 18:57:01 +00:00
|
|
|
context->paint_info = NULL;
|
|
|
|
context->paint_name = NULL;
|
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
context->brush = NULL;
|
|
|
|
context->brush_name = NULL;
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2009-08-19 13:29:06 -03:00
|
|
|
context->dynamics = NULL;
|
|
|
|
context->dynamics_name = NULL;
|
|
|
|
|
2015-12-20 23:48:40 +01:00
|
|
|
context->mybrush = NULL;
|
|
|
|
context->mybrush_name = NULL;
|
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
context->pattern = NULL;
|
|
|
|
context->pattern_name = NULL;
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
context->gradient = NULL;
|
|
|
|
context->gradient_name = NULL;
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
context->palette = NULL;
|
|
|
|
context->palette_name = NULL;
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
context->font = NULL;
|
|
|
|
context->font_name = NULL;
|
2001-02-11 16:14:25 +00:00
|
|
|
|
2018-06-02 23:19:51 +02:00
|
|
|
context->tool_preset = NULL;
|
|
|
|
context->tool_preset_name = NULL;
|
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
context->buffer = NULL;
|
|
|
|
context->buffer_name = NULL;
|
2003-03-25 22:06:03 +00:00
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
context->imagefile = NULL;
|
|
|
|
context->imagefile_name = NULL;
|
2004-01-29 16:34:41 +00:00
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
context->template = NULL;
|
|
|
|
context->template_name = NULL;
|
2022-02-08 00:30:15 +01:00
|
|
|
|
|
|
|
context->line_art = NULL;
|
|
|
|
context->line_art_timeout_id = 0;
|
2023-11-13 23:29:20 +01:00
|
|
|
|
2023-11-14 20:04:14 +01:00
|
|
|
context->foreground = gegl_color_new ("black");
|
|
|
|
context->background = gegl_color_new ("white");
|
1999-06-17 19:13:08 +00:00
|
|
|
}
|
|
|
|
|
2002-05-22 13:19:19 +00:00
|
|
|
static void
|
2005-12-10 19:24:36 +00:00
|
|
|
gimp_context_config_iface_init (GimpConfigInterface *iface)
|
2002-05-22 13:19:19 +00:00
|
|
|
{
|
2018-06-17 14:09:55 +02:00
|
|
|
parent_config_iface = g_type_interface_peek_parent (iface);
|
|
|
|
|
|
|
|
if (! parent_config_iface)
|
|
|
|
parent_config_iface = g_type_default_interface_peek (GIMP_TYPE_CONFIG);
|
|
|
|
|
2005-12-10 19:24:36 +00:00
|
|
|
iface->serialize = gimp_context_serialize;
|
2015-04-27 17:48:00 -04:00
|
|
|
iface->deserialize = gimp_context_deserialize;
|
2005-12-10 19:24:36 +00:00
|
|
|
iface->serialize_property = gimp_context_serialize_property;
|
|
|
|
iface->deserialize_property = gimp_context_deserialize_property;
|
2018-06-17 14:09:55 +02:00
|
|
|
iface->duplicate = gimp_context_duplicate;
|
|
|
|
iface->copy = gimp_context_copy;
|
2002-05-22 13:19:19 +00:00
|
|
|
}
|
|
|
|
|
2011-01-12 22:53:58 +01:00
|
|
|
static void
|
|
|
|
gimp_context_constructed (GObject *object)
|
2002-05-28 16:41:56 +00:00
|
|
|
{
|
2010-06-26 15:49:10 +02:00
|
|
|
Gimp *gimp;
|
|
|
|
GimpContainer *container;
|
2002-05-28 16:41:56 +00:00
|
|
|
|
2012-11-12 21:51:22 +01:00
|
|
|
G_OBJECT_CLASS (parent_class)->constructed (object);
|
2002-05-28 16:41:56 +00:00
|
|
|
|
|
|
|
gimp = GIMP_CONTEXT (object)->gimp;
|
|
|
|
|
2018-02-11 22:23:10 +01:00
|
|
|
gimp_assert (GIMP_IS_GIMP (gimp));
|
2002-05-28 16:41:56 +00:00
|
|
|
|
2003-10-14 16:40:02 +00:00
|
|
|
gimp->context_list = g_list_prepend (gimp->context_list, object);
|
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect_object (gimp->images, "remove",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_image_removed),
|
|
|
|
object, 0);
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect_object (gimp->displays, "remove",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_display_removed),
|
|
|
|
object, 0);
|
2002-05-28 16:41:56 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect_object (gimp->tool_info_list, "remove",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_tool_removed),
|
|
|
|
object, 0);
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect_object (gimp->tool_info_list, "thaw",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_tool_list_thaw),
|
|
|
|
object, 0);
|
2002-05-28 16:41:56 +00:00
|
|
|
|
2005-12-27 18:57:01 +00:00
|
|
|
g_signal_connect_object (gimp->paint_info_list, "remove",
|
|
|
|
G_CALLBACK (gimp_context_paint_info_removed),
|
|
|
|
object, 0);
|
|
|
|
g_signal_connect_object (gimp->paint_info_list, "thaw",
|
|
|
|
G_CALLBACK (gimp_context_paint_info_list_thaw),
|
|
|
|
object, 0);
|
|
|
|
|
2010-06-26 15:49:10 +02:00
|
|
|
container = gimp_data_factory_get_container (gimp->brush_factory);
|
|
|
|
g_signal_connect_object (container, "remove",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_brush_removed),
|
|
|
|
object, 0);
|
2010-06-26 15:49:10 +02:00
|
|
|
g_signal_connect_object (container, "thaw",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_brush_list_thaw),
|
|
|
|
object, 0);
|
2002-05-28 16:41:56 +00:00
|
|
|
|
2010-06-26 15:49:10 +02:00
|
|
|
container = gimp_data_factory_get_container (gimp->dynamics_factory);
|
|
|
|
g_signal_connect_object (container, "remove",
|
2009-08-17 23:47:26 -03:00
|
|
|
G_CALLBACK (gimp_context_dynamics_removed),
|
|
|
|
object, 0);
|
2010-06-26 15:49:10 +02:00
|
|
|
g_signal_connect_object (container, "thaw",
|
2009-08-17 23:47:26 -03:00
|
|
|
G_CALLBACK (gimp_context_dynamics_list_thaw),
|
|
|
|
object, 0);
|
|
|
|
|
2015-12-20 23:48:40 +01:00
|
|
|
container = gimp_data_factory_get_container (gimp->mybrush_factory);
|
|
|
|
g_signal_connect_object (container, "remove",
|
|
|
|
G_CALLBACK (gimp_context_mybrush_removed),
|
|
|
|
object, 0);
|
|
|
|
g_signal_connect_object (container, "thaw",
|
|
|
|
G_CALLBACK (gimp_context_mybrush_list_thaw),
|
|
|
|
object, 0);
|
|
|
|
|
2010-06-26 15:49:10 +02:00
|
|
|
container = gimp_data_factory_get_container (gimp->pattern_factory);
|
|
|
|
g_signal_connect_object (container, "remove",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_pattern_removed),
|
|
|
|
object, 0);
|
2010-06-26 15:49:10 +02:00
|
|
|
g_signal_connect_object (container, "thaw",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_pattern_list_thaw),
|
|
|
|
object, 0);
|
2002-05-28 16:41:56 +00:00
|
|
|
|
2010-06-26 15:49:10 +02:00
|
|
|
container = gimp_data_factory_get_container (gimp->gradient_factory);
|
|
|
|
g_signal_connect_object (container, "remove",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_gradient_removed),
|
|
|
|
object, 0);
|
2010-06-26 15:49:10 +02:00
|
|
|
g_signal_connect_object (container, "thaw",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_gradient_list_thaw),
|
|
|
|
object, 0);
|
2002-05-28 16:41:56 +00:00
|
|
|
|
2010-06-26 15:49:10 +02:00
|
|
|
container = gimp_data_factory_get_container (gimp->palette_factory);
|
|
|
|
g_signal_connect_object (container, "remove",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_palette_removed),
|
|
|
|
object, 0);
|
2010-06-26 15:49:10 +02:00
|
|
|
g_signal_connect_object (container, "thaw",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_palette_list_thaw),
|
|
|
|
object, 0);
|
2002-05-28 16:41:56 +00:00
|
|
|
|
2018-06-02 23:19:51 +02:00
|
|
|
container = gimp_data_factory_get_container (gimp->font_factory);
|
2010-06-26 15:49:10 +02:00
|
|
|
g_signal_connect_object (container, "remove",
|
2018-06-02 23:19:51 +02:00
|
|
|
G_CALLBACK (gimp_context_font_removed),
|
2010-04-03 18:25:31 +03:00
|
|
|
object, 0);
|
2010-06-26 15:49:10 +02:00
|
|
|
g_signal_connect_object (container, "thaw",
|
2018-06-02 23:19:51 +02:00
|
|
|
G_CALLBACK (gimp_context_font_list_thaw),
|
2010-04-03 18:25:31 +03:00
|
|
|
object, 0);
|
|
|
|
|
2018-06-02 23:19:51 +02:00
|
|
|
container = gimp_data_factory_get_container (gimp->tool_preset_factory);
|
|
|
|
g_signal_connect_object (container, "remove",
|
|
|
|
G_CALLBACK (gimp_context_tool_preset_removed),
|
2003-10-14 16:40:02 +00:00
|
|
|
object, 0);
|
2018-06-02 23:19:51 +02:00
|
|
|
g_signal_connect_object (container, "thaw",
|
|
|
|
G_CALLBACK (gimp_context_tool_preset_list_thaw),
|
2003-10-14 16:40:02 +00:00
|
|
|
object, 0);
|
2003-03-25 22:06:03 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect_object (gimp->named_buffers, "remove",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_buffer_removed),
|
|
|
|
object, 0);
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect_object (gimp->named_buffers, "thaw",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_CALLBACK (gimp_context_buffer_list_thaw),
|
|
|
|
object, 0);
|
2002-05-28 16:41:56 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect_object (gimp->documents, "remove",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_imagefile_removed),
|
|
|
|
object, 0);
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect_object (gimp->documents, "thaw",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_imagefile_list_thaw),
|
|
|
|
object, 0);
|
2002-05-28 16:41:56 +00:00
|
|
|
|
2003-04-05 19:56:38 +00:00
|
|
|
g_signal_connect_object (gimp->templates, "remove",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_template_removed),
|
|
|
|
object, 0);
|
2003-04-05 19:56:38 +00:00
|
|
|
g_signal_connect_object (gimp->templates, "thaw",
|
2003-10-14 16:40:02 +00:00
|
|
|
G_CALLBACK (gimp_context_template_list_thaw),
|
|
|
|
object, 0);
|
2018-03-18 13:47:25 +01:00
|
|
|
|
|
|
|
gimp_context_set_paint_info (GIMP_CONTEXT (object),
|
|
|
|
gimp_paint_info_get_standard (gimp));
|
2002-05-28 16:41:56 +00:00
|
|
|
}
|
|
|
|
|
2001-12-07 17:39:51 +00:00
|
|
|
static void
|
|
|
|
gimp_context_dispose (GObject *object)
|
|
|
|
{
|
2003-10-14 16:40:02 +00:00
|
|
|
GimpContext *context = GIMP_CONTEXT (object);
|
2001-12-07 17:39:51 +00:00
|
|
|
|
2018-04-25 19:20:12 +02:00
|
|
|
gimp_context_set_parent (context, NULL);
|
|
|
|
|
2001-12-07 17:39:51 +00:00
|
|
|
if (context->gimp)
|
|
|
|
{
|
|
|
|
context->gimp->context_list = g_list_remove (context->gimp->context_list,
|
|
|
|
context);
|
|
|
|
context->gimp = NULL;
|
|
|
|
}
|
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_object (&context->tool_info);
|
|
|
|
g_clear_object (&context->paint_info);
|
|
|
|
g_clear_object (&context->brush);
|
|
|
|
g_clear_object (&context->dynamics);
|
|
|
|
g_clear_object (&context->mybrush);
|
|
|
|
g_clear_object (&context->pattern);
|
|
|
|
g_clear_object (&context->gradient);
|
|
|
|
g_clear_object (&context->palette);
|
|
|
|
g_clear_object (&context->font);
|
2018-06-02 23:19:51 +02:00
|
|
|
g_clear_object (&context->tool_preset);
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_object (&context->buffer);
|
|
|
|
g_clear_object (&context->imagefile);
|
|
|
|
g_clear_object (&context->template);
|
2010-06-24 12:57:46 +02:00
|
|
|
|
2001-12-07 17:39:51 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2001-02-07 15:01:52 +00:00
|
|
|
static void
|
2001-08-11 19:53:35 +00:00
|
|
|
gimp_context_finalize (GObject *object)
|
2001-02-07 15:01:52 +00:00
|
|
|
{
|
2003-10-14 16:40:02 +00:00
|
|
|
GimpContext *context = GIMP_CONTEXT (object);
|
2001-02-07 15:01:52 +00:00
|
|
|
|
2003-11-19 01:02:19 +00:00
|
|
|
context->parent = NULL;
|
2001-04-23 16:58:18 +00:00
|
|
|
context->image = NULL;
|
|
|
|
context->display = NULL;
|
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_pointer (&context->tool_name, g_free);
|
|
|
|
g_clear_pointer (&context->paint_name, g_free);
|
|
|
|
g_clear_pointer (&context->brush_name, g_free);
|
|
|
|
g_clear_pointer (&context->dynamics_name, g_free);
|
|
|
|
g_clear_pointer (&context->mybrush_name, g_free);
|
|
|
|
g_clear_pointer (&context->pattern_name, g_free);
|
|
|
|
g_clear_pointer (&context->gradient_name, g_free);
|
|
|
|
g_clear_pointer (&context->palette_name, g_free);
|
|
|
|
g_clear_pointer (&context->font_name, g_free);
|
2018-06-02 23:19:51 +02:00
|
|
|
g_clear_pointer (&context->tool_preset_name, g_free);
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_pointer (&context->buffer_name, g_free);
|
|
|
|
g_clear_pointer (&context->imagefile_name, g_free);
|
|
|
|
g_clear_pointer (&context->template_name, g_free);
|
2003-04-05 19:56:38 +00:00
|
|
|
|
2022-02-08 00:30:15 +01:00
|
|
|
g_clear_object (&context->line_art);
|
2023-11-13 23:29:20 +01:00
|
|
|
g_clear_object (&context->foreground);
|
|
|
|
g_clear_object (&context->background);
|
2022-02-08 00:30:15 +01:00
|
|
|
|
2001-08-11 19:53:35 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2001-02-07 15:01:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-08-11 19:53:35 +00:00
|
|
|
gimp_context_set_property (GObject *object,
|
2004-07-03 20:27:28 +00:00
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2001-02-07 15:01:52 +00:00
|
|
|
{
|
2003-10-14 16:40:02 +00:00
|
|
|
GimpContext *context = GIMP_CONTEXT (object);
|
2001-02-07 15:01:52 +00:00
|
|
|
|
2001-08-11 19:53:35 +00:00
|
|
|
switch (property_id)
|
2001-02-07 15:01:52 +00:00
|
|
|
{
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_GIMP:
|
2001-12-07 17:39:51 +00:00
|
|
|
context->gimp = g_value_get_object (value);
|
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_IMAGE:
|
2001-08-11 21:10:44 +00:00
|
|
|
gimp_context_set_image (context, g_value_get_object (value));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_DISPLAY:
|
2002-05-10 13:09:19 +00:00
|
|
|
gimp_context_set_display (context, g_value_get_object (value));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_TOOL:
|
2001-08-11 21:10:44 +00:00
|
|
|
gimp_context_set_tool (context, g_value_get_object (value));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2005-12-27 18:57:01 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PAINT_INFO:
|
|
|
|
gimp_context_set_paint_info (context, g_value_get_object (value));
|
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_FOREGROUND:
|
2023-11-14 20:04:14 +01:00
|
|
|
gimp_context_set_foreground (context, g_value_get_object (value));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_BACKGROUND:
|
2023-11-14 20:04:14 +01:00
|
|
|
gimp_context_set_background (context, g_value_get_object (value));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_OPACITY:
|
2001-08-11 19:53:35 +00:00
|
|
|
gimp_context_set_opacity (context, g_value_get_double (value));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PAINT_MODE:
|
2002-05-21 15:01:57 +00:00
|
|
|
gimp_context_set_paint_mode (context, g_value_get_enum (value));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_BRUSH:
|
2001-08-11 21:10:44 +00:00
|
|
|
gimp_context_set_brush (context, g_value_get_object (value));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2009-08-17 23:47:26 -03:00
|
|
|
case GIMP_CONTEXT_PROP_DYNAMICS:
|
|
|
|
gimp_context_set_dynamics (context, g_value_get_object (value));
|
|
|
|
break;
|
2015-12-20 23:48:40 +01:00
|
|
|
case GIMP_CONTEXT_PROP_MYBRUSH:
|
|
|
|
gimp_context_set_mybrush (context, g_value_get_object (value));
|
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PATTERN:
|
2001-08-11 21:10:44 +00:00
|
|
|
gimp_context_set_pattern (context, g_value_get_object (value));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_GRADIENT:
|
2001-08-11 21:10:44 +00:00
|
|
|
gimp_context_set_gradient (context, g_value_get_object (value));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PALETTE:
|
2001-08-11 21:10:44 +00:00
|
|
|
gimp_context_set_palette (context, g_value_get_object (value));
|
2001-02-11 16:14:25 +00:00
|
|
|
break;
|
2003-03-25 22:06:03 +00:00
|
|
|
case GIMP_CONTEXT_PROP_FONT:
|
|
|
|
gimp_context_set_font (context, g_value_get_object (value));
|
|
|
|
break;
|
2018-06-02 23:19:51 +02:00
|
|
|
case GIMP_CONTEXT_PROP_TOOL_PRESET:
|
|
|
|
gimp_context_set_tool_preset (context, g_value_get_object (value));
|
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_BUFFER:
|
2001-08-11 21:10:44 +00:00
|
|
|
gimp_context_set_buffer (context, g_value_get_object (value));
|
2001-06-26 12:09:43 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_IMAGEFILE:
|
2001-10-22 17:27:46 +00:00
|
|
|
gimp_context_set_imagefile (context, g_value_get_object (value));
|
|
|
|
break;
|
2003-04-05 19:56:38 +00:00
|
|
|
case GIMP_CONTEXT_PROP_TEMPLATE:
|
|
|
|
gimp_context_set_template (context, g_value_get_object (value));
|
|
|
|
break;
|
2001-02-07 15:01:52 +00:00
|
|
|
default:
|
2001-08-11 19:53:35 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-08-11 19:53:35 +00:00
|
|
|
gimp_context_get_property (GObject *object,
|
2004-07-03 20:27:28 +00:00
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2001-02-07 15:01:52 +00:00
|
|
|
{
|
2003-10-14 16:40:02 +00:00
|
|
|
GimpContext *context = GIMP_CONTEXT (object);
|
2001-02-07 15:01:52 +00:00
|
|
|
|
2001-08-11 19:53:35 +00:00
|
|
|
switch (property_id)
|
2001-02-07 15:01:52 +00:00
|
|
|
{
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_GIMP:
|
2001-12-07 17:39:51 +00:00
|
|
|
g_value_set_object (value, context->gimp);
|
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_IMAGE:
|
2001-08-11 21:10:44 +00:00
|
|
|
g_value_set_object (value, gimp_context_get_image (context));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_DISPLAY:
|
2002-05-10 13:09:19 +00:00
|
|
|
g_value_set_object (value, gimp_context_get_display (context));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_TOOL:
|
2001-08-11 21:10:44 +00:00
|
|
|
g_value_set_object (value, gimp_context_get_tool (context));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2005-12-27 18:57:01 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PAINT_INFO:
|
|
|
|
g_value_set_object (value, gimp_context_get_paint_info (context));
|
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_FOREGROUND:
|
2023-11-14 20:04:14 +01:00
|
|
|
g_value_take_object (value, gegl_color_duplicate (gimp_context_get_foreground (context)));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_BACKGROUND:
|
2023-11-14 20:04:14 +01:00
|
|
|
g_value_take_object (value, gegl_color_duplicate (gimp_context_get_background (context)));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_OPACITY:
|
2001-08-11 19:53:35 +00:00
|
|
|
g_value_set_double (value, gimp_context_get_opacity (context));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PAINT_MODE:
|
2002-05-21 15:01:57 +00:00
|
|
|
g_value_set_enum (value, gimp_context_get_paint_mode (context));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_BRUSH:
|
2001-08-11 21:10:44 +00:00
|
|
|
g_value_set_object (value, gimp_context_get_brush (context));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2009-08-17 23:47:26 -03:00
|
|
|
case GIMP_CONTEXT_PROP_DYNAMICS:
|
|
|
|
g_value_set_object (value, gimp_context_get_dynamics (context));
|
|
|
|
break;
|
2015-12-20 23:48:40 +01:00
|
|
|
case GIMP_CONTEXT_PROP_MYBRUSH:
|
|
|
|
g_value_set_object (value, gimp_context_get_mybrush (context));
|
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PATTERN:
|
2001-08-11 21:10:44 +00:00
|
|
|
g_value_set_object (value, gimp_context_get_pattern (context));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_GRADIENT:
|
2001-08-11 21:10:44 +00:00
|
|
|
g_value_set_object (value, gimp_context_get_gradient (context));
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PALETTE:
|
2001-08-11 21:10:44 +00:00
|
|
|
g_value_set_object (value, gimp_context_get_palette (context));
|
2001-02-11 16:14:25 +00:00
|
|
|
break;
|
2003-03-25 22:06:03 +00:00
|
|
|
case GIMP_CONTEXT_PROP_FONT:
|
|
|
|
g_value_set_object (value, gimp_context_get_font (context));
|
|
|
|
break;
|
2018-06-02 23:19:51 +02:00
|
|
|
case GIMP_CONTEXT_PROP_TOOL_PRESET:
|
|
|
|
g_value_set_object (value, gimp_context_get_tool_preset (context));
|
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_BUFFER:
|
2001-08-11 21:10:44 +00:00
|
|
|
g_value_set_object (value, gimp_context_get_buffer (context));
|
2001-06-26 12:09:43 +00:00
|
|
|
break;
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_IMAGEFILE:
|
2001-10-22 17:27:46 +00:00
|
|
|
g_value_set_object (value, gimp_context_get_imagefile (context));
|
|
|
|
break;
|
2003-04-05 19:56:38 +00:00
|
|
|
case GIMP_CONTEXT_PROP_TEMPLATE:
|
|
|
|
g_value_set_object (value, gimp_context_get_template (context));
|
|
|
|
break;
|
2001-02-07 15:01:52 +00:00
|
|
|
default:
|
2001-08-11 19:53:35 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
2001-02-07 15:01:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-16 17:51:36 +00:00
|
|
|
static gint64
|
2003-08-25 10:49:33 +00:00
|
|
|
gimp_context_get_memsize (GimpObject *object,
|
2003-11-16 17:51:36 +00:00
|
|
|
gint64 *gui_size)
|
2002-01-30 16:14:26 +00:00
|
|
|
{
|
2003-10-14 16:40:02 +00:00
|
|
|
GimpContext *context = GIMP_CONTEXT (object);
|
2003-11-16 17:51:36 +00:00
|
|
|
gint64 memsize = 0;
|
2002-01-30 16:14:26 +00:00
|
|
|
|
2007-11-16 18:19:30 +00:00
|
|
|
memsize += gimp_string_get_memsize (context->tool_name);
|
|
|
|
memsize += gimp_string_get_memsize (context->paint_name);
|
|
|
|
memsize += gimp_string_get_memsize (context->brush_name);
|
2010-04-01 20:46:31 +02:00
|
|
|
memsize += gimp_string_get_memsize (context->dynamics_name);
|
2015-12-20 23:48:40 +01:00
|
|
|
memsize += gimp_string_get_memsize (context->mybrush_name);
|
2007-11-16 18:19:30 +00:00
|
|
|
memsize += gimp_string_get_memsize (context->pattern_name);
|
|
|
|
memsize += gimp_string_get_memsize (context->palette_name);
|
|
|
|
memsize += gimp_string_get_memsize (context->font_name);
|
2018-06-02 23:19:51 +02:00
|
|
|
memsize += gimp_string_get_memsize (context->tool_preset_name);
|
2007-11-16 18:19:30 +00:00
|
|
|
memsize += gimp_string_get_memsize (context->buffer_name);
|
|
|
|
memsize += gimp_string_get_memsize (context->imagefile_name);
|
|
|
|
memsize += gimp_string_get_memsize (context->template_name);
|
2004-01-29 16:34:41 +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-02-28 13:58:19 +00:00
|
|
|
static gboolean
|
2003-10-11 14:30:18 +00:00
|
|
|
gimp_context_serialize (GimpConfig *config,
|
2003-03-05 20:21:50 +00:00
|
|
|
GimpConfigWriter *writer,
|
|
|
|
gpointer data)
|
2003-02-28 13:58:19 +00:00
|
|
|
{
|
2003-10-11 14:30:18 +00:00
|
|
|
return gimp_config_serialize_changed_properties (config, writer);
|
2003-02-28 13:58:19 +00:00
|
|
|
}
|
|
|
|
|
2015-04-27 17:48:00 -04:00
|
|
|
static gboolean
|
|
|
|
gimp_context_deserialize (GimpConfig *config,
|
|
|
|
GScanner *scanner,
|
|
|
|
gint nest_level,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2017-01-08 23:00:19 +01:00
|
|
|
GimpContext *context = GIMP_CONTEXT (config);
|
|
|
|
GimpLayerMode old_paint_mode = context->paint_mode;
|
|
|
|
gboolean success;
|
2015-04-27 17:48:00 -04:00
|
|
|
|
|
|
|
success = gimp_config_deserialize_properties (config, scanner, nest_level);
|
|
|
|
|
|
|
|
if (context->paint_mode != old_paint_mode)
|
|
|
|
{
|
2017-01-09 01:27:20 +01:00
|
|
|
if (context->paint_mode == GIMP_LAYER_MODE_OVERLAY_LEGACY)
|
2017-01-08 23:00:19 +01:00
|
|
|
g_object_set (context,
|
2017-01-09 01:27:20 +01:00
|
|
|
"paint-mode", GIMP_LAYER_MODE_SOFTLIGHT_LEGACY,
|
2017-01-08 23:00:19 +01:00
|
|
|
NULL);
|
2015-04-27 17:48:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2002-05-22 13:19:19 +00:00
|
|
|
static gboolean
|
2003-10-11 14:30:18 +00:00
|
|
|
gimp_context_serialize_property (GimpConfig *config,
|
2003-03-05 20:21:50 +00:00
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GimpConfigWriter *writer)
|
2002-05-22 13:19:19 +00:00
|
|
|
{
|
2004-03-11 19:13:49 +00:00
|
|
|
GimpContext *context = GIMP_CONTEXT (config);
|
2002-05-22 13:19:19 +00:00
|
|
|
GimpObject *serialize_obj;
|
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
/* serialize nothing if the property is not in serialize_props */
|
|
|
|
if (! ((1 << property_id) & context->serialize_props))
|
2003-02-09 17:32:52 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2002-05-22 13:19:19 +00:00
|
|
|
switch (property_id)
|
|
|
|
{
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_TOOL:
|
2005-12-27 18:57:01 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PAINT_INFO:
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_BRUSH:
|
2009-08-17 23:47:26 -03:00
|
|
|
case GIMP_CONTEXT_PROP_DYNAMICS:
|
2015-12-20 23:48:40 +01:00
|
|
|
case GIMP_CONTEXT_PROP_MYBRUSH:
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PATTERN:
|
|
|
|
case GIMP_CONTEXT_PROP_GRADIENT:
|
|
|
|
case GIMP_CONTEXT_PROP_PALETTE:
|
2003-03-25 22:06:03 +00:00
|
|
|
case GIMP_CONTEXT_PROP_FONT:
|
2018-06-02 23:19:51 +02:00
|
|
|
case GIMP_CONTEXT_PROP_TOOL_PRESET:
|
2003-03-10 15:48:16 +00:00
|
|
|
serialize_obj = g_value_get_object (value);
|
2002-05-22 13:19:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-04-12 19:06:25 +00:00
|
|
|
gimp_config_writer_open (writer, pspec->name);
|
|
|
|
|
2002-05-24 02:53:20 +00:00
|
|
|
if (serialize_obj)
|
2003-04-13 12:27:44 +00:00
|
|
|
gimp_config_writer_string (writer, gimp_object_get_name (serialize_obj));
|
2002-05-24 02:53:20 +00:00
|
|
|
else
|
2003-04-13 12:27:44 +00:00
|
|
|
gimp_config_writer_print (writer, "NULL", 4);
|
2002-05-22 13:19:19 +00:00
|
|
|
|
2003-04-12 19:06:25 +00:00
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
|
2002-05-22 13:19:19 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-10-11 14:30:18 +00:00
|
|
|
gimp_context_deserialize_property (GimpConfig *object,
|
2002-05-22 13:19:19 +00:00
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GScanner *scanner,
|
|
|
|
GTokenType *expected)
|
|
|
|
{
|
2004-03-11 19:13:49 +00:00
|
|
|
GimpContext *context = GIMP_CONTEXT (object);
|
2002-05-22 13:19:19 +00:00
|
|
|
GimpContainer *container;
|
2018-06-17 14:09:55 +02:00
|
|
|
gpointer standard;
|
2002-05-27 14:04:21 +00:00
|
|
|
gchar **name_loc;
|
2002-05-22 13:19:19 +00:00
|
|
|
gchar *object_name;
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_TOOL:
|
2002-05-22 13:19:19 +00:00
|
|
|
container = context->gimp->tool_info_list;
|
2018-06-17 14:09:55 +02:00
|
|
|
standard = gimp_tool_info_get_standard (context->gimp);
|
2002-05-27 14:04:21 +00:00
|
|
|
name_loc = &context->tool_name;
|
2002-05-22 13:19:19 +00:00
|
|
|
break;
|
|
|
|
|
2005-12-27 18:57:01 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PAINT_INFO:
|
|
|
|
container = context->gimp->paint_info_list;
|
2018-06-17 14:09:55 +02:00
|
|
|
standard = gimp_paint_info_get_standard (context->gimp);
|
2005-12-27 18:57:01 +00:00
|
|
|
name_loc = &context->paint_name;
|
|
|
|
break;
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_BRUSH:
|
2008-12-19 21:58:17 +00:00
|
|
|
container = gimp_data_factory_get_container (context->gimp->brush_factory);
|
2018-06-17 14:09:55 +02:00
|
|
|
standard = gimp_brush_get_standard (context);
|
2002-05-27 14:04:21 +00:00
|
|
|
name_loc = &context->brush_name;
|
2002-05-22 13:19:19 +00:00
|
|
|
break;
|
|
|
|
|
2009-08-17 23:47:26 -03:00
|
|
|
case GIMP_CONTEXT_PROP_DYNAMICS:
|
|
|
|
container = gimp_data_factory_get_container (context->gimp->dynamics_factory);
|
2018-06-17 14:09:55 +02:00
|
|
|
standard = gimp_dynamics_get_standard (context);
|
2009-08-17 23:47:26 -03:00
|
|
|
name_loc = &context->dynamics_name;
|
|
|
|
break;
|
|
|
|
|
2015-12-20 23:48:40 +01:00
|
|
|
case GIMP_CONTEXT_PROP_MYBRUSH:
|
|
|
|
container = gimp_data_factory_get_container (context->gimp->mybrush_factory);
|
2018-06-17 14:09:55 +02:00
|
|
|
standard = gimp_mybrush_get_standard (context);
|
2015-12-20 23:48:40 +01:00
|
|
|
name_loc = &context->mybrush_name;
|
|
|
|
break;
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PATTERN:
|
2008-12-19 21:58:17 +00:00
|
|
|
container = gimp_data_factory_get_container (context->gimp->pattern_factory);
|
2018-06-17 14:09:55 +02:00
|
|
|
standard = gimp_pattern_get_standard (context);
|
2002-05-27 14:04:21 +00:00
|
|
|
name_loc = &context->pattern_name;
|
2002-05-22 13:19:19 +00:00
|
|
|
break;
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_GRADIENT:
|
2008-12-19 21:58:17 +00:00
|
|
|
container = gimp_data_factory_get_container (context->gimp->gradient_factory);
|
2018-06-17 14:09:55 +02:00
|
|
|
standard = gimp_gradient_get_standard (context);
|
2002-05-27 14:04:21 +00:00
|
|
|
name_loc = &context->gradient_name;
|
2002-05-22 13:19:19 +00:00
|
|
|
break;
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PALETTE:
|
2008-12-19 21:58:17 +00:00
|
|
|
container = gimp_data_factory_get_container (context->gimp->palette_factory);
|
2018-06-17 14:09:55 +02:00
|
|
|
standard = gimp_palette_get_standard (context);
|
2002-05-27 14:04:21 +00:00
|
|
|
name_loc = &context->palette_name;
|
2002-05-22 13:19:19 +00:00
|
|
|
break;
|
|
|
|
|
2018-06-02 23:19:51 +02:00
|
|
|
case GIMP_CONTEXT_PROP_FONT:
|
|
|
|
container = gimp_data_factory_get_container (context->gimp->font_factory);
|
2018-06-17 14:09:55 +02:00
|
|
|
standard = gimp_font_get_standard ();
|
2018-06-02 23:19:51 +02:00
|
|
|
name_loc = &context->font_name;
|
|
|
|
break;
|
|
|
|
|
2010-04-03 18:25:31 +03:00
|
|
|
case GIMP_CONTEXT_PROP_TOOL_PRESET:
|
|
|
|
container = gimp_data_factory_get_container (context->gimp->tool_preset_factory);
|
2018-06-17 14:09:55 +02:00
|
|
|
standard = NULL;
|
2010-04-03 18:25:31 +03:00
|
|
|
name_loc = &context->tool_preset_name;
|
|
|
|
break;
|
|
|
|
|
2002-05-22 13:19:19 +00:00
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-05-24 02:53:20 +00:00
|
|
|
if (gimp_scanner_parse_identifier (scanner, "NULL"))
|
|
|
|
{
|
|
|
|
g_value_set_object (value, NULL);
|
|
|
|
}
|
|
|
|
else if (gimp_scanner_parse_string (scanner, &object_name))
|
2002-05-22 13:19:19 +00:00
|
|
|
{
|
|
|
|
GimpObject *deserialize_obj;
|
|
|
|
|
2003-04-13 12:27:44 +00:00
|
|
|
if (! object_name)
|
|
|
|
object_name = g_strdup ("");
|
|
|
|
|
2002-05-22 13:19:19 +00:00
|
|
|
deserialize_obj = gimp_container_get_child_by_name (container,
|
|
|
|
object_name);
|
|
|
|
|
|
|
|
if (! deserialize_obj)
|
|
|
|
{
|
2018-06-17 14:09:55 +02:00
|
|
|
g_value_set_object (value, standard);
|
2002-05-22 13:19:19 +00:00
|
|
|
|
2018-06-17 14:09:55 +02:00
|
|
|
g_free (*name_loc);
|
|
|
|
*name_loc = g_strdup (object_name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_value_set_object (value, deserialize_obj);
|
|
|
|
}
|
2003-04-13 12:27:44 +00:00
|
|
|
|
|
|
|
g_free (object_name);
|
2002-05-22 13:19:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*expected = G_TOKEN_STRING;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-06-17 14:09:55 +02:00
|
|
|
static GimpConfig *
|
|
|
|
gimp_context_duplicate (GimpConfig *config)
|
|
|
|
{
|
|
|
|
GimpContext *context = GIMP_CONTEXT (config);
|
|
|
|
GimpContext *new;
|
|
|
|
|
|
|
|
new = GIMP_CONTEXT (parent_config_iface->duplicate (config));
|
|
|
|
|
|
|
|
COPY_NAME (context, new, tool_name);
|
|
|
|
COPY_NAME (context, new, paint_name);
|
|
|
|
COPY_NAME (context, new, brush_name);
|
|
|
|
COPY_NAME (context, new, dynamics_name);
|
|
|
|
COPY_NAME (context, new, mybrush_name);
|
|
|
|
COPY_NAME (context, new, pattern_name);
|
|
|
|
COPY_NAME (context, new, gradient_name);
|
|
|
|
COPY_NAME (context, new, palette_name);
|
|
|
|
COPY_NAME (context, new, font_name);
|
|
|
|
COPY_NAME (context, new, tool_preset_name);
|
|
|
|
COPY_NAME (context, new, buffer_name);
|
|
|
|
COPY_NAME (context, new, imagefile_name);
|
|
|
|
COPY_NAME (context, new, template_name);
|
|
|
|
|
|
|
|
return GIMP_CONFIG (new);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_context_copy (GimpConfig *src,
|
|
|
|
GimpConfig *dest,
|
|
|
|
GParamFlags flags)
|
|
|
|
{
|
|
|
|
GimpContext *src_context = GIMP_CONTEXT (src);
|
|
|
|
GimpContext *dest_context = GIMP_CONTEXT (dest);
|
|
|
|
gboolean success = parent_config_iface->copy (src, dest, flags);
|
|
|
|
|
|
|
|
COPY_NAME (src_context, dest_context, tool_name);
|
|
|
|
COPY_NAME (src_context, dest_context, paint_name);
|
|
|
|
COPY_NAME (src_context, dest_context, brush_name);
|
|
|
|
COPY_NAME (src_context, dest_context, dynamics_name);
|
|
|
|
COPY_NAME (src_context, dest_context, mybrush_name);
|
|
|
|
COPY_NAME (src_context, dest_context, pattern_name);
|
|
|
|
COPY_NAME (src_context, dest_context, gradient_name);
|
|
|
|
COPY_NAME (src_context, dest_context, palette_name);
|
|
|
|
COPY_NAME (src_context, dest_context, font_name);
|
|
|
|
COPY_NAME (src_context, dest_context, tool_preset_name);
|
|
|
|
COPY_NAME (src_context, dest_context, buffer_name);
|
|
|
|
COPY_NAME (src_context, dest_context, imagefile_name);
|
|
|
|
COPY_NAME (src_context, dest_context, template_name);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2002-01-30 16:14:26 +00:00
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
/*****************************************************************************/
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
/* public functions ********************************************************/
|
1999-06-18 18:29:27 +00:00
|
|
|
|
1999-06-17 19:13:08 +00:00
|
|
|
GimpContext *
|
2001-07-04 19:31:35 +00:00
|
|
|
gimp_context_new (Gimp *gimp,
|
2004-07-03 20:27:28 +00:00
|
|
|
const gchar *name,
|
|
|
|
GimpContext *template)
|
1999-06-17 19:13:08 +00:00
|
|
|
{
|
|
|
|
GimpContext *context;
|
|
|
|
|
2001-07-04 19:31:35 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2001-07-07 12:17:23 +00:00
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_val_if_fail (template == NULL || GIMP_IS_CONTEXT (template), NULL);
|
1999-06-18 18:29:27 +00:00
|
|
|
|
2001-12-07 17:39:51 +00:00
|
|
|
context = g_object_new (GIMP_TYPE_CONTEXT,
|
|
|
|
"name", name,
|
|
|
|
"gimp", gimp,
|
|
|
|
NULL);
|
1999-06-18 18:29:27 +00:00
|
|
|
|
|
|
|
if (template)
|
|
|
|
{
|
2001-08-11 19:53:35 +00:00
|
|
|
context->defined_props = template->defined_props;
|
1999-10-19 15:52:32 +00:00
|
|
|
|
2001-08-11 19:53:35 +00:00
|
|
|
gimp_context_copy_properties (template, context,
|
2015-09-08 21:18:49 +02:00
|
|
|
GIMP_CONTEXT_PROP_MASK_ALL);
|
1999-06-18 18:29:27 +00:00
|
|
|
}
|
|
|
|
|
1999-06-17 19:13:08 +00:00
|
|
|
return context;
|
|
|
|
}
|
|
|
|
|
1999-06-19 20:20:59 +00:00
|
|
|
GimpContext *
|
2016-05-19 23:51:44 +02:00
|
|
|
gimp_context_get_parent (GimpContext *context)
|
1999-06-19 20:20:59 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
1999-06-19 20:20:59 +00:00
|
|
|
|
|
|
|
return context->parent;
|
|
|
|
}
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
static void
|
|
|
|
gimp_context_parent_notify (GimpContext *parent,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
2015-11-09 01:38:37 +01:00
|
|
|
if (pspec->owner_type == GIMP_TYPE_CONTEXT)
|
2008-10-25 09:14:16 +00:00
|
|
|
{
|
2015-11-09 01:38:37 +01:00
|
|
|
GimpContextPropType prop = pspec->param_id;
|
|
|
|
|
|
|
|
/* copy from parent if the changed property is undefined;
|
|
|
|
* ignore properties that are not context properties, for
|
|
|
|
* example notifications on the context's "gimp" property
|
|
|
|
*/
|
|
|
|
if ((prop >= GIMP_CONTEXT_PROP_FIRST) &&
|
|
|
|
(prop <= GIMP_CONTEXT_PROP_LAST) &&
|
|
|
|
! ((1 << prop) & context->defined_props))
|
|
|
|
{
|
|
|
|
gimp_context_copy_property (parent, context, prop);
|
|
|
|
}
|
2008-10-25 09:14:16 +00:00
|
|
|
}
|
2003-02-09 17:32:52 +00:00
|
|
|
}
|
|
|
|
|
1999-06-19 20:20:59 +00:00
|
|
|
void
|
|
|
|
gimp_context_set_parent (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *parent)
|
1999-06-19 20:20:59 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2003-02-09 17:32:52 +00:00
|
|
|
g_return_if_fail (parent == NULL || GIMP_IS_CONTEXT (parent));
|
|
|
|
g_return_if_fail (parent == NULL || parent->parent != context);
|
2001-08-12 15:39:23 +00:00
|
|
|
g_return_if_fail (context != parent);
|
1999-06-19 20:20:59 +00:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
if (context->parent == parent)
|
1999-11-14 10:50:19 +00:00
|
|
|
return;
|
1999-10-19 15:52:32 +00:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
if (context->parent)
|
|
|
|
{
|
|
|
|
g_signal_handlers_disconnect_by_func (context->parent,
|
|
|
|
gimp_context_parent_notify,
|
|
|
|
context);
|
|
|
|
}
|
1999-10-19 15:52:32 +00:00
|
|
|
|
2023-05-22 18:13:44 +02:00
|
|
|
g_set_weak_pointer (&context->parent, parent);
|
1999-06-19 20:20:59 +00:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
if (parent)
|
|
|
|
{
|
|
|
|
/* copy all undefined properties from the new parent */
|
|
|
|
gimp_context_copy_properties (parent, context,
|
|
|
|
~context->defined_props &
|
2015-09-08 21:18:49 +02:00
|
|
|
GIMP_CONTEXT_PROP_MASK_ALL);
|
1999-06-19 20:20:59 +00:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_signal_connect_object (parent, "notify",
|
|
|
|
G_CALLBACK (gimp_context_parent_notify),
|
|
|
|
context,
|
|
|
|
0);
|
|
|
|
}
|
1999-10-19 15:52:32 +00:00
|
|
|
}
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
|
2001-08-11 19:53:35 +00:00
|
|
|
/* define / undefinine context properties */
|
1999-10-19 15:52:32 +00:00
|
|
|
|
|
|
|
void
|
2001-08-11 19:53:35 +00:00
|
|
|
gimp_context_define_property (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContextPropType prop,
|
|
|
|
gboolean defined)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
2001-08-11 19:53:35 +00:00
|
|
|
GimpContextPropMask mask;
|
1999-10-19 15:52:32 +00:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2015-09-08 21:18:49 +02:00
|
|
|
g_return_if_fail ((prop >= GIMP_CONTEXT_PROP_FIRST) &&
|
|
|
|
(prop <= GIMP_CONTEXT_PROP_LAST));
|
1999-10-19 15:52:32 +00:00
|
|
|
|
2001-08-11 19:53:35 +00:00
|
|
|
mask = (1 << prop);
|
1999-10-19 15:52:32 +00:00
|
|
|
|
|
|
|
if (defined)
|
|
|
|
{
|
2001-08-11 19:53:35 +00:00
|
|
|
if (! (context->defined_props & mask))
|
2004-07-03 20:27:28 +00:00
|
|
|
{
|
|
|
|
context->defined_props |= mask;
|
|
|
|
}
|
1999-10-19 15:52:32 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-08-11 19:53:35 +00:00
|
|
|
if (context->defined_props & mask)
|
2004-07-03 20:27:28 +00:00
|
|
|
{
|
|
|
|
context->defined_props &= ~mask;
|
2003-02-09 17:32:52 +00:00
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
if (context->parent)
|
2003-02-09 17:32:52 +00:00
|
|
|
gimp_context_copy_property (context->parent, context, prop);
|
2004-07-03 20:27:28 +00:00
|
|
|
}
|
1999-10-19 15:52:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2001-08-11 19:53:35 +00:00
|
|
|
gimp_context_property_defined (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContextPropType prop)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
|
1999-10-19 15:52:32 +00:00
|
|
|
|
2001-08-11 19:53:35 +00:00
|
|
|
return (context->defined_props & (1 << prop)) ? TRUE : FALSE;
|
1999-10-19 15:52:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-08-11 19:53:35 +00:00
|
|
|
gimp_context_define_properties (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContextPropMask prop_mask,
|
|
|
|
gboolean defined)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
2001-08-11 19:53:35 +00:00
|
|
|
GimpContextPropType prop;
|
1999-10-19 15:52:32 +00:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
1999-10-19 15:52:32 +00:00
|
|
|
|
2015-09-08 21:18:49 +02:00
|
|
|
for (prop = GIMP_CONTEXT_PROP_FIRST; prop <= GIMP_CONTEXT_PROP_LAST; prop++)
|
2003-02-09 17:32:52 +00:00
|
|
|
if ((1 << prop) & prop_mask)
|
2001-08-11 19:53:35 +00:00
|
|
|
gimp_context_define_property (context, prop, defined);
|
1999-10-19 15:52:32 +00:00
|
|
|
}
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
|
2004-07-03 20:27:28 +00:00
|
|
|
/* specify which context properties will be serialized */
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_serialize_properties (GimpContext *context,
|
|
|
|
GimpContextPropMask props_mask)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
|
|
|
|
|
|
context->serialize_props = props_mask;
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpContextPropMask
|
|
|
|
gimp_context_get_serialize_properties (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), 0);
|
|
|
|
|
|
|
|
return context->serialize_props;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-11 19:53:35 +00:00
|
|
|
/* copying context properties */
|
1999-10-19 15:52:32 +00:00
|
|
|
|
|
|
|
void
|
2001-08-11 19:53:35 +00:00
|
|
|
gimp_context_copy_property (GimpContext *src,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *dest,
|
|
|
|
GimpContextPropType prop)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (src));
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (dest));
|
2015-09-08 21:18:49 +02:00
|
|
|
g_return_if_fail ((prop >= GIMP_CONTEXT_PROP_FIRST) &&
|
|
|
|
(prop <= GIMP_CONTEXT_PROP_LAST));
|
1999-10-19 15:52:32 +00:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
switch (prop)
|
|
|
|
{
|
|
|
|
case GIMP_CONTEXT_PROP_IMAGE:
|
|
|
|
gimp_context_real_set_image (dest, src->image);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CONTEXT_PROP_DISPLAY:
|
|
|
|
gimp_context_real_set_display (dest, src->display);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CONTEXT_PROP_TOOL:
|
|
|
|
gimp_context_real_set_tool (dest, src->tool_info);
|
2018-06-17 14:09:55 +02:00
|
|
|
COPY_NAME (src, dest, tool_name);
|
2003-02-09 17:32:52 +00:00
|
|
|
break;
|
|
|
|
|
2005-12-27 18:57:01 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PAINT_INFO:
|
|
|
|
gimp_context_real_set_paint_info (dest, src->paint_info);
|
2018-06-17 14:09:55 +02:00
|
|
|
COPY_NAME (src, dest, paint_name);
|
2005-12-27 18:57:01 +00:00
|
|
|
break;
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_FOREGROUND:
|
2023-11-13 23:29:20 +01:00
|
|
|
gimp_context_real_set_foreground (dest, src->foreground);
|
2003-02-09 17:32:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CONTEXT_PROP_BACKGROUND:
|
2023-11-13 23:29:20 +01:00
|
|
|
gimp_context_real_set_background (dest, src->background);
|
2003-02-09 17:32:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CONTEXT_PROP_OPACITY:
|
|
|
|
gimp_context_real_set_opacity (dest, src->opacity);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CONTEXT_PROP_PAINT_MODE:
|
|
|
|
gimp_context_real_set_paint_mode (dest, src->paint_mode);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CONTEXT_PROP_BRUSH:
|
|
|
|
gimp_context_real_set_brush (dest, src->brush);
|
2018-06-17 14:09:55 +02:00
|
|
|
COPY_NAME (src, dest, brush_name);
|
2003-02-09 17:32:52 +00:00
|
|
|
break;
|
|
|
|
|
2009-08-17 23:47:26 -03:00
|
|
|
case GIMP_CONTEXT_PROP_DYNAMICS:
|
|
|
|
gimp_context_real_set_dynamics (dest, src->dynamics);
|
2018-06-17 14:09:55 +02:00
|
|
|
COPY_NAME (src, dest, dynamics_name);
|
2009-08-17 23:47:26 -03:00
|
|
|
break;
|
|
|
|
|
2015-12-20 23:48:40 +01:00
|
|
|
case GIMP_CONTEXT_PROP_MYBRUSH:
|
|
|
|
gimp_context_real_set_mybrush (dest, src->mybrush);
|
2018-06-17 14:09:55 +02:00
|
|
|
COPY_NAME (src, dest, mybrush_name);
|
2015-12-20 23:48:40 +01:00
|
|
|
break;
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_PATTERN:
|
|
|
|
gimp_context_real_set_pattern (dest, src->pattern);
|
2018-06-17 14:09:55 +02:00
|
|
|
COPY_NAME (src, dest, pattern_name);
|
2003-02-09 17:32:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CONTEXT_PROP_GRADIENT:
|
|
|
|
gimp_context_real_set_gradient (dest, src->gradient);
|
2018-06-17 14:09:55 +02:00
|
|
|
COPY_NAME (src, dest, gradient_name);
|
2003-02-09 17:32:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CONTEXT_PROP_PALETTE:
|
|
|
|
gimp_context_real_set_palette (dest, src->palette);
|
2018-06-17 14:09:55 +02:00
|
|
|
COPY_NAME (src, dest, palette_name);
|
2003-02-09 17:32:52 +00:00
|
|
|
break;
|
|
|
|
|
2003-03-25 22:06:03 +00:00
|
|
|
case GIMP_CONTEXT_PROP_FONT:
|
|
|
|
gimp_context_real_set_font (dest, src->font);
|
2018-06-17 14:09:55 +02:00
|
|
|
COPY_NAME (src, dest, font_name);
|
2003-03-25 22:06:03 +00:00
|
|
|
break;
|
|
|
|
|
2018-06-02 23:19:51 +02:00
|
|
|
case GIMP_CONTEXT_PROP_TOOL_PRESET:
|
|
|
|
gimp_context_real_set_tool_preset (dest, src->tool_preset);
|
2018-06-17 14:09:55 +02:00
|
|
|
COPY_NAME (src, dest, tool_preset_name);
|
2018-06-02 23:19:51 +02:00
|
|
|
break;
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
case GIMP_CONTEXT_PROP_BUFFER:
|
|
|
|
gimp_context_real_set_buffer (dest, src->buffer);
|
2018-06-17 14:09:55 +02:00
|
|
|
COPY_NAME (src, dest, buffer_name);
|
2003-02-09 17:32:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CONTEXT_PROP_IMAGEFILE:
|
|
|
|
gimp_context_real_set_imagefile (dest, src->imagefile);
|
2018-06-17 14:09:55 +02:00
|
|
|
COPY_NAME (src, dest, imagefile_name);
|
2003-02-09 17:32:52 +00:00
|
|
|
break;
|
|
|
|
|
2003-04-05 19:56:38 +00:00
|
|
|
case GIMP_CONTEXT_PROP_TEMPLATE:
|
|
|
|
gimp_context_real_set_template (dest, src->template);
|
2018-06-17 14:09:55 +02:00
|
|
|
COPY_NAME (src, dest, template_name);
|
2003-04-05 19:56:38 +00:00
|
|
|
break;
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
1999-10-19 15:52:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-08-11 19:53:35 +00:00
|
|
|
gimp_context_copy_properties (GimpContext *src,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *dest,
|
|
|
|
GimpContextPropMask prop_mask)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
2001-08-11 19:53:35 +00:00
|
|
|
GimpContextPropType prop;
|
1999-10-19 15:52:32 +00:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (src));
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (dest));
|
1999-10-19 15:52:32 +00:00
|
|
|
|
2015-09-08 21:18:49 +02:00
|
|
|
for (prop = GIMP_CONTEXT_PROP_FIRST; prop <= GIMP_CONTEXT_PROP_LAST; prop++)
|
2003-02-09 17:32:52 +00:00
|
|
|
if ((1 << prop) & prop_mask)
|
|
|
|
gimp_context_copy_property (src, dest, prop);
|
1999-10-19 15:52:32 +00:00
|
|
|
}
|
|
|
|
|
2018-06-17 14:09:55 +02:00
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
/* attribute access functions */
|
1999-06-18 18:29:27 +00:00
|
|
|
|
2001-02-07 15:01:52 +00:00
|
|
|
/*****************************************************************************/
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
/* manipulate by GType *****************************************************/
|
2001-02-07 15:01:52 +00:00
|
|
|
|
2001-08-11 19:53:35 +00:00
|
|
|
GimpContextPropType
|
|
|
|
gimp_context_type_to_property (GType type)
|
2001-02-07 15:01:52 +00:00
|
|
|
{
|
2003-02-09 17:32:52 +00:00
|
|
|
GimpContextPropType prop;
|
2001-02-07 15:01:52 +00:00
|
|
|
|
2015-09-08 21:18:49 +02:00
|
|
|
for (prop = GIMP_CONTEXT_PROP_FIRST; prop <= GIMP_CONTEXT_PROP_LAST; prop++)
|
2001-02-07 15:01:52 +00:00
|
|
|
{
|
2003-02-09 17:32:52 +00:00
|
|
|
if (g_type_is_a (type, gimp_context_prop_types[prop]))
|
2004-07-03 20:27:28 +00:00
|
|
|
return prop;
|
2001-02-07 15:01:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2003-04-10 10:34:56 +00:00
|
|
|
const gchar *
|
|
|
|
gimp_context_type_to_prop_name (GType type)
|
|
|
|
{
|
|
|
|
GimpContextPropType prop;
|
|
|
|
|
2015-09-08 21:18:49 +02:00
|
|
|
for (prop = GIMP_CONTEXT_PROP_FIRST; prop <= GIMP_CONTEXT_PROP_LAST; prop++)
|
2003-04-10 10:34:56 +00:00
|
|
|
{
|
|
|
|
if (g_type_is_a (type, gimp_context_prop_types[prop]))
|
2004-07-03 20:27:28 +00:00
|
|
|
return gimp_context_prop_names[prop];
|
2003-04-10 10:34:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2001-02-07 15:01:52 +00:00
|
|
|
const gchar *
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
gimp_context_type_to_signal_name (GType type)
|
2001-02-07 15:01:52 +00:00
|
|
|
{
|
2003-02-09 17:32:52 +00:00
|
|
|
GimpContextPropType prop;
|
2001-02-07 15:01:52 +00:00
|
|
|
|
2015-09-08 21:18:49 +02:00
|
|
|
for (prop = GIMP_CONTEXT_PROP_FIRST; prop <= GIMP_CONTEXT_PROP_LAST; prop++)
|
2001-02-07 15:01:52 +00:00
|
|
|
{
|
2003-02-09 17:32:52 +00:00
|
|
|
if (g_type_is_a (type, gimp_context_prop_types[prop]))
|
2004-07-03 20:27:28 +00:00
|
|
|
return g_signal_name (gimp_context_signals[prop]);
|
2001-02-07 15:01:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpObject *
|
|
|
|
gimp_context_get_by_type (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GType type)
|
2001-02-07 15:01:52 +00:00
|
|
|
{
|
2001-08-11 19:53:35 +00:00
|
|
|
GimpContextPropType prop;
|
|
|
|
GimpObject *object = NULL;
|
2001-02-07 15:01:52 +00:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
2016-02-12 22:48:59 +01:00
|
|
|
|
|
|
|
prop = gimp_context_type_to_property (type);
|
|
|
|
|
|
|
|
g_return_val_if_fail (prop != -1, NULL);
|
2001-02-07 15:01:52 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_object_get (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_prop_names[prop], &object,
|
|
|
|
NULL);
|
2001-02-07 15:01:52 +00:00
|
|
|
|
2002-05-13 14:28:49 +00:00
|
|
|
/* g_object_get() refs the object, this function however is a getter,
|
|
|
|
* which usually doesn't ref it's return value
|
|
|
|
*/
|
|
|
|
if (object)
|
2003-01-05 22:07:10 +00:00
|
|
|
g_object_unref (object);
|
2002-05-13 14:28:49 +00:00
|
|
|
|
2001-02-07 15:01:52 +00:00
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_by_type (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GType type,
|
|
|
|
GimpObject *object)
|
2001-02-07 15:01:52 +00:00
|
|
|
{
|
Bug 731279 - Tool Preset Editor not working correctly
This fixes restoring of brush properties (size, spacing angle etc.)
from presets, which was utterly broken before. The fix consists of
two parts:
- In tool_manager_preset_changed(), always copy the brush properties
again after setting the preview on the tool options, in order to
override brush properites that get copied from a linked brush when
that brush gets set on the tool options.
But no amount of copying stuff again and again would help without:
- In gimp_context_set_by_type(), don't use g_object_set() to set the
object (brush, pattern etc.). Instead, build a GValue and call
gimp_context_set_property(). This may seem odd, but avoids a
g_object_freeze_notify()/thaw_notify() around the g_object_set(),
which was causing "notify" to be emitted at the very end, after
everything this context change has triggered. GimpContext is an
essential core object and there is an expectation of a reasonable
order of signal emissions and callbacks being called. The "notify"
at the end was keeping any callbacks of the context's "foo-changed"
signals to override anything an earlier callback had done, if a
"notify" callback was overriding that overriding again.
This was probably the reason for a lot of odd behavior observed over
the years. In fact, I have been searching for this for at least 5
years.
2016-10-12 20:12:08 +02:00
|
|
|
GimpContextPropType prop;
|
|
|
|
GParamSpec *pspec;
|
|
|
|
GValue value = G_VALUE_INIT;
|
2001-02-07 15:01:52 +00:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2016-10-12 22:44:19 +02:00
|
|
|
g_return_if_fail (object == NULL || G_IS_OBJECT (object));
|
2016-02-12 22:48:59 +01:00
|
|
|
|
|
|
|
prop = gimp_context_type_to_property (type);
|
|
|
|
|
|
|
|
g_return_if_fail (prop != -1);
|
2001-02-07 15:01:52 +00:00
|
|
|
|
Bug 731279 - Tool Preset Editor not working correctly
This fixes restoring of brush properties (size, spacing angle etc.)
from presets, which was utterly broken before. The fix consists of
two parts:
- In tool_manager_preset_changed(), always copy the brush properties
again after setting the preview on the tool options, in order to
override brush properites that get copied from a linked brush when
that brush gets set on the tool options.
But no amount of copying stuff again and again would help without:
- In gimp_context_set_by_type(), don't use g_object_set() to set the
object (brush, pattern etc.). Instead, build a GValue and call
gimp_context_set_property(). This may seem odd, but avoids a
g_object_freeze_notify()/thaw_notify() around the g_object_set(),
which was causing "notify" to be emitted at the very end, after
everything this context change has triggered. GimpContext is an
essential core object and there is an expectation of a reasonable
order of signal emissions and callbacks being called. The "notify"
at the end was keeping any callbacks of the context's "foo-changed"
signals to override anything an earlier callback had done, if a
"notify" callback was overriding that overriding again.
This was probably the reason for a lot of odd behavior observed over
the years. In fact, I have been searching for this for at least 5
years.
2016-10-12 20:12:08 +02:00
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (context),
|
|
|
|
gimp_context_prop_names[prop]);
|
|
|
|
|
|
|
|
g_return_if_fail (pspec != NULL);
|
|
|
|
|
|
|
|
g_value_init (&value, pspec->value_type);
|
|
|
|
g_value_set_object (&value, object);
|
|
|
|
|
|
|
|
/* we use gimp_context_set_property() (which in turn only calls
|
|
|
|
* gimp_context_set_foo() functions) instead of the much more obvious
|
|
|
|
* g_object_set(); this avoids g_object_freeze_notify()/thaw_notify()
|
|
|
|
* around the g_object_set() and makes GimpContext callbacks being
|
|
|
|
* called in a much more predictable order. See bug #731279.
|
|
|
|
*/
|
|
|
|
gimp_context_set_property (G_OBJECT (context),
|
|
|
|
pspec->param_id,
|
|
|
|
(const GValue *) &value,
|
|
|
|
pspec);
|
|
|
|
|
|
|
|
g_value_unset (&value);
|
2001-02-07 15:01:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_changed_by_type (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GType type)
|
2001-02-07 15:01:52 +00:00
|
|
|
{
|
2001-08-11 19:53:35 +00:00
|
|
|
GimpContextPropType prop;
|
|
|
|
GimpObject *object;
|
2001-02-07 15:01:52 +00:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2016-02-12 22:48:59 +01:00
|
|
|
|
|
|
|
prop = gimp_context_type_to_property (type);
|
|
|
|
|
|
|
|
g_return_if_fail (prop != -1);
|
2001-02-07 15:01:52 +00:00
|
|
|
|
|
|
|
object = gimp_context_get_by_type (context, type);
|
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[prop], 0,
|
|
|
|
object);
|
2001-02-07 15:01:52 +00:00
|
|
|
}
|
|
|
|
|
2018-06-17 14:09:55 +02:00
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
/*****************************************************************************/
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
/* image *******************************************************************/
|
|
|
|
|
|
|
|
GimpImage *
|
|
|
|
gimp_context_get_image (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
|
|
|
return context->image;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_image (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpImage *image)
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (image == NULL || GIMP_IS_IMAGE (image));
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_IMAGE);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
gimp_context_real_set_image (context, image);
|
|
|
|
}
|
|
|
|
|
2000-02-22 17:06:44 +00:00
|
|
|
void
|
|
|
|
gimp_context_image_changed (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2000-02-22 17:06:44 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[IMAGE_CHANGED], 0,
|
|
|
|
context->image);
|
2000-02-22 17:06:44 +00:00
|
|
|
}
|
|
|
|
|
2023-11-16 15:15:45 +01:00
|
|
|
/* This is a utility function to share, across the program, some common logic of
|
|
|
|
* "which format to use when you are not sure and you need to give generic color
|
|
|
|
* information" in RGBA.
|
|
|
|
* @babl_type must be a valid babl type name such as "u8", "double", "float".
|
|
|
|
* If @space_image is not NULL, it will be used to return the GimpImage
|
|
|
|
* associated to the returned format (if the returned format is indeed using the
|
|
|
|
* image's space).
|
|
|
|
*
|
|
|
|
* The logic for the format to use in RGB color actions is as follows:
|
|
|
|
* - The space we navigate through is the active image's space.
|
|
|
|
* - Increasing/decreasing follows the image TRC (in particular, if the image is
|
|
|
|
* linear or perceptual, we care about chromaticities yet don't follow the
|
|
|
|
* space TRC).
|
|
|
|
* - If there is no active image or if its space is non-sRGB, we use the context
|
|
|
|
* color's space (if set).
|
|
|
|
* - We discard non-RGB spaces and fallback to sRGB.
|
|
|
|
*/
|
|
|
|
const Babl *
|
|
|
|
gimp_context_get_rgba_format (GimpContext *context,
|
|
|
|
GeglColor *color,
|
|
|
|
const gchar *babl_type,
|
|
|
|
GimpImage **space_image)
|
|
|
|
{
|
|
|
|
GimpImage *image = NULL;
|
|
|
|
const Babl *format = NULL;
|
|
|
|
const Babl *space = NULL;
|
|
|
|
gchar *format_name;
|
|
|
|
GimpTRCType trc = GIMP_TRC_NON_LINEAR;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
|
|
|
g_return_val_if_fail (babl_type != NULL , NULL);
|
|
|
|
g_return_val_if_fail (space_image == NULL || *space_image == NULL, NULL);
|
|
|
|
|
|
|
|
image = gimp_context_get_image (context);
|
|
|
|
if (image)
|
|
|
|
{
|
|
|
|
format = gimp_image_get_layer_format (image, FALSE);
|
|
|
|
space = babl_format_get_space (format);
|
|
|
|
if (space_image)
|
|
|
|
*space_image = image;
|
|
|
|
}
|
|
|
|
|
2024-02-24 18:14:36 +01:00
|
|
|
if (color != NULL && (space == NULL || ! babl_space_is_rgb (space)))
|
2023-11-16 15:15:45 +01:00
|
|
|
{
|
|
|
|
format = gegl_color_get_format (color);
|
|
|
|
space = babl_format_get_space (format);
|
|
|
|
if (space_image)
|
|
|
|
*space_image = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! babl_space_is_rgb (space))
|
|
|
|
{
|
|
|
|
format = NULL;
|
|
|
|
space = NULL;
|
|
|
|
if (space_image)
|
|
|
|
*space_image = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (format != NULL)
|
|
|
|
{
|
|
|
|
if (image != NULL)
|
|
|
|
{
|
|
|
|
GimpPrecision precision;
|
|
|
|
|
|
|
|
precision = gimp_image_get_precision (image);
|
|
|
|
trc = gimp_babl_trc (precision);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
trc = gimp_babl_format_get_trc (format);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (trc)
|
|
|
|
{
|
|
|
|
case GIMP_TRC_LINEAR:
|
|
|
|
format_name = g_strdup_printf ("RGBA %s", babl_type);
|
|
|
|
break;
|
|
|
|
case GIMP_TRC_NON_LINEAR:
|
|
|
|
format_name = g_strdup_printf ("R'G'B'A %s", babl_type);
|
|
|
|
break;
|
|
|
|
case GIMP_TRC_PERCEPTUAL:
|
|
|
|
format_name = g_strdup_printf ("R~G~B~A %s", babl_type);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_return_val_if_reached (NULL);
|
|
|
|
}
|
|
|
|
format = babl_format_with_space (format_name, space);
|
|
|
|
g_free (format_name);
|
|
|
|
|
|
|
|
return format;
|
|
|
|
}
|
|
|
|
|
2024-01-30 14:41:50 +01:00
|
|
|
static void
|
|
|
|
gimp_context_image_disconnect (GimpImage *image,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
if (image == context->image)
|
|
|
|
gimp_context_real_set_image (context, NULL);
|
|
|
|
}
|
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
static void
|
2001-02-04 14:10:03 +00:00
|
|
|
gimp_context_image_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpImage *image,
|
|
|
|
GimpContext *context)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
|
|
|
if (context->image == image)
|
|
|
|
gimp_context_real_set_image (context, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_real_set_image (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpImage *image)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
1999-11-14 10:50:19 +00:00
|
|
|
if (context->image == image)
|
|
|
|
return;
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2024-01-30 14:41:50 +01:00
|
|
|
if (context->image)
|
|
|
|
g_signal_handlers_disconnect_by_func (context->image,
|
|
|
|
G_CALLBACK (gimp_context_image_disconnect),
|
|
|
|
context);
|
|
|
|
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
context->image = image;
|
2001-02-12 03:27:28 +00:00
|
|
|
|
2024-01-30 14:41:50 +01:00
|
|
|
if (image)
|
|
|
|
g_signal_connect_object (image, "disconnect",
|
|
|
|
G_CALLBACK (gimp_context_image_disconnect),
|
|
|
|
context, 0);
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_notify (G_OBJECT (context), "image");
|
2000-02-22 17:06:44 +00:00
|
|
|
gimp_context_image_changed (context);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
/*****************************************************************************/
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
/* display *****************************************************************/
|
|
|
|
|
2019-09-04 14:27:18 +02:00
|
|
|
GimpDisplay *
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
gimp_context_get_display (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
|
|
|
return context->display;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_display (GimpContext *context,
|
2019-09-04 14:27:18 +02:00
|
|
|
GimpDisplay *display)
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2019-09-04 14:27:18 +02:00
|
|
|
g_return_if_fail (display == NULL || GIMP_IS_DISPLAY (display));
|
2018-06-17 15:12:26 +02:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_DISPLAY);
|
1999-10-19 15:52:32 +00:00
|
|
|
|
|
|
|
gimp_context_real_set_display (context, display);
|
|
|
|
}
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2000-02-22 17:06:44 +00:00
|
|
|
void
|
|
|
|
gimp_context_display_changed (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2000-02-22 17:06:44 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[DISPLAY_CHANGED], 0,
|
|
|
|
context->display);
|
2000-02-22 17:06:44 +00:00
|
|
|
}
|
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
static void
|
2002-05-10 13:09:19 +00:00
|
|
|
gimp_context_display_removed (GimpContainer *container,
|
2019-09-04 14:27:18 +02:00
|
|
|
GimpDisplay *display,
|
2002-05-10 13:09:19 +00:00
|
|
|
GimpContext *context)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
2002-05-10 13:09:19 +00:00
|
|
|
if (context->display == display)
|
|
|
|
gimp_context_real_set_display (context, NULL);
|
1999-10-19 15:52:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_real_set_display (GimpContext *context,
|
2019-09-04 14:27:18 +02:00
|
|
|
GimpDisplay *display)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
2019-09-04 14:27:18 +02:00
|
|
|
GimpDisplay *old_display;
|
2008-10-06 19:54:42 +00:00
|
|
|
|
1999-11-14 10:50:19 +00:00
|
|
|
if (context->display == display)
|
2013-04-23 21:00:17 +02:00
|
|
|
{
|
|
|
|
/* make sure that setting a display *always* sets the image
|
|
|
|
* to that display's image, even if the display already
|
|
|
|
* matches
|
|
|
|
*/
|
|
|
|
if (display)
|
|
|
|
{
|
|
|
|
GimpImage *image;
|
|
|
|
|
|
|
|
g_object_get (display, "image", &image, NULL);
|
|
|
|
|
|
|
|
gimp_context_real_set_image (context, image);
|
|
|
|
|
|
|
|
if (image)
|
|
|
|
g_object_unref (image);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2008-10-06 19:54:42 +00:00
|
|
|
old_display = context->display;
|
|
|
|
|
2001-12-07 17:39:51 +00:00
|
|
|
context->display = display;
|
|
|
|
|
|
|
|
if (context->display)
|
2001-08-14 14:53:55 +00:00
|
|
|
{
|
2006-03-28 17:08:36 +00:00
|
|
|
GimpImage *image;
|
2002-05-10 13:09:19 +00:00
|
|
|
|
2006-03-28 17:08:36 +00:00
|
|
|
g_object_get (display, "image", &image, NULL);
|
2001-08-14 14:53:55 +00:00
|
|
|
|
2008-03-23 13:27:51 +00:00
|
|
|
gimp_context_real_set_image (context, image);
|
2001-08-14 14:53:55 +00:00
|
|
|
|
2008-03-23 13:27:51 +00:00
|
|
|
if (image)
|
|
|
|
g_object_unref (image);
|
2001-08-14 14:53:55 +00:00
|
|
|
}
|
2008-10-06 19:54:42 +00:00
|
|
|
else if (old_display)
|
|
|
|
{
|
|
|
|
gimp_context_real_set_image (context, NULL);
|
|
|
|
}
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_notify (G_OBJECT (context), "display");
|
2000-02-22 17:06:44 +00:00
|
|
|
gimp_context_display_changed (context);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
/*****************************************************************************/
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
/* tool ********************************************************************/
|
|
|
|
|
2001-02-21 12:18:09 +00:00
|
|
|
GimpToolInfo *
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
gimp_context_get_tool (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2001-02-21 12:18:09 +00:00
|
|
|
return context->tool_info;
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-02-21 12:18:09 +00:00
|
|
|
gimp_context_set_tool (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpToolInfo *tool_info)
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (tool_info == NULL || GIMP_IS_TOOL_INFO (tool_info));
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_TOOL);
|
1999-10-19 15:52:32 +00:00
|
|
|
|
2001-02-21 12:18:09 +00:00
|
|
|
gimp_context_real_set_tool (context, tool_info);
|
1999-10-19 15:52:32 +00:00
|
|
|
}
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2000-02-22 17:06:44 +00:00
|
|
|
void
|
|
|
|
gimp_context_tool_changed (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2000-02-22 17:06:44 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[TOOL_CHANGED], 0,
|
|
|
|
context->tool_info);
|
2001-02-21 12:18:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_tool_dirty (GimpToolInfo *tool_info,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context)
|
2001-02-21 12:18:09 +00:00
|
|
|
{
|
|
|
|
g_free (context->tool_name);
|
2009-08-29 12:40:40 +02:00
|
|
|
context->tool_name = g_strdup (gimp_object_get_name (tool_info));
|
2015-02-26 22:17:45 +01:00
|
|
|
|
|
|
|
g_signal_emit (context, gimp_context_signals[PROP_NAME_CHANGED], 0,
|
|
|
|
GIMP_CONTEXT_PROP_TOOL);
|
2000-02-22 17:06:44 +00:00
|
|
|
}
|
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
static void
|
2001-02-21 12:18:09 +00:00
|
|
|
gimp_context_tool_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
2001-02-21 12:18:09 +00:00
|
|
|
GimpToolInfo *tool_info;
|
|
|
|
|
|
|
|
if (! context->tool_name)
|
2006-05-24 15:04:45 +00:00
|
|
|
context->tool_name = g_strdup ("gimp-paintbrush-tool");
|
2001-02-21 12:18:09 +00:00
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
tool_info = gimp_context_find_object (context, container,
|
|
|
|
context->tool_name,
|
|
|
|
gimp_tool_info_get_standard (context->gimp));
|
2001-02-21 12:18:09 +00:00
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
gimp_context_real_set_tool (context, tool_info);
|
2001-02-21 12:18:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_tool_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpToolInfo *tool_info,
|
|
|
|
GimpContext *context)
|
2001-02-21 12:18:09 +00:00
|
|
|
{
|
|
|
|
if (tool_info == context->tool_info)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->tool_info,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_tool_dirty,
|
|
|
|
context);
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_object (&context->tool_info);
|
2001-02-21 12:18:09 +00:00
|
|
|
|
|
|
|
if (! gimp_container_frozen (container))
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_tool_list_thaw (container, context);
|
2001-02-21 12:18:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_real_set_tool (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpToolInfo *tool_info)
|
2001-02-21 12:18:09 +00:00
|
|
|
{
|
|
|
|
if (context->tool_info == tool_info)
|
1999-11-14 10:50:19 +00:00
|
|
|
return;
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (context->tool_name &&
|
|
|
|
tool_info != gimp_tool_info_get_standard (context->gimp))
|
2001-02-21 12:18:09 +00:00
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_pointer (&context->tool_name, g_free);
|
2001-02-21 12:18:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (context->tool_info)
|
2018-06-01 12:59:52 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->tool_info,
|
|
|
|
gimp_context_tool_dirty,
|
|
|
|
context);
|
2001-02-21 12:18:09 +00:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&context->tool_info, tool_info);
|
2001-02-21 12:18:09 +00:00
|
|
|
|
|
|
|
if (tool_info)
|
|
|
|
{
|
2005-05-27 16:51:39 +00:00
|
|
|
g_signal_connect_object (tool_info, "name-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_CALLBACK (gimp_context_tool_dirty),
|
|
|
|
context,
|
|
|
|
0);
|
2001-02-21 12:18:09 +00:00
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (tool_info != gimp_tool_info_get_standard (context->gimp))
|
2009-08-29 12:40:40 +02:00
|
|
|
context->tool_name = g_strdup (gimp_object_get_name (tool_info));
|
2005-12-27 18:57:01 +00:00
|
|
|
|
|
|
|
if (tool_info->paint_info)
|
|
|
|
gimp_context_real_set_paint_info (context, tool_info->paint_info);
|
2001-02-21 12:18:09 +00:00
|
|
|
}
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_notify (G_OBJECT (context), "tool");
|
2000-02-22 17:06:44 +00:00
|
|
|
gimp_context_tool_changed (context);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
}
|
|
|
|
|
2001-02-21 12:18:09 +00:00
|
|
|
|
2005-12-27 18:57:01 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* paint info **************************************************************/
|
|
|
|
|
|
|
|
GimpPaintInfo *
|
|
|
|
gimp_context_get_paint_info (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
|
|
|
|
|
|
|
return context->paint_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_paint_info (GimpContext *context,
|
|
|
|
GimpPaintInfo *paint_info)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (paint_info == NULL || GIMP_IS_PAINT_INFO (paint_info));
|
|
|
|
|
2005-12-27 18:57:01 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_PAINT_INFO);
|
|
|
|
|
|
|
|
gimp_context_real_set_paint_info (context, paint_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_paint_info_changed (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
|
|
|
|
|
|
g_signal_emit (context,
|
|
|
|
gimp_context_signals[PAINT_INFO_CHANGED], 0,
|
|
|
|
context->paint_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_paint_info_dirty (GimpPaintInfo *paint_info,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
g_free (context->paint_name);
|
2009-08-29 12:40:40 +02:00
|
|
|
context->paint_name = g_strdup (gimp_object_get_name (paint_info));
|
2015-02-26 22:17:45 +01:00
|
|
|
|
|
|
|
g_signal_emit (context, gimp_context_signals[PROP_NAME_CHANGED], 0,
|
|
|
|
GIMP_CONTEXT_PROP_PAINT_INFO);
|
2005-12-27 18:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* the global paint info list is there again after refresh */
|
|
|
|
static void
|
|
|
|
gimp_context_paint_info_list_thaw (GimpContainer *container,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
GimpPaintInfo *paint_info;
|
|
|
|
|
|
|
|
if (! context->paint_name)
|
2010-06-24 18:35:15 +02:00
|
|
|
context->paint_name = g_strdup ("gimp-paintbrush");
|
2005-12-27 18:57:01 +00:00
|
|
|
|
|
|
|
paint_info = gimp_context_find_object (context, container,
|
|
|
|
context->paint_name,
|
|
|
|
gimp_paint_info_get_standard (context->gimp));
|
|
|
|
|
|
|
|
gimp_context_real_set_paint_info (context, paint_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_paint_info_removed (GimpContainer *container,
|
|
|
|
GimpPaintInfo *paint_info,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
if (paint_info == context->paint_info)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->paint_info,
|
2005-12-27 18:57:01 +00:00
|
|
|
gimp_context_paint_info_dirty,
|
|
|
|
context);
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_object (&context->paint_info);
|
2005-12-27 18:57:01 +00:00
|
|
|
|
|
|
|
if (! gimp_container_frozen (container))
|
|
|
|
gimp_context_paint_info_list_thaw (container, context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_real_set_paint_info (GimpContext *context,
|
|
|
|
GimpPaintInfo *paint_info)
|
|
|
|
{
|
|
|
|
if (context->paint_info == paint_info)
|
|
|
|
return;
|
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (context->paint_name &&
|
|
|
|
paint_info != gimp_paint_info_get_standard (context->gimp))
|
2005-12-27 18:57:01 +00:00
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_pointer (&context->paint_name, g_free);
|
2005-12-27 18:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (context->paint_info)
|
2018-06-01 12:59:52 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->paint_info,
|
|
|
|
gimp_context_paint_info_dirty,
|
|
|
|
context);
|
2005-12-27 18:57:01 +00:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&context->paint_info, paint_info);
|
2005-12-27 18:57:01 +00:00
|
|
|
|
|
|
|
if (paint_info)
|
|
|
|
{
|
|
|
|
g_signal_connect_object (paint_info, "name-changed",
|
|
|
|
G_CALLBACK (gimp_context_paint_info_dirty),
|
|
|
|
context,
|
|
|
|
0);
|
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (paint_info != gimp_paint_info_get_standard (context->gimp))
|
2009-08-29 12:40:40 +02:00
|
|
|
context->paint_name = g_strdup (gimp_object_get_name (paint_info));
|
2005-12-27 18:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (context), "paint-info");
|
|
|
|
gimp_context_paint_info_changed (context);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
/*****************************************************************************/
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
/* foreground color ********************************************************/
|
|
|
|
|
2023-11-14 20:04:14 +01:00
|
|
|
GeglColor *
|
|
|
|
gimp_context_get_foreground (GimpContext *context)
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
{
|
2023-11-14 20:04:14 +01:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
2001-01-15 01:48:53 +00:00
|
|
|
|
2023-11-14 20:04:14 +01:00
|
|
|
return context->foreground;
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-11-13 23:29:20 +01:00
|
|
|
gimp_context_set_foreground (GimpContext *context,
|
|
|
|
GeglColor *color)
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2023-11-14 20:04:14 +01:00
|
|
|
g_return_if_fail (GEGL_IS_COLOR (color));
|
2018-06-17 15:12:26 +02:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_FOREGROUND);
|
2001-01-15 01:48:53 +00:00
|
|
|
|
|
|
|
gimp_context_real_set_foreground (context, color);
|
1999-10-19 15:52:32 +00:00
|
|
|
}
|
|
|
|
|
2000-02-22 17:06:44 +00:00
|
|
|
void
|
|
|
|
gimp_context_foreground_changed (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2000-02-22 17:06:44 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[FOREGROUND_CHANGED], 0,
|
2023-11-14 20:04:14 +01:00
|
|
|
context->foreground);
|
2000-02-22 17:06:44 +00:00
|
|
|
}
|
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
static void
|
2023-11-13 23:29:20 +01:00
|
|
|
gimp_context_real_set_foreground (GimpContext *context,
|
|
|
|
GeglColor *color)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
2023-11-13 23:29:20 +01:00
|
|
|
if (context->foreground != NULL &&
|
|
|
|
gimp_color_is_perceptually_identical (context->foreground, color))
|
1999-11-14 10:50:19 +00:00
|
|
|
return;
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2023-11-13 23:29:20 +01:00
|
|
|
g_clear_object (&context->foreground);
|
|
|
|
context->foreground = gegl_color_duplicate (color);
|
|
|
|
gimp_color_set_alpha (context->foreground, GIMP_OPACITY_OPAQUE);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_notify (G_OBJECT (context), "foreground");
|
2000-02-22 17:06:44 +00:00
|
|
|
gimp_context_foreground_changed (context);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
/*****************************************************************************/
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
/* background color ********************************************************/
|
|
|
|
|
2023-11-14 20:04:14 +01:00
|
|
|
GeglColor *
|
|
|
|
gimp_context_get_background (GimpContext *context)
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
{
|
2023-11-14 20:04:14 +01:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
2001-01-15 01:48:53 +00:00
|
|
|
|
2023-11-14 20:04:14 +01:00
|
|
|
return context->background;
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
}
|
|
|
|
|
2001-01-10 22:49:45 +00:00
|
|
|
void
|
2023-11-13 23:29:20 +01:00
|
|
|
gimp_context_set_background (GimpContext *context,
|
|
|
|
GeglColor *color)
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2023-11-14 20:04:14 +01:00
|
|
|
g_return_if_fail (GEGL_IS_COLOR (color));
|
2018-06-17 15:12:26 +02:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_BACKGROUND);
|
2001-01-15 01:48:53 +00:00
|
|
|
|
|
|
|
gimp_context_real_set_background (context, color);
|
1999-10-19 15:52:32 +00:00
|
|
|
}
|
|
|
|
|
2000-02-22 17:06:44 +00:00
|
|
|
void
|
|
|
|
gimp_context_background_changed (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2000-02-22 17:06:44 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[BACKGROUND_CHANGED], 0,
|
2023-11-14 20:04:14 +01:00
|
|
|
context->background);
|
2000-02-22 17:06:44 +00:00
|
|
|
}
|
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
static void
|
2023-11-13 23:29:20 +01:00
|
|
|
gimp_context_real_set_background (GimpContext *context,
|
|
|
|
GeglColor *color)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
2023-11-13 23:29:20 +01:00
|
|
|
if (context->background != NULL &&
|
|
|
|
gimp_color_is_perceptually_identical (context->background, color))
|
1999-11-14 10:50:19 +00:00
|
|
|
return;
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2023-11-13 23:29:20 +01:00
|
|
|
g_clear_object (&context->background);
|
|
|
|
context->background = gegl_color_duplicate (color);
|
|
|
|
gimp_color_set_alpha (context->background, GIMP_OPACITY_OPAQUE);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_notify (G_OBJECT (context), "background");
|
2000-02-22 17:06:44 +00:00
|
|
|
gimp_context_background_changed (context);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* color utility functions *************************************************/
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_default_colors (GimpContext *context)
|
|
|
|
{
|
|
|
|
GimpContext *bg_context;
|
2023-11-13 23:29:20 +01:00
|
|
|
GeglColor *fg;
|
|
|
|
GeglColor *bg;
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2002-11-17 20:51:03 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
bg_context = context;
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_FOREGROUND);
|
|
|
|
context_find_defined (bg_context, GIMP_CONTEXT_PROP_BACKGROUND);
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2023-11-13 23:29:20 +01:00
|
|
|
fg = gegl_color_new ("black");
|
|
|
|
bg = gegl_color_new ("white");
|
2001-01-15 01:48:53 +00:00
|
|
|
|
2023-11-13 23:29:20 +01:00
|
|
|
gimp_context_real_set_foreground (context, fg);
|
|
|
|
gimp_context_real_set_background (bg_context, bg);
|
|
|
|
|
|
|
|
g_object_unref (fg);
|
|
|
|
g_object_unref (bg);
|
1999-10-26 18:27:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_swap_colors (GimpContext *context)
|
|
|
|
{
|
|
|
|
GimpContext *bg_context;
|
2023-11-13 23:29:20 +01:00
|
|
|
GeglColor *fg;
|
|
|
|
GeglColor *bg;
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2002-11-17 20:51:03 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
bg_context = context;
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_FOREGROUND);
|
|
|
|
context_find_defined (bg_context, GIMP_CONTEXT_PROP_BACKGROUND);
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2023-11-13 23:29:20 +01:00
|
|
|
fg = g_object_ref (context->foreground);
|
|
|
|
bg = g_object_ref (context->background);
|
|
|
|
|
|
|
|
gimp_context_real_set_foreground (context, bg);
|
|
|
|
gimp_context_real_set_background (bg_context, fg);
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2023-11-13 23:29:20 +01:00
|
|
|
g_object_unref (fg);
|
|
|
|
g_object_unref (bg);
|
1999-10-26 18:27:27 +00:00
|
|
|
}
|
|
|
|
|
2018-06-17 14:09:55 +02:00
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
/*****************************************************************************/
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
/* opacity *****************************************************************/
|
1999-06-18 18:29:27 +00:00
|
|
|
|
1999-06-17 19:13:08 +00:00
|
|
|
gdouble
|
|
|
|
gimp_context_get_opacity (GimpContext *context)
|
|
|
|
{
|
2002-03-03 17:38:12 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), GIMP_OPACITY_OPAQUE);
|
1999-06-17 19:13:08 +00:00
|
|
|
|
|
|
|
return context->opacity;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_opacity (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gdouble opacity)
|
1999-06-17 19:13:08 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_OPACITY);
|
1999-10-19 15:52:32 +00:00
|
|
|
|
|
|
|
gimp_context_real_set_opacity (context, opacity);
|
|
|
|
}
|
1999-06-17 19:13:08 +00:00
|
|
|
|
2000-02-22 17:06:44 +00:00
|
|
|
void
|
|
|
|
gimp_context_opacity_changed (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2000-02-22 17:06:44 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[OPACITY_CHANGED], 0,
|
|
|
|
context->opacity);
|
2000-02-22 17:06:44 +00:00
|
|
|
}
|
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
static void
|
|
|
|
gimp_context_real_set_opacity (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gdouble opacity)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
1999-11-14 10:50:19 +00:00
|
|
|
if (context->opacity == opacity)
|
|
|
|
return;
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
1999-06-17 19:13:08 +00:00
|
|
|
context->opacity = opacity;
|
2003-02-09 17:32:52 +00:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (context), "opacity");
|
2000-02-22 17:06:44 +00:00
|
|
|
gimp_context_opacity_changed (context);
|
1999-06-17 19:13:08 +00:00
|
|
|
}
|
|
|
|
|
1999-06-18 18:29:27 +00:00
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
/*****************************************************************************/
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
/* paint mode **************************************************************/
|
1999-06-18 18:29:27 +00:00
|
|
|
|
2017-01-08 23:00:19 +01:00
|
|
|
GimpLayerMode
|
1999-06-17 19:13:08 +00:00
|
|
|
gimp_context_get_paint_mode (GimpContext *context)
|
|
|
|
{
|
2018-04-24 13:56:51 +02:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), GIMP_LAYER_MODE_NORMAL);
|
1999-06-17 19:13:08 +00:00
|
|
|
|
|
|
|
return context->paint_mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-08 23:00:19 +01:00
|
|
|
gimp_context_set_paint_mode (GimpContext *context,
|
|
|
|
GimpLayerMode paint_mode)
|
1999-06-17 19:13:08 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_PAINT_MODE);
|
1999-10-19 15:52:32 +00:00
|
|
|
|
|
|
|
gimp_context_real_set_paint_mode (context, paint_mode);
|
|
|
|
}
|
1999-06-17 19:13:08 +00:00
|
|
|
|
2000-02-22 17:06:44 +00:00
|
|
|
void
|
|
|
|
gimp_context_paint_mode_changed (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2001-02-23 21:32:47 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[PAINT_MODE_CHANGED], 0,
|
|
|
|
context->paint_mode);
|
2000-02-22 17:06:44 +00:00
|
|
|
}
|
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
static void
|
2017-01-08 23:00:19 +01:00
|
|
|
gimp_context_real_set_paint_mode (GimpContext *context,
|
|
|
|
GimpLayerMode paint_mode)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
1999-11-14 10:50:19 +00:00
|
|
|
if (context->paint_mode == paint_mode)
|
|
|
|
return;
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
1999-06-17 19:13:08 +00:00
|
|
|
context->paint_mode = paint_mode;
|
2003-02-09 17:32:52 +00:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (context), "paint-mode");
|
2000-02-22 17:06:44 +00:00
|
|
|
gimp_context_paint_mode_changed (context);
|
1999-06-17 19:13:08 +00:00
|
|
|
}
|
1999-06-18 18:29:27 +00:00
|
|
|
|
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
/*****************************************************************************/
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
/* brush *******************************************************************/
|
1999-06-18 18:29:27 +00:00
|
|
|
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
GimpBrush *
|
|
|
|
gimp_context_get_brush (GimpContext *context)
|
1999-06-18 18:29:27 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
1999-06-18 18:29:27 +00:00
|
|
|
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
return context->brush;
|
1999-06-18 18:29:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
gimp_context_set_brush (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpBrush *brush)
|
1999-06-18 18:29:27 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (brush == NULL || GIMP_IS_BRUSH (brush));
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_BRUSH);
|
1999-10-19 15:52:32 +00:00
|
|
|
|
|
|
|
gimp_context_real_set_brush (context, brush);
|
|
|
|
}
|
1999-06-18 18:29:27 +00:00
|
|
|
|
2000-02-22 17:06:44 +00:00
|
|
|
void
|
|
|
|
gimp_context_brush_changed (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2000-02-22 17:06:44 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[BRUSH_CHANGED], 0,
|
|
|
|
context->brush);
|
2000-02-22 17:06:44 +00:00
|
|
|
}
|
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
static void
|
|
|
|
gimp_context_brush_dirty (GimpBrush *brush,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context)
|
1999-10-26 18:27:27 +00:00
|
|
|
{
|
|
|
|
g_free (context->brush_name);
|
2009-08-29 12:40:40 +02:00
|
|
|
context->brush_name = g_strdup (gimp_object_get_name (brush));
|
2015-02-26 22:17:45 +01:00
|
|
|
|
|
|
|
g_signal_emit (context, gimp_context_signals[PROP_NAME_CHANGED], 0,
|
|
|
|
GIMP_CONTEXT_PROP_BRUSH);
|
1999-10-26 18:27:27 +00:00
|
|
|
}
|
|
|
|
|
2001-02-12 03:27:28 +00:00
|
|
|
static void
|
|
|
|
gimp_context_brush_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context)
|
2001-02-12 03:27:28 +00:00
|
|
|
{
|
|
|
|
GimpBrush *brush;
|
|
|
|
|
|
|
|
if (! context->brush_name)
|
2001-07-11 12:39:49 +00:00
|
|
|
context->brush_name = g_strdup (context->gimp->config->default_brush);
|
2001-02-12 03:27:28 +00:00
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
brush = gimp_context_find_object (context, container,
|
|
|
|
context->brush_name,
|
2010-04-05 13:24:54 +02:00
|
|
|
gimp_brush_get_standard (context));
|
2001-02-12 03:27:28 +00:00
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
gimp_context_real_set_brush (context, brush);
|
2001-02-12 03:27:28 +00:00
|
|
|
}
|
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
/* the active brush disappeared */
|
|
|
|
static void
|
2001-02-12 03:27:28 +00:00
|
|
|
gimp_context_brush_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpBrush *brush,
|
|
|
|
GimpContext *context)
|
1999-10-26 18:27:27 +00:00
|
|
|
{
|
|
|
|
if (brush == context->brush)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->brush,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_brush_dirty,
|
|
|
|
context);
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_object (&context->brush);
|
2001-02-12 03:27:28 +00:00
|
|
|
|
|
|
|
if (! gimp_container_frozen (container))
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_brush_list_thaw (container, context);
|
1999-10-26 18:27:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
static void
|
|
|
|
gimp_context_real_set_brush (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpBrush *brush)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
1999-11-14 10:50:19 +00:00
|
|
|
if (context->brush == brush)
|
|
|
|
return;
|
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (context->brush_name &&
|
|
|
|
brush != GIMP_BRUSH (gimp_brush_get_standard (context)))
|
1999-10-26 18:27:27 +00:00
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_pointer (&context->brush_name, g_free);
|
1999-10-26 18:27:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (context->brush)
|
2018-06-01 12:59:52 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->brush,
|
|
|
|
gimp_context_brush_dirty,
|
|
|
|
context);
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&context->brush, brush);
|
1999-10-26 18:27:27 +00:00
|
|
|
|
|
|
|
if (brush)
|
|
|
|
{
|
2005-05-27 16:51:39 +00:00
|
|
|
g_signal_connect_object (brush, "name-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_CALLBACK (gimp_context_brush_dirty),
|
|
|
|
context,
|
|
|
|
0);
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (brush != GIMP_BRUSH (gimp_brush_get_standard (context)))
|
2009-08-29 12:40:40 +02:00
|
|
|
context->brush_name = g_strdup (gimp_object_get_name (brush));
|
1999-10-26 18:27:27 +00:00
|
|
|
}
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_notify (G_OBJECT (context), "brush");
|
2000-02-22 17:06:44 +00:00
|
|
|
gimp_context_brush_changed (context);
|
1999-06-18 18:29:27 +00:00
|
|
|
}
|
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2009-08-17 23:47:26 -03:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* dynamics *****************************************************************/
|
|
|
|
|
2009-08-20 18:24:50 +03:00
|
|
|
GimpDynamics *
|
2009-08-17 23:47:26 -03:00
|
|
|
gimp_context_get_dynamics (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
|
|
|
|
|
|
|
return context->dynamics;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-10-03 13:53:40 +02:00
|
|
|
gimp_context_set_dynamics (GimpContext *context,
|
|
|
|
GimpDynamics *dynamics)
|
2009-08-17 23:47:26 -03:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (dynamics == NULL || GIMP_IS_DYNAMICS (dynamics));
|
|
|
|
|
2009-08-17 23:47:26 -03:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_DYNAMICS);
|
|
|
|
|
|
|
|
gimp_context_real_set_dynamics (context, dynamics);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_dynamics_changed (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
|
|
|
|
|
|
g_signal_emit (context,
|
|
|
|
gimp_context_signals[DYNAMICS_CHANGED], 0,
|
|
|
|
context->dynamics);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-03 13:53:40 +02:00
|
|
|
gimp_context_dynamics_dirty (GimpDynamics *dynamics,
|
|
|
|
GimpContext *context)
|
2009-08-17 23:47:26 -03:00
|
|
|
{
|
|
|
|
g_free (context->dynamics_name);
|
2009-10-11 13:18:23 +02:00
|
|
|
context->dynamics_name = g_strdup (gimp_object_get_name (dynamics));
|
2015-02-26 22:17:45 +01:00
|
|
|
|
|
|
|
g_signal_emit (context, gimp_context_signals[PROP_NAME_CHANGED], 0,
|
|
|
|
GIMP_CONTEXT_PROP_DYNAMICS);
|
2009-08-17 23:47:26 -03:00
|
|
|
}
|
|
|
|
|
2009-10-11 00:19:14 +02:00
|
|
|
static void
|
|
|
|
gimp_context_dynamics_removed (GimpContainer *container,
|
|
|
|
GimpDynamics *dynamics,
|
|
|
|
GimpContext *context)
|
2009-08-17 23:47:26 -03:00
|
|
|
{
|
|
|
|
if (dynamics == context->dynamics)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->dynamics,
|
2009-08-17 23:47:26 -03:00
|
|
|
gimp_context_dynamics_dirty,
|
|
|
|
context);
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_object (&context->dynamics);
|
2009-08-17 23:47:26 -03:00
|
|
|
|
|
|
|
if (! gimp_container_frozen (container))
|
|
|
|
gimp_context_dynamics_list_thaw (container, context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-11 00:19:14 +02:00
|
|
|
static void
|
|
|
|
gimp_context_dynamics_list_thaw (GimpContainer *container,
|
|
|
|
GimpContext *context)
|
2009-08-17 23:47:26 -03:00
|
|
|
{
|
2009-10-03 12:59:45 +03:00
|
|
|
GimpDynamics *dynamics;
|
2009-10-11 01:36:24 +02:00
|
|
|
|
2009-08-17 23:47:26 -03:00
|
|
|
if (! context->dynamics_name)
|
|
|
|
context->dynamics_name = g_strdup (context->gimp->config->default_dynamics);
|
2009-10-11 01:36:24 +02:00
|
|
|
|
2009-08-17 23:47:26 -03:00
|
|
|
dynamics = gimp_context_find_object (context, container,
|
2009-10-03 13:53:40 +02:00
|
|
|
context->dynamics_name,
|
2010-04-05 13:24:54 +02:00
|
|
|
gimp_dynamics_get_standard (context));
|
2009-08-17 23:47:26 -03:00
|
|
|
|
|
|
|
gimp_context_real_set_dynamics (context, dynamics);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-03 13:53:40 +02:00
|
|
|
gimp_context_real_set_dynamics (GimpContext *context,
|
|
|
|
GimpDynamics *dynamics)
|
2009-08-17 23:47:26 -03:00
|
|
|
{
|
|
|
|
if (context->dynamics == dynamics)
|
2010-06-24 22:33:33 +02:00
|
|
|
return;
|
2009-10-03 12:59:45 +03:00
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (context->dynamics_name &&
|
|
|
|
dynamics != GIMP_DYNAMICS (gimp_dynamics_get_standard (context)))
|
2009-08-17 23:47:26 -03:00
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_pointer (&context->dynamics_name, g_free);
|
2009-08-17 23:47:26 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (context->dynamics)
|
2018-06-01 12:59:52 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->dynamics,
|
|
|
|
gimp_context_dynamics_dirty,
|
|
|
|
context);
|
2009-08-17 23:47:26 -03:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&context->dynamics, dynamics);
|
2009-08-17 23:47:26 -03:00
|
|
|
|
|
|
|
if (dynamics)
|
|
|
|
{
|
|
|
|
g_signal_connect_object (dynamics, "name-changed",
|
|
|
|
G_CALLBACK (gimp_context_dynamics_dirty),
|
|
|
|
context,
|
|
|
|
0);
|
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (dynamics != GIMP_DYNAMICS (gimp_dynamics_get_standard (context)))
|
2009-10-11 13:18:23 +02:00
|
|
|
context->dynamics_name = g_strdup (gimp_object_get_name (dynamics));
|
2009-08-17 23:47:26 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (context), "dynamics");
|
|
|
|
gimp_context_dynamics_changed (context);
|
2015-12-20 23:48:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* mybrush *****************************************************************/
|
|
|
|
|
|
|
|
GimpMybrush *
|
|
|
|
gimp_context_get_mybrush (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
|
|
|
|
|
|
|
return context->mybrush;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_mybrush (GimpContext *context,
|
|
|
|
GimpMybrush *brush)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (brush == NULL || GIMP_IS_MYBRUSH (brush));
|
|
|
|
|
2015-12-20 23:48:40 +01:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_MYBRUSH);
|
|
|
|
|
|
|
|
gimp_context_real_set_mybrush (context, brush);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_mybrush_changed (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
|
|
|
|
|
|
g_signal_emit (context,
|
|
|
|
gimp_context_signals[MYBRUSH_CHANGED], 0,
|
|
|
|
context->mybrush);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_mybrush_dirty (GimpMybrush *brush,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
g_free (context->mybrush_name);
|
|
|
|
context->mybrush_name = g_strdup (gimp_object_get_name (brush));
|
|
|
|
|
|
|
|
g_signal_emit (context, gimp_context_signals[PROP_NAME_CHANGED], 0,
|
|
|
|
GIMP_CONTEXT_PROP_MYBRUSH);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_mybrush_list_thaw (GimpContainer *container,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
GimpMybrush *brush;
|
|
|
|
|
|
|
|
if (! context->mybrush_name)
|
|
|
|
context->mybrush_name = g_strdup (context->gimp->config->default_mypaint_brush);
|
|
|
|
|
|
|
|
brush = gimp_context_find_object (context, container,
|
|
|
|
context->mybrush_name,
|
|
|
|
gimp_mybrush_get_standard (context));
|
|
|
|
|
|
|
|
gimp_context_real_set_mybrush (context, brush);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_mybrush_removed (GimpContainer *container,
|
|
|
|
GimpMybrush *brush,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
if (brush == context->mybrush)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->mybrush,
|
2015-12-20 23:48:40 +01:00
|
|
|
gimp_context_mybrush_dirty,
|
|
|
|
context);
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_object (&context->mybrush);
|
2015-12-20 23:48:40 +01:00
|
|
|
|
|
|
|
if (! gimp_container_frozen (container))
|
|
|
|
gimp_context_mybrush_list_thaw (container, context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_real_set_mybrush (GimpContext *context,
|
|
|
|
GimpMybrush *brush)
|
|
|
|
{
|
|
|
|
if (context->mybrush == brush)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (context->mybrush_name &&
|
|
|
|
brush != GIMP_MYBRUSH (gimp_mybrush_get_standard (context)))
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_pointer (&context->mybrush_name, g_free);
|
2015-12-20 23:48:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (context->mybrush)
|
2018-06-01 12:59:52 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->mybrush,
|
|
|
|
gimp_context_mybrush_dirty,
|
|
|
|
context);
|
2015-12-20 23:48:40 +01:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&context->mybrush, brush);
|
2015-12-20 23:48:40 +01:00
|
|
|
|
|
|
|
if (brush)
|
|
|
|
{
|
|
|
|
g_signal_connect_object (brush, "name-changed",
|
|
|
|
G_CALLBACK (gimp_context_mybrush_dirty),
|
|
|
|
context,
|
|
|
|
0);
|
|
|
|
|
|
|
|
if (brush != GIMP_MYBRUSH (gimp_mybrush_get_standard (context)))
|
|
|
|
context->mybrush_name = g_strdup (gimp_object_get_name (brush));
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (context), "mybrush");
|
|
|
|
gimp_context_mybrush_changed (context);
|
2009-08-17 23:47:26 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
/*****************************************************************************/
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
/* pattern *****************************************************************/
|
1999-06-18 18:29:27 +00:00
|
|
|
|
2001-02-04 17:34:30 +00:00
|
|
|
GimpPattern *
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
gimp_context_get_pattern (GimpContext *context)
|
1999-06-18 18:29:27 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
1999-06-18 18:29:27 +00:00
|
|
|
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
return context->pattern;
|
1999-06-18 18:29:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
gimp_context_set_pattern (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpPattern *pattern)
|
1999-06-18 18:29:27 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (pattern == NULL || GIMP_IS_PATTERN (pattern));
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_PATTERN);
|
1999-10-19 15:52:32 +00:00
|
|
|
|
|
|
|
gimp_context_real_set_pattern (context, pattern);
|
|
|
|
}
|
1999-06-18 18:29:27 +00:00
|
|
|
|
2000-02-22 17:06:44 +00:00
|
|
|
void
|
|
|
|
gimp_context_pattern_changed (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2000-02-22 17:06:44 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[PATTERN_CHANGED], 0,
|
|
|
|
context->pattern);
|
2000-02-22 17:06:44 +00:00
|
|
|
}
|
|
|
|
|
2001-02-04 17:34:30 +00:00
|
|
|
static void
|
|
|
|
gimp_context_pattern_dirty (GimpPattern *pattern,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context)
|
2001-02-04 17:34:30 +00:00
|
|
|
{
|
|
|
|
g_free (context->pattern_name);
|
2009-08-29 12:40:40 +02:00
|
|
|
context->pattern_name = g_strdup (gimp_object_get_name (pattern));
|
2015-02-26 22:17:45 +01:00
|
|
|
|
|
|
|
g_signal_emit (context, gimp_context_signals[PROP_NAME_CHANGED], 0,
|
|
|
|
GIMP_CONTEXT_PROP_PATTERN);
|
2001-02-04 17:34:30 +00:00
|
|
|
}
|
|
|
|
|
2001-02-12 03:27:28 +00:00
|
|
|
static void
|
|
|
|
gimp_context_pattern_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context)
|
2001-02-12 03:27:28 +00:00
|
|
|
{
|
|
|
|
GimpPattern *pattern;
|
|
|
|
|
|
|
|
if (! context->pattern_name)
|
2001-07-11 12:39:49 +00:00
|
|
|
context->pattern_name = g_strdup (context->gimp->config->default_pattern);
|
2001-02-12 03:27:28 +00:00
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
pattern = gimp_context_find_object (context, container,
|
|
|
|
context->pattern_name,
|
2010-04-05 13:24:54 +02:00
|
|
|
gimp_pattern_get_standard (context));
|
2001-02-12 03:27:28 +00:00
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
gimp_context_real_set_pattern (context, pattern);
|
2001-02-12 03:27:28 +00:00
|
|
|
}
|
|
|
|
|
2001-02-04 17:34:30 +00:00
|
|
|
static void
|
2001-02-12 03:27:28 +00:00
|
|
|
gimp_context_pattern_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpPattern *pattern,
|
|
|
|
GimpContext *context)
|
2001-02-04 17:34:30 +00:00
|
|
|
{
|
|
|
|
if (pattern == context->pattern)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->pattern,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_pattern_dirty,
|
|
|
|
context);
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_object (&context->pattern);
|
2001-02-12 03:27:28 +00:00
|
|
|
|
|
|
|
if (! gimp_container_frozen (container))
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_pattern_list_thaw (container, context);
|
2001-02-04 17:34:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
static void
|
|
|
|
gimp_context_real_set_pattern (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpPattern *pattern)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
1999-11-14 10:50:19 +00:00
|
|
|
if (context->pattern == pattern)
|
|
|
|
return;
|
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (context->pattern_name &&
|
|
|
|
pattern != GIMP_PATTERN (gimp_pattern_get_standard (context)))
|
1999-10-26 18:27:27 +00:00
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_pointer (&context->pattern_name, g_free);
|
1999-10-26 18:27:27 +00:00
|
|
|
}
|
|
|
|
|
2001-02-04 17:34:30 +00:00
|
|
|
if (context->pattern)
|
2018-06-01 12:59:52 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->pattern,
|
|
|
|
gimp_context_pattern_dirty,
|
|
|
|
context);
|
2001-02-04 17:34:30 +00:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&context->pattern, pattern);
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2001-02-04 17:34:30 +00:00
|
|
|
if (pattern)
|
|
|
|
{
|
2005-05-27 16:51:39 +00:00
|
|
|
g_signal_connect_object (pattern, "name-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_CALLBACK (gimp_context_pattern_dirty),
|
|
|
|
context,
|
|
|
|
0);
|
2001-02-04 17:34:30 +00:00
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (pattern != GIMP_PATTERN (gimp_pattern_get_standard (context)))
|
2009-08-29 12:40:40 +02:00
|
|
|
context->pattern_name = g_strdup (gimp_object_get_name (pattern));
|
2001-02-04 17:34:30 +00:00
|
|
|
}
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_notify (G_OBJECT (context), "pattern");
|
2000-02-22 17:06:44 +00:00
|
|
|
gimp_context_pattern_changed (context);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
}
|
1999-06-20 13:53:15 +00:00
|
|
|
|
1999-10-26 18:27:27 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
/* gradient ****************************************************************/
|
|
|
|
|
2001-02-10 19:35:29 +00:00
|
|
|
GimpGradient *
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
gimp_context_get_gradient (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
|
|
|
|
return context->gradient;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-02-10 19:35:29 +00:00
|
|
|
gimp_context_set_gradient (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpGradient *gradient)
|
added the possibility to store the current tool, FG/BG color, brush,
1999-10-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontext.[ch]: added the possibility to store the current
tool, FG/BG color, brush, pattern and gradient, but don't use
these attributes yet.
Before replacing the get/set color/brush/... functions with
context functions, I'll have to change the "parent context"
implementation to something where the children catch the parent's
color/brush/..._changed signals.
Finally, updating the indicator_area, device_status, tool_options
etc. will be done by connecting to their own context's "*_changed"
signals, which will be much cleaner than calling the update
functions from various places.
(I think this is a "consistency fix", please let me know if you
consider it a new feature).
1999-10-17 12:28:38 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (gradient == NULL || GIMP_IS_GRADIENT (gradient));
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_GRADIENT);
|
1999-10-19 15:52:32 +00:00
|
|
|
|
|
|
|
gimp_context_real_set_gradient (context, gradient);
|
|
|
|
}
|
1999-06-20 13:53:15 +00:00
|
|
|
|
2000-02-22 17:06:44 +00:00
|
|
|
void
|
|
|
|
gimp_context_gradient_changed (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2000-02-22 17:06:44 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[GRADIENT_CHANGED], 0,
|
|
|
|
context->gradient);
|
2000-02-22 17:06:44 +00:00
|
|
|
}
|
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
static void
|
2001-02-12 03:27:28 +00:00
|
|
|
gimp_context_gradient_dirty (GimpGradient *gradient,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context)
|
1999-10-19 15:52:32 +00:00
|
|
|
{
|
2001-02-12 03:27:28 +00:00
|
|
|
g_free (context->gradient_name);
|
2009-08-29 12:40:40 +02:00
|
|
|
context->gradient_name = g_strdup (gimp_object_get_name (gradient));
|
2015-02-26 22:17:45 +01:00
|
|
|
|
|
|
|
g_signal_emit (context, gimp_context_signals[PROP_NAME_CHANGED], 0,
|
|
|
|
GIMP_CONTEXT_PROP_GRADIENT);
|
1999-06-18 18:29:27 +00:00
|
|
|
}
|
|
|
|
|
1999-10-19 15:52:32 +00:00
|
|
|
static void
|
2001-02-12 03:27:28 +00:00
|
|
|
gimp_context_gradient_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context)
|
1999-10-26 18:27:27 +00:00
|
|
|
{
|
2001-02-10 19:35:29 +00:00
|
|
|
GimpGradient *gradient;
|
1999-10-26 18:27:27 +00:00
|
|
|
|
|
|
|
if (! context->gradient_name)
|
2001-07-11 12:39:49 +00:00
|
|
|
context->gradient_name = g_strdup (context->gimp->config->default_gradient);
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
gradient = gimp_context_find_object (context, container,
|
|
|
|
context->gradient_name,
|
2010-04-05 13:24:54 +02:00
|
|
|
gimp_gradient_get_standard (context));
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
gimp_context_real_set_gradient (context, gradient);
|
1999-10-26 18:27:27 +00:00
|
|
|
}
|
|
|
|
|
2001-02-12 03:27:28 +00:00
|
|
|
static void
|
|
|
|
gimp_context_gradient_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpGradient *gradient,
|
|
|
|
GimpContext *context)
|
1999-10-26 18:27:27 +00:00
|
|
|
{
|
2001-02-12 03:27:28 +00:00
|
|
|
if (gradient == context->gradient)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->gradient,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_gradient_dirty,
|
|
|
|
context);
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_object (&context->gradient);
|
2001-02-12 03:27:28 +00:00
|
|
|
|
|
|
|
if (! gimp_container_frozen (container))
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_gradient_list_thaw (container, context);
|
2001-02-12 03:27:28 +00:00
|
|
|
}
|
1999-10-26 18:27:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-02-12 03:27:28 +00:00
|
|
|
gimp_context_real_set_gradient (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpGradient *gradient)
|
1999-10-26 18:27:27 +00:00
|
|
|
{
|
|
|
|
if (context->gradient == gradient)
|
2001-02-12 03:27:28 +00:00
|
|
|
return;
|
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (context->gradient_name &&
|
|
|
|
gradient != GIMP_GRADIENT (gimp_gradient_get_standard (context)))
|
2001-02-12 03:27:28 +00:00
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_pointer (&context->gradient_name, g_free);
|
2001-02-12 03:27:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (context->gradient)
|
2018-06-01 12:59:52 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->gradient,
|
|
|
|
gimp_context_gradient_dirty,
|
|
|
|
context);
|
2001-02-12 03:27:28 +00:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&context->gradient, gradient);
|
1999-10-26 18:27:27 +00:00
|
|
|
|
2001-02-12 03:27:28 +00:00
|
|
|
if (gradient)
|
|
|
|
{
|
2005-05-27 16:51:39 +00:00
|
|
|
g_signal_connect_object (gradient, "name-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_CALLBACK (gimp_context_gradient_dirty),
|
|
|
|
context,
|
|
|
|
0);
|
1999-11-14 10:50:19 +00:00
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (gradient != GIMP_GRADIENT (gimp_gradient_get_standard (context)))
|
2009-08-29 12:40:40 +02:00
|
|
|
context->gradient_name = g_strdup (gimp_object_get_name (gradient));
|
1999-10-26 18:27:27 +00:00
|
|
|
}
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_notify (G_OBJECT (context), "gradient");
|
2001-02-12 03:27:28 +00:00
|
|
|
gimp_context_gradient_changed (context);
|
|
|
|
}
|
2001-01-11 23:36:59 +00:00
|
|
|
|
2001-02-11 16:14:25 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* palette *****************************************************************/
|
|
|
|
|
|
|
|
GimpPalette *
|
|
|
|
gimp_context_get_palette (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
2001-02-11 16:14:25 +00:00
|
|
|
|
|
|
|
return context->palette;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_palette (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpPalette *palette)
|
2001-02-11 16:14:25 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (palette == NULL || GIMP_IS_PALETTE (palette));
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_PALETTE);
|
2001-02-11 16:14:25 +00:00
|
|
|
|
|
|
|
gimp_context_real_set_palette (context, palette);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_palette_changed (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2001-02-11 16:14:25 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[PALETTE_CHANGED], 0,
|
|
|
|
context->palette);
|
2001-02-11 16:14:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_palette_dirty (GimpPalette *palette,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context)
|
2001-02-11 16:14:25 +00:00
|
|
|
{
|
|
|
|
g_free (context->palette_name);
|
2009-08-29 12:40:40 +02:00
|
|
|
context->palette_name = g_strdup (gimp_object_get_name (palette));
|
2015-02-26 22:17:45 +01:00
|
|
|
|
|
|
|
g_signal_emit (context, gimp_context_signals[PROP_NAME_CHANGED], 0,
|
|
|
|
GIMP_CONTEXT_PROP_PALETTE);
|
2001-02-11 16:14:25 +00:00
|
|
|
}
|
|
|
|
|
2001-02-12 03:27:28 +00:00
|
|
|
static void
|
|
|
|
gimp_context_palette_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context)
|
2001-02-12 03:27:28 +00:00
|
|
|
{
|
|
|
|
GimpPalette *palette;
|
|
|
|
|
|
|
|
if (! context->palette_name)
|
2001-07-11 12:39:49 +00:00
|
|
|
context->palette_name = g_strdup (context->gimp->config->default_palette);
|
2001-02-12 03:27:28 +00:00
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
palette = gimp_context_find_object (context, container,
|
|
|
|
context->palette_name,
|
2010-04-05 13:24:54 +02:00
|
|
|
gimp_palette_get_standard (context));
|
2001-02-12 03:27:28 +00:00
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
gimp_context_real_set_palette (context, palette);
|
2001-02-12 03:27:28 +00:00
|
|
|
}
|
|
|
|
|
2001-02-11 16:14:25 +00:00
|
|
|
static void
|
2001-02-12 03:27:28 +00:00
|
|
|
gimp_context_palette_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpPalette *palette,
|
|
|
|
GimpContext *context)
|
2001-02-11 16:14:25 +00:00
|
|
|
{
|
|
|
|
if (palette == context->palette)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->palette,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_palette_dirty,
|
|
|
|
context);
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_object (&context->palette);
|
2001-02-12 03:27:28 +00:00
|
|
|
|
|
|
|
if (! gimp_container_frozen (container))
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_palette_list_thaw (container, context);
|
2001-02-11 16:14:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_real_set_palette (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpPalette *palette)
|
2001-02-11 16:14:25 +00:00
|
|
|
{
|
|
|
|
if (context->palette == palette)
|
|
|
|
return;
|
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (context->palette_name &&
|
|
|
|
palette != GIMP_PALETTE (gimp_palette_get_standard (context)))
|
2001-02-11 16:14:25 +00:00
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_pointer (&context->palette_name, g_free);
|
2001-02-11 16:14:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (context->palette)
|
2018-06-01 12:59:52 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->palette,
|
|
|
|
gimp_context_palette_dirty,
|
|
|
|
context);
|
2001-02-11 16:14:25 +00:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&context->palette, palette);
|
2001-02-11 16:14:25 +00:00
|
|
|
|
|
|
|
if (palette)
|
|
|
|
{
|
2005-05-27 16:51:39 +00:00
|
|
|
g_signal_connect_object (palette, "name-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_CALLBACK (gimp_context_palette_dirty),
|
|
|
|
context,
|
|
|
|
0);
|
2001-02-11 16:14:25 +00:00
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (palette != GIMP_PALETTE (gimp_palette_get_standard (context)))
|
2009-08-29 12:40:40 +02:00
|
|
|
context->palette_name = g_strdup (gimp_object_get_name (palette));
|
2001-02-11 16:14:25 +00:00
|
|
|
}
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_notify (G_OBJECT (context), "palette");
|
2001-02-11 16:14:25 +00:00
|
|
|
gimp_context_palette_changed (context);
|
|
|
|
}
|
|
|
|
|
2010-04-04 13:58:55 +02:00
|
|
|
|
2003-03-25 22:06:03 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* font *****************************************************************/
|
|
|
|
|
|
|
|
GimpFont *
|
|
|
|
gimp_context_get_font (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
|
|
|
|
|
|
|
return context->font;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_font (GimpContext *context,
|
|
|
|
GimpFont *font)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (font == NULL || GIMP_IS_FONT (font));
|
|
|
|
|
2003-03-25 22:06:03 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_FONT);
|
|
|
|
|
|
|
|
gimp_context_real_set_font (context, font);
|
|
|
|
}
|
|
|
|
|
2004-03-11 18:47:37 +00:00
|
|
|
const gchar *
|
|
|
|
gimp_context_get_font_name (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
|
|
|
|
2013-01-18 01:02:31 +01:00
|
|
|
return context->font_name;
|
2004-03-11 18:47:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_font_name (GimpContext *context,
|
|
|
|
const gchar *name)
|
|
|
|
{
|
2018-06-02 23:19:51 +02:00
|
|
|
GimpContainer *container;
|
|
|
|
GimpObject *font;
|
2004-03-11 18:47:37 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
|
|
|
2018-06-02 23:19:51 +02:00
|
|
|
container = gimp_data_factory_get_container (context->gimp->font_factory);
|
2023-05-15 21:03:54 +01:00
|
|
|
font = gimp_container_search (container,
|
|
|
|
(GimpContainerSearchFunc) gimp_font_match_by_lookup_name,
|
|
|
|
(gpointer) name);
|
2004-03-11 18:47:37 +00:00
|
|
|
|
2013-01-18 01:02:31 +01:00
|
|
|
if (font)
|
|
|
|
{
|
|
|
|
gimp_context_set_font (context, GIMP_FONT (font));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* No font with this name exists, use the standard font, but
|
|
|
|
* keep the intended name around
|
|
|
|
*/
|
2018-06-03 22:46:48 +02:00
|
|
|
gimp_context_set_font (context, GIMP_FONT (gimp_font_get_standard ()));
|
2013-01-18 01:02:31 +01:00
|
|
|
|
|
|
|
g_free (context->font_name);
|
|
|
|
context->font_name = g_strdup (name);
|
|
|
|
}
|
2004-03-11 18:47:37 +00:00
|
|
|
}
|
|
|
|
|
2003-03-25 22:06:03 +00:00
|
|
|
void
|
|
|
|
gimp_context_font_changed (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
|
|
|
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[FONT_CHANGED], 0,
|
|
|
|
context->font);
|
2003-03-25 22:06:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_font_dirty (GimpFont *font,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
g_free (context->font_name);
|
2009-08-29 12:40:40 +02:00
|
|
|
context->font_name = g_strdup (gimp_object_get_name (font));
|
2015-02-26 22:17:45 +01:00
|
|
|
|
|
|
|
g_signal_emit (context, gimp_context_signals[PROP_NAME_CHANGED], 0,
|
|
|
|
GIMP_CONTEXT_PROP_FONT);
|
2003-03-25 22:06:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_font_list_thaw (GimpContainer *container,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
GimpFont *font;
|
|
|
|
|
|
|
|
if (! context->font_name)
|
|
|
|
context->font_name = g_strdup (context->gimp->config->default_font);
|
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
font = gimp_context_find_object (context, container,
|
|
|
|
context->font_name,
|
|
|
|
gimp_font_get_standard ());
|
2003-03-25 22:06:03 +00:00
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
gimp_context_real_set_font (context, font);
|
2003-03-25 22:06:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_font_removed (GimpContainer *container,
|
|
|
|
GimpFont *font,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
if (font == context->font)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->font,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_font_dirty,
|
|
|
|
context);
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_object (&context->font);
|
2003-03-25 22:06:03 +00:00
|
|
|
|
|
|
|
if (! gimp_container_frozen (container))
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_font_list_thaw (container, context);
|
2003-03-25 22:06:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_real_set_font (GimpContext *context,
|
|
|
|
GimpFont *font)
|
|
|
|
{
|
|
|
|
if (context->font == font)
|
|
|
|
return;
|
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (context->font_name &&
|
2018-06-03 22:46:48 +02:00
|
|
|
font != GIMP_FONT (gimp_font_get_standard ()))
|
2003-03-25 22:06:03 +00:00
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_pointer (&context->font_name, g_free);
|
2003-03-25 22:06:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (context->font)
|
2018-06-01 12:59:52 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->font,
|
|
|
|
gimp_context_font_dirty,
|
|
|
|
context);
|
2003-03-25 22:06:03 +00:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&context->font, font);
|
2003-03-25 22:06:03 +00:00
|
|
|
|
|
|
|
if (font)
|
|
|
|
{
|
2005-05-27 16:51:39 +00:00
|
|
|
g_signal_connect_object (font, "name-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_CALLBACK (gimp_context_font_dirty),
|
|
|
|
context,
|
|
|
|
0);
|
2003-03-25 22:06:03 +00:00
|
|
|
|
2018-06-03 22:46:48 +02:00
|
|
|
if (font != GIMP_FONT (gimp_font_get_standard ()))
|
2023-05-15 21:03:54 +01:00
|
|
|
context->font_name = g_strdup (gimp_font_get_lookup_name (font));
|
2003-03-25 22:06:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (context), "font");
|
|
|
|
gimp_context_font_changed (context);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-02 23:19:51 +02:00
|
|
|
/********************************************************************************/
|
|
|
|
/* tool preset *****************************************************************/
|
|
|
|
|
|
|
|
GimpToolPreset *
|
|
|
|
gimp_context_get_tool_preset (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
|
|
|
|
|
|
|
return context->tool_preset;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_tool_preset (GimpContext *context,
|
|
|
|
GimpToolPreset *tool_preset)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (tool_preset == NULL || GIMP_IS_TOOL_PRESET (tool_preset));
|
|
|
|
|
2018-06-02 23:19:51 +02:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_TOOL_PRESET);
|
|
|
|
|
|
|
|
gimp_context_real_set_tool_preset (context, tool_preset);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_tool_preset_changed (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
|
|
|
|
|
|
g_signal_emit (context,
|
|
|
|
gimp_context_signals[TOOL_PRESET_CHANGED], 0,
|
|
|
|
context->tool_preset);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_tool_preset_dirty (GimpToolPreset *tool_preset,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
g_free (context->tool_preset_name);
|
|
|
|
context->tool_preset_name = g_strdup (gimp_object_get_name (tool_preset));
|
|
|
|
|
|
|
|
g_signal_emit (context, gimp_context_signals[PROP_NAME_CHANGED], 0,
|
|
|
|
GIMP_CONTEXT_PROP_TOOL_PRESET);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_tool_preset_removed (GimpContainer *container,
|
|
|
|
GimpToolPreset *tool_preset,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
if (tool_preset == context->tool_preset)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->tool_preset,
|
2018-06-02 23:19:51 +02:00
|
|
|
gimp_context_tool_preset_dirty,
|
|
|
|
context);
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_object (&context->tool_preset);
|
2018-06-02 23:19:51 +02:00
|
|
|
|
|
|
|
if (! gimp_container_frozen (container))
|
|
|
|
gimp_context_tool_preset_list_thaw (container, context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_tool_preset_list_thaw (GimpContainer *container,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
GimpToolPreset *tool_preset;
|
|
|
|
|
|
|
|
tool_preset = gimp_context_find_object (context, container,
|
2018-06-17 14:42:44 +02:00
|
|
|
context->tool_preset_name,
|
|
|
|
NULL);
|
2018-06-02 23:19:51 +02:00
|
|
|
|
|
|
|
gimp_context_real_set_tool_preset (context, tool_preset);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_real_set_tool_preset (GimpContext *context,
|
|
|
|
GimpToolPreset *tool_preset)
|
|
|
|
{
|
|
|
|
if (context->tool_preset == tool_preset)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (context->tool_preset_name)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_pointer (&context->tool_preset_name, g_free);
|
2018-06-02 23:19:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (context->tool_preset)
|
|
|
|
g_signal_handlers_disconnect_by_func (context->tool_preset,
|
|
|
|
gimp_context_tool_preset_dirty,
|
|
|
|
context);
|
|
|
|
|
|
|
|
g_set_object (&context->tool_preset, tool_preset);
|
|
|
|
|
|
|
|
if (tool_preset)
|
|
|
|
{
|
|
|
|
g_signal_connect_object (tool_preset, "name-changed",
|
|
|
|
G_CALLBACK (gimp_context_tool_preset_dirty),
|
|
|
|
context,
|
|
|
|
0);
|
|
|
|
|
|
|
|
context->tool_preset_name = g_strdup (gimp_object_get_name (tool_preset));
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (context), "tool-preset");
|
|
|
|
gimp_context_tool_preset_changed (context);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-26 12:09:43 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* buffer ******************************************************************/
|
|
|
|
|
|
|
|
GimpBuffer *
|
|
|
|
gimp_context_get_buffer (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
2001-06-26 12:09:43 +00:00
|
|
|
|
|
|
|
return context->buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_buffer (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpBuffer *buffer)
|
2001-06-26 12:09:43 +00:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (buffer == NULL || GIMP_IS_BUFFER (buffer));
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_BUFFER);
|
2001-06-26 12:09:43 +00:00
|
|
|
|
|
|
|
gimp_context_real_set_buffer (context, buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_buffer_changed (GimpContext *context)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-24 21:27:11 +00:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2001-06-26 12:09:43 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[BUFFER_CHANGED], 0,
|
|
|
|
context->buffer);
|
2001-06-26 12:09:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_buffer_dirty (GimpBuffer *buffer,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context)
|
2001-06-26 12:09:43 +00:00
|
|
|
{
|
|
|
|
g_free (context->buffer_name);
|
2009-08-29 12:40:40 +02:00
|
|
|
context->buffer_name = g_strdup (gimp_object_get_name (buffer));
|
2015-02-26 22:17:45 +01:00
|
|
|
|
|
|
|
g_signal_emit (context, gimp_context_signals[PROP_NAME_CHANGED], 0,
|
|
|
|
GIMP_CONTEXT_PROP_BUFFER);
|
2001-06-26 12:09:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_buffer_list_thaw (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpContext *context)
|
2001-06-26 12:09:43 +00:00
|
|
|
{
|
|
|
|
GimpBuffer *buffer;
|
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
buffer = gimp_context_find_object (context, container,
|
|
|
|
context->buffer_name,
|
2010-06-24 22:33:33 +02:00
|
|
|
NULL);
|
2004-01-29 16:34:41 +00:00
|
|
|
|
|
|
|
if (buffer)
|
2003-02-09 17:32:52 +00:00
|
|
|
{
|
2004-01-29 16:34:41 +00:00
|
|
|
gimp_context_real_set_buffer (context, buffer);
|
2003-02-09 17:32:52 +00:00
|
|
|
}
|
2001-06-26 12:09:43 +00:00
|
|
|
else
|
2003-02-09 17:32:52 +00:00
|
|
|
{
|
2004-01-29 16:34:41 +00:00
|
|
|
g_object_notify (G_OBJECT (context), "buffer");
|
|
|
|
gimp_context_buffer_changed (context);
|
2003-02-09 17:32:52 +00:00
|
|
|
}
|
2001-06-26 12:09:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_buffer_removed (GimpContainer *container,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpBuffer *buffer,
|
|
|
|
GimpContext *context)
|
2001-06-26 12:09:43 +00:00
|
|
|
{
|
|
|
|
if (buffer == context->buffer)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->buffer,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_buffer_dirty,
|
|
|
|
context);
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_object (&context->buffer);
|
2001-06-26 12:09:43 +00:00
|
|
|
|
|
|
|
if (! gimp_container_frozen (container))
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_buffer_list_thaw (container, context);
|
2001-06-26 12:09:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_real_set_buffer (GimpContext *context,
|
2004-07-03 20:27:28 +00:00
|
|
|
GimpBuffer *buffer)
|
2001-06-26 12:09:43 +00:00
|
|
|
{
|
|
|
|
if (context->buffer == buffer)
|
|
|
|
return;
|
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (context->buffer_name)
|
2001-06-26 12:09:43 +00:00
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_pointer (&context->buffer_name, g_free);
|
2001-06-26 12:09:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (context->buffer)
|
2018-06-01 12:59:52 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->buffer,
|
|
|
|
gimp_context_buffer_dirty,
|
|
|
|
context);
|
2001-06-26 12:09:43 +00:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&context->buffer, buffer);
|
2001-06-26 12:09:43 +00:00
|
|
|
|
|
|
|
if (buffer)
|
|
|
|
{
|
2005-05-27 16:51:39 +00:00
|
|
|
g_signal_connect_object (buffer, "name-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_CALLBACK (gimp_context_buffer_dirty),
|
|
|
|
context,
|
|
|
|
0);
|
2001-06-26 12:09:43 +00:00
|
|
|
|
2009-08-29 12:40:40 +02:00
|
|
|
context->buffer_name = g_strdup (gimp_object_get_name (buffer));
|
2001-06-26 12:09:43 +00:00
|
|
|
}
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_notify (G_OBJECT (context), "buffer");
|
2001-06-26 12:09:43 +00:00
|
|
|
gimp_context_buffer_changed (context);
|
|
|
|
}
|
|
|
|
|
2001-10-22 17:27:46 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* imagefile ***************************************************************/
|
|
|
|
|
|
|
|
GimpImagefile *
|
|
|
|
gimp_context_get_imagefile (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
|
|
|
|
|
|
|
return context->imagefile;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_imagefile (GimpContext *context,
|
|
|
|
GimpImagefile *imagefile)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (imagefile == NULL || GIMP_IS_IMAGEFILE (imagefile));
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_IMAGEFILE);
|
2001-10-22 17:27:46 +00:00
|
|
|
|
|
|
|
gimp_context_real_set_imagefile (context, imagefile);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_imagefile_changed (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[IMAGEFILE_CHANGED], 0,
|
|
|
|
context->imagefile);
|
2001-10-22 17:27:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_imagefile_dirty (GimpImagefile *imagefile,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
g_free (context->imagefile_name);
|
2009-08-29 12:40:40 +02:00
|
|
|
context->imagefile_name = g_strdup (gimp_object_get_name (imagefile));
|
2015-02-26 22:17:45 +01:00
|
|
|
|
|
|
|
g_signal_emit (context, gimp_context_signals[PROP_NAME_CHANGED], 0,
|
|
|
|
GIMP_CONTEXT_PROP_IMAGEFILE);
|
2001-10-22 17:27:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_imagefile_list_thaw (GimpContainer *container,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
2004-01-29 16:34:41 +00:00
|
|
|
GimpImagefile *imagefile;
|
2001-10-22 17:27:46 +00:00
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
imagefile = gimp_context_find_object (context, container,
|
|
|
|
context->imagefile_name,
|
2010-06-24 22:33:33 +02:00
|
|
|
NULL);
|
2004-01-29 16:34:41 +00:00
|
|
|
|
|
|
|
if (imagefile)
|
2003-02-09 17:32:52 +00:00
|
|
|
{
|
2004-01-29 16:34:41 +00:00
|
|
|
gimp_context_real_set_imagefile (context, imagefile);
|
2003-02-09 17:32:52 +00:00
|
|
|
}
|
2001-10-22 17:27:46 +00:00
|
|
|
else
|
2003-02-09 17:32:52 +00:00
|
|
|
{
|
|
|
|
g_object_notify (G_OBJECT (context), "imagefile");
|
|
|
|
gimp_context_imagefile_changed (context);
|
|
|
|
}
|
2001-10-22 17:27:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_imagefile_removed (GimpContainer *container,
|
|
|
|
GimpImagefile *imagefile,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
if (imagefile == context->imagefile)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->imagefile,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_imagefile_dirty,
|
|
|
|
context);
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_object (&context->imagefile);
|
2001-10-22 17:27:46 +00:00
|
|
|
|
|
|
|
if (! gimp_container_frozen (container))
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_imagefile_list_thaw (container, context);
|
2001-10-22 17:27:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_real_set_imagefile (GimpContext *context,
|
|
|
|
GimpImagefile *imagefile)
|
|
|
|
{
|
|
|
|
if (context->imagefile == imagefile)
|
|
|
|
return;
|
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (context->imagefile_name)
|
2001-10-22 17:27:46 +00:00
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_pointer (&context->imagefile_name, g_free);
|
2001-10-22 17:27:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (context->imagefile)
|
2018-06-01 12:59:52 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->imagefile,
|
|
|
|
gimp_context_imagefile_dirty,
|
|
|
|
context);
|
2001-10-22 17:27:46 +00:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&context->imagefile, imagefile);
|
2001-10-22 17:27:46 +00:00
|
|
|
|
|
|
|
if (imagefile)
|
|
|
|
{
|
2005-05-27 16:51:39 +00:00
|
|
|
g_signal_connect_object (imagefile, "name-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_CALLBACK (gimp_context_imagefile_dirty),
|
|
|
|
context,
|
|
|
|
0);
|
2001-10-22 17:27:46 +00:00
|
|
|
|
2009-08-29 12:40:40 +02:00
|
|
|
context->imagefile_name = g_strdup (gimp_object_get_name (imagefile));
|
2001-10-22 17:27:46 +00:00
|
|
|
}
|
|
|
|
|
2003-02-09 17:32:52 +00:00
|
|
|
g_object_notify (G_OBJECT (context), "imagefile");
|
2001-10-22 17:27:46 +00:00
|
|
|
gimp_context_imagefile_changed (context);
|
|
|
|
}
|
2003-04-05 19:56:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* template ***************************************************************/
|
|
|
|
|
|
|
|
GimpTemplate *
|
|
|
|
gimp_context_get_template (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
|
|
|
|
|
|
|
return context->template;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_set_template (GimpContext *context,
|
|
|
|
GimpTemplate *template)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2018-06-17 15:12:26 +02:00
|
|
|
g_return_if_fail (template == NULL || GIMP_IS_TEMPLATE (template));
|
|
|
|
|
2003-04-05 19:56:38 +00:00
|
|
|
context_find_defined (context, GIMP_CONTEXT_PROP_TEMPLATE);
|
|
|
|
|
|
|
|
gimp_context_real_set_template (context, template);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_context_template_changed (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
|
|
|
|
|
|
g_signal_emit (context,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_signals[TEMPLATE_CHANGED], 0,
|
|
|
|
context->template);
|
2003-04-05 19:56:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_template_dirty (GimpTemplate *template,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
g_free (context->template_name);
|
2009-08-29 12:40:40 +02:00
|
|
|
context->template_name = g_strdup (gimp_object_get_name (template));
|
2015-02-26 22:17:45 +01:00
|
|
|
|
|
|
|
g_signal_emit (context, gimp_context_signals[PROP_NAME_CHANGED], 0,
|
|
|
|
GIMP_CONTEXT_PROP_TEMPLATE);
|
2003-04-05 19:56:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_template_list_thaw (GimpContainer *container,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
2004-01-29 16:34:41 +00:00
|
|
|
GimpTemplate *template;
|
2003-04-05 19:56:38 +00:00
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
template = gimp_context_find_object (context, container,
|
|
|
|
context->template_name,
|
2010-06-24 22:33:33 +02:00
|
|
|
NULL);
|
2004-01-29 16:34:41 +00:00
|
|
|
|
|
|
|
if (template)
|
2003-04-05 19:56:38 +00:00
|
|
|
{
|
2004-01-29 16:34:41 +00:00
|
|
|
gimp_context_real_set_template (context, template);
|
2003-04-05 19:56:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_object_notify (G_OBJECT (context), "template");
|
|
|
|
gimp_context_template_changed (context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_template_removed (GimpContainer *container,
|
|
|
|
GimpTemplate *template,
|
|
|
|
GimpContext *context)
|
|
|
|
{
|
|
|
|
if (template == context->template)
|
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->template,
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_template_dirty,
|
|
|
|
context);
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_object (&context->template);
|
2003-04-05 19:56:38 +00:00
|
|
|
|
|
|
|
if (! gimp_container_frozen (container))
|
2004-07-03 20:27:28 +00:00
|
|
|
gimp_context_template_list_thaw (container, context);
|
2003-04-05 19:56:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_context_real_set_template (GimpContext *context,
|
|
|
|
GimpTemplate *template)
|
|
|
|
{
|
|
|
|
if (context->template == template)
|
|
|
|
return;
|
|
|
|
|
2010-06-24 22:33:33 +02:00
|
|
|
if (context->template_name)
|
2003-04-05 19:56:38 +00:00
|
|
|
{
|
2018-06-17 14:42:44 +02:00
|
|
|
g_clear_pointer (&context->template_name, g_free);
|
2003-04-05 19:56:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (context->template)
|
2018-06-01 12:59:52 +02:00
|
|
|
g_signal_handlers_disconnect_by_func (context->template,
|
|
|
|
gimp_context_template_dirty,
|
|
|
|
context);
|
2003-04-05 19:56:38 +00:00
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&context->template, template);
|
2003-04-05 19:56:38 +00:00
|
|
|
|
|
|
|
if (template)
|
|
|
|
{
|
2005-05-27 16:51:39 +00:00
|
|
|
g_signal_connect_object (template, "name-changed",
|
2004-07-03 20:27:28 +00:00
|
|
|
G_CALLBACK (gimp_context_template_dirty),
|
|
|
|
context,
|
|
|
|
0);
|
2003-04-05 19:56:38 +00:00
|
|
|
|
2009-08-29 12:40:40 +02:00
|
|
|
context->template_name = g_strdup (gimp_object_get_name (template));
|
2003-04-05 19:56:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (context), "template");
|
|
|
|
gimp_context_template_changed (context);
|
|
|
|
}
|
2004-01-29 16:34:41 +00:00
|
|
|
|
|
|
|
|
2022-02-08 00:30:15 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* Line Art ****************************************************************/
|
|
|
|
|
|
|
|
GimpLineArt *
|
|
|
|
gimp_context_take_line_art (GimpContext *context)
|
|
|
|
{
|
|
|
|
GimpLineArt *line_art;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
|
|
|
|
|
|
|
if (context->line_art)
|
|
|
|
{
|
|
|
|
g_source_remove (context->line_art_timeout_id);
|
|
|
|
context->line_art_timeout_id = 0;
|
|
|
|
|
|
|
|
line_art = context->line_art;
|
|
|
|
context->line_art = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
line_art = gimp_line_art_new ();
|
|
|
|
}
|
|
|
|
|
|
|
|
return line_art;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* gimp_context_store_line_art:
|
|
|
|
* @context:
|
|
|
|
* @line_art:
|
|
|
|
*
|
|
|
|
* The @context takes ownership of @line_art until the next time it is
|
|
|
|
* requested with gimp_context_take_line_art() or until 3 minutes have
|
|
|
|
* passed.
|
|
|
|
* This function allows to temporarily store the computed line art data
|
|
|
|
* in case it is needed very soon again, so that not to free and
|
|
|
|
* recompute all the time the data when quickly switching tools.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gimp_context_store_line_art (GimpContext *context,
|
|
|
|
GimpLineArt *line_art)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
|
|
|
g_return_if_fail (GIMP_IS_LINE_ART (line_art));
|
|
|
|
|
|
|
|
if (context->line_art)
|
|
|
|
{
|
|
|
|
g_source_remove (context->line_art_timeout_id);
|
|
|
|
context->line_art_timeout_id = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
context->line_art = line_art;
|
|
|
|
context->line_art_timeout_id = g_timeout_add (180000,
|
|
|
|
(GSourceFunc) gimp_context_free_line_art,
|
|
|
|
context);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_context_free_line_art (GimpContext *context)
|
|
|
|
{
|
|
|
|
g_clear_object (&context->line_art);
|
|
|
|
|
|
|
|
context->line_art_timeout_id = 0;
|
|
|
|
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-01-29 16:34:41 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* utility functions *******************************************************/
|
|
|
|
|
|
|
|
static gpointer
|
|
|
|
gimp_context_find_object (GimpContext *context,
|
|
|
|
GimpContainer *container,
|
|
|
|
const gchar *object_name,
|
|
|
|
gpointer standard_object)
|
|
|
|
{
|
|
|
|
GimpObject *object = NULL;
|
|
|
|
|
|
|
|
if (object_name)
|
|
|
|
object = gimp_container_get_child_by_name (container, object_name);
|
|
|
|
|
2005-04-12 21:36:54 +00:00
|
|
|
if (! object && ! gimp_container_is_empty (container))
|
2004-01-29 16:34:41 +00:00
|
|
|
object = gimp_container_get_child_by_index (container, 0);
|
|
|
|
|
|
|
|
if (! object)
|
|
|
|
object = standard_object;
|
|
|
|
|
|
|
|
return object;
|
|
|
|
}
|