示例#1
0
文件: icontainer.c 项目: jcupitt/nip2
void
icontainer_pos_renumber( iContainer *icontainer )
{
	int n = 0;
	GSList *changed;

#ifdef DEBUG_VERBOSE
{
	int i;

	printf( "icontainer_pos_renumber: " );
	iobject_print( IOBJECT( icontainer ) );
	printf( "\tbefore:\n" );
	i = 0;
	icontainer_map( icontainer, 
		(icontainer_map_fn) icontainer_print_element, &i, NULL );
}
#endif /*DEBUG_VERBOSE*/

	changed = NULL;
	icontainer_map( icontainer,
		(icontainer_map_fn) icontainer_pos_renumber_sub, &n, &changed );

	/* Tell all the children that have been renumbered.
	 */
#ifdef DEBUG_VERBOSE
	if( g_slist_length( changed ) > 1 ) {
		printf( "icontainer_pos_renumber: renumbering %d children! ",
			g_slist_length( changed ) );
		iobject_print( IOBJECT( icontainer ) );
	}
#endif /*DEBUG_VERBOSE*/
	slist_map( changed,
		(SListMapFn) icontainer_pos_changed, NULL );
	g_slist_free( changed );
	iobject_changed( IOBJECT( icontainer ) );

#ifdef DEBUG_VERBOSE
{
	int i;

	printf( "icontainer_pos_renumber: " );
	iobject_print( IOBJECT( icontainer ) );
	printf( "\tafter:\n" );
	i = 0;
	icontainer_map( icontainer, 
		(icontainer_map_fn) icontainer_print_element, &i, NULL );
}
#endif /*DEBUG_VERBOSE*/
}
示例#2
0
文件: icontainer.c 项目: jcupitt/nip2
/* Apply a function to the children of a icontainer.
 */
void *
icontainer_map_all_intrans( iContainer *icontainer, 
	icontainer_map_fn fn, void *a )
{
	return( icontainer_map( icontainer, 
		(icontainer_map_fn) icontainer_map_all, (void *) fn, a ) );
}
示例#3
0
文件: row.c 项目: imclab/nip2
static void *
row_set_to_save( Row *row )
{
	Row *enclosing;

	if( !row->to_save ) {
		row->to_save = TRUE;

		/* All peers must be saved. When we reload, we want to keep
		 * row ordering. If we just save modded row, they'll move to
		 * the front of the row list on reload, since they'll be made
		 * first.
		 */
		icontainer_map( ICONTAINER( row->scol ),
			(icontainer_map_fn) row_set_to_save, NULL, NULL );

		/* All rows back up to the top level must also be saved.
		 */
		for( enclosing = row; enclosing != row->top_row; 
			enclosing = row_get_parent( enclosing ) )
			row_set_to_save( enclosing );
	}

	return( NULL );
}
示例#4
0
文件: builtin.c 项目: DINKIN/nip2
/* Do "dir". 
 */
static void
apply_dir_call( Reduce *rc, const char *name, HeapNode **arg, PElement *out )
{
	PElement rhs;

        PEPOINTRIGHT( arg[0], &rhs );

	if( PEISCLASS( &rhs ) ) 
		/* This is more complex than it looks. We have to walk a class
		 * instance generating a list of member names, while not
		 * destroying the instance as we go, in the case that out will
		 * overwrite (rhs) arg[0].
		 */
		reduce_safe_pointer( rc, (reduce_safe_pointer_fn) dir_object,
			&rhs, out, NULL, NULL );
	else if( PEISSYMREF( &rhs ) ) {
		Symbol *sym = PEGETSYMREF( &rhs );

		if( is_scope( sym ) && sym->expr && sym->expr->compile ) {
			PElement list;

			list = *out;
			heap_list_init( &list );

			icontainer_map( ICONTAINER( sym->expr->compile ),
				(icontainer_map_fn) dir_scope, rc, &list );
		}
	}
	else if( PEISREAL( &rhs ) ) {
		/* Assume this is a gtype and try to get the children of that
		 * type.
		 */
		GType type = PEGETREAL( &rhs );
		PElement list;

		list = *out;
		heap_list_init( &list );

		if( !g_type_name( type ) ) {
			error_top( _( "No such type" ) );
			error_sub( _( "GType %u not found." ), 
				(unsigned int) type );
			reduce_throw( rc );
		}

		if( vips_type_map( type, dir_gtype, rc, &list ) ) 
			reduce_throw( rc );
	}
	else if( PEISMANAGEDGOBJECT( &rhs ) ) {
		guint n_properties;
		ManagedgobjectClass *class = 
			MANAGEDGOBJECT_GET_CLASS( PEGETMANAGEDGOBJECT( &rhs ) ); 
		GParamSpec **properties;

		properties = g_object_class_list_properties( 
			G_OBJECT_CLASS( class ), &n_properties );
		dir_gobject( rc, properties, n_properties, out );
		g_free( properties);
	}
示例#5
0
文件: workspace.c 项目: imclab/nip2
static void *
workspace_map_sub( Workspacegroup *wsg, workspace_map_fn fn, void *a, void *b )
{
	g_assert( IS_WORKSPACEGROUP( wsg ) ); 

	return( icontainer_map( ICONTAINER( wsg ),
		(icontainer_map_fn) fn, a, b ) );
}
示例#6
0
文件: icontainer.c 项目: jcupitt/nip2
int
icontainer_pos_last( iContainer *icontainer )
{
	int max = -1;

	icontainer_map( icontainer,
		(icontainer_map_fn) icontainer_pos_last_sub, &max, NULL );

	return( max );
}
示例#7
0
文件: icontainer.c 项目: jcupitt/nip2
void
icontainer_sanity( iContainer *icontainer )
{
	g_assert( IS_ICONTAINER( icontainer ) );

	if( icontainer->parent )
		icontainer_sanity_child( icontainer, icontainer->parent );
	icontainer_map( icontainer, 
		(icontainer_map_fn) icontainer_sanity_child, icontainer, NULL );
}
示例#8
0
文件: icontainer.c 项目: jcupitt/nip2
/* Apply a function to a tree of icontainers, bottom up.
 */
void *
icontainer_map_all( iContainer *icontainer, icontainer_map_fn fn, void *a )
{
	iContainer *result;

	if( (result = icontainer_map( icontainer, 
		(icontainer_map_fn) icontainer_map_all, (void *) fn, a )) )
		return( result );

	return( fn( icontainer, a, NULL ) );
}
示例#9
0
文件: workspace.c 项目: imclab/nip2
/* Search for a column by name.
 */
Column *
workspace_column_find( Workspace *ws, const char *name )
{
	Model *model;

	if( !(model = icontainer_map( ICONTAINER( ws ),
		(icontainer_map_fn) iobject_test_name, (void *) name, NULL )) ) 
		return( NULL );

	return( COLUMN( model ) );
}
示例#10
0
文件: icontainer.c 项目: jcupitt/nip2
static void
icontainer_dispose( GObject *gobject )
{
	iContainer *icontainer;

	g_return_if_fail( gobject != NULL );
	g_return_if_fail( IS_ICONTAINER( gobject ) );

	icontainer = ICONTAINER( gobject );

#ifdef DEBUG
	printf( "icontainer_dispose: (%p) %s \"%s\"\n",
		icontainer,
		G_OBJECT_TYPE_NAME( icontainer ), 
		NN( IOBJECT( icontainer )->name ) );
#endif /*DEBUG*/

	icontainer_map( icontainer,
		(icontainer_map_fn) icontainer_child_remove, NULL, NULL );
	icontainer_child_remove( icontainer );

	G_OBJECT_CLASS( parent_class )->dispose( gobject );
}
示例#11
0
文件: workspace.c 项目: imclab/nip2
/* Select all objects in all columns.
 */
void
workspace_select_all( Workspace *ws )
{
	(void) icontainer_map( ICONTAINER( ws ), 
		(icontainer_map_fn) column_select_symbols, NULL, NULL );
}
示例#12
0
文件: workspace.c 项目: imclab/nip2
/* Map across a Workspace, applying to the symbols of the top-level rows.
 */
void *
workspace_map_symbol( Workspace *ws, symbol_map_fn fn, void *a )
{
	return( icontainer_map( ICONTAINER( ws ), 
		(icontainer_map_fn) column_map_symbol, (void *) fn, a ) );
}
示例#13
0
文件: workspace.c 项目: imclab/nip2
/* Map across the columns in a workspace.
 */
void *
workspace_map_column( Workspace *ws, column_map_fn fn, void *a )
{
	return( icontainer_map( ICONTAINER( ws ), 
		(icontainer_map_fn) fn, a, NULL ) );
}