Patches from Wolfgang Hofer.

--Sven
This commit is contained in:
Sven Neumann 1999-09-02 20:33:49 +00:00
parent 52b5222052
commit 1341c2939a
8 changed files with 138 additions and 38 deletions

View File

@ -1,3 +1,18 @@
Thu Sep 2 22:31:11 MEST 1999 Sven Neumann <sven@gimp.org>
* plug-ins/gap/gap_lib.[ch]
* plug-ins/gap/gap_main.c
* plug-ins/gap/gap_mov_dialog.c
* plug-ins/gap/gap_mpege.c
* plug-ins/gap/gap_range_ops.c
* plug-ins/gap/gap_split.c: applied patches from the GAP author
Wolfgang Hofer:
- Simplified naming convention for AnimFrames: under_score isn't
mandatory anymore.
- gimp_file_save is called INTERACTIVE on first call and
RUN_WITH_LAST_VALUES later.
Thu Sep 2 11:51:02 PDT 1999 Manish Singh <yosh@gimp.org> Thu Sep 2 11:51:02 PDT 1999 Manish Singh <yosh@gimp.org>
* app/gtkhwrapbox.[ch] * app/gtkhwrapbox.[ch]

View File

@ -28,6 +28,16 @@
*/ */
/* revision history: /* revision history:
* 1.1.8a; 1999/08/31 hof: for AnimFrame Filtypes != XCF:
* p_decide_save_as does save INTERACTIVE at 1.st time
* and uses RUN_WITH_LAST_VALS for subsequent calls
* (this enables to set Fileformat specific save-Parameters
* at least at the 1.st call, using the save dialog
* of the selected (by gimp_file_save) file_save procedure.
* in NONINTERACTIVE mode we have no access to
* the Fileformat specific save-Parameters
* 1999/07/22 hof: accept anim framenames without underscore '_'
* (suggested by Samuel Meder)
* 0.99.00; 1999/03/15 hof: prepared for win/dos filename conventions * 0.99.00; 1999/03/15 hof: prepared for win/dos filename conventions
* 0.98.00; 1998/11/30 hof: started Port to GIMP 1.1: * 0.98.00; 1998/11/30 hof: started Port to GIMP 1.1:
* exchange of Images (by next frame) is now handled in the * exchange of Images (by next frame) is now handled in the
@ -76,7 +86,61 @@ static int p_save_old_frame(t_anim_info *ainfo_ptr);
static int p_rename_frame(t_anim_info *ainfo_ptr, long from_nr, long to_nr); static int p_rename_frame(t_anim_info *ainfo_ptr, long from_nr, long to_nr);
static int p_delete_frame(t_anim_info *ainfo_ptr, long nr); static int p_delete_frame(t_anim_info *ainfo_ptr, long nr);
static int p_del(t_anim_info *ainfo_ptr, long cnt); static int p_del(t_anim_info *ainfo_ptr, long cnt);
static int p_decide_save_as(gint32 image_id); static int p_decide_save_as(gint32 image_id, char *sav_name);
/* ============================================================================
* p_strdup_*_underscore
* duplicate string and if last char is no underscore add one at end.
* duplicate string and delete last char if it is the underscore
* ============================================================================
*/
char *
p_strdup_add_underscore(char *name)
{
int l_len;
char *l_str;
if(name == NULL)
{
return(g_strdup("\0"));
}
l_len = strlen(name);
l_str = g_malloc(l_len+1);
strcpy(l_str, name);
if(l_len > 0)
{
if (name[l_len-1] != '_')
{
l_str[l_len ] = '_';
l_str[l_len +1 ] = '\0';
}
}
return(l_str);
}
char *
p_strdup_del_underscore(char *name)
{
int l_len;
char *l_str;
if(name == NULL)
{
return(g_strdup("\0"));
}
l_len = strlen(name);
l_str = g_strdup(name);
if(l_len > 0)
{
if (l_str[l_len-1] == '_')
{
l_str[l_len -1 ] = '\0';
}
}
return(l_str);
}
/* ============================================================================ /* ============================================================================
* p_msg_win * p_msg_win
@ -255,7 +319,7 @@ int p_rename_frame(t_anim_info *ainfo_ptr, long from_nr, long to_nr)
* p_alloc_basename * p_alloc_basename
* *
* build the basename from an images name * build the basename from an images name
* Extension and trailing "_0000" are cut off. * Extension and trailing digits ("0000.xcf") are cut off.
* return name or NULL (if malloc fails) * return name or NULL (if malloc fails)
* Output: number contains the integer representation of the stripped off * Output: number contains the integer representation of the stripped off
* number String. (or 0 if there was none) * number String. (or 0 if there was none)
@ -286,7 +350,7 @@ char* p_alloc_basename(char *imagename, long *number)
} }
if(gap_debug) fprintf(stderr, "DEBUG p_alloc_basename (ext_off): '%s'\n", l_fname); if(gap_debug) fprintf(stderr, "DEBUG p_alloc_basename (ext_off): '%s'\n", l_fname);
/* cut off trailing digits and underscore (_0000) */ /* cut off trailing digits (0000) */
l_ptr = &l_fname[strlen(l_fname)]; l_ptr = &l_fname[strlen(l_fname)];
if(l_ptr != l_fname) l_ptr--; if(l_ptr != l_fname) l_ptr--;
l_idx = 1; l_idx = 1;
@ -301,10 +365,13 @@ char* p_alloc_basename(char *imagename, long *number)
} }
else else
{ {
if(*l_ptr == '_') /* do not cut off underscore any longer */
{ /*
*l_ptr = '\0'; * if(*l_ptr == '_')
} * {
* *l_ptr = '\0';
* }
*/
break; break;
} }
} }
@ -369,7 +436,7 @@ char* p_alloc_fname(char *basename, long nr, char *extension)
l_fname = (char *)g_malloc(strlen(basename) + strlen(extension) + 8); l_fname = (char *)g_malloc(strlen(basename) + strlen(extension) + 8);
if(l_fname != NULL) if(l_fname != NULL)
{ {
sprintf(l_fname, "%s_%04ld%s", basename, nr, extension); sprintf(l_fname, "%s%04ld%s", basename, nr, extension);
} }
return(l_fname); return(l_fname);
} /* end p_alloc_fname */ } /* end p_alloc_fname */
@ -530,7 +597,7 @@ int p_dir_ainfo(t_anim_info *ainfo_ptr)
{ {
/* check for files, with equal basename (frames) /* check for files, with equal basename (frames)
* (length must be greater than basepart+extension * (length must be greater than basepart+extension
* because of the frame_nr part "_0000") * because of the frame_nr part "0000")
*/ */
if((0 == strcmp(l_ptr, l_dummy)) if((0 == strcmp(l_ptr, l_dummy))
&& ( strlen(l_dp->d_name) > strlen(l_dummy) + strlen(l_exptr) )) && ( strlen(l_dp->d_name) > strlen(l_dummy) + strlen(l_exptr) ))
@ -720,7 +787,7 @@ char * p_gzip (char *orig_name, char *new_name, char *zip)
* 0 ... save the image (may be flattened) * 0 ... save the image (may be flattened)
* ============================================================================ * ============================================================================
*/ */
int p_decide_save_as(gint32 image_id) int p_decide_save_as(gint32 image_id, char *sav_name)
{ {
static char *l_msg = static char *l_msg =
"You are using a fileformat != xcf\nSave Operations may result\nin loss of layerinformation"; "You are using a fileformat != xcf\nSave Operations may result\nin loss of layerinformation";
@ -729,7 +796,8 @@ int p_decide_save_as(gint32 image_id)
static t_but_arg l_argv[3]; static t_but_arg l_argv[3];
int l_argc; int l_argc;
int l_save_as_mode; int l_save_as_mode;
GRunModeType l_run_mode;
/* check if there are SAVE_AS_MODE settings (from privious calls within one gimp session) */ /* check if there are SAVE_AS_MODE settings (from privious calls within one gimp session) */
l_save_as_mode = -1; l_save_as_mode = -1;
@ -755,6 +823,11 @@ int p_decide_save_as(gint32 image_id)
if(gap_debug) fprintf(stderr, "DEBUG: decide SAVE_AS_MODE %d\n", (int)l_save_as_mode); if(gap_debug) fprintf(stderr, "DEBUG: decide SAVE_AS_MODE %d\n", (int)l_save_as_mode);
if(l_save_as_mode < 0) return -1; if(l_save_as_mode < 0) return -1;
l_run_mode = RUN_INTERACTIVE;
}
else
{
l_run_mode = RUN_WITH_LAST_VALS;
} }
gimp_set_data (l_save_as_name, &l_save_as_mode, sizeof(l_save_as_mode)); gimp_set_data (l_save_as_name, &l_save_as_mode, sizeof(l_save_as_mode));
@ -765,7 +838,7 @@ int p_decide_save_as(gint32 image_id)
gimp_image_flatten (image_id); gimp_image_flatten (image_id);
} }
return 0; return(p_save_named_image(image_id, sav_name, l_run_mode));
} /* end p_decide_save_as */ } /* end p_decide_save_as */
@ -806,7 +879,7 @@ gint32 p_save_named_image(gint32 image_id, char *sav_name, GRunModeType run_mode
PARAM_STRING, sav_name, /* raw name ? */ PARAM_STRING, sav_name, /* raw name ? */
PARAM_END); PARAM_END);
if(gap_debug) fprintf(stderr, "DEBUG: after p_save_named_image: '%s' nlayers=%d\n", sav_name, (int)l_nlayers); if(gap_debug) fprintf(stderr, "DEBUG: after p_save_named_image: '%s' nlayers=%d image=%d drw=%d run_mode=%d\n", sav_name, (int)l_nlayers, (int)image_id, (int)l_drawable->id, (int)run_mode);
g_free (l_layers_list); g_free (l_layers_list);
g_free (l_drawable); g_free (l_drawable);
@ -943,11 +1016,7 @@ int p_save_named_frame(gint32 image_id, char *sav_name)
* To Do: Should warn the user at 1.st attempt to do this. * To Do: Should warn the user at 1.st attempt to do this.
*/ */
l_rc = p_decide_save_as(image_id); l_rc = p_decide_save_as(image_id, l_tmpname);
if(l_rc >= 0)
{
l_rc = p_save_named_image(image_id, l_tmpname, RUN_NONINTERACTIVE);
}
} }
if(l_rc < 0) if(l_rc < 0)
@ -1273,7 +1342,7 @@ int p_dup(t_anim_info *ainfo_ptr, long cnt, long range_from, long range_to)
/* save current frame */ /* save current frame */
p_save_named_frame(ainfo_ptr->image_id, l_curr_name); p_save_named_frame(ainfo_ptr->image_id, l_curr_name);
/* use a new name (_0001.xcf Konvention) */ /* use a new name (0001.xcf Konvention) */
gimp_image_set_filename (ainfo_ptr->image_id, l_curr_name); gimp_image_set_filename (ainfo_ptr->image_id, l_curr_name);
g_free(l_curr_name); g_free(l_curr_name);

View File

@ -25,6 +25,7 @@
*/ */
/* revision history: /* revision history:
* 1.1.8a; 1999/08/31 hof: new: p_strdup_del_underscore and p_strdup_add_underscore
* 0.99.00; 1999/03/15 hof: prepared for win/dos filename conventions * 0.99.00; 1999/03/15 hof: prepared for win/dos filename conventions
* 0.96.02; 1998/08/05 hof: extended gap_dup (duplicate range instead of singele frame) * 0.96.02; 1998/08/05 hof: extended gap_dup (duplicate range instead of singele frame)
* added gap_shift (framesequence shift) * added gap_shift (framesequence shift)
@ -94,7 +95,8 @@ gint32 p_load_image (char *lod_name);
gint32 p_save_named_image(gint32 image_id, char *sav_name, GRunModeType run_mode); gint32 p_save_named_image(gint32 image_id, char *sav_name, GRunModeType run_mode);
char* p_alloc_fname(char *basename, long nr, char *extension); char* p_alloc_fname(char *basename, long nr, char *extension);
char* p_gzip (char *orig_name, char *new_name, char *zip); char* p_gzip (char *orig_name, char *new_name, char *zip);
char* p_strdup_add_underscore(char *name);
char* p_strdup_del_underscore(char *name);
/* animation menu fuctions provided by gap_lib.c */ /* animation menu fuctions provided by gap_lib.c */

View File

@ -38,9 +38,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
static char *gap_main_version = "0.99.00; 1999/03/17"; static char *gap_main_version = "1.1.8a; 1999/08/31";
/* revision history: /* revision history:
* gimp 1.1.8a; 1999/08/31 hof: updated main version
* version 0.99.00; 1999/03/17 hof: updated main version * version 0.99.00; 1999/03/17 hof: updated main version
* version 0.98.02; 1999/01/27 hof: updated main version * version 0.98.02; 1999/01/27 hof: updated main version
* version 0.98.01; 1998/12/21 hof: updated main version, e-mail adress * version 0.98.01; 1998/12/21 hof: updated main version, e-mail adress

View File

@ -30,7 +30,8 @@
*/ */
/* revision history: /* revision history:
* gimp 1.1.15.1; 1999/05/08 hof: call fileselect in gtk+1.2 style * gimp 1.1.8a; 1999/08/31 hof: accept anim framenames without underscore '_'
* gimp 1.1.5a; 1999/05/08 hof: call fileselect in gtk+1.2 style
* version 0.99.00; 1999.03.03 hof: bugfix: update of the preview (did'nt work with gimp1.1.2) * version 0.99.00; 1999.03.03 hof: bugfix: update of the preview (did'nt work with gimp1.1.2)
* version 0.98.00; 1998.11.28 hof: Port to GIMP 1.1: replaced buildmenu.h, apply layermask (before rotate) * version 0.98.00; 1998.11.28 hof: Port to GIMP 1.1: replaced buildmenu.h, apply layermask (before rotate)
* mov_imglayer_constrain must check for drawable_id -1 * mov_imglayer_constrain must check for drawable_id -1
@ -301,6 +302,7 @@ long p_move_dialog (t_mov_data *mov_ptr)
{ {
GDrawable *l_drawable_ptr; GDrawable *l_drawable_ptr;
gint l_first, l_last; gint l_first, l_last;
char *l_str;
t_mov_path_preview *path_ptr; t_mov_path_preview *path_ptr;
static char l_pointfile_name[POINT_FILE_MAXLEN]; static char l_pointfile_name[POINT_FILE_MAXLEN];
@ -308,7 +310,9 @@ long p_move_dialog (t_mov_data *mov_ptr)
if(gap_debug) printf("GAP-DEBUG: START p_move_dialog\n"); if(gap_debug) printf("GAP-DEBUG: START p_move_dialog\n");
l_pointfile_name[POINT_FILE_MAXLEN -1 ] = '\0'; l_pointfile_name[POINT_FILE_MAXLEN -1 ] = '\0';
sprintf(l_pointfile_name, "%s.path_points", mov_ptr->dst_ainfo_ptr->basename); l_str = p_strdup_del_underscore(mov_ptr->dst_ainfo_ptr->basename);
sprintf(l_pointfile_name, "%s.path_points", l_str);
g_free(l_str);
pvals = mov_ptr->val_ptr; pvals = mov_ptr->val_ptr;

View File

@ -36,6 +36,7 @@
*/ */
/* revision history /* revision history
* 1.1.8a; 1999/08/31 hof: accept anim framenames without underscore '_'
* 0.99.00; 1999/03/15 hof: prepared for win/dos filename conventions * 0.99.00; 1999/03/15 hof: prepared for win/dos filename conventions
* 0.96.00; 1998/07/08 hof: first release * 0.96.00; 1998/07/08 hof: first release
*/ */
@ -211,6 +212,7 @@ int p_mpege_dialog(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr, t_gap_mpeg_encoder
static t_but_arg b_argv[3]; static t_but_arg b_argv[3];
gint l_rc; gint l_rc;
gint l_idx; gint l_idx;
char *l_str;
static char l_buf[MBUF_SIZE]; static char l_buf[MBUF_SIZE];
static char l_startscript[MBUF_SIZE]; static char l_startscript[MBUF_SIZE];
@ -235,10 +237,12 @@ int p_mpege_dialog(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr, t_gap_mpeg_encoder
b_argv[1].but_val = 0; b_argv[1].but_val = 0;
b_argv[2].but_txt = "Gen + Encode"; b_argv[2].but_txt = "Gen + Encode";
b_argv[2].but_val = 1; b_argv[2].but_val = 1;
sprintf (l_outfile, "%s.mpg", ainfo_ptr->basename); l_str = p_strdup_del_underscore(ainfo_ptr->basename);
sprintf (l_parfile, "%s.par_mpg", ainfo_ptr->basename); sprintf (l_outfile, "%s.mpg", l_str);
sprintf (l_startscript, "%s.sh", ainfo_ptr->basename); sprintf (l_parfile, "%s.par_mpg", l_str);
sprintf (l_startscript, "%s.sh", l_str);
g_free(l_str);
p_init_arr_arg(&argv[0], WGT_LABEL); p_init_arr_arg(&argv[0], WGT_LABEL);
argv[0].label_txt = &l_buf[0]; argv[0].label_txt = &l_buf[0];
@ -539,7 +543,7 @@ int p_mpeg2encode_gen_parfile(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr)
fprintf(l_fp, "MPEG-2 stream %s frames/sec\n", mp_ptr->framerate); fprintf(l_fp, "MPEG-2 stream %s frames/sec\n", mp_ptr->framerate);
} }
fprintf(l_fp, "%s_%%04d /* name of source files */\n", ainfo_ptr->basename); fprintf(l_fp, "%s%%04d /* name of source files */\n", ainfo_ptr->basename);
fprintf(l_fp, "- /* name of reconstructed images (\"-\": don't store) */\n"); fprintf(l_fp, "- /* name of reconstructed images (\"-\": don't store) */\n");
fprintf(l_fp, "- /* name of intra quant matrix file (\"-\": default matrix) */\n"); fprintf(l_fp, "- /* name of intra quant matrix file (\"-\": default matrix) */\n");
@ -630,7 +634,6 @@ int p_mpeg2encode_gen_parfile(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr)
fprintf(l_fp, "read DUMMY\n"); fprintf(l_fp, "read DUMMY\n");
fclose(l_fp); fclose(l_fp);
return 0; return 0;
} }
@ -796,7 +799,7 @@ int p_mpeg_encode_gen_parfile(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr)
fprintf(l_fp, "#\n"); fprintf(l_fp, "#\n");
fprintf(l_fp, "#\n"); fprintf(l_fp, "#\n");
fprintf(l_fp, "%s_*.%s [%04d-%04d]\n", l_basename_ptr fprintf(l_fp, "%s*.%s [%04d-%04d]\n", l_basename_ptr
, mp_ptr->ext , mp_ptr->ext
, mp_ptr->from , mp_ptr->from
, mp_ptr->to); , mp_ptr->to);
@ -884,7 +887,6 @@ int p_mpeg_encode_gen_parfile(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr)
fprintf(l_fp, "read DUMMY\n"); fprintf(l_fp, "read DUMMY\n");
fclose(l_fp); fclose(l_fp);
return 0; return 0;
} /* end p_mpege_gen_parfile */ } /* end p_mpege_gen_parfile */

View File

@ -32,6 +32,8 @@
*/ */
/* revision history /* revision history
* 1.1.8 1999/08/31 hof: frames convert: save subsequent frames
* with rumode RUN_WITH_LAST_VALS
* 0.97.00; 1998/10/19 hof: gap_range_to_multilayer: extended layer selection * 0.97.00; 1998/10/19 hof: gap_range_to_multilayer: extended layer selection
* 0.96.03; 1998/08/31 hof: gap_range_to_multilayer: all params available * 0.96.03; 1998/08/31 hof: gap_range_to_multilayer: all params available
* in non-interactive runmode * in non-interactive runmode
@ -297,7 +299,7 @@ p_convert_dialog(t_anim_info *ainfo_ptr,
p_init_arr_arg(&argv[3], WGT_FILESEL); p_init_arr_arg(&argv[3], WGT_FILESEL);
argv[3].label_txt ="Basename:"; argv[3].label_txt ="Basename:";
argv[3].help_txt ="basename of the resulting frames \n(_0001.ext is added)"; argv[3].help_txt ="basename of the resulting frames \n(0001.ext is added)";
argv[3].text_buf_len = len_base; argv[3].text_buf_len = len_base;
argv[3].text_buf_ret = basename; argv[3].text_buf_ret = basename;
@ -1026,9 +1028,10 @@ p_frames_convert(t_anim_info *ainfo_ptr,
p_msg_win(ainfo_ptr->run_mode, "Convert Frames: SAVE operation FAILED\n- desired save plugin cant handle type\n- or desired save plugin not available\n"); p_msg_win(ainfo_ptr->run_mode, "Convert Frames: SAVE operation FAILED\n- desired save plugin cant handle type\n- or desired save plugin not available\n");
} }
} }
if(l_run_mode == RUN_INTERACTIVE)
l_run_mode = RUN_NONINTERACTIVE; /* for all further calls */ {
l_run_mode = RUN_WITH_LAST_VALS; /* for all further calls */
}
g_free(l_sav_name); g_free(l_sav_name);
} }
} }
@ -1500,7 +1503,7 @@ gint32 gap_range_conv(GRunModeType run_mode, gint32 image_id,
if(l_rc >= 0) if(l_rc >= 0)
{ {
/* cut off extension and trailing frame number "_0001" */ /* cut off extension and trailing frame number */
l_basename_ptr = p_alloc_basename(&l_basename[0], &l_number); l_basename_ptr = p_alloc_basename(&l_basename[0], &l_number);
if(l_basename_ptr == NULL) { l_rc = -1; } if(l_basename_ptr == NULL) { l_rc = -1; }
else else

View File

@ -26,7 +26,8 @@
*/ */
/* revision history /* revision history
* gimp 1.1.15.1; 1999/05/08 hof: bugix (dont mix GDrawableType with GImageType) * 1.1.8a; 1999/08/31 hof: accept anim framenames without underscore '_'
* 1.1.5a; 1999/05/08 hof: bugix (dont mix GDrawableType with GImageType)
* 0.96.00; 1998/07/01 hof: - added scale, resize and crop * 0.96.00; 1998/07/01 hof: - added scale, resize and crop
* (affects full range == all anim frames) * (affects full range == all anim frames)
* - now using gap_arr_dialog.h * - now using gap_arr_dialog.h
@ -79,6 +80,7 @@ p_split_image(t_anim_info *ainfo_ptr,
gint l_src_offset_x, l_src_offset_y; /* layeroffsets as they were in src_image */ gint l_src_offset_x, l_src_offset_y; /* layeroffsets as they were in src_image */
gdouble l_percentage, l_percentage_step; gdouble l_percentage, l_percentage_step;
char *l_sav_name; char *l_sav_name;
char *l_str;
gint32 l_rc; gint32 l_rc;
int l_idx; int l_idx;
long l_layer_idx; long l_layer_idx;
@ -151,9 +153,11 @@ p_split_image(t_anim_info *ainfo_ptr,
/* build the name for output image */ /* build the name for output image */
l_sav_name = p_alloc_fname(ainfo_ptr->basename, l_str = p_strdup_add_underscore(ainfo_ptr->basename);
l_sav_name = p_alloc_fname(l_str,
(l_idx +1), /* start at 1 (not at 0) */ (l_idx +1), /* start at 1 (not at 0) */
new_extension); new_extension);
g_free(l_str);
if(l_sav_name != NULL) if(l_sav_name != NULL)
{ {
/* save with selected save procedure /* save with selected save procedure