mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-22 04:22:29 +00:00
f38cdf123c
2000-09-29 Michael Natterer <mitch@gimp.org> * app/brush_edit.[ch] * app/brush_header.h * app/gimpbrush.[ch] * app/gimpbrushgenerated.[ch] * app/gimpbrushlist.[ch] * app/gimpbrushpipe.[ch] * app/gimpcontext.h * app/gimplist.[ch] * app/gimpobject.[ch] * app/gimpset.[ch] * app/gimpsignal.[ch] * app/parasitelist.h: Lotsa fixes in the brush referencing code and cleanups in many GtkObjects: - Reference brushes correctly (call gtk_object_sink() after adding them to the brush list). Don't crash when renaming a brush multiple times. - Replaced all gtk_object_destroy() with gtk_object_unref|sink(). - Removed the "Fake Gimp object system" (gimp_object_destroy() et.al.) all over the place (while it's a good idea to have a common Gimp base object, it's totally useless to try to imitate Gtk's object system). - s/sz_BrushHeader/sizeof(BrushHeader)/g - And of course various indentation and coding style paranoia changes in all files I visited.
217 lines
4.4 KiB
C
217 lines
4.4 KiB
C
/* The GIMP -- an image manipulation program
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#include "gimpsignal.h"
|
|
|
|
struct _GimpSignalType
|
|
{
|
|
GtkSignalMarshaller marshaller;
|
|
GtkType return_type;
|
|
guint nparams;
|
|
const GtkType *param_types;
|
|
};
|
|
|
|
typedef const GtkType TypeArr[];
|
|
|
|
GimpSignalID
|
|
gimp_signal_new (const gchar *name,
|
|
GtkSignalRunType signal_flags,
|
|
GtkType object_type,
|
|
guint function_offset,
|
|
GimpSignalType *sig_type)
|
|
{
|
|
return gtk_signal_newv (name,
|
|
signal_flags,
|
|
object_type,
|
|
function_offset,
|
|
sig_type->marshaller,
|
|
sig_type->return_type,
|
|
sig_type->nparams,
|
|
/* Bah. We try to be const correct, but
|
|
gtk isn't.. */
|
|
(GtkType *) sig_type->param_types);
|
|
}
|
|
|
|
|
|
/* void__void */
|
|
|
|
static GimpSignalType sigtype_void =
|
|
{
|
|
gtk_signal_default_marshaller,
|
|
GTK_TYPE_NONE,
|
|
0,
|
|
NULL
|
|
};
|
|
|
|
GimpSignalType * const gimp_sigtype_void = &sigtype_void;
|
|
|
|
|
|
/* void__pointer */
|
|
|
|
static void
|
|
gimp_marshaller_pointer (GtkObject *object,
|
|
GtkSignalFunc func,
|
|
gpointer func_data,
|
|
GtkArg *args)
|
|
{
|
|
(* (GimpHandlerPointer) func) (object,
|
|
GTK_VALUE_POINTER (args[0]),
|
|
func_data);
|
|
}
|
|
|
|
static TypeArr pointer_types =
|
|
{
|
|
GTK_TYPE_POINTER
|
|
};
|
|
|
|
static GimpSignalType sigtype_pointer =
|
|
{
|
|
gimp_marshaller_pointer,
|
|
GTK_TYPE_NONE,
|
|
1,
|
|
pointer_types
|
|
};
|
|
|
|
GimpSignalType * const gimp_sigtype_pointer = &sigtype_pointer;
|
|
|
|
|
|
/* void__int */
|
|
|
|
static void
|
|
gimp_marshaller_int (GtkObject *object,
|
|
GtkSignalFunc func,
|
|
gpointer func_data,
|
|
GtkArg *args)
|
|
{
|
|
(* (GimpHandlerInt) func) (object,
|
|
GTK_VALUE_INT (args[0]),
|
|
func_data);
|
|
}
|
|
|
|
static TypeArr int_types =
|
|
{
|
|
GTK_TYPE_INT
|
|
};
|
|
|
|
static GimpSignalType sigtype_int =
|
|
{
|
|
gimp_marshaller_int,
|
|
GTK_TYPE_NONE,
|
|
1,
|
|
int_types
|
|
};
|
|
|
|
GimpSignalType* const gimp_sigtype_int = &sigtype_int;
|
|
|
|
|
|
/* void__double */
|
|
|
|
static void
|
|
gimp_marshaller_double (GtkObject *object,
|
|
GtkSignalFunc func,
|
|
gpointer func_data,
|
|
GtkArg *args)
|
|
{
|
|
(* (GimpHandlerDouble) func) (object,
|
|
GTK_VALUE_DOUBLE (args[0]),
|
|
func_data);
|
|
}
|
|
|
|
static TypeArr double_types =
|
|
{
|
|
GTK_TYPE_DOUBLE
|
|
};
|
|
|
|
static GimpSignalType sigtype_double =
|
|
{
|
|
gimp_marshaller_double,
|
|
GTK_TYPE_NONE,
|
|
1,
|
|
double_types
|
|
};
|
|
|
|
GimpSignalType* const gimp_sigtype_double = &sigtype_double;
|
|
|
|
|
|
/* void__int_int_int */
|
|
|
|
static void
|
|
gimp_marshaller_int_int_int (GtkObject *object,
|
|
GtkSignalFunc func,
|
|
gpointer func_data,
|
|
GtkArg *args)
|
|
{
|
|
(* (GimpHandlerIntIntInt) func) (object,
|
|
GTK_VALUE_INT (args[0]),
|
|
GTK_VALUE_INT (args[1]),
|
|
GTK_VALUE_INT (args[2]),
|
|
func_data);
|
|
}
|
|
|
|
static TypeArr int_int_int_types =
|
|
{
|
|
GTK_TYPE_INT,
|
|
GTK_TYPE_INT,
|
|
GTK_TYPE_INT
|
|
};
|
|
|
|
static GimpSignalType sigtype_int_int_int =
|
|
{
|
|
gimp_marshaller_int_int_int,
|
|
GTK_TYPE_NONE,
|
|
3,
|
|
int_int_int_types
|
|
};
|
|
|
|
GimpSignalType* const gimp_sigtype_int_int_int = &sigtype_int_int_int;
|
|
|
|
|
|
/* void__int_int_int_int */
|
|
|
|
static void
|
|
gimp_marshaller_int_int_int_int (GtkObject *object,
|
|
GtkSignalFunc func,
|
|
gpointer func_data,
|
|
GtkArg *args)
|
|
{
|
|
(* (GimpHandlerIntIntIntInt) func) (object,
|
|
GTK_VALUE_INT (args[0]),
|
|
GTK_VALUE_INT (args[1]),
|
|
GTK_VALUE_INT (args[2]),
|
|
GTK_VALUE_INT (args[3]),
|
|
func_data);
|
|
}
|
|
|
|
static TypeArr int_int_int_int_types =
|
|
{
|
|
GTK_TYPE_INT,
|
|
GTK_TYPE_INT,
|
|
GTK_TYPE_INT,
|
|
GTK_TYPE_INT
|
|
};
|
|
|
|
static GimpSignalType sigtype_int_int_int_int =
|
|
{
|
|
gimp_marshaller_int_int_int_int,
|
|
GTK_TYPE_NONE,
|
|
4,
|
|
int_int_int_int_types
|
|
};
|
|
|
|
GimpSignalType * const gimp_sigtype_int_int_int_int = &sigtype_int_int_int_int;
|