1997-11-25 06:05:25 +08:00
/* The GIMP -- an image manipulation program
2000-02-17 19:44:27 +08:00
* Copyright ( C ) 1995 - 2000 Spencer Kimball and Peter Mattis
1997-11-25 06:05:25 +08: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 13:44:11 +08:00
* Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
1997-11-25 06:05:25 +08:00
*/
1999-04-25 04:33:31 +08:00
/* NOTE: This file is autogenerated by pdbgen.pl. */
1998-01-22 15:02:57 +08:00
2000-12-29 23:22:01 +08:00
# include "config.h"
2001-08-17 22:27:31 +08:00
# include <glib-object.h>
1997-11-25 06:05:25 +08:00
2001-05-21 21:58:46 +08:00
# include "libgimpbase/gimpbasetypes.h"
2001-08-17 22:27:31 +08:00
# include "pdb-types.h"
2000-12-29 23:22:01 +08:00
# include "procedural_db.h"
2001-12-09 07:12:59 +08:00
# include "base/base-enums.h"
2002-11-19 04:50:31 +08:00
# include "config/gimpcoreconfig.h"
2001-12-12 02:11:56 +08:00
# include "core/core-enums.h"
2002-02-12 10:31:45 +08:00
# include "core/gimp.h"
2002-12-03 20:10:21 +08:00
# include "core/gimpdrawable.h"
2003-02-13 19:23:50 +08:00
# include "core/gimpimage-undo.h"
2001-05-09 10:32:03 +08:00
# include "core/gimpimage.h"
2002-02-22 06:19:45 +08:00
# include "core/gimplayer-floating-sel.h"
2001-05-09 10:32:03 +08:00
# include "core/gimplayer.h"
# include "core/gimplayermask.h"
# include "core/gimplist.h"
2003-03-26 00:38:19 +08:00
# include "gimp-intl.h"
2003-03-26 01:39:01 +08:00
# include "pdb_glue.h"
2003-02-13 19:23:50 +08:00
1999-04-25 04:33:31 +08:00
static ProcRecord layer_new_proc ;
static ProcRecord layer_copy_proc ;
static ProcRecord layer_create_mask_proc ;
static ProcRecord layer_scale_proc ;
static ProcRecord layer_resize_proc ;
static ProcRecord layer_delete_proc ;
static ProcRecord layer_translate_proc ;
static ProcRecord layer_add_alpha_proc ;
static ProcRecord layer_set_offsets_proc ;
static ProcRecord layer_mask_proc ;
static ProcRecord layer_is_floating_sel_proc ;
2002-12-03 20:10:21 +08:00
static ProcRecord layer_new_from_drawable_proc ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_get_name_proc ;
static ProcRecord layer_set_name_proc ;
static ProcRecord layer_get_visible_proc ;
static ProcRecord layer_set_visible_proc ;
static ProcRecord layer_get_preserve_trans_proc ;
static ProcRecord layer_set_preserve_trans_proc ;
2001-05-20 22:15:09 +08:00
static ProcRecord layer_get_apply_mask_proc ;
static ProcRecord layer_set_apply_mask_proc ;
static ProcRecord layer_get_show_mask_proc ;
static ProcRecord layer_set_show_mask_proc ;
static ProcRecord layer_get_edit_mask_proc ;
static ProcRecord layer_set_edit_mask_proc ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_get_opacity_proc ;
static ProcRecord layer_set_opacity_proc ;
static ProcRecord layer_get_mode_proc ;
static ProcRecord layer_set_mode_proc ;
static ProcRecord layer_get_linked_proc ;
static ProcRecord layer_set_linked_proc ;
static ProcRecord layer_get_tattoo_proc ;
2000-02-16 07:49:03 +08:00
static ProcRecord layer_set_tattoo_proc ;
1999-04-25 04:33:31 +08:00
void
2001-07-05 03:31:35 +08:00
register_layer_procs ( Gimp * gimp )
{
procedural_db_register ( gimp , & layer_new_proc ) ;
procedural_db_register ( gimp , & layer_copy_proc ) ;
procedural_db_register ( gimp , & layer_create_mask_proc ) ;
procedural_db_register ( gimp , & layer_scale_proc ) ;
procedural_db_register ( gimp , & layer_resize_proc ) ;
procedural_db_register ( gimp , & layer_delete_proc ) ;
procedural_db_register ( gimp , & layer_translate_proc ) ;
procedural_db_register ( gimp , & layer_add_alpha_proc ) ;
procedural_db_register ( gimp , & layer_set_offsets_proc ) ;
procedural_db_register ( gimp , & layer_mask_proc ) ;
procedural_db_register ( gimp , & layer_is_floating_sel_proc ) ;
2002-12-03 20:10:21 +08:00
procedural_db_register ( gimp , & layer_new_from_drawable_proc ) ;
2001-07-05 03:31:35 +08:00
procedural_db_register ( gimp , & layer_get_name_proc ) ;
procedural_db_register ( gimp , & layer_set_name_proc ) ;
procedural_db_register ( gimp , & layer_get_visible_proc ) ;
procedural_db_register ( gimp , & layer_set_visible_proc ) ;
procedural_db_register ( gimp , & layer_get_preserve_trans_proc ) ;
procedural_db_register ( gimp , & layer_set_preserve_trans_proc ) ;
procedural_db_register ( gimp , & layer_get_apply_mask_proc ) ;
procedural_db_register ( gimp , & layer_set_apply_mask_proc ) ;
procedural_db_register ( gimp , & layer_get_show_mask_proc ) ;
procedural_db_register ( gimp , & layer_set_show_mask_proc ) ;
procedural_db_register ( gimp , & layer_get_edit_mask_proc ) ;
procedural_db_register ( gimp , & layer_set_edit_mask_proc ) ;
procedural_db_register ( gimp , & layer_get_opacity_proc ) ;
procedural_db_register ( gimp , & layer_set_opacity_proc ) ;
procedural_db_register ( gimp , & layer_get_mode_proc ) ;
procedural_db_register ( gimp , & layer_set_mode_proc ) ;
procedural_db_register ( gimp , & layer_get_linked_proc ) ;
procedural_db_register ( gimp , & layer_set_linked_proc ) ;
procedural_db_register ( gimp , & layer_get_tattoo_proc ) ;
procedural_db_register ( gimp , & layer_set_tattoo_proc ) ;
1999-04-25 04:33:31 +08:00
}
1997-11-25 06:05:25 +08:00
static Argument *
2001-07-05 03:31:35 +08:00
layer_new_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
1997-11-25 06:05:25 +08:00
Argument * return_args ;
1999-04-25 04:33:31 +08:00
GimpImage * gimage ;
gint32 width ;
gint32 height ;
gint32 type ;
gchar * name ;
2002-03-04 22:52:54 +08:00
gdouble opacity ;
1999-04-25 04:33:31 +08:00
gint32 mode ;
GimpLayer * layer = NULL ;
1997-11-25 06:05:25 +08:00
2001-07-11 20:39:49 +08:00
gimage = gimp_image_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_IMAGE ( gimage ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
width = args [ 1 ] . value . pdb_int ;
if ( width < = 0 )
success = FALSE ;
height = args [ 2 ] . value . pdb_int ;
if ( height < = 0 )
success = FALSE ;
type = args [ 3 ] . value . pdb_int ;
2001-12-12 02:11:56 +08:00
if ( type < GIMP_RGB_IMAGE | | type > GIMP_INDEXEDA_IMAGE )
1999-04-25 04:33:31 +08:00
success = FALSE ;
name = ( gchar * ) args [ 4 ] . value . pdb_pointer ;
2002-03-04 22:52:54 +08:00
opacity = args [ 5 ] . value . pdb_float ;
if ( opacity < 0.0 | | opacity > 100.0 )
1999-04-25 04:33:31 +08:00
success = FALSE ;
mode = args [ 6 ] . value . pdb_int ;
2001-12-09 07:12:59 +08:00
if ( mode < GIMP_NORMAL_MODE | | mode > GIMP_COLOR_ERASE_MODE )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
if ( success )
{
2002-03-04 22:52:54 +08:00
layer = gimp_layer_new ( gimage ,
width , height ,
type ,
name ,
opacity / 100.0 , mode ) ;
success = ( layer ! = NULL ) ;
1997-11-25 06:05:25 +08:00
}
return_args = procedural_db_return_args ( & layer_new_proc , success ) ;
if ( success )
2002-02-26 01:58:50 +08:00
return_args [ 1 ] . value . pdb_int = gimp_item_get_ID ( GIMP_ITEM ( layer ) ) ;
1997-11-25 06:05:25 +08:00
return return_args ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_new_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_IMAGE ,
1997-11-25 06:05:25 +08:00
" image " ,
1999-04-25 04:33:31 +08:00
" The image to which to add the layer "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" width " ,
1999-04-25 04:33:31 +08:00
" The layer width: (0 < width) "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" height " ,
1999-04-25 04:33:31 +08:00
" The layer height: (0 < height) "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" type " ,
2001-12-12 02:11:56 +08:00
" The layer type: { GIMP_RGB_IMAGE (0), GIMP_RGBA_IMAGE (1), GIMP_GRAY_IMAGE (2), GIMP_GRAYA_IMAGE (3), GIMP_INDEXED_IMAGE (4), GIMP_INDEXEDA_IMAGE (5) } "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_STRING ,
1997-11-25 06:05:25 +08:00
" name " ,
1999-04-25 04:33:31 +08:00
" The layer name "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_FLOAT ,
1997-11-25 06:05:25 +08:00
" opacity " ,
1999-04-25 04:33:31 +08:00
" The layer opacity: (0 <= opacity <= 100) "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" mode " ,
2002-11-06 03:33:59 +08:00
" The layer combination mode: { GIMP_NORMAL_MODE (0), GIMP_DISSOLVE_MODE (1), GIMP_BEHIND_MODE (2), GIMP_MULTIPLY_MODE (3), GIMP_SCREEN_MODE (4), GIMP_OVERLAY_MODE (5), GIMP_DIFFERENCE_MODE (6), GIMP_ADDITION_MODE (7), GIMP_SUBTRACT_MODE (8), GIMP_DARKEN_ONLY_MODE (9), GIMP_LIGHTEN_ONLY_MODE (10), GIMP_HUE_MODE (11), GIMP_SATURATION_MODE (12), GIMP_COLOR_MODE (13), GIMP_VALUE_MODE (14), GIMP_DIVIDE_MODE (15), GIMP_DODGE_MODE (16), GIMP_BURN_MODE (17), GIMP_HARDLIGHT_MODE (18), GIMP_SOFTLIGHT_MODE (19), GIMP_GRAIN_EXTRACT_MODE (20), GIMP_GRAIN_MERGE_MODE (21), GIMP_COLOR_ERASE_MODE (22) } "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcArg layer_new_outargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The newly created layer "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_new_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_new " ,
1999-04-25 04:33:31 +08:00
" Create a new layer. " ,
" This procedure creates a new layer with the specified width, height, and type. Name, opacity, and mode are also supplied parameters. The new layer still needs to be added to the image, as this is not automatic. Add the new layer with the 'gimp_image_add_layer' command. Other attributes such as layer mask modes, and offsets should be set with explicit procedure calls. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
7 ,
1999-04-25 04:33:31 +08:00
layer_new_inargs ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_new_outargs ,
{ { layer_new_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_copy_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
1997-11-25 06:05:25 +08:00
Argument * return_args ;
1999-04-25 04:33:31 +08:00
GimpLayer * layer ;
gboolean add_alpha ;
GimpLayer * copy = NULL ;
1997-11-25 06:05:25 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
add_alpha = args [ 1 ] . value . pdb_int ? TRUE : FALSE ;
1997-11-25 06:05:25 +08:00
if ( success )
2003-02-11 21:52:47 +08:00
success = ( copy = GIMP_LAYER ( gimp_item_duplicate ( GIMP_ITEM ( layer ) , G_TYPE_FROM_INSTANCE ( layer ) , add_alpha ) ) ) ! = NULL ;
1997-11-25 06:05:25 +08:00
return_args = procedural_db_return_args ( & layer_copy_proc , success ) ;
if ( success )
2002-02-26 01:58:50 +08:00
return_args [ 1 ] . value . pdb_int = gimp_item_get_ID ( GIMP_ITEM ( copy ) ) ;
1997-11-25 06:05:25 +08:00
return return_args ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_copy_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer to copy "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1999-04-25 04:33:31 +08:00
" add_alpha " ,
" Add an alpha channel to the copied layer "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcArg layer_copy_outargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer_copy " ,
1999-04-25 04:33:31 +08:00
" The newly copied layer "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_copy_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_copy " ,
1999-04-25 04:33:31 +08:00
" Copy a layer. " ,
" This procedure copies the specified layer and returns the copy. The newly copied layer is for use within the original layer's image. It should not be subsequently added to any other image. The copied layer can optionally have an added alpha channel. This is useful if the background layer in an image is being copied and added to the same image. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
2 ,
1999-04-25 04:33:31 +08:00
layer_copy_inargs ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_copy_outargs ,
{ { layer_copy_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_create_mask_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
1997-11-25 06:05:25 +08:00
Argument * return_args ;
1999-04-25 04:33:31 +08:00
GimpLayer * layer ;
gint32 mask_type ;
2001-01-29 00:44:22 +08:00
GimpLayerMask * mask = NULL ;
1997-11-25 06:05:25 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
mask_type = args [ 1 ] . value . pdb_int ;
2003-03-06 21:22:11 +08:00
if ( mask_type < GIMP_ADD_WHITE_MASK | | mask_type > GIMP_ADD_COPY_MASK )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
if ( success )
2002-03-18 19:07:34 +08:00
success = ( mask = gimp_layer_create_mask ( layer , ( GimpAddMaskType ) mask_type ) ) ! = NULL ;
1997-11-25 06:05:25 +08:00
return_args = procedural_db_return_args ( & layer_create_mask_proc , success ) ;
if ( success )
2002-02-26 01:58:50 +08:00
return_args [ 1 ] . value . pdb_int = gimp_item_get_ID ( GIMP_ITEM ( mask ) ) ;
1997-11-25 06:05:25 +08:00
return return_args ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_create_mask_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer to which to add the mask "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" mask_type " ,
2003-03-06 21:22:11 +08:00
" The type of mask: { GIMP_ADD_WHITE_MASK (0), GIMP_ADD_BLACK_MASK (1), GIMP_ADD_ALPHA_MASK (2), GIMP_ADD_SELECTION_MASK (3), GIMP_ADD_COPY_MASK (4) } "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcArg layer_create_mask_outargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_CHANNEL ,
1997-11-25 06:05:25 +08:00
" mask " ,
1999-04-25 04:33:31 +08:00
" The newly created mask "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_create_mask_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_create_mask " ,
1999-04-25 04:33:31 +08:00
" Create a layer mask for the specified specified layer. " ,
2003-03-06 21:22:11 +08:00
" This procedure creates a layer mask for the specified layer. Layer masks serve as an additional alpha channel for a layer. A number of ifferent types of masks are allowed for initialisation: completely white masks (which will leave the layer fully visible), completely black masks (which will give the layer complete transparency, the layer's already existing alpha channel (which will leave the layer fully visible, but which may be more useful than a white mask), the current selection or a grayscale copy of the layer. The layer mask still needs to be added to the layer. This can be done with a call to 'gimp_image_add_layer_mask'. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
2 ,
1999-04-25 04:33:31 +08:00
layer_create_mask_inargs ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_create_mask_outargs ,
{ { layer_create_mask_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_scale_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
GimpLayer * layer ;
gint32 new_width ;
gint32 new_height ;
gboolean local_origin ;
GimpImage * gimage ;
2001-01-29 07:25:25 +08:00
GimpLayer * floating_layer ;
1997-11-25 06:05:25 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
new_width = args [ 1 ] . value . pdb_int ;
if ( new_width < = 0 )
success = FALSE ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
new_height = args [ 2 ] . value . pdb_int ;
if ( new_height < = 0 )
success = FALSE ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
local_origin = args [ 3 ] . value . pdb_int ? TRUE : FALSE ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
if ( success )
{
2002-02-26 01:58:50 +08:00
if ( ( gimage = gimp_item_get_image ( GIMP_ITEM ( layer ) ) ) )
1999-04-25 04:33:31 +08:00
{
2000-12-29 23:22:01 +08:00
floating_layer = gimp_image_floating_sel ( gimage ) ;
1999-04-25 04:33:31 +08:00
2003-02-13 19:23:50 +08:00
gimp_image_undo_group_start ( gimage , GIMP_UNDO_GROUP_LAYER_SCALE ,
_ ( " Scale Layer " ) ) ;
1999-04-25 04:33:31 +08:00
if ( floating_layer )
floating_sel_relax ( floating_layer , TRUE ) ;
2003-05-08 22:54:04 +08:00
gimp_item_scale_by_origin ( GIMP_ITEM ( layer ) , new_width , new_height , gimp - > config - > interpolation_type , local_origin ) ;
1999-04-25 04:33:31 +08:00
if ( floating_layer )
floating_sel_rigor ( floating_layer , TRUE ) ;
2003-02-13 19:23:50 +08:00
gimp_image_undo_group_end ( gimage ) ;
1999-04-25 04:33:31 +08:00
}
else
success = FALSE ;
1997-11-25 06:05:25 +08:00
}
return procedural_db_return_args ( & layer_scale_proc , success ) ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_scale_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" new_width " ,
1999-04-25 04:33:31 +08:00
" New layer width: (0 < new_width) "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" new_height " ,
1999-04-25 04:33:31 +08:00
" New layer height: (0 < new_height) "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" local_origin " ,
1999-04-25 04:33:31 +08:00
" Use a local origin (as opposed to the image origin) "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_scale_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_scale " ,
" Scale the layer to the specified extents. " ,
1999-04-25 04:33:31 +08:00
" This procedure scales the layer so that it's new width and height are equal to the supplied parameters. The \" local_origin \" parameter specifies whether to scale from the center of the layer, or from the image origin. This operation only works if the layer has been added to an image. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
4 ,
1999-04-25 04:33:31 +08:00
layer_scale_inargs ,
1997-11-25 06:05:25 +08:00
0 ,
NULL ,
1999-04-25 04:33:31 +08:00
{ { layer_scale_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_resize_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
GimpLayer * layer ;
gint32 new_width ;
gint32 new_height ;
gint32 offx ;
gint32 offy ;
GimpImage * gimage ;
2001-01-29 07:25:25 +08:00
GimpLayer * floating_layer ;
1997-11-25 06:05:25 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
new_width = args [ 1 ] . value . pdb_int ;
if ( new_width < = 0 )
success = FALSE ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
new_height = args [ 2 ] . value . pdb_int ;
if ( new_height < = 0 )
success = FALSE ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
offx = args [ 3 ] . value . pdb_int ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
offy = args [ 4 ] . value . pdb_int ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
if ( success )
{
2002-02-26 01:58:50 +08:00
if ( ( gimage = gimp_item_get_image ( GIMP_ITEM ( layer ) ) ) )
1999-04-25 04:33:31 +08:00
{
2000-12-29 23:22:01 +08:00
floating_layer = gimp_image_floating_sel ( gimage ) ;
1999-04-25 04:33:31 +08:00
2003-02-13 19:23:50 +08:00
gimp_image_undo_group_start ( gimage , GIMP_UNDO_GROUP_LAYER_RESIZE ,
_ ( " Resize Layer " ) ) ;
1999-04-25 04:33:31 +08:00
if ( floating_layer )
floating_sel_relax ( floating_layer , TRUE ) ;
2003-05-07 21:01:17 +08:00
gimp_item_resize ( GIMP_ITEM ( layer ) , new_width , new_height , offx , offy ) ;
1999-04-25 04:33:31 +08:00
if ( floating_layer )
floating_sel_rigor ( floating_layer , TRUE ) ;
2003-02-13 19:23:50 +08:00
gimp_image_undo_group_end ( gimage ) ;
1999-04-25 04:33:31 +08:00
}
else
success = FALSE ;
1997-11-25 06:05:25 +08:00
}
return procedural_db_return_args ( & layer_resize_proc , success ) ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_resize_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" new_width " ,
1999-04-25 04:33:31 +08:00
" New layer width: (0 < new_width) "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" new_height " ,
1999-04-25 04:33:31 +08:00
" New layer height: (0 < new_height) "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" offx " ,
" x offset between upper left corner of old and new layers: (new - old) "
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" offy " ,
" y offset between upper left corner of old and new layers: (new - old) "
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_resize_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_resize " ,
" Resize the layer to the specified extents. " ,
1999-04-25 04:33:31 +08:00
" This procedure resizes the layer so that it's new width and height are equal to the supplied parameters. Offsets are also provided which describe the position of the previous layer's content. This operation only works if the layer has been added to an image. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
5 ,
1999-04-25 04:33:31 +08:00
layer_resize_inargs ,
1997-11-25 06:05:25 +08:00
0 ,
NULL ,
1999-04-25 04:33:31 +08:00
{ { layer_resize_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_delete_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
GimpLayer * layer ;
1997-11-25 06:05:25 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
2000-12-29 03:17:41 +08:00
if ( success )
2001-08-17 22:27:31 +08:00
{
2002-02-26 01:58:50 +08:00
if ( ! gimp_item_get_image ( GIMP_ITEM ( layer ) ) )
2001-08-17 22:27:31 +08:00
{
2003-01-06 06:07:10 +08:00
g_object_unref ( layer ) ;
2001-08-17 22:27:31 +08:00
success = TRUE ;
}
}
2000-12-29 03:17:41 +08:00
1997-11-25 06:05:25 +08:00
return procedural_db_return_args ( & layer_delete_proc , success ) ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_delete_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer to delete "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_delete_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_delete " ,
1999-04-25 04:33:31 +08:00
" Delete a layer. " ,
2000-12-29 03:17:41 +08:00
" This procedure deletes the specified layer. This must not be done if the gimage containing this layer was already deleted or if the layer was already removed from the image. The only case in which this procedure is useful is if you want to get rid of a layer which has not yet been added to an image. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_delete_inargs ,
1997-11-25 06:05:25 +08:00
0 ,
NULL ,
1999-04-25 04:33:31 +08:00
{ { layer_delete_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_translate_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
GimpLayer * layer ;
gint32 offx ;
gint32 offy ;
GimpImage * gimage ;
2001-01-29 07:25:25 +08:00
GimpLayer * floating_layer ;
GimpLayer * tmp_layer ;
2001-02-19 21:06:09 +08:00
GList * layer_list ;
1997-11-25 06:05:25 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
offx = args [ 1 ] . value . pdb_int ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
offy = args [ 2 ] . value . pdb_int ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
if ( success )
{
2002-02-26 01:58:50 +08:00
if ( ( gimage = gimp_item_get_image ( GIMP_ITEM ( layer ) ) ) )
1997-11-25 06:05:25 +08:00
{
2000-12-29 23:22:01 +08:00
floating_layer = gimp_image_floating_sel ( gimage ) ;
1999-04-25 04:33:31 +08:00
2003-02-13 19:23:50 +08:00
gimp_image_undo_group_start ( gimage , GIMP_UNDO_GROUP_LAYER_LINKED ,
_ ( " Move Layer " ) ) ;
1999-04-25 04:33:31 +08:00
if ( floating_layer )
floating_sel_relax ( floating_layer , TRUE ) ;
2001-02-19 21:06:09 +08:00
for ( layer_list = GIMP_LIST ( gimage - > layers ) - > list ;
layer_list ;
layer_list = g_list_next ( layer_list ) )
1999-04-25 04:33:31 +08:00
{
2001-01-29 07:25:25 +08:00
tmp_layer = ( GimpLayer * ) layer_list - > data ;
2001-02-19 21:06:09 +08:00
2001-03-12 01:24:47 +08:00
if ( ( tmp_layer = = layer ) | | gimp_layer_get_linked ( tmp_layer ) )
2003-05-09 03:11:17 +08:00
gimp_item_translate ( GIMP_ITEM ( tmp_layer ) , offx , offy , TRUE ) ;
1999-04-25 04:33:31 +08:00
}
if ( floating_layer )
floating_sel_rigor ( floating_layer , TRUE ) ;
2003-02-13 19:23:50 +08:00
gimp_image_undo_group_end ( gimage ) ;
1997-11-25 06:05:25 +08:00
}
1999-04-25 04:33:31 +08:00
else
success = FALSE ;
1997-11-25 06:05:25 +08:00
}
return procedural_db_return_args ( & layer_translate_proc , success ) ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_translate_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" offx " ,
1999-04-25 04:33:31 +08:00
" Offset in x direction "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" offy " ,
1999-04-25 04:33:31 +08:00
" Offset in y direction "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_translate_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_translate " ,
1999-04-25 04:33:31 +08:00
" Translate the layer by the specified offsets. " ,
" This procedure translates the layer by the amounts specified in the x and y arguments. These can be negative, and are considered offsets from the current position. This command only works if the layer has been added to an image. All additional layers contained in the image which have the linked flag set to TRUE w ill also be translated by the specified offsets. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
3 ,
1999-04-25 04:33:31 +08:00
layer_translate_inargs ,
1997-11-25 06:05:25 +08:00
0 ,
NULL ,
1999-04-25 04:33:31 +08:00
{ { layer_translate_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_add_alpha_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
GimpLayer * layer ;
1997-11-25 06:05:25 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
if ( success )
2001-01-29 07:25:25 +08:00
gimp_layer_add_alpha ( layer ) ;
1997-11-25 06:05:25 +08:00
return procedural_db_return_args ( & layer_add_alpha_proc , success ) ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_add_alpha_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_add_alpha_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_add_alpha " ,
" Add an alpha channel to the layer if it doesn't already have one. " ,
1999-04-25 04:33:31 +08:00
" This procedure adds an additional component to the specified layer if it does not already possess an alpha channel. An alpha channel makes it possible to move a layer from the bottom of the layer stack and to clear and erase to transparency, instead of the background color. This transforms images of type RGB to RGBA, GRAY to GRAYA, and INDEXED to INDEXEDA. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_add_alpha_inargs ,
1997-11-25 06:05:25 +08:00
0 ,
NULL ,
1999-04-25 04:33:31 +08:00
{ { layer_add_alpha_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_set_offsets_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
GimpLayer * layer ;
gint32 offx ;
gint32 offy ;
GimpImage * gimage ;
2001-01-29 07:25:25 +08:00
GimpLayer * floating_layer ;
GimpLayer * tmp_layer ;
2001-02-19 21:06:09 +08:00
GList * layer_list ;
1999-04-25 04:33:31 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
offx = args [ 1 ] . value . pdb_int ;
offy = args [ 2 ] . value . pdb_int ;
1997-11-25 06:05:25 +08:00
if ( success )
{
2002-02-26 01:58:50 +08:00
if ( ( gimage = gimp_item_get_image ( GIMP_ITEM ( layer ) ) ) )
1999-04-25 04:33:31 +08:00
{
2000-12-29 23:22:01 +08:00
floating_layer = gimp_image_floating_sel ( gimage ) ;
1999-04-25 04:33:31 +08:00
2003-02-13 19:23:50 +08:00
gimp_image_undo_group_start ( gimage , GIMP_UNDO_GROUP_LAYER_LINKED ,
_ ( " Move Layer " ) ) ;
1999-04-25 04:33:31 +08:00
if ( floating_layer )
floating_sel_relax ( floating_layer , TRUE ) ;
2001-02-19 21:06:09 +08:00
for ( layer_list = GIMP_LIST ( gimage - > layers ) - > list ;
layer_list ;
layer_list = g_list_next ( layer_list ) )
1999-04-25 04:33:31 +08:00
{
2001-01-29 07:25:25 +08:00
tmp_layer = ( GimpLayer * ) layer_list - > data ;
2001-02-19 21:06:09 +08:00
2001-03-12 01:24:47 +08:00
if ( ( tmp_layer = = layer ) | | gimp_layer_get_linked ( tmp_layer ) )
2003-05-09 03:11:17 +08:00
gimp_item_translate ( GIMP_ITEM ( tmp_layer ) ,
2003-05-08 19:52:31 +08:00
( offx - GIMP_ITEM ( layer ) - > offset_x ) ,
( offy - GIMP_ITEM ( layer ) - > offset_y ) , TRUE ) ;
1999-04-25 04:33:31 +08:00
}
if ( floating_layer )
floating_sel_rigor ( floating_layer , TRUE ) ;
2003-02-13 19:23:50 +08:00
gimp_image_undo_group_end ( gimage ) ;
1999-04-25 04:33:31 +08:00
}
1997-11-25 06:05:25 +08:00
else
success = FALSE ;
}
1999-04-25 04:33:31 +08:00
return procedural_db_return_args ( & layer_set_offsets_proc , success ) ;
1997-11-25 06:05:25 +08:00
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_set_offsets_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
} ,
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1999-04-25 04:33:31 +08:00
" offx " ,
" Offset in x direction "
} ,
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1999-04-25 04:33:31 +08:00
" offy " ,
" Offset in y direction "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_set_offsets_proc =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
" gimp_layer_set_offsets " ,
" Set the layer offsets. " ,
" This procedure sets the offsets for the specified layer. The offsets are relative to the image origin and can be any values. This operation is valid only on layers which have been added to an image. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1999-04-25 04:33:31 +08:00
3 ,
layer_set_offsets_inargs ,
0 ,
NULL ,
{ { layer_set_offsets_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_mask_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
Argument * return_args ;
GimpLayer * layer ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
return_args = procedural_db_return_args ( & layer_mask_proc , success ) ;
1997-11-25 06:05:25 +08:00
if ( success )
2002-02-26 01:58:50 +08:00
return_args [ 1 ] . value . pdb_int = layer - > mask ? gimp_item_get_ID ( GIMP_ITEM ( layer - > mask ) ) : - 1 ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
return return_args ;
1997-11-25 06:05:25 +08:00
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_mask_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcArg layer_mask_outargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_CHANNEL ,
1999-04-25 04:33:31 +08:00
" mask " ,
" The layer mask "
}
} ;
static ProcRecord layer_mask_proc =
{
" gimp_layer_mask " ,
" Get the specified layer's mask if it exists. " ,
1999-04-27 12:57:59 +08:00
" This procedure returns the specified layer's mask, or -1 if none exists. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1999-04-25 04:33:31 +08:00
1 ,
layer_mask_inargs ,
1 ,
layer_mask_outargs ,
{ { layer_mask_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_is_floating_sel_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
1997-11-25 06:05:25 +08:00
Argument * return_args ;
1999-04-25 04:33:31 +08:00
GimpLayer * layer ;
1997-11-25 06:05:25 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
return_args = procedural_db_return_args ( & layer_is_floating_sel_proc , success ) ;
1997-11-25 06:05:25 +08:00
if ( success )
2001-01-29 07:25:25 +08:00
return_args [ 1 ] . value . pdb_int = gimp_layer_is_floating_sel ( layer ) ;
1997-11-25 06:05:25 +08:00
return return_args ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_is_floating_sel_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcArg layer_is_floating_sel_outargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1999-04-25 04:33:31 +08:00
" is_floating_sel " ,
" Non-zero if the layer is a floating selection "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_is_floating_sel_proc =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
" gimp_layer_is_floating_sel " ,
" Is the specified layer a floating selection? " ,
" This procedure returns whether the layer is a floating selection. Floating selections are special cases of layers which are attached to a specific drawable. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_is_floating_sel_inargs ,
1 ,
layer_is_floating_sel_outargs ,
{ { layer_is_floating_sel_invoker } }
} ;
2002-12-03 20:10:21 +08:00
static Argument *
layer_new_from_drawable_invoker ( Gimp * gimp ,
Argument * args )
{
gboolean success = TRUE ;
Argument * return_args ;
GimpDrawable * drawable ;
GimpImage * gimage ;
GimpLayer * copy = NULL ;
drawable = ( GimpDrawable * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
if ( ! GIMP_IS_DRAWABLE ( drawable ) )
success = FALSE ;
gimage = gimp_image_get_by_ID ( gimp , args [ 1 ] . value . pdb_int ) ;
if ( ! GIMP_IS_IMAGE ( gimage ) )
success = FALSE ;
if ( success )
success = ( copy = gimp_layer_new_from_drawable ( drawable ,
gimage ) ) ! = NULL ;
return_args = procedural_db_return_args ( & layer_new_from_drawable_proc , success ) ;
if ( success )
return_args [ 1 ] . value . pdb_int = gimp_item_get_ID ( GIMP_ITEM ( copy ) ) ;
return return_args ;
}
static ProcArg layer_new_from_drawable_inargs [ ] =
{
{
GIMP_PDB_DRAWABLE ,
" drawable " ,
" The source drawable from where the new layer is copied "
} ,
{
GIMP_PDB_IMAGE ,
" dest_image " ,
" The destination image to which to add the layer "
}
} ;
static ProcArg layer_new_from_drawable_outargs [ ] =
{
{
GIMP_PDB_LAYER ,
" layer_copy " ,
" The newly copied layer "
}
} ;
static ProcRecord layer_new_from_drawable_proc =
{
" gimp_layer_new_from_drawable " ,
" Create a new layer by copying an existing drawable. " ,
" This procedure creates a new layer as a copy of the specified drawable. The new layer still needs to be added to the image, as this is not automatic. Add the new layer with the 'gimp_image_add_layer' command. Other attributes such as layer mask modes, and offsets should be set with explicit procedure calls. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
GIMP_INTERNAL ,
2 ,
layer_new_from_drawable_inargs ,
1 ,
layer_new_from_drawable_outargs ,
{ { layer_new_from_drawable_invoker } }
} ;
1999-04-25 04:33:31 +08:00
static Argument *
2001-07-05 03:31:35 +08:00
layer_get_name_invoker ( Gimp * gimp ,
Argument * args )
1999-04-25 04:33:31 +08:00
{
gboolean success = TRUE ;
Argument * return_args ;
GimpLayer * layer ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
return_args = procedural_db_return_args ( & layer_get_name_proc , success ) ;
if ( success )
2002-09-11 04:23:00 +08:00
return_args [ 1 ] . value . pdb_pointer = g_strdup ( gimp_object_get_name ( GIMP_OBJECT ( layer ) ) ) ;
1999-04-25 04:33:31 +08:00
return return_args ;
}
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
static ProcArg layer_get_name_inargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1999-04-25 04:33:31 +08:00
" layer " ,
" The layer "
}
} ;
static ProcArg layer_get_name_outargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_STRING ,
1999-04-25 04:33:31 +08:00
" name " ,
" The layer name "
}
} ;
static ProcRecord layer_get_name_proc =
{
" gimp_layer_get_name " ,
" Get the name of the specified layer. " ,
" This procedure returns the specified layer's name. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1999-04-25 04:33:31 +08:00
1 ,
layer_get_name_inargs ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_get_name_outargs ,
{ { layer_get_name_invoker } }
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_set_name_invoker ( Gimp * gimp ,
Argument * args )
1999-04-25 04:33:31 +08:00
{
gboolean success = TRUE ;
GimpLayer * layer ;
gchar * name ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
name = ( gchar * ) args [ 1 ] . value . pdb_pointer ;
1999-12-21 08:36:07 +08:00
if ( name = = NULL )
success = FALSE ;
1999-04-25 04:33:31 +08:00
if ( success )
2003-03-17 09:41:54 +08:00
gimp_item_rename ( GIMP_ITEM ( layer ) , name ) ;
1999-04-25 04:33:31 +08:00
return procedural_db_return_args ( & layer_set_name_proc , success ) ;
}
static ProcArg layer_set_name_inargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1999-04-25 04:33:31 +08:00
" layer " ,
" The layer "
} ,
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_STRING ,
1999-04-25 04:33:31 +08:00
" name " ,
" The new layer name "
}
} ;
static ProcRecord layer_set_name_proc =
{
" gimp_layer_set_name " ,
" Set the name of the specified layer. " ,
" This procedure sets the specified layer's name. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1999-04-25 04:33:31 +08:00
2 ,
layer_set_name_inargs ,
0 ,
NULL ,
{ { layer_set_name_invoker } }
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_get_visible_invoker ( Gimp * gimp ,
Argument * args )
1999-04-25 04:33:31 +08:00
{
gboolean success = TRUE ;
Argument * return_args ;
GimpLayer * layer ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
return_args = procedural_db_return_args ( & layer_get_visible_proc , success ) ;
if ( success )
2002-09-11 04:23:00 +08:00
return_args [ 1 ] . value . pdb_int = gimp_drawable_get_visible ( GIMP_DRAWABLE ( layer ) ) ;
1999-04-25 04:33:31 +08:00
return return_args ;
}
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
static ProcArg layer_get_visible_inargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1999-04-25 04:33:31 +08:00
" layer " ,
" The layer "
}
1997-11-25 06:05:25 +08:00
} ;
1999-04-25 04:33:31 +08:00
static ProcArg layer_get_visible_outargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1999-04-25 04:33:31 +08:00
" visible " ,
" The layer visibility "
}
} ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
static ProcRecord layer_get_visible_proc =
{
" gimp_layer_get_visible " ,
" Get the visibility of the specified layer. " ,
" This procedure returns the specified layer's visibility. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1999-04-25 04:33:31 +08:00
1 ,
layer_get_visible_inargs ,
1 ,
layer_get_visible_outargs ,
{ { layer_get_visible_invoker } }
} ;
1997-11-25 06:05:25 +08:00
static Argument *
2001-07-05 03:31:35 +08:00
layer_set_visible_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
GimpLayer * layer ;
gboolean visible ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
visible = args [ 1 ] . value . pdb_int ? TRUE : FALSE ;
1997-11-25 06:05:25 +08:00
if ( success )
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
gimp_drawable_set_visible ( GIMP_DRAWABLE ( layer ) , visible , TRUE ) ;
1997-11-25 06:05:25 +08:00
return procedural_db_return_args ( & layer_set_visible_proc , success ) ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_set_visible_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" visible " ,
1999-04-25 04:33:31 +08:00
" The new layer visibility "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_set_visible_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_set_visible " ,
" Set the visibility of the specified layer. " ,
" This procedure sets the specified layer's visibility. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
2 ,
1999-04-25 04:33:31 +08:00
layer_set_visible_inargs ,
1997-11-25 06:05:25 +08:00
0 ,
NULL ,
1999-04-25 04:33:31 +08:00
{ { layer_set_visible_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_get_preserve_trans_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
1997-11-25 06:05:25 +08:00
Argument * return_args ;
1999-04-25 04:33:31 +08:00
GimpLayer * layer ;
1997-11-25 06:05:25 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
return_args = procedural_db_return_args ( & layer_get_preserve_trans_proc , success ) ;
if ( success )
2001-03-12 01:24:47 +08:00
return_args [ 1 ] . value . pdb_int = gimp_layer_get_preserve_trans ( layer ) ;
1997-11-25 06:05:25 +08:00
return return_args ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_get_preserve_trans_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcArg layer_get_preserve_trans_outargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" preserve_trans " ,
1999-04-25 04:33:31 +08:00
" The layer's preserve transperancy setting "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_get_preserve_trans_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_get_preserve_trans " ,
1999-04-25 04:33:31 +08:00
" Get the preserve transperancy setting of the specified layer. " ,
" This procedure returns the specified layer's preserve transperancy setting. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_get_preserve_trans_inargs ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_get_preserve_trans_outargs ,
{ { layer_get_preserve_trans_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_set_preserve_trans_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
GimpLayer * layer ;
gboolean preserve_trans ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
preserve_trans = args [ 1 ] . value . pdb_int ? TRUE : FALSE ;
1997-11-25 06:05:25 +08:00
if ( success )
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
gimp_layer_set_preserve_trans ( layer , preserve_trans , TRUE ) ;
1997-11-25 06:05:25 +08:00
return procedural_db_return_args ( & layer_set_preserve_trans_proc , success ) ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_set_preserve_trans_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" preserve_trans " ,
1999-04-25 04:33:31 +08:00
" The new layer's preserve transperancy setting "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_set_preserve_trans_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_set_preserve_trans " ,
1999-04-25 04:33:31 +08:00
" Set the preserve transperancy setting of the specified layer. " ,
" This procedure sets the specified layer's preserve transperancy setting. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
2 ,
1999-04-25 04:33:31 +08:00
layer_set_preserve_trans_inargs ,
1997-11-25 06:05:25 +08:00
0 ,
NULL ,
1999-04-25 04:33:31 +08:00
{ { layer_set_preserve_trans_invoker } }
1997-11-25 06:05:25 +08:00
} ;
2001-05-20 22:15:09 +08:00
static Argument *
2001-07-05 03:31:35 +08:00
layer_get_apply_mask_invoker ( Gimp * gimp ,
Argument * args )
2001-05-20 22:15:09 +08:00
{
gboolean success = TRUE ;
Argument * return_args ;
GimpLayer * layer ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
2001-05-20 22:15:09 +08:00
success = FALSE ;
return_args = procedural_db_return_args ( & layer_get_apply_mask_proc , success ) ;
if ( success )
return_args [ 1 ] . value . pdb_int = gimp_layer_get_apply_mask ( layer ) ;
return return_args ;
}
static ProcArg layer_get_apply_mask_inargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
2001-05-20 22:15:09 +08:00
" layer " ,
" The layer "
}
} ;
static ProcArg layer_get_apply_mask_outargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
2001-05-20 22:15:09 +08:00
" apply_mask " ,
" The layer apply mask "
}
} ;
static ProcRecord layer_get_apply_mask_proc =
{
" gimp_layer_get_apply_mask " ,
" Get the apply mask of the specified layer. " ,
" This procedure returns the specified layer's apply mask. If the value is non-zero, then the layer mask for this layer is currently being composited with the layer's alpha channel. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
2001-05-20 22:15:09 +08:00
1 ,
layer_get_apply_mask_inargs ,
1 ,
layer_get_apply_mask_outargs ,
{ { layer_get_apply_mask_invoker } }
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_set_apply_mask_invoker ( Gimp * gimp ,
Argument * args )
2001-05-20 22:15:09 +08:00
{
gboolean success = TRUE ;
GimpLayer * layer ;
gboolean apply_mask ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
2001-05-20 22:15:09 +08:00
success = FALSE ;
apply_mask = args [ 1 ] . value . pdb_int ? TRUE : FALSE ;
if ( success )
gimp_layer_set_apply_mask ( layer , apply_mask ) ;
return procedural_db_return_args ( & layer_set_apply_mask_proc , success ) ;
}
static ProcArg layer_set_apply_mask_inargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
2001-05-20 22:15:09 +08:00
" layer " ,
" The layer "
} ,
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
2001-05-20 22:15:09 +08:00
" apply_mask " ,
" The new layer apply mask "
}
} ;
static ProcRecord layer_set_apply_mask_proc =
{
" gimp_layer_set_apply_mask " ,
" Set the apply mask of the specified layer. " ,
" This procedure sets the specified layer's apply mask. This controls whether the layer's mask is currently affecting the alpha channel. If there is no layer mask, this function will return an error. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
2001-05-20 22:15:09 +08:00
2 ,
layer_set_apply_mask_inargs ,
0 ,
NULL ,
{ { layer_set_apply_mask_invoker } }
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_get_show_mask_invoker ( Gimp * gimp ,
Argument * args )
2001-05-20 22:15:09 +08:00
{
gboolean success = TRUE ;
Argument * return_args ;
GimpLayer * layer ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
2001-05-20 22:15:09 +08:00
success = FALSE ;
return_args = procedural_db_return_args ( & layer_get_show_mask_proc , success ) ;
if ( success )
return_args [ 1 ] . value . pdb_int = gimp_layer_get_show_mask ( layer ) ;
return return_args ;
}
static ProcArg layer_get_show_mask_inargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
2001-05-20 22:15:09 +08:00
" layer " ,
" The layer "
}
} ;
static ProcArg layer_get_show_mask_outargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
2001-05-20 22:15:09 +08:00
" show_mask " ,
" The layer show mask "
}
} ;
static ProcRecord layer_get_show_mask_proc =
{
" gimp_layer_get_show_mask " ,
" Get the show mask of the specified layer. " ,
" This procedure returns the specified layer's show mask. If the value is non-zero, then the layer mask for this layer is currently being shown instead of the layer. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
2001-05-20 22:15:09 +08:00
1 ,
layer_get_show_mask_inargs ,
1 ,
layer_get_show_mask_outargs ,
{ { layer_get_show_mask_invoker } }
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_set_show_mask_invoker ( Gimp * gimp ,
Argument * args )
2001-05-20 22:15:09 +08:00
{
gboolean success = TRUE ;
GimpLayer * layer ;
gboolean show_mask ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
2001-05-20 22:15:09 +08:00
success = FALSE ;
show_mask = args [ 1 ] . value . pdb_int ? TRUE : FALSE ;
if ( success )
gimp_layer_set_show_mask ( layer , show_mask ) ;
return procedural_db_return_args ( & layer_set_show_mask_proc , success ) ;
}
static ProcArg layer_set_show_mask_inargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
2001-05-20 22:15:09 +08:00
" layer " ,
" The layer "
} ,
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
2001-05-20 22:15:09 +08:00
" show_mask " ,
" The new layer show mask "
}
} ;
static ProcRecord layer_set_show_mask_proc =
{
" gimp_layer_set_show_mask " ,
" Set the show mask of the specified layer. " ,
" This procedure sets the specified layer's show mask. This controls whether the layer or it's mask is visible. Non-zero values indicate that the mask should be visible. If the layer has no mask, then this function returns an error. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
2001-05-20 22:15:09 +08:00
2 ,
layer_set_show_mask_inargs ,
0 ,
NULL ,
{ { layer_set_show_mask_invoker } }
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_get_edit_mask_invoker ( Gimp * gimp ,
Argument * args )
2001-05-20 22:15:09 +08:00
{
gboolean success = TRUE ;
Argument * return_args ;
GimpLayer * layer ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
2001-05-20 22:15:09 +08:00
success = FALSE ;
return_args = procedural_db_return_args ( & layer_get_edit_mask_proc , success ) ;
if ( success )
return_args [ 1 ] . value . pdb_int = gimp_layer_get_edit_mask ( layer ) ;
return return_args ;
}
static ProcArg layer_get_edit_mask_inargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
2001-05-20 22:15:09 +08:00
" layer " ,
" The layer "
}
} ;
static ProcArg layer_get_edit_mask_outargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
2001-05-20 22:15:09 +08:00
" edit_mask " ,
" The layer show mask "
}
} ;
static ProcRecord layer_get_edit_mask_proc =
{
" gimp_layer_get_edit_mask " ,
" Get the show mask of the specified layer. " ,
" This procedure returns the specified layer's show mask. If the value is non-zero, then the layer mask for this layer is currently active, and not the layer. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
2001-05-20 22:15:09 +08:00
1 ,
layer_get_edit_mask_inargs ,
1 ,
layer_get_edit_mask_outargs ,
{ { layer_get_edit_mask_invoker } }
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_set_edit_mask_invoker ( Gimp * gimp ,
Argument * args )
2001-05-20 22:15:09 +08:00
{
gboolean success = TRUE ;
GimpLayer * layer ;
gboolean edit_mask ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
2001-05-20 22:15:09 +08:00
success = FALSE ;
edit_mask = args [ 1 ] . value . pdb_int ? TRUE : FALSE ;
if ( success )
gimp_layer_set_edit_mask ( layer , edit_mask ) ;
return procedural_db_return_args ( & layer_set_edit_mask_proc , success ) ;
}
static ProcArg layer_set_edit_mask_inargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
2001-05-20 22:15:09 +08:00
" layer " ,
" The layer "
} ,
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
2001-05-20 22:15:09 +08:00
" edit_mask " ,
" The new layer show mask "
}
} ;
static ProcRecord layer_set_edit_mask_proc =
{
" gimp_layer_set_edit_mask " ,
" Set the show mask of the specified layer. " ,
" This procedure sets the specified layer's show mask. This controls whether the layer or it's mask is currently active for editing. If the specified layer has no layer mask, then this procedure will return an error. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
2001-05-20 22:15:09 +08:00
2 ,
layer_set_edit_mask_inargs ,
0 ,
NULL ,
{ { layer_set_edit_mask_invoker } }
} ;
1997-11-25 06:05:25 +08:00
static Argument *
2001-07-05 03:31:35 +08:00
layer_get_opacity_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
1997-11-25 06:05:25 +08:00
Argument * return_args ;
1999-04-25 04:33:31 +08:00
GimpLayer * layer ;
1997-11-25 06:05:25 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
return_args = procedural_db_return_args ( & layer_get_opacity_proc , success ) ;
if ( success )
2001-03-12 01:24:47 +08:00
return_args [ 1 ] . value . pdb_float = gimp_layer_get_opacity ( layer ) * 100.0 ;
1997-11-25 06:05:25 +08:00
return return_args ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_get_opacity_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcArg layer_get_opacity_outargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_FLOAT ,
1997-11-25 06:05:25 +08:00
" opacity " ,
1999-04-25 04:33:31 +08:00
" The layer opacity "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_get_opacity_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_get_opacity " ,
" Get the opacity of the specified layer. " ,
" This procedure returns the specified layer's opacity. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_get_opacity_inargs ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_get_opacity_outargs ,
{ { layer_get_opacity_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_set_opacity_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
GimpLayer * layer ;
gdouble opacity ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
opacity = args [ 1 ] . value . pdb_float ;
if ( opacity < 0.0 | | opacity > 100.0 )
success = FALSE ;
1997-11-25 06:05:25 +08:00
if ( success )
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
gimp_layer_set_opacity ( layer , opacity / 100.0 , TRUE ) ;
1997-11-25 06:05:25 +08:00
return procedural_db_return_args ( & layer_set_opacity_proc , success ) ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_set_opacity_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_FLOAT ,
1997-11-25 06:05:25 +08:00
" opacity " ,
1999-04-25 04:33:31 +08:00
" The new layer opacity (0 <= opacity <= 100) "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_set_opacity_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_set_opacity " ,
" Set the opacity of the specified layer. " ,
" This procedure sets the specified layer's opacity. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
2 ,
1999-04-25 04:33:31 +08:00
layer_set_opacity_inargs ,
1997-11-25 06:05:25 +08:00
0 ,
NULL ,
1999-04-25 04:33:31 +08:00
{ { layer_set_opacity_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_get_mode_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
1997-11-25 06:05:25 +08:00
Argument * return_args ;
1999-04-25 04:33:31 +08:00
GimpLayer * layer ;
1997-11-25 06:05:25 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
return_args = procedural_db_return_args ( & layer_get_mode_proc , success ) ;
if ( success )
2001-03-12 01:24:47 +08:00
return_args [ 1 ] . value . pdb_int = gimp_layer_get_mode ( layer ) ;
1997-11-25 06:05:25 +08:00
return return_args ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_get_mode_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcArg layer_get_mode_outargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" mode " ,
1999-04-25 04:33:31 +08:00
" The layer combination mode "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_get_mode_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_get_mode " ,
" Get the combination mode of the specified layer. " ,
" This procedure returns the specified layer's combination mode. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_get_mode_inargs ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_get_mode_outargs ,
{ { layer_get_mode_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_set_mode_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
GimpLayer * layer ;
gint32 mode ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
mode = args [ 1 ] . value . pdb_int ;
2001-12-09 07:12:59 +08:00
if ( mode < GIMP_NORMAL_MODE | | mode > GIMP_COLOR_ERASE_MODE )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
if ( success )
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
gimp_layer_set_mode ( layer , mode , TRUE ) ;
1997-11-25 06:05:25 +08:00
return procedural_db_return_args ( & layer_set_mode_proc , success ) ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_set_mode_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
} ,
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1997-11-25 06:05:25 +08:00
" mode " ,
1999-04-25 04:33:31 +08:00
" The new layer combination mode "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_set_mode_proc =
1997-11-25 06:05:25 +08:00
{
" gimp_layer_set_mode " ,
" Set the combination mode of the specified layer. " ,
" This procedure sets the specified layer's combination mode. " ,
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
2 ,
1999-04-25 04:33:31 +08:00
layer_set_mode_inargs ,
1997-11-25 06:05:25 +08:00
0 ,
NULL ,
1999-04-25 04:33:31 +08:00
{ { layer_set_mode_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_get_linked_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
1997-11-25 06:05:25 +08:00
Argument * return_args ;
1999-04-25 04:33:31 +08:00
GimpLayer * layer ;
1997-11-25 06:05:25 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
return_args = procedural_db_return_args ( & layer_get_linked_proc , success ) ;
1997-11-25 06:05:25 +08:00
if ( success )
2001-03-12 01:24:47 +08:00
return_args [ 1 ] . value . pdb_int = gimp_layer_get_linked ( layer ) ;
1997-11-25 06:05:25 +08:00
return return_args ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_get_linked_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcArg layer_get_linked_outargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1999-04-25 04:33:31 +08:00
" linked " ,
" The layer linked state (for moves) "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_get_linked_proc =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
" gimp_layer_get_linked " ,
" Get the linked state of the specified layer. " ,
" This procedure returns the specified layer's linked state. " ,
" Wolfgang Hofer " ,
" Wolfgang Hofer " ,
" 1998 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_get_linked_inargs ,
1997-11-25 06:05:25 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_get_linked_outargs ,
{ { layer_get_linked_invoker } }
1997-11-25 06:05:25 +08:00
} ;
static Argument *
2001-07-05 03:31:35 +08:00
layer_set_linked_invoker ( Gimp * gimp ,
Argument * args )
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
GimpLayer * layer ;
2000-06-23 04:06:02 +08:00
gboolean linked ;
1997-11-25 06:05:25 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1997-11-25 06:05:25 +08:00
2000-06-23 04:06:02 +08:00
linked = args [ 1 ] . value . pdb_int ? TRUE : FALSE ;
1997-11-25 06:05:25 +08:00
if ( success )
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
gimp_layer_set_linked ( layer , linked , TRUE ) ;
1997-11-25 06:05:25 +08:00
1999-04-25 04:33:31 +08:00
return procedural_db_return_args ( & layer_set_linked_proc , success ) ;
1997-11-25 06:05:25 +08:00
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_set_linked_inargs [ ] =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1997-11-25 06:05:25 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
} ,
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1999-04-25 04:33:31 +08:00
" linked " ,
" The new layer linked state "
1997-11-25 06:05:25 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_set_linked_proc =
1997-11-25 06:05:25 +08:00
{
1999-04-25 04:33:31 +08:00
" gimp_layer_set_linked " ,
" Set the linked state of the specified layer. " ,
" This procedure sets the specified layer's linked state. " ,
" Wolfgang Hofer " ,
" Wolfgang Hofer " ,
" 1998 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1999-04-25 04:33:31 +08:00
2 ,
layer_set_linked_inargs ,
0 ,
NULL ,
{ { layer_set_linked_invoker } }
1997-11-25 06:05:25 +08:00
} ;
1998-10-14 10:54:02 +08:00
static Argument *
2001-07-05 03:31:35 +08:00
layer_get_tattoo_invoker ( Gimp * gimp ,
Argument * args )
1998-10-14 10:54:02 +08:00
{
1999-04-25 04:33:31 +08:00
gboolean success = TRUE ;
1998-10-14 10:54:02 +08:00
Argument * return_args ;
1999-04-25 04:33:31 +08:00
GimpLayer * layer ;
1998-10-14 10:54:02 +08:00
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
1999-04-25 04:33:31 +08:00
success = FALSE ;
1998-10-14 10:54:02 +08:00
return_args = procedural_db_return_args ( & layer_get_tattoo_proc , success ) ;
if ( success )
2002-09-11 04:23:00 +08:00
return_args [ 1 ] . value . pdb_int = gimp_item_get_tattoo ( GIMP_ITEM ( layer ) ) ;
1998-10-14 10:54:02 +08:00
return return_args ;
}
1999-04-25 04:33:31 +08:00
static ProcArg layer_get_tattoo_inargs [ ] =
1998-10-14 10:54:02 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
1998-10-14 10:54:02 +08:00
" layer " ,
1999-04-25 04:33:31 +08:00
" The layer "
1998-10-14 10:54:02 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcArg layer_get_tattoo_outargs [ ] =
1998-10-14 10:54:02 +08:00
{
1999-04-25 04:33:31 +08:00
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
1998-10-14 10:54:02 +08:00
" tattoo " ,
1999-04-25 04:33:31 +08:00
" The layer tattoo "
1998-10-14 10:54:02 +08:00
}
} ;
1999-04-25 04:33:31 +08:00
static ProcRecord layer_get_tattoo_proc =
1998-10-14 10:54:02 +08:00
{
" gimp_layer_get_tattoo " ,
2000-02-16 07:49:03 +08:00
" Get the tattoo of the specified layer. " ,
" This procedure returns the specified layer's tattoo. A tattoo is a unique and permanent identifier attached to a layer that can be used to uniquely identify a layer within an image even between sessions " ,
1998-10-14 10:54:02 +08:00
" Jay Cox " ,
" Jay Cox " ,
" 1998 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
1998-11-16 01:02:59 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_get_tattoo_inargs ,
1998-11-16 01:02:59 +08:00
1 ,
1999-04-25 04:33:31 +08:00
layer_get_tattoo_outargs ,
{ { layer_get_tattoo_invoker } }
1998-11-16 01:02:59 +08:00
} ;
2000-02-16 07:49:03 +08:00
static Argument *
2001-07-05 03:31:35 +08:00
layer_set_tattoo_invoker ( Gimp * gimp ,
Argument * args )
2000-02-16 07:49:03 +08:00
{
gboolean success = TRUE ;
GimpLayer * layer ;
gint32 tattoo ;
2002-02-26 01:58:50 +08:00
layer = ( GimpLayer * ) gimp_item_get_by_ID ( gimp , args [ 0 ] . value . pdb_int ) ;
2002-08-30 01:21:21 +08:00
if ( ! GIMP_IS_LAYER ( layer ) )
2000-02-16 07:49:03 +08:00
success = FALSE ;
tattoo = args [ 1 ] . value . pdb_int ;
if ( tattoo = = 0 )
success = FALSE ;
if ( success )
2002-09-11 04:23:00 +08:00
gimp_item_set_tattoo ( GIMP_ITEM ( layer ) , tattoo ) ;
2000-02-16 07:49:03 +08:00
return procedural_db_return_args ( & layer_set_tattoo_proc , success ) ;
}
static ProcArg layer_set_tattoo_inargs [ ] =
{
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_LAYER ,
2000-02-16 07:49:03 +08:00
" layer " ,
" The layer "
} ,
{
2001-05-21 21:58:46 +08:00
GIMP_PDB_INT32 ,
2000-02-16 07:49:03 +08:00
" tattoo " ,
" The new layer tattoo "
}
} ;
static ProcRecord layer_set_tattoo_proc =
{
" gimp_layer_set_tattoo " ,
" Set the tattoo of the specified layer. " ,
" This procedure sets the specified layer's tattoo. A tattoo is a unique and permanent identifier attached to a layer that can be used to uniquely identify a layer within an image even between sessions " ,
" Jay Cox " ,
" Jay Cox " ,
" 1998 " ,
2001-05-21 21:58:46 +08:00
GIMP_INTERNAL ,
2000-02-16 07:49:03 +08:00
2 ,
layer_set_tattoo_inargs ,
0 ,
NULL ,
{ { layer_set_tattoo_invoker } }
} ;