Major clean-up of xjt.

This commit is contained in:
Maurits Rijk 2003-08-28 19:46:39 +00:00
parent 28920aa76e
commit e4e1f51cdb
6 changed files with 645 additions and 1746 deletions

View file

@ -1,3 +1,11 @@
2003-08-28 Maurits Rijk <lpeek.mrijk@consunet.nl>
* plug-ins/xjt/xpdb_calls.[ch]: removed
* Makefile.am
* plug-ins/xjt/xjt.c: major clean-up. All calls that were in xpdb_calls.c are already
available in the various libgimp routines.
2003-08-28 Michael Natterer <mitch@gimp.org>
Completed the new help infrastructure. Needs some polishing but
@ -65,6 +73,7 @@
* app/pdb/image_cmds.c: regenerated.
>>>>>>> 1.6225
2003-08-28 Simon Budig <simon@gimp.org>
* app/tools/gimptransformtool.c: Modified the test when to paint

View file

@ -11,9 +11,7 @@ EXTRA_DIST = \
xjt_SOURCES = \
xjt.c \
xjpeg.c \
xjpeg.h \
xpdb_calls.c \
xpdb_calls.h
xjpeg.h
INCLUDES = \
-I$(top_srcdir) \

View file

@ -80,7 +80,6 @@
/* XJT includes */
#include "xjpeg.h"
#include "xpdb_calls.h"
#define GIMP_XJ_IMAGE "GIMP_XJ_IMAGE"
@ -429,8 +428,7 @@ static JpegSaveInterface jsint =
static gint
p_invert(gint value)
{
if(value == FALSE) return(TRUE);
return(FALSE);
return (value) ? FALSE : TRUE;
}
int p_system(const gchar *cmd)
@ -655,7 +653,7 @@ p_my_ascii_strtod (gchar *nptr,
*/
ii=0;
ic = -1;
while(nptr)
while (nptr)
{
if (nptr[ii] == ',')
{
@ -674,13 +672,12 @@ p_my_ascii_strtod (gchar *nptr,
l_rc = g_ascii_strtod(nptr, endptr);
if(ic >= 0)
if (ic >= 0)
{
nptr[ii] = ','; /* restore the comma */
}
return(l_rc);
return l_rc;
} /* end p_my_ascii_strtod */
/* -- type transformer routines XJT -- GIMP internal enums ----------------- */
@ -688,14 +685,14 @@ p_my_ascii_strtod (gchar *nptr,
gint32
p_to_GimpOrientation(gint32 orientation)
{
if(orientation == XJT_ORIENTATION_VERTICAL) return(GIMP_ORIENTATION_VERTICAL);
return(GIMP_ORIENTATION_HORIZONTAL);
return (orientation == XJT_ORIENTATION_VERTICAL)
? GIMP_ORIENTATION_VERTICAL : GIMP_ORIENTATION_HORIZONTAL;
}
gint32
p_to_XJTOrientation(gint32 orientation)
{
if(orientation == GIMP_ORIENTATION_VERTICAL) return(XJT_ORIENTATION_VERTICAL);
return(XJT_ORIENTATION_HORIZONTAL);
return (orientation == GIMP_ORIENTATION_VERTICAL)
? XJT_ORIENTATION_VERTICAL : XJT_ORIENTATION_HORIZONTAL;
}
GimpLayerModeEffects
@ -703,36 +700,36 @@ p_to_GimpLayerModeEffects(XJTLayerModeEffects intype)
{
switch(intype)
{
case XJT_NORMAL_MODE: return(GIMP_NORMAL_MODE);
case XJT_DISSOLVE_MODE: return(GIMP_DISSOLVE_MODE);
case XJT_BEHIND_MODE: return(GIMP_BEHIND_MODE);
case XJT_MULTIPLY_MODE: return(GIMP_MULTIPLY_MODE);
case XJT_SCREEN_MODE: return(GIMP_SCREEN_MODE);
case XJT_OVERLAY_MODE: return(GIMP_OVERLAY_MODE);
case XJT_DIFFERENCE_MODE: return(GIMP_DIFFERENCE_MODE);
case XJT_ADDITION_MODE: return(GIMP_ADDITION_MODE);
case XJT_SUBTRACT_MODE: return(GIMP_SUBTRACT_MODE);
case XJT_DARKEN_ONLY_MODE: return(GIMP_DARKEN_ONLY_MODE);
case XJT_LIGHTEN_ONLY_MODE: return(GIMP_LIGHTEN_ONLY_MODE);
case XJT_HUE_MODE: return(GIMP_HUE_MODE);
case XJT_SATURATION_MODE: return(GIMP_SATURATION_MODE);
case XJT_COLOR_MODE: return(GIMP_COLOR_MODE);
case XJT_VALUE_MODE: return(GIMP_VALUE_MODE);
case XJT_DIVIDE_MODE: return(GIMP_DIVIDE_MODE);
case XJT_DODGE_MODE: return(GIMP_DODGE_MODE);
case XJT_BURN_MODE: return(GIMP_BURN_MODE);
case XJT_HARDLIGHT_MODE: return(GIMP_HARDLIGHT_MODE);
case XJT_SOFTLIGHT_MODE: return(GIMP_SOFTLIGHT_MODE);
case XJT_GRAIN_EXTRACT_MODE: return(GIMP_GRAIN_EXTRACT_MODE);
case XJT_GRAIN_MERGE_MODE: return(GIMP_GRAIN_MERGE_MODE);
case XJT_COLOR_ERASE_MODE: return(GIMP_COLOR_ERASE_MODE);
case XJT_NORMAL_MODE: return GIMP_NORMAL_MODE;
case XJT_DISSOLVE_MODE: return GIMP_DISSOLVE_MODE;
case XJT_BEHIND_MODE: return GIMP_BEHIND_MODE;
case XJT_MULTIPLY_MODE: return GIMP_MULTIPLY_MODE;
case XJT_SCREEN_MODE: return GIMP_SCREEN_MODE;
case XJT_OVERLAY_MODE: return GIMP_OVERLAY_MODE;
case XJT_DIFFERENCE_MODE: return GIMP_DIFFERENCE_MODE;
case XJT_ADDITION_MODE: return GIMP_ADDITION_MODE;
case XJT_SUBTRACT_MODE: return GIMP_SUBTRACT_MODE;
case XJT_DARKEN_ONLY_MODE: return GIMP_DARKEN_ONLY_MODE;
case XJT_LIGHTEN_ONLY_MODE: return GIMP_LIGHTEN_ONLY_MODE;
case XJT_HUE_MODE: return GIMP_HUE_MODE;
case XJT_SATURATION_MODE: return GIMP_SATURATION_MODE;
case XJT_COLOR_MODE: return GIMP_COLOR_MODE;
case XJT_VALUE_MODE: return GIMP_VALUE_MODE;
case XJT_DIVIDE_MODE: return GIMP_DIVIDE_MODE;
case XJT_DODGE_MODE: return GIMP_DODGE_MODE;
case XJT_BURN_MODE: return GIMP_BURN_MODE;
case XJT_HARDLIGHT_MODE: return GIMP_HARDLIGHT_MODE;
case XJT_SOFTLIGHT_MODE: return GIMP_SOFTLIGHT_MODE;
case XJT_GRAIN_EXTRACT_MODE: return GIMP_GRAIN_EXTRACT_MODE;
case XJT_GRAIN_MERGE_MODE: return GIMP_GRAIN_MERGE_MODE;
case XJT_COLOR_ERASE_MODE: return GIMP_COLOR_ERASE_MODE;
}
printf (_("XJT file contains unknown layermode %d"), (int)intype);
if((gint32)intype > (gint32)XJT_DIVIDE_MODE)
{
return((GimpLayerModeEffects)intype);
return (GimpLayerModeEffects)intype;
}
return(GIMP_NORMAL_MODE);
return GIMP_NORMAL_MODE;
}
XJTLayerModeEffects
@ -740,36 +737,36 @@ p_to_XJTLayerModeEffects(GimpLayerModeEffects intype)
{
switch(intype)
{
case GIMP_NORMAL_MODE: return(XJT_NORMAL_MODE);
case GIMP_DISSOLVE_MODE: return(XJT_DISSOLVE_MODE);
case GIMP_BEHIND_MODE: return(XJT_BEHIND_MODE);
case GIMP_MULTIPLY_MODE: return(XJT_MULTIPLY_MODE);
case GIMP_SCREEN_MODE: return(XJT_SCREEN_MODE);
case GIMP_OVERLAY_MODE: return(XJT_OVERLAY_MODE);
case GIMP_DIFFERENCE_MODE: return(XJT_DIFFERENCE_MODE);
case GIMP_ADDITION_MODE: return(XJT_ADDITION_MODE);
case GIMP_SUBTRACT_MODE: return(XJT_SUBTRACT_MODE);
case GIMP_DARKEN_ONLY_MODE: return(XJT_DARKEN_ONLY_MODE);
case GIMP_LIGHTEN_ONLY_MODE: return(XJT_LIGHTEN_ONLY_MODE);
case GIMP_HUE_MODE: return(XJT_HUE_MODE);
case GIMP_SATURATION_MODE: return(XJT_SATURATION_MODE);
case GIMP_COLOR_MODE: return(XJT_COLOR_MODE);
case GIMP_VALUE_MODE: return(XJT_VALUE_MODE);
case GIMP_DIVIDE_MODE: return(XJT_DIVIDE_MODE);
case GIMP_DODGE_MODE: return(XJT_DODGE_MODE);
case GIMP_BURN_MODE: return(XJT_BURN_MODE);
case GIMP_HARDLIGHT_MODE: return(XJT_HARDLIGHT_MODE);
case GIMP_SOFTLIGHT_MODE: return(XJT_SOFTLIGHT_MODE);
case GIMP_GRAIN_EXTRACT_MODE: return(XJT_GRAIN_EXTRACT_MODE);
case GIMP_GRAIN_MERGE_MODE: return(XJT_GRAIN_MERGE_MODE);
case GIMP_COLOR_ERASE_MODE: return(XJT_COLOR_ERASE_MODE);
case GIMP_NORMAL_MODE: return XJT_NORMAL_MODE;
case GIMP_DISSOLVE_MODE: return XJT_DISSOLVE_MODE;
case GIMP_BEHIND_MODE: return XJT_BEHIND_MODE;
case GIMP_MULTIPLY_MODE: return XJT_MULTIPLY_MODE;
case GIMP_SCREEN_MODE: return XJT_SCREEN_MODE;
case GIMP_OVERLAY_MODE: return XJT_OVERLAY_MODE;
case GIMP_DIFFERENCE_MODE: return XJT_DIFFERENCE_MODE;
case GIMP_ADDITION_MODE: return XJT_ADDITION_MODE;
case GIMP_SUBTRACT_MODE: return XJT_SUBTRACT_MODE;
case GIMP_DARKEN_ONLY_MODE: return XJT_DARKEN_ONLY_MODE;
case GIMP_LIGHTEN_ONLY_MODE: return XJT_LIGHTEN_ONLY_MODE;
case GIMP_HUE_MODE: return XJT_HUE_MODE;
case GIMP_SATURATION_MODE: return XJT_SATURATION_MODE;
case GIMP_COLOR_MODE: return XJT_COLOR_MODE;
case GIMP_VALUE_MODE: return XJT_VALUE_MODE;
case GIMP_DIVIDE_MODE: return XJT_DIVIDE_MODE;
case GIMP_DODGE_MODE: return XJT_DODGE_MODE;
case GIMP_BURN_MODE: return XJT_BURN_MODE;
case GIMP_HARDLIGHT_MODE: return XJT_HARDLIGHT_MODE;
case GIMP_SOFTLIGHT_MODE: return XJT_SOFTLIGHT_MODE;
case GIMP_GRAIN_EXTRACT_MODE: return XJT_GRAIN_EXTRACT_MODE;
case GIMP_GRAIN_MERGE_MODE: return XJT_GRAIN_MERGE_MODE;
case GIMP_COLOR_ERASE_MODE: return XJT_COLOR_ERASE_MODE;
}
printf (_("Warning: unsupported layermode %d saved to XJT"), (int)intype);
if((gint32)intype > (gint32)XJT_DIVIDE_MODE)
if ((gint32)intype > (gint32)XJT_DIVIDE_MODE)
{
return((XJTLayerModeEffects)intype);
return (XJTLayerModeEffects)intype;
}
return(XJT_NORMAL_MODE);
return XJT_NORMAL_MODE;
}
gint32
@ -777,15 +774,15 @@ p_to_GimpPathType(XJTPathType intype)
{
switch(intype)
{
case XJT_PATHTYPE_UNDEF: return(0);
case XJT_PATHTYPE_BEZIER: return(1);
case XJT_PATHTYPE_UNDEF: return 0;
case XJT_PATHTYPE_BEZIER: return 1;
}
printf (_("XJT file contains unknown pathtype %d"), (int)intype);
if((gint32)intype > (gint32)XJT_PATHTYPE_BEZIER)
if ((gint32)intype > (gint32)XJT_PATHTYPE_BEZIER)
{
return((gint32)intype);
return (gint32)intype;
}
return(0);
return 0;
}
XJTPathType
@ -793,8 +790,8 @@ p_to_XJTPathType(gint32 intype)
{
switch(intype)
{
case 0: return(XJT_PATHTYPE_UNDEF);
case 1: return(XJT_PATHTYPE_BEZIER);
case 0: return XJT_PATHTYPE_UNDEF;
case 1: return XJT_PATHTYPE_BEZIER;
}
printf (_("Warning: unsupported pathtype %d saved to XJT"), (int)intype);
if((gint32)intype > (gint32)XJT_PATHTYPE_BEZIER)
@ -804,7 +801,6 @@ p_to_XJTPathType(gint32 intype)
return(XJT_PATHTYPE_UNDEF);
}
GimpUnit
p_to_GimpUnit(XJTUnitType intype)
{
@ -960,9 +956,9 @@ p_get_property_index(t_proptype proptype)
for (l_idx = 0; l_idx < PROP_TABLE_ENTRIES; l_idx++)
{
if(g_prop_table[l_idx].prop_id == proptype)
if (g_prop_table[l_idx].prop_id == proptype)
{
return(l_idx);
return l_idx;
}
}
return 0; /* index of PROP_END -- not supported */
@ -1227,7 +1223,7 @@ p_write_prop(FILE *fp, t_proptype proptype, t_param_prop *param, gint wr_all_prp
gchar *l_buff;
l_buff = p_write_prop_string(proptype, param, wr_all_prp);
if(l_buff[0] != '\0')
if (l_buff[0] != '\0')
{
fprintf(fp, "%s", l_buff);
}
@ -1279,12 +1275,11 @@ p_write_parasite(const gchar *dirname,
l_parasite_buff = g_strdup_printf("p%d%s%s\n"
, (int)global_parasite_id
, l_buff
, l_buff2
);
, l_buff2);
g_free(l_buff);
g_free(l_buff2);
if(global_parasite_prop_lines == NULL)
if (global_parasite_prop_lines == NULL)
{
global_parasite_prop_lines = g_strdup(l_parasite_buff);
}
@ -1328,19 +1323,18 @@ p_write_image_paths(FILE *fp, gint32 image_id, gint wr_all_prp)
gint32 l_num_points = 0;
t_param_prop l_param;
l_path_names = p_gimp_path_list(image_id, &l_num_paths);
l_path_names = gimp_path_list(image_id, &l_num_paths);
if(l_path_names == NULL) return;
l_current_pathname = p_gimp_path_get_current(image_id);
l_current_pathname = gimp_path_get_current(image_id);
for(l_idx = 0; l_idx < l_num_paths; l_idx++)
{
if(xjt_debug) printf("p_write_image_paths NAME:%s:\n", l_path_names[l_idx]);
l_path_points = p_gimp_path_get_points(image_id, l_path_names[l_idx],
&l_path_type, &l_path_closed, &l_num_points);
if(l_path_points)
l_path_type = gimp_path_get_points(image_id, l_path_names[l_idx],
&l_path_closed, &l_num_points, &l_path_points);
if (l_path_points)
{
/* write PATH line identifier */
fprintf(fp, "PATH");
@ -1348,10 +1342,10 @@ p_write_image_paths(FILE *fp, gint32 image_id, gint wr_all_prp)
l_param.int_val1 = p_to_XJTPathType(l_path_type);
p_write_prop (fp, PROP_PATH_TYPE, &l_param, wr_all_prp);
l_param.int_val1 = p_gimp_path_get_tattoo(image_id, l_path_names[l_idx]);
l_param.int_val1 = gimp_path_get_tattoo(image_id, l_path_names[l_idx]);
p_write_prop (fp, PROP_TATTOO, &l_param, wr_all_prp);
l_param.int_val1 = p_gimp_path_get_locked(image_id, l_path_names[l_idx]);
l_param.int_val1 = gimp_path_get_locked(image_id, l_path_names[l_idx]);
p_write_prop (fp, PROP_PATH_LOCKED, &l_param, wr_all_prp);
l_param.string_val = l_path_names[l_idx];
@ -1392,8 +1386,8 @@ p_write_image_parasites(const gchar *dirname,
gchar **l_parasite_names = NULL;
gint32 l_num_parasites = 0;
l_parasite_names = p_gimp_image_parasite_list (image_id, &l_num_parasites);
if(l_parasite_names == NULL) return;
if (!gimp_image_parasite_list (image_id, &l_num_parasites, &l_parasite_names))
return;
for(l_idx = 0; l_idx < l_num_parasites; l_idx++)
{
@ -1418,8 +1412,8 @@ p_write_drawable_parasites (const gchar *dirname,
gchar **l_parasite_names = NULL;
gint32 l_num_parasites = 0;
l_parasite_names = p_gimp_drawable_parasite_list (drawable_id, &l_num_parasites);
if(l_parasite_names == NULL) return;
if (!gimp_drawable_parasite_list (drawable_id, &l_num_parasites, &l_parasite_names))
return;
for(l_idx = 0; l_idx < l_num_parasites; l_idx++)
{
@ -1459,7 +1453,7 @@ p_write_layer_prp(const gchar *dirname,
p_write_prop (fp, PROP_FLOATING_SELECTION, &l_param, wr_all_prp);
/* check if floating selection is attached to this layer */
l_param.int_val1 = (layer_id == p_gimp_image_floating_sel_attached_to(image_id));
l_param.int_val1 = (layer_id == gimp_image_floating_sel_attached_to(image_id));
p_write_prop (fp, PROP_FLOATING_ATTACHED, &l_param, wr_all_prp);
l_param.flt_val1 = gimp_layer_get_opacity(layer_id);
@ -1471,7 +1465,7 @@ p_write_layer_prp(const gchar *dirname,
l_param.int_val1 = p_invert(gimp_layer_get_visible(layer_id));
p_write_prop (fp, PROP_VISIBLE, &l_param, wr_all_prp);
l_param.int_val1 = p_layer_get_linked (layer_id);
l_param.int_val1 = gimp_layer_get_linked (layer_id);
p_write_prop (fp, PROP_LINKED, &l_param, wr_all_prp);
l_param.int_val1 = gimp_layer_get_preserve_transparency(layer_id);
@ -1491,7 +1485,7 @@ p_write_layer_prp(const gchar *dirname,
l_param.int_val2 = l_ofsy;
p_write_prop (fp, PROP_OFFSETS, &l_param, wr_all_prp);
l_param.int_val1 = p_gimp_layer_get_tattoo(layer_id);
l_param.int_val1 = gimp_layer_get_tattoo(layer_id);
p_write_prop (fp, PROP_TATTOO, &l_param, wr_all_prp);
l_param.string_val = gimp_layer_get_name(layer_id);
@ -1501,7 +1495,6 @@ p_write_layer_prp(const gchar *dirname,
fprintf(fp, "\n");
} /* end p_write_layer_prp */
@ -1533,7 +1526,7 @@ p_write_channel_prp(const gchar *dirname,
p_write_prop (fp, PROP_SELECTION, &l_param, wr_all_prp);
/* check if floating selection is attached to this channel */
l_param.int_val1 = (channel_id == p_gimp_image_floating_sel_attached_to(image_id));
l_param.int_val1 = (channel_id == gimp_image_floating_sel_attached_to(image_id));
p_write_prop (fp, PROP_FLOATING_ATTACHED, &l_param, wr_all_prp);
l_param.flt_val1 = gimp_channel_get_opacity(channel_id);
@ -1557,7 +1550,7 @@ p_write_channel_prp(const gchar *dirname,
l_param.int_val2 = l_ofsy;
p_write_prop (fp, PROP_OFFSETS, &l_param, wr_all_prp);
l_param.int_val1 = p_gimp_channel_get_tattoo(channel_id);
l_param.int_val1 = gimp_channel_get_tattoo (channel_id);
p_write_prop (fp, PROP_TATTOO, &l_param, wr_all_prp);
l_param.string_val = gimp_channel_get_name(channel_id);
@ -1567,10 +1560,8 @@ p_write_channel_prp(const gchar *dirname,
fprintf(fp, "\n");
} /* end p_write_channel_prp */
/* ============================================================================
* p_write_image_prp
* write out the properties of the image
@ -1585,7 +1576,7 @@ p_write_image_prp (const gchar *dirname,
{
GimpImageBaseType l_image_type;
guint l_width, l_height;
float l_xresolution, l_yresolution;
gdouble l_xresolution, l_yresolution;
t_param_prop l_param;
gint32 l_guide_id;
@ -1608,7 +1599,7 @@ p_write_image_prp (const gchar *dirname,
l_param.int_val2 = l_height;
p_write_prop (fp, PROP_DIMENSION, &l_param, wr_all_prp);
p_gimp_image_get_resolution(image_id, &l_xresolution, &l_yresolution);
gimp_image_get_resolution(image_id, &l_xresolution, &l_yresolution);
l_param.flt_val1 = l_xresolution;
l_param.flt_val2 = l_yresolution;
p_write_prop (fp, PROP_RESOLUTION, &l_param, wr_all_prp);
@ -1618,29 +1609,29 @@ p_write_image_prp (const gchar *dirname,
p_write_prop (fp, PROP_UNIT, &l_param, wr_all_prp);
/* write tattoo_state */
l_param.int_val1 = p_gimp_image_get_tattoo_state(image_id);
if(l_param.int_val1 > 0)
l_param.int_val1 = gimp_image_get_tattoo_state(image_id);
if (l_param.int_val1 > 0)
{
p_write_prop (fp, PROP_TATTOO_STATE, &l_param, wr_all_prp);
}
/* write guides */
l_guide_id = p_gimp_image_findnext_guide(image_id, 0); /* get 1.st guide */
while(l_guide_id > 0)
l_guide_id = gimp_image_find_next_guide(image_id, 0); /* get 1.st guide */
while (l_guide_id > 0)
{
/* get position and orientation for the current guide ID */
l_param.int_val1 = p_gimp_image_get_guide_position(image_id, l_guide_id);
l_param.int_val2 = p_to_XJTOrientation(p_gimp_image_get_guide_orientation(image_id, l_guide_id));
l_param.int_val1 = gimp_image_get_guide_position(image_id, l_guide_id);
l_param.int_val2 = p_to_XJTOrientation(gimp_image_get_guide_orientation(image_id, l_guide_id));
p_write_prop (fp, PROP_GUIDES, &l_param, wr_all_prp);
/* findnext returns 0 if no (more) guides there
* (or -1 if no PDB interface is available)
*/
l_guide_id = p_gimp_image_findnext_guide(image_id, l_guide_id);
l_guide_id = gimp_image_find_next_guide(image_id, l_guide_id);
}
if(l_image_type == GIMP_GRAY)
if (l_image_type == GIMP_GRAY)
{
l_param.int_val1 = (gint32)XJT_GRAY;
}
@ -1687,6 +1678,7 @@ save_xjt_image (const gchar *filename,
gint32 l_selection_channel_id;
int l_sel;
gint32 l_x1, l_x2, l_y1, l_y2;
gboolean non_empty;
gint l_wr_all_prp;
@ -1750,12 +1742,12 @@ save_xjt_image (const gchar *filename,
l_floating_layer_id = gimp_image_floating_selection(image_id);
if(l_floating_layer_id >= 0)
if (l_floating_layer_id >= 0)
{
if(xjt_debug) printf("XJT-DEBUG: call floating_sel_relax fsel_id=%d\n",
(int)l_floating_layer_id);
p_gimp_floating_sel_relax (l_floating_layer_id, FALSE);
gimp_floating_sel_relax (l_floating_layer_id, FALSE);
}
l_layers_list = gimp_image_get_layers(image_id, &l_nlayers);
@ -1829,7 +1821,7 @@ save_xjt_image (const gchar *filename,
/* check and see if we have to save out the selection */
l_sel = 0;
l_selection_channel_id = gimp_image_get_selection(image_id);
if((p_get_gimp_selection_bounds(image_id, &l_x1, &l_y1, &l_x2, &l_y2))
if ((gimp_selection_bounds(image_id, &non_empty, &l_x1, &l_y1, &l_x2, &l_y2))
&& (l_selection_channel_id >= 0))
{
l_sel = 1;
@ -1881,7 +1873,6 @@ save_xjt_image (const gchar *filename,
l_rc = p_system(l_cmd);
g_free(l_cmd);
l_len = strlen(filename);
if((l_len > 3) && (l_rc == 0))
{
@ -1915,21 +1906,21 @@ save_xjt_image (const gchar *filename,
}
cleanup:
if(l_fp_prp != NULL)
if (l_fp_prp)
{
fclose( l_fp_prp );
fclose (l_fp_prp);
}
if(l_floating_layer_id >= 0)
if (l_floating_layer_id >= 0)
{
if(xjt_debug) printf("XJT-DEBUG: here we should call floating_sel_rigor sel_id=%d\n",
if (xjt_debug)
printf("XJT-DEBUG: here we should call floating_sel_rigor sel_id=%d\n",
(int)l_floating_layer_id);
p_gimp_floating_sel_rigor (l_floating_layer_id, FALSE);
gimp_floating_sel_rigor (l_floating_layer_id, FALSE);
}
if(l_layers_list) g_free (l_layers_list);
if(l_channels_list) g_free (l_channels_list);
g_free (l_layers_list);
g_free (l_channels_list);
/* remove the temorary directory */
l_cmd = g_strdup_printf("rm -rf \"%s\"", l_dirname);
@ -1937,15 +1928,13 @@ cleanup:
if(!xjt_debug) p_system(l_cmd);
g_free(l_cmd);
if(l_dirname) g_free(l_dirname);
if(l_prop_file) g_free(l_prop_file);
if(l_jpg_file) g_free(l_jpg_file);
return(l_rc);
g_free (l_dirname);
g_free (l_prop_file);
g_free (l_jpg_file);
return l_rc;
}
/* ---------------------- LOAD WORKER procedures -------------------------- */
@ -1978,8 +1967,7 @@ t_layer_props * p_new_layer_prop()
l_new_prop->layer_pos = -1;
l_new_prop->has_alpha = FALSE;
l_new_prop->next = NULL;
return(l_new_prop);
return l_new_prop;
} /* end p_new_layer_prop */
@ -2009,7 +1997,7 @@ t_channel_props * p_new_channel_prop()
l_new_prop->channel_pos = -1;
l_new_prop->next = NULL;
return(l_new_prop);
return l_new_prop;
} /* end p_new_channel_prop */
@ -2026,7 +2014,7 @@ t_guide_props * p_new_guide_prop()
l_new_prop->position = 0;
l_new_prop->orientation = 0;
l_new_prop->next = NULL;
return(l_new_prop);
return l_new_prop;
} /* end p_new_guide_prop */
/* ============================================================================
@ -2045,7 +2033,7 @@ t_parasite_props * p_new_parasite_prop()
l_new_prop->obj_pos = -1;
l_new_prop->flags = GIMP_PARASITE_PERSISTENT;
l_new_prop->next = NULL;
return(l_new_prop);
return l_new_prop;
} /* end p_new_parasite_prop */
/* ============================================================================
@ -2067,7 +2055,7 @@ t_path_props * p_new_path_prop()
l_new_prop->num_points = 0;
l_new_prop->path_points = NULL;
l_new_prop->next = NULL;
return(l_new_prop);
return l_new_prop;
} /* end p_new_path_prop */
/* ============================================================================
@ -2096,7 +2084,7 @@ t_image_props * p_new_image_prop()
l_new_prop->guide_props = NULL;
l_new_prop->parasite_props = NULL;
l_new_prop->path_props = NULL;
return(l_new_prop);
return l_new_prop;
} /* end p_new_image_prop */
@ -3044,7 +3032,6 @@ gint p_scann_parasite_prop(const gchar *scan_ptr,
gint p_scann_path_prop (gchar *scan_ptr,
t_image_props *image_prop)
{
t_path_props *l_new_prop;
gchar *l_ptr;
t_param_prop l_param;
@ -3056,7 +3043,7 @@ gint p_scann_path_prop (gchar *scan_ptr,
l_new_prop->next = image_prop->path_props;
image_prop->path_props = l_new_prop;
if(strncmp(scan_ptr, "PATH", strlen("PATH")) != 0)
if (strncmp(scan_ptr, "PATH", strlen("PATH")) != 0)
{
fprintf(stderr, "XJT: PRP scanned bad line:\n%s\n", scan_ptr);
return -1;
@ -3117,18 +3104,21 @@ p_add_paths(gint32 image_id, t_path_props *path_props)
{
if(l_prop->num_points > 0)
{
if(xjt_debug) printf("XJT: p_add_path name:%s num_points:%d\n", l_prop->name, (int)l_prop->num_points);
if(xjt_debug) printf("XJT: :path_type %d point[0]:%f\n", (int)l_prop->path_type, (float)l_prop->path_points[0]);
if(xjt_debug)
printf("XJT: p_add_path name:%s num_points:%d\n", l_prop->name,
(int)l_prop->num_points);
if(xjt_debug) printf("XJT: :path_type %d point[0]:%f\n",
(int)l_prop->path_type, (float)l_prop->path_points[0]);
if(l_prop->current_flag)
{
l_current_pathname = l_prop->name;
}
p_gimp_path_set_points(image_id, l_prop->name,
gimp_path_set_points(image_id, l_prop->name,
l_prop->path_type, l_prop->num_points, l_prop->path_points);
p_gimp_path_set_locked(image_id, l_prop->name, l_prop->path_locked);
gimp_path_set_locked(image_id, l_prop->name, l_prop->path_locked);
if(l_prop->tattoo >= 0)
{
p_gimp_path_set_tattoo(image_id, l_prop->name, l_prop->tattoo);
gimp_path_set_tattoo(image_id, l_prop->name, l_prop->tattoo);
}
}
l_prop = (t_path_props *)l_prop->next;
@ -3137,7 +3127,7 @@ p_add_paths(gint32 image_id, t_path_props *path_props)
if(l_current_pathname)
{
if(xjt_debug) printf("XJT: p_add_path current:%s\n", l_current_pathname);
p_gimp_path_set_current(image_id, l_current_pathname);
gimp_path_set_current(image_id, l_current_pathname);
}
} /* end p_add_paths */
@ -3185,19 +3175,19 @@ p_load_linefile(const gchar *filename, gint32 *len)
gint32
p_next_lineindex(const gchar *file_buff, gint32 max_len, gint32 pos)
{
if (pos < 0) { return (-1); }
if (pos < 0)
return (-1);
while(pos < max_len)
while (pos < max_len)
{
if(file_buff[pos] == '\0')
if (file_buff[pos] == '\0')
{
pos++;
break;
}
pos++;
}
if(pos >= max_len) { return (-1); }
return(pos);
return (pos >= max_len) ? -1 : pos;
}
/* ============================================================================
@ -3299,15 +3289,9 @@ t_image_props * p_load_prop_file(const gchar *prop_filename)
cleanup:
if(l_file_buff) g_free(l_file_buff);
if(l_rc == 0)
{
return(l_image_prop);
}
return NULL; /* error */
g_free(l_file_buff);
return (l_rc) ? NULL : l_image_prop;
} /* end p_load_prop_file */
@ -3438,7 +3422,7 @@ load_xjt_image (const gchar *filename)
}
gimp_image_set_filename (l_image_id, filename);
p_gimp_image_set_resolution (l_image_id,
gimp_image_set_resolution (l_image_id,
l_image_prp_ptr->xresolution,
l_image_prp_ptr->yresolution);
gimp_image_set_unit(l_image_id, l_image_prp_ptr->unit);
@ -3503,14 +3487,14 @@ load_xjt_image (const gchar *filename)
/* adjust offsets and other layerproperties */
gimp_layer_set_offsets(l_layer_id, l_layer_prp_ptr->offx, l_layer_prp_ptr->offy);
gimp_layer_set_visible (l_layer_id, l_layer_prp_ptr->visible);
p_layer_set_linked (l_layer_id, l_layer_prp_ptr->linked);
gimp_layer_set_linked (l_layer_id, l_layer_prp_ptr->linked);
gimp_layer_set_preserve_transparency (l_layer_id, l_layer_prp_ptr->preserve_transparency);
if(l_layer_prp_ptr->tattoo >= 0)
if (l_layer_prp_ptr->tattoo >= 0)
{
p_gimp_layer_set_tattoo(l_layer_id, l_layer_prp_ptr->tattoo);
gimp_layer_set_tattoo(l_layer_id, l_layer_prp_ptr->tattoo);
}
if(l_layer_prp_ptr->active_layer)
if (l_layer_prp_ptr->active_layer)
{
l_active_layer_id = l_layer_id;
}
@ -3558,9 +3542,9 @@ load_xjt_image (const gchar *filename)
l_fsel_attached_to_id = l_channel_id; /* the floating selection is attached to this layer_mask */
}
if(l_channel_prp_ptr->tattoo >= 0)
if (l_channel_prp_ptr->tattoo >= 0)
{
p_gimp_channel_set_tattoo(l_channel_id, l_channel_prp_ptr->tattoo);
gimp_channel_set_tattoo(l_channel_id, l_channel_prp_ptr->tattoo);
}
/* gimp_layer_set_offsets(l_channel_id, l_layer_prp_ptr->offx, l_layer_prp_ptr->offy); */
@ -3614,16 +3598,16 @@ load_xjt_image (const gchar *filename)
if(l_channel_prp_ptr->tattoo >= 0)
{
p_gimp_channel_set_tattoo(l_channel_id, l_channel_prp_ptr->tattoo);
gimp_channel_set_tattoo(l_channel_id, l_channel_prp_ptr->tattoo);
}
if(l_channel_prp_ptr->selection)
{
if(xjt_debug) printf("XJT-DEBUG: SELECTION loaded channel id = %d\n", (int)l_channel_id);
p_gimp_selection_load (l_image_id, l_channel_id);
gimp_selection_load (l_channel_id);
/* delete the channel after load into selection */
gimp_channel_delete(l_channel_id);
gimp_channel_delete (l_channel_id);
}
else
{
@ -3647,77 +3631,75 @@ load_xjt_image (const gchar *filename)
}
/* attach the floating selection... */
if((l_fsel_id >= 0) && (l_fsel_attached_to_id >= 0))
if ((l_fsel_id >= 0) && (l_fsel_attached_to_id >= 0))
{
if(xjt_debug) printf("XJT-DEBUG: attaching floating_selection id=%d to id %d\n",
(int)l_fsel_id, (int)l_fsel_attached_to_id);
if(p_gimp_floating_sel_attach (l_fsel_id, l_fsel_attached_to_id) < 0)
if (gimp_floating_sel_attach (l_fsel_id, l_fsel_attached_to_id) < 0)
{
/* in case of error add floating_selection like an ordinary layer
* (if patches are not installed you'll get the error for sure)
*/
printf("XJT: floating_selection is added as top-layer (attach failed)\n");
gimp_image_add_layer (l_image_id, l_fsel_id, 0);
}
}
/* set active layer/channel */
if(l_active_channel_id >= 0)
if (l_active_channel_id >= 0)
{
if(xjt_debug) printf("SET active channel\n");
gimp_image_set_active_channel(l_image_id, l_active_channel_id);
gimp_image_set_active_channel (l_image_id, l_active_channel_id);
}
if(l_active_layer_id >= 0)
if (l_active_layer_id >= 0)
{
if(xjt_debug) printf("SET active layer\n");
gimp_image_set_active_layer(l_image_id, l_active_layer_id);
gimp_image_set_active_layer (l_image_id, l_active_layer_id);
}
/* set guides */
for(l_guide_prp_ptr = l_image_prp_ptr->guide_props;
for (l_guide_prp_ptr = l_image_prp_ptr->guide_props;
l_guide_prp_ptr != NULL;
l_guide_prp_ptr = (t_guide_props *)l_guide_prp_ptr->next)
{
p_gimp_image_add_guide(l_image_id,
l_guide_prp_ptr->position,
l_guide_prp_ptr->orientation);
if (l_guide_prp_ptr->orientation == GIMP_ORIENTATION_HORIZONTAL)
gimp_image_add_hguide(l_image_id, l_guide_prp_ptr->position);
else
gimp_image_add_vguide(l_image_id, l_guide_prp_ptr->position);
}
/* create paths */
if(l_image_prp_ptr->path_props)
if (l_image_prp_ptr->path_props)
{
p_add_paths(l_image_id, l_image_prp_ptr->path_props);
}
/* set tattoo_state */
if(l_image_prp_ptr->tattoo_state > 0)
if (l_image_prp_ptr->tattoo_state > 0)
{
p_gimp_image_set_tattoo_state(l_image_id, l_image_prp_ptr->tattoo_state);
gimp_image_set_tattoo_state(l_image_id, l_image_prp_ptr->tattoo_state);
}
cleanup:
cleanup:
if(l_layers_list) g_free (l_layers_list);
if(l_channels_list) g_free (l_channels_list);
g_free (l_layers_list);
g_free (l_channels_list);
/* remove the temorary directory */
l_cmd = g_strdup_printf("rm -rf \"%s\"", l_dirname);
p_system(l_cmd);
g_free(l_cmd);
l_cmd = g_strdup_printf ("rm -rf \"%s\"", l_dirname);
p_system (l_cmd);
g_free (l_cmd);
if(l_dirname) g_free(l_dirname);
if(l_prop_file) g_free(l_prop_file);
if(l_jpg_file) g_free(l_jpg_file);
g_free (l_dirname);
g_free (l_prop_file);
g_free (l_jpg_file);
if(l_rc == 0)
if (l_rc == 0)
{
return(l_image_id); /* all done OK */
return l_image_id; /* all done OK */
}
/* destroy the tmp image */
gimp_image_delete(l_image_id);
gimp_image_delete (l_image_id);
return -1;
} /* end load_xjt_image */

File diff suppressed because it is too large Load diff

View file

@ -1,79 +0,0 @@
/* xpdb_calls.h
*
*/
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* revision history:
* version 1.1.18a; 2000/03/07 hof: tattoo_state
* version 1.1.16a; 2000/02/04 hof: path lockedstaus, tattoo set procedures
* version 1.1.15b; 2000/01/28 hof: parasites part2
* version 1.1.15; 2000/01/20 hof: parasites
* version 1.02.00; 1999/02/01 hof: PDB-calls to load/save resolution tattoos and parasites
* (needs GIMP 1.1.1)-- UNDER CONSTRUCTION ---
* version 1.01.00; 1998/11/22 hof: PDB-calls to load/save guides under GIMP 1.1
* version 1.00.00; 1998/10/26 hof: 1.st (pre) release
*/
#ifndef _XPDB_CALLS_H
#define _XPDB_CALLS_H
#include "libgimp/gimp.h"
gint p_procedure_available(gchar *proc_name);
gint p_get_gimp_selection_bounds (gint32 image_id, gint32 *x1, gint32 *y1, gint32 *x2, gint32 *y2);
gint p_gimp_selection_load (gint32 image_id, gint32 channel_id);
int p_layer_set_linked (gint32 layer_id, gint32 new_state);
gint p_layer_get_linked(gint32 layer_id);
gint32 p_gimp_image_floating_sel_attached_to(gint32 image_id);
gint p_gimp_floating_sel_attach(gint32 layer_id, gint32 drawable_id);
gint p_gimp_floating_sel_rigor(gint32 layer_id, gint32 undo);
gint p_gimp_floating_sel_relax(gint32 layer_id, gint32 undo);
gint32 p_gimp_image_add_guide(gint32 image_id, gint32 position, gint32 orientation);
gint32 p_gimp_image_findnext_guide(gint32 image_id, gint32 guide_id);
gint32 p_gimp_image_get_guide_position(gint32 image_id, gint32 guide_id);
gint32 p_gimp_image_get_guide_orientation(gint32 image_id, gint32 guide_id);
gint p_gimp_image_get_resolution(gint32 image_id, float *xresolution, float *yresolution);
gint p_gimp_image_set_resolution(gint32 image_id, float xresolution, float yresolution);
gint32 p_gimp_layer_get_tattoo(gint32 layer_id);
gint32 p_gimp_channel_get_tattoo(gint32 channel_id);
gchar** p_gimp_drawable_parasite_list (gint32 drawable_id, gint32 *num_parasites);
gchar** p_gimp_image_parasite_list (gint32 image_id, gint32 *num_parasites);
gint p_gimp_path_set_points(gint32 image_id, gchar *name,
gint32 path_type, gint32 num_points, gdouble *path_points);
gdouble* p_gimp_path_get_points(gint32 image_id, gchar *name,
gint32 *path_type, gint32 *path_closed, gint32 *num_points);
gchar** p_gimp_path_list(gint32 image_id, gint32 *num_paths);
gchar* p_gimp_path_get_current(gint32 image_id);
gint p_gimp_path_set_current(gint32 image_id, gchar *name);
gint32 p_gimp_path_get_locked(gint32 image_id, gchar *name);
gint p_gimp_path_set_locked(gint32 image_id, gchar *name, gint32 lockstatus);
gint32 p_gimp_path_get_tattoo(gint32 image_id, gchar *name);
gint p_gimp_path_set_tattoo(gint32 image_id, gchar *name, gint32 tattoovalue);
gint p_gimp_layer_set_tattoo(gint32 layer_id, gint32 tattoovalue);
gint p_gimp_channel_set_tattoo(gint32 channel_id, gint32 tattoovalue);
gint p_gimp_image_set_tattoo_state(gint32 image_id, gint32 tattoo_state);
gint32 p_gimp_image_get_tattoo_state(gint32 image_id);
#endif

View file

@ -75,7 +75,7 @@ INSTOBJEXT = @INSTOBJEXT@
.po.pox:
$(MAKE) $(GETTEXT_PACKAGE).pot
$(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*pox
$(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
.po.mo:
$(MSGFMT) -o $@ $<
@ -168,9 +168,7 @@ uninstall:
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
done
if test "$(PACKAGE)" = "glib"; then \
rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
fi
rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
check: all
@ -179,7 +177,6 @@ dvi info tags TAGS ID:
mostlyclean:
rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
rm -fr *.o
rm -f .intltool-merge-cache
clean: mostlyclean
@ -201,31 +198,35 @@ dist distdir: update-po $(DISTFILES)
update-po: Makefile
$(MAKE) $(GETTEXT_PACKAGE).pot
tmpdir=`pwd`; \
cd $(srcdir); \
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
cp $$lang.po $$lang.old.po; \
echo "$$lang:"; \
if $$tmpdir/$(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist -o $$tmpdir/$$lang.new.po $$lang; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
:; \
else \
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
rm -f $$tmpdir/$$lang.new.po; \
exit 1; \
fi; \
fi; \
if $(MSGMERGE) $$lang; then \
rm -f $$lang.old.po; \
else \
echo "msgmerge for $$cat failed!"; \
rm -f $$tmpdir/$$lang.new.po; \
rm -f $$lang.po; \
mv $$lang.old.po $$lang.po; \
fi; \
done
.po: Makefile
$(MAKE) $(PACKAGE).pot;
PATH=`pwd`/../src:$$PATH; \
echo; printf "$*: "; \
if $(MSGMERGE) $*; then \
rm -f $*.old.po; \
else \
echo "msgmerge for * failed!"; \
mv $*.old.po $*.po; \
fi; \
msgfmt --statistics $*.po; echo;
# POTFILES is created from POTFILES.in by stripping comments, empty lines
# and Intltool tags (enclosed in square brackets), and appending a full
# relative path to them