diff --git a/ChangeLog b/ChangeLog index 48dc23363f..09fbf13270 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Thu Jul 29 22:06:41 PDT 1999 Manish Singh + + * tools/pdbgen/pdb/tools.pdb: revert previous change + + * tools/pdbgen/pdb/guides.pdb: perform orientation xform here + + * app/gimpimage.h: use 2 enums, one for internal and for external + + * libgimp/gimpenums.h: change around external enums here + Fri Jul 30 02:34:43 CEST 1999 Marc Lehmann * app/gimpparasite.c: I escaped everything when writing out diff --git a/app/core/gimpimage-guides.h b/app/core/gimpimage-guides.h index d0283c90a2..7cc3e051af 100644 --- a/app/core/gimpimage-guides.h +++ b/app/core/gimpimage-guides.h @@ -61,6 +61,12 @@ typedef enum { ORIENTATION_UNKNOWN, ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL +} InternalOrientationType; + +typedef enum { + HORIZONTAL, + VERTICAL, + UNKNOWN } OrientationType; typedef enum diff --git a/app/core/gimpimage-merge.h b/app/core/gimpimage-merge.h index d0283c90a2..7cc3e051af 100644 --- a/app/core/gimpimage-merge.h +++ b/app/core/gimpimage-merge.h @@ -61,6 +61,12 @@ typedef enum { ORIENTATION_UNKNOWN, ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL +} InternalOrientationType; + +typedef enum { + HORIZONTAL, + VERTICAL, + UNKNOWN } OrientationType; typedef enum diff --git a/app/core/gimpimage-projection.h b/app/core/gimpimage-projection.h index d0283c90a2..7cc3e051af 100644 --- a/app/core/gimpimage-projection.h +++ b/app/core/gimpimage-projection.h @@ -61,6 +61,12 @@ typedef enum { ORIENTATION_UNKNOWN, ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL +} InternalOrientationType; + +typedef enum { + HORIZONTAL, + VERTICAL, + UNKNOWN } OrientationType; typedef enum diff --git a/app/core/gimpimage-resize.h b/app/core/gimpimage-resize.h index d0283c90a2..7cc3e051af 100644 --- a/app/core/gimpimage-resize.h +++ b/app/core/gimpimage-resize.h @@ -61,6 +61,12 @@ typedef enum { ORIENTATION_UNKNOWN, ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL +} InternalOrientationType; + +typedef enum { + HORIZONTAL, + VERTICAL, + UNKNOWN } OrientationType; typedef enum diff --git a/app/core/gimpimage-scale.h b/app/core/gimpimage-scale.h index d0283c90a2..7cc3e051af 100644 --- a/app/core/gimpimage-scale.h +++ b/app/core/gimpimage-scale.h @@ -61,6 +61,12 @@ typedef enum { ORIENTATION_UNKNOWN, ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL +} InternalOrientationType; + +typedef enum { + HORIZONTAL, + VERTICAL, + UNKNOWN } OrientationType; typedef enum diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h index d0283c90a2..7cc3e051af 100644 --- a/app/core/gimpimage.h +++ b/app/core/gimpimage.h @@ -61,6 +61,12 @@ typedef enum { ORIENTATION_UNKNOWN, ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL +} InternalOrientationType; + +typedef enum { + HORIZONTAL, + VERTICAL, + UNKNOWN } OrientationType; typedef enum diff --git a/app/core/gimpprojection-construct.h b/app/core/gimpprojection-construct.h index d0283c90a2..7cc3e051af 100644 --- a/app/core/gimpprojection-construct.h +++ b/app/core/gimpprojection-construct.h @@ -61,6 +61,12 @@ typedef enum { ORIENTATION_UNKNOWN, ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL +} InternalOrientationType; + +typedef enum { + HORIZONTAL, + VERTICAL, + UNKNOWN } OrientationType; typedef enum diff --git a/app/gimpimage.h b/app/gimpimage.h index d0283c90a2..7cc3e051af 100644 --- a/app/gimpimage.h +++ b/app/gimpimage.h @@ -61,6 +61,12 @@ typedef enum { ORIENTATION_UNKNOWN, ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL +} InternalOrientationType; + +typedef enum { + HORIZONTAL, + VERTICAL, + UNKNOWN } OrientationType; typedef enum diff --git a/app/guides_cmds.c b/app/guides_cmds.c index 6ec2ca5f27..73d649ce19 100644 --- a/app/guides_cmds.c +++ b/app/guides_cmds.c @@ -408,7 +408,7 @@ image_get_guide_orientation_invoker (Argument *args) if ((((Guide *) guides->data)->guide_ID == guide) && (((Guide *) guides->data)->position >= 0)) { - orientation = ((Guide *) guides->data)->orientation; + orientation = ((Guide *) guides->data)->orientation - 1; success = TRUE; break; } @@ -444,7 +444,7 @@ static ProcArg image_get_guide_orientation_outargs[] = { PDB_INT32, "orientation", - "The guide's orientation: { ORIENTATION_HORIZONTAL (1), ORIENTATION_VERTICAL (2) }" + "The guide's orientation: { HORIZONTAL (0), VERTICAL (1), UNKNOWN (2) }" } }; diff --git a/app/tools_cmds.c b/app/tools_cmds.c index 76e079dcb2..71067799aa 100644 --- a/app/tools_cmds.c +++ b/app/tools_cmds.c @@ -36,6 +36,7 @@ #include "flip_tool.h" #include "free_select.h" #include "fuzzy_select.h" +#include "gimpimage.h" #include "paint_core.h" #include "paint_funcs.h" #include "paintbrush.h" @@ -1573,7 +1574,7 @@ flip_invoker (Argument *args) success = FALSE; flip_type = args[1].value.pdb_int; - if (flip_type < 0 || flip_type > 1) + if (flip_type < VERTICAL || flip_type > UNKNOWN) success = FALSE; if (success) @@ -1587,9 +1588,16 @@ flip_invoker (Argument *args) float_tiles = transform_core_cut (gimage, drawable, &new_layer); /* flip the buffer */ - new_tiles = flip_tool_flip (gimage, drawable, float_tiles, -1, - flip_type == 1 ? ORIENTATION_VERTICAL : - ORIENTATION_HORIZONTAL); + switch (flip_type) + { + case ORIENTATION_HORIZONTAL: + case ORIENTATION_VERTICAL: + new_tiles = flip_tool_flip (gimage, drawable, float_tiles, -1, flip_type); + break; + default: + new_tiles = NULL; + break; + } /* free the cut/copied buffer */ tile_manager_destroy (float_tiles); @@ -1624,7 +1632,7 @@ static ProcArg flip_inargs[] = { PDB_INT32, "flip_type", - "Type of flip: HORIZONTAL (0) or VERTICAL (1)" + "Type of flip: HORIZONTAL (0), VERTICAL (1), UNKNOWN (2)" } }; @@ -2648,7 +2656,7 @@ shear_invoker (Argument *args) interpolation = args[1].value.pdb_int ? TRUE : FALSE; shear_type = args[2].value.pdb_int; - if (shear_type < 0 || shear_type > 1) + if (shear_type < VERTICAL || shear_type > UNKNOWN) success = FALSE; magnitude = args[3].value.pdb_float; @@ -2669,9 +2677,9 @@ shear_invoker (Argument *args) gimp_matrix_identity (matrix); gimp_matrix_translate (matrix, -cx, -cy); /* Shear matrix */ - if (shear_type == 0) + if (shear_type == ORIENTATION_HORIZONTAL) gimp_matrix_xshear (matrix, magnitude / float_tiles->height); - else if (shear_type == 1) + else if (shear_type == ORIENTATION_VERTICAL) gimp_matrix_yshear (matrix, magnitude / float_tiles->width); gimp_matrix_translate (matrix, +cx, +cy); @@ -2717,7 +2725,7 @@ static ProcArg shear_inargs[] = { PDB_INT32, "shear_type", - "Type of shear: HORIZONTAL (0) or VERTICAL (1)" + "Type of shear: HORIZONTAL (0), VERTICAL (1), UNKNOWN (2)" }, { PDB_FLOAT, diff --git a/libgimp/gimpenums.h b/libgimp/gimpenums.h index 053e100f19..29c49b40f9 100644 --- a/libgimp/gimpenums.h +++ b/libgimp/gimpenums.h @@ -29,9 +29,9 @@ typedef enum typedef enum { - ORIENTATION_UNKNOWN = 0, - ORIENTATION_HORIZONTAL = 1, - ORIENTATION_VERTICAL = 2 + ORIENTATION_HORIZONTAL = 0, + ORIENTATION_VERTICAL = 1, + ORIENTATION_UNKNOWN = 2 } GOrientation; typedef enum diff --git a/tools/pdbgen/enums.pl b/tools/pdbgen/enums.pl index e88aeab41e..4d8efb99d0 100644 --- a/tools/pdbgen/enums.pl +++ b/tools/pdbgen/enums.pl @@ -185,7 +185,7 @@ package Gimp::CodeGen::enums; GRAY => '1', INDEXED => '2' } }, - OrientationType => + InternalOrientationType => { contig => 1, header => 'gimpimage.h', symbols => [ qw(ORIENTATION_UNKNOWN ORIENTATION_HORIZONTAL @@ -194,6 +194,14 @@ package Gimp::CodeGen::enums; ORIENTATION_HORIZONTAL => '1', ORIENTATION_VERTICAL => '2' } }, + OrientationType => + { contig => 1, + header => 'gimpimage.h', + symbols => [ qw(HORIZONTAL VERTICAL UNKNOWN) ], + mapping => { HORIZONTAL => '0', + VERTICAL => '1', + UNKNOWN => '2' } + }, ChannelType => { contig => 1, header => 'gimpimage.h', diff --git a/tools/pdbgen/pdb/guides.pdb b/tools/pdbgen/pdb/guides.pdb index 8ac00db984..66b5119522 100644 --- a/tools/pdbgen/pdb/guides.pdb +++ b/tools/pdbgen/pdb/guides.pdb @@ -235,7 +235,7 @@ HELP if ((((Guide *) guides->data)->guide_ID == guide) && (((Guide *) guides->data)->position >= 0)) { - orientation = ((Guide *) guides->data)->orientation; + orientation = ((Guide *) guides->data)->orientation - 1; success = TRUE; break; } diff --git a/tools/pdbgen/pdb/misc_tools.pdb b/tools/pdbgen/pdb/misc_tools.pdb index 628d496942..66f7f87adb 100644 --- a/tools/pdbgen/pdb/misc_tools.pdb +++ b/tools/pdbgen/pdb/misc_tools.pdb @@ -649,8 +649,8 @@ HELP @inargs = ( &drawable_arg, - { name => 'flip_type', type => '0 <= int32 <= 1', - desc => 'Type of flip: HORIZONTAL (0) or VERTICAL (1)' } + { name => 'flip_type', type => &std_orientation_enum, + desc => 'Type of flip: %%desc%%' } ); @outargs = ( &drawable_out_arg('flipped') ); @@ -670,9 +670,16 @@ HELP float_tiles = transform_core_cut (gimage, drawable, &new_layer); /* flip the buffer */ - new_tiles = flip_tool_flip (gimage, drawable, float_tiles, -1, - flip_type == 1 ? ORIENTATION_VERTICAL : - ORIENTATION_HORIZONTAL); + switch (flip_type) + { + case ORIENTATION_HORIZONTAL: + case ORIENTATION_VERTICAL: + new_tiles = flip_tool_flip (gimage, drawable, float_tiles, -1, flip_type); + break; + default: + new_tiles = NULL; + break; + } /* free the cut/copied buffer */ tile_manager_destroy (float_tiles); @@ -1226,8 +1233,8 @@ HELP &drawable_arg, { name => 'interpolation', type => 'boolean', desc => 'Whether to use interpolation' }, - { name => 'shear_type', type => '0 <= int32 <= 1', - desc => 'Type of shear: HORIZONTAL (0) or VERTICAL (1)' }, + { name => 'shear_type', type => &std_orientation_enum, + desc => 'Type of shear: %%desc%%' }, { name => 'magnitude', type => 'float', desc => 'The magnitude of the shear' } ); @@ -1256,9 +1263,9 @@ HELP gimp_matrix_identity (matrix); gimp_matrix_translate (matrix, -cx, -cy); /* Shear matrix */ - if (shear_type == 0) + if (shear_type == ORIENTATION_HORIZONTAL) gimp_matrix_xshear (matrix, magnitude / float_tiles->height); - else if (shear_type == 1) + else if (shear_type == ORIENTATION_VERTICAL) gimp_matrix_yshear (matrix, magnitude / float_tiles->width); gimp_matrix_translate (matrix, +cx, +cy); diff --git a/tools/pdbgen/pdb/paint_tools.pdb b/tools/pdbgen/pdb/paint_tools.pdb index 628d496942..66f7f87adb 100644 --- a/tools/pdbgen/pdb/paint_tools.pdb +++ b/tools/pdbgen/pdb/paint_tools.pdb @@ -649,8 +649,8 @@ HELP @inargs = ( &drawable_arg, - { name => 'flip_type', type => '0 <= int32 <= 1', - desc => 'Type of flip: HORIZONTAL (0) or VERTICAL (1)' } + { name => 'flip_type', type => &std_orientation_enum, + desc => 'Type of flip: %%desc%%' } ); @outargs = ( &drawable_out_arg('flipped') ); @@ -670,9 +670,16 @@ HELP float_tiles = transform_core_cut (gimage, drawable, &new_layer); /* flip the buffer */ - new_tiles = flip_tool_flip (gimage, drawable, float_tiles, -1, - flip_type == 1 ? ORIENTATION_VERTICAL : - ORIENTATION_HORIZONTAL); + switch (flip_type) + { + case ORIENTATION_HORIZONTAL: + case ORIENTATION_VERTICAL: + new_tiles = flip_tool_flip (gimage, drawable, float_tiles, -1, flip_type); + break; + default: + new_tiles = NULL; + break; + } /* free the cut/copied buffer */ tile_manager_destroy (float_tiles); @@ -1226,8 +1233,8 @@ HELP &drawable_arg, { name => 'interpolation', type => 'boolean', desc => 'Whether to use interpolation' }, - { name => 'shear_type', type => '0 <= int32 <= 1', - desc => 'Type of shear: HORIZONTAL (0) or VERTICAL (1)' }, + { name => 'shear_type', type => &std_orientation_enum, + desc => 'Type of shear: %%desc%%' }, { name => 'magnitude', type => 'float', desc => 'The magnitude of the shear' } ); @@ -1256,9 +1263,9 @@ HELP gimp_matrix_identity (matrix); gimp_matrix_translate (matrix, -cx, -cy); /* Shear matrix */ - if (shear_type == 0) + if (shear_type == ORIENTATION_HORIZONTAL) gimp_matrix_xshear (matrix, magnitude / float_tiles->height); - else if (shear_type == 1) + else if (shear_type == ORIENTATION_VERTICAL) gimp_matrix_yshear (matrix, magnitude / float_tiles->width); gimp_matrix_translate (matrix, +cx, +cy); diff --git a/tools/pdbgen/pdb/tools.pdb b/tools/pdbgen/pdb/tools.pdb index 628d496942..66f7f87adb 100644 --- a/tools/pdbgen/pdb/tools.pdb +++ b/tools/pdbgen/pdb/tools.pdb @@ -649,8 +649,8 @@ HELP @inargs = ( &drawable_arg, - { name => 'flip_type', type => '0 <= int32 <= 1', - desc => 'Type of flip: HORIZONTAL (0) or VERTICAL (1)' } + { name => 'flip_type', type => &std_orientation_enum, + desc => 'Type of flip: %%desc%%' } ); @outargs = ( &drawable_out_arg('flipped') ); @@ -670,9 +670,16 @@ HELP float_tiles = transform_core_cut (gimage, drawable, &new_layer); /* flip the buffer */ - new_tiles = flip_tool_flip (gimage, drawable, float_tiles, -1, - flip_type == 1 ? ORIENTATION_VERTICAL : - ORIENTATION_HORIZONTAL); + switch (flip_type) + { + case ORIENTATION_HORIZONTAL: + case ORIENTATION_VERTICAL: + new_tiles = flip_tool_flip (gimage, drawable, float_tiles, -1, flip_type); + break; + default: + new_tiles = NULL; + break; + } /* free the cut/copied buffer */ tile_manager_destroy (float_tiles); @@ -1226,8 +1233,8 @@ HELP &drawable_arg, { name => 'interpolation', type => 'boolean', desc => 'Whether to use interpolation' }, - { name => 'shear_type', type => '0 <= int32 <= 1', - desc => 'Type of shear: HORIZONTAL (0) or VERTICAL (1)' }, + { name => 'shear_type', type => &std_orientation_enum, + desc => 'Type of shear: %%desc%%' }, { name => 'magnitude', type => 'float', desc => 'The magnitude of the shear' } ); @@ -1256,9 +1263,9 @@ HELP gimp_matrix_identity (matrix); gimp_matrix_translate (matrix, -cx, -cy); /* Shear matrix */ - if (shear_type == 0) + if (shear_type == ORIENTATION_HORIZONTAL) gimp_matrix_xshear (matrix, magnitude / float_tiles->height); - else if (shear_type == 1) + else if (shear_type == ORIENTATION_VERTICAL) gimp_matrix_yshear (matrix, magnitude / float_tiles->width); gimp_matrix_translate (matrix, +cx, +cy); diff --git a/tools/pdbgen/pdb/transform_tools.pdb b/tools/pdbgen/pdb/transform_tools.pdb index 628d496942..66f7f87adb 100644 --- a/tools/pdbgen/pdb/transform_tools.pdb +++ b/tools/pdbgen/pdb/transform_tools.pdb @@ -649,8 +649,8 @@ HELP @inargs = ( &drawable_arg, - { name => 'flip_type', type => '0 <= int32 <= 1', - desc => 'Type of flip: HORIZONTAL (0) or VERTICAL (1)' } + { name => 'flip_type', type => &std_orientation_enum, + desc => 'Type of flip: %%desc%%' } ); @outargs = ( &drawable_out_arg('flipped') ); @@ -670,9 +670,16 @@ HELP float_tiles = transform_core_cut (gimage, drawable, &new_layer); /* flip the buffer */ - new_tiles = flip_tool_flip (gimage, drawable, float_tiles, -1, - flip_type == 1 ? ORIENTATION_VERTICAL : - ORIENTATION_HORIZONTAL); + switch (flip_type) + { + case ORIENTATION_HORIZONTAL: + case ORIENTATION_VERTICAL: + new_tiles = flip_tool_flip (gimage, drawable, float_tiles, -1, flip_type); + break; + default: + new_tiles = NULL; + break; + } /* free the cut/copied buffer */ tile_manager_destroy (float_tiles); @@ -1226,8 +1233,8 @@ HELP &drawable_arg, { name => 'interpolation', type => 'boolean', desc => 'Whether to use interpolation' }, - { name => 'shear_type', type => '0 <= int32 <= 1', - desc => 'Type of shear: HORIZONTAL (0) or VERTICAL (1)' }, + { name => 'shear_type', type => &std_orientation_enum, + desc => 'Type of shear: %%desc%%' }, { name => 'magnitude', type => 'float', desc => 'The magnitude of the shear' } ); @@ -1256,9 +1263,9 @@ HELP gimp_matrix_identity (matrix); gimp_matrix_translate (matrix, -cx, -cy); /* Shear matrix */ - if (shear_type == 0) + if (shear_type == ORIENTATION_HORIZONTAL) gimp_matrix_xshear (matrix, magnitude / float_tiles->height); - else if (shear_type == 1) + else if (shear_type == ORIENTATION_VERTICAL) gimp_matrix_yshear (matrix, magnitude / float_tiles->width); gimp_matrix_translate (matrix, +cx, +cy);