app/gimpcontainer.[ch] made the "get_by_name" and the "by_index" access

2001-02-05  Michael Natterer  <mitch@gimp.org>

	* app/gimpcontainer.[ch]
	* app/gimplist.[ch]: made the "get_by_name" and the "by_index"
	access functions methods of the GimpContainerClass. The semantic
	of this index is somewhat unclear if we have e.g. a hash table
	implementation but the container needs to have an order for the
	ContainerView. Finally, the ordering will be a feature of the
	ContainerView.

	* app/gimpmarshal.[ch]: marshallers needed for the new methods.

	* app/brushes.[ch]
	* app/patterns.[ch]: the public global brush and pattern lists
	are GimpContainers now (they are really GimpLists of course).

	* app/brush_select.c
	* app/devices.c
	* app/gimpcontainerlistview.c
	* app/gimpcontext.c
	* app/gimpdnd.c
	* app/pattern_select.c
	* app/pdb/brush_select_cmds.c
	* app/pdb/brushes_cmds.c
	* app/pdb/pattern_select_cmds.c
	* app/pdb/patterns_cmds.c
	* tools/pdbgen/pdb/brush_select.pdb
	* tools/pdbgen/pdb/brushes.pdb
	* tools/pdbgen/pdb/pattern_select.pdb
	* tools/pdbgen/pdb/patterns.pdb: changed accordingly.
This commit is contained in:
Michael Natterer 2001-02-05 17:48:50 +00:00 committed by Michael Natterer
parent be0e7d119c
commit 2e464cf5e6
40 changed files with 684 additions and 279 deletions

View File

@ -1,3 +1,34 @@
2001-02-05 Michael Natterer <mitch@gimp.org>
* app/gimpcontainer.[ch]
* app/gimplist.[ch]: made the "get_by_name" and the "by_index"
access functions methods of the GimpContainerClass. The semantic
of this index is somewhat unclear if we have e.g. a hash table
implementation but the container needs to have an order for the
ContainerView. Finally, the ordering will be a feature of the
ContainerView.
* app/gimpmarshal.[ch]: marshallers needed for the new methods.
* app/brushes.[ch]
* app/patterns.[ch]: the public global brush and pattern lists
are GimpContainers now (they are really GimpLists of course).
* app/brush_select.c
* app/devices.c
* app/gimpcontainerlistview.c
* app/gimpcontext.c
* app/gimpdnd.c
* app/pattern_select.c
* app/pdb/brush_select_cmds.c
* app/pdb/brushes_cmds.c
* app/pdb/pattern_select_cmds.c
* app/pdb/patterns_cmds.c
* tools/pdbgen/pdb/brush_select.pdb
* tools/pdbgen/pdb/brushes.pdb
* tools/pdbgen/pdb/pattern_select.pdb
* tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-05 Michael Natterer <mitch@gimp.org>
* app/Makefile.am

View File

@ -310,8 +310,9 @@ brush_select_new (gchar *title,
if (title && init_name && strlen (init_name))
{
active = (GimpBrush *) gimp_list_get_child_by_name (global_brush_list,
init_name);
active = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
init_name);
}
else
{
@ -836,7 +837,8 @@ brush_select_select (BrushSelect *bsp,
gint row, col;
gint scroll_offset = 0;
index = gimp_list_get_child_index (global_brush_list, GIMP_OBJECT (brush));
index = gimp_container_get_child_index (GIMP_CONTAINER (global_brush_list),
GIMP_OBJECT (brush));
if (index < 0)
return;
@ -886,7 +888,8 @@ brush_select_brush_dirty_callback (GimpBrush *brush,
if (!bsp || bsp->freeze)
return;
index = gimp_list_get_child_index (global_brush_list, GIMP_OBJECT (brush));
index = gimp_container_get_child_index (GIMP_CONTAINER (global_brush_list),
GIMP_OBJECT (brush));
redraw = (brush != gimp_context_get_brush (bsp->context));
clear_brush (bsp, brush,
@ -1568,8 +1571,9 @@ brush_select_events (GtkWidget *widget,
index = row * bsp->NUM_BRUSH_COLUMNS + col;
/* Get the brush and check if it is editable */
brush = GIMP_BRUSH (gimp_list_get_child_by_index (global_brush_list,
index));
brush = (GimpBrush *)
gimp_container_get_child_by_index (GIMP_CONTAINER (global_brush_list),
index);
if (GIMP_IS_BRUSH_GENERATED (brush))
brush_select_edit_brush_callback (NULL, bsp);
break;
@ -1581,8 +1585,9 @@ brush_select_events (GtkWidget *widget,
row = (bevent->y + bsp->scroll_offset) / bsp->cell_height;
index = row * bsp->NUM_BRUSH_COLUMNS + col;
brush = (GimpBrush *) gimp_list_get_child_by_index (global_brush_list,
index);
brush = (GimpBrush *)
gimp_container_get_child_by_index (GIMP_CONTAINER (global_brush_list),
index);
if (brush)
bsp->dnd_brush = brush;
@ -1709,10 +1714,13 @@ brush_select_scroll_update (GtkAdjustment *adjustment,
if (active)
{
index = gimp_list_get_child_index (global_brush_list,
GIMP_OBJECT (active));
index =
gimp_container_get_child_index (GIMP_CONTAINER (global_brush_list),
GIMP_OBJECT (active));
if (index < 0)
return;
row = index / bsp->NUM_BRUSH_COLUMNS;
col = index - row * bsp->NUM_BRUSH_COLUMNS;

View File

@ -43,7 +43,7 @@
/* global variables */
GimpList *global_brush_list = NULL;
GimpContainer *global_brush_list = NULL;
/* local function prototypes */
@ -57,7 +57,7 @@ brushes_init (gboolean no_data)
if (global_brush_list)
brushes_free ();
else
global_brush_list = GIMP_LIST (gimp_data_list_new (GIMP_TYPE_BRUSH));
global_brush_list = GIMP_CONTAINER (gimp_data_list_new (GIMP_TYPE_BRUSH));
if (brush_path != NULL && !no_data)
{
@ -122,8 +122,7 @@ brushes_brush_load (const gchar *filename)
}
if (brush != NULL)
gimp_container_add (GIMP_CONTAINER (global_brush_list),
GIMP_OBJECT (brush));
gimp_container_add (global_brush_list, GIMP_OBJECT (brush));
}
void
@ -148,8 +147,7 @@ brushes_free (void)
if (GIMP_IS_BRUSH_GENERATED (brush) && vbr_dir)
gimp_brush_generated_save (GIMP_BRUSH_GENERATED (brush), vbr_dir);
gimp_container_remove (GIMP_CONTAINER (global_brush_list),
GIMP_OBJECT (brush));
gimp_container_remove (global_brush_list, GIMP_OBJECT (brush));
}
brush_select_thaw_all ();

View File

@ -20,7 +20,7 @@
#define __BRUSHES_H__
extern GimpList *global_brush_list;
extern GimpContainer *global_brush_list;
void brushes_init (gboolean no_data);

View File

@ -23,6 +23,7 @@
#include "apptypes.h"
#include "gimpcontainer.h"
#include "gimpmarshal.h"
typedef struct _GimpContainerHandler
@ -41,6 +42,9 @@ enum
REMOVE,
HAVE,
FOREACH,
GET_CHILD_BY_NAME,
GET_CHILD_BY_INDEX,
GET_CHILD_INDEX,
LAST_SIGNAL
};
@ -143,14 +147,47 @@ gimp_container_class_init (GimpContainerClass* klass)
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
container_signals[GET_CHILD_BY_NAME] =
gtk_signal_new ("get_child_by_name",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContainerClass,
get_child_by_name),
gimp_marshal_POINTER__POINTER,
GIMP_TYPE_OBJECT, 1,
GTK_TYPE_POINTER);
container_signals[GET_CHILD_BY_INDEX] =
gtk_signal_new ("get_child_by_index",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContainerClass,
get_child_by_index),
gimp_marshal_POINTER__INT,
GIMP_TYPE_OBJECT, 1,
GTK_TYPE_INT);
container_signals[GET_CHILD_INDEX] =
gtk_signal_new ("get_child_index",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContainerClass,
get_child_index),
gtk_marshal_INT__POINTER,
GTK_TYPE_INT, 1,
GIMP_TYPE_OBJECT);
gtk_object_class_add_signals (object_class, container_signals, LAST_SIGNAL);
object_class->destroy = gimp_container_destroy;
klass->add = NULL;
klass->remove = NULL;
klass->have = NULL;
klass->foreach = NULL;
klass->add = NULL;
klass->remove = NULL;
klass->have = NULL;
klass->foreach = NULL;
klass->get_child_by_name = NULL;
klass->get_child_by_index = NULL;
klass->get_child_index = NULL;
}
static void
@ -351,6 +388,55 @@ gimp_container_foreach (GimpContainer *container,
func, user_data);
}
GimpObject *
gimp_container_get_child_by_name (const GimpContainer *container,
const gchar *name)
{
GimpObject *object = NULL;
g_return_val_if_fail (container != NULL, NULL);
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (name != NULL, NULL);
gtk_signal_emit (GTK_OBJECT (container), container_signals[GET_CHILD_BY_NAME],
name, &object);
return object;
}
GimpObject *
gimp_container_get_child_by_index (const GimpContainer *container,
gint index)
{
GimpObject *object = NULL;
g_return_val_if_fail (container != NULL, NULL);
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (index >= 0 && index < container->num_children, NULL);
gtk_signal_emit (GTK_OBJECT (container), container_signals[GET_CHILD_BY_INDEX],
index, &object);
return object;
}
gint
gimp_container_get_child_index (const GimpContainer *container,
const GimpObject *object)
{
gint index = -1;
g_return_val_if_fail (container != NULL, -1);
g_return_val_if_fail (GIMP_IS_CONTAINER (container), -1);
g_return_val_if_fail (object != NULL, -1);
g_return_val_if_fail (GTK_CHECK_TYPE (object, container->children_type), -1);
gtk_signal_emit (GTK_OBJECT (container), container_signals[GET_CHILD_INDEX],
object, &index);
return index;
}
static void
gimp_container_add_handler_foreach_func (GimpObject *object,
GimpContainerHandler *handler)

View File

@ -56,41 +56,54 @@ struct _GimpContainerClass
{
GimpObjectClass parent_class;
void (* add) (GimpContainer *container,
GimpObject *object);
void (* remove) (GimpContainer *container,
GimpObject *object);
gboolean (* have) (GimpContainer *container,
GimpObject *object);
void (* foreach) (GimpContainer *container,
GFunc func,
gpointer user_data);
void (* add) (GimpContainer *container,
GimpObject *object);
void (* remove) (GimpContainer *container,
GimpObject *object);
gboolean (* have) (GimpContainer *container,
GimpObject *object);
void (* foreach) (GimpContainer *container,
GFunc func,
gpointer user_data);
GimpObject * (* get_child_by_name) (GimpContainer *container,
gchar *name);
GimpObject * (* get_child_by_index) (GimpContainer *container,
gint index);
gint (* get_child_index) (GimpContainer *container,
GimpObject *object);
};
GtkType gimp_container_get_type (void);
GtkType gimp_container_get_type (void);
GtkType gimp_container_children_type (const GimpContainer *container);
GimpContainerPolicy gimp_container_policy (const GimpContainer *container);
gint gimp_container_num_children (const GimpContainer *container);
GtkType gimp_container_children_type (const GimpContainer *container);
GimpContainerPolicy gimp_container_policy (const GimpContainer *container);
gint gimp_container_num_children (const GimpContainer *container);
gboolean gimp_container_add (GimpContainer *container,
GimpObject *object);
gboolean gimp_container_remove (GimpContainer *container,
GimpObject *object);
gboolean gimp_container_add (GimpContainer *container,
GimpObject *object);
gboolean gimp_container_remove (GimpContainer *container,
GimpObject *object);
gboolean gimp_container_have (GimpContainer *container,
GimpObject *object);
void gimp_container_foreach (GimpContainer *container,
GFunc func,
gpointer user_data);
gboolean gimp_container_have (GimpContainer *container,
GimpObject *object);
void gimp_container_foreach (GimpContainer *container,
GFunc func,
gpointer user_data);
GQuark gimp_container_add_handler (GimpContainer *container,
const gchar *signame,
GtkSignalFunc handler,
gpointer user_data);
void gimp_container_remove_handler (GimpContainer *container,
GQuark id);
GimpObject * gimp_container_get_child_by_name (const GimpContainer *container,
const gchar *name);
GimpObject * gimp_container_get_child_by_index (const GimpContainer *container,
gint index);
gint gimp_container_get_child_index (const GimpContainer *container,
const GimpObject *object);
GQuark gimp_container_add_handler (GimpContainer *container,
const gchar *signame,
GtkSignalFunc handler,
gpointer user_data);
void gimp_container_remove_handler (GimpContainer *container,
GQuark id);
#endif /* __GIMP_CONTAINER_H__ */

View File

@ -30,8 +30,8 @@
#include "context_manager.h"
#include "gdisplay.h"
#include "gimpbrush.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimppattern.h"
#include "gimprc.h"
@ -1490,8 +1490,9 @@ gimp_context_refresh_brush (GimpContext *context,
if (! context->brush_name)
context->brush_name = g_strdup (default_brush);
if ((brush = (GimpBrush *) gimp_list_get_child_by_name (global_brush_list,
context->brush_name)))
if ((brush = (GimpBrush *)
gimp_container_get_child_by_name (global_brush_list,
context->brush_name)))
{
gimp_context_real_set_brush (context, brush);
return;
@ -1499,8 +1500,8 @@ gimp_context_refresh_brush (GimpContext *context,
if (gimp_container_num_children (GIMP_CONTAINER (global_brush_list)))
gimp_context_real_set_brush
(context, GIMP_BRUSH (gimp_list_get_child_by_index (global_brush_list,
0)));
(context, GIMP_BRUSH (gimp_container_get_child_by_index (global_brush_list,
0)));
else
gimp_context_real_set_brush (context, brushes_get_standard_brush ());
}
@ -1675,9 +1676,9 @@ gimp_context_refresh_pattern (GimpContext *context,
if (! context->pattern_name)
context->pattern_name = g_strdup (default_pattern);
if ((pattern =
(GimpPattern *) gimp_list_get_child_by_name (global_pattern_list,
context->pattern_name)))
if ((pattern = (GimpPattern *)
gimp_container_get_child_by_name (global_pattern_list,
context->pattern_name)))
{
gimp_context_real_set_pattern (context, pattern);
return;
@ -1685,8 +1686,9 @@ gimp_context_refresh_pattern (GimpContext *context,
if (gimp_container_num_children (GIMP_CONTAINER (global_pattern_list)))
gimp_context_real_set_pattern
(context, GIMP_PATTERN (gimp_list_get_child_by_index (global_pattern_list,
0)));
(context,
GIMP_PATTERN (gimp_container_get_child_by_index (global_pattern_list,
0)));
else
gimp_context_real_set_pattern (context, patterns_get_standard_pattern ());
}

View File

@ -26,18 +26,24 @@
#include "gimplist.h"
static void gimp_list_class_init (GimpListClass *klass);
static void gimp_list_init (GimpList *list);
static void gimp_list_destroy (GtkObject *object);
static void gimp_list_add (GimpContainer *container,
GimpObject *object);
static void gimp_list_remove (GimpContainer *container,
GimpObject *object);
static gboolean gimp_list_have (GimpContainer *container,
GimpObject *object);
static void gimp_list_foreach (GimpContainer *container,
GFunc func,
gpointer user_data);
static void gimp_list_class_init (GimpListClass *klass);
static void gimp_list_init (GimpList *list);
static void gimp_list_destroy (GtkObject *object);
static void gimp_list_add (GimpContainer *container,
GimpObject *object);
static void gimp_list_remove (GimpContainer *container,
GimpObject *object);
static gboolean gimp_list_have (GimpContainer *container,
GimpObject *object);
static void gimp_list_foreach (GimpContainer *container,
GFunc func,
gpointer user_data);
static GimpObject * gimp_list_get_child_by_name (GimpContainer *container,
gchar *name);
static GimpObject * gimp_list_get_child_by_index (GimpContainer *container,
gint index);
static gint gimp_list_get_child_index (GimpContainer *container,
GimpObject *object);
static GimpContainerClass *parent_class = NULL;
@ -81,10 +87,13 @@ gimp_list_class_init (GimpListClass *klass)
object_class->destroy = gimp_list_destroy;
container_class->add = gimp_list_add;
container_class->remove = gimp_list_remove;
container_class->have = gimp_list_have;
container_class->foreach = gimp_list_foreach;
container_class->add = gimp_list_add;
container_class->remove = gimp_list_remove;
container_class->have = gimp_list_have;
container_class->foreach = gimp_list_foreach;
container_class->get_child_by_name = gimp_list_get_child_by_name;
container_class->get_child_by_index = gimp_list_get_child_by_index;
container_class->get_child_index = gimp_list_get_child_index;
}
static void
@ -173,16 +182,15 @@ gimp_list_new (GtkType children_type,
return list;
}
GimpObject *
gimp_list_get_child_by_name (const GimpList *list,
const gchar *name)
static GimpObject *
gimp_list_get_child_by_name (GimpContainer *container,
gchar *name)
{
GimpList *list;
GimpObject *object;
GList *glist;
g_return_val_if_fail (list != NULL, NULL);
g_return_val_if_fail (GIMP_IS_LIST (list), NULL);
g_return_val_if_fail (name != NULL, NULL);
list = GIMP_LIST (container);
for (glist = list->list; glist; glist = g_list_next (glist))
{
@ -195,14 +203,14 @@ gimp_list_get_child_by_name (const GimpList *list,
return NULL;
}
GimpObject *
gimp_list_get_child_by_index (const GimpList *list,
gint index)
static GimpObject *
gimp_list_get_child_by_index (GimpContainer *container,
gint index)
{
GList *glist;
GimpList *list;
GList *glist;
g_return_val_if_fail (list != NULL, NULL);
g_return_val_if_fail (GIMP_IS_LIST (list), NULL);
list = GIMP_LIST (container);
glist = g_list_nth (list->list, index);
@ -212,14 +220,13 @@ gimp_list_get_child_by_index (const GimpList *list,
return NULL;
}
gint
gimp_list_get_child_index (const GimpList *list,
const GimpObject *object)
static gint
gimp_list_get_child_index (GimpContainer *container,
GimpObject *object)
{
g_return_val_if_fail (list != NULL, 0);
g_return_val_if_fail (GIMP_IS_LIST (list), 0);
g_return_val_if_fail (object != NULL, 0);
g_return_val_if_fail (GIMP_IS_OBJECT (list), 0);
GimpList *list;
list = GIMP_LIST (container);
return g_list_index (list->list, (gpointer) object);
}

View File

@ -49,12 +49,5 @@ GtkType gimp_list_get_type (void);
GimpList * gimp_list_new (GtkType children_type,
GimpContainerPolicy policy);
GimpObject * gimp_list_get_child_by_name (const GimpList *list,
const gchar *name);
GimpObject * gimp_list_get_child_by_index (const GimpList *list,
gint index);
gint gimp_list_get_child_index (const GimpList *list,
const GimpObject *object);
#endif /* __GIMP_LIST_H__ */

View File

@ -81,6 +81,57 @@ gimp_marshal_NONE__DOUBLE (GtkObject *object,
}
typedef gint (* GimpSignal_INT__POINTER) (GtkObject *object,
gpointer arg1,
gpointer user_data);
void
gimp_marshal_INT__POINTER (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args)
{
*GTK_RETLOC_INT (args[1]) =
(* (GimpSignal_INT__POINTER) func) (object,
GTK_VALUE_POINTER (args[0]),
func_data);
}
typedef gpointer (* GimpSignal_POINTER__INT) (GtkObject *object,
gint arg1,
gpointer user_data);
void
gimp_marshal_POINTER__INT (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args)
{
*GTK_RETLOC_POINTER (args[1]) =
(* (GimpSignal_POINTER__INT) func) (object,
GTK_VALUE_INT (args[0]),
func_data);
}
typedef gpointer (* GimpSignal_POINTER__POINTER) (GtkObject *object,
gpointer arg1,
gpointer user_data);
void
gimp_marshal_POINTER__POINTER (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args)
{
*GTK_RETLOC_POINTER (args[1]) =
(* (GimpSignal_POINTER__POINTER) func) (object,
GTK_VALUE_POINTER (args[0]),
func_data);
}
typedef gpointer (* GimpSignal_POINTER__INT_INT) (GtkObject *object,
gint arg1,
gint arg2,

View File

@ -35,6 +35,21 @@ void gimp_marshal_NONE__DOUBLE (GtkObject *object,
gpointer func_data,
GtkArg *args);
void gimp_marshal_INT__POINTER (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
void gimp_marshal_POINTER__INT (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
void gimp_marshal_POINTER__POINTER (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
void gimp_marshal_POINTER__INT_INT (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,

View File

@ -468,8 +468,9 @@ devices_rc_update (gchar *name,
{
GimpBrush *brush;
brush = (GimpBrush *) gimp_list_get_child_by_name (global_brush_list,
brush_name);
brush = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
brush_name);
if (brush)
{
@ -486,8 +487,9 @@ devices_rc_update (gchar *name,
{
GimpPattern *pattern;
pattern = (GimpPattern *) gimp_list_get_child_by_name (global_pattern_list,
pattern_name);
pattern = (GimpPattern *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_pattern_list),
pattern_name);
if (pattern)
{

View File

@ -23,6 +23,7 @@
#include "apptypes.h"
#include "gimpcontainer.h"
#include "gimpmarshal.h"
typedef struct _GimpContainerHandler
@ -41,6 +42,9 @@ enum
REMOVE,
HAVE,
FOREACH,
GET_CHILD_BY_NAME,
GET_CHILD_BY_INDEX,
GET_CHILD_INDEX,
LAST_SIGNAL
};
@ -143,14 +147,47 @@ gimp_container_class_init (GimpContainerClass* klass)
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
container_signals[GET_CHILD_BY_NAME] =
gtk_signal_new ("get_child_by_name",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContainerClass,
get_child_by_name),
gimp_marshal_POINTER__POINTER,
GIMP_TYPE_OBJECT, 1,
GTK_TYPE_POINTER);
container_signals[GET_CHILD_BY_INDEX] =
gtk_signal_new ("get_child_by_index",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContainerClass,
get_child_by_index),
gimp_marshal_POINTER__INT,
GIMP_TYPE_OBJECT, 1,
GTK_TYPE_INT);
container_signals[GET_CHILD_INDEX] =
gtk_signal_new ("get_child_index",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContainerClass,
get_child_index),
gtk_marshal_INT__POINTER,
GTK_TYPE_INT, 1,
GIMP_TYPE_OBJECT);
gtk_object_class_add_signals (object_class, container_signals, LAST_SIGNAL);
object_class->destroy = gimp_container_destroy;
klass->add = NULL;
klass->remove = NULL;
klass->have = NULL;
klass->foreach = NULL;
klass->add = NULL;
klass->remove = NULL;
klass->have = NULL;
klass->foreach = NULL;
klass->get_child_by_name = NULL;
klass->get_child_by_index = NULL;
klass->get_child_index = NULL;
}
static void
@ -351,6 +388,55 @@ gimp_container_foreach (GimpContainer *container,
func, user_data);
}
GimpObject *
gimp_container_get_child_by_name (const GimpContainer *container,
const gchar *name)
{
GimpObject *object = NULL;
g_return_val_if_fail (container != NULL, NULL);
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (name != NULL, NULL);
gtk_signal_emit (GTK_OBJECT (container), container_signals[GET_CHILD_BY_NAME],
name, &object);
return object;
}
GimpObject *
gimp_container_get_child_by_index (const GimpContainer *container,
gint index)
{
GimpObject *object = NULL;
g_return_val_if_fail (container != NULL, NULL);
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (index >= 0 && index < container->num_children, NULL);
gtk_signal_emit (GTK_OBJECT (container), container_signals[GET_CHILD_BY_INDEX],
index, &object);
return object;
}
gint
gimp_container_get_child_index (const GimpContainer *container,
const GimpObject *object)
{
gint index = -1;
g_return_val_if_fail (container != NULL, -1);
g_return_val_if_fail (GIMP_IS_CONTAINER (container), -1);
g_return_val_if_fail (object != NULL, -1);
g_return_val_if_fail (GTK_CHECK_TYPE (object, container->children_type), -1);
gtk_signal_emit (GTK_OBJECT (container), container_signals[GET_CHILD_INDEX],
object, &index);
return index;
}
static void
gimp_container_add_handler_foreach_func (GimpObject *object,
GimpContainerHandler *handler)

View File

@ -56,41 +56,54 @@ struct _GimpContainerClass
{
GimpObjectClass parent_class;
void (* add) (GimpContainer *container,
GimpObject *object);
void (* remove) (GimpContainer *container,
GimpObject *object);
gboolean (* have) (GimpContainer *container,
GimpObject *object);
void (* foreach) (GimpContainer *container,
GFunc func,
gpointer user_data);
void (* add) (GimpContainer *container,
GimpObject *object);
void (* remove) (GimpContainer *container,
GimpObject *object);
gboolean (* have) (GimpContainer *container,
GimpObject *object);
void (* foreach) (GimpContainer *container,
GFunc func,
gpointer user_data);
GimpObject * (* get_child_by_name) (GimpContainer *container,
gchar *name);
GimpObject * (* get_child_by_index) (GimpContainer *container,
gint index);
gint (* get_child_index) (GimpContainer *container,
GimpObject *object);
};
GtkType gimp_container_get_type (void);
GtkType gimp_container_get_type (void);
GtkType gimp_container_children_type (const GimpContainer *container);
GimpContainerPolicy gimp_container_policy (const GimpContainer *container);
gint gimp_container_num_children (const GimpContainer *container);
GtkType gimp_container_children_type (const GimpContainer *container);
GimpContainerPolicy gimp_container_policy (const GimpContainer *container);
gint gimp_container_num_children (const GimpContainer *container);
gboolean gimp_container_add (GimpContainer *container,
GimpObject *object);
gboolean gimp_container_remove (GimpContainer *container,
GimpObject *object);
gboolean gimp_container_add (GimpContainer *container,
GimpObject *object);
gboolean gimp_container_remove (GimpContainer *container,
GimpObject *object);
gboolean gimp_container_have (GimpContainer *container,
GimpObject *object);
void gimp_container_foreach (GimpContainer *container,
GFunc func,
gpointer user_data);
gboolean gimp_container_have (GimpContainer *container,
GimpObject *object);
void gimp_container_foreach (GimpContainer *container,
GFunc func,
gpointer user_data);
GQuark gimp_container_add_handler (GimpContainer *container,
const gchar *signame,
GtkSignalFunc handler,
gpointer user_data);
void gimp_container_remove_handler (GimpContainer *container,
GQuark id);
GimpObject * gimp_container_get_child_by_name (const GimpContainer *container,
const gchar *name);
GimpObject * gimp_container_get_child_by_index (const GimpContainer *container,
gint index);
gint gimp_container_get_child_index (const GimpContainer *container,
const GimpObject *object);
GQuark gimp_container_add_handler (GimpContainer *container,
const gchar *signame,
GtkSignalFunc handler,
gpointer user_data);
void gimp_container_remove_handler (GimpContainer *container,
GQuark id);
#endif /* __GIMP_CONTAINER_H__ */

View File

@ -222,8 +222,8 @@ gimp_container_list_view_add (GimpContainerListView *list_view,
{
gint index;
index = gimp_list_get_child_index (GIMP_LIST (container),
GIMP_OBJECT (viewable));
index = gimp_container_get_child_index (container,
GIMP_OBJECT (viewable));
gimp_container_list_view_insert (list_view, viewable, index);
}

View File

@ -30,8 +30,8 @@
#include "context_manager.h"
#include "gdisplay.h"
#include "gimpbrush.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimppattern.h"
#include "gimprc.h"
@ -1490,8 +1490,9 @@ gimp_context_refresh_brush (GimpContext *context,
if (! context->brush_name)
context->brush_name = g_strdup (default_brush);
if ((brush = (GimpBrush *) gimp_list_get_child_by_name (global_brush_list,
context->brush_name)))
if ((brush = (GimpBrush *)
gimp_container_get_child_by_name (global_brush_list,
context->brush_name)))
{
gimp_context_real_set_brush (context, brush);
return;
@ -1499,8 +1500,8 @@ gimp_context_refresh_brush (GimpContext *context,
if (gimp_container_num_children (GIMP_CONTAINER (global_brush_list)))
gimp_context_real_set_brush
(context, GIMP_BRUSH (gimp_list_get_child_by_index (global_brush_list,
0)));
(context, GIMP_BRUSH (gimp_container_get_child_by_index (global_brush_list,
0)));
else
gimp_context_real_set_brush (context, brushes_get_standard_brush ());
}
@ -1675,9 +1676,9 @@ gimp_context_refresh_pattern (GimpContext *context,
if (! context->pattern_name)
context->pattern_name = g_strdup (default_pattern);
if ((pattern =
(GimpPattern *) gimp_list_get_child_by_name (global_pattern_list,
context->pattern_name)))
if ((pattern = (GimpPattern *)
gimp_container_get_child_by_name (global_pattern_list,
context->pattern_name)))
{
gimp_context_real_set_pattern (context, pattern);
return;
@ -1685,8 +1686,9 @@ gimp_context_refresh_pattern (GimpContext *context,
if (gimp_container_num_children (GIMP_CONTAINER (global_pattern_list)))
gimp_context_real_set_pattern
(context, GIMP_PATTERN (gimp_list_get_child_by_index (global_pattern_list,
0)));
(context,
GIMP_PATTERN (gimp_container_get_child_by_index (global_pattern_list,
0)));
else
gimp_context_real_set_pattern (context, patterns_get_standard_pattern ());
}

View File

@ -31,10 +31,10 @@
#include "fileops.h"
#include "gimpimage.h"
#include "gimpbrush.h"
#include "gimpcontainer.h"
#include "gimpcontextpreview.h"
#include "gimpdnd.h"
#include "gimpdrawable.h"
#include "gimplist.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "gradient.h"
@ -661,7 +661,8 @@ gimp_dnd_set_brush_data (GtkWidget *widget,
if (strcmp (name, "Standard") == 0)
brush = brushes_get_standard_brush ();
else
brush = (GimpBrush *) gimp_list_get_child_by_name (global_brush_list, name);
brush = (GimpBrush *) gimp_container_get_child_by_name (global_brush_list,
name);
if (brush)
(* (GimpDndDropBrushFunc) set_brush_func) (widget, brush, set_brush_data);
@ -761,8 +762,8 @@ gimp_dnd_set_pattern_data (GtkWidget *widget,
if (strcmp (name, "Standard") == 0)
pattern = patterns_get_standard_pattern ();
else
pattern = (GimpPattern *) gimp_list_get_child_by_name (global_pattern_list,
name);
pattern = (GimpPattern *) gimp_container_get_child_by_name (global_pattern_list,
name);
if (pattern)
(* (GimpDndDropPatternFunc) set_pattern_func) (widget, pattern,

View File

@ -26,18 +26,24 @@
#include "gimplist.h"
static void gimp_list_class_init (GimpListClass *klass);
static void gimp_list_init (GimpList *list);
static void gimp_list_destroy (GtkObject *object);
static void gimp_list_add (GimpContainer *container,
GimpObject *object);
static void gimp_list_remove (GimpContainer *container,
GimpObject *object);
static gboolean gimp_list_have (GimpContainer *container,
GimpObject *object);
static void gimp_list_foreach (GimpContainer *container,
GFunc func,
gpointer user_data);
static void gimp_list_class_init (GimpListClass *klass);
static void gimp_list_init (GimpList *list);
static void gimp_list_destroy (GtkObject *object);
static void gimp_list_add (GimpContainer *container,
GimpObject *object);
static void gimp_list_remove (GimpContainer *container,
GimpObject *object);
static gboolean gimp_list_have (GimpContainer *container,
GimpObject *object);
static void gimp_list_foreach (GimpContainer *container,
GFunc func,
gpointer user_data);
static GimpObject * gimp_list_get_child_by_name (GimpContainer *container,
gchar *name);
static GimpObject * gimp_list_get_child_by_index (GimpContainer *container,
gint index);
static gint gimp_list_get_child_index (GimpContainer *container,
GimpObject *object);
static GimpContainerClass *parent_class = NULL;
@ -81,10 +87,13 @@ gimp_list_class_init (GimpListClass *klass)
object_class->destroy = gimp_list_destroy;
container_class->add = gimp_list_add;
container_class->remove = gimp_list_remove;
container_class->have = gimp_list_have;
container_class->foreach = gimp_list_foreach;
container_class->add = gimp_list_add;
container_class->remove = gimp_list_remove;
container_class->have = gimp_list_have;
container_class->foreach = gimp_list_foreach;
container_class->get_child_by_name = gimp_list_get_child_by_name;
container_class->get_child_by_index = gimp_list_get_child_by_index;
container_class->get_child_index = gimp_list_get_child_index;
}
static void
@ -173,16 +182,15 @@ gimp_list_new (GtkType children_type,
return list;
}
GimpObject *
gimp_list_get_child_by_name (const GimpList *list,
const gchar *name)
static GimpObject *
gimp_list_get_child_by_name (GimpContainer *container,
gchar *name)
{
GimpList *list;
GimpObject *object;
GList *glist;
g_return_val_if_fail (list != NULL, NULL);
g_return_val_if_fail (GIMP_IS_LIST (list), NULL);
g_return_val_if_fail (name != NULL, NULL);
list = GIMP_LIST (container);
for (glist = list->list; glist; glist = g_list_next (glist))
{
@ -195,14 +203,14 @@ gimp_list_get_child_by_name (const GimpList *list,
return NULL;
}
GimpObject *
gimp_list_get_child_by_index (const GimpList *list,
gint index)
static GimpObject *
gimp_list_get_child_by_index (GimpContainer *container,
gint index)
{
GList *glist;
GimpList *list;
GList *glist;
g_return_val_if_fail (list != NULL, NULL);
g_return_val_if_fail (GIMP_IS_LIST (list), NULL);
list = GIMP_LIST (container);
glist = g_list_nth (list->list, index);
@ -212,14 +220,13 @@ gimp_list_get_child_by_index (const GimpList *list,
return NULL;
}
gint
gimp_list_get_child_index (const GimpList *list,
const GimpObject *object)
static gint
gimp_list_get_child_index (GimpContainer *container,
GimpObject *object)
{
g_return_val_if_fail (list != NULL, 0);
g_return_val_if_fail (GIMP_IS_LIST (list), 0);
g_return_val_if_fail (object != NULL, 0);
g_return_val_if_fail (GIMP_IS_OBJECT (list), 0);
GimpList *list;
list = GIMP_LIST (container);
return g_list_index (list->list, (gpointer) object);
}

View File

@ -49,12 +49,5 @@ GtkType gimp_list_get_type (void);
GimpList * gimp_list_new (GtkType children_type,
GimpContainerPolicy policy);
GimpObject * gimp_list_get_child_by_name (const GimpList *list,
const gchar *name);
GimpObject * gimp_list_get_child_by_index (const GimpList *list,
gint index);
gint gimp_list_get_child_index (const GimpList *list,
const GimpObject *object);
#endif /* __GIMP_LIST_H__ */

View File

@ -81,6 +81,57 @@ gimp_marshal_NONE__DOUBLE (GtkObject *object,
}
typedef gint (* GimpSignal_INT__POINTER) (GtkObject *object,
gpointer arg1,
gpointer user_data);
void
gimp_marshal_INT__POINTER (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args)
{
*GTK_RETLOC_INT (args[1]) =
(* (GimpSignal_INT__POINTER) func) (object,
GTK_VALUE_POINTER (args[0]),
func_data);
}
typedef gpointer (* GimpSignal_POINTER__INT) (GtkObject *object,
gint arg1,
gpointer user_data);
void
gimp_marshal_POINTER__INT (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args)
{
*GTK_RETLOC_POINTER (args[1]) =
(* (GimpSignal_POINTER__INT) func) (object,
GTK_VALUE_INT (args[0]),
func_data);
}
typedef gpointer (* GimpSignal_POINTER__POINTER) (GtkObject *object,
gpointer arg1,
gpointer user_data);
void
gimp_marshal_POINTER__POINTER (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args)
{
*GTK_RETLOC_POINTER (args[1]) =
(* (GimpSignal_POINTER__POINTER) func) (object,
GTK_VALUE_POINTER (args[0]),
func_data);
}
typedef gpointer (* GimpSignal_POINTER__INT_INT) (GtkObject *object,
gint arg1,
gint arg2,

View File

@ -35,6 +35,21 @@ void gimp_marshal_NONE__DOUBLE (GtkObject *object,
gpointer func_data,
GtkArg *args);
void gimp_marshal_INT__POINTER (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
void gimp_marshal_POINTER__INT (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
void gimp_marshal_POINTER__POINTER (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
void gimp_marshal_POINTER__INT_INT (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,

View File

@ -310,8 +310,9 @@ brush_select_new (gchar *title,
if (title && init_name && strlen (init_name))
{
active = (GimpBrush *) gimp_list_get_child_by_name (global_brush_list,
init_name);
active = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
init_name);
}
else
{
@ -836,7 +837,8 @@ brush_select_select (BrushSelect *bsp,
gint row, col;
gint scroll_offset = 0;
index = gimp_list_get_child_index (global_brush_list, GIMP_OBJECT (brush));
index = gimp_container_get_child_index (GIMP_CONTAINER (global_brush_list),
GIMP_OBJECT (brush));
if (index < 0)
return;
@ -886,7 +888,8 @@ brush_select_brush_dirty_callback (GimpBrush *brush,
if (!bsp || bsp->freeze)
return;
index = gimp_list_get_child_index (global_brush_list, GIMP_OBJECT (brush));
index = gimp_container_get_child_index (GIMP_CONTAINER (global_brush_list),
GIMP_OBJECT (brush));
redraw = (brush != gimp_context_get_brush (bsp->context));
clear_brush (bsp, brush,
@ -1568,8 +1571,9 @@ brush_select_events (GtkWidget *widget,
index = row * bsp->NUM_BRUSH_COLUMNS + col;
/* Get the brush and check if it is editable */
brush = GIMP_BRUSH (gimp_list_get_child_by_index (global_brush_list,
index));
brush = (GimpBrush *)
gimp_container_get_child_by_index (GIMP_CONTAINER (global_brush_list),
index);
if (GIMP_IS_BRUSH_GENERATED (brush))
brush_select_edit_brush_callback (NULL, bsp);
break;
@ -1581,8 +1585,9 @@ brush_select_events (GtkWidget *widget,
row = (bevent->y + bsp->scroll_offset) / bsp->cell_height;
index = row * bsp->NUM_BRUSH_COLUMNS + col;
brush = (GimpBrush *) gimp_list_get_child_by_index (global_brush_list,
index);
brush = (GimpBrush *)
gimp_container_get_child_by_index (GIMP_CONTAINER (global_brush_list),
index);
if (brush)
bsp->dnd_brush = brush;
@ -1709,10 +1714,13 @@ brush_select_scroll_update (GtkAdjustment *adjustment,
if (active)
{
index = gimp_list_get_child_index (global_brush_list,
GIMP_OBJECT (active));
index =
gimp_container_get_child_index (GIMP_CONTAINER (global_brush_list),
GIMP_OBJECT (active));
if (index < 0)
return;
row = index / bsp->NUM_BRUSH_COLUMNS;
col = index - row * bsp->NUM_BRUSH_COLUMNS;

View File

@ -468,8 +468,9 @@ devices_rc_update (gchar *name,
{
GimpBrush *brush;
brush = (GimpBrush *) gimp_list_get_child_by_name (global_brush_list,
brush_name);
brush = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
brush_name);
if (brush)
{
@ -486,8 +487,9 @@ devices_rc_update (gchar *name,
{
GimpPattern *pattern;
pattern = (GimpPattern *) gimp_list_get_child_by_name (global_pattern_list,
pattern_name);
pattern = (GimpPattern *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_pattern_list),
pattern_name);
if (pattern)
{

View File

@ -468,8 +468,9 @@ devices_rc_update (gchar *name,
{
GimpBrush *brush;
brush = (GimpBrush *) gimp_list_get_child_by_name (global_brush_list,
brush_name);
brush = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
brush_name);
if (brush)
{
@ -486,8 +487,9 @@ devices_rc_update (gchar *name,
{
GimpPattern *pattern;
pattern = (GimpPattern *) gimp_list_get_child_by_name (global_pattern_list,
pattern_name);
pattern = (GimpPattern *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_pattern_list),
pattern_name);
if (pattern)
{

View File

@ -28,6 +28,7 @@
#include "appenv.h"
#include "dialog_handler.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdnd.h"
#include "gimplist.h"
@ -230,8 +231,9 @@ pattern_select_new (gchar *title,
if (title && initial_pattern && strlen (initial_pattern))
{
active = (GimpPattern *) gimp_list_get_child_by_name (global_pattern_list,
initial_pattern);
active = (GimpPattern *)
gimp_container_get_child_by_name (global_pattern_list,
initial_pattern);
}
else
{
@ -550,7 +552,8 @@ pattern_select_select (PatternSelect *psp,
gint row, col;
gint scroll_offset = 0;
index = gimp_list_get_child_index (global_pattern_list, GIMP_OBJECT (pattern));
index = gimp_container_get_child_index (global_pattern_list,
GIMP_OBJECT (pattern));
if (index < 0)
return;
@ -589,8 +592,8 @@ pattern_select_pattern_dirty_callback (GimpPattern *pattern,
if (!psp || psp->freeze)
return;
index = gimp_list_get_child_index (global_pattern_list,
GIMP_OBJECT (pattern));
index = gimp_container_get_child_index (global_pattern_list,
GIMP_OBJECT (pattern));
redraw = (pattern != gimp_context_get_pattern (psp->context));
display_pattern (psp, pattern,
@ -829,7 +832,7 @@ display_pattern (PatternSelect *psp,
static void
display_patterns (PatternSelect *psp)
{
GList *list = global_pattern_list->list;
GList *list = GIMP_LIST (global_pattern_list)->list;
gint row, col;
GimpPattern *pattern;
@ -1048,8 +1051,8 @@ pattern_select_events (GtkWidget *widget,
index = row * psp->NUM_PATTERN_COLUMNS + col;
pattern =
(GimpPattern *) gimp_list_get_child_by_index (global_pattern_list,
index);
(GimpPattern *) gimp_container_get_child_by_index (global_pattern_list,
index);
if (pattern)
psp->dnd_pattern = pattern;
@ -1139,8 +1142,8 @@ pattern_select_scroll_update (GtkAdjustment *adjustment,
if (active)
{
index = gimp_list_get_child_index (global_pattern_list,
GIMP_OBJECT (active));
index = gimp_container_get_child_index (global_pattern_list,
GIMP_OBJECT (active));
if (index < 0)
return;

View File

@ -28,6 +28,7 @@
#include "appenv.h"
#include "dialog_handler.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdnd.h"
#include "gimplist.h"
@ -230,8 +231,9 @@ pattern_select_new (gchar *title,
if (title && initial_pattern && strlen (initial_pattern))
{
active = (GimpPattern *) gimp_list_get_child_by_name (global_pattern_list,
initial_pattern);
active = (GimpPattern *)
gimp_container_get_child_by_name (global_pattern_list,
initial_pattern);
}
else
{
@ -550,7 +552,8 @@ pattern_select_select (PatternSelect *psp,
gint row, col;
gint scroll_offset = 0;
index = gimp_list_get_child_index (global_pattern_list, GIMP_OBJECT (pattern));
index = gimp_container_get_child_index (global_pattern_list,
GIMP_OBJECT (pattern));
if (index < 0)
return;
@ -589,8 +592,8 @@ pattern_select_pattern_dirty_callback (GimpPattern *pattern,
if (!psp || psp->freeze)
return;
index = gimp_list_get_child_index (global_pattern_list,
GIMP_OBJECT (pattern));
index = gimp_container_get_child_index (global_pattern_list,
GIMP_OBJECT (pattern));
redraw = (pattern != gimp_context_get_pattern (psp->context));
display_pattern (psp, pattern,
@ -829,7 +832,7 @@ display_pattern (PatternSelect *psp,
static void
display_patterns (PatternSelect *psp)
{
GList *list = global_pattern_list->list;
GList *list = GIMP_LIST (global_pattern_list)->list;
gint row, col;
GimpPattern *pattern;
@ -1048,8 +1051,8 @@ pattern_select_events (GtkWidget *widget,
index = row * psp->NUM_PATTERN_COLUMNS + col;
pattern =
(GimpPattern *) gimp_list_get_child_by_index (global_pattern_list,
index);
(GimpPattern *) gimp_container_get_child_by_index (global_pattern_list,
index);
if (pattern)
psp->dnd_pattern = pattern;
@ -1139,8 +1142,8 @@ pattern_select_scroll_update (GtkAdjustment *adjustment,
if (active)
{
index = gimp_list_get_child_index (global_pattern_list,
GIMP_OBJECT (active));
index = gimp_container_get_child_index (global_pattern_list,
GIMP_OBJECT (active));
if (index < 0)
return;

View File

@ -42,7 +42,7 @@ static void patterns_load_pattern (const gchar *filename);
/* global variables */
GimpList *global_pattern_list = NULL;
GimpContainer *global_pattern_list = NULL;
/* static variables */
@ -57,7 +57,7 @@ patterns_init (gboolean no_data)
if (global_pattern_list)
patterns_free ();
else
global_pattern_list = GIMP_LIST (gimp_data_list_new (GIMP_TYPE_PATTERN));
global_pattern_list = GIMP_CONTAINER (gimp_data_list_new (GIMP_TYPE_PATTERN));
if (pattern_path != NULL && !no_data)
{
@ -79,10 +79,11 @@ patterns_free (void)
pattern_select_freeze_all ();
while (global_pattern_list->list)
while (GIMP_LIST (global_pattern_list)->list)
{
gimp_container_remove (GIMP_CONTAINER (global_pattern_list),
GIMP_OBJECT (global_pattern_list->list->data));
gimp_container_remove
(global_pattern_list,
GIMP_OBJECT (GIMP_LIST (global_pattern_list)->list->data));
}
pattern_select_thaw_all ();
@ -134,6 +135,5 @@ patterns_load_pattern (const gchar *filename)
g_message (_("Warning: Failed to load pattern\n\"%s\""), filename);
if (pattern != NULL)
gimp_container_add (GIMP_CONTAINER (global_pattern_list),
GIMP_OBJECT (pattern));
gimp_container_add (global_pattern_list, GIMP_OBJECT (pattern));
}

View File

@ -20,7 +20,7 @@
#define __PATTERNS_H__
extern GimpList *global_pattern_list;
extern GimpContainer *global_pattern_list;
void patterns_init (gboolean no_data);

View File

@ -255,8 +255,8 @@ brushes_set_popup_invoker (Argument *args)
if ((prec = procedural_db_lookup (name)) &&
(bsp = brush_get_brushselect (name)))
{
GimpObject *object = gimp_list_get_child_by_name (global_brush_list,
brush_name);
GimpObject *object =
gimp_container_get_child_by_name (global_brush_list, brush_name);
if (object)
{

View File

@ -168,7 +168,7 @@ brushes_set_brush_invoker (Argument *args)
if (success)
{
object = gimp_list_get_child_by_name (global_brush_list, name);
object = gimp_container_get_child_by_name (global_brush_list, name);
if (object)
gimp_context_set_brush (NULL, GIMP_BRUSH (object));
@ -444,7 +444,7 @@ brushes_list_invoker (Argument *args)
GList *list = NULL;
int i = 0;
brushes = g_new (char *, GIMP_CONTAINER (global_brush_list)->num_children);
brushes = g_new (char *, global_brush_list->num_children);
success = (list = GIMP_LIST (global_brush_list)->list) != NULL;
@ -458,7 +458,7 @@ brushes_list_invoker (Argument *args)
if (success)
{
return_args[1].value.pdb_int = GIMP_CONTAINER (global_brush_list)->num_children;
return_args[1].value.pdb_int = global_brush_list->num_children;
return_args[2].value.pdb_pointer = brushes;
}

View File

@ -218,8 +218,8 @@ patterns_set_popup_invoker (Argument *args)
(psp = pattern_get_patternselect (name)))
{
GimpPattern *active =
(GimpPattern *) gimp_list_get_child_by_name (global_pattern_list,
pattern_name);
(GimpPattern *) gimp_container_get_child_by_name (global_pattern_list,
pattern_name);
if (active)
{

View File

@ -119,7 +119,9 @@ patterns_set_pattern_invoker (Argument *args)
{
success = FALSE;
for (list = global_pattern_list->list; list; list = g_list_next (list))
for (list = GIMP_LIST (global_pattern_list)->list;
list;
list = g_list_next (list))
{
pattern = (GimpPattern *) list->data;
@ -169,9 +171,9 @@ patterns_list_invoker (Argument *args)
GList *list = NULL;
gint i = 0;
patterns = g_new (gchar *, GIMP_CONTAINER (global_pattern_list)->num_children);
patterns = g_new (gchar *, global_pattern_list->num_children);
success = ((list = global_pattern_list->list) != NULL);
success = ((list = GIMP_LIST (global_pattern_list)->list) != NULL);
while (list)
{
@ -183,7 +185,7 @@ patterns_list_invoker (Argument *args)
if (success)
{
return_args[1].value.pdb_int = GIMP_CONTAINER (global_pattern_list)->num_children;
return_args[1].value.pdb_int = global_pattern_list->num_children;
return_args[2].value.pdb_pointer = patterns;
}
@ -242,7 +244,9 @@ patterns_get_pattern_data_invoker (Argument *args)
success = FALSE;
for (list = global_pattern_list->list; list; list = g_list_next (list))
for (list = GIMP_LIST (global_pattern_list)->list;
list;
list = g_list_next (list))
{
pattern = (GimpPattern *) list->data;

View File

@ -222,8 +222,8 @@ gimp_container_list_view_add (GimpContainerListView *list_view,
{
gint index;
index = gimp_list_get_child_index (GIMP_LIST (container),
GIMP_OBJECT (viewable));
index = gimp_container_get_child_index (container,
GIMP_OBJECT (viewable));
gimp_container_list_view_insert (list_view, viewable, index);
}

View File

@ -468,8 +468,9 @@ devices_rc_update (gchar *name,
{
GimpBrush *brush;
brush = (GimpBrush *) gimp_list_get_child_by_name (global_brush_list,
brush_name);
brush = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
brush_name);
if (brush)
{
@ -486,8 +487,9 @@ devices_rc_update (gchar *name,
{
GimpPattern *pattern;
pattern = (GimpPattern *) gimp_list_get_child_by_name (global_pattern_list,
pattern_name);
pattern = (GimpPattern *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_pattern_list),
pattern_name);
if (pattern)
{

View File

@ -468,8 +468,9 @@ devices_rc_update (gchar *name,
{
GimpBrush *brush;
brush = (GimpBrush *) gimp_list_get_child_by_name (global_brush_list,
brush_name);
brush = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
brush_name);
if (brush)
{
@ -486,8 +487,9 @@ devices_rc_update (gchar *name,
{
GimpPattern *pattern;
pattern = (GimpPattern *) gimp_list_get_child_by_name (global_pattern_list,
pattern_name);
pattern = (GimpPattern *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_pattern_list),
pattern_name);
if (pattern)
{

View File

@ -31,10 +31,10 @@
#include "fileops.h"
#include "gimpimage.h"
#include "gimpbrush.h"
#include "gimpcontainer.h"
#include "gimpcontextpreview.h"
#include "gimpdnd.h"
#include "gimpdrawable.h"
#include "gimplist.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "gradient.h"
@ -661,7 +661,8 @@ gimp_dnd_set_brush_data (GtkWidget *widget,
if (strcmp (name, "Standard") == 0)
brush = brushes_get_standard_brush ();
else
brush = (GimpBrush *) gimp_list_get_child_by_name (global_brush_list, name);
brush = (GimpBrush *) gimp_container_get_child_by_name (global_brush_list,
name);
if (brush)
(* (GimpDndDropBrushFunc) set_brush_func) (widget, brush, set_brush_data);
@ -761,8 +762,8 @@ gimp_dnd_set_pattern_data (GtkWidget *widget,
if (strcmp (name, "Standard") == 0)
pattern = patterns_get_standard_pattern ();
else
pattern = (GimpPattern *) gimp_list_get_child_by_name (global_pattern_list,
name);
pattern = (GimpPattern *) gimp_container_get_child_by_name (global_pattern_list,
name);
if (pattern)
(* (GimpDndDropPatternFunc) set_pattern_func) (widget, pattern,

View File

@ -132,8 +132,8 @@ sub brushes_set_popup {
if ((prec = procedural_db_lookup (name)) &&
(bsp = brush_get_brushselect (name)))
{
GimpObject *object = gimp_list_get_child_by_name (global_brush_list,
brush_name);
GimpObject *object =
gimp_container_get_child_by_name (global_brush_list, brush_name);
if (object)
{

View File

@ -135,7 +135,7 @@ HELP
vars => [ 'GimpObject *object' ],
code => <<'CODE'
{
object = gimp_list_get_child_by_name (global_brush_list, name);
object = gimp_container_get_child_by_name (global_brush_list, name);
if (object)
gimp_context_set_brush (NULL, GIMP_BRUSH (object));
@ -262,14 +262,14 @@ HELP
alias => 'brushes',
array => { name => 'num_brushes',
desc => 'The number of brushes in the brush list',
alias => 'GIMP_CONTAINER (global_brush_list)->num_children', no_declare => 1 } }
alias => 'global_brush_list->num_children', no_declare => 1 } }
);
%invoke = (
vars => [ 'GList *list = NULL', 'int i = 0' ],
code => <<'CODE'
{
brushes = g_new (char *, GIMP_CONTAINER (global_brush_list)->num_children);
brushes = g_new (char *, global_brush_list->num_children);
success = (list = GIMP_LIST (global_brush_list)->list) != NULL;

View File

@ -119,8 +119,8 @@ sub patterns_set_popup {
(psp = pattern_get_patternselect (name)))
{
GimpPattern *active =
(GimpPattern *) gimp_list_get_child_by_name (global_pattern_list,
pattern_name);
(GimpPattern *) gimp_container_get_child_by_name (global_pattern_list,
pattern_name);
if (active)
{

View File

@ -94,7 +94,9 @@ HELP
{
success = FALSE;
for (list = global_pattern_list->list; list; list = g_list_next (list))
for (list = GIMP_LIST (global_pattern_list)->list;
list;
list = g_list_next (list))
{
pattern = (GimpPattern *) list->data;
@ -126,16 +128,16 @@ HELP
alias => 'patterns',
array => { name => 'num_patterns',
desc => 'The number of patterns in the pattern list',
alias => 'GIMP_CONTAINER (global_pattern_list)->num_children', no_declare => 1 } }
alias => 'global_pattern_list->num_children', no_declare => 1 } }
);
%invoke = (
vars => [ 'GList *list = NULL', 'gint i = 0' ],
code => <<'CODE'
{
patterns = g_new (gchar *, GIMP_CONTAINER (global_pattern_list)->num_children);
patterns = g_new (gchar *, global_pattern_list->num_children);
success = ((list = global_pattern_list->list) != NULL);
success = ((list = GIMP_LIST (global_pattern_list)->list) != NULL);
while (list)
{
@ -190,7 +192,9 @@ HELP
success = FALSE;
for (list = global_pattern_list->list; list; list = g_list_next (list))
for (list = GIMP_LIST (global_pattern_list)->list;
list;
list = g_list_next (list))
{
pattern = (GimpPattern *) list->data;