1997-11-24 22:05:25 +00:00
/* The GIMP -- an image manipulation program
2003-07-03 00:47:26 +00:00
* Copyright ( C ) 1995 - 2003 Spencer Kimball and Peter Mattis
1997-11-24 22:05:25 +00:00
*
* 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
1998-04-13 05:44:11 +00:00
* Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
1997-11-24 22:05:25 +00:00
*/
1999-03-28 06:55:29 +00:00
/* NOTE: This file is autogenerated by pdbgen.pl. */
2000-12-29 15:22:01 +00:00
# include "config.h"
2004-07-10 20:29:11 +00:00
# include <glib-object.h>
2000-12-29 15:22:01 +00:00
2001-08-17 14:27:31 +00:00
# include "pdb-types.h"
2006-04-26 09:13:47 +00:00
# include "gimppdb.h"
2006-03-31 09:15:08 +00:00
# include "gimpprocedure.h"
2006-03-28 19:58:00 +00:00
# include "core/gimpparamspecs.h"
1997-11-24 22:05:25 +00:00
2001-10-31 21:20:09 +00:00
# include "core/gimp.h"
2003-10-06 12:17:11 +00:00
# include "core/gimpcontainer.h"
2001-05-09 02:32:03 +00:00
# include "core/gimpimage.h"
1997-11-24 22:05:25 +00:00
2006-04-04 10:30:58 +00:00
static GValueArray *
display_new_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args )
1999-03-28 06:55:29 +00:00
{
gboolean success = TRUE ;
2006-04-04 10:30:58 +00:00
GValueArray * return_vals ;
2006-03-23 21:17:16 +00:00
GimpImage * image ;
2004-07-10 20:29:11 +00:00
GimpObject * display = NULL ;
1999-03-28 06:55:29 +00:00
2006-04-04 10:30:58 +00:00
image = gimp_value_get_image ( & args - > values [ 0 ] , gimp ) ;
1997-11-24 22:05:25 +00:00
if ( success )
{
2006-03-23 21:17:16 +00:00
display = gimp_create_display ( gimp , image , GIMP_UNIT_PIXEL , 1.0 ) ;
2004-03-26 16:38:44 +00:00
2006-03-22 17:19:14 +00:00
if ( display )
{
/* the first display takes ownership of the image */
2006-03-23 21:17:16 +00:00
if ( image - > disp_count = = 1 )
g_object_unref ( image ) ;
2006-03-22 17:19:14 +00:00
}
else
success = FALSE ;
1997-11-24 22:05:25 +00:00
}
2006-03-31 17:42:13 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ) ;
1997-11-24 22:05:25 +00:00
if ( success )
2006-04-04 10:30:58 +00:00
gimp_value_set_display ( & return_vals - > values [ 1 ] , display ) ;
1997-11-24 22:05:25 +00:00
2006-03-27 21:09:32 +00:00
return return_vals ;
1997-11-24 22:05:25 +00:00
}
2006-04-04 10:30:58 +00:00
static GValueArray *
display_delete_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args )
1997-11-24 22:05:25 +00:00
{
1999-03-28 06:55:29 +00:00
gboolean success = TRUE ;
2004-07-10 20:29:11 +00:00
GimpObject * display ;
1997-11-24 22:05:25 +00:00
2006-04-04 10:30:58 +00:00
display = gimp_value_get_display ( & args - > values [ 0 ] , gimp ) ;
1997-11-24 22:05:25 +00:00
1999-03-28 06:55:29 +00:00
if ( success )
2006-03-22 09:58:08 +00:00
{
gimp_delete_display ( gimp , display ) ;
}
1999-03-28 06:55:29 +00:00
2006-03-31 17:42:13 +00:00
return gimp_procedure_get_return_values ( procedure , success ) ;
1997-11-24 22:05:25 +00:00
}
2006-04-04 10:30:58 +00:00
static GValueArray *
display_get_window_handle_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args )
2005-09-05 20:47:12 +00:00
{
gboolean success = TRUE ;
2006-04-04 10:30:58 +00:00
GValueArray * return_vals ;
2005-09-05 20:47:12 +00:00
GimpObject * display ;
gint32 window = 0 ;
2006-04-04 10:30:58 +00:00
display = gimp_value_get_display ( & args - > values [ 0 ] , gimp ) ;
2005-09-05 20:47:12 +00:00
if ( success )
2006-03-22 09:58:08 +00:00
{
window = ( gint32 ) gimp_get_display_window ( gimp , display ) ;
}
2005-09-05 20:47:12 +00:00
2006-03-31 17:42:13 +00:00
return_vals = gimp_procedure_get_return_values ( procedure , success ) ;
2005-09-05 20:47:12 +00:00
if ( success )
2006-04-04 10:30:58 +00:00
g_value_set_int ( & return_vals - > values [ 1 ] , window ) ;
2005-09-05 20:47:12 +00:00
2006-03-27 21:09:32 +00:00
return return_vals ;
2005-09-05 20:47:12 +00:00
}
2006-04-04 10:30:58 +00:00
static GValueArray *
displays_flush_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args )
1997-11-24 22:05:25 +00:00
{
2003-10-06 12:17:11 +00:00
gimp_container_foreach ( gimp - > images , ( GFunc ) gimp_image_flush , NULL ) ;
2006-03-31 17:42:13 +00:00
return gimp_procedure_get_return_values ( procedure , TRUE ) ;
1997-11-24 22:05:25 +00:00
}
2006-04-04 10:30:58 +00:00
static GValueArray *
displays_reconnect_invoker ( GimpProcedure * procedure ,
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GValueArray * args )
2002-12-03 12:10:21 +00:00
{
gboolean success = TRUE ;
2003-12-08 12:28:29 +00:00
GimpImage * old_image ;
GimpImage * new_image ;
2002-12-03 12:10:21 +00:00
2006-04-04 10:30:58 +00:00
old_image = gimp_value_get_image ( & args - > values [ 0 ] , gimp ) ;
new_image = gimp_value_get_image ( & args - > values [ 1 ] , gimp ) ;
2002-12-03 12:10:21 +00:00
if ( success )
2004-11-29 16:59:53 +00:00
{
success = ( old_image ! = new_image & &
old_image - > disp_count > 0 & &
new_image - > disp_count = = 0 ) ;
if ( success )
{
gimp_reconnect_displays ( gimp , old_image , new_image ) ;
/* take ownership of the image */
if ( new_image - > disp_count > 0 )
g_object_unref ( new_image ) ;
}
}
2002-12-03 12:10:21 +00:00
2006-03-31 17:42:13 +00:00
return gimp_procedure_get_return_values ( procedure , success ) ;
2002-12-03 12:10:21 +00:00
}
2006-04-04 21:11:45 +00:00
void
2006-04-26 09:13:47 +00:00
register_display_procs ( GimpPDB * pdb )
2002-12-03 12:10:21 +00:00
{
2006-04-04 21:11:45 +00:00
GimpProcedure * procedure ;
/*
* gimp - display - new
*/
2006-04-06 10:01:30 +00:00
procedure = gimp_procedure_new ( display_new_invoker ) ;
2006-04-07 10:04:27 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) , " gimp-display-new " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-display-new " ,
" Create a new display for the specified image. " ,
" Creates a new display for the specified image. If the image already has a display, another is added. Multiple displays are handled transparently by the GIMP. The newly created display is returned and can be subsequently destroyed with a call to 'gimp-display-delete'. This procedure only makes sense for use with the GIMP UI. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_image_id ( " image " ,
" image " ,
" The image " ,
2006-05-06 18:57:51 +00:00
pdb - > gimp , FALSE ,
2006-04-04 21:11:45 +00:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_display_id ( " display " ,
" display " ,
" The new display " ,
2006-05-06 18:57:51 +00:00
pdb - > gimp , FALSE ,
2006-04-04 21:11:45 +00:00
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2006-04-04 21:11:45 +00:00
/*
* gimp - display - delete
*/
2006-04-06 10:01:30 +00:00
procedure = gimp_procedure_new ( display_delete_invoker ) ;
2006-04-07 10:04:27 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) , " gimp-display-delete " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-display-delete " ,
" Delete the specified display. " ,
" This procedure removes the specified display. If this is the last remaining display for the underlying image, then the image is deleted also. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_display_id ( " display " ,
" display " ,
" The display to delete " ,
2006-05-06 18:57:51 +00:00
pdb - > gimp , FALSE ,
2006-04-04 21:11:45 +00:00
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2006-04-04 21:11:45 +00:00
/*
* gimp - display - get - window - handle
*/
2006-04-06 10:01:30 +00:00
procedure = gimp_procedure_new ( display_get_window_handle_invoker ) ;
2006-04-07 10:04:27 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) , " gimp-display-get-window-handle " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-display-get-window-handle " ,
" Get a handle to the native window for an image display. " ,
" This procedure returns a handle to the native window for a given image display. For example in the X backend of GDK, a native window handle is an Xlib XID. A value of 0 is returned for an invalid display or if this function is unimplemented for the windowing system that is being used. " ,
" Sven Neumann <sven@gimp.org> " ,
" Sven Neumann " ,
" 2005 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_display_id ( " display " ,
" display " ,
" The display to get the window handle from " ,
2006-05-06 18:57:51 +00:00
pdb - > gimp , FALSE ,
2006-04-04 21:11:45 +00:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_int32 ( " window " ,
" window " ,
" The native window handle or 0 " ,
G_MININT32 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2006-04-04 21:11:45 +00:00
/*
* gimp - displays - flush
*/
2006-04-06 10:01:30 +00:00
procedure = gimp_procedure_new ( displays_flush_invoker ) ;
2006-04-07 10:04:27 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) , " gimp-displays-flush " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-displays-flush " ,
" Flush all internal changes to the user interface " ,
" This procedure takes no arguments and returns nothing except a success status. Its purpose is to flush all pending updates of image manipulations to the user interface. It should be called whenever appropriate. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
NULL ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2006-04-04 21:11:45 +00:00
/*
* gimp - displays - reconnect
*/
2006-04-06 10:01:30 +00:00
procedure = gimp_procedure_new ( displays_reconnect_invoker ) ;
2006-04-07 10:04:27 +00:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) , " gimp-displays-reconnect " ) ;
2006-04-04 21:11:45 +00:00
gimp_procedure_set_static_strings ( procedure ,
" gimp-displays-reconnect " ,
" Reconnect displays from one image to another image. " ,
" This procedure connects all displays of the old_image to the new_image. If the old_image has no display or new_image already has a display the reconnect is not performed and the procedure returns without success. You should rarely need to use this function. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
NULL ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_image_id ( " old-image " ,
" old image " ,
" The old image (must have at least one display) " ,
2006-05-06 18:57:51 +00:00
pdb - > gimp , FALSE ,
2006-04-04 21:11:45 +00:00
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_image_id ( " new-image " ,
" new image " ,
" The new image (must not have a display) " ,
2006-05-06 18:57:51 +00:00
pdb - > gimp , FALSE ,
2006-04-04 21:11:45 +00:00
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 09:13:47 +00:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 08:16:26 +00:00
g_object_unref ( procedure ) ;
2006-04-04 21:11:45 +00:00
}