app/gui/image-menu.c app/gui/layers-menu.c "Imagesize" isn't a real word.

2003-10-06  Manish Singh  <yosh@gimp.org>

        * app/gui/image-menu.c
        * app/gui/layers-menu.c
        * etc/ps-menurc: "Imagesize" isn't a real word. Fix to "Image Size".

        * app/paint/gimppaintcore.c: add declaration for rotate_pointers which
        was inadvertently took out.

        * tools/pdbgen/pdb/layer.pdb: add gimp_layer_resize_to_image_size.
        Fix failure reporting logic for gimp_layer_delete.

        * app/pdb/internal_procs.c
        * app/pdb/layer_cmds.c
        * libgimp/gimplayer_pdb.[ch]: regenerated.

        * plug-ins/common/tiff.c: always compare used unsigned chars for 7bit
        ASCII check.
This commit is contained in:
Manish Singh 2003-10-06 21:22:09 +00:00 committed by Manish Singh
parent fdbbfff852
commit f64ad067d7
12 changed files with 228 additions and 105 deletions

View File

@ -1,3 +1,22 @@
2003-10-06 Manish Singh <yosh@gimp.org>
* app/gui/image-menu.c
* app/gui/layers-menu.c
* etc/ps-menurc: "Imagesize" isn't a real word. Fix to "Image Size".
* app/paint/gimppaintcore.c: add declaration for rotate_pointers which
was inadvertently took out.
* tools/pdbgen/pdb/layer.pdb: add gimp_layer_resize_to_image_size.
Fix failure reporting logic for gimp_layer_delete.
* app/pdb/internal_procs.c
* app/pdb/layer_cmds.c
* libgimp/gimplayer_pdb.[ch]: regenerated.
* plug-ins/common/tiff.c: always compare used unsigned chars for 7bit
ASCII check.
2003-10-06 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable.c (gimp_drawable_mask_bounds): one

View File

@ -862,7 +862,7 @@ GimpItemFactoryEntry image_menu_entries[] =
"<StockItem>", GIMP_STOCK_RESIZE },
NULL,
GIMP_HELP_LAYER_RESIZE, NULL },
{ { N_("/Layer/Layer to _Imagesize"), NULL,
{ { N_("/Layer/Layer to _Image Size"), NULL,
layers_resize_to_image_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_LAYER_TO_IMAGESIZE },
NULL,
@ -1546,7 +1546,7 @@ image_menu_update (GtkItemFactory *item_factory,
SET_SENSITIVE ("/Layer/Delete Layer", lp && !aux);
SET_SENSITIVE ("/Layer/Layer Boundary Size...", lp && !aux);
SET_SENSITIVE ("/Layer/Layer to Imagesize", lp && !aux);
SET_SENSITIVE ("/Layer/Layer to Image Size", lp && !aux);
SET_SENSITIVE ("/Layer/Scale Layer...", lp && !aux);
SET_SENSITIVE ("/Layer/Crop Layer", lp && !aux && sel);

View File

@ -104,7 +104,7 @@ GimpItemFactoryEntry layers_menu_entries[] =
"<StockItem>", GIMP_STOCK_RESIZE },
NULL,
GIMP_HELP_LAYER_RESIZE, NULL },
{ { N_("/Layer to _Imagesize"), NULL,
{ { N_("/Layer to _Image Size"), NULL,
layers_resize_to_image_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_LAYER_TO_IMAGESIZE },
NULL,
@ -236,7 +236,7 @@ layers_menu_update (GtkItemFactory *factory,
SET_SENSITIVE ("/Delete Layer", layer && !ac);
SET_SENSITIVE ("/Layer Boundary Size...", layer && !ac);
SET_SENSITIVE ("/Layer to Imagesize", layer && !ac);
SET_SENSITIVE ("/Layer to Image Size", layer && !ac);
SET_SENSITIVE ("/Scale Layer...", layer && !ac);
SET_SENSITIVE ("/Add Layer Mask...", layer && !fs && !ac && !lm && alpha);

View File

@ -862,7 +862,7 @@ GimpItemFactoryEntry image_menu_entries[] =
"<StockItem>", GIMP_STOCK_RESIZE },
NULL,
GIMP_HELP_LAYER_RESIZE, NULL },
{ { N_("/Layer/Layer to _Imagesize"), NULL,
{ { N_("/Layer/Layer to _Image Size"), NULL,
layers_resize_to_image_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_LAYER_TO_IMAGESIZE },
NULL,
@ -1546,7 +1546,7 @@ image_menu_update (GtkItemFactory *item_factory,
SET_SENSITIVE ("/Layer/Delete Layer", lp && !aux);
SET_SENSITIVE ("/Layer/Layer Boundary Size...", lp && !aux);
SET_SENSITIVE ("/Layer/Layer to Imagesize", lp && !aux);
SET_SENSITIVE ("/Layer/Layer to Image Size", lp && !aux);
SET_SENSITIVE ("/Layer/Scale Layer...", lp && !aux);
SET_SENSITIVE ("/Layer/Crop Layer", lp && !aux && sel);

View File

@ -72,6 +72,8 @@ static void gimp_paint_core_calc_brush_size (GimpPaintCore *core,
gdouble scale,
gint *width,
gint *height);
static inline void rotate_pointers (gulong **p,
guint32 n);
static MaskBuf * gimp_paint_core_subsample_mask (GimpPaintCore *core,
MaskBuf *mask,
gdouble x,

View File

@ -69,7 +69,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 348 procedures registered total */
/* 349 procedures registered total */
void
internal_procs_init (Gimp *gimp,
@ -90,73 +90,73 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Color"), 0.086);
register_color_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.124);
(* status_callback) (NULL, _("Convert"), 0.123);
register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.132);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.144);
(* status_callback) (NULL, _("Drawable procedures"), 0.143);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.21);
(* status_callback) (NULL, _("Edit procedures"), 0.209);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.227);
(* status_callback) (NULL, _("File Operations"), 0.226);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.25);
(* status_callback) (NULL, _("Floating selections"), 0.249);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.267);
(* status_callback) (NULL, _("Font UI"), 0.266);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.276);
(* status_callback) (NULL, _("Fonts"), 0.275);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.282);
(* status_callback) (NULL, _("Gimprc procedures"), 0.281);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.293);
(* status_callback) (NULL, _("Gradient UI"), 0.292);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.302);
(* status_callback) (NULL, _("Gradients"), 0.301);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.322);
(* status_callback) (NULL, _("Guide procedures"), 0.321);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.339);
(* status_callback) (NULL, _("Help procedures"), 0.338);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.342);
(* status_callback) (NULL, _("Image"), 0.341);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.526);
(* status_callback) (NULL, _("Layer"), 0.524);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.618);
(* status_callback) (NULL, _("Message procedures"), 0.619);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.626);
(* status_callback) (NULL, _("Miscellaneous"), 0.628);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Misc Tool procedures"), 0.632);
(* status_callback) (NULL, _("Misc Tool procedures"), 0.633);
register_misc_tools_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.641);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.642);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.684);
(* status_callback) (NULL, _("Palette"), 0.685);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.701);
(* status_callback) (NULL, _("Palette UI"), 0.702);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.71);
(* status_callback) (NULL, _("Palettes"), 0.711);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.724);
(* status_callback) (NULL, _("Parasite procedures"), 0.725);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.759);
@ -165,7 +165,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Pattern UI"), 0.802);
register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.81);
(* status_callback) (NULL, _("Patterns"), 0.811);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.825);

View File

@ -45,6 +45,7 @@ static ProcRecord layer_copy_proc;
static ProcRecord layer_create_mask_proc;
static ProcRecord layer_scale_proc;
static ProcRecord layer_resize_proc;
static ProcRecord layer_resize_to_image_size_proc;
static ProcRecord layer_delete_proc;
static ProcRecord layer_translate_proc;
static ProcRecord layer_add_alpha_proc;
@ -81,6 +82,7 @@ register_layer_procs (Gimp *gimp)
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_resize_to_image_size_proc);
procedural_db_register (gimp, &layer_delete_proc);
procedural_db_register (gimp, &layer_translate_proc);
procedural_db_register (gimp, &layer_add_alpha_proc);
@ -561,6 +563,53 @@ static ProcRecord layer_resize_proc =
{ { layer_resize_invoker } }
};
static Argument *
layer_resize_to_image_size_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
GimpLayer *layer;
layer = (GimpLayer *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_LAYER (layer))
success = FALSE;
if (success)
{
if (gimp_item_get_image (GIMP_ITEM (layer)))
gimp_layer_resize_to_image (layer);
else
success = FALSE;
}
return procedural_db_return_args (&layer_resize_to_image_size_proc, success);
}
static ProcArg layer_resize_to_image_size_inargs[] =
{
{
GIMP_PDB_LAYER,
"layer",
"The layer to resize"
}
};
static ProcRecord layer_resize_to_image_size_proc =
{
"gimp_layer_resize_to_image_size",
"Resize a layer to the image size.",
"This procedure resizes the layer so that it's new width and height are equal to the width and height of its image container.",
"Manish Singh",
"Manish Singh",
"2003",
GIMP_INTERNAL,
1,
layer_resize_to_image_size_inargs,
0,
NULL,
{ { layer_resize_to_image_size_invoker } }
};
static Argument *
layer_delete_invoker (Gimp *gimp,
Argument *args)
@ -575,10 +624,9 @@ layer_delete_invoker (Gimp *gimp,
if (success)
{
if (! gimp_item_get_image (GIMP_ITEM (layer)))
{
g_object_unref (layer);
success = TRUE;
}
g_object_unref (layer);
else
success = FALSE;
}
return procedural_db_return_args (&layer_delete_proc, success);

View File

@ -49,7 +49,7 @@
(gtk_accel_path "<Image>/Layer/Stack/Layer to Bottom" "<Control>braceleft")
(gtk_accel_path "<Image>/Tools/Selection Tools/Intelligent Scissors" "")
(gtk_accel_path "<Image>/Tools/Paint Tools/Clone" "s")
(gtk_accel_path "<Image>/Layer/Layer to Imagesize" "<Alt>y")
(gtk_accel_path "<Image>/Layer/Layer to Image Size" "<Alt>y")
(gtk_accel_path "<Image>/Layer/Stack/Lower Layer" "<Control>bracketleft")
(gtk_accel_path "<Image>/View/Snap to Guides" "<Control>semicolon")
(gtk_accel_path "<Image>/Tools/Selection Tools/Fuzzy Select" "w")

View File

@ -244,6 +244,36 @@ gimp_layer_resize (gint32 layer_ID,
return success;
}
/**
* gimp_layer_resize_to_image_size:
* @layer_ID: The layer to resize.
*
* Resize a layer to the image size.
*
* This procedure resizes the layer so that it's new width and height
* are equal to the width and height of its image container.
*
* Returns: TRUE on success.
*/
gboolean
gimp_layer_resize_to_image_size (gint32 layer_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_layer_resize_to_image_size",
&nreturn_vals,
GIMP_PDB_LAYER, layer_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_layer_delete:
* @layer_ID: The layer to delete.

View File

@ -29,68 +29,69 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gint32 _gimp_layer_new (gint32 image_ID,
gint width,
gint height,
GimpImageType type,
const gchar *name,
gdouble opacity,
GimpLayerModeEffects mode);
gint32 _gimp_layer_copy (gint32 layer_ID,
gboolean add_alpha);
gint32 gimp_layer_create_mask (gint32 layer_ID,
GimpAddMaskType mask_type);
gboolean gimp_layer_scale (gint32 layer_ID,
gint new_width,
gint new_height,
gboolean local_origin);
gboolean gimp_layer_resize (gint32 layer_ID,
gint new_width,
gint new_height,
gint offx,
gint offy);
gboolean gimp_layer_delete (gint32 layer_ID);
gboolean gimp_layer_translate (gint32 layer_ID,
gint offx,
gint offy);
gboolean gimp_layer_add_alpha (gint32 layer_ID);
gboolean gimp_layer_set_offsets (gint32 layer_ID,
gint offx,
gint offy);
gint32 gimp_layer_mask (gint32 layer_ID);
gboolean gimp_layer_is_floating_sel (gint32 layer_ID);
gint32 gimp_layer_new_from_drawable (gint32 drawable_ID,
gint32 dest_image_ID);
gchar* gimp_layer_get_name (gint32 layer_ID);
gboolean gimp_layer_set_name (gint32 layer_ID,
const gchar *name);
gboolean gimp_layer_get_visible (gint32 layer_ID);
gboolean gimp_layer_set_visible (gint32 layer_ID,
gboolean visible);
gboolean gimp_layer_get_preserve_trans (gint32 layer_ID);
gboolean gimp_layer_set_preserve_trans (gint32 layer_ID,
gboolean preserve_trans);
gboolean gimp_layer_get_apply_mask (gint32 layer_ID);
gboolean gimp_layer_set_apply_mask (gint32 layer_ID,
gboolean apply_mask);
gboolean gimp_layer_get_show_mask (gint32 layer_ID);
gboolean gimp_layer_set_show_mask (gint32 layer_ID,
gboolean show_mask);
gboolean gimp_layer_get_edit_mask (gint32 layer_ID);
gboolean gimp_layer_set_edit_mask (gint32 layer_ID,
gboolean edit_mask);
gdouble gimp_layer_get_opacity (gint32 layer_ID);
gboolean gimp_layer_set_opacity (gint32 layer_ID,
gdouble opacity);
GimpLayerModeEffects gimp_layer_get_mode (gint32 layer_ID);
gboolean gimp_layer_set_mode (gint32 layer_ID,
GimpLayerModeEffects mode);
gboolean gimp_layer_get_linked (gint32 layer_ID);
gboolean gimp_layer_set_linked (gint32 layer_ID,
gboolean linked);
gint gimp_layer_get_tattoo (gint32 layer_ID);
gboolean gimp_layer_set_tattoo (gint32 layer_ID,
gint tattoo);
gint32 _gimp_layer_new (gint32 image_ID,
gint width,
gint height,
GimpImageType type,
const gchar *name,
gdouble opacity,
GimpLayerModeEffects mode);
gint32 _gimp_layer_copy (gint32 layer_ID,
gboolean add_alpha);
gint32 gimp_layer_create_mask (gint32 layer_ID,
GimpAddMaskType mask_type);
gboolean gimp_layer_scale (gint32 layer_ID,
gint new_width,
gint new_height,
gboolean local_origin);
gboolean gimp_layer_resize (gint32 layer_ID,
gint new_width,
gint new_height,
gint offx,
gint offy);
gboolean gimp_layer_resize_to_image_size (gint32 layer_ID);
gboolean gimp_layer_delete (gint32 layer_ID);
gboolean gimp_layer_translate (gint32 layer_ID,
gint offx,
gint offy);
gboolean gimp_layer_add_alpha (gint32 layer_ID);
gboolean gimp_layer_set_offsets (gint32 layer_ID,
gint offx,
gint offy);
gint32 gimp_layer_mask (gint32 layer_ID);
gboolean gimp_layer_is_floating_sel (gint32 layer_ID);
gint32 gimp_layer_new_from_drawable (gint32 drawable_ID,
gint32 dest_image_ID);
gchar* gimp_layer_get_name (gint32 layer_ID);
gboolean gimp_layer_set_name (gint32 layer_ID,
const gchar *name);
gboolean gimp_layer_get_visible (gint32 layer_ID);
gboolean gimp_layer_set_visible (gint32 layer_ID,
gboolean visible);
gboolean gimp_layer_get_preserve_trans (gint32 layer_ID);
gboolean gimp_layer_set_preserve_trans (gint32 layer_ID,
gboolean preserve_trans);
gboolean gimp_layer_get_apply_mask (gint32 layer_ID);
gboolean gimp_layer_set_apply_mask (gint32 layer_ID,
gboolean apply_mask);
gboolean gimp_layer_get_show_mask (gint32 layer_ID);
gboolean gimp_layer_set_show_mask (gint32 layer_ID,
gboolean show_mask);
gboolean gimp_layer_get_edit_mask (gint32 layer_ID);
gboolean gimp_layer_set_edit_mask (gint32 layer_ID,
gboolean edit_mask);
gdouble gimp_layer_get_opacity (gint32 layer_ID);
gboolean gimp_layer_set_opacity (gint32 layer_ID,
gdouble opacity);
GimpLayerModeEffects gimp_layer_get_mode (gint32 layer_ID);
gboolean gimp_layer_set_mode (gint32 layer_ID,
GimpLayerModeEffects mode);
gboolean gimp_layer_get_linked (gint32 layer_ID);
gboolean gimp_layer_set_linked (gint32 layer_ID,
gboolean linked);
gint gimp_layer_get_tattoo (gint32 layer_ID);
gboolean gimp_layer_set_tattoo (gint32 layer_ID,
gint tattoo);
G_END_DECLS

View File

@ -1648,7 +1648,7 @@ save_image (const gchar *filename,
for (len = strlen (c); len; c++, len--)
{
if (*c < 0)
if ((guchar) *c > 127)
{
g_message (_("The TIFF format only supports comments in\n"
"7bit ASCII encoding. No comment is saved."));

View File

@ -354,6 +354,30 @@ content.
HELP
}
sub layer_resize_to_image_size {
$blurb = 'Resize a layer to the image size.';
$help = <<'HELP';
This procedure resizes the layer so that it's new width and height are equal to
the width and height of its image container.
HELP
$author = $copyright = 'Manish Singh';
$date = '2003';
@inargs = ( &layer_arg );
$inargs[0]->{desc} .= ' to resize';
%invoke = ( code => <<'CODE' );
{
if (gimp_item_get_image (GIMP_ITEM (layer)))
gimp_layer_resize_to_image (layer);
else
success = FALSE;
}
CODE
}
sub layer_delete {
$blurb = 'Delete a layer.';
@ -373,10 +397,9 @@ HELP
%invoke = ( code => <<'CODE' );
{
if (! gimp_item_get_image (GIMP_ITEM (layer)))
{
g_object_unref (layer);
success = TRUE;
}
g_object_unref (layer);
else
success = FALSE;
}
CODE
}
@ -626,9 +649,9 @@ CODE
"core/gimpitem-linked.h" "pdb_glue.h" "gimp-intl.h");
unshift @procs, qw(layer_new layer_copy layer_create_mask layer_scale
layer_resize layer_delete layer_translate layer_add_alpha
layer_set_offsets layer_mask layer_is_floating_sel
layer_new_from_drawable);
layer_resize layer_resize_to_image_size layer_delete
layer_translate layer_add_alpha layer_set_offsets layer_mask
layer_is_floating_sel layer_new_from_drawable);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Layer';