applied patch from Wolfgang Hofer <hof@hotbot.com>

--Sven
This commit is contained in:
Sven Neumann 2000-02-28 18:39:00 +00:00
parent bdbb45d87c
commit de605b01ee
16 changed files with 750 additions and 654 deletions

View File

@ -1,3 +1,20 @@
Mon Feb 28 19:37:25 CET 2000 Sven Neumann <sven@gimp.org>
* plug-ins/gap/gap_arr_dialog.[ch]
* plug-ins/gap/gap_decode_mpeg_main.c
* plug-ins/gap/gap_decode_xanim.c
* plug-ins/gap/gap_filter.h
* plug-ins/gap/gap_filter_iterators.c
* plug-ins/gap/gap_filter_pdb.[ch]
* plug-ins/gap/gap_lib.c
* plug-ins/gap/gap_mov_dialog.c
* plug-ins/gap/gap_mpege.c
* plug-ins/gap/gap_range_ops.c
* plug-ins/gap/iter_ALT/mod/plug_in_nova_iter_ALT.inc
* plug-ins/gap/iter_ALT/mod/plug_in_papertile_iter_ALT.inc
* plug-ins/gap/iter_ALT/mod/plug_in_sparkle_iter_ALT.inc:
applied patch from Wolfgang Hofer <hof@hotbot.com>
2000-02-28 02:40-GMT Garry R. Osgood <gosgood@idt.net> 2000-02-28 02:40-GMT Garry R. Osgood <gosgood@idt.net>
* gimp/app/by_color_select.c * gimp/app/by_color_select.c

View File

@ -38,6 +38,8 @@
*/ */
/* revision history: /* revision history:
* gimp 1.1.17b; 2000/01/26 hof: bugfix gimp_help_init
* use gimp_scale_entry_new for WGT_FLT_PAIR, WGT_INT_PAIR
* gimp 1.1.17a; 2000/02/20 hof: use gimp_help_set_help_data for tooltips * gimp 1.1.17a; 2000/02/20 hof: use gimp_help_set_help_data for tooltips
* gimp 1.1.13b; 1999/12/04 hof: some cosmetic gtk fixes * gimp 1.1.13b; 1999/12/04 hof: some cosmetic gtk fixes
* changed border_width spacing and Buttons in action area * changed border_width spacing and Buttons in action area
@ -72,12 +74,6 @@
typedef void (*t_entry_cb_func) (GtkWidget *widget, t_arr_arg *arr_ptr); typedef void (*t_entry_cb_func) (GtkWidget *widget, t_arr_arg *arr_ptr);
typedef struct {
GtkWidget *scale;
GtkWidget *entry;
GtkWidget *label;
} t_pair;
typedef struct typedef struct
{ {
t_arr_arg *arr_ptr; t_arr_arg *arr_ptr;
@ -109,7 +105,8 @@ static void but_array_callback (GtkWidget *widget, gpointer data);
static void entry_create_value (char *title, GtkTable *table, int row, t_arr_arg *arr_ptr, static void entry_create_value (char *title, GtkTable *table, int row, t_arr_arg *arr_ptr,
t_entry_cb_func entry_update_cb, char *init_txt); t_entry_cb_func entry_update_cb, char *init_txt);
static void label_create_value (char *title, GtkTable *table, int row, t_arr_arg *arr_ptr); static void label_create_value (char *title, GtkTable *table, int row, t_arr_arg *arr_ptr,
gfloat align);
static void text_entry_update_cb (GtkWidget *widget, t_arr_arg *arr_ptr); static void text_entry_update_cb (GtkWidget *widget, t_arr_arg *arr_ptr);
static void text_create_value (char *title, GtkTable *table, int row, t_arr_arg *arr_ptr); static void text_create_value (char *title, GtkTable *table, int row, t_arr_arg *arr_ptr);
static void filesel_close_cb (GtkWidget *widget, t_arr_arg *arr_ptr); static void filesel_close_cb (GtkWidget *widget, t_arr_arg *arr_ptr);
@ -129,13 +126,8 @@ static void radio_update_cb (GtkWidget *widget, t_radio_arg *radio_
static void radio_create_value (char *title, GtkTable *table, int row, t_arr_arg *arr_ptr); static void radio_create_value (char *title, GtkTable *table, int row, t_arr_arg *arr_ptr);
static void optionmenu_create_value (char *title, GtkTable *table, int row, t_arr_arg *arr_ptr); static void optionmenu_create_value (char *title, GtkTable *table, int row, t_arr_arg *arr_ptr);
static void pair_flt_scale_update_cb (GtkAdjustment *adjustment, t_arr_arg *arr_ptr); static void pair_int_create_value (gchar *title, GtkTable *table, gint row, t_arr_arg *arr_ptr);
static void pair_flt_entry_update_cb (GtkWidget *widget, t_arr_arg *arr_ptr); static void pair_flt_create_value (gchar *title, GtkTable *table, gint row, t_arr_arg *arr_ptr);
static void pair_flt_create_value (t_pair *pair,
char *title,
GtkTable *table,
int row,
t_arr_arg *arr_ptr);
gint gint
@ -179,8 +171,8 @@ entry_create_value(char *title, GtkTable *table, int row, t_arr_arg *arr_ptr,
label = gtk_label_new(title); label = gtk_label_new(title);
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
gtk_table_attach(table, label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 4, 0); gtk_table_attach(table, label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show(label); gtk_widget_show(label);
entry = gtk_entry_new(); entry = gtk_entry_new();
@ -206,13 +198,26 @@ entry_create_value(char *title, GtkTable *table, int row, t_arr_arg *arr_ptr,
*/ */
static void static void
label_create_value(char *title, GtkTable *table, int row, t_arr_arg *arr_ptr) label_create_value(char *title, GtkTable *table, int row, t_arr_arg *arr_ptr, gfloat align)
{ {
GtkWidget *label; GtkWidget *label;
GtkWidget *hbox;
label = gtk_label_new(title); label = gtk_label_new(title);
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_misc_set_alignment(GTK_MISC(label), align, 0.5);
gtk_table_attach(table, label, 0, 3, row, row + 1, GTK_FILL, GTK_FILL, 4, 0);
if(align != 0.5)
{
hbox = gtk_hbox_new (FALSE, 2);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
gtk_table_attach(table, hbox, 0, 3, row, row + 1, GTK_FILL, GTK_FILL, 4, 0);
}
else
{
gtk_table_attach(table, label, 0, 3, row, row + 1, GTK_FILL, GTK_FILL, 4, 0);
}
gtk_widget_show(label); gtk_widget_show(label);
} }
@ -335,10 +340,11 @@ int_entry_update_cb(GtkWidget *widget, t_arr_arg *arr_ptr)
static void static void
int_create_value(char *title, GtkTable *table, int row, t_arr_arg *arr_ptr) int_create_value(char *title, GtkTable *table, int row, t_arr_arg *arr_ptr)
{ {
char buf[256]; char *buf;
sprintf(buf, arr_ptr->int_format, arr_ptr->int_ret); buf = g_strdup_printf("%d", arr_ptr->int_ret);
entry_create_value(title, table, row, arr_ptr, int_entry_update_cb, buf); entry_create_value(title, table, row, arr_ptr, int_entry_update_cb, buf);
g_free(buf);
} }
/* -------------------------- /* --------------------------
@ -357,10 +363,15 @@ flt_entry_update_cb(GtkWidget *widget, t_arr_arg *arr_ptr)
static void static void
flt_create_value(char *title, GtkTable *table, int row, t_arr_arg *arr_ptr) flt_create_value(char *title, GtkTable *table, int row, t_arr_arg *arr_ptr)
{ {
char buf[256]; char *buf;
char *fmt;
sprintf(buf, arr_ptr->int_format, arr_ptr->int_ret);
/* fmt should result something like "%.2f" */
fmt = g_strdup_printf("%%.%df", arr_ptr->flt_digits);
buf = g_strdup_printf(fmt, arr_ptr->flt_ret);
entry_create_value(title, table, row, arr_ptr, flt_entry_update_cb, buf); entry_create_value(title, table, row, arr_ptr, flt_entry_update_cb, buf);
g_free(fmt);
g_free(buf);
} }
/* -------------------------- /* --------------------------
@ -392,8 +403,8 @@ toggle_create_value(char *title, GtkTable *table, int row, t_arr_arg *arr_ptr)
label = gtk_label_new(title); label = gtk_label_new(title);
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
gtk_table_attach(table, label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 4, 0); gtk_table_attach(table, label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show(label); gtk_widget_show(label);
/* (make sure there is only 0 or 1) */ /* (make sure there is only 0 or 1) */
@ -452,8 +463,8 @@ radio_create_value(char *title, GtkTable *table, int row, t_arr_arg *arr_ptr)
label = gtk_label_new(title); label = gtk_label_new(title);
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
gtk_table_attach( GTK_TABLE (table), label, 0, 1, row, row+1, GTK_FILL, GTK_FILL, 4, 0); gtk_table_attach( GTK_TABLE (table), label, 0, 1, row, row+1, GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show(label); gtk_widget_show(label);
/* radio_table */ /* radio_table */
@ -531,8 +542,8 @@ optionmenu_create_value(char *title, GtkTable *table, int row, t_arr_arg *arr_pt
/* label */ /* label */
label = gtk_label_new(title); label = gtk_label_new(title);
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
gtk_table_attach( GTK_TABLE (table), label, 0, 1, row, row+1, GTK_FILL, GTK_FILL, 4, 0); gtk_table_attach( GTK_TABLE (table), label, 0, 1, row, row+1, GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show(label); gtk_widget_show(label);
/* optionmenu */ /* optionmenu */
@ -595,299 +606,89 @@ optionmenu_create_value(char *title, GtkTable *table, int row, t_arr_arg *arr_pt
* -------------------------- * --------------------------
*/ */
static void static void
pair_flt_entry_update_cb(GtkWidget *widget, t_arr_arg *arr_ptr) pair_flt_create_value(gchar *title, GtkTable *table, gint row, t_arr_arg *arr_ptr)
{ {
GtkAdjustment *adjustment; GtkObject *adj;
gdouble new_value; gfloat umin, umax;
gdouble new_value_lim;
if(arr_ptr->constraint)
{
umin = arr_ptr->flt_min;
umax = arr_ptr->flt_max;
}
else
{
umin = arr_ptr->umin;
umax = arr_ptr->umax;
}
if (arr_ptr->widget_type != WGT_FLT_PAIR) return; adj =
gimp_scale_entry_new( GTK_TABLE (table), 0, row, /* table col, row */
title, /* label text */
arr_ptr->scale_width, /* scalesize */
arr_ptr->entry_width, /* entrysize */
(gfloat)arr_ptr->flt_ret, /* init value */
(gfloat)arr_ptr->flt_min, /* lower, */
(gfloat)arr_ptr->flt_max, /* upper */
arr_ptr->flt_step, /* step */
arr_ptr->pagestep, /* pagestep */
arr_ptr->flt_digits, /* digits */
arr_ptr->constraint, /* constrain */
umin, umax, /* lower, upper (unconstrained) */
arr_ptr->help_txt, /* tooltip */
NULL); /* privatetip */
new_value = atof(gtk_entry_get_text(GTK_ENTRY(widget))); gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
/* printf("pair_flt_entry_update_cb: val: %f lim: %f new_value %f\n", arr_ptr->flt_ret, arr_ptr->flt_ret_lim, new_value); &arr_ptr->flt_ret);
*/
if (arr_ptr->flt_ret_lim != new_value)
{
adjustment = gtk_object_get_user_data(GTK_OBJECT(widget));
new_value_lim = new_value;
if (new_value < adjustment->lower) new_value_lim = adjustment->lower;
if (new_value > adjustment->upper) new_value_lim = adjustment->upper;
/* if constraint use limit both for entry and scale */
if(arr_ptr->constraint == TRUE) arr_ptr->flt_ret = new_value_lim;
else arr_ptr->flt_ret = new_value;
arr_ptr->flt_ret_lim = new_value_lim;
adjustment->value = new_value_lim;
gtk_signal_emit_by_name(GTK_OBJECT(adjustment), "value_changed");
}
} }
static void
pair_flt_scale_update_cb (GtkAdjustment *adjustment, t_arr_arg *arr_ptr)
{
GtkWidget *entry;
char buf[256];
/* printf("pair_flt_scale_update_cb: val: %f lim: %f new_value %f\n", arr_ptr->flt_ret, arr_ptr->flt_ret_lim, (float)adjustment->value);
*/
if (arr_ptr->widget_type != WGT_FLT_PAIR) return;
if (arr_ptr->flt_ret_lim != adjustment->value)
{
arr_ptr->flt_ret = adjustment->value;
arr_ptr->flt_ret_lim = adjustment->value;
entry = gtk_object_get_user_data(GTK_OBJECT(adjustment));
sprintf(buf, arr_ptr->flt_format, arr_ptr->flt_ret);
gtk_signal_handler_block_by_data(GTK_OBJECT(entry), arr_ptr);
gtk_entry_set_text(GTK_ENTRY(entry), buf);
gtk_signal_handler_unblock_by_data(GTK_OBJECT(entry), arr_ptr);
}
}
static void
pair_flt_create_value(t_pair *pair, char *title, GtkTable *table, int row, t_arr_arg *arr_ptr)
{
GtkObject *scale_data;
GtkWidget *hbox;
char buf[256];
if(arr_ptr->flt_format == NULL)
{
arr_ptr->flt_format = "%0.2f"; /* use default format */
}
else
{
/* short check if formatstring starts with % and ends with f */
if((*arr_ptr->flt_format != '%')
|| (arr_ptr->flt_format[strlen(arr_ptr->flt_format) -1] != 'f'))
{
printf( "pair_flt_create_value: Bad FloatFormat ignored %s\n", arr_ptr->flt_format);
arr_ptr->flt_format = "%0.2f";
}
}
/* init the limitied value */
arr_ptr->flt_ret_lim = arr_ptr->flt_ret;
if (arr_ptr->flt_ret < arr_ptr->flt_min) arr_ptr->flt_ret_lim = arr_ptr->flt_min;
if (arr_ptr->flt_ret > arr_ptr->flt_max) arr_ptr->flt_ret_lim = arr_ptr->flt_max;
pair->label = gtk_label_new(title);
gtk_misc_set_alignment(GTK_MISC(pair->label), 0.0, 0.5);
gtk_table_attach(table, pair->label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 4, 0);
gtk_widget_show(pair->label);
scale_data = gtk_adjustment_new((double)arr_ptr->flt_ret,
(double)arr_ptr->flt_min,
(double)arr_ptr->flt_max,
(double)arr_ptr->flt_step,
(double)arr_ptr->flt_step,
0.0);
gtk_signal_connect(GTK_OBJECT(scale_data), "value_changed",
(GtkSignalFunc) pair_flt_scale_update_cb,
arr_ptr);
pair->scale = gtk_hscale_new(GTK_ADJUSTMENT(scale_data));
gtk_widget_set_usize(pair->scale, arr_ptr->scale_width, 0);
/* gtk_table_attach(table, pair->scale, 2, 3, row, row + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); */
gtk_scale_set_draw_value(GTK_SCALE(pair->scale), FALSE);
gtk_scale_set_digits(GTK_SCALE(pair->scale), 3);
gtk_range_set_update_policy(GTK_RANGE(pair->scale), GTK_UPDATE_CONTINUOUS);
if(arr_ptr->help_txt != NULL)
{
gimp_help_set_help_data(pair->scale, arr_ptr->help_txt,NULL);
}
gtk_widget_show(pair->scale);
pair->entry = gtk_entry_new();
gtk_object_set_user_data(GTK_OBJECT(pair->entry), scale_data);
gtk_object_set_user_data(scale_data, pair->entry);
gtk_widget_set_usize(pair->entry, arr_ptr->entry_width, 0);
sprintf(buf, arr_ptr->flt_format, arr_ptr->flt_ret);
gtk_entry_set_text(GTK_ENTRY(pair->entry), buf);
gtk_signal_connect(GTK_OBJECT(pair->entry), "changed",
(GtkSignalFunc) pair_flt_entry_update_cb,
arr_ptr);
/* gtk_table_attach(GTK_TABLE(table), pair->entry, 1, 2, row, row + 1, GTK_FILL, GTK_FILL, 4, 0); */
if(arr_ptr->help_txt != NULL)
{
gimp_help_set_help_data(pair->entry, arr_ptr->help_txt,NULL);
}
gtk_widget_show(pair->entry);
/* Horizontal box for entry and scale */
hbox = gtk_hbox_new (FALSE, 2+3);
gtk_box_pack_start (GTK_BOX (hbox), pair->entry, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), pair->scale, TRUE, TRUE, 0);
gtk_widget_show(hbox);
gtk_table_attach(GTK_TABLE(table), hbox, 1, 3, row, row + 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 4, 0);
}
/* -------------------------- /* --------------------------
* INT_PAIR * INT_PAIR
* -------------------------- * --------------------------
*/ */
static void static void
pair_int_entry_update_cb(GtkWidget *widget, t_arr_arg *arr_ptr) pair_int_create_value(gchar *title, GtkTable *table, gint row, t_arr_arg *arr_ptr)
{ {
GtkAdjustment *adjustment; GtkObject *adj;
gint new_value; gfloat umin, umax;
gint new_value_lim;
if(arr_ptr->constraint)
{
umin = (gfloat)arr_ptr->int_min;
umax = (gfloat)arr_ptr->int_max;
}
else
{
umin = arr_ptr->umin;
umax = arr_ptr->umax;
}
if (arr_ptr->widget_type != WGT_INT_PAIR) return; adj =
gimp_scale_entry_new( GTK_TABLE (table), 0, row, /* table col, row */
title, /* label text */
arr_ptr->scale_width, /* scalesize */
arr_ptr->entry_width, /* entrysize */
(gfloat)arr_ptr->int_ret, /* init value */
(gfloat)arr_ptr->int_min, /* lower, */
(gfloat)arr_ptr->int_max, /* upper */
arr_ptr->int_step, /* step */
arr_ptr->pagestep, /* pagestep */
0, /* digits */
arr_ptr->constraint, /* constrain */
umin, umax, /* lower, upper (unconstrained) */
arr_ptr->help_txt, /* tooltip */
NULL); /* privatetip */
new_value = atol(gtk_entry_get_text(GTK_ENTRY(widget))); gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
&arr_ptr->int_ret);
/* printf("pair_int_entry_update_cb: val: %d lim: %d new_value %d\n", arr_ptr->int_ret, arr_ptr->int_ret_lim, new_value);
*/
if (arr_ptr->int_ret_lim != new_value)
{
adjustment = gtk_object_get_user_data(GTK_OBJECT(widget));
new_value_lim = new_value;
if (new_value < (gint)adjustment->lower) new_value_lim = (gint)adjustment->lower;
if (new_value > (gint)adjustment->upper) new_value_lim = (gint)adjustment->upper;
/* if constraint use limit both for entry and scale */
if(arr_ptr->constraint == TRUE)
{
arr_ptr->int_ret = new_value_lim;
}
else
{
arr_ptr->int_ret = new_value;
}
arr_ptr->int_ret_lim = new_value_lim;
adjustment->value = new_value_lim;
gtk_signal_emit_by_name(GTK_OBJECT(adjustment), "value_changed");
}
} }
static void
pair_int_scale_update_cb (GtkAdjustment *adjustment, t_arr_arg *arr_ptr)
{
GtkWidget *entry;
char buf[256];
/* printf("pair_int_scale_update_cb: val: %d lim: %d new_value %f\n", arr_ptr->int_ret, arr_ptr->int_ret_lim, (float)adjustment->value);
*/
if (arr_ptr->widget_type != WGT_INT_PAIR) return;
if (arr_ptr->int_ret_lim != (gint)adjustment->value)
{
arr_ptr->int_ret = (gint)adjustment->value;
arr_ptr->int_ret_lim = (gint)adjustment->value;
entry = gtk_object_get_user_data(GTK_OBJECT(adjustment));
sprintf(buf, arr_ptr->int_format, arr_ptr->int_ret);
gtk_signal_handler_block_by_data(GTK_OBJECT(entry), arr_ptr);
gtk_entry_set_text(GTK_ENTRY(entry), buf);
gtk_signal_handler_unblock_by_data(GTK_OBJECT(entry), arr_ptr);
}
}
static void
pair_int_create_value(t_pair *pair, char *title, GtkTable *table, int row, t_arr_arg *arr_ptr)
{
GtkObject *scale_data;
GtkWidget *hbox;
char buf[256];
if(arr_ptr->int_format == NULL)
{
arr_ptr->int_format = "%d"; /* use default format */
}
else
{
/* short check if formatstring starts with % and ends with d */
if((*arr_ptr->int_format != '%')
|| (arr_ptr->int_format[strlen(arr_ptr->int_format) -1] != 'd'))
{
printf ("pair_int_create_value: Bad IntFormat ignored %s\n", arr_ptr->int_format);
arr_ptr->int_format = "%d";
}
}
/* init the limitied value */
arr_ptr->int_ret_lim = arr_ptr->int_ret;
if (arr_ptr->int_ret < arr_ptr->int_min) arr_ptr->int_ret_lim = arr_ptr->int_min;
if (arr_ptr->int_ret > arr_ptr->int_max) arr_ptr->int_ret_lim = arr_ptr->int_max;
pair->label = gtk_label_new(title);
gtk_misc_set_alignment(GTK_MISC(pair->label), 0.0, 0.5);
gtk_table_attach(table, pair->label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 4, 0);
gtk_widget_show(pair->label);
scale_data = gtk_adjustment_new((double)arr_ptr->int_ret,
(double)arr_ptr->int_min,
(double)arr_ptr->int_max,
(double)arr_ptr->int_step,
(double)arr_ptr->int_step,
0.0);
gtk_signal_connect(GTK_OBJECT(scale_data), "value_changed",
(GtkSignalFunc) pair_int_scale_update_cb,
arr_ptr);
pair->scale = gtk_hscale_new(GTK_ADJUSTMENT(scale_data));
gtk_widget_set_usize(pair->scale, arr_ptr->scale_width, 0);
/* gtk_table_attach(table, pair->scale, 2, 3, row, row + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); */
gtk_scale_set_draw_value(GTK_SCALE(pair->scale), FALSE);
gtk_scale_set_digits(GTK_SCALE(pair->scale), 3);
gtk_range_set_update_policy(GTK_RANGE(pair->scale), GTK_UPDATE_CONTINUOUS);
if(arr_ptr->help_txt != NULL)
{
gimp_help_set_help_data(pair->scale, arr_ptr->help_txt,NULL);
}
gtk_widget_show(pair->scale);
pair->entry = gtk_entry_new();
gtk_object_set_user_data(GTK_OBJECT(pair->entry), scale_data);
gtk_object_set_user_data(scale_data, pair->entry);
gtk_widget_set_usize(pair->entry, arr_ptr->entry_width, 0);
sprintf(buf, arr_ptr->int_format, arr_ptr->int_ret);
gtk_entry_set_text(GTK_ENTRY(pair->entry), buf);
gtk_signal_connect(GTK_OBJECT(pair->entry), "changed",
(GtkSignalFunc) pair_int_entry_update_cb,
arr_ptr);
/* gtk_table_attach(GTK_TABLE(table), pair->entry, 1, 2, row, row + 1, GTK_FILL, GTK_FILL, 4, 0); */
if(arr_ptr->help_txt != NULL)
{
gimp_help_set_help_data(pair->entry, arr_ptr->help_txt,NULL);
}
gtk_widget_show(pair->entry);
/* Horizontal box for entry and scale */
hbox = gtk_hbox_new (FALSE, 2+3);
gtk_box_pack_start (GTK_BOX (hbox), pair->entry, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), pair->scale, TRUE, TRUE, 0);
gtk_widget_show(hbox);
gtk_table_attach(GTK_TABLE(table), hbox, 1, 3, row, row + 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 4, 0);
}
/* ============================================================================ /* ============================================================================
* p_array_std_dialog * p_array_std_dialog
@ -915,7 +716,6 @@ gint p_array_std_dialog(char *title_txt,
gint l_idx; gint l_idx;
gint l_ok_value; gint l_ok_value;
char *l_label_txt; char *l_label_txt;
t_pair l_pair;
t_arr_arg *arr_ptr; t_arr_arg *arr_ptr;
g_arrint.run = b_def_val; /* prepare default retcode (if window is closed without button) */ g_arrint.run = b_def_val; /* prepare default retcode (if window is closed without button) */
@ -941,11 +741,11 @@ gint p_array_std_dialog(char *title_txt,
l_argsv[0] = g_strdup ("gap_std_dialog"); l_argsv[0] = g_strdup ("gap_std_dialog");
gtk_init (&l_argsc, &l_argsv); gtk_init (&l_argsc, &l_argsv);
g_first_call = FALSE; g_first_call = FALSE;
/* Initialize Tooltips */
gimp_help_init ();
} }
/* Initialize Tooltips */
gimp_help_init ();
/* dialog */ /* dialog */
g_arrint.dlg = gtk_dialog_new (); g_arrint.dlg = gtk_dialog_new ();
gtk_window_set_title (GTK_WINDOW (g_arrint.dlg), title_txt); gtk_window_set_title (GTK_WINDOW (g_arrint.dlg), title_txt);
@ -1014,10 +814,10 @@ gint p_array_std_dialog(char *title_txt,
switch(arr_ptr->widget_type) switch(arr_ptr->widget_type)
{ {
case WGT_FLT_PAIR: case WGT_FLT_PAIR:
pair_flt_create_value(&l_pair, l_label_txt, GTK_TABLE(table), (l_idx + 1), arr_ptr); pair_flt_create_value(l_label_txt, GTK_TABLE(table), (l_idx + 1), arr_ptr);
break; break;
case WGT_INT_PAIR: case WGT_INT_PAIR:
pair_int_create_value(&l_pair, l_label_txt, GTK_TABLE(table), (l_idx + 1), arr_ptr); pair_int_create_value(l_label_txt, GTK_TABLE(table), (l_idx + 1), arr_ptr);
break; break;
case WGT_TOGGLE: case WGT_TOGGLE:
toggle_create_value(l_label_txt, GTK_TABLE(table), (l_idx + 1), arr_ptr); toggle_create_value(l_label_txt, GTK_TABLE(table), (l_idx + 1), arr_ptr);
@ -1041,7 +841,13 @@ gint p_array_std_dialog(char *title_txt,
flt_create_value(l_label_txt, GTK_TABLE(table), (l_idx + 1), arr_ptr); flt_create_value(l_label_txt, GTK_TABLE(table), (l_idx + 1), arr_ptr);
break; break;
case WGT_LABEL: case WGT_LABEL:
label_create_value(l_label_txt, GTK_TABLE(table), (l_idx + 1), arr_ptr); label_create_value(l_label_txt, GTK_TABLE(table), (l_idx + 1), arr_ptr, 0.5);
break;
case WGT_LABEL_LEFT:
label_create_value(l_label_txt, GTK_TABLE(table), (l_idx + 1), arr_ptr, 0.0);
break;
case WGT_LABEL_RIGHT:
label_create_value(l_label_txt, GTK_TABLE(table), (l_idx + 1), arr_ptr, 1.0);
break; break;
case WGT_ACT_BUTTON: case WGT_ACT_BUTTON:
printf ("WGT_ACT_BUTTON not implemented yet, widget type ignored\n"); printf ("WGT_ACT_BUTTON not implemented yet, widget type ignored\n");
@ -1113,31 +919,41 @@ void p_init_arr_arg (t_arr_arg *arr_ptr,
arr_ptr->label_txt = NULL; arr_ptr->label_txt = NULL;
arr_ptr->help_txt = NULL; arr_ptr->help_txt = NULL;
arr_ptr->togg_label = NULL; arr_ptr->togg_label = NULL;
arr_ptr->entry_width = 50; arr_ptr->entry_width = 60;
arr_ptr->scale_width = 180; arr_ptr->scale_width = 200;
arr_ptr->constraint = TRUE; arr_ptr->constraint = TRUE;
arr_ptr->has_default = FALSE; arr_ptr->has_default = FALSE;
arr_ptr->text_entry = NULL; arr_ptr->text_entry = NULL;
switch(widget_type) switch(widget_type)
{ {
case WGT_LABEL:
case WGT_LABEL_LEFT:
case WGT_LABEL_RIGHT:
arr_ptr->widget_type = widget_type;
break;
case WGT_INT_PAIR: case WGT_INT_PAIR:
case WGT_INT: case WGT_INT:
arr_ptr->widget_type = widget_type; arr_ptr->widget_type = widget_type;
arr_ptr->int_format = "%d"; arr_ptr->umin = (gfloat)G_MININT;
arr_ptr->umax = (gfloat)G_MAXINT;
arr_ptr->int_min = 0; arr_ptr->int_min = 0;
arr_ptr->int_max = 100; arr_ptr->int_max = 100;
arr_ptr->int_step = 1; arr_ptr->int_step = 1;
arr_ptr->pagestep = 10.0;
arr_ptr->int_default = 0; arr_ptr->int_default = 0;
arr_ptr->int_ret = 0; arr_ptr->int_ret = 0;
break; break;
case WGT_FLT_PAIR: case WGT_FLT_PAIR:
case WGT_FLT: case WGT_FLT:
arr_ptr->widget_type = widget_type; arr_ptr->widget_type = widget_type;
arr_ptr->flt_format = "%0.2f"; arr_ptr->flt_digits = 2;
arr_ptr->umin = G_MINFLOAT;
arr_ptr->umax = G_MAXFLOAT;
arr_ptr->flt_min = 0.0; arr_ptr->flt_min = 0.0;
arr_ptr->flt_max = 100.0; arr_ptr->flt_max = 100.0;
arr_ptr->flt_step = 0.1; arr_ptr->flt_step = 0.1;
arr_ptr->pagestep = 10.0;
arr_ptr->flt_default = 0.0; arr_ptr->flt_default = 0.0;
arr_ptr->flt_ret = 0.0; arr_ptr->flt_ret = 0.0;
break; break;

View File

@ -40,6 +40,7 @@
*/ */
/* revision history: /* revision history:
* gimp 1.1.17b; 2000/01/26 hof:
* version 0.96.03; 1998/08/15 hof: p_arr_gtk_init * version 0.96.03; 1998/08/15 hof: p_arr_gtk_init
* version 0.96.00; 1998/07/09 hof: 1.st release * version 0.96.00; 1998/07/09 hof: 1.st release
* (re-implementation of gap_sld_dialog.c) * (re-implementation of gap_sld_dialog.c)
@ -64,7 +65,9 @@ typedef enum
,WGT_FLT_PAIR ,WGT_FLT_PAIR
,WGT_INT_PAIR ,WGT_INT_PAIR
,WGT_ACT_BUTTON ,WGT_ACT_BUTTON
,WGT_FILESEL ,WGT_FILESEL
,WGT_LABEL_LEFT
,WGT_LABEL_RIGHT
} t_gap_widget; } t_gap_widget;
typedef int (*t_action_func) ( gpointer action_data); typedef int (*t_action_func) ( gpointer action_data);
@ -86,16 +89,14 @@ typedef struct {
gint has_default; /* TRUE: default value available */ gint has_default; /* TRUE: default value available */
/* flt_ fileds are used for WGT_FLT and WGT_FLT_PAIR */ /* flt_ fileds are used for WGT_FLT and WGT_FLT_PAIR */
char *flt_format; /* NULL or something like "%0.2f" */ gint flt_digits; /* digits behind comma */
gdouble flt_min; gdouble flt_min;
gdouble flt_max; gdouble flt_max;
gdouble flt_step; gdouble flt_step;
gdouble flt_default; gdouble flt_default;
gdouble flt_ret; gdouble flt_ret;
gdouble flt_ret_lim;
/* int_ fileds are used for WGT_INT and WGT_INT_PAIR WGT_TOGGLE */ /* int_ fileds are used for WGT_INT and WGT_INT_PAIR WGT_TOGGLE */
char *int_format; /* NULL or something like "%d" */
gint int_min; gint int_min;
gint int_max; gint int_max;
gint int_step; gint int_step;
@ -103,6 +104,12 @@ typedef struct {
gint int_ret; gint int_ret;
gint int_ret_lim; /* for private (arr_dialog.c) use only */ gint int_ret_lim; /* for private (arr_dialog.c) use only */
/* uncontraint lower /upper limit for WGT_FLT_PAIR and WGT_INT_PAIR */
gfloat umin;
gfloat umax;
gfloat pagestep;
/* togg_ field are used for WGT_TOGGLE */ /* togg_ field are used for WGT_TOGGLE */
char *togg_label; /* extra label attached right to toggle button */ char *togg_label; /* extra label attached right to toggle button */

View File

@ -655,6 +655,8 @@ load_range_dialog(gint32 *first_frame,
argv[1].int_min = 1; argv[1].int_min = 1;
argv[1].int_max = 9999; argv[1].int_max = 9999;
argv[1].int_ret = 1; argv[1].int_ret = 1;
argv[1].umin = 0;
argv[1].entry_width = 80;
p_init_arr_arg(&argv[2], WGT_INT_PAIR); p_init_arr_arg(&argv[2], WGT_INT_PAIR);
argv[2].label_txt = _("To"); argv[2].label_txt = _("To");
@ -663,6 +665,8 @@ load_range_dialog(gint32 *first_frame,
argv[2].int_min = 1; argv[2].int_min = 1;
argv[2].int_max = 9999; argv[2].int_max = 9999;
argv[2].int_ret = 9999; argv[2].int_ret = 9999;
argv[2].umin = 0;
argv[2].entry_width = 80;
p_init_arr_arg(&argv[3], WGT_FILESEL); p_init_arr_arg(&argv[3], WGT_FILESEL);
argv[3].label_txt = _("Framenames"); argv[3].label_txt = _("Framenames");
@ -677,7 +681,7 @@ load_range_dialog(gint32 *first_frame,
argv[4].help_txt = _("Open the 1.st one of the extracted frames"); argv[4].help_txt = _("Open the 1.st one of the extracted frames");
argv[4].int_ret = 1; argv[4].int_ret = 1;
p_init_arr_arg(&argv[5], WGT_LABEL); p_init_arr_arg(&argv[5], WGT_LABEL_LEFT);
argv[5].label_txt = _("\nWARNING: do not attempt to split other files than MPEG1 videos\n" argv[5].label_txt = _("\nWARNING: do not attempt to split other files than MPEG1 videos\n"
"before you proceed, you should save all open images"); "before you proceed, you should save all open images");

View File

@ -48,6 +48,7 @@
*/ */
/* revision history /* revision history
* 1.1.17b; 2000/02/26 hof: bugfixes
* 1.1.14a; 1999/11/22 hof: fixed gcc warning (too many arguments for format) * 1.1.14a; 1999/11/22 hof: fixed gcc warning (too many arguments for format)
* 1.1.13a; 1999/11/22 hof: first release * 1.1.13a; 1999/11/22 hof: first release
*/ */
@ -86,8 +87,8 @@ extern int gap_debug; /* ==0 ... dont print debug infos */
static char *global_xanim_input_dir = "input"; static char *global_xanim_input_dir = "input";
char global_xanim_prog[500]; gchar global_xanim_prog[500];
char global_errlist[500]; gchar *global_errlist = NULL;
gint32 global_delete_number; gint32 global_delete_number;
@ -108,64 +109,64 @@ p_xanim_info(char *errlist)
l_idx = 0; l_idx = 0;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _("Conditions to run the xanim based video split"); argv[l_idx].label_txt = _("Conditions to run the xanim based video split");
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = ""; argv[l_idx].label_txt = "";
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _("1.) xanim 2.80.0 exporting edition (the loki version)"); argv[l_idx].label_txt = _("1.) xanim 2.80.0 exporting edition (the loki version)");
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _(" must be installed somewhere in your PATH"); argv[l_idx].label_txt = _(" must be installed somewhere in your PATH");
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _(" you can get xanim exporting edition at"); argv[l_idx].label_txt = _(" you can get xanim exporting edition at");
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = " http://heroine.linuxbox.com/toys.html"; argv[l_idx].label_txt = " http://heroine.linuxbox.com/toys.html";
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = " http://www.lokigames.com/development/download/smjpeg/xanim2801-loki090899.tar.gz"; argv[l_idx].label_txt = " http://www.lokigames.com/development/download/smjpeg/xanim2801-loki090899.tar.gz";
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = ""; argv[l_idx].label_txt = "";
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _("2.) if your xanim exporting edition is not in your PATH or is not named xanim"); argv[l_idx].label_txt = _("2.) if your xanim exporting edition is not in your PATH or is not named xanim");
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _(" you have to set Environment variable GAP_XANIM_PROG "); argv[l_idx].label_txt = _(" you have to set Environment variable GAP_XANIM_PROG ");
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _(" to your xanim exporting program and restart gimp"); argv[l_idx].label_txt = _(" to your xanim exporting program and restart gimp");
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = ""; argv[l_idx].label_txt = "";
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _("An ERROR occured while trying to call xanim:"); argv[l_idx].label_txt = _("An ERROR occured while trying to call xanim:");
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = "--------------------------------------------"; argv[l_idx].label_txt = "--------------------------------------------";
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = errlist; argv[l_idx].label_txt = errlist;
l_idx++; l_idx++;
@ -204,7 +205,7 @@ p_xanim_dialog (gint32 *first_frame,
gint32 *autoload, gint32 *autoload,
gint32 *run_xanim_asynchron) gint32 *run_xanim_asynchron)
{ {
#define XADIALOG_NUM_ARGS 11 #define XADIALOG_NUM_ARGS 12
static t_arr_arg argv[XADIALOG_NUM_ARGS]; static t_arr_arg argv[XADIALOG_NUM_ARGS];
static char *radio_args[3] = { N_("XCF"), N_("PPM"), N_("JPEG") }; static char *radio_args[3] = { N_("XCF"), N_("PPM"), N_("JPEG") };
@ -225,6 +226,8 @@ p_xanim_dialog (gint32 *first_frame,
argv[1].int_min = 0; argv[1].int_min = 0;
argv[1].int_max = 9999; argv[1].int_max = 9999;
argv[1].int_ret = 0; argv[1].int_ret = 0;
argv[1].umin = 0;
argv[1].entry_width = 80;
p_init_arr_arg(&argv[2], WGT_INT_PAIR); p_init_arr_arg(&argv[2], WGT_INT_PAIR);
argv[2].label_txt = _("To :"); argv[2].label_txt = _("To :");
@ -233,6 +236,8 @@ p_xanim_dialog (gint32 *first_frame,
argv[2].int_min = 0; argv[2].int_min = 0;
argv[2].int_max = 9999; argv[2].int_max = 9999;
argv[2].int_ret = 9999; argv[2].int_ret = 9999;
argv[2].umin = 0;
argv[2].entry_width = 80;
p_init_arr_arg(&argv[3], WGT_FILESEL); p_init_arr_arg(&argv[3], WGT_FILESEL);
argv[3].label_txt = _("Framenames:"); argv[3].label_txt = _("Framenames:");
@ -271,8 +276,7 @@ p_xanim_dialog (gint32 *first_frame,
argv[7].int_ret = 90; argv[7].int_ret = 90;
p_init_arr_arg(&argv[8], WGT_LABEL); p_init_arr_arg(&argv[8], WGT_LABEL);
argv[8].label_txt = _("\nWarning: xanim 2.80 has just limited MPEG support\n" argv[8].label_txt = "";
"most of the frames (type P and B) will be skipped");
p_init_arr_arg(&argv[9], WGT_TOGGLE); p_init_arr_arg(&argv[9], WGT_TOGGLE);
argv[9].label_txt = _("Open"); argv[9].label_txt = _("Open");
@ -284,6 +288,10 @@ p_xanim_dialog (gint32 *first_frame,
argv[10].help_txt = _("Run xanim asynchronously and delete unwanted frames\n" argv[10].help_txt = _("Run xanim asynchronously and delete unwanted frames\n"
"(out of the specified range) while xanim is still running"); "(out of the specified range) while xanim is still running");
argv[10].int_ret = 1; argv[10].int_ret = 1;
p_init_arr_arg(&argv[11], WGT_LABEL_LEFT);
argv[11].label_txt = _("\nWarning: xanim 2.80 has just limited MPEG support\n"
"most of the frames (type P and B) will be skipped");
if(TRUE == p_array_dialog(_("Split any Xanim readable Video to Frames"), if(TRUE == p_array_dialog(_("Split any Xanim readable Video to Frames"),
_("Select Frame range"), XADIALOG_NUM_ARGS, argv)) _("Select Frame range"), XADIALOG_NUM_ARGS, argv))
@ -527,7 +535,7 @@ p_rename_frames(gint32 frame_from, gint32 frame_to, char *basename, char *ext)
l_max_found = p_find_max_xanim_frame (frame_from, ext); l_max_found = p_find_max_xanim_frame (frame_from, ext);
if(l_max_found < 0) if(l_max_found < 0)
{ {
sprintf(global_errlist, global_errlist = g_strdup_printf(
_("cant find any extracted frames,\n%s\nmaybe xanim has failed or was canclled"), _("cant find any extracted frames,\n%s\nmaybe xanim has failed or was canclled"),
l_src_frame); l_src_frame);
return(-1); return(-1);
@ -552,7 +560,7 @@ p_rename_frames(gint32 frame_from, gint32 frame_to, char *basename, char *ext)
l_overwrite_mode = p_overwrite_dialog(l_dst_frame, l_overwrite_mode); l_overwrite_mode = p_overwrite_dialog(l_dst_frame, l_overwrite_mode);
if (l_overwrite_mode < 0) if (l_overwrite_mode < 0)
{ {
sprintf(global_errlist, global_errlist = g_strdup_printf(
_("frames are not extracted, because overwrite of %s was cancelled"), _("frames are not extracted, because overwrite of %s was cancelled"),
l_dst_frame); l_dst_frame);
return(-1); return(-1);
@ -562,7 +570,7 @@ p_rename_frames(gint32 frame_from, gint32 frame_to, char *basename, char *ext)
remove(l_dst_frame); remove(l_dst_frame);
if (p_file_exists(l_dst_frame)) if (p_file_exists(l_dst_frame))
{ {
sprintf(global_errlist, global_errlist = g_strdup_printf(
_("failed to overwrite %s (check permissions ?)"), _("failed to overwrite %s (check permissions ?)"),
l_dst_frame); l_dst_frame);
return(-1); return(-1);
@ -584,7 +592,7 @@ p_rename_frames(gint32 frame_from, gint32 frame_to, char *basename, char *ext)
} }
else else
{ {
sprintf(global_errlist, global_errlist = g_strdup_printf(
_("failed to write %s (check permissions ?)"), _("failed to write %s (check permissions ?)"),
l_dst_frame); l_dst_frame);
return(-1); return(-1);
@ -666,11 +674,12 @@ p_poll(pid_t xanim_pid, char *one_past_last_frame, gint32 frame_from, gint32 fra
static int static int
p_grep(char *pattern, char *file) p_grep(char *pattern, char *file)
{ {
int l_rc; gint l_rc;
char l_cmd[300]; gchar *l_cmd;
sprintf(l_cmd, "grep -c '%s' \"%s\" >/dev/null", pattern, file); l_cmd = g_strdup_printf("grep -c '%s' \"%s\" >/dev/null", pattern, file);
l_rc = system(l_cmd); l_rc = system(l_cmd);
g_free(l_cmd);
if (l_rc == 0) if (l_rc == 0)
{ {
return(0); /* pattern found */ return(0); /* pattern found */
@ -678,21 +687,21 @@ p_grep(char *pattern, char *file)
return(1); /* pattern NOT found */ return(1); /* pattern NOT found */
} }
static int static gint
p_check_xanim() p_check_xanim()
{ {
int l_rc; gint l_rc;
int l_grep_counter1; gint l_grep_counter1;
int l_grep_counter2; gint l_grep_counter2;
int l_grep_counter3; gint l_grep_counter3;
char l_cmd[300]; gchar *l_cmd;
static char *l_xanim_help_output = "tmp_xanim_help.output"; static char *l_xanim_help_output = "tmp_xanim_help.output";
FILE *l_fp; FILE *l_fp;
l_fp = fopen(l_xanim_help_output, "w+"); l_fp = fopen(l_xanim_help_output, "w+");
if (l_fp == NULL) if (l_fp == NULL)
{ {
sprintf(global_errlist, "no write permission for current directory"); global_errlist = g_strdup_printf("no write permission for current directory");
return(10); return(10);
} }
fprintf(l_fp, "dummy"); fprintf(l_fp, "dummy");
@ -701,14 +710,15 @@ p_check_xanim()
/* execute xanim with -h option and /* execute xanim with -h option and
* store its output in a file. * store its output in a file.
*/ */
sprintf(l_cmd, "%s -h 2>&1 >>%s", global_xanim_prog, l_xanim_help_output); l_cmd = g_strdup_printf("%s -h 2>&1 >>%s", global_xanim_prog, l_xanim_help_output);
l_rc = system(l_cmd); l_rc = system(l_cmd);
printf("DEBUG: executed :%s\n Retcode: %d\n", l_cmd, (int)l_rc); if(gap_debug) printf("DEBUG: executed :%s\n Retcode: %d\n", l_cmd, (int)l_rc);
g_free(l_cmd);
if ((l_rc == 127) || (l_rc == (127 << 8))) if ((l_rc == 127) || (l_rc == (127 << 8)))
{ {
sprintf(global_errlist, global_errlist = g_strdup_printf(
_("could not execute %s (check if xanim is installed)"), _("could not execute %s (check if xanim is installed)"),
global_xanim_prog ); global_xanim_prog );
return(10); return(10);
@ -716,7 +726,7 @@ p_check_xanim()
if(!p_file_exists(l_xanim_help_output)) if(!p_file_exists(l_xanim_help_output))
{ {
sprintf(global_errlist, global_errlist = g_strdup_printf(
_("%s does not look like xanim"), _("%s does not look like xanim"),
global_xanim_prog ); global_xanim_prog );
return(10); return(10);
@ -740,14 +750,14 @@ p_check_xanim()
if(l_grep_counter2 != 0) if(l_grep_counter2 != 0)
{ {
sprintf(global_errlist, global_errlist = g_strdup_printf(
_("The xanim program on your system \"%s\"\ndoes not support the exporting options Ea, Ee, Eq"), _("The xanim program on your system \"%s\"\ndoes not support the exporting options Ea, Ee, Eq"),
global_xanim_prog ); global_xanim_prog );
return(10); return(10);
} }
if(l_grep_counter3 != 0) if(l_grep_counter3 != 0)
{ {
sprintf(global_errlist, global_errlist = g_strdup_printf(
_("The xanim program on your system \"%s\"\ndoes not support exporting of single frames"), _("The xanim program on your system \"%s\"\ndoes not support exporting of single frames"),
global_xanim_prog ); global_xanim_prog );
return(10); return(10);
@ -765,8 +775,8 @@ p_start_xanim_process(gint32 first_frame, gint32 last_frame,
char *one_past_last_frame, char *one_past_last_frame,
gint32 run_xanim_asynchron) gint32 run_xanim_asynchron)
{ {
char l_cmd[300]; gchar l_cmd[500];
char l_buf[40]; gchar l_buf[40];
pid_t l_xanim_pid; pid_t l_xanim_pid;
int l_rc; int l_rc;
FILE *l_fp; FILE *l_fp;
@ -985,7 +995,7 @@ gap_xanim_decode(GRunModeType run_mode)
l_rc = 0; l_rc = 0;
l_input_dir_created_by_myself = FALSE; l_input_dir_created_by_myself = FALSE;
global_errlist[0] = '\0'; global_errlist = NULL;
p_init_xanim_global_name(); p_init_xanim_global_name();
filename[0] = '\0'; filename[0] = '\0';
@ -1010,7 +1020,7 @@ gap_xanim_decode(GRunModeType run_mode)
if(!p_file_exists(filename)) if(!p_file_exists(filename))
{ {
sprintf(global_errlist, global_errlist = g_strdup_printf(
_("videofile %s not existent or empty\n"), _("videofile %s not existent or empty\n"),
filename); filename);
l_rc = 10; l_rc = 10;
@ -1063,7 +1073,7 @@ gap_xanim_decode(GRunModeType run_mode)
} }
else else
{ {
sprintf(global_errlist, global_errlist = g_strdup_printf(
_("could not create %s directory\n" _("could not create %s directory\n"
"(that is required for xanim frame export)"), "(that is required for xanim frame export)"),
global_xanim_input_dir); global_xanim_input_dir);
@ -1099,7 +1109,7 @@ gap_xanim_decode(GRunModeType run_mode)
if (l_xanim_pid == -1 ) if (l_xanim_pid == -1 )
{ {
sprintf(global_errlist, global_errlist = g_strdup_printf(
_("could not start xanim process\n(program=%s)"), _("could not start xanim process\n(program=%s)"),
global_xanim_prog ); global_xanim_prog );
l_rc = -1; l_rc = -1;
@ -1120,7 +1130,7 @@ gap_xanim_decode(GRunModeType run_mode)
if (p_find_max_xanim_frame (first_frame, extension) < first_frame) if (p_find_max_xanim_frame (first_frame, extension) < first_frame)
{ {
sprintf(global_errlist, global_errlist = g_strdup_printf(
_("cant find any extracted frames,\n" _("cant find any extracted frames,\n"
"xanim has failed or was canclled")); "xanim has failed or was canclled"));
l_rc = -1; l_rc = -1;
@ -1166,7 +1176,7 @@ gap_xanim_decode(GRunModeType run_mode)
if(l_rc != 0) if(l_rc != 0)
{ {
if(global_errlist[0] == '\0') if(global_errlist == NULL)
{ {
p_xanim_info("ERROR: could not execute xanim"); p_xanim_info("ERROR: could not execute xanim");
} }

View File

@ -29,9 +29,6 @@
#include "libgimp/gimp.h" #include "libgimp/gimp.h"
/* max buffer size for plugin' stored valus
*/
#define PLUGIN_DATA_SIZE 8192
/* ------------------------ /* ------------------------
* gap_filter_foreach.h * gap_filter_foreach.h

View File

@ -64,6 +64,7 @@
*/ */
/* Change Log: /* Change Log:
* version gimp 1.1.17b 2000.02.22 hof: - removed limit PLUGIN_DATA_SIZE
* 1999.11.16 hof: added p_delta_gintdrawable * 1999.11.16 hof: added p_delta_gintdrawable
* 1999.06.21 hof: removed Colorify iterator * 1999.06.21 hof: removed Colorify iterator
* 1999.03.14 hof: added iterators for gimp 1.1.3 prerelease * 1999.03.14 hof: added iterators for gimp 1.1.3 prerelease
@ -93,14 +94,29 @@
#include "gap_filter_iterators.h" #include "gap_filter_iterators.h"
static char g_plugin_data_from[PLUGIN_DATA_SIZE + 1]; static gchar *g_plugin_data_from = NULL;
static char g_plugin_data_to[PLUGIN_DATA_SIZE + 1]; static gchar *g_plugin_data_to = NULL;
extern int gap_debug; extern int gap_debug;
static gchar *
p_alloc_plugin_data(char *key)
{
int l_len;
gchar *l_plugin_data;
l_len = gimp_get_data_size (key);
if(l_len < 1)
{
fprintf(stderr, "ERROR: no stored data found for Key %s\n", key);
return NULL;
}
l_plugin_data = g_malloc0(l_len+1);
if(gap_debug) printf("DEBUG Key:%s plugin_data length %d\n", key, (int)l_len);
return (l_plugin_data);
}
typedef struct { typedef struct {
guchar color[3]; guchar color[3];
} t_color; } t_color;
@ -125,7 +141,7 @@ static void p_delta_long(long *val, long val_from, long val_to, gint32 total_ste
delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step); delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step);
*val = val_from + delta; *val = val_from + delta;
if(gap_debug) fprintf(stderr, "DEBUG: p_delta_long from: %ld to: %ld curr: %ld delta: %f\n", if(gap_debug) printf("DEBUG: p_delta_long from: %ld to: %ld curr: %ld delta: %f\n",
val_from, val_to, *val, delta); val_from, val_to, *val, delta);
} }
static void p_delta_short(short *val, short val_from, short val_to, gint32 total_steps, gdouble current_step) static void p_delta_short(short *val, short val_from, short val_to, gint32 total_steps, gdouble current_step)
@ -182,7 +198,7 @@ static void p_delta_gdouble(double *val, double val_from, double val_to, gint32
delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step); delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step);
*val = val_from + delta; *val = val_from + delta;
if(gap_debug) fprintf(stderr, "DEBUG: p_delta_gdouble total: %d from: %f to: %f curr: %f delta: %f\n", if(gap_debug) printf("DEBUG: p_delta_gdouble total: %d from: %f to: %f curr: %f delta: %f\n",
(int)total_steps, val_from, val_to, *val, delta); (int)total_steps, val_from, val_to, *val, delta);
} }
static void p_delta_gfloat(gfloat *val, gfloat val_from, gfloat val_to, gint32 total_steps, gdouble current_step) static void p_delta_gfloat(gfloat *val, gfloat val_from, gfloat val_to, gint32 total_steps, gdouble current_step)
@ -194,7 +210,7 @@ static void p_delta_gfloat(gfloat *val, gfloat val_from, gfloat val_to, gint32 t
delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step); delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step);
*val = val_from + delta; *val = val_from + delta;
if(gap_debug) fprintf(stderr, "DEBUG: p_delta_gfloat total: %d from: %f to: %f curr: %f delta: %f\n", if(gap_debug) printf("DEBUG: p_delta_gfloat total: %d from: %f to: %f curr: %f delta: %f\n",
(int)total_steps, val_from, val_to, *val, delta); (int)total_steps, val_from, val_to, *val, delta);
} }
@ -207,7 +223,7 @@ static void p_delta_float(float *val, float val_from, float val_to, gint32 total
delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step); delta = ((double)(val_to - val_from) / (double)total_steps) * ((double)total_steps - current_step);
*val = val_from + delta; *val = val_from + delta;
if(gap_debug) fprintf(stderr, "DEBUG: p_delta_gdouble total: %d from: %f to: %f curr: %f delta: %f\n", if(gap_debug) printf("DEBUG: p_delta_gdouble total: %d from: %f to: %f curr: %f delta: %f\n",
(int)total_steps, val_from, val_to, *val, delta); (int)total_steps, val_from, val_to, *val, delta);
} }
static void p_delta_color(t_color *val, t_color *val_from, t_color *val_to, gint32 total_steps, gdouble current_step) static void p_delta_color(t_color *val, t_color *val_from, t_color *val_to, gint32 total_steps, gdouble current_step)
@ -222,7 +238,7 @@ static void p_delta_color(t_color *val, t_color *val_from, t_color *val_to, gint
delta = ((double)(val_to->color[l_idx] - val_from->color[l_idx]) / (double)total_steps) * ((double)total_steps - current_step); delta = ((double)(val_to->color[l_idx] - val_from->color[l_idx]) / (double)total_steps) * ((double)total_steps - current_step);
val->color[l_idx] = val_from->color[l_idx] + delta; val->color[l_idx] = val_from->color[l_idx] + delta;
if(gap_debug) fprintf(stderr, "DEBUG: p_delta_color[%d] total: %d from: %d to: %d curr: %d delta: %f current_step: %f\n", if(gap_debug) printf("DEBUG: p_delta_color[%d] total: %d from: %d to: %d curr: %d delta: %f current_step: %f\n",
(int)l_idx, (int)total_steps, (int)l_idx, (int)total_steps,
(int)val_from->color[l_idx], (int)val_to->color[l_idx], (int)val->color[l_idx], (int)val_from->color[l_idx], (int)val_to->color[l_idx], (int)val->color[l_idx],
delta, current_step); delta, current_step);
@ -639,8 +655,8 @@ static t_iter_ALT_tab g_iter_ALT_tab[] =
static void p_install_proc_iter_ALT(char *name) static void p_install_proc_iter_ALT(char *name)
{ {
char l_iter_proc_name[256]; gchar *l_iter_proc_name;
char l_blurb_text[300]; gchar *l_blurb_text;
static GParamDef args_iter[] = static GParamDef args_iter[] =
{ {
@ -654,21 +670,23 @@ static void p_install_proc_iter_ALT(char *name)
static GParamDef *return_vals = NULL; static GParamDef *return_vals = NULL;
static int nreturn_vals = 0; static int nreturn_vals = 0;
sprintf(l_iter_proc_name, "%s_Iterator_ALT", name); l_iter_proc_name = g_strdup_printf("%s_Iterator_ALT", name);
sprintf(l_blurb_text, "This extension calculates the modified values for one iterationstep for the call of %s", name); l_blurb_text = g_strdup_printf("This extension calculates the modified values for one iterationstep for the call of %s", name);
gimp_install_procedure(l_iter_proc_name, gimp_install_procedure(l_iter_proc_name,
l_blurb_text, l_blurb_text,
"", "",
"Wolfgang Hofer", "Wolfgang Hofer",
"Wolfgang Hofer", "Wolfgang Hofer",
"Dec. 1997", "Feb. 2000",
NULL, /* do not appear in menus */ NULL, /* do not appear in menus */
NULL, NULL,
PROC_EXTENSION, PROC_EXTENSION,
nargs_iter, nreturn_vals, nargs_iter, nreturn_vals,
args_iter, return_vals); args_iter, return_vals);
g_free(l_iter_proc_name);
g_free(l_blurb_text);
} }
void gap_query_iterators_ALT() void gap_query_iterators_ALT()
@ -706,18 +724,33 @@ gint gap_run_iterators_ALT(char *name, GRunModeType run_mode, gint32 total_steps
} }
l_name[l_cut] = '\0'; /* cut off "_Iterator_ALT" from l_name end */
l_rc = -1; l_rc = -1;
for(l_idx = 0; l_idx < MAX_ITER_ALT; l_idx++) l_name[l_cut] = '\0'; /* cut off "_Iterator_ALT" from l_name end */
/* allocate from/to plugin_data buffers
* as big as needed for the current plugin named l_name
*/
g_plugin_data_from = p_alloc_plugin_data(l_name);
g_plugin_data_to = p_alloc_plugin_data(l_name);
if((g_plugin_data_from != NULL)
&& (g_plugin_data_to != NULL))
{ {
if (strcmp (l_name, g_iter_ALT_tab[l_idx].proc_name) == 0) for(l_idx = 0; l_idx < MAX_ITER_ALT; l_idx++)
{ {
if(gap_debug) fprintf(stderr, "DEBUG: gap_run_iterators_ALT: FOUND %s\n", l_name); if (strcmp (l_name, g_iter_ALT_tab[l_idx].proc_name) == 0)
l_rc = (g_iter_ALT_tab[l_idx].proc_func)(run_mode, total_steps, current_step, len_struct); {
} if(gap_debug) printf("DEBUG: gap_run_iterators_ALT: FOUND %s\n", l_name);
l_rc = (g_iter_ALT_tab[l_idx].proc_func)(run_mode, total_steps, current_step, len_struct);
}
}
} }
if(l_rc < 0) fprintf(stderr, "ERROR: gap_run_iterators_ALT: NOT FOUND proc_name=%s (%s)\n", name, l_name); if(l_rc < 0) fprintf(stderr, "ERROR: gap_run_iterators_ALT: NOT FOUND proc_name=%s (%s)\n", name, l_name);
/* free from/to plugin_data buffers */
if(g_plugin_data_from) g_free(g_plugin_data_from);
if(g_plugin_data_to) g_free(g_plugin_data_to);
return l_rc; return l_rc;
} }

View File

@ -27,7 +27,9 @@
*/ */
/* revision history: /* revision history:
* version 0.97.00 hof: - created module (as extract gap_filter_foreach) * version gimp 1.1.17b 2000.02.22 hof: - removed limit PLUGIN_DATA_SIZE
* - removed support for old gimp 1.0.x PDB-interface.
* version 0.97.00 hof: - created module (as extract gap_filter_foreach)
*/ */
#include "config.h" #include "config.h"
@ -63,7 +65,7 @@
extern int gap_debug; extern int gap_debug;
static char g_plugin_data[PLUGIN_DATA_SIZE + 1]; static char *global_plugin_data = NULL;
static gint32 g_current_image_id; static gint32 g_current_image_id;
@ -215,76 +217,41 @@ p_save_xcf(gint32 image_id, char *sav_name)
* and check for the length of the retrieved data. * and check for the length of the retrieved data.
* if all done OK return the length of the retrieved data, * if all done OK return the length of the retrieved data,
* return -1 in case of errors. * return -1 in case of errors.
*
* RISK: this procedure may crash if the retrieved data
* is longer than PLUGIN_DATA_SIZE and gimp_get_data_size
* is not available
* (there was no way for a plugin to findout the length
* in older GIMP releases)
* ============================================================================ * ============================================================================
*/ */
gint p_get_data(char *key) gint p_get_data(char *key)
{ {
int l_len; int l_len;
#ifdef GIMP_HAVE_PROCEDURAL_DB_GET_DATA_SIZE
l_len = gimp_get_data_size (key); l_len = gimp_get_data_size (key);
if(l_len >= PLUGIN_DATA_SIZE)
{
fprintf(stderr, "ERROR: stored data too big Key %s (%d > %d)\n",
key, (int)l_len, (int)PLUGIN_DATA_SIZE);
return -1;
}
gimp_get_data(key, g_plugin_data);
#else
{
int l_l1, l_l2;
memset(g_plugin_data, 'X', PLUGIN_DATA_SIZE);
gimp_get_data(key, g_plugin_data);
for(l_l1 = PLUGIN_DATA_SIZE -1; l_l1 >= 0; l_l1--)
{
if (g_plugin_data[l_l1] != 'X' )
break;
}
memset(g_plugin_data, '\0', PLUGIN_DATA_SIZE);
gimp_get_data(key, g_plugin_data);
for(l_l2 = PLUGIN_DATA_SIZE -1; l_l2 >= 0; l_l2--)
{
if (g_plugin_data[l_l2] != '\0' )
break;
}
if(l_l1 > l_l2) l_len = l_l1;
else l_len = l_l2;
l_len++; /* length is index of last valid byte + 1 */
}
#endif
if(l_len < 1) if(l_len < 1)
{ {
fprintf(stderr, "ERROR: no stored data found for Key %s\n", key); fprintf(stderr, "ERROR: no stored data found for Key %s\n", key);
return -1; return -1;
} }
if(global_plugin_data)
{
g_free(global_plugin_data);
}
global_plugin_data = g_malloc0(l_len+1);
gimp_get_data(key, global_plugin_data);
if(gap_debug) fprintf(stderr, "DEBUG p_get_data Key:%s retrieved bytes %d\n", key, (int)l_len); if(gap_debug) printf("DEBUG p_get_data Key:%s retrieved bytes %d\n", key, (int)l_len);
return (l_len); return (l_len);
} }
/* ============================================================================ /* ============================================================================
* p_set_data * p_set_data
* *
* set g_plugin_data * set global_plugin_data
* ============================================================================ * ============================================================================
*/ */
void p_set_data(char *key, gint plugin_data_len) void p_set_data(char *key, gint plugin_data_len)
{ {
gimp_set_data(key, g_plugin_data, plugin_data_len); if(global_plugin_data)
{
gimp_set_data(key, global_plugin_data, plugin_data_len);
}
} }
/* ============================================================================ /* ============================================================================
@ -372,7 +339,7 @@ gint p_procedure_available(char *proc_name, t_proc_type ptype)
* p_get_iterator_proc * p_get_iterator_proc
* check the PDB for Iterator Procedures (suffix "_Iterator" or "_Iterator_ALT" * check the PDB for Iterator Procedures (suffix "_Iterator" or "_Iterator_ALT"
* return Pointer to the name of the Iterator Procedure * return Pointer to the name of the Iterator Procedure
* or NULL if not found (or malloc error) * or NULL if not found
* ============================================================================ * ============================================================================
*/ */
@ -381,28 +348,25 @@ char * p_get_iterator_proc(char *plugin_name)
char *l_plugin_iterator; char *l_plugin_iterator;
/* check for matching Iterator PluginProcedures */ /* check for matching Iterator PluginProcedures */
l_plugin_iterator = g_malloc(strlen(plugin_name) + strlen("_Iterator_ALT") +2); l_plugin_iterator = g_strdup_printf("%s_Iterator", plugin_name);
if(l_plugin_iterator != NULL)
{
sprintf(l_plugin_iterator, "%s_Iterator", plugin_name);
/* check if iterator is available in PDB */ /* check if iterator is available in PDB */
if(p_procedure_available(l_plugin_iterator, PTYP_ITERATOR) < 0)
{
g_free(l_plugin_iterator);
l_plugin_iterator = g_strdup_printf("%s_Iterator_ALT", plugin_name);
/* check for alternative Iterator _Iterator_ALT
* for now i made some Iterator Plugins using the ending _ALT,
* If New plugins were added or existing ones were updated
* the Authors should supply original _Iterator Procedures
* to be used instead of my Hacked versions without name conflicts.
*/
if(p_procedure_available(l_plugin_iterator, PTYP_ITERATOR) < 0) if(p_procedure_available(l_plugin_iterator, PTYP_ITERATOR) < 0)
{ {
sprintf(l_plugin_iterator, "%s_Iterator_ALT", plugin_name); /* both iterator names are not available */
g_free(l_plugin_iterator);
/* check for alternative Iterator _Iterator_ALT l_plugin_iterator = NULL;
* for now i made some Iterator Plugins using the ending _ALT,
* If New plugins were added or existing ones were updated
* the Authors should supply original _Iterator Procedures
* to be used instead of my Hacked versions without name conflicts.
*/
if(p_procedure_available(l_plugin_iterator, PTYP_ITERATOR) < 0)
{
/* both iterator names are not available */
g_free(l_plugin_iterator);
l_plugin_iterator = NULL;
}
} }
} }

View File

@ -26,11 +26,6 @@
#include "libgimp/gimp.h" #include "libgimp/gimp.h"
/* max buffer size for plugin' stored valus
*/
#define PLUGIN_DATA_SIZE 8192
typedef enum typedef enum
{ PTYP_ANY = 0, { PTYP_ANY = 0,
PTYP_ITERATOR = 1, PTYP_ITERATOR = 1,

View File

@ -28,6 +28,7 @@
*/ */
/* revision history: /* revision history:
* 1.1.17b; 2000/02/27 hof: bug/style fixes
* 1.1.14a; 1999/12/18 hof: handle .xvpics on fileops (copy, rename and delete) * 1.1.14a; 1999/12/18 hof: handle .xvpics on fileops (copy, rename and delete)
* new: p_get_frame_nr, * new: p_get_frame_nr,
* 1.1.9a; 1999/09/14 hof: handle frame filenames with framenumbers * 1.1.9a; 1999/09/14 hof: handle frame filenames with framenumbers
@ -96,8 +97,6 @@
#include "gap_exchange_image.h" #include "gap_exchange_image.h"
extern int gap_debug; /* ==0 ... dont print debug infos */ extern int gap_debug; /* ==0 ... dont print debug infos */
static char g_errtxt[1024]; /* buffer for current message- or errortext */
/* ------------------------------------------ */ /* ------------------------------------------ */
/* forward working procedures */ /* forward working procedures */
@ -536,14 +535,15 @@ char* p_alloc_extension(char *imagename)
*/ */
char* p_alloc_fname(char *basename, long nr, char *extension) char* p_alloc_fname(char *basename, long nr, char *extension)
{ {
char *l_fname; gchar *l_fname;
int l_leading_zeroes; gint l_leading_zeroes;
long l_nr_chk; gint l_len;
long l_nr_chk;
if(basename == NULL) return (NULL); if(basename == NULL) return (NULL);
l_fname = (char *)g_malloc(strlen(basename) + strlen(extension) + 8); l_len = (strlen(basename) + strlen(extension) + 10);
if(l_fname != NULL) l_fname = (char *)g_malloc(l_len);
{
l_leading_zeroes = TRUE; l_leading_zeroes = TRUE;
if(nr < 1000) if(nr < 1000)
{ {
@ -556,14 +556,14 @@ char* p_alloc_fname(char *basename, long nr, char *extension)
while(l_nr_chk >= 0) while(l_nr_chk >= 0)
{ {
/* check if frame is on disk with 4-digit style framenumber */ /* check if frame is on disk with 4-digit style framenumber */
sprintf(l_fname, "%s%04ld%s", basename, l_nr_chk, extension); g_snprintf(l_fname, l_len, "%s%04ld%s", basename, l_nr_chk, extension);
if (p_file_exists(l_fname)) if (p_file_exists(l_fname))
{ {
break; break;
} }
/* now check for filename without leading zeroes in the framenumber */ /* now check for filename without leading zeroes in the framenumber */
sprintf(l_fname, "%s%ld%s", basename, l_nr_chk, extension); g_snprintf(l_fname, l_len, "%s%ld%s", basename, l_nr_chk, extension);
if (p_file_exists(l_fname)) if (p_file_exists(l_fname))
{ {
l_leading_zeroes = FALSE; l_leading_zeroes = FALSE;
@ -586,9 +586,11 @@ char* p_alloc_fname(char *basename, long nr, char *extension)
l_leading_zeroes = FALSE; l_leading_zeroes = FALSE;
} }
if(l_leading_zeroes) sprintf(l_fname, "%s%04ld%s", basename, nr, extension); g_free(l_fname);
else sprintf(l_fname, "%s%ld%s", basename, nr, extension);
} if(l_leading_zeroes) l_fname = g_strdup_printf("%s%04ld%s", basename, nr, extension);
else l_fname = g_strdup_printf("%s%ld%s", basename, nr, extension);
return(l_fname); return(l_fname);
} /* end p_alloc_fname */ } /* end p_alloc_fname */
@ -617,8 +619,7 @@ t_anim_info *p_alloc_ainfo(gint32 image_id, GRunModeType run_mode)
l_ainfo_ptr->old_filename = gimp_image_get_filename(image_id); l_ainfo_ptr->old_filename = gimp_image_get_filename(image_id);
if(l_ainfo_ptr->old_filename == NULL) if(l_ainfo_ptr->old_filename == NULL)
{ {
l_ainfo_ptr->old_filename = g_malloc(30); l_ainfo_ptr->old_filename = g_strdup("frame_0001.xcf"); /* assign a defaultname */
sprintf(l_ainfo_ptr->old_filename, "frame_0001.xcf"); /* assign a defaultname */
gimp_image_set_filename (image_id, l_ainfo_ptr->old_filename); gimp_image_set_filename (image_id, l_ainfo_ptr->old_filename);
} }
@ -727,16 +728,16 @@ int p_dir_ainfo(t_anim_info *ainfo_ptr)
switch(l_dirflag) switch(l_dirflag)
{ {
case 0: case 0:
sprintf(dirname_buff, "%s", l_dp->d_name); g_snprintf(dirname_buff, sizeof(dirname_buff), "%s", l_dp->d_name);
break; break;
case 1: case 1:
sprintf(dirname_buff, "%c%s", G_DIR_SEPARATOR, l_dp->d_name); g_snprintf(dirname_buff, sizeof(dirname_buff), "%c%s", G_DIR_SEPARATOR, l_dp->d_name);
break; break;
default: default:
/* UNIX: "/dir/file" /* UNIX: "/dir/file"
* DOS: "drv:\dir\file" * DOS: "drv:\dir\file"
*/ */
sprintf(dirname_buff, "%s%c%s", l_dirname_ptr, G_DIR_SEPARATOR, l_dp->d_name); g_snprintf(dirname_buff, sizeof(dirname_buff), "%s%c%s", l_dirname_ptr, G_DIR_SEPARATOR, l_dp->d_name);
break; break;
} }
@ -923,21 +924,15 @@ int p_chk_framerange(t_anim_info *ainfo_ptr)
*/ */
char * p_gzip (char *orig_name, char *new_name, char *zip) char * p_gzip (char *orig_name, char *new_name, char *zip)
{ {
char* l_cmd; gchar* l_cmd;
char* l_tmpname; gchar* l_tmpname;
int l_rc, l_rc2; gint l_rc, l_rc2;
if(zip == NULL) return NULL; if(zip == NULL) return NULL;
l_cmd = NULL; l_cmd = NULL;
l_tmpname = new_name; l_tmpname = new_name;
l_cmd = g_malloc((strlen(l_tmpname) + strlen(orig_name) + 20));
if(l_cmd == NULL)
{
return NULL;
}
/* used gzip options: /* used gzip options:
* -c --stdout --to-stdout * -c --stdout --to-stdout
* Write output on standard output * Write output on standard output
@ -949,11 +944,11 @@ char * p_gzip (char *orig_name, char *new_name, char *zip)
if(*zip == 'u') if(*zip == 'u')
{ {
sprintf(l_cmd, "gzip -cfd <\"%s\" >\"%s\"", orig_name, l_tmpname); l_cmd = g_strdup_printf("gzip -cfd <\"%s\" >\"%s\"", orig_name, l_tmpname);
} }
else else
{ {
sprintf(l_cmd, "gzip -cf <\"%s\" >\"%s\"", orig_name, l_tmpname); l_cmd = g_strdup_printf("gzip -cf <\"%s\" >\"%s\"", orig_name, l_tmpname);
} }
if(gap_debug) fprintf(stderr, "system: %s\n", l_cmd); if(gap_debug) fprintf(stderr, "system: %s\n", l_cmd);
@ -999,8 +994,8 @@ int p_decide_save_as(gint32 image_id, char *sav_name)
l_msg = _("You are using a file format != xcf\nSave Operations may result\nin loss of layer information"); l_msg = _("You are using a file format != xcf\nSave Operations may result\nin loss of layer information");
/* 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;
/* sprintf(l_save_as_name, "plug_in_gap_plugins_SAVE_AS_MODE_%d", (int)image_id);*/ /* g_snprintf(l_save_as_name, sizeof(l_save_as_name), "plug_in_gap_plugins_SAVE_AS_MODE_%d", (int)image_id);*/
sprintf(l_save_as_name, "plug_in_gap_plugins_SAVE_AS_MODE"); g_snprintf(l_save_as_name, sizeof(l_save_as_name), "plug_in_gap_plugins_SAVE_AS_MODE");
gimp_get_data (l_save_as_name, &l_save_as_mode); gimp_get_data (l_save_as_name, &l_save_as_mode);
if(l_save_as_mode == -1) if(l_save_as_mode == -1)
@ -1146,12 +1141,7 @@ int p_save_named_frame(gint32 image_id, char *sav_name)
* that resides on the same filesystem as sav_name * that resides on the same filesystem as sav_name
* and has the same extension as the original sav_name * and has the same extension as the original sav_name
*/ */
l_tmpname = (char *)g_malloc(strlen(sav_name) + strlen(".gtmp") + strlen(l_ext) +2); l_tmpname = g_strdup_printf("%s.gtmp%s", sav_name, l_ext);
if(l_tmpname == NULL)
{
return -1;
}
sprintf(l_tmpname, "%s.gtmp%s", sav_name, l_ext);
if(1 == p_file_exists(l_tmpname)) if(1 == p_file_exists(l_tmpname))
{ {
/* FILE exists: let gimp find another temp name */ /* FILE exists: let gimp find another temp name */
@ -1485,9 +1475,12 @@ int p_del(t_anim_info *ainfo_ptr, long cnt)
{ {
if(0 != p_rename_frame(ainfo_ptr, l_hi, l_lo)) if(0 != p_rename_frame(ainfo_ptr, l_hi, l_lo))
{ {
sprintf(g_errtxt, "Error: could not rename frame %ld to %ld\n" gchar *tmp_errtxt;
tmp_errtxt = g_strdup_printf(_("Error: could not rename frame %ld to %ld\n")
, l_hi, l_lo); , l_hi, l_lo);
p_msg_win(ainfo_ptr->run_mode, g_errtxt); p_msg_win(ainfo_ptr->run_mode, tmp_errtxt);
g_free(tmp_errtxt);
return -1; return -1;
} }
l_lo++; l_lo++;
@ -1598,12 +1591,13 @@ int p_dup(t_anim_info *ainfo_ptr, long cnt, long range_from, long range_to)
l_lo = ainfo_ptr->last_frame_nr; l_lo = ainfo_ptr->last_frame_nr;
l_hi = l_lo + l_cnt2; l_hi = l_lo + l_cnt2;
while(l_lo > l_src_nr_max) while(l_lo > l_src_nr_max)
{ {
sprintf(g_errtxt, "BEFORE rename frame %ld to %ld\n", l_lo, l_hi);
if(0 != p_rename_frame(ainfo_ptr, l_lo, l_hi)) if(0 != p_rename_frame(ainfo_ptr, l_lo, l_hi))
{ {
sprintf(g_errtxt, "Error: could not rename frame %ld to %ld\n", l_lo, l_hi); gchar *tmp_errtxt;
p_msg_win(ainfo_ptr->run_mode, g_errtxt); tmp_errtxt = g_strdup_printf(_("Error: could not rename frame %ld to %ld\n"), l_lo, l_hi);
p_msg_win(ainfo_ptr->run_mode, tmp_errtxt);
g_free(tmp_errtxt);
return -1; return -1;
} }
l_lo--; l_lo--;
@ -1666,6 +1660,7 @@ int p_dup(t_anim_info *ainfo_ptr, long cnt, long range_from, long range_to)
int p_exchg(t_anim_info *ainfo_ptr, long dest) int p_exchg(t_anim_info *ainfo_ptr, long dest)
{ {
long l_tmp_nr; long l_tmp_nr;
gchar *tmp_errtxt;
l_tmp_nr = ainfo_ptr->last_frame_nr + 4; /* use a free frame_nr for temp name */ l_tmp_nr = ainfo_ptr->last_frame_nr + 4; /* use a free frame_nr for temp name */
@ -1679,20 +1674,23 @@ int p_exchg(t_anim_info *ainfo_ptr, long dest)
/* rename (renumber) frames */ /* rename (renumber) frames */
if(0 != p_rename_frame(ainfo_ptr, dest, l_tmp_nr)) if(0 != p_rename_frame(ainfo_ptr, dest, l_tmp_nr))
{ {
sprintf(g_errtxt, "Error: could not rename frame %ld to %ld\n", dest, l_tmp_nr); tmp_errtxt = g_strdup_printf(_("Error: could not rename frame %ld to %ld\n"), dest, l_tmp_nr);
p_msg_win(ainfo_ptr->run_mode, g_errtxt); p_msg_win(ainfo_ptr->run_mode, tmp_errtxt);
g_free(tmp_errtxt);
return -1; return -1;
} }
if(0 != p_rename_frame(ainfo_ptr, ainfo_ptr->curr_frame_nr, dest)) if(0 != p_rename_frame(ainfo_ptr, ainfo_ptr->curr_frame_nr, dest))
{ {
sprintf(g_errtxt, "Error: could not rename frame %ld to %ld\n", ainfo_ptr->curr_frame_nr, dest); tmp_errtxt = g_strdup_printf(_("Error: could not rename frame %ld to %ld\n"), ainfo_ptr->curr_frame_nr, dest);
p_msg_win(ainfo_ptr->run_mode, g_errtxt); p_msg_win(ainfo_ptr->run_mode, tmp_errtxt);
g_free(tmp_errtxt);
return -1; return -1;
} }
if(0 != p_rename_frame(ainfo_ptr, l_tmp_nr, ainfo_ptr->curr_frame_nr)) if(0 != p_rename_frame(ainfo_ptr, l_tmp_nr, ainfo_ptr->curr_frame_nr))
{ {
sprintf(g_errtxt, "Error: could not rename frame %ld to %ld\n", l_tmp_nr, ainfo_ptr->curr_frame_nr); tmp_errtxt = g_strdup_printf(_("Error: could not rename frame %ld to %ld\n"), l_tmp_nr, ainfo_ptr->curr_frame_nr);
p_msg_win(ainfo_ptr->run_mode, g_errtxt); p_msg_win(ainfo_ptr->run_mode, tmp_errtxt);
g_free(tmp_errtxt);
return -1; return -1;
} }
@ -1720,7 +1718,9 @@ p_shift(t_anim_info *ainfo_ptr, long cnt, long range_from, long range_to)
long l_lo, l_hi, l_curr, l_dst; long l_lo, l_hi, l_curr, l_dst;
long l_upper; long l_upper;
long l_shift; long l_shift;
char *l_curr_name; gchar *l_curr_name;
gchar *tmp_errtxt;
gdouble l_percentage, l_percentage_step; gdouble l_percentage, l_percentage_step;
if(gap_debug) fprintf(stderr, "DEBUG p_shift fr:%d to:%d cnt:%d\n", if(gap_debug) fprintf(stderr, "DEBUG p_shift fr:%d to:%d cnt:%d\n",
@ -1771,8 +1771,9 @@ p_shift(t_anim_info *ainfo_ptr, long cnt, long range_from, long range_to)
{ {
if(0 != p_rename_frame(ainfo_ptr, l_curr, l_curr + l_upper)) if(0 != p_rename_frame(ainfo_ptr, l_curr, l_curr + l_upper))
{ {
sprintf(g_errtxt, "Error: could not rename frame %ld to %ld\n", l_lo, l_hi); tmp_errtxt = g_strdup_printf(_("Error: could not rename frame %ld to %ld\n"), l_lo, l_hi);
p_msg_win(ainfo_ptr->run_mode, g_errtxt); p_msg_win(ainfo_ptr->run_mode, tmp_errtxt);
g_free(tmp_errtxt);
return -1; return -1;
} }
if(ainfo_ptr->run_mode == RUN_INTERACTIVE) if(ainfo_ptr->run_mode == RUN_INTERACTIVE)
@ -1792,8 +1793,9 @@ p_shift(t_anim_info *ainfo_ptr, long cnt, long range_from, long range_to)
if (l_dst > l_hi) { l_dst = l_lo; } if (l_dst > l_hi) { l_dst = l_lo; }
if(0 != p_rename_frame(ainfo_ptr, l_curr, l_dst)) if(0 != p_rename_frame(ainfo_ptr, l_curr, l_dst))
{ {
sprintf(g_errtxt, "Error: could not rename frame %ld to %ld\n", l_lo, l_hi); tmp_errtxt = g_strdup_printf(_("Error: could not rename frame %ld to %ld\n"), l_lo, l_hi);
p_msg_win(ainfo_ptr->run_mode, g_errtxt); p_msg_win(ainfo_ptr->run_mode, tmp_errtxt);
g_free(tmp_errtxt);
return -1; return -1;
} }
if(ainfo_ptr->run_mode == RUN_INTERACTIVE) if(ainfo_ptr->run_mode == RUN_INTERACTIVE)
@ -2103,6 +2105,8 @@ int p_dup_dialog(t_anim_info *ainfo_ptr, long *range_from, long *range_to)
argv[2].int_min = 0; argv[2].int_min = 0;
argv[2].int_max = 99; argv[2].int_max = 99;
argv[2].int_ret = 1; argv[2].int_ret = 1;
argv[2].umin = 0;
argv[2].umax = 9999;
argv[2].help_txt = _("Copy selected Range n-times \n(you may type in Values > 99)"); argv[2].help_txt = _("Copy selected Range n-times \n(you may type in Values > 99)");
if(TRUE == p_array_dialog(l_title, _("Duplicate Framerange"), 3, argv)) if(TRUE == p_array_dialog(l_title, _("Duplicate Framerange"), 3, argv))
@ -2274,7 +2278,7 @@ int p_shift_dialog(t_anim_info *ainfo_ptr, long *range_from, long *range_to)
p_init_arr_arg(&argv[2], WGT_INT_PAIR); p_init_arr_arg(&argv[2], WGT_INT_PAIR);
argv[2].label_txt = _("N-Shift :"); argv[2].label_txt = _("N-Shift :");
argv[2].constraint = FALSE; argv[2].constraint = TRUE;
argv[2].int_min = -1 * (gint)ainfo_ptr->last_frame_nr; argv[2].int_min = -1 * (gint)ainfo_ptr->last_frame_nr;
argv[2].int_max = (gint)ainfo_ptr->last_frame_nr; argv[2].int_max = (gint)ainfo_ptr->last_frame_nr;
argv[2].int_ret = 1; argv[2].int_ret = 1;

View File

@ -30,6 +30,10 @@
*/ */
/* revision history: /* revision history:
* gimp 1.1.17b; 2000/02/23 hof: bugfix: dont flatten the preview, just merge visible layers
* bugfix: for current frame never use diskfile for the preview
* (to avoid inconsitencies, and to speed up a little)
* added "Show Path", pick and drag Controlpoints
* gimp 1.1.17a; 2000/02/20 hof: use gimp_help_set_help_data for tooltips * gimp 1.1.17a; 2000/02/20 hof: use gimp_help_set_help_data for tooltips
* added spinbuttons, and more layout cosmetics. * added spinbuttons, and more layout cosmetics.
* gimp 1.1.15a; 2000/01/26 hof: removed gimp 1.0.x support * gimp 1.1.15a; 2000/01/26 hof: removed gimp 1.0.x support
@ -77,19 +81,21 @@
extern int gap_debug; /* ==0 ... dont print debug infos */ extern int gap_debug; /* ==0 ... dont print debug infos */
#define POINT_FILE_MAXLEN 512
#define ENTRY_WIDTH 60 #define ENTRY_WIDTH 60
#define SCALE_WIDTH 125 #define SCALE_WIDTH 125
#define PREVIEW_SIZE 256 #define PREVIEW_SIZE 256
#define RADIUS 3
#define PREVIEW 0x1 #define PREVIEW 0x1
#define CURSOR 0x2 #define CURSOR 0x2
#define ALL 0xf #define PATH_LINE 0x4
#define ALL 0xf
/* event masks for the preview widget */
#define PREVIEW_MASK GDK_EXPOSURE_MASK | \ #define PREVIEW_MASK GDK_EXPOSURE_MASK | \
GDK_BUTTON_PRESS_MASK | \ GDK_BUTTON_PRESS_MASK |\
GDK_BUTTON1_MOTION_MASK GDK_BUTTON_RELEASE_MASK |\
GDK_BUTTON_MOTION_MASK
#define LABEL_LENGTH 256 #define LABEL_LENGTH 256
@ -110,6 +116,10 @@ typedef struct
gint dwidth, dheight; gint dwidth, dheight;
gint bpp; gint bpp;
GtkWidget *preview; GtkWidget *preview;
GPixelRgn src_rgn;
gint PixelRgnIsInitialized;
gint show_path;
gint startup;
gint pwidth, pheight; gint pwidth, pheight;
gint cursor; gint cursor;
@ -155,7 +165,7 @@ struct _MenuItem
{ {
char *label; char *label;
char unused_accelerator_key; char unused_accelerator_key;
int unused_accelerator_mods; gint unused_accelerator_mods;
MenuItemCallback callback; MenuItemCallback callback;
gpointer user_data; gpointer user_data;
MenuItem *unused_subitems; MenuItem *unused_subitems;
@ -171,6 +181,7 @@ static void p_update_point_labels (t_mov_path_preview *path_ptr);
static void p_points_from_tab (t_mov_path_preview *path_ptr); static void p_points_from_tab (t_mov_path_preview *path_ptr);
static void p_points_to_tab (t_mov_path_preview *path_ptr); static void p_points_to_tab (t_mov_path_preview *path_ptr);
static void p_point_refresh (t_mov_path_preview *path_ptr); static void p_point_refresh (t_mov_path_preview *path_ptr);
static void p_pick_nearest_point (gint px, gint py);
static void p_reset_points (); static void p_reset_points ();
static void p_clear_point (); static void p_clear_point ();
static void p_load_points (char *filename); static void p_load_points (char *filename);
@ -218,7 +229,8 @@ static void mov_imglayer_menu_callback (gint32 id, gpointer data);
static void mov_paintmode_menu_callback (GtkWidget *, gpointer); static void mov_paintmode_menu_callback (GtkWidget *, gpointer);
static void mov_handmode_menu_callback (GtkWidget *, gpointer); static void mov_handmode_menu_callback (GtkWidget *, gpointer);
static void mov_stepmode_menu_callback (GtkWidget *, gpointer); static void mov_stepmode_menu_callback (GtkWidget *, gpointer);
static void mov_clip_to_img_callback (GtkWidget *, gpointer); static void mov_gint_toggle_callback (GtkWidget *, gpointer);
static void mov_show_path_callback (GtkWidget *, gpointer);
/* the option menu items -- the paint modes */ /* the option menu items -- the paint modes */
@ -290,24 +302,26 @@ long p_move_dialog (t_mov_data *mov_ptr)
gint l_first, l_last; gint l_first, l_last;
char *l_str; char *l_str;
t_mov_path_preview *path_ptr; t_mov_path_preview *path_ptr;
static char l_pointfile_name[POINT_FILE_MAXLEN];
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_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;
path_ptr = g_new( t_mov_path_preview, 1 ); path_ptr = g_new( t_mov_path_preview, 1 );
if(path_ptr == NULL) if(path_ptr == NULL)
{ {
printf("error cant alloc path_preview structure\n"); printf("error cant alloc path_preview structure\n");
return -1; return -1;
} }
path_ptr->show_path = TRUE;
path_ptr->startup = TRUE;
path_ptr->PixelRgnIsInitialized = FALSE;
pvals = mov_ptr->val_ptr;
l_str = p_strdup_del_underscore(mov_ptr->dst_ainfo_ptr->basename);
path_ptr->pointfile_name = g_strdup_printf("%s.path_points", l_str);
g_free(l_str);
l_first = mov_ptr->dst_ainfo_ptr->first_frame_nr; l_first = mov_ptr->dst_ainfo_ptr->first_frame_nr;
l_last = mov_ptr->dst_ainfo_ptr->last_frame_nr; l_last = mov_ptr->dst_ainfo_ptr->last_frame_nr;
@ -336,7 +350,6 @@ long p_move_dialog (t_mov_data *mov_ptr)
path_ptr->preview_frame_nr = mov_ptr->dst_ainfo_ptr->curr_frame_nr; path_ptr->preview_frame_nr = mov_ptr->dst_ainfo_ptr->curr_frame_nr;
path_ptr->old_preview_frame_nr = path_ptr->preview_frame_nr; path_ptr->old_preview_frame_nr = path_ptr->preview_frame_nr;
path_ptr->PointIndex_LabelPtr = NULL; path_ptr->PointIndex_LabelPtr = NULL;
path_ptr->pointfile_name = l_pointfile_name;
p_points_from_tab(path_ptr); p_points_from_tab(path_ptr);
p_update_point_labels(path_ptr); p_update_point_labels(path_ptr);
@ -558,8 +571,8 @@ mov_dialog ( GDrawable *drawable, t_mov_path_preview *path_ptr,
/* toggle clip_to_image */ /* toggle clip_to_image */
check_button = gtk_check_button_new_with_label ( _("Clip To Frame")); check_button = gtk_check_button_new_with_label ( _("Clip To Frame"));
gtk_signal_connect (GTK_OBJECT (check_button), "toggled", gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
(GtkSignalFunc) mov_clip_to_img_callback, (GtkSignalFunc) mov_gint_toggle_callback,
path_ptr); &pvals->clip_to_img);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button), pvals->clip_to_img); gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button), pvals->clip_to_img);
gimp_help_set_help_data(check_button, gimp_help_set_help_data(check_button,
_("Clip all copied Src-Layers\nat Frame Boundaries") _("Clip all copied Src-Layers\nat Frame Boundaries")
@ -571,6 +584,8 @@ mov_dialog ( GDrawable *drawable, t_mov_path_preview *path_ptr,
gtk_widget_show (table); gtk_widget_show (table);
gtk_widget_show (dlg); gtk_widget_show (dlg);
path_ptr->startup = FALSE;
gtk_main (); gtk_main ();
gdk_flush (); gdk_flush ();
@ -647,8 +662,15 @@ mov_upvw_callback (GtkWidget *widget,
path_ptr->ainfo_ptr->extension); path_ptr->ainfo_ptr->extension);
if(l_filename != NULL) if(l_filename != NULL)
{ {
/* replace the temporary image */ /* replace the temporary image */
l_new_tmp_image_id = p_load_image(l_filename); if(path_ptr->preview_frame_nr == path_ptr->ainfo_ptr->curr_frame_nr)
{
l_new_tmp_image_id = p_gimp_channel_ops_duplicate(path_ptr->ainfo_ptr->image_id);
}
else
{
l_new_tmp_image_id = p_load_image(l_filename);
}
g_free(l_filename); g_free(l_filename);
if (l_new_tmp_image_id >= 0) if (l_new_tmp_image_id >= 0)
{ {
@ -666,6 +688,7 @@ mov_upvw_callback (GtkWidget *widget,
path_ptr->old_preview_frame_nr = path_ptr->preview_frame_nr; path_ptr->old_preview_frame_nr = path_ptr->preview_frame_nr;
gtk_widget_draw(path_ptr->preview, NULL); gtk_widget_draw(path_ptr->preview, NULL);
mov_path_prevw_draw ( path_ptr, CURSOR | PATH_LINE );
gdk_flush(); gdk_flush();
/* destroy the old tmp image */ /* destroy the old tmp image */
@ -936,13 +959,14 @@ p_points_load_from_file (GtkWidget *widget,
gpointer data) gpointer data)
{ {
t_mov_path_preview *path_ptr = data; t_mov_path_preview *path_ptr = data;
char *filename; gchar *filename;
if(gap_debug) printf("p_points_load_from_file\n"); if(gap_debug) printf("p_points_load_from_file\n");
if(path_ptr->filesel == NULL) return; if(path_ptr->filesel == NULL) return;
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (path_ptr->filesel)); filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (path_ptr->filesel));
strncpy(path_ptr->pointfile_name, filename, POINT_FILE_MAXLEN -1); g_free(path_ptr->pointfile_name);
path_ptr->pointfile_name = g_strdup(filename);
if(gap_debug) printf("p_points_load_from_file %s\n", path_ptr->pointfile_name); if(gap_debug) printf("p_points_load_from_file %s\n", path_ptr->pointfile_name);
@ -965,7 +989,8 @@ p_points_save_to_file (GtkWidget *widget,
if(path_ptr->filesel == NULL) return; if(path_ptr->filesel == NULL) return;
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (path_ptr->filesel)); filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (path_ptr->filesel));
strncpy(path_ptr->pointfile_name, filename, POINT_FILE_MAXLEN -1); g_free(path_ptr->pointfile_name);
path_ptr->pointfile_name = g_strdup(filename);
if(gap_debug) printf("p_points_save_to_file %s\n", path_ptr->pointfile_name); if(gap_debug) printf("p_points_save_to_file %s\n", path_ptr->pointfile_name);
@ -978,7 +1003,8 @@ p_points_save_to_file (GtkWidget *widget,
} }
static void p_point_refresh(t_mov_path_preview *path_ptr) static void
p_point_refresh(t_mov_path_preview *path_ptr)
{ {
p_points_from_tab(path_ptr); p_points_from_tab(path_ptr);
p_update_point_labels(path_ptr); p_update_point_labels(path_ptr);
@ -987,27 +1013,70 @@ static void p_point_refresh(t_mov_path_preview *path_ptr)
if( !path_ptr->in_call ) if( !path_ptr->in_call )
{ {
mov_path_prevw_cursor_update( path_ptr ); mov_path_prevw_cursor_update( path_ptr );
mov_path_prevw_draw ( path_ptr, CURSOR ); mov_path_prevw_draw ( path_ptr, CURSOR | PATH_LINE );
path_ptr->in_call = TRUE;
gtk_adjustment_set_value (path_ptr->x_adj,
(gfloat)path_ptr->p_x);
gtk_adjustment_set_value (path_ptr->y_adj,
(gfloat)path_ptr->p_y);
gtk_adjustment_set_value (path_ptr->wres_adj,
(gfloat)path_ptr->w_resize);
gtk_adjustment_set_value (path_ptr->hres_adj,
(gfloat)path_ptr->h_resize);
gtk_adjustment_set_value (path_ptr->opacity_adj,
(gfloat)path_ptr->opacity);
gtk_adjustment_set_value (path_ptr->rotation_adj,
(gfloat)path_ptr->rotation);
path_ptr->in_call = FALSE;
} }
path_ptr->in_call = TRUE;
gtk_adjustment_set_value (path_ptr->x_adj,
(gfloat)path_ptr->p_x);
gtk_adjustment_set_value (path_ptr->y_adj,
(gfloat)path_ptr->p_y);
gtk_adjustment_set_value (path_ptr->wres_adj,
(gfloat)path_ptr->w_resize);
gtk_adjustment_set_value (path_ptr->hres_adj,
(gfloat)path_ptr->h_resize);
gtk_adjustment_set_value (path_ptr->opacity_adj,
(gfloat)path_ptr->opacity);
gtk_adjustment_set_value (path_ptr->rotation_adj,
(gfloat)path_ptr->rotation);
path_ptr->in_call = FALSE;
} /* end p_point_refresh */ } /* end p_point_refresh */
static void
p_pick_nearest_point(gint px, gint py)
{
gint l_idx;
gint l_idx_min;
gdouble l_sq_dist;
gdouble l_dx, l_dy;
gdouble l_sq_dist_min;
l_idx_min = 0;
l_sq_dist_min = G_MAXDOUBLE;
if(gap_debug) printf("\np_pick_nearest_point: near to %4d %4d\n", (int)px, (int)py);
for(l_idx = pvals->point_idx_max; l_idx >= 0; l_idx--)
{
/* calculate x and y distance */
l_dx = pvals->point[l_idx].p_x - px;
l_dy = pvals->point[l_idx].p_y - py;
/* calculate square of the distance */
l_sq_dist = (l_dx * l_dx) + (l_dy * l_dy);
if(l_sq_dist < l_sq_dist_min)
{
l_sq_dist_min = l_sq_dist;
l_idx_min = l_idx;
}
if(gap_debug)
{
printf(" [%2d] %4d %4d %f\n",
(int)l_idx,
(int)pvals->point[l_idx].p_x,
(int)pvals->point[l_idx].p_y,
(float)l_sq_dist
);
}
}
if(gap_debug) printf("p_pick_nearest_point: selected %d\n", (int)l_idx_min);
pvals->point_idx = l_idx_min;
pvals->point[pvals->point_idx].p_x = px;
pvals->point[pvals->point_idx].p_y = py;
} /* end p_pick_nearest_point */
static void static void
@ -1055,34 +1124,57 @@ mov_imglayer_constrain(gint32 image_id, gint32 drawable_id, gpointer data)
static void static void
mov_paintmode_menu_callback (GtkWidget *w, gpointer client_data) mov_paintmode_menu_callback (GtkWidget *w, gpointer client_data)
{ {
pvals->src_paintmode = (int)client_data; pvals->src_paintmode = (gint)client_data;
} }
static void static void
mov_handmode_menu_callback (GtkWidget *w, gpointer client_data) mov_handmode_menu_callback (GtkWidget *w, gpointer client_data)
{ {
pvals->src_handle = (int)client_data; pvals->src_handle = (gint)client_data;
} }
static void static void
mov_stepmode_menu_callback (GtkWidget *w, gpointer client_data) mov_stepmode_menu_callback (GtkWidget *w, gpointer client_data)
{ {
pvals->src_stepmode = (int)client_data; pvals->src_stepmode = (gint)client_data;
} }
static void static void
mov_clip_to_img_callback(GtkWidget *w, gpointer client_data) mov_gint_toggle_callback(GtkWidget *w, gpointer client_data)
{ {
gint *data;
data = (gint*)client_data;
if (GTK_TOGGLE_BUTTON (w)->active) if (GTK_TOGGLE_BUTTON (w)->active)
{ {
pvals->clip_to_img = 1; *data = 1;
} }
else else
{ {
pvals->clip_to_img = 0; *data = 0;
} }
} }
static void
mov_show_path_callback(GtkWidget *widget, gpointer client_data)
{
t_mov_path_preview *path_ptr;
path_ptr = (t_mov_path_preview *)client_data;
mov_gint_toggle_callback(widget, &path_ptr->show_path);
if(path_ptr == NULL) return;
if(path_ptr->startup) return;
if(path_ptr->preview == NULL) return;
if(path_ptr->drawable == NULL) return;
p_point_refresh(path_ptr);
mov_path_prevw_draw ( path_ptr, CURSOR | PATH_LINE );
gtk_widget_draw(path_ptr->preview, NULL);
gdk_flush();
}
/* ============================================================================ /* ============================================================================
* procedures to handle POINTS - TABLE * procedures to handle POINTS - TABLE
* ============================================================================ * ============================================================================
@ -1109,9 +1201,10 @@ p_points_to_tab(t_mov_path_preview *path_ptr)
pvals->point[pvals->point_idx].rotation = path_ptr->rotation; pvals->point[pvals->point_idx].rotation = path_ptr->rotation;
} }
void p_update_point_labels(t_mov_path_preview *path_ptr) void
p_update_point_labels(t_mov_path_preview *path_ptr)
{ {
g_snprintf (&path_ptr->PointIndex_Label[0], LABEL_LENGTH, _("Current Point: [ %d ] of [ %d ]"), g_snprintf (&path_ptr->PointIndex_Label[0], LABEL_LENGTH, _("Current Point: [ %3d ] of [ %3d ]"),
pvals->point_idx + 1, pvals->point_idx_max +1); pvals->point_idx + 1, pvals->point_idx_max +1);
if(NULL != path_ptr->PointIndex_LabelPtr) if(NULL != path_ptr->PointIndex_LabelPtr)
@ -1128,13 +1221,11 @@ void p_update_point_labels(t_mov_path_preview *path_ptr)
*/ */
void p_clear_point() void p_clear_point()
{ {
int l_idx; gint l_idx;
l_idx = pvals->point_idx; l_idx = pvals->point_idx;
if((l_idx >= 0) && (l_idx <= pvals->point_idx_max)) if((l_idx >= 0) && (l_idx <= pvals->point_idx_max))
{ {
pvals->point[l_idx].p_x = 0;
pvals->point[l_idx].p_y = 0;
pvals->point[l_idx].opacity = 100; /* 100 percent (no transparecy) */ pvals->point[l_idx].opacity = 100; /* 100 percent (no transparecy) */
pvals->point[l_idx].w_resize = 100; /* 100% no resizize (1:1) */ pvals->point[l_idx].w_resize = 100; /* 100% no resizize (1:1) */
pvals->point[l_idx].h_resize = 100; /* 100% no resizize (1:1) */ pvals->point[l_idx].h_resize = 100; /* 100% no resizize (1:1) */
@ -1147,6 +1238,8 @@ void p_reset_points()
pvals->point_idx = 0; /* 0 == current point */ pvals->point_idx = 0; /* 0 == current point */
pvals->point_idx_max = 0; /* 0 == there is only one valid point */ pvals->point_idx_max = 0; /* 0 == there is only one valid point */
p_clear_point(); p_clear_point();
pvals->point[0].p_x = 0;
pvals->point[0].p_y = 0;
} /* end p_reset_points */ } /* end p_reset_points */
/* ============================================================================ /* ============================================================================
@ -1161,11 +1254,11 @@ void p_load_points(char *filename)
#define POINT_REC_MAX 128 #define POINT_REC_MAX 128
FILE *l_fp; FILE *l_fp;
int l_idx; gint l_idx;
char l_buff[POINT_REC_MAX +1 ]; char l_buff[POINT_REC_MAX +1 ];
char *l_ptr; char *l_ptr;
int l_cnt; gint l_cnt;
int l_v1, l_v2, l_v3, l_v4, l_v5, l_v6; gint l_v1, l_v2, l_v3, l_v4, l_v5, l_v6;
if(filename == NULL) return; if(filename == NULL) return;
@ -1225,7 +1318,7 @@ void p_load_points(char *filename)
void p_save_points(char *filename) void p_save_points(char *filename)
{ {
FILE *l_fp; FILE *l_fp;
int l_idx; gint l_idx;
if(filename == NULL) return; if(filename == NULL) return;
@ -1271,7 +1364,7 @@ mov_src_sel_create()
GtkWidget *option_menu; GtkWidget *option_menu;
GtkWidget *menu; GtkWidget *menu;
GtkWidget *label; GtkWidget *label;
int gettextize_loop; gint gettextize_loop;
frame = gtk_frame_new ( _("Source Select") ); frame = gtk_frame_new ( _("Source Select") );
@ -1417,6 +1510,7 @@ mov_path_prevw_create ( GDrawable *drawable, t_mov_path_preview *path_ptr)
GtkWidget *button_table; GtkWidget *button_table;
GtkWidget *pv_table; GtkWidget *pv_table;
GtkWidget *button; GtkWidget *button;
GtkWidget *check_button;
GtkObject *adj; GtkObject *adj;
gint row; gint row;
@ -1618,8 +1712,8 @@ mov_path_prevw_create ( GDrawable *drawable, t_mov_path_preview *path_ptr)
/* the PointIndex label */ /* the PointIndex label */
label = gtk_label_new ( &path_ptr->PointIndex_Label[0] ); /* "Current Point: 1" */ label = gtk_label_new ( &path_ptr->PointIndex_Label[0] ); /* "Current Point: 1" */
gtk_misc_set_alignment( GTK_MISC(label), 0.0, 0.5 ); gtk_misc_set_alignment( GTK_MISC(label), 0.0, 0.5 );
gtk_table_attach( GTK_TABLE(button_table), label, 0, 1, row, row+1, gtk_table_attach( GTK_TABLE(button_table), label, 0, 2, row, row+1,
0, 0, 0, 0 ); GTK_FILL, 0, 4, 0 );
gtk_widget_show(label); gtk_widget_show(label);
path_ptr->PointIndex_LabelPtr = label; /* store label ptr for later update */ path_ptr->PointIndex_LabelPtr = label; /* store label ptr for later update */
@ -1637,6 +1731,21 @@ mov_path_prevw_create ( GDrawable *drawable, t_mov_path_preview *path_ptr)
, NULL); , NULL);
gtk_widget_show (button); gtk_widget_show (button);
/* toggle clip_to_image */
check_button = gtk_check_button_new_with_label ( _("Show Path"));
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
(GtkSignalFunc) mov_show_path_callback,
path_ptr);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button), path_ptr->show_path);
gimp_help_set_help_data(check_button,
_("Show Path Lines and enable\n"
"pick/drag with left button\n"
"or move with right button")
, NULL);
gtk_widget_show (check_button);
gtk_table_attach(GTK_TABLE(button_table), check_button, 1, 2, row, row+1,
0, 0, 0, 0);
row++; row++;
button = gtk_button_new_with_label ( _("Insert Point")); button = gtk_button_new_with_label ( _("Insert Point"));
@ -1801,23 +1910,14 @@ static void render_preview ( GtkWidget *preview, GPixelRgn *srcrgn );
* Draw the contents into the internal buffer of the preview widget * Draw the contents into the internal buffer of the preview widget
* ============================================================================ * ============================================================================
*/ */
static void static void
mov_path_prevw_preview_init ( t_mov_path_preview *path_ptr ) mov_path_prevw_preview_init ( t_mov_path_preview *path_ptr )
{ {
GtkWidget *preview; gimp_pixel_rgn_init ( &path_ptr->src_rgn, path_ptr->drawable, 0, 0,
GPixelRgn src_rgn;
gint dwidth, dheight, pwidth, pheight, bpp;
preview = path_ptr->preview;
dwidth = path_ptr->dwidth;
dheight = path_ptr->dheight;
pwidth = path_ptr->pwidth;
pheight = path_ptr->pheight;
bpp = path_ptr->bpp;
gimp_pixel_rgn_init ( &src_rgn, path_ptr->drawable, 0, 0,
path_ptr->dwidth, path_ptr->dheight, FALSE, FALSE ); path_ptr->dwidth, path_ptr->dheight, FALSE, FALSE );
render_preview( path_ptr->preview, &src_rgn ); path_ptr->PixelRgnIsInitialized = TRUE;
render_preview( path_ptr->preview, &path_ptr->src_rgn );
} }
@ -1827,7 +1927,7 @@ mov_path_prevw_preview_init ( t_mov_path_preview *path_ptr )
* ============================================================================ * ============================================================================
*/ */
#define CHECKWIDTH 4 #define CHECKWIDTH 8
#define LIGHTCHECK 192 #define LIGHTCHECK 192
#define DARKCHECK 128 #define DARKCHECK 128
#ifndef OPAQUE #ifndef OPAQUE
@ -1921,7 +2021,7 @@ render_preview ( GtkWidget *preview, GPixelRgn *srcrgn )
/* ============================================================================ /* ============================================================================
* mov_path_prevw_draw * mov_path_prevw_draw
* Preview Rendering Util routine End * Preview Rendering Util routine End
* if update & PREVIEW, draw preview * if update & PATH_LINE, draw the path lines
* if update & CURSOR, draw cross cursor * if update & CURSOR, draw cross cursor
* ============================================================================ * ============================================================================
*/ */
@ -1929,12 +2029,67 @@ render_preview ( GtkWidget *preview, GPixelRgn *srcrgn )
static void static void
mov_path_prevw_draw ( t_mov_path_preview *path_ptr, gint update ) mov_path_prevw_draw ( t_mov_path_preview *path_ptr, gint update )
{ {
gint l_idx;
GdkColor fg;
guchar l_red, l_green, l_blue;
if( update & PREVIEW ) if( update & PREVIEW )
{ {
path_ptr->cursor = FALSE; path_ptr->cursor = FALSE;
if(gap_debug) printf("draw-preview\n"); if(gap_debug) printf("draw-preview\n");
} }
/* alternate cross cursor OR path graph */
if((path_ptr->show_path)
&& ( pvals != NULL )
&& (update & PATH_LINE))
{
if(gap_debug) printf("draw-preview re-render for PATH draw\n");
if((path_ptr->PixelRgnIsInitialized)
&& (path_ptr->preview))
{
/* redraw the preview
* (to clear path lines and cross cursor)
*/
gtk_widget_draw(path_ptr->preview, NULL);
}
gimp_palette_get_foreground(&l_red, &l_green, &l_blue);
fg.pixel = gdk_rgb_xpixel_from_rgb ((l_red << 16) | (l_green << 8) | l_blue);
gdk_gc_set_foreground (path_ptr->preview->style->black_gc, &fg);
p_points_to_tab(path_ptr);
for(l_idx = 0; l_idx < pvals->point_idx_max; l_idx++)
{
/* draw the path line(s) */
gdk_draw_line (path_ptr->preview->window,
path_ptr->preview->style->black_gc,
(pvals->point[l_idx].p_x * path_ptr->pwidth) / path_ptr->dwidth,
(pvals->point[l_idx].p_y * path_ptr->pheight) / path_ptr->dheight,
(pvals->point[l_idx +1].p_x * path_ptr->pwidth) / path_ptr->dwidth,
(pvals->point[l_idx +1].p_y * path_ptr->pheight) / path_ptr->dheight
);
/* draw the path point(s) */
gdk_draw_arc (path_ptr->preview->window, path_ptr->preview->style->black_gc, TRUE,
(pvals->point[l_idx +1].p_x * path_ptr->pwidth / path_ptr->dwidth) -RADIUS,
(pvals->point[l_idx +1].p_y * path_ptr->pheight / path_ptr->dheight) -RADIUS,
RADIUS * 2, RADIUS * 2, 0, 23040);
}
/* draw the start point */
gdk_draw_arc (path_ptr->preview->window, path_ptr->preview->style->black_gc, TRUE,
(pvals->point[0].p_x * path_ptr->pwidth / path_ptr->dwidth) -RADIUS,
(pvals->point[0].p_y * path_ptr->pheight / path_ptr->dheight) -RADIUS,
RADIUS * 2, RADIUS * 2, 0, 23040);
/* restore black gc */
fg.pixel = gdk_rgb_xpixel_from_rgb (0);
gdk_gc_set_foreground (path_ptr->preview->style->black_gc, &fg);
}
if( update & CURSOR ) if( update & CURSOR )
{ {
if(gap_debug) printf("draw-cursor %d old=%d,%d cur=%d,%d\n", if(gap_debug) printf("draw-cursor %d old=%d,%d cur=%d,%d\n",
@ -1985,7 +2140,7 @@ mov_path_x_adjustment_update( GtkWidget *widget,
if( !path_ptr->in_call ) if( !path_ptr->in_call )
{ {
mov_path_prevw_cursor_update( path_ptr ); mov_path_prevw_cursor_update( path_ptr );
mov_path_prevw_draw ( path_ptr, CURSOR ); mov_path_prevw_draw ( path_ptr, CURSOR | PATH_LINE );
} }
} }
} }
@ -2006,7 +2161,7 @@ mov_path_y_adjustment_update( GtkWidget *widget,
if( !path_ptr->in_call ) if( !path_ptr->in_call )
{ {
mov_path_prevw_cursor_update( path_ptr ); mov_path_prevw_cursor_update( path_ptr );
mov_path_prevw_draw ( path_ptr, CURSOR ); mov_path_prevw_draw ( path_ptr, CURSOR | PATH_LINE );
} }
} }
} }
@ -2042,7 +2197,16 @@ mov_path_prevw_preview_expose( GtkWidget *widget,
t_mov_path_preview *path_ptr; t_mov_path_preview *path_ptr;
path_ptr = gtk_object_get_user_data( GTK_OBJECT(widget) ); path_ptr = gtk_object_get_user_data( GTK_OBJECT(widget) );
if((!path_ptr->PixelRgnIsInitialized)
|| (path_ptr->in_call))
{
return FALSE;
}
path_ptr->in_call = TRUE;
mov_path_prevw_draw( path_ptr, ALL ); mov_path_prevw_draw( path_ptr, ALL );
path_ptr->in_call = FALSE;
return FALSE; return FALSE;
} }
@ -2058,18 +2222,39 @@ mov_path_prevw_preview_events ( GtkWidget *widget,
t_mov_path_preview *path_ptr; t_mov_path_preview *path_ptr;
GdkEventButton *bevent; GdkEventButton *bevent;
GdkEventMotion *mevent; GdkEventMotion *mevent;
gint upd_flag;
gint mouse_button;
path_ptr = gtk_object_get_user_data ( GTK_OBJECT(widget) ); path_ptr = gtk_object_get_user_data ( GTK_OBJECT(widget) );
/* HINT:
* smooth update of both CURSOR and PATH_LINE
* on every mousemove works fine on machines with 300MHz.
* for slower machines it is better to paint just the cross cursor,
* and refresh the path lines only at
* button press and release events
*/
/* upd_flag = CURSOR | PATH_LINE; */
upd_flag = CURSOR;
mouse_button = 0;
switch (event->type) switch (event->type)
{ {
case GDK_EXPOSE: case GDK_EXPOSE:
break; break;
case GDK_BUTTON_RELEASE:
bevent = (GdkEventButton *) event;
mouse_button = 0 - bevent->button;
goto mbuttons;
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
bevent = (GdkEventButton *) event; bevent = (GdkEventButton *) event;
mouse_button = bevent->button;
mbuttons:
path_ptr->curx = bevent->x; path_ptr->curx = bevent->x;
path_ptr->cury = bevent->y; path_ptr->cury = bevent->y;
upd_flag = CURSOR | PATH_LINE;
goto mouse; goto mouse;
case GDK_MOTION_NOTIFY: case GDK_MOTION_NOTIFY:
@ -2078,11 +2263,28 @@ mov_path_prevw_preview_events ( GtkWidget *widget,
path_ptr->curx = mevent->x; path_ptr->curx = mevent->x;
path_ptr->cury = mevent->y; path_ptr->cury = mevent->y;
mouse: mouse:
mov_path_prevw_draw( path_ptr, CURSOR ); if((mouse_button == 1)
&& (path_ptr->show_path))
{
/* Picking of pathpoints is done only if
* the left mousebutton goes down (mouse_button == 1)
* and only if Path is visible
*/
p_points_to_tab(path_ptr);
path_ptr->p_x = path_ptr->curx * path_ptr->dwidth / path_ptr->pwidth;
path_ptr->p_y = path_ptr->cury * path_ptr->dheight / path_ptr->pheight;
p_pick_nearest_point(path_ptr->p_x, path_ptr->p_y);
p_point_refresh(path_ptr);
}
else
{
path_ptr->p_x = path_ptr->curx * path_ptr->dwidth / path_ptr->pwidth;
path_ptr->p_y = path_ptr->cury * path_ptr->dheight / path_ptr->pheight;
p_points_to_tab(path_ptr);
mov_path_prevw_cursor_update( path_ptr );
}
mov_path_prevw_draw( path_ptr, upd_flag);
path_ptr->in_call = TRUE; path_ptr->in_call = TRUE;
path_ptr->p_x = path_ptr->curx * path_ptr->dwidth / path_ptr->pwidth;
path_ptr->p_y = path_ptr->cury * path_ptr->dheight / path_ptr->pheight;
gtk_adjustment_set_value (path_ptr->x_adj, gtk_adjustment_set_value (path_ptr->x_adj,
(gfloat)path_ptr->p_x); (gfloat)path_ptr->p_x);
gtk_adjustment_set_value (path_ptr->y_adj, gtk_adjustment_set_value (path_ptr->y_adj,
@ -2108,18 +2310,34 @@ GDrawable *
p_get_flattened_drawable(gint32 image_id) p_get_flattened_drawable(gint32 image_id)
{ {
GDrawable *l_drawable_ptr ; GDrawable *l_drawable_ptr ;
gint l_nlayers; GImageType l_type;
gint32 *l_layers_list; guint l_width, l_height;
gint32 l_layer_id;
/* get info about the image */
l_width = gimp_image_width(image_id);
l_height = gimp_image_height(image_id);
l_type = gimp_image_base_type(image_id);
gimp_image_flatten (image_id); l_type = (l_type * 2); /* convert from GImageType to GDrawableType */
/* get a list of layers for this image_ID */
l_layers_list = gimp_image_get_layers (image_id, &l_nlayers);
/* use top layer for preview (should be the onnly layer after flatten) */
l_drawable_ptr = gimp_drawable_get (l_layers_list[0]);
g_free (l_layers_list); /* add 2 full transparent dummy layers at top
* (because gimp_image_merge_visible_layers complains
* if there are less than 2 visible layers)
*/
l_layer_id = gimp_layer_new(image_id, "dummy",
l_width, l_height, l_type,
0.0, /* Opacity full transparent */
0); /* NORMAL */
gimp_image_add_layer(image_id, l_layer_id, 0);
l_layer_id = gimp_layer_new(image_id, "dummy",
10, 10, l_type,
0.0, /* Opacity full transparent */
0); /* NORMAL */
gimp_image_add_layer(image_id, l_layer_id, 0);
l_drawable_ptr = gimp_drawable_get (gimp_image_merge_visible_layers (image_id, GIMP_CLIP_TO_IMAGE));
return l_drawable_ptr; return l_drawable_ptr;
} /* end p_get_flattened_drawable */ } /* end p_get_flattened_drawable */
@ -2133,10 +2351,11 @@ p_get_flattened_drawable(gint32 image_id)
* ============================================================================ * ============================================================================
*/ */
GDrawable * p_get_prevw_drawable (t_mov_path_preview *path_ptr) GDrawable *
p_get_prevw_drawable (t_mov_path_preview *path_ptr)
{ {
t_mov_current l_curr; t_mov_current l_curr;
int l_nlayers; gint l_nlayers;
/* check if we have a source layer (to add to the preview) */ /* check if we have a source layer (to add to the preview) */
@ -2246,7 +2465,8 @@ void p_set_handle_offsets(t_mov_values *val_ptr, t_mov_current *cur_ptr)
* use my 'private' version of layercopy * use my 'private' version of layercopy
*/ */
int p_mov_render(gint32 image_id, t_mov_values *val_ptr, t_mov_current *cur_ptr) gint
p_mov_render(gint32 image_id, t_mov_values *val_ptr, t_mov_current *cur_ptr)
{ {
gint32 l_cp_layer_id; gint32 l_cp_layer_id;
gint32 l_cp_layer_mask_id; gint32 l_cp_layer_mask_id;
@ -2258,7 +2478,7 @@ int p_mov_render(gint32 image_id, t_mov_values *val_ptr, t_mov_current *cur_ptr)
guint l_orig_height; guint l_orig_height;
gint l_resized_flag; gint l_resized_flag;
gint32 l_interpolation; gint32 l_interpolation;
int lx1, ly1, lx2, ly2; gint lx1, ly1, lx2, ly2;
guint l_image_width; guint l_image_width;
guint l_image_height; guint l_image_height;

View File

@ -107,7 +107,7 @@ int p_mpege_info(t_anim_info *ainfo_ptr, char *errlist, t_gap_mpeg_encoder encod
l_idx = 0; l_idx = 0;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _("Conditions to run mpeg_encode 1.5:"); argv[l_idx].label_txt = _("Conditions to run mpeg_encode 1.5:");
if(encoder == MPEG2ENCODE) if(encoder == MPEG2ENCODE)
{ {
@ -116,11 +116,11 @@ int p_mpege_info(t_anim_info *ainfo_ptr, char *errlist, t_gap_mpeg_encoder encod
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = ""; argv[l_idx].label_txt = "";
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _("1.) mpeg_encode 1.5 must be installed"); argv[l_idx].label_txt = _("1.) mpeg_encode 1.5 must be installed");
if(encoder == MPEG2ENCODE) if(encoder == MPEG2ENCODE)
{ {
@ -128,7 +128,7 @@ int p_mpege_info(t_anim_info *ainfo_ptr, char *errlist, t_gap_mpeg_encoder encod
} }
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _(" you can get mpeg_encode at"); argv[l_idx].label_txt = _(" you can get mpeg_encode at");
if(encoder == MPEG2ENCODE) if(encoder == MPEG2ENCODE)
{ {
@ -136,7 +136,7 @@ int p_mpege_info(t_anim_info *ainfo_ptr, char *errlist, t_gap_mpeg_encoder encod
} }
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _(" ftp://mm-ftp.cs.berkeley.edu/pub/multimedia/mpeg/bmt1r1.tar.gz"); argv[l_idx].label_txt = _(" ftp://mm-ftp.cs.berkeley.edu/pub/multimedia/mpeg/bmt1r1.tar.gz");
if(encoder == MPEG2ENCODE) if(encoder == MPEG2ENCODE)
{ {
@ -144,11 +144,11 @@ int p_mpege_info(t_anim_info *ainfo_ptr, char *errlist, t_gap_mpeg_encoder encod
} }
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _("2.) You need a series of single Images on disk (AnimFrames)"); argv[l_idx].label_txt = _("2.) You need a series of single Images on disk (AnimFrames)");
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _(" all with fileformat JPEG (or YUV or PNM or PPM)"); argv[l_idx].label_txt = _(" all with fileformat JPEG (or YUV or PNM or PPM)");
if(encoder == MPEG2ENCODE) if(encoder == MPEG2ENCODE)
{ {
@ -156,31 +156,31 @@ int p_mpege_info(t_anim_info *ainfo_ptr, char *errlist, t_gap_mpeg_encoder encod
} }
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _(" (use 'Frames Convert' from the Video Menu"); argv[l_idx].label_txt = _(" (use 'Frames Convert' from the Video Menu");
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _(" or 'Split Img to Frames' from the Video Menu)"); argv[l_idx].label_txt = _(" or 'Split Img to Frames' from the Video Menu)");
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _("3.) All Images must have the same size,"); argv[l_idx].label_txt = _("3.) All Images must have the same size,");
if(encoder == MPEG_ENCODE) if(encoder == MPEG_ENCODE)
{ {
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _(" width and height must be a multiple of 16"); argv[l_idx].label_txt = _(" width and height must be a multiple of 16");
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = _(" (use Scale or Crop from the Video Menu)"); argv[l_idx].label_txt = _(" (use Scale or Crop from the Video Menu)");
} }
l_idx++; l_idx++;
p_init_arr_arg(&argv[l_idx], WGT_LABEL); p_init_arr_arg(&argv[l_idx], WGT_LABEL_LEFT);
argv[l_idx].label_txt = errlist; argv[l_idx].label_txt = errlist;
l_idx++; l_idx++;
@ -218,7 +218,6 @@ int p_mpege_dialog(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr, t_gap_mpeg_encoder
char *l_str; char *l_str;
static int gettextize_loop = 0; static int gettextize_loop = 0;
static char l_buf[MBUF_SIZE];
static char l_startscript[MBUF_SIZE]; static char l_startscript[MBUF_SIZE];
static char l_parfile[MBUF_SIZE]; static char l_parfile[MBUF_SIZE];
static char l_outfile[MBUF_SIZE]; static char l_outfile[MBUF_SIZE];
@ -246,13 +245,13 @@ int p_mpege_dialog(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr, t_gap_mpeg_encoder
b_argv[2].but_val = 1; b_argv[2].but_val = 1;
l_str = p_strdup_del_underscore(ainfo_ptr->basename); l_str = p_strdup_del_underscore(ainfo_ptr->basename);
sprintf (l_outfile, "%s.mpg", l_str); g_snprintf (l_outfile, MBUF_SIZE, "%s.mpg", l_str);
sprintf (l_parfile, "%s.par_mpg", l_str); g_snprintf (l_parfile, MBUF_SIZE, "%s.par_mpg", l_str);
sprintf (l_startscript, "%s.sh", l_str); g_snprintf (l_startscript, MBUF_SIZE, "%s.sh", l_str);
g_free(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 = "";
p_init_arr_arg(&argv[1], WGT_INT_PAIR); p_init_arr_arg(&argv[1], WGT_INT_PAIR);
argv[1].constraint = TRUE; argv[1].constraint = TRUE;
@ -285,6 +284,9 @@ int p_mpege_dialog(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr, t_gap_mpeg_encoder
argv[4].int_step = 100000; argv[4].int_step = 100000;
argv[4].int_max = 9000000; argv[4].int_max = 9000000;
argv[4].int_ret = 3000000; argv[4].int_ret = 3000000;
argv[4].umin = 100;
argv[4].entry_width = 80;
argv[4].pagestep = 1000000;
if(encoder == MPEG_ENCODE) l_idx = 12; if(encoder == MPEG_ENCODE) l_idx = 12;
else l_idx = 7; else l_idx = 7;
@ -315,8 +317,7 @@ int p_mpege_dialog(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr, t_gap_mpeg_encoder
if(encoder == MPEG_ENCODE) if(encoder == MPEG_ENCODE)
{ {
sprintf(l_buf, argv[0].label_txt = _("Generate parameterfile for mpeg_encode 1.5\n(the freely distributed Berkeley MPEG-1 Video Encoder.)\n");
_("Generate parameterfile for mpeg_encode 1.5\n(the freely distributed Berkeley MPEG-1 Video Encoder.)\n"));
p_init_arr_arg(&argv[5], WGT_TOGGLE); p_init_arr_arg(&argv[5], WGT_TOGGLE);
@ -324,7 +325,7 @@ int p_mpege_dialog(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr, t_gap_mpeg_encoder
argv[5].help_txt = _("Iqnore I/P/QSCALE values and use constant bit-rate)"); argv[5].help_txt = _("Iqnore I/P/QSCALE values and use constant bit-rate)");
argv[5].int_ret = 1; argv[5].int_ret = 1;
sprintf (l_pattern, "IBBPBBPBBPBBPBBP"); g_snprintf (l_pattern, MBUF_SIZE, "IBBPBBPBBPBBPBBP");
p_init_arr_arg(&argv[6], WGT_TEXT); p_init_arr_arg(&argv[6], WGT_TEXT);
argv[6].label_txt = _("Pattern:"); argv[6].label_txt = _("Pattern:");
argv[6].entry_width = 140; /* pixel */ argv[6].entry_width = 140; /* pixel */
@ -388,8 +389,7 @@ int p_mpege_dialog(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr, t_gap_mpeg_encoder
if(encoder == MPEG2ENCODE) if(encoder == MPEG2ENCODE)
{ {
sprintf(l_buf, argv[0].label_txt = _("Generate parameterfile for mpeg2encode 1.2\n(MPEG-2 Video Encoder.)\n");
_("Generate parameterfile for mpeg2encode 1.2\n(MPEG-2 Video Encoder.)\n"));
p_init_arr_arg(&argv[5], WGT_RADIO); p_init_arr_arg(&argv[5], WGT_RADIO);
argv[5].label_txt = _("MPEG-type :"); argv[5].label_txt = _("MPEG-type :");
@ -906,7 +906,7 @@ static
int p_mpege_gen_parfile(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr, t_gap_mpeg_encoder encoder) int p_mpege_gen_parfile(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr, t_gap_mpeg_encoder encoder)
{ {
int l_rc; int l_rc;
char l_cmd[256]; gchar *l_cmd;
l_rc = -1; l_rc = -1;
switch(encoder) switch(encoder)
@ -922,8 +922,9 @@ int p_mpege_gen_parfile(t_anim_info *ainfo_ptr, t_mpg_par *mp_ptr, t_gap_mpeg_en
if(l_rc >= 0) if(l_rc >= 0)
{ {
/* make startscript executable */ /* make startscript executable */
sprintf(l_cmd, "chmod a+x %s", mp_ptr->startscript); l_cmd = g_strdup_printf("chmod a+x %s", mp_ptr->startscript);
system(l_cmd); system(l_cmd);
g_free(l_cmd);
} }
return(l_rc); return(l_rc);
@ -947,7 +948,7 @@ int gap_mpeg_encode(GRunModeType run_mode,
gint l_height; gint l_height;
char *l_base_file_format; char *l_base_file_format;
char l_errlist[512]; char l_errlist[512];
char l_cmd[256]; char *l_cmd;
gint l_base_ffidx; gint l_base_ffidx;
l_rc = 0; l_rc = 0;
@ -1019,8 +1020,9 @@ int gap_mpeg_encode(GRunModeType run_mode,
if (l_genmode == 1) if (l_genmode == 1)
{ {
/* execute mpeg encoder startscript in an xterm window */ /* execute mpeg encoder startscript in an xterm window */
sprintf(l_cmd, "xterm -e %s &", mp_par.startscript); l_cmd = g_strdup_printf("xterm -e %s &", mp_par.startscript);
l_rc = system(l_cmd); l_rc = system(l_cmd);
g_free(l_cmd);
if(l_rc != 0) if(l_rc != 0)
{ {
fprintf(stderr, "ERROR: could not execute mpeg_encode (not installed or not in PATH)"); fprintf(stderr, "ERROR: could not execute mpeg_encode (not installed or not in PATH)");

View File

@ -32,6 +32,7 @@
*/ */
/* revision history /* revision history
* 1.1.17b 2000/02/26 hof: bugfixes
* 1.1.14a 2000/01/06 hof: gap_range_to_multilayer: use framerate (from video info file) in framenames * 1.1.14a 2000/01/06 hof: gap_range_to_multilayer: use framerate (from video info file) in framenames
* bugfix: gap_range_to_multilayer: first save current frame * bugfix: gap_range_to_multilayer: first save current frame
* 1.1.10a 1999/10/22 hof: bugfix: have to use the changed PDB-Interface * 1.1.10a 1999/10/22 hof: bugfix: have to use the changed PDB-Interface
@ -118,6 +119,8 @@ p_anim_sizechange_dialog(t_anim_info *ainfo_ptr, t_gap_asiz asiz_mode,
argv[0].constraint = FALSE; argv[0].constraint = FALSE;
argv[0].int_min = 1; argv[0].int_min = 1;
argv[0].int_max = 1024; argv[0].int_max = 1024;
argv[0].umin = 1;
argv[0].umax = 10000;
argv[0].int_ret = l_width; argv[0].int_ret = l_width;
p_init_arr_arg(&argv[1], WGT_INT_PAIR); p_init_arr_arg(&argv[1], WGT_INT_PAIR);
@ -125,6 +128,8 @@ p_anim_sizechange_dialog(t_anim_info *ainfo_ptr, t_gap_asiz asiz_mode,
argv[1].constraint = FALSE; argv[1].constraint = FALSE;
argv[1].int_min = 1; argv[1].int_min = 1;
argv[1].int_max = 1024; argv[1].int_max = 1024;
argv[1].umin = 1;
argv[1].umax = 10000;
argv[1].int_ret = l_height; argv[1].int_ret = l_height;
p_init_arr_arg(&argv[2], WGT_INT_PAIR); p_init_arr_arg(&argv[2], WGT_INT_PAIR);
@ -132,6 +137,8 @@ p_anim_sizechange_dialog(t_anim_info *ainfo_ptr, t_gap_asiz asiz_mode,
argv[2].constraint = FALSE; argv[2].constraint = FALSE;
argv[2].int_min = 0; argv[2].int_min = 0;
argv[2].int_max = l_width; argv[2].int_max = l_width;
argv[2].umin = 0;
argv[2].umax = 10000;
argv[2].int_ret = 0; argv[2].int_ret = 0;
p_init_arr_arg(&argv[3], WGT_INT_PAIR); p_init_arr_arg(&argv[3], WGT_INT_PAIR);
@ -139,6 +146,8 @@ p_anim_sizechange_dialog(t_anim_info *ainfo_ptr, t_gap_asiz asiz_mode,
argv[3].constraint = FALSE; argv[3].constraint = FALSE;
argv[3].int_min = 0; argv[3].int_min = 0;
argv[3].int_max = l_height; argv[3].int_max = l_height;
argv[3].umin = 0;
argv[3].umax = 10000;
argv[3].int_ret = 0; argv[3].int_ret = 0;
switch(asiz_mode) switch(asiz_mode)
@ -257,6 +266,8 @@ p_range_dialog(t_anim_info *ainfo_ptr,
argv[2].constraint = FALSE; argv[2].constraint = FALSE;
argv[2].int_min = 0; argv[2].int_min = 0;
argv[2].int_max = 99; argv[2].int_max = 99;
argv[2].umin = 0;
argv[2].umax = 999999;
argv[2].int_ret = 0; argv[2].int_ret = 0;
if(0 != p_chk_framerange(ainfo_ptr)) return -1; if(0 != p_chk_framerange(ainfo_ptr)) return -1;
@ -636,7 +647,7 @@ p_range_to_multilayer_dialog(t_anim_info *ainfo_ptr,
argv[6].radio_ret = 6; argv[6].radio_ret = 6;
/* Layer select pattern string */ /* Layer select pattern string */
sprintf (sel_pattern, "0"); g_snprintf (sel_pattern, 2, "0");
p_init_arr_arg(&argv[7], WGT_TEXT); p_init_arr_arg(&argv[7], WGT_TEXT);
argv[7].label_txt = _("Select Pattern:"); argv[7].label_txt = _("Select Pattern:");
argv[7].entry_width = 140; /* pixel */ argv[7].entry_width = 140; /* pixel */
@ -944,7 +955,7 @@ gint32 gap_range_to_multilayer(GRunModeType run_mode, gint32 image_id,
if(vin_ptr->framerate > 0) l_framerate = vin_ptr->framerate; if(vin_ptr->framerate > 0) l_framerate = vin_ptr->framerate;
g_free(vin_ptr); g_free(vin_ptr);
} }
sprintf(frame_basename, "frame_[####] (%dms)", (int)(1000/l_framerate)); g_snprintf(frame_basename, frame_basename_len, "frame_[####] (%dms)", (int)(1000/l_framerate));
framerate = 0; framerate = 0;
l_rc = p_range_to_multilayer_dialog (ainfo_ptr, &l_from, &l_to, l_rc = p_range_to_multilayer_dialog (ainfo_ptr, &l_from, &l_to,
&flatten_mode, &bg_visible, &flatten_mode, &bg_visible,

View File

@ -8,7 +8,7 @@ gint p_plug_in_nova_iter_ALT(GRunModeType run_mode, gint32 total_steps, gdouble
{ {
gint xcenter; gint xcenter;
gint ycenter; gint ycenter;
t_gint_color color; t_color color;
gint radius; gint radius;
gint nspoke; gint nspoke;
gint randomhue; gint randomhue;
@ -32,7 +32,7 @@ gint p_plug_in_nova_iter_ALT(GRunModeType run_mode, gint32 total_steps, gdouble
p_delta_gint(&buf.xcenter, buf_from->xcenter, buf_to->xcenter, total_steps, current_step); p_delta_gint(&buf.xcenter, buf_from->xcenter, buf_to->xcenter, total_steps, current_step);
p_delta_gint(&buf.ycenter, buf_from->ycenter, buf_to->ycenter, total_steps, current_step); p_delta_gint(&buf.ycenter, buf_from->ycenter, buf_to->ycenter, total_steps, current_step);
p_delta_gint_color(&buf.color, &buf_from->color, &buf_to->color, total_steps, current_step); p_delta_color(&buf.color, &buf_from->color, &buf_to->color, total_steps, current_step);
p_delta_gint(&buf.radius, buf_from->radius, buf_to->radius, total_steps, current_step); p_delta_gint(&buf.radius, buf_from->radius, buf_to->radius, total_steps, current_step);
p_delta_gint(&buf.nspoke, buf_from->nspoke, buf_to->nspoke, total_steps, current_step); p_delta_gint(&buf.nspoke, buf_from->nspoke, buf_to->nspoke, total_steps, current_step);
p_delta_gint(&buf.randomhue, buf_from->randomhue, buf_to->randomhue, total_steps, current_step); p_delta_gint(&buf.randomhue, buf_from->randomhue, buf_to->randomhue, total_steps, current_step);

View File

@ -14,7 +14,7 @@ gint p_plug_in_papertile_iter_ALT(GRunModeType run_mode, gint32 total_steps, gdo
long centering; long centering;
long wrap_around; long wrap_around;
long background_type; long background_type;
gdouble background_color[4]; guchar background_color[4];
} t_plug_in_papertile_Vals; } t_plug_in_papertile_Vals;
int l_idx; int l_idx;
@ -45,7 +45,7 @@ gint p_plug_in_papertile_iter_ALT(GRunModeType run_mode, gint32 total_steps, gdo
for(l_idx=0; l_idx < 4; l_idx++) for(l_idx=0; l_idx < 4; l_idx++)
{ {
p_delta_gdouble(&buf.background_color[l_idx], buf_from->background_color[l_idx], buf_to->background_color[l_idx], total_steps, current_step); p_delta_guchar(&buf.background_color[l_idx], buf_from->background_color[l_idx], buf_to->background_color[l_idx], total_steps, current_step);
} }
gimp_set_data("plug_in_papertile", &buf, sizeof(buf)); gimp_set_data("plug_in_papertile", &buf, sizeof(buf));

View File

@ -11,6 +11,14 @@ gint p_plug_in_sparkle_iter_ALT(GRunModeType run_mode, gint32 total_steps, gdoub
gdouble spike_len; gdouble spike_len;
gdouble spike_pts; gdouble spike_pts;
gdouble spike_angle; gdouble spike_angle;
gdouble density;
gdouble opacity;
gdouble random_hue;
gdouble random_saturation;
gint preserve_luminosity;
gint invers;
gint border;
gint colortype;
} t_plug_in_sparkle_Vals; } t_plug_in_sparkle_Vals;
t_plug_in_sparkle_Vals buf, *buf_from, *buf_to; t_plug_in_sparkle_Vals buf, *buf_from, *buf_to;
@ -34,6 +42,14 @@ gint p_plug_in_sparkle_iter_ALT(GRunModeType run_mode, gint32 total_steps, gdoub
p_delta_gdouble(&buf.spike_len, buf_from->spike_len, buf_to->spike_len, total_steps, current_step); p_delta_gdouble(&buf.spike_len, buf_from->spike_len, buf_to->spike_len, total_steps, current_step);
p_delta_gdouble(&buf.spike_pts, buf_from->spike_pts, buf_to->spike_pts, total_steps, current_step); p_delta_gdouble(&buf.spike_pts, buf_from->spike_pts, buf_to->spike_pts, total_steps, current_step);
p_delta_gdouble(&buf.spike_angle, buf_from->spike_angle, buf_to->spike_angle, total_steps, current_step); p_delta_gdouble(&buf.spike_angle, buf_from->spike_angle, buf_to->spike_angle, total_steps, current_step);
p_delta_gdouble(&buf.density, buf_from->density, buf_to->density, total_steps, current_step);
p_delta_gdouble(&buf.opacity, buf_from->opacity, buf_to->opacity, total_steps, current_step);
p_delta_gdouble(&buf.random_hue, buf_from->random_hue, buf_to->random_hue, total_steps, current_step);
p_delta_gdouble(&buf.random_saturation, buf_from->random_saturation, buf_to->random_saturation, total_steps, current_step);
p_delta_gint(&buf.preserve_luminosity, buf_from->preserve_luminosity, buf_to->preserve_luminosity, total_steps, current_step);
p_delta_gint(&buf.invers, buf_from->invers, buf_to->invers, total_steps, current_step);
p_delta_gint(&buf.border, buf_from->border, buf_to->border, total_steps, current_step);
p_delta_gint(&buf.colortype, buf_from->colortype, buf_to->colortype, total_steps, current_step);
gimp_set_data("plug_in_sparkle", &buf, sizeof(buf)); gimp_set_data("plug_in_sparkle", &buf, sizeof(buf));